mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
fixed test, versioned old file.
This commit is contained in:
parent
c34d467672
commit
329ed16b58
204
angular-material/angular-material-0.9.0.d.ts
vendored
Normal file
204
angular-material/angular-material-0.9.0.d.ts
vendored
Normal file
@ -0,0 +1,204 @@
|
||||
// Type definitions for Angular Material 0.9.0-rc1+ (angular.material module)
|
||||
// Project: https://github.com/angular/material
|
||||
// Definitions by: Matt Traynham <https://github.com/mtraynham>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="../angularjs/angular.d.ts" />
|
||||
declare module angular.material {
|
||||
|
||||
interface MDBottomSheetOptions {
|
||||
templateUrl?: string;
|
||||
template?: string;
|
||||
scope?: angular.IScope; // default: new child scope
|
||||
preserveScope?: boolean; // default: false
|
||||
controller?: string|Function;
|
||||
locals?: {[index: string]: any};
|
||||
targetEvent?: MouseEvent;
|
||||
resolve?: {[index: string]: angular.IPromise<any>}
|
||||
controllerAs?: string;
|
||||
parent?: string|Element|JQuery; // default: root node
|
||||
disableParentScroll?: boolean; // default: true
|
||||
}
|
||||
|
||||
interface MDBottomSheetService {
|
||||
show(options: MDBottomSheetOptions): angular.IPromise<any>;
|
||||
hide(response?: any): void;
|
||||
cancel(response?: any): void;
|
||||
}
|
||||
|
||||
interface MDPresetDialog<T> {
|
||||
title(title: string): T;
|
||||
content(content: string): T;
|
||||
ok(ok: string): T;
|
||||
theme(theme: string): T;
|
||||
}
|
||||
|
||||
interface MDAlertDialog extends MDPresetDialog<MDAlertDialog> {
|
||||
}
|
||||
|
||||
interface MDConfirmDialog extends MDPresetDialog<MDConfirmDialog> {
|
||||
cancel(cancel: string): MDConfirmDialog;
|
||||
}
|
||||
|
||||
interface MDDialogOptions {
|
||||
templateUrl?: string;
|
||||
template?: string;
|
||||
targetEvent?: MouseEvent;
|
||||
scope?: angular.IScope; // default: new child scope
|
||||
preserveScope?: boolean; // default: false
|
||||
disableParentScroll?: boolean; // default: true
|
||||
hasBackdrop?: boolean // default: true
|
||||
clickOutsideToClose?: boolean; // default: false
|
||||
escapeToClose?: boolean; // default: true
|
||||
focusOnOpen?: boolean; // default: true
|
||||
controller?: string|Function;
|
||||
locals?: {[index: string]: any};
|
||||
bindToController?: boolean; // default: false
|
||||
resolve?: {[index: string]: angular.IPromise<any>}
|
||||
controllerAs?: string;
|
||||
parent?: string|Element|JQuery; // default: root node
|
||||
onComplete?: Function;
|
||||
}
|
||||
|
||||
interface MDDialogService {
|
||||
show(dialog: MDDialogOptions|MDAlertDialog|MDConfirmDialog): angular.IPromise<any>;
|
||||
confirm(): MDConfirmDialog;
|
||||
alert(): MDAlertDialog;
|
||||
hide(response?: any): void;
|
||||
cancel(response?: any): void;
|
||||
}
|
||||
|
||||
interface MDIcon {
|
||||
(id: string): angular.IPromise<Element>; // id is a unique ID or URL
|
||||
}
|
||||
|
||||
interface MDIconProvider {
|
||||
icon(id: string, url: string, iconSize?: string): MDIconProvider; // iconSize default: '24px'
|
||||
iconSet(id: string, url: string, iconSize?: string): MDIconProvider; // iconSize default: '24px'
|
||||
defaultIconSet(url: string, iconSize?: string): MDIconProvider; // iconSize default: '24px'
|
||||
defaultIconSize(iconSize: string): MDIconProvider; // default: '24px'
|
||||
}
|
||||
|
||||
interface MDMedia {
|
||||
(media: string): boolean;
|
||||
}
|
||||
|
||||
interface MDSidenavObject {
|
||||
toggle(): angular.IPromise<void>;
|
||||
open(): angular.IPromise<void>;
|
||||
close(): angular.IPromise<void>;
|
||||
isOpen(): boolean;
|
||||
isLockedOpen(): boolean;
|
||||
}
|
||||
|
||||
interface MDSidenavService {
|
||||
(component: string): MDSidenavObject;
|
||||
}
|
||||
|
||||
interface MDToastPreset<T> {
|
||||
content(content: string): T;
|
||||
action(action: string): T;
|
||||
highlightAction(highlightAction: boolean): T;
|
||||
capsule(capsule: boolean): T;
|
||||
theme(theme: string): T;
|
||||
hideDelay(delay: number): T;
|
||||
position(position: string): T;
|
||||
}
|
||||
|
||||
interface MDSimpleToastPreset extends MDToastPreset<MDSimpleToastPreset> {
|
||||
}
|
||||
|
||||
interface MDToastOptions {
|
||||
templateUrl?: string;
|
||||
template?: string;
|
||||
scope?: angular.IScope; // default: new child scope
|
||||
preserveScope?: boolean; // default: false
|
||||
hideDelay?: number; // default (ms): 3000
|
||||
position?: string; // any combination of 'bottom'/'left'/'top'/'right'/'fit'; default: 'bottom left'
|
||||
controller?: string|Function;
|
||||
locals?: {[index: string]: any};
|
||||
bindToController?: boolean; // default: false
|
||||
resolve?: {[index: string]: angular.IPromise<any>}
|
||||
controllerAs?: string;
|
||||
parent?: string|Element|JQuery; // default: root node
|
||||
}
|
||||
|
||||
interface MDToastService {
|
||||
show(optionsOrPreset: MDToastOptions|MDToastPreset<any>): angular.IPromise<any>;
|
||||
showSimple(): angular.IPromise<any>;
|
||||
simple(): MDSimpleToastPreset;
|
||||
build(): MDToastPreset<any>;
|
||||
updateContent(): void;
|
||||
hide(response?: any): void;
|
||||
cancel(response?: any): void;
|
||||
}
|
||||
|
||||
interface MDPalette {
|
||||
0?: string;
|
||||
50?: string;
|
||||
100?: string;
|
||||
200?: string;
|
||||
300?: string;
|
||||
400?: string;
|
||||
500?: string;
|
||||
600?: string;
|
||||
700?: string;
|
||||
800?: string;
|
||||
900?: string;
|
||||
A100?: string;
|
||||
A200?: string;
|
||||
A400?: string;
|
||||
A700?: string;
|
||||
contrastDefaultColor?: string;
|
||||
contrastDarkColors?: string;
|
||||
contrastStrongLightColors?: string;
|
||||
}
|
||||
|
||||
interface MDThemeHues {
|
||||
default?: string;
|
||||
'hue-1'?: string;
|
||||
'hue-2'?: string;
|
||||
'hue-3'?: string;
|
||||
}
|
||||
|
||||
interface MDThemePalette {
|
||||
name: string;
|
||||
hues: MDThemeHues;
|
||||
}
|
||||
|
||||
interface MDThemeColors {
|
||||
accent: MDThemePalette;
|
||||
background: MDThemePalette;
|
||||
primary: MDThemePalette;
|
||||
warn: MDThemePalette;
|
||||
}
|
||||
|
||||
interface MDThemeGrayScalePalette {
|
||||
1: string;
|
||||
2: string;
|
||||
3: string;
|
||||
4: string;
|
||||
name: string;
|
||||
}
|
||||
|
||||
interface MDTheme {
|
||||
name: string;
|
||||
isDark: boolean;
|
||||
colors: MDThemeColors;
|
||||
foregroundPalette: MDThemeGrayScalePalette;
|
||||
foregroundShadow: string;
|
||||
accentPalette(name: string, hues?: MDThemeHues): MDTheme;
|
||||
primaryPalette(name: string, hues?: MDThemeHues): MDTheme;
|
||||
warnPalette(name: string, hues?: MDThemeHues): MDTheme;
|
||||
backgroundPalette(name: string, hues?: MDThemeHues): MDTheme;
|
||||
dark(isDark?: boolean): MDTheme;
|
||||
}
|
||||
|
||||
interface MDThemingProvider {
|
||||
theme(name: string, inheritFrom?: string): MDTheme;
|
||||
definePalette(name: string, palette: MDPalette): MDThemingProvider;
|
||||
extendPalette(name: string, palette: MDPalette): MDPalette;
|
||||
setDefaultTheme(theme: string): void;
|
||||
alwaysWatchTheme(alwaysWatch: boolean): void;
|
||||
}
|
||||
}
|
||||
@ -3,11 +3,11 @@
|
||||
var myApp = angular.module('testModule', ['ngMaterial']);
|
||||
|
||||
myApp.config((
|
||||
$mdThemingProvider: ng.material.MDThemingProvider,
|
||||
$mdIconProvider: ng.material.MDIconProvider) => {
|
||||
$mdThemingProvider: ng.material.IThemingProvider,
|
||||
$mdIconProvider: ng.material.IIconProvider) => {
|
||||
|
||||
$mdThemingProvider.alwaysWatchTheme(true);
|
||||
var neonRedMap: ng.material.MDPalette = $mdThemingProvider.extendPalette('red', {
|
||||
var neonRedMap: ng.material.IPalette = $mdThemingProvider.extendPalette('red', {
|
||||
'500': 'ff0000'
|
||||
});
|
||||
// Register the new color palette map with the name <code>neonRed</code>
|
||||
@ -27,7 +27,7 @@ myApp.config((
|
||||
.icon('work:chair', 'my/app/chair.svg'); // Register icon in a specific set
|
||||
});
|
||||
|
||||
myApp.controller('BottomSheetController', ($scope: ng.IScope, $mdBottomSheet: ng.material.MDBottomSheetService) => {
|
||||
myApp.controller('BottomSheetController', ($scope: ng.IScope, $mdBottomSheet: ng.material.IBottomSheetService) => {
|
||||
$scope['openBottomSheet'] = () => {
|
||||
$mdBottomSheet.show({
|
||||
template: '<md-bottom-sheet>Hello!</md-bottom-sheet>'
|
||||
@ -37,7 +37,7 @@ myApp.controller('BottomSheetController', ($scope: ng.IScope, $mdBottomSheet: ng
|
||||
$scope['cancelBottomSheet'] = $mdBottomSheet.cancel.bind($mdBottomSheet, 'cancel');
|
||||
});
|
||||
|
||||
myApp.controller('DialogController', ($scope: ng.IScope, $mdDialog: ng.material.MDDialogService) => {
|
||||
myApp.controller('DialogController', ($scope: ng.IScope, $mdDialog: ng.material.IDialogService) => {
|
||||
$scope['openDialog'] = () => {
|
||||
$mdDialog.show({
|
||||
template: '<md-dialog>Hello!</md-dialog>'
|
||||
@ -55,8 +55,8 @@ myApp.controller('DialogController', ($scope: ng.IScope, $mdDialog: ng.material.
|
||||
|
||||
class IconDirective implements ng.IDirective {
|
||||
|
||||
private $mdIcon: ng.material.MDIcon;
|
||||
constructor($mdIcon: ng.material.MDIcon) {
|
||||
private $mdIcon: ng.material.IIcon;
|
||||
constructor($mdIcon: ng.material.IIcon) {
|
||||
this.$mdIcon = $mdIcon;
|
||||
}
|
||||
|
||||
@ -69,9 +69,9 @@ class IconDirective implements ng.IDirective {
|
||||
});
|
||||
}
|
||||
}
|
||||
myApp.directive('icon-directive', ($mdIcon: ng.material.MDIcon) => new IconDirective($mdIcon));
|
||||
myApp.directive('icon-directive', ($mdIcon: ng.material.IIcon) => new IconDirective($mdIcon));
|
||||
|
||||
myApp.controller('MediaController', ($scope: ng.IScope, $mdMedia: ng.material.MDMedia) => {
|
||||
myApp.controller('MediaController', ($scope: ng.IScope, $mdMedia: ng.material.IMedia) => {
|
||||
$scope.$watch(() => $mdMedia('lg'), (big: boolean) => {
|
||||
$scope['bigScreen'] = big;
|
||||
});
|
||||
@ -80,7 +80,7 @@ myApp.controller('MediaController', ($scope: ng.IScope, $mdMedia: ng.material.MD
|
||||
$scope['anotherCustom'] = $mdMedia('max-width: 300px');
|
||||
});
|
||||
|
||||
myApp.controller('SidenavController', ($scope: ng.IScope, $mdSidenav: ng.material.MDSidenavService) => {
|
||||
myApp.controller('SidenavController', ($scope: ng.IScope, $mdSidenav: ng.material.ISidenavService) => {
|
||||
var componentId = 'left';
|
||||
$scope['toggle'] = () => $mdSidenav(componentId).toggle();
|
||||
$scope['open'] = () => $mdSidenav(componentId).open();
|
||||
@ -89,6 +89,6 @@ myApp.controller('SidenavController', ($scope: ng.IScope, $mdSidenav: ng.materia
|
||||
$scope['isLockedOpen'] = $mdSidenav(componentId).isLockedOpen();
|
||||
});
|
||||
|
||||
myApp.controller('ToastController', ($scope: ng.IScope, $mdToast: ng.material.MDToastService) => {
|
||||
myApp.controller('ToastController', ($scope: ng.IScope, $mdToast: ng.material.IToastService) => {
|
||||
$scope['openToast'] = () => $mdToast.show($mdToast.simple().content('Hello!'));
|
||||
});
|
||||
Loading…
Reference in New Issue
Block a user