##// END OF EJS Templates
created typings for basic part of dojo and dijit further work is required to...
cin -
r2:8ec37bf1b4d1 default
parent child
Show More
@@ -0,0 +1,107
1 import DropDownButton = require("./form/DropDownButton");
2 import _Widget = require("./_Widget");
3 import _TemplatedMixin = require("./_TemplatedMixin");
4 import { _WidgetBaseConstructor } from "./_WidgetBase";
5 import { CSSStateNodes, _CssStateMixin } from "./_CssStateMixin";
6 import { _MonthWidgetConstructor, CalendarLite } from "./CalendarLite";
7
8 interface _MonthDropDownButton extends DropDownButton<_MonthDropDown> {
9 onMonthSelect(): void;
10 postCreate(): void;
11
12 set(name: 'month', value: number): this;
13 set(name: string, value: any): this;
14 set(values: Object): this;
15 }
16
17 type _MonthDropDownButtonConstructor = _WidgetBaseConstructor<_MonthDropDownButton>;
18
19 interface _MonthDropDown extends _Widget, _TemplatedMixin, _CssStateMixin {
20 months: string[];
21 baseClass: string;
22 templateString: string;
23
24 /**
25 * Callback when month is selected from drop down
26 */
27 onChange(month: number): void;
28
29 set(name: 'months', value: string[]): this;
30 set(name: string, value: any): this;
31 set(values: Object): this;
32 }
33
34 type _MonthDropDownConstructor = _WidgetBaseConstructor<_MonthDropDown>;
35
36 interface Calendar extends CalendarLite, _Widget, _CssStateMixin {
37
38 baseClass: string;
39
40 /**
41 * Set node classes for various mouse events, see dijit._CssStateMixin for more details
42 */
43 cssStateNodes: CSSStateNodes;
44
45 /**
46 * Creates the drop down button that displays the current month and lets user pick a new one
47 */
48 _createMonthWidget(): _MonthDropDownButton;
49
50 postCreate(): void;
51
52 /**
53 * Handler for when user selects a month from the drop down list
54 */
55 _onMonthSelect(newMonth: number): void;
56
57 /**
58 * Handler for mouse over events on days, sets hovered style
59 */
60 _onDayMouseOver(evt: MouseEvent): void;
61
62 /**
63 * Handler for mouse out events on days, clears hovered style
64 */
65 _onDayMouseOut(evt: MouseEvent): void;
66 _onDayMouseDown(evt: MouseEvent): void;
67 _onDayMouseUp(evt: MouseEvent): void;
68
69 /**
70 * Provides keyboard navigation of calendar.
71 */
72 handleKey(evt: KeyboardEvent): void;
73
74 /**
75 * For handling keydown events on a stand alone calendar
76 */
77 _onKeyDown(evt: KeyboardEvent): void;
78
79 /**
80 * Deprecated. Notification that a date cell was selected. It may be the same as the previous value.
81 */
82 onValueSelected(date: Date): void;
83
84 onChange(date: Date): void;
85
86 /**
87 * May be overridden to return CSS classes to associate with the date entry for the given dateObject
88 * for example to indicate a holiday in specified locale.
89 */
90 getClassForDate(dateObject: Date, locale?: string): string;
91
92 get(name: 'value'): Date;
93 get(name: string): any;
94
95 set(name: 'value', value: number | Date): this;
96 set(name: string, value: any): this;
97 set(values: Object): this;
98 }
99
100 interface CalendarConstructor extends _WidgetBaseConstructor<Calendar> {
101 _MonthWidget: _MonthWidgetConstructor;
102 _MonthDropDown: _MonthDropDownButtonConstructor;
103 _MonthDropDownButton: _MonthDropDownButtonConstructor;
104 }
105
106 declare const Calendar: CalendarConstructor;
107 export = Calendar;
@@ -0,0 +1,181
1 import _WidgetBase = require("./_WidgetBase");
2 import { _WidgetBaseConstructor } from "./_WidgetBase";
3 import _TemplatedMixin = require("./_TemplatedMixin");
4
5 declare namespace CalendarLite {
6 interface _MonthWidget extends _WidgetBase {
7 set(name: 'month', value: Date): this;
8 set(name: string, value: any): this;
9 set(values: Object): this;
10 }
11
12 type _MonthWidgetConstructor = _WidgetBaseConstructor<_MonthWidget>;
13
14 interface CalendarLite extends _WidgetBase, _TemplatedMixin {
15 /**
16 * Template for main calendar
17 */
18 templateString: string;
19
20 /**
21 * Template for cell for a day of the week (ex: M)
22 */
23 dowTemplateString: string;
24
25 dateTemplateString: string;
26 weekTemplateString: string;
27
28 /**
29 * The currently selected Date, initially set to invalid date to indicate no selection.
30 */
31 value: Date;
32
33 /**
34 * JavaScript namespace to find calendar routines. If unspecified, uses Gregorian calendar routines
35 * at dojo/date and dojo/date/locale.
36 */
37 datePackage: string;
38
39 /**
40 * How to represent the days of the week in the calendar header. See locale
41 */
42 dayWidth: string;
43
44 /**
45 * Order fields are traversed when user hits the tab key
46 */
47 tabIndex: string;
48
49 /**
50 * (Optional) The first day of week override. By default the first day of week is determined
51 * for the current locale (extracted from the CLDR).
52 * Special value -1 (default value), means use locale dependent value.
53 */
54 dayOffset: number;
55
56 /**
57 * Date object containing the currently focused date, or the date which would be focused
58 * if the calendar itself was focused. Also indicates which year and month to display,
59 * i.e. the current "page" the calendar is on.
60 */
61 currentFocus: Date;
62
63 /**
64 * Put the summary to the node with role=grid
65 */
66 _setSummaryAttr: string;
67
68 baseClass: string;
69
70 /**
71 * Runs various tests on the value, checking that it's a valid date, rather
72 * than blank or NaN.
73 */
74 _isValidDate(value: Date): boolean;
75
76 /**
77 * Convert Number into Date, or copy Date object. Then, round to nearest day,
78 * setting to 1am to avoid issues when DST shift occurs at midnight, see #8521, #9366)
79 */
80 _patchDate(value: number | Date): Date;
81
82 /**
83 * This just sets the content of node to the specified text.
84 * Can't do "node.innerHTML=text" because of an IE bug w/tables, see #3434.
85 */
86 _setText(node: HTMLElement, text?: string): void;
87
88 /**
89 * Fills in the calendar grid with each day (1-31).
90 * Call this on creation, when moving to a new month.
91 */
92 _populateGrid(): void;
93
94 /**
95 * Fill in localized month, and prev/current/next years
96 */
97 _populateControls(): void;
98
99 /**
100 * Sets calendar's value to today's date
101 */
102 goToToday(): void;
103
104 /**
105 * Creates the drop down button that displays the current month and lets user pick a new one
106 */
107 _createMonthWidget(): void;
108
109 buildRendering(): void;
110 postCreate(): void;
111
112 /**
113 * Set up connects for increment/decrement of months/years
114 */
115 _connectControls(): void;
116
117 /**
118 * If the calendar currently has focus, then focuses specified date,
119 * changing the currently displayed month/year if necessary.
120 * If the calendar doesn't have focus, updates currently
121 * displayed month/year, and sets the cell that will get focus
122 * when Calendar is focused.
123 */
124 _setCurrentFocusAttr(date: Date, forceFocus?: boolean): void;
125
126 /**
127 * Focus the calendar by focusing one of the calendar cells
128 */
129 focus(): void;
130
131 /**
132 * Handler for day clicks, selects the date if appropriate
133 */
134 _onDayClick(evt: MouseEvent): void;
135
136 /**
137 * Returns the cell corresponding to the date, or null if the date is not within the currently
138 * displayed month.
139 */
140 _getNodeByDate(value: Date): HTMLElement;
141
142 /**
143 * Marks the specified cells as selected, and clears cells previously marked as selected.
144 * For CalendarLite at most one cell is selected at any point, but this allows an array
145 * for easy subclassing.
146 */
147 _markSelectedDates(dates: Date[]): void;
148
149 /**
150 * Called only when the selected date has changed
151 */
152 onChange(date: Date): void;
153
154 /**
155 * May be overridden to disable certain dates in the calendar e.g. `isDisabledDate=dojo.date.locale.isWeekend`
156 */
157 isDisabledDate(dateObject: Date, locale?: string): boolean;
158
159 /**
160 * May be overridden to return CSS classes to associate with the date entry for the given dateObject,
161 * for example to indicate a holiday in specified locale.
162 */
163 getClassForDate(dateObject: Date, locale?: string): string;
164
165 get(name: 'value'): Date;
166 get(name: string): any;
167
168 set(name: 'value', value: number | Date): this;
169 set(name: string, value: any): this;
170 set(values: Object): this;
171 }
172
173 interface CalendarLiteConstructor extends _WidgetBaseConstructor<CalendarLite> {
174 _MonthWidget: _MonthWidgetConstructor;
175 }
176
177 }
178
179 declare type CalendarLite = CalendarLite.CalendarLite;
180 declare const CalendarLite: CalendarLite.CalendarLiteConstructor;
181 export = CalendarLite;
@@ -0,0 +1,8
1 import { _ConfirmDialogMixin } from "./_ConfirmDialogMixin";
2 import { DialogConstructor } from "./Dialog";
3
4 interface ConfirmDialog extends _ConfirmDialogMixin { }
5
6 type ConfirmDialogConstructor = DialogConstructor;
7 declare const ConfirmDialog: ConfirmDialogConstructor;
8 export = ConfirmDialog;
@@ -0,0 +1,24
1 import { DeclareConstructor } from "dojo/_base/declare";
2
3 interface Destroyable {
4 _destroyed?: true;
5
6 /**
7 * Destroy this class, releasing any resources registered via own().
8 */
9 destroy(preserveDom?: boolean): void;
10
11 /**
12 * Track specified handles and remove/destroy them when this instance is destroyed, unless they were
13 * already removed/destroyed manually.
14 */
15 own(...args: any[]): any[];
16 }
17
18 /**
19 * Mixin to track handles and release them when instance is destroyed.
20 */
21 interface DestroyableConstructor extends DeclareConstructor<Destroyable> { }
22
23 declare const Destroyable: DestroyableConstructor;
24 export = Destroyable;
@@ -0,0 +1,147
1 import _TemplatedMixin = require("./_TemplatedMixin");
2 import _FormMixin = require("./form/_FormMixin");
3 import _DialogMixin = require("./_DialogMixin");
4 import _CssStateMixin = require("./_CssStateMixin");
5 import { CSSStateNodes } from "./_CssStateMixin";
6 import DojoPromise = require("dojo/promise/Promise");
7 import { DomGeometryWidthHeight } from "dojo/dom-geometry";
8 import { _WidgetBaseConstructor, _WidgetBase } from "./_WidgetBase";
9 import ContentPane = require("./layout/ContentPane");
10
11 interface _DialogBase extends _TemplatedMixin, _FormMixin, _DialogMixin, _CssStateMixin {
12 templateString: string;
13 baseClass: string;
14 cssStateNodes: CSSStateNodes;
15
16 /**
17 * True if Dialog is currently displayed on screen.
18 */
19 open: boolean;
20
21 /**
22 * The time in milliseconds it takes the dialog to fade in and out
23 */
24 duration: number;
25
26 /**
27 * A Toggle to modify the default focus behavior of a Dialog, which
28 * is to re-focus the element which had focus before being opened.
29 * False will disable refocusing. Default: true
30 */
31 refocus: boolean;
32
33 /**
34 * A Toggle to modify the default focus behavior of a Dialog, which
35 * is to focus on the first dialog element after opening the dialog.
36 * False will disable autofocusing. Default: true
37 */
38 autofocus: boolean;
39
40 /**
41 * Toggles the movable aspect of the Dialog. If true, Dialog
42 * can be dragged by it's title. If false it will remain centered
43 * in the viewport.
44 */
45 draggable: boolean;
46
47 /**
48 * Maximum size to allow the dialog to expand to, relative to viewport size
49 */
50 maxRatio: number;
51
52 /**
53 * Dialog show [x] icon to close itself, and ESC key will close the dialog.
54 */
55 closable: boolean;
56 postMixInProperties(): void;
57 postCreate(): void;
58
59 /**
60 * Called when data has been loaded from an href.
61 * Unlike most other callbacks, this function can be connected to (via `dojo.connect`)
62 * but should *not* be overridden.
63 */
64 onLoad(data?: any): void;
65
66 focus(): void;
67
68 /* Not entirely sure of the resolution type of these promises */
69
70 /**
71 * Display the dialog
72 */
73 show(): DojoPromise<any>;
74
75 /**
76 * Hide the dialog
77 */
78 hide(): DojoPromise<any>;
79
80 /**
81 * Called with no argument when viewport scrolled or viewport size changed. Adjusts Dialog as
82 * necessary to keep it visible.
83 *
84 * Can also be called with an argument (by dojox/layout/ResizeHandle etc.) to explicitly set the
85 * size of the dialog.
86 */
87 resize(dim?: DomGeometryWidthHeight): void;
88
89 destroy(preserveDom?: boolean): void;
90 }
91
92 type _DialogBaseConstructor = _WidgetBaseConstructor<_DialogBase>;
93
94 interface Dialog extends ContentPane, _DialogBase {
95 /* overrides conflicting methods */
96 resize(dim?: DomGeometryWidthHeight): void;
97 }
98
99 interface DialogLevelManager {
100 _beginZIndex: number;
101
102 /**
103 * Call right before fade-in animation for new dialog.
104 *
105 * Saves current focus, displays/adjusts underlay for new dialog,
106 * and sets the z-index of the dialog itself.
107 *
108 * New dialog will be displayed on top of all currently displayed dialogs.
109 * Caller is responsible for setting focus in new dialog after the fade-in
110 * animation completes.
111 */
112 show(dialog: _WidgetBase, underlayAttrs: Object): void;
113
114 /**
115 * Called when the specified dialog is hidden/destroyed, after the fade-out
116 * animation ends, in order to reset page focus, fix the underlay, etc.
117 * If the specified dialog isn't open then does nothing.
118 *
119 * Caller is responsible for either setting display:none on the dialog domNode,
120 * or calling dijit/popup.hide(), or removing it from the page DOM.
121 */
122 hide(dialog: _WidgetBase): void;
123
124 /**
125 * Returns true if specified Dialog is the top in the task
126 */
127 isTop(dialog: _WidgetBase): boolean;
128 }
129
130 declare namespace Dialog {
131
132 interface DialogConstructor extends _WidgetBaseConstructor<Dialog> {
133 /**
134 * for monkey patching and dojox/widget/DialogSimple
135 */
136 _DialogBase: _DialogBaseConstructor;
137 _DialogLevelManager: DialogLevelManager;
138 _dialogStack: {
139 dialog: _WidgetBase,
140 focus: any,
141 underlayAttrs: any
142 }[];
143 }
144 }
145
146 declare const Dialog: Dialog.DialogConstructor;
147 export = Dialog;
@@ -0,0 +1,12
1 import _MenuBase = require("./_MenuBase");
2 import { _WidgetBaseConstructor } from "./_WidgetBase";
3
4 /**
5 * A menu, without features for context menu (Meaning, drop down menu)
6 */
7 interface DropDownMenu extends _MenuBase { }
8
9 type DropDownMenuConstructor = _WidgetBaseConstructor<DropDownMenu>;
10
11 declare const DropDownMenu: DropDownMenuConstructor;
12 export = DropDownMenu;
@@ -0,0 +1,14
1 import { _WidgetBaseConstructor } from "./_WidgetBase";
2 import TitlePane = require("./TitlePane");
3
4 /**
5 * An accessible fieldset that can be expanded or collapsed via
6 * its legend. Fieldset extends `dijit.TitlePane`.
7 */
8 interface Fieldset extends TitlePane {
9 open: boolean;
10 }
11
12 type FieldsetConstructor = _WidgetBaseConstructor<Fieldset>;
13 declare const Fieldset: FieldsetConstructor;
14 export = Fieldset;
@@ -0,0 +1,54
1 import DropDownMenu = require("./DropDownMenu");
2 import { _WidgetBaseConstructor } from "./_WidgetBase";
3
4 /**
5 * A context menu you can assign to multiple elements
6 */
7 interface Menu extends DropDownMenu {
8 /**
9 * Array of dom node ids of nodes to attach to.
10 * Fill this with nodeIds upon widget creation and it becomes context menu for those nodes.
11 */
12 targetNodeIds: string[];
13
14 /**
15 * CSS expression to apply this Menu to descendants of targetNodeIds, rather than to
16 * the nodes specified by targetNodeIds themselves. Useful for applying a Menu to
17 * a range of rows in a table, tree, etc.
18 *
19 * The application must require() an appropriate level of dojo/query to handle the selector.
20 */
21 selector: string;
22
23 /**
24 * If true, right clicking anywhere on the window will cause this context menu to open.
25 * If false, must specify targetNodeIds.
26 */
27 contextMenuForWindow: boolean;
28
29 /**
30 * If true, menu will open on left click instead of right click, similar to a file menu.
31 */
32 leftClickToOpen: boolean;
33
34 /**
35 * When this menu closes, re-focus the element which had focus before it was opened.
36 */
37 refocus: boolean;
38
39 /**
40 * Attach menu to given node
41 */
42 bindDomNode(node: string | Node): void;
43
44 /**
45 * Detach menu from given node
46 */
47 unBindDomNode(nodeName: string | Node): void;
48 }
49
50 interface MenuConstructor extends _WidgetBaseConstructor<Menu> { }
51
52 declare const Menu: MenuConstructor;
53 export = Menu;
54 No newline at end of file
@@ -0,0 +1,23
1 import _MenuBase = require("./_MenuBase");
2 import _WidgetBase = require("./_WidgetBase");
3 import { _WidgetBaseConstructor } from "./_WidgetBase";
4
5 interface MenuBar extends _MenuBase {
6 baseClass: 'dijitMenuBar';
7 popupDelay: number;
8 _isMenuBar: true;
9 _orient: string[];
10 _moveToPopup(evt: Event): void;
11 focusChild(item: _WidgetBase): void;
12 _onChildDeselect(item: _WidgetBase): void;
13 _onLeftArrow(): void;
14 _onRightArrow(): void;
15 _onDownArrow(): void;
16 _onUpArrow(): void;
17 onItemClick(item: _WidgetBase, evt: Event): void;
18 }
19
20 interface MenuBarConstructor extends _WidgetBaseConstructor<MenuBar> { }
21
22 declare const MenuBar: MenuBarConstructor;
23 export = MenuBar No newline at end of file
@@ -0,0 +1,9
1 import MenuItem = require("./MenuItem");
2 import { _WidgetBaseConstructor } from "./_WidgetBase";
3
4 interface MenuBarItem extends MenuItem { }
5
6 interface MenuBarItemConstructor extends _WidgetBaseConstructor<MenuBarItem> { }
7
8 declare const MenuBarItem: MenuBarItemConstructor;
9 export = MenuBarItem;
@@ -0,0 +1,69
1 import _Widget = require("./_Widget");
2 import _TemplatedMixin = require("./_TemplatedMixin");
3 import _Contained = require("./_Contained");
4 import _CssStateMixin = require("./_CssStateMixin");
5 import { _WidgetBaseConstructor } from "./_WidgetBase";
6
7 interface MenuItem extends _Widget, _TemplatedMixin, _Contained, _CssStateMixin {
8 /**
9 * Text for the accelerator (shortcut) key combination, a control, alt, etc. modified keystroke meant to execute the menu item regardless of where the focus is on the page.
10 *
11 * Note that although Menu can display accelerator keys, there is no infrastructure to actually catch and execute those accelerators.
12 */
13 accelKey: string;
14
15 /**
16 * If true, the menu item is disabled.
17 * If false, the menu item is enabled.
18 */
19 disabled: boolean;
20
21 /** Menu text as HTML */
22 label: string;
23
24 /**
25 * Class to apply to DOMNode to make it display an icon.
26 */
27 iconClass: string;
28
29 /**
30 * Hook for attr('accelKey', ...) to work.
31 * Set accelKey on this menu item.
32 */
33 _setAccelKeyAttr(value: string): void;
34
35 /**
36 * Hook for attr('disabled', ...) to work.
37 * Enable or disable this menu item.
38 */
39 _setDisabledAttr(value: boolean): void;
40
41 _setLabelAttr(val: string): void;
42 _setIconClassAttr(val: string): void;
43
44 _fillContent(source: Element): void;
45
46 /**
47 * Indicate that this node is the currently selected one
48 */
49 _setSelected(selected: boolean): void;
50
51 focus(): void;
52
53 /**
54 * Deprecated.
55 * Use set('disabled', bool) instead.
56 */
57 setDisabled(disabled: boolean): void;
58
59 /**
60 * Deprecated.
61 * Use set('label', ...) instead.
62 */
63 setLabel(content: string): void;
64 }
65
66 interface MenuItemConstructor extends _WidgetBaseConstructor<MenuItem> { }
67
68 declare const MenuItem: MenuItemConstructor;
69 export = MenuItem; No newline at end of file
@@ -0,0 +1,11
1 import _WidgetBase = require("./_WidgetBase");
2 import _TemplatedMixin = require("./_TemplatedMixin");
3 import _Contained = require("./_Contained");
4 import { _WidgetBaseConstructor } from "./_WidgetBase";
5
6 interface MenuSeparator extends _WidgetBase, _TemplatedMixin, _Contained { }
7
8 interface MenuSeparatorConstructor extends _WidgetBaseConstructor<MenuSeparator> { }
9
10 declare const MenuSeparator: MenuSeparatorConstructor;
11 export = MenuSeparator;
@@ -0,0 +1,9
1 import { _WidgetBaseConstructor } from "./_WidgetBase";
2 import PopupMenuItem = require("./PopupMenuItem");
3
4 interface PopupMenuBarItem extends PopupMenuItem { }
5
6 interface PopupMenuBarItemConstructor extends _WidgetBaseConstructor<PopupMenuBarItem> { }
7
8 declare const PopupMenuBarItem: PopupMenuBarItemConstructor;
9 export = PopupMenuBarItem;
@@ -0,0 +1,27
1 import MenuItem = require("./MenuItem");
2 import { _WidgetBaseConstructor } from "./_WidgetBase";
3
4 /**
5 * An item in a Menu that spawn a drop down (usually a drop down menu)
6 */
7 interface PopupMenuItem extends MenuItem {
8 /**
9 * When Menu is declared in markup, this code gets the menu label and the popup widget from the srcNodeRef.
10 *
11 * srcNodeRef.innerHTML contains both the menu item text and a popup widget
12 * The first part holds the menu item text and the second part is the popup
13 */
14 _fillContent(source: Element): void;
15
16 /**
17 * Open the popup to the side of/underneath this MenuItem, and optionally focus first item
18 */
19 _openPopup(params: { around?: Element; popup?: Function }, focus?: boolean): void;
20
21 _closePopup(): void;
22 }
23
24 interface PopupMenuItemConstructor extends _WidgetBaseConstructor<PopupMenuItem> { }
25
26 declare const PopupMenuItem: PopupMenuItemConstructor;
27 export = PopupMenuItem;
@@ -0,0 +1,58
1 import ContentPane = require("./layout/ContentPane");
2 import _TemplatedMixin = require("./_TemplatedMixin");
3 import _CssStateMixin = require("./_CssStateMixin");
4 import { _WidgetBaseConstructor } from "./_WidgetBase";
5
6 interface TitlePane extends ContentPane, _TemplatedMixin, _CssStateMixin {
7 /**
8 * Whether pane can be opened or closed by clicking the title bar.
9 */
10 toggleable: boolean;
11
12 /**
13 * Tabindex setting for the title (so users can tab to the title then use space/enter to open/close the title pane)
14 */
15 tabIndex: string;
16
17 /**
18 * Time in milliseconds to fade in/fade out
19 */
20 duration: number;
21
22 /**
23 * Don't change this parameter from the default value.
24 *
25 * This ContentPane parameter doesn't make sense for TitlePane, since TitlePane is never a child of a layout container, nor should TitlePane try to control the size of an inner widget.
26 */
27 doLayout: boolean;
28
29 /**
30 * Switches between opened and closed state
31 */
32 toggle(): void;
33
34 /**
35 * Set the open/close css state for the TitlePane
36 */
37 _setCss(): void;
38
39 /**
40 * Handler for when user hits a key
41 */
42 _onTitleKey(e: Event): void;
43
44 /**
45 * Handler when user clicks the title bar
46 */
47 _onTitleClick(): void;
48
49 /**
50 * Deprecated. Use set('title', ...) instead.
51 */
52 setTitle(): void;
53 }
54
55 interface TitlePaneConstructor extends _WidgetBaseConstructor<TitlePane> { }
56
57 declare const TitlePane: TitlePaneConstructor;
58 export = TitlePane; No newline at end of file
@@ -0,0 +1,11
1 import _Widget = require("./_Widget");
2 import _TemplatedMixin = require("./_TemplatedMixin");
3 import _KeyNavContainer = require("./_KeyNavContainer");
4 import { _WidgetBaseConstructor } from "./_WidgetBase";
5
6 interface Toolbar extends _Widget, _TemplatedMixin, _KeyNavContainer { }
7
8 interface ToolbarConstructor extends _WidgetBaseConstructor<Toolbar> { }
9
10 declare const Toolbar: ToolbarConstructor;
11 export = Toolbar;
@@ -0,0 +1,10
1 import _Widget = require("./_Widget");
2 import _TemplatedMixin = require("./_TemplatedMixin");
3 import { _WidgetBaseConstructor } from "./_WidgetBase";
4
5 interface ToolbarSeparator extends _Widget, _TemplatedMixin { }
6
7 interface ToolbarSeparatorConstructor extends _WidgetBaseConstructor<ToolbarSeparator> { }
8
9 declare const ToolbarSeparator: ToolbarSeparatorConstructor;
10 export = ToolbarSeparatorConstructor;
@@ -0,0 +1,121
1 import _Widget = require("./_Widget");
2 import { NodeOrString } from "dojo/interfaces";
3 import dojo = require("dojo/_base/html");
4 import { _WidgetBaseConstructor } from "./_WidgetBase";
5 import { PlaceRectangle } from "./place";
6
7 interface Tooltip extends _Widget {
8 /**
9 * HTML to display in the tooltip.
10 * Specified as innerHTML when creating the widget from markup.
11 */
12 label: string;
13
14 /**
15 * Number of milliseconds to wait after hovering over/focusing on the object, before
16 * the tooltip is displayed.
17 */
18 showDelay: number;
19
20 /**
21 * Number of milliseconds to wait after unhovering the object, before
22 * the tooltip is hidden. Note that blurring an object hides the tooltip immediately.
23 */
24 hideDelay: number;
25
26 /**
27 * Id of domNode(s) to attach the tooltip to.
28 * When user hovers over specified dom node(s), the tooltip will appear.
29 */
30 connectId: NodeOrString | NodeOrString[];
31
32 /**
33 * See description of `dijit/Tooltip.defaultPosition` for details on position parameter.
34 */
35 position: string;
36
37 /**
38 * CSS expression to apply this Tooltip to descendants of connectIds, rather than to
39 * the nodes specified by connectIds themselves. Useful for applying a Tooltip to
40 * a range of rows in a table, tree, etc. Use in conjunction with getContent() parameter.
41 * Ex: connectId: myTable, selector: "tr", getContent: function(node){ return ...; }
42 *
43 * The application must require() an appropriate level of dojo/query to handle the selector.
44 */
45 selector: string;
46
47 /**
48 * Attach tooltip to specified node if it's not already connected
49 */
50 addTarget(node: NodeOrString): void;
51
52 /**
53 * Detach tooltip from specified node
54 */
55 removeTarget(node: NodeOrString): void;
56
57 /**
58 * User overridable function that return the text to display in the tooltip.
59 */
60 getContent(node: Node): Node;
61
62 /**
63 * Display the tooltip; usually not called directly.
64 */
65 open(target: Node): void;
66
67 /**
68 * Hide the tooltip or cancel timer for show of tooltip
69 */
70 close(): void;
71
72 /**
73 * Called when the tooltip is shown
74 */
75 onShow(): void;
76
77 /**
78 * Called when the tooltip is hidden
79 */
80 onHide(): void;
81 }
82
83 interface TooltipConstructor extends _WidgetBaseConstructor<Tooltip> {
84 /**
85 * This variable controls the position of tooltips, if the position is not specified to
86 * the Tooltip widget or *TextBox widget itself. It's an array of strings with the values
87 * possible for `dijit/place.around()`. The recommended values are:
88 *
89 * - before-centered: centers tooltip to the left of the anchor node/widget, or to the right
90 * in the case of RTL scripts like Hebrew and Arabic
91 * - after-centered: centers tooltip to the right of the anchor node/widget, or to the left
92 * in the case of RTL scripts like Hebrew and Arabic
93 * - above-centered: tooltip is centered above anchor node
94 * - below-centered: tooltip is centered above anchor node
95 *
96 * The list is positions is tried, in order, until a position is found where the tooltip fits
97 * within the viewport.
98 *
99 * Be careful setting this parameter. A value of "above-centered" may work fine until the user scrolls
100 * the screen so that there's no room above the target node. Nodes with drop downs, like
101 * DropDownButton or FilteringSelect, are especially problematic, in that you need to be sure
102 * that the drop down and tooltip don't overlap, even when the viewport is scrolled so that there
103 * is only room below (or above) the target node, but not both.
104 */
105 defaultPosition: [string];
106
107 /**
108 * Static method to display tooltip w/specified contents in specified position.
109 * See description of dijit/Tooltip.defaultPosition for details on position parameter.
110 * If position is not specified then dijit/Tooltip.defaultPosition is used.
111 */
112 show(innerHTML: string, aroundNode: PlaceRectangle, position?: [string], rtl?: boolean, textDir?: string, onMouseEnter?: Function, onMouseLeave?: Function): void;
113
114 /**
115 * Hide the tooltip
116 */
117 hide(aroundNode: PlaceRectangle): void;
118 }
119
120 declare const Tooltip: TooltipConstructor;
121 export = Tooltip;
@@ -0,0 +1,75
1 import ContentPane = require("./layout/ContentPane");
2 import _TemplatedMixin = require("./_TemplatedMixin");
3 import _FormMixin = require("./form/_FormMixin");
4 import _DialogMixin = require("./_DialogMixin");
5 import { _WidgetBaseConstructor } from "./_WidgetBase";
6 import { PlaceCorner, PlacePosition } from "./place";
7
8 interface TooltipDialog extends ContentPane, _TemplatedMixin, _FormMixin, _DialogMixin {
9 /**
10 * Description of tooltip dialog (required for a11y)
11 */
12 title: string;
13
14 /**
15 * Don't change this parameter from the default value.
16 * This ContentPane parameter doesn't make sense for TooltipDialog, since TooltipDialog
17 * is never a child of a layout container, nor can you specify the size of
18 * TooltipDialog in order to control the size of an inner widget.
19 */
20 doLayout: boolean;
21
22 /**
23 * A Toggle to modify the default focus behavior of a Dialog, which
24 * is to focus on the first dialog element after opening the dialog.
25 * False will disable autofocusing. Default: true.
26 */
27 autofocus: boolean;
28
29 /**
30 * The pointer to the first focusable node in the dialog.
31 */
32 _firstFocusItem: any;
33
34 /**
35 * The pointer to which node has focus prior to our dialog.
36 */
37 _lastFocusItem: any;
38
39 /**
40 * Configure widget to be displayed in given position relative to the button.
41 *
42 * This is called from the dijit.popup code, and should not be called directly.
43 */
44 orient(node: Node | HTMLElement, aroundCorner: PlaceCorner, tooltipCorner: PlaceCorner): void;
45
46 /**
47 * Focus on first field
48 */
49 focus(): void;
50
51 /**
52 * Called when dialog is displayed.
53 *
54 * This is called from the dijit.popup code, and should not be called directly.
55 */
56 onOpen(pos: {
57 aroundCorner: PlaceCorner
58 aroundNodePos: PlacePosition
59 corner: PlaceCorner
60 x: number
61 y: number
62 }): void;
63
64 /**
65 * Handler for keydown events
66 *
67 * Keep keyboard focus in dialog; close dialog on escape key
68 */
69 _onKey(evt: KeyboardEvent): void;
70 }
71
72 interface TooltipDialogConstructor extends _WidgetBaseConstructor<TooltipDialog> { }
73
74 declare const TooltipDialog: TooltipDialogConstructor;
75 export = TooltipDialog;
@@ -0,0 +1,87
1 import { DeclareConstructor } from "dojo/_base/declare";
2 import { Handle } from "dojo/interfaces";
3 import _WidgetBase = require("./_WidgetBase");
4
5 declare module "./_WidgetBase" {
6 interface _WidgetBase {
7 dojoAttachEvent: string;
8 dojoAttachPoint: string;
9 }
10 }
11
12 declare module "dojo/_base/kernel" {
13 interface Dijit {
14 _AttachMixin: _AttachMixinConstructor;
15 }
16 }
17
18 interface _AttachMixin {
19 /**
20 * List of widget attribute names associated with data-dojo-attach-point=... in the template, ex: ["containerNode", "labelNode"]
21 */
22 _attachPoints: string[];
23
24 /**
25 * List of connections associated with data-dojo-attach-event=... in the template
26 */
27 _attachEvents: Handle[];
28
29 /**
30 * Object to which attach points and events will be scoped. Defaults to 'this'.
31 */
32 attachScope: any;
33
34 /**
35 * Search descendants of this.containerNode for data-dojo-attach-point and data-dojo-attach-event.
36 *
37 * Should generally be left false (the default value) both for performance and to avoid failures when this.containerNode holds other _AttachMixin instances with their own attach points and events.
38 */
39 searchContainerNode: boolean;
40
41 /**
42 * Attach to DOM nodes marked with special attributes.
43 */
44 buildRendering(): void;
45
46 /**
47 * hook for _WidgetsInTemplateMixin
48 */
49 _beforeFillContent(): void;
50
51 /**
52 * Iterate through the dom nodes and attach functions and nodes accordingly.
53 *
54 * Map widget properties and functions to the handlers specified in the dom node and it's descendants. This function iterates over all nodes and looks for these properties:
55 * - dojoAttachPoint/data-dojo-attach-point
56 * - dojoAttachEvent/data-dojo-attach-event
57 */
58 _attachTemplateNodes(rootNode: Element | Node): void;
59
60 /**
61 * Process data-dojo-attach-point and data-dojo-attach-event for given node or widget.
62 *
63 * Returns true if caller should process baseNode's children too.
64 */
65 _processTemplateNode<T extends (Element | Node | _WidgetBase)>(
66 baseNode: T,
67 getAttrFunc: (baseNode: T, attr: string) => string,
68 attachFunc: (node: T, type: string, func?: Function) => Handle
69 ): boolean;
70
71 /**
72 * Roughly corresponding to dojo/on, this is the default function for processing a data-dojo-attach-event. Meant to attach to DOMNodes, not to widgets.
73 */
74 _attach(node: Element | Node, type: string, func?: Function): Handle;
75
76 /**
77 * Detach and clean up the attachments made in _attachtempalteNodes.
78 */
79 _detachTemplateNodes(): void;
80
81 destroyRendering(preserveDom?: boolean): void;
82 }
83
84 interface _AttachMixinConstructor extends DeclareConstructor<_AttachMixin> { }
85
86 declare const _AttachMixin: _AttachMixinConstructor;
87 export = _AttachMixin;
@@ -0,0 +1,27
1 import { DeclareConstructor } from "dojo/_base/declare";
2
3 interface _BidiMixin {
4
5 /**
6 * Gets the right direction of text.
7 */
8 getTextDir(text: string): string;
9
10 /**
11 * Set element.dir according to this.textDir, assuming this.textDir has a value.
12 */
13 applyTextDir(element: HTMLElement, text?: string): void;
14
15 /**
16 * Wraps by UCC (Unicode control characters) option's text according to this.textDir
17 */
18 enforceTextDirWithUcc(option: HTMLOptionElement, text: string): string;
19
20 /**
21 * Restores the text of origObj, if needed, after enforceTextDirWithUcc, e.g. set("textDir", textDir).
22 */
23 restoreOriginalText(origObj: HTMLOptionElement): HTMLOptionElement;
24 }
25
26 declare const _BidiMixin: DeclareConstructor<_BidiMixin>;
27 export = _BidiMixin;
@@ -0,0 +1,28
1 import _WidgetBase = require("./_WidgetBase");
2
3 declare module "./_WidgetBase" {
4 interface _WidgetBase {
5
6 /**
7 * Gets the right direction of text.
8 */
9 getTextDir(text: string): string;
10
11 /**
12 * Set element.dir according to this.textDir, assuming this.textDir has a value.
13 */
14 applyTextDir(element: HTMLElement, text?: string): void;
15
16 /**
17 * Wraps by UCC (Unicode control characters) option's text according to this.textDir
18 */
19 enforceTextDirWithUcc(option: HTMLOptionElement, text: string): string;
20
21 /**
22 * Restores the text of origObj, if needed, after enforceTextDirWithUcc, e.g. set("textDir", textDir).
23 */
24 restoreOriginalText(origObj: HTMLOptionElement): HTMLOptionElement;
25 }
26 }
27
28 export = _WidgetBase;
@@ -0,0 +1,29
1 import { DeclareConstructor } from "dojo/_base/declare";
2 import _WidgetsInTemplateMixin = require("./_WidgetsInTemplateMixin");
3
4 interface _ConfirmDialogMixin extends _WidgetsInTemplateMixin {
5 /**
6 * HTML snippet for action bar, overrides _DialogMixin.actionBarTemplate
7 */
8 actionBarTemplate: string;
9
10 /**
11 * Label of OK button.
12 */
13 buttonOk: string;
14
15 /**
16 * Label of cancel button.
17 */
18 buttonCancel: string;
19 }
20
21 type _ConfirmDialogMixinContructor = DeclareConstructor<_ConfirmDialogMixin>;
22
23 declare const _ConfirmDialogMixin: _ConfirmDialogMixinContructor
24
25 declare module "dojo/_base/kernel" {
26 interface Dijit {
27 _ConfirmDialogMixin: _ConfirmDialogMixinContructor;
28 }
29 }
@@ -0,0 +1,33
1 import { DeclareConstructor } from "dojo/_base/declare";
2 import _WidgetBase = require("./_WidgetBase");
3
4 interface _Contained {
5 /**
6 * Returns the previous child of the parent or null if this is the
7 * first child of the parent.
8 */
9 getPreviousSibling<T extends _WidgetBase>(): T;
10
11 /**
12 * Returns the next child of the parent or null if this is the last
13 * child of the parent.
14 */
15 getNextSibling<T extends _WidgetBase>(): T;
16
17 /**
18 * Returns the index of this widget within its container parent.
19 * It returns -1 if the parent does not exist or if the parent is
20 * not a dijit/_Container.
21 */
22 getIndexInParent(): number;
23 }
24
25 declare module "dojo/_base/kernel" {
26 interface Dijit {
27 _Contained: _ContainedConstructor;
28 }
29 }
30
31 type _ContainedConstructor = DeclareConstructor<_Contained>;
32 declare const _Contained: _ContainedConstructor;
33 export = _Contained;
@@ -0,0 +1,39
1 import { DeclareConstructor } from "dojo/_base/declare";
2 import _WidgetBase = require("./_WidgetBase");
3
4 interface _Container {
5 buildRendering(): void;
6
7 /**
8 * Makes the given widget a child of this widget.
9 */
10 addChild<T extends _WidgetBase>(widget: T, insertIndex?: number): void;
11
12 /**
13 * Removes the passed widget instance from this widget but does
14 * not destroy it. You can also pass in an integer indicating
15 * the index within the container to remove (ie, removeChild(5) removes the sixth widget)
16 */
17 removeChild<T extends _WidgetBase>(widget: T): void;
18 removeChild<T extends number>(widget: number): void;
19
20 /**
21 * Returns true if widget has child widgets, i.e. if this.containerNode contains widgets.
22 */
23 hasChildren(): boolean;
24
25 /**
26 * Gets the index of the child in this container or -1 if not found
27 */
28 getIndexOfChild<T extends _WidgetBase>(widget: T): number;
29 }
30
31 declare module "dojo/_base/kernel" {
32 interface Dijit {
33 _Container: _ContainerConstructor
34 }
35 }
36
37 type _ContainerConstructor = DeclareConstructor<_Container>;
38 declare const _Container: _ContainerConstructor;
39 export = _Container;
@@ -0,0 +1,31
1 import { DeclareConstructor } from "dojo/_base/declare";
2
3 declare namespace _CssStateMixin {
4 interface CSSStateNodes {
5 [node: string]: string;
6 }
7
8
9 interface _CssStateMixin {
10 /**
11 * True if cursor is over this widget
12 */
13 hovering: boolean;
14
15 /**
16 * True if mouse was pressed while over this widget, and hasn't been released yet
17 */
18 active: boolean;
19 }
20 }
21
22 declare module "dojo/_base/kernel" {
23 interface Dijit {
24 _CssStateMixin: _CssStateMixinConstructor
25 }
26 }
27
28 type _CssStateMixin = _CssStateMixin._CssStateMixin;
29 type _CssStateMixinConstructor = DeclareConstructor<_CssStateMixin>;
30 declare const _CssStateMixin: _CssStateMixinConstructor;
31 export = _CssStateMixin;
@@ -0,0 +1,35
1 import { DeclareConstructor } from "dojo/_base/declare";
2
3 interface _DialogMixin {
4 /**
5 * HTML snippet to show the action bar (gray bar with OK/cancel buttons).
6 * Blank by default, but used by ConfirmDialog/ConfirmTooltipDialog subclasses.
7 */
8 actionBarTemplate: string;
9
10 /**
11 * Callback when the user hits the submit button.
12 * Override this method to handle Dialog execution.
13 */
14 execute(formContents?: any): void;
15
16 /**
17 * Called when user has pressed the Dialog's cancel button, to notify container.
18 */
19 onCancel(): void;
20
21 /**
22 * Called when user has pressed the dialog's OK button, to notify container.
23 */
24 onExecute(): void;
25 }
26
27 declare module "dojo/_base/kernel" {
28 interface Dijit {
29 _DialogMixin: _DialogMixinConstructor
30 }
31 }
32
33 type _DialogMixinConstructor = DeclareConstructor<_DialogMixin>;
34 declare const _DialogMixin: _DialogMixinConstructor;
35 export = _DialogMixin;
@@ -0,0 +1,42
1 import { DeclareConstructor } from "dojo/_base/declare";
2 import { FocusManager } from "./focus";
3
4 declare module "./_WidgetBase" {
5
6 interface _WidgetBase {
7 /**
8 * This widget or a widget it contains has focus, or is "active" because
9 * it was recently clicked.
10 */
11 focused: boolean;
12
13 /**
14 * Called when the widget becomes "active" because
15 * it or a widget inside of it either has focus, or has recently
16 * been clicked.
17 */
18 onFocus(): void;
19
20 /**
21 * Called when the widget stops being "active" because
22 * focus moved to something outside of it, or the user
23 * clicked somewhere outside of it, or the widget was
24 * hidden.
25 */
26 onBlur(): void;
27 }
28 }
29
30 interface _FocusMixin {
31 _focusManager: FocusManager;
32 }
33
34 declare module "dojo/_base/kernel" {
35 interface Dijit {
36 _FocusMixin: _FocusMixinConstructor;
37 }
38 }
39
40 type _FocusMixinConstructor = DeclareConstructor<_FocusMixin>;
41 declare const _FocusMixin: _FocusMixinConstructor;
42 export = _FocusMixin;
@@ -0,0 +1,140
1 import _FocusMixin = require("./_FocusMixin");
2 import _WidgetBase = require("./_WidgetBase");
3 import { Deferred } from "dojo/Deferred";
4 import { PlaceLocation } from "./place";
5
6 interface _HasDropDown<T extends _WidgetBase> extends _FocusMixin {
7 /**
8 * The button/icon/node to click to display the drop down.
9 * Can be set via a data-dojo-attach-point assignment.
10 * If missing, then either focusNode or domNode (if focusNode is also missing) will be used.
11 */
12 _buttonNode: HTMLElement;
13
14 /**
15 * Will set CSS class dijitUpArrow, dijitDownArrow, dijitRightArrow etc. on this node depending
16 * on where the drop down is set to be positioned.
17 * Can be set via a data-dojo-attach-point assignment.
18 * If missing, then _buttonNode will be used.
19 */
20 _arrowWrapperNode: HTMLElement;
21
22 /**
23 * The node to set the aria-expanded class on.
24 * Also sets popupActive class but that will be removed in 2.0.
25 * Can be set via a data-dojo-attach-point assignment.
26 * If missing, then focusNode or _buttonNode (if focusNode is missing) will be used.
27 */
28 _popupStateNode: HTMLElement;
29
30 /**
31 * The node to display the popup around.
32 * Can be set via a data-dojo-attach-point assignment.
33 * If missing, then domNode will be used.
34 */
35 _aroundNode: HTMLElement;
36
37 /**
38 * The widget to display as a popup. This widget *must* be
39 * defined before the startup function is called.
40 */
41 dropDown: T;
42
43 /**
44 * Set to true to make the drop down at least as wide as this
45 * widget. Set to false if the drop down should just be its
46 * default width.
47 */
48 autoWidth: boolean;
49
50 /**
51 * Set to true to make the drop down exactly as wide as this
52 * widget. Overrides autoWidth.
53 */
54 forceWidth: boolean;
55
56 /**
57 * The max height for our dropdown.
58 * Any dropdown taller than this will have scrollbars.
59 * Set to 0 for no max height, or -1 to limit height to available space in viewport
60 */
61 maxHeight: number;
62
63 /**
64 * This variable controls the position of the drop down.
65 * It's an array of strings
66 */
67 dropDownPosition: string[];
68 /* TODO remove for TS 1.8 */
69 /* dropDownPosition: ('before' | 'after' | 'above' | 'below')[]; */
70
71 /**
72 * When set to false, the click events will not be stopped, in
73 * case you want to use them in your subclass
74 */
75 _stopClickEvents: boolean;
76
77 /**
78 * Callback when the user mousedown/touchstart on the arrow icon.
79 */
80 _onDropDownMouseDown(e: MouseEvent): void;
81
82 /**
83 * Callback on mouseup/touchend after mousedown/touchstart on the arrow icon.
84 * Note that this function is called regardless of what node the event occurred on (but only after
85 * a mousedown/touchstart on the arrow).
86 */
87 _onDropDownMouseUp(e?: MouseEvent): void;
88
89 /**
90 * The drop down was already opened on mousedown/keydown; just need to stop the event
91 */
92 _onDropDownClick(e: MouseEvent): void;
93
94 buildRendering(): void;
95 postCreate(): void;
96 destroy(preserveDom?: boolean): void;
97
98 /**
99 * Returns true if the dropdown exists and it's data is loaded. This can
100 * be overridden in order to force a call to loadDropDown().
101 */
102 isLoaded(): boolean;
103
104 /**
105 * Creates the drop down if it doesn't exist, loads the data
106 * if there's an href and it hasn't been loaded yet, and then calls
107 * the given callback.
108 */
109 loadDropDown(loadCallback: () => void): void;
110
111 /**
112 * Creates the drop down if it doesn't exist, loads the data
113 * if there's an href and it hasn't been loaded yet, and
114 * then opens the drop down. This is basically a callback when the
115 * user presses the down arrow button to open the drop down.
116 */
117 loadAndOpenDropDown(): Deferred<T>;
118
119 /**
120 * Callback when the user presses the down arrow button or presses
121 * the down arrow key to open/close the drop down.
122 * Toggle the drop-down widget; if it is up, close it, if not, open it
123 */
124 toggleDropDown(): void;
125
126 /**
127 * Opens the dropdown for this widget. To be called only when this.dropDown
128 * has been created and is ready to display (ie, it's data is loaded).
129 */
130 openDropDown(): PlaceLocation;
131
132 /**
133 * Closes the drop down on this widget
134 */
135 closeDropDown(focus?: boolean): void;
136 }
137
138 type _HasDropDownConstructor<T extends _WidgetBase = _WidgetBase> = _HasDropDown<T>;
139 declare const _HasDropDown: _HasDropDownConstructor;
140 export = _HasDropDown;
@@ -0,0 +1,67
1 import _FocusMixin = require("./_FocusMixin");
2 import _Container = require("./_Container");
3 import _WidgetBase = require("./_WidgetBase");
4 import { DeclareConstructor } from "dojo/_base/declare";
5 import _KeyNavMixin = require("./_KeyNavMixin");
6
7 /**
8 * A _Container with keyboard navigation of its children.
9 *
10 * Provides normalized keyboard and focusing code for Container widgets.
11 * To use this mixin, call connectKeyNavHandlers() in postCreate().
12 * Also, child widgets must implement a focus() method.
13 */
14 interface _KeyNavContainer extends _FocusMixin, _KeyNavMixin, _Container {
15 /**
16 * Deprecated. You can call this in postCreate() to attach the keyboard handlers to the container, but the preferred method is to override _onLeftArrow() and _onRightArrow(), or _onUpArrow() and _onDownArrow(), to call focusPrev() and focusNext().
17 *
18 * @param prevKeyCodes Key codes for navigating to the previous child.
19 * @param nextKeyCodes Key codes for navigating to the next child.
20 */
21 connectKeyNavHandlers(prevKeyCodes: number[], nextKeyCodes: number[]): void;
22
23 /**
24 * @deprecated
25 */
26 startupKeyNavChildren(): void;
27
28 /**
29 * Setup for each child widget.
30 *
31 * Sets tabIndex=-1 on each child, so that the tab key will leave the container rather than visiting each child.
32 *
33 * Note: if you add children by a different method than addChild(), then need to call this manually or at least make sure the child's tabIndex is -1.
34 *
35 * Note: see also _LayoutWidget.setupChild(), which is also called for each child widget.
36 */
37 _startupChild(widget: _WidgetBase): void;
38
39 /**
40 * Focus the next widget
41 */
42 focusNext(): void;
43
44 /**
45 * Focus the last focusable node in the previous widget
46 *
47 * (ex: go to the ComboButton icon section rather than button section)
48 */
49 focusPrev(): void;
50
51 /**
52 * Implement _KeyNavMixin.childSelector, to identify focusable child nodes.
53 *
54 * If we allowed a dojo/query dependency from this module this could more simply be a string "> *" instead of this function.
55 */
56 childSelector(node: Element | Node): boolean | void | any;
57 }
58
59 declare module "dojo/_base/kernel" {
60 interface Dijit {
61 _KeyNavContainer: _KeyNavContainerConstructor
62 }
63 }
64
65 type _KeyNavContainerConstructor = DeclareConstructor<_KeyNavContainer>;
66 declare const _KeyNavContainer: _KeyNavContainerConstructor;
67 export = _KeyNavContainer;
@@ -0,0 +1,168
1 import _FocusMixin = require("./_FocusMixin");
2 import _WidgetBase = require("./_WidgetBase");
3 import { DeclareConstructor } from "dojo/_base/declare";
4
5 /**
6 * A mixin to allow arrow key and letter key navigation of child or descendant widgets.
7 * It can be used by dijit/_Container based widgets with a flat list of children, or more complex widgets like dijit/Tree.
8 *
9 * To use this mixin, the subclass must:
10 *
11 * - Implement _getNext(), _getFirst(), _getLast(), _onLeftArrow(), _onRightArrow() _onDownArrow(), _onUpArrow() methods to handle home/end/left/right/up/down keystrokes. Next and previous in this context refer to a linear ordering of the descendants used by letter key search.
12 * - Set all descendants' initial tabIndex to "-1"; both initial descendants and any descendants added later, by for example addChild()
13 * - Define childSelector to a function or string that identifies focusable descendant widgets
14 *
15 * Also, child widgets must implement a focus() method.
16 */
17 interface _KeyNavMixin extends _FocusMixin {
18 /**
19 * Tab index of the container; same as HTML tabIndex attribute.
20 * Note then when user tabs into the container, focus is immediately moved to the first item in the container.
21 */
22 tabIndex: string;
23
24 /**
25 * Selector (passed to on.selector()) used to identify what to treat as a child widget. Used to monitor focus events and set this.focusedChild. Must be set by implementing class. If this is a string (ex: "> *") then the implementing class must require dojo/query.
26 */
27 childSelector: string | Function | null;
28
29 /**
30 * Called on left arrow key, or right arrow key if widget is in RTL mode.
31 * Should go back to the previous child in horizontal container widgets like Toolbar.
32 */
33 _onLeftArrow(evt?: KeyboardEvent): void;
34
35 /**
36 * Called on right arrow key, or left arrow key if widget is in RTL mode.
37 * Should go to the next child in horizontal container widgets like Toolbar.
38 */
39 _onRightArrow(evt?: KeyboardEvent): void;
40
41 /**
42 * Called on up arrow key. Should go to the previous child in vertical container widgets like Menu.
43 */
44 _onUpArrow(evt?: KeyboardEvent): void;
45
46 /**
47 * Called on down arrow key. Should go to the next child in vertical container widgets like Menu.
48 */
49 _onDownArrow(evt?: KeyboardEvent): void;
50
51 /**
52 * Default focus() implementation: focus the first child.
53 */
54 focus(): void;
55
56 /**
57 * Returns first child that can be focused.
58 */
59 _getFirstFocusableChild(): _WidgetBase;
60
61 /**
62 * Returns last child that can be focused.
63 */
64 _getLastFocusableChild(): _WidgetBase;
65
66 /**
67 * Focus the first focusable child in the container.
68 */
69 focusFirstChild(): void;
70
71 /**
72 * Focus the last focusable child in the container.
73 */
74 focusLastChild(): void;
75
76 /**
77 * Focus specified child widget.
78 *
79 * @param widget Reference to container's child widget
80 * @param last If true and if widget has multiple focusable nodes, focus the last one instead of the first one
81 */
82 focusChild(widget: _WidgetBase, last?: boolean): void;
83
84 /**
85 * Handler for when the container itself gets focus.
86 *
87 * Initially the container itself has a tabIndex, but when it gets focus, switch focus to first child.
88 */
89 _onContainerFocus(evt: Event): void;
90
91 /**
92 * Called when a child widget gets focus, either by user clicking it, or programatically by arrow key handling code.
93 *
94 * It marks that the current node is the selected one, and the previously selected node no longer is.
95 */
96 _onChildFocus(child?: _WidgetBase): void;
97
98 _searchString: string;
99
100 multiCharSearchDuration: number;
101
102 /**
103 * When a key is pressed that matches a child item, this method is called so that a widget can take appropriate action is necessary.
104 */
105 onKeyboardSearch(tem: _WidgetBase, evt: Event, searchString: string, numMatches: number): void;
106
107 /**
108 * Compares the searchString to the widget's text label, returning:
109 *
110 * * -1: a high priority match and stop searching
111 * * 0: not a match
112 * * 1: a match but keep looking for a higher priority match
113 */
114 _keyboardSearchCompare(item: _WidgetBase, searchString: string): -1 | 0 | 1;
115
116 /**
117 * When a key is pressed, if it's an arrow key etc. then it's handled here.
118 */
119 _onContainerKeydown(evt: Event): void;
120
121 /**
122 * When a printable key is pressed, it's handled here, searching by letter.
123 */
124 _onContainerKeypress(evt: Event): void;
125
126 /**
127 * Perform a search of the widget's options based on the user's keyboard activity
128 *
129 * Called on keypress (and sometimes keydown), searches through this widget's children looking for items that match the user's typed search string. Multiple characters typed within 1 sec of each other are combined for multicharacter searching.
130 */
131 _keyboardSearch(evt: Event, keyChar: string): void;
132
133 /**
134 * Called when focus leaves a child widget to go to a sibling widget.
135 */
136 _onChildBlur(widget: _WidgetBase): void;
137
138 /**
139 * Returns the next or previous focusable descendant, compared to "child".
140 * Implements and extends _KeyNavMixin._getNextFocusableChild() for a _Container.
141 */
142 _getNextFocusableChild(child: _WidgetBase, dir: 1 | -1): _WidgetBase | null;
143
144 /**
145 * Returns the first child.
146 */
147 _getFirst(): _WidgetBase | null;
148
149 /**
150 * Returns the last descendant.
151 */
152 _getLast(): _WidgetBase | null;
153
154 /**
155 * Returns the next descendant, compared to "child".
156 */
157 _getNext(child: _WidgetBase, dir: 1 | -1): _WidgetBase | null;
158 }
159
160 declare module "dojo/_base/kernel" {
161 interface Dijit {
162 _KeyNavMixin: _KeyNavMixinConstructor;
163 }
164 }
165
166 type _KeyNavMixinConstructor = DeclareConstructor<_KeyNavMixin>;
167 declare const _KeyNavMixin: _KeyNavMixinConstructor;
168 export = _KeyNavMixin; No newline at end of file
@@ -0,0 +1,158
1 import _KeyNavContainer = require("./_KeyNavContainer");
2 import _CssStateMixin = require("./_CssStateMixin");
3 import { _WidgetBaseConstructor, _WidgetBase } from "./_WidgetBase";
4 import _TemplatedMixin = require("./_TemplatedMixin");
5 import _Widget = require("./_Widget");
6 import MenuItem = require("./MenuItem");
7
8 /**
9 * Abstract base class for Menu and MenuBar.
10 * Subclass should implement _onUpArrow(), _onDownArrow(), _onLeftArrow(), and _onRightArrow().
11 */
12 interface _MenuBase extends _Widget, _TemplatedMixin, _KeyNavContainer, _CssStateMixin {
13 selected: MenuItem | null;
14
15 _setSelectedAttr(item?: MenuItem | null): void;
16
17 /**
18 * This Menu has been clicked (mouse or via space/arrow key) or opened as a submenu, so mere mouseover will open submenus. Focusing a menu via TAB does NOT automatically make it active since TAB is a navigation operation and not a selection one.
19 *
20 * For Windows apps, pressing the ALT key focuses the menubar menus (similar to TAB navigation) but the menu is not active (ie no dropdown) until an item is clicked.
21 */
22 activated: boolean;
23
24 _setActivatedAttr(val: boolean): void;
25
26 /**
27 * pointer to menu that displayed me
28 */
29 parentMenu: _Widget | null;
30
31 /**
32 * After a menu has been activated (by clicking on it etc.), number of milliseconds before hovering (without clicking) another MenuItem causes that MenuItem's popup to automatically open.
33 */
34 popupDelay: number;
35
36 /**
37 * For a passive (unclicked) Menu, number of milliseconds before hovering (without clicking) will cause the popup to open. Default is Infinity, meaning you need to click the menu to open it.
38 */
39 passivePopupDelay: number;
40
41 /**
42 * A toggle to control whether or not a Menu gets focused when opened as a drop down from a MenuBar or DropDownButton/ComboButton. Note though that it always get focused when opened via the keyboard.
43 */
44 autoFocus: boolean;
45
46 /**
47 * Selector (passed to on.selector()) used to identify MenuItem child widgets, but exclude inert children like MenuSeparator. If subclass overrides to a string (ex: "> *"), the subclass must require dojo/query.
48 */
49 childSelector(node: Element | Node): boolean | void | Function;
50
51 /**
52 * Attach point for notification about when a menu item has been executed. This is an internal mechanism used for Menus to signal to their parent to close them, because they are about to execute the onClick handler. In general developers should not attach to or override this method.
53 */
54 onExecute(): void;
55
56 /**
57 * Attach point for notification about when the user cancels the current menu
58 * This is an internal mechanism used for Menus to signal to their parent to close them. In general developers should not attach to or override this method.
59 */
60 onCancel(): void;
61
62 /**
63 * This handles the right arrow key (left arrow key on RTL systems), which will either open a submenu, or move to the next item in the ancestor MenuBar
64 */
65 _moveToPopup(evt: Event): void;
66
67 /**
68 * This handler is called when the mouse moves over the popup.
69 */
70 _onPopupHover(evt?: MouseEvent): void;
71
72 /**
73 * Called when cursor is over a MenuItem.
74 */
75 onItemHover(item: MenuItem): void;
76
77 /**
78 * Called when a child MenuItem becomes deselected. Setup timer to close its popup.
79 */
80 _onChildDeselect(item: MenuItem): void;
81
82 /**
83 * Callback fires when mouse exits a MenuItem
84 */
85 onItemUnhover(item: MenuItem): void;
86
87 /**
88 * Cancels the popup timer because the user has stop hovering on the MenuItem, etc.
89 */
90 _stopPopupTimer(): void;
91
92 /**
93 * Cancels the pending-close timer because the close has been preempted
94 */
95 _stopPendingCloseTimer(): void;
96
97 /**
98 * Returns the top menu in this chain of Menus
99 */
100 _getTopMenu(): void;
101
102 /**
103 * Handle clicks on an item.
104 */
105 onItemClick(item: _WidgetBase, evt: Event): void;
106
107 /**
108 * Open the popup to the side of/underneath the current menu item, and optionally focus first item
109 */
110 _openItemPopup(fromItem: MenuItem, focus: boolean): void;
111
112 /**
113 * Callback when this menu is opened.
114 * This is called by the popup manager as notification that the menu was opened.
115 */
116 onOpen(evt?: Event): void;
117
118 /**
119 * Callback when this menu is closed.
120 * This is called by the popup manager as notification that the menu was closed.
121 */
122 onClose(): boolean;
123
124 /**
125 * Called when submenu is clicked or focus is lost. Close hierarchy of menus.
126 */
127 _closeChild(): void;
128 /**
129 * Called when child of this Menu gets focus from:
130 *
131 * 1. clicking it
132 * 2. tabbing into it
133 * 3. being opened by a parent menu.
134 *
135 * This is not called just from mouse hover.
136 */
137 _onItemFocus(item: MenuItem): void;
138
139 /**
140 * Called when focus is moved away from this Menu and it's submenus.
141 */
142 _onBlur(): void;
143
144 /**
145 * Called when the user is done with this menu. Closes hierarchy of menus.
146 */
147 _cleanUp(clearSelectedItem?: boolean): void;
148 }
149
150 declare module "dojo/_base/kernel" {
151 interface Dijit {
152 _MenuBase: _MenuBaseConstructor;
153 }
154 }
155
156 type _MenuBaseConstructor = _WidgetBaseConstructor<_MenuBase>;
157 declare const _MenuBase: _MenuBaseConstructor;
158 export = _MenuBase;
@@ -0,0 +1,32
1 import { DeclareConstructor } from "dojo/_base/declare";
2 import { ExtensionEvent } from "dojo/on";
3 import { WatchHandle } from "dojo/interfaces";
4 import { A11yClick } from "./a11yclick";
5
6 interface _OnDijitClickMixin {
7 /**
8 * override _WidgetBase.connect() to make this.connect(node, "ondijitclick", ...) work
9 */
10 connect(obj: any, event: string | ExtensionEvent, method: string | EventListener): WatchHandle;
11 }
12
13 /**
14 * Deprecated. New code should access the dijit/a11yclick event directly, ex:
15 * this.own(on(node, a11yclick, function(){ ... }));
16 *
17 * Mixing in this class will make _WidgetBase.connect(node, "ondijitclick", ...) work.
18 * It also used to be necessary to make templates with ondijitclick work, but now you can just require
19 * dijit/a11yclick.
20 */
21 interface _OnDijitClickMixinConstructor extends DeclareConstructor<_OnDijitClickMixin>{
22 a11yclick: A11yClick;
23 }
24
25 declare module "dojo/_base/kernel" {
26 interface Dijit {
27 _OnDijitClickMixin: _OnDijitClickMixinConstructor;
28 }
29 }
30
31 declare const _OnDijitClickMixin: _OnDijitClickMixinConstructor;
32 export = _OnDijitClickMixin;
@@ -0,0 +1,45
1 import _AttachMixin = require("./_AttachMixin");
2 import { _WidgetBaseConstructor } from "./_WidgetBase";
3
4 interface _TemplatedMixin extends _AttachMixin {
5
6 /**
7 * A string that represents the widget template.
8 * Use in conjunction with dojo.cache() to load from a file.
9 */
10 templateString: string;
11
12 /**
13 * Path to template (HTML file) for this widget relative to dojo.baseUrl.
14 * Deprecated: use templateString with require([... "dojo/text!..."], ...) instead
15 */
16 templatePath: string;
17
18 /**
19 * Set _AttachMixin.searchContainerNode to true for back-compat for widgets that have data-dojo-attach-point's
20 * and events inside this.containerNode. Remove for 2.0.
21 */
22 searchContainerNode: boolean;
23
24 /**
25 * Construct the UI for this widget from a template, setting this.domNode.
26 */
27 buildRendering(): void;
28 }
29
30 interface _TemplatedMixinConstructor extends _WidgetBaseConstructor<_TemplatedMixin> {
31 /**
32 * Static method to get a template based on the templatePath or
33 * templateString key
34 */
35 getCachedTemplate(templateString: string, alwaysUseString: string, doc?: Document): string | HTMLElement;
36 }
37
38 declare module "dojo/_base/kernel" {
39 interface Dijit {
40 _TemplatedMixin: _TemplatedMixinConstructor;
41 }
42 }
43
44 declare const _TemplatedMixin: _TemplatedMixinConstructor;
45 export = _TemplatedMixin;
@@ -0,0 +1,115
1 import _WidgetBase = require("./_WidgetBase");
2 import _OnDijitClickMixin = require("./_OnDijitClickMixin");
3 import _FocusMixin = require("./_FocusMixin");
4 import { _WidgetBaseConstructor } from "./_WidgetBase";
5
6 interface _Widget extends _WidgetBase, _OnDijitClickMixin, _FocusMixin {
7 /**
8 * Connect to this function to receive notifications of mouse click events.
9 */
10 onClick(event: DocumentEvent): void;
11
12 /**
13 * Connect to this function to receive notifications of mouse double click events.
14 */
15 onDblClick(event: DocumentEvent): void;
16
17 /**
18 * Connect to this function to receive notifications of keys being pressed down.
19 */
20 onKeyDown(event: DocumentEvent): void;
21
22 /**
23 * Connect to this function to receive notifications of printable keys being typed.
24 */
25 onKeyPress(event: DocumentEvent): void;
26
27 /**
28 * Connect to this function to receive notifications of keys being released.
29 */
30 onKeyUp(event: DocumentEvent): void;
31
32 /**
33 * Connect to this function to receive notifications of when the mouse button is pressed down.
34 */
35 onMouseDown(event: DocumentEvent): void;
36
37 /**
38 * Connect to this function to receive notifications of when the mouse moves over nodes contained within this widget.
39 */
40 onMouseMove(event: DocumentEvent): void;
41
42 /**
43 * Connect to this function to receive notifications of when the mouse moves off of nodes contained within this widget.
44 */
45 onMouseOut(event: DocumentEvent): void;
46
47 /**
48 * Connect to this function to receive notifications of when the mouse moves onto nodes contained within this widget.
49 */
50 onMouseOver(event: DocumentEvent): void;
51
52 /**
53 * Connect to this function to receive notifications of when the mouse moves off of this widget.
54 */
55 onMouseLeave(event: DocumentEvent): void;
56
57 /**
58 * Connect to this function to receive notifications of when the mouse moves onto this widget.
59 */
60 onMouseEnter(event: DocumentEvent): void;
61
62 /**
63 * Connect to this function to receive notifications of when the mouse button is released.
64 */
65 onMouseUp(event: DocumentEvent): void;
66
67 postCreate(): void;
68
69 /**
70 * Deprecated. Use set() instead.
71 */
72 setAttribute(attr: string, value: any): void;
73
74 /**
75 * This method is deprecated, use get() or set() directly.
76 */
77 attr(name: string | { [attr: string]: any }, value?: any): any;
78
79 /**
80 * Returns all the widgets contained by this, i.e., all widgets underneath this.containerNode.
81 */
82 getDescendants(): _Widget[];
83
84 /**
85 * Called when this widget becomes the selected pane in a
86 * `dijit/layout/TabContainer`, `dijit/layout/StackContainer`,
87 * `dijit/layout/AccordionContainer`, etc.
88 *
89 * Also called to indicate display of a `dijit.Dialog`, `dijit.TooltipDialog`, or `dijit.TitlePane`.
90 */
91 onShow(): void;
92
93 /**
94 * Called when another widget becomes the selected pane in a
95 * `dijit/layout/TabContainer`, `dijit/layout/StackContainer`,
96 * `dijit/layout/AccordionContainer`, etc.
97 *
98 * Also called to indicate hide of a `dijit.Dialog`, `dijit.TooltipDialog`, or `dijit.TitlePane`.
99 */
100 onHide(): void;
101
102 /**
103 * Called when this widget is being displayed as a popup (ex: a Calendar popped
104 * up from a DateTextBox), and it is hidden.
105 * This is called from the dijit.popup code, and should not be called directly.
106 *
107 * Also used as a parameter for children of `dijit/layout/StackContainer` or subclasses.
108 * Callback if a user tries to close the child. Child will be closed if this function returns true.
109 */
110 onClose(): boolean;
111 }
112
113 type _WidgetConstructor = _WidgetBaseConstructor<_Widget>;
114 declare const _Widget: _WidgetConstructor;
115 export = _Widget;
@@ -0,0 +1,241
1 import Stateful = require("dojo/Stateful");
2 import Destroyable = require("./Destroyable");
3 import { ExtensionEvent } from "dojo/on";
4 import { NodeFragmentOrString, Handle, NodeOrString, WatchHandle } from "dojo/interfaces";
5 import { DeclareConstructor } from "dojo/_base/declare";
6
7 declare namespace _WidgetBase {
8
9 interface _WidgetBase extends Stateful, Destroyable {
10
11 /**
12 * A unique, opaque ID string that can be assigned by users or by the
13 * system. If the developer passes an ID which is known not to be
14 * unique, the specified ID is ignored and the system-generated ID is
15 * used instead.
16 */
17 id: string;
18
19 /**
20 * Rarely used. Overrides the default Dojo locale used to render this widget,
21 * as defined by the [HTML LANG](http://www.w3.org/TR/html401/struct/dirlang.html#adef-lang) attribute.
22 * Value must be among the list of locales specified during by the Dojo bootstrap,
23 * formatted according to [RFC 3066](http://www.ietf.org/rfc/rfc3066.txt) (like en-us).
24 */
25 lang: string;
26
27 /**
28 * Bi-directional support, as defined by the [HTML DIR](http://www.w3.org/TR/html401/struct/dirlang.html#adef-dir)
29 * attribute. Either left-to-right "ltr" or right-to-left "rtl". If undefined, widgets renders in page's
30 * default direction.
31 */
32 dir: string;
33
34 /**
35 * HTML class attribute
36 */
37 class: string;
38
39 /**
40 * HTML style attributes as cssText string or name/value hash
41 */
42 style: string;
43
44 /**
45 * HTML title attribute.
46 *
47 * For form widgets this specifies a tooltip to display when hovering over
48 * the widget (just like the native HTML title attribute).
49 *
50 * For TitlePane or for when this widget is a child of a TabContainer, AccordionContainer,
51 * etc., it's used to specify the tab label, accordion pane title, etc. In this case it's
52 * interpreted as HTML.
53 */
54 title: string;
55
56 /**
57 * When this widget's title attribute is used to for a tab label, accordion pane title, etc.,
58 * this specifies the tooltip to appear when the mouse is hovered over that text.
59 */
60 tooltip: string;
61
62 /**
63 * Root CSS class of the widget (ex: dijitTextBox), used to construct CSS classes to indicate
64 * widget state.
65 */
66 baseClass: string;
67
68 /**
69 * pointer to original DOM node
70 */
71 srcNodeRef: HTMLElement;
72
73 /**
74 * This is our visible representation of the widget! Other DOM
75 * Nodes may by assigned to other properties, usually through the
76 * template system's data-dojo-attach-point syntax, but the domNode
77 * property is the canonical "top level" node in widget UI.
78 */
79 domNode: HTMLElement;
80
81 /**
82 * Designates where children of the source DOM node will be placed.
83 * "Children" in this case refers to both DOM nodes and widgets.
84 */
85 containerNode: HTMLElement;
86
87 /**
88 * The document this widget belongs to. If not specified to constructor, will default to
89 * srcNodeRef.ownerDocument, or if no sourceRef specified, then to the document global
90 */
91 ownerDocument: HTMLElement;
92
93 /**
94 * Deprecated. Instead of attributeMap, widget should have a _setXXXAttr attribute
95 * for each XXX attribute to be mapped to the DOM.
96 */
97 attributeMap: { [attribute: string]: any };
98
99 /**
100 * Bi-directional support, the main variable which is responsible for the direction of the text.
101 * The text direction can be different than the GUI direction by using this parameter in creation
102 * of a widget.
103 */
104 textDir: string;
105
106 /**
107 * Kicks off widget instantiation. See create() for details.
108 */
109 postscript(params?: any, srcNodeRef?: HTMLElement): void;
110
111 /**
112 * Kick off the life-cycle of a widget
113 */
114 create(params?: any, srcNodeRef?: HTMLElement): void;
115
116 /**
117 * Called after the parameters to the widget have been read-in,
118 * but before the widget template is instantiated. Especially
119 * useful to set properties that are referenced in the widget
120 * template.
121 */
122 postMixInProperties(): void;
123
124 /**
125 * Construct the UI for this widget, setting this.domNode.
126 * Most widgets will mixin `dijit._TemplatedMixin`, which implements this method.
127 */
128 buildRendering(): void;
129
130 /**
131 * Processing after the DOM fragment is created
132 */
133 postCreate(): void;
134
135 /**
136 * Processing after the DOM fragment is added to the document
137 */
138 startup(): void;
139
140 /**
141 * Destroy this widget and its descendants
142 */
143 destroyRecursive(preserveDom?: boolean): void;
144
145 /**
146 * Destroys the DOM nodes associated with this widget.
147 */
148 destroyRendering(preserveDom?: boolean): void;
149
150 /**
151 * Recursively destroy the children of this widget and their
152 * descendants.
153 */
154 destroyDescendants(preserveDom?: boolean): void;
155
156 /**
157 * Deprecated. Override destroy() instead to implement custom widget tear-down
158 * behavior.
159 */
160 uninitialize(): boolean;
161
162 /**
163 * Used by widgets to signal that a synthetic event occurred, ex:
164 * | myWidget.emit("attrmodified-selectedChildWidget", {}).
165 */
166 emit(type: string, eventObj?: any, callbackArgs?: any[]): any;
167
168 /**
169 * Call specified function when event occurs, ex: myWidget.on("click", function(){ ... }).
170 */
171 on(type: string | ExtensionEvent, func: EventListener | Function): WatchHandle;
172
173 /**
174 * Returns a string that represents the widget.
175 */
176 toString(): string;
177
178 /**
179 * Returns all direct children of this widget, i.e. all widgets underneath this.containerNode whose parent
180 * is this widget. Note that it does not return all descendants, but rather just direct children.
181 */
182 getChildren<T extends _WidgetBase>(): T[];
183
184 /**
185 * Returns the parent widget of this widget.
186 */
187 getParent<T extends _WidgetBase>(): T;
188
189 /**
190 * Deprecated, will be removed in 2.0, use this.own(on(...)) or this.own(aspect.after(...)) instead.
191 */
192 connect(obj: any, event: string | ExtensionEvent, method: string | EventListener): WatchHandle;
193
194 /**
195 * Deprecated, will be removed in 2.0, use handle.remove() instead.
196 */
197 disconnect(handle: WatchHandle): void;
198
199 /**
200 * Deprecated, will be removed in 2.0, use this.own(topic.subscribe()) instead.
201 */
202 subscribe(t: string, method: EventListener): WatchHandle;
203
204 /**
205 * Deprecated, will be removed in 2.0, use handle.remove() instead.
206 */
207 unsubscribe(handle: WatchHandle): void;
208
209 /**
210 * Return this widget's explicit or implicit orientation (true for LTR, false for RTL)
211 */
212 isLeftToRight(): boolean;
213
214 /**
215 * Return true if this widget can currently be focused
216 * and false if not
217 */
218 isFocusable(): boolean;
219
220 /**
221 * Place this widget somewhere in the DOM based
222 * on standard domConstruct.place() conventions.
223 */
224 placeAt<T extends _WidgetBase>(reference: NodeFragmentOrString | T, position?: string | number): this;
225
226 /**
227 * Wrapper to setTimeout to avoid deferred functions executing
228 * after the originating widget has been destroyed.
229 * Returns an object handle with a remove method (that returns null) (replaces clearTimeout).
230 */
231 defer(fcn: Function, delay?: number): Handle;
232 }
233
234 interface _WidgetBaseConstructor<W = _WidgetBase> extends DeclareConstructor<W> {
235 new(params: Object, srcNodeRef: NodeOrString): W;
236 }
237 }
238
239 type _WidgetBase = _WidgetBase._WidgetBase;
240 declare const _WidgetBase: _WidgetBase._WidgetBaseConstructor;
241 export = _WidgetBase;
@@ -0,0 +1,21
1 import { _WidgetBaseConstructor } from "./_WidgetBase";
2
3 interface _WidgetsInTemplateMixin {
4 /**
5 * Used to provide a context require to dojo/parser in order to be
6 * able to use relative MIDs (e.g. `./Widget`) in the widget's template.
7 */
8 contextRequire: Function;
9
10 startup(): void;
11 }
12
13 declare module "dojo/_base/kernel" {
14 interface Dijit {
15 _WidgetsInTemplateMixin: _WidgetsInTemplateMixinConstructor
16 }
17 }
18
19 type _WidgetsInTemplateMixinConstructor = _WidgetBaseConstructor<_WidgetsInTemplateMixin>;
20 declare const _WidgetsInTemplateMixin: _WidgetsInTemplateMixinConstructor;
21 export = _WidgetsInTemplateMixin;
@@ -0,0 +1,84
1 import dijit = require("../main");
2 import _WidgetBase = require("dijit/_WidgetBase");
3
4 type Bookmark = { isCollapsed: boolean, mark?: Range };
5 type FocusNode = Element | null;
6 type RemoveHandle = { remove(): void };
7
8 /**
9 * Deprecated module to monitor currently focused node and stack of currently focused widgets.
10 *
11 * New code should access dijit/focus directly.
12 */
13 declare module "dojo/_base/kernel" {
14 interface Dijit {
15 /**
16 * Currently focused item on screen
17 */
18 _curFocus: FocusNode;
19
20 /**
21 * Previously focused item on screen
22 */
23 _prevFocus: FocusNode;
24
25 /**
26 * Returns true if there is no text selected
27 */
28 isCollapsed(): boolean;
29
30 /**
31 * Retrieves a bookmark that can be used with moveToBookmark to return to the same range
32 */
33 getBookmark(): Bookmark;
34
35 /**
36 * Moves current selection to a bookmark
37 */
38 moveToBookmark(bookmark: Bookmark): void;
39
40 /**
41 * Called as getFocus(), this returns an Object showing the current focus and selected text.
42 *
43 * Called as getFocus(widget), where widget is a (widget representing) a button that was just pressed, it returns where focus was before that button was pressed. (Pressing the button may have either shifted focus to the button, or removed focus altogether.) In this case the selected text is not returned, since it can't be accurately determined.
44 */
45 getFocus(menu: _WidgetBase, openedForWindow?: Window): {
46 node: FocusNode;
47 bookmark: any;
48 openedForWindow?: Window
49 };
50
51 /**
52 * List of currently active widgets (focused widget and it's ancestors)
53 */
54 _activeStack: _WidgetBase[];
55
56 /**
57 * Registers listeners on the specified iframe so that any click or focus event on that iframe (or anything in it) is reported as a focus/click event on the `<iframe>` itself.
58 *
59 * Currently only used by editor.
60 */
61 registerIframe(iframe: HTMLIFrameElement): RemoveHandle;
62
63 /**
64 * Unregisters listeners on the specified iframe created by registerIframe.
65 * After calling be sure to delete or null out the handle itself.
66 */
67 unregisterIframe(handle?: RemoveHandle): void;
68
69 /**
70 * Registers listeners on the specified window (either the main window or an iframe's window) to detect when the user has clicked somewhere or focused somewhere.
71 *
72 * Users should call registerIframe() instead of this method.
73 */
74 registerWin(targetWindow: Window, effectiveNode: Element): RemoveHandle;
75
76 /**
77 * Unregisters listeners on the specified window (either the main window or an iframe's window) according to handle returned from registerWin().
78 * After calling be sure to delete or null out the handle itself.
79 */
80 unregisterWin(handle?: RemoveHandle): void;
81 }
82 }
83
84 export = dijit; No newline at end of file
@@ -0,0 +1,23
1 import dijit = require("../main");
2 import _WidgetBase = require("../_WidgetBase");
3
4 declare module "dojo/_base/kernel" {
5 interface Dijit {
6 byId(id: string | _WidgetBase): _WidgetBase;
7 getUniqueId(widgetType: string): string;
8 findWidgets(root: Node, skipNode?: Node): _WidgetBase[];
9 byNode(node: Node): _WidgetBase;
10 getEnclosingWidgets(node: Node): _WidgetBase;
11
12 /**
13 * defaultDuration: Integer
14 * The default fx.animation speed (in ms) to use for all Dijit
15 * transitional fx.animations, unless otherwise specified
16 * on a per-instance basis. Defaults to 200, overrided by
17 * `djConfig.defaultDuration`
18 */
19 defaultDuration: number;
20 }
21 }
22
23 export = dijit; No newline at end of file
@@ -0,0 +1,51
1 import { DomGeometryBox } from "dojo/dom-geometry";
2 import dijit = require("../main");
3 import { PlacePosition, LayoutNodeFunction, PlaceCorner, PlaceLocation } from "../place";
4
5 type placeOnScreenAround = (node: Element, aroundNode: Element, aroundCorners: Object | any[], layoutNode?: LayoutNodeFunction) => void;
6
7 /**
8 * Deprecated back compatibility module, new code should use dijit/place directly instead of using this module.
9 */
10 declare module "dojo/_base/kernel" {
11 interface Dijit {
12 /**
13 * Deprecated method to return the dimensions and scroll position of the viewable area of a browser window.
14 *
15 * New code should use windowUtils.getBox()
16 */
17 getViewport(): DomGeometryBox;
18
19 placeOnScreen(node: Element, pos?: PlacePosition, corners?: PlaceCorner[], padding?: PlacePosition, layoutNode?: LayoutNodeFunction): PlaceLocation;
20
21 /**
22 * Like dijit.placeOnScreenAroundNode(), except it accepts an arbitrary object for the "around" argument and finds a proper processor to place a node.
23 *
24 * Deprecated, new code should use dijit/place.around() instead.
25 */
26 placeOnScreenAroundElement: placeOnScreenAround;
27
28 /**
29 * Position node adjacent or kitty-corner to aroundNode such that it's fully visible in viewport.
30 *
31 * Deprecated, new code should use dijit/place.around() instead.
32 */
33 placeOnScreenAroundNode: placeOnScreenAround;
34
35 /**
36 * Like dijit.placeOnScreenAroundNode(), except that the "around" parameter is an arbitrary rectangle on the screen (x, y, width, height) instead of a dom node.
37 *
38 * Deprecated, new code should use dijit/place.around() instead.
39 */
40 placeOnScreenAroundRectangle: placeOnScreenAround;
41
42 /**
43 * Deprecated method, unneeded when using dijit/place directly.
44 *
45 * Transforms the passed array of preferred positions into a format suitable for passing as the aroundCorners argument to dijit/place.placeOnScreenAroundElement.
46 */
47 getPopupAroundAlignment(position: string[], leftToRight?: boolean): { [s: string]: PlaceCorner };
48 }
49 }
50
51 export = dijit;
@@ -0,0 +1,2
1 import popup = require("../popup");
2 export = popup;
@@ -0,0 +1,7
1 import { DomGeometryXYBox } from "dojo/dom-geometry";
2
3 declare module "dojo/_base/kernel" {
4 interface Dijit {
5 scrollIntoView(node: Element, pos?: DomGeometryXYBox): void;
6 }
7 }
1 NO CONTENT: new file 100644
NO CONTENT: new file 100644
1 NO CONTENT: new file 100644
NO CONTENT: new file 100644
@@ -0,0 +1,56
1 import dijit = require("../main");
2
3 declare module "dojo/_base/kernel" {
4 interface Dijit {
5 /**
6 * Determines if an element has a particular role.
7 */
8 hasWaiRole(elem: Element, role: string): boolean;
9
10 /**
11 * Gets the role for an element (which should be a wai role).
12 */
13 getWaiRole(elem: Element): string;
14
15 /**
16 * Sets the role on an element.
17 */
18 setWaiRole(elem: Element, role: string): void;
19
20 /**
21 * Removes the specified role from an element.
22 * Removes role attribute if no specific role provided (for backwards compat.)
23 */
24 removeWaiRole(elem: Element, role: string): void;
25
26 /**
27 * Determines if an element has a given state.
28 *
29 * Checks for an attribute called "aria-"+state.
30 */
31 hasWaiState(elem: Element, state: string): boolean;
32
33 /**
34 * Gets the value of a state on an element.
35 *
36 * Checks for an attribute called "aria-"+state.
37 */
38 getWaiState(elem: Element, state: string): string;
39
40 /**
41 * Sets a state on an element.
42 *
43 * Sets an attribute called "aria-"+state.
44 */
45 setWaiState(elem: Element, state: string, value: string): void;
46
47 /**
48 * Removes a state from an element.
49 *
50 * Sets an attribute called "aria-"+state.
51 */
52 removeWaiState(elem: Element, state: string): void;
53 }
54 }
55
56 export = dijit;
@@ -0,0 +1,7
1 import "dojo/_base/kernel";
2
3 declare module "dojo/_base/kernel" {
4 interface Dijit {
5 getDocumentWindow(doc?: Document): Window;
6 }
7 }
@@ -0,0 +1,33
1 import { Handle } from "dojo/interfaces";
2 import { ExtensionEvent } from "dojo/on";
3
4 declare namespace a11yclick {
5
6 interface A11yClick {
7
8 /**
9 * Custom press, release, and click synthetic events
10 * which trigger on a left mouse click, touch, or space/enter keyup.
11 */
12 (node: HTMLElement, listener: Function): Handle;
13
14 /**
15 * Mousedown (left button), touchstart, or keydown (space or enter) corresponding to logical click operation.
16 */
17 press: ExtensionEvent;
18
19 /**
20 * Mouseup (left button), touchend, or keyup (space or enter) corresponding to logical click operation.
21 */
22 release: ExtensionEvent;
23
24 /**
25 * Mouse cursor or a finger is dragged over the given node.
26 */
27 move: ExtensionEvent;
28 }
29
30 }
31
32 declare const a11yclick: a11yclick.A11yClick;
33 export = a11yclick;
@@ -0,0 +1,62
1 import _WidgetBase = require("./_WidgetBase");
2 import { Handle } from "dojo/interfaces";
3
4 declare namespace focus {
5
6 /**
7 * Tracks the currently focused node, and which widgets are currently "active".
8 * Access via require(["dijit/focus"], function(focus){ ... }).
9 *
10 * A widget is considered active if it or a descendant widget has focus,
11 * or if a non-focusable node of this widget or a descendant was recently clicked.
12 *
13 * Call focus.watch("curNode", callback) to track the current focused DOMNode,
14 * or focus.watch("activeStack", callback) to track the currently focused stack of widgets.
15 *
16 * Call focus.on("widget-blur", func) or focus.on("widget-focus", ...) to monitor when
17 * when widgets become active/inactive
18 *
19 * Finally, focus(node) will focus a node, suppressing errors if the node doesn't exist.
20 */
21 interface FocusManager {
22 /**
23 * Currently focused item on screen
24 */
25 curNode: Element;
26
27 /**
28 * List of currently active widgets (focused widget and it's ancestors)
29 */
30 activeStack: _WidgetBase[];
31
32 /**
33 * Registers listeners on the specified iframe so that any click
34 * or focus event on that iframe (or anything in it) is reported
35 * as a focus/click event on the `<iframe>` itself.
36 *
37 * @param iframe Currently only used by editor.
38 * @returns Handle with remove() method to deregister.
39 */
40 registerIframe(iframe: Element): Handle;
41
42 /**
43 * Registers listeners on the specified window (either the main
44 * window or an iframe's window) to detect when the user has clicked somewhere
45 * or focused somewhere.
46 *
47 * Users should call registerIframe() instead of this method.
48 *
49 * @param targetWindow If specified this is the window associated with the iframe,
50 * i.e. iframe.contentWindow.
51 * @param effectiveNode If specified, report any focus events inside targetWindow as
52 * an event on effectiveNode, rather than on evt.target.
53 *
54 * @returns Handle with remove() method to deregister.
55 */
56 registerWin(targetWindow?: Window, effectiveNode?: Element): Handle;
57 }
58
59 }
60
61 declare const focus: focus.FocusManager;
62 export = focus; No newline at end of file
@@ -0,0 +1,37
1 import { _WidgetBaseConstructor } from "../_WidgetBase";
2 import _ButtonMixin = require("./_ButtonMixin");
3 import _FormWidget = require("./_FormWidget");
4
5 interface Button extends _FormWidget, _ButtonMixin {
6 /**
7 * Set this to true to hide the label text and display only the icon.
8 * (If showLabel=false then iconClass must be specified.)
9 * Especially useful for toolbars.
10 * If showLabel=true, the label will become the title (a.k.a. tooltip/hint)
11 */
12 showLabel: boolean;
13
14 /**
15 * Class to apply to DOMNode in button to make it display an icon
16 */
17 iconClass: string;
18
19 baseClass: string;
20 templateString: string;
21 postCreate(): void;
22 setLabel(content: string): void;
23 onLabelSet(e: DocumentEvent): void;
24
25 onClick(e: DocumentEvent): boolean;
26
27 set(name: 'showLabel', value: boolean): this;
28 set(name: 'value', value: string): this;
29 set(name: 'name', value: string): this;
30 set(name: 'label', value: string): this;
31 set(name: string, value: any): this;
32 set(values: Object): this;
33 }
34
35 type ButtonConstructor = _WidgetBaseConstructor<Button>;
36 declare const Button: ButtonConstructor;
37 export = Button;
@@ -0,0 +1,45
1 import _WidgetBase = require("../_WidgetBase");
2 import _Container = require("../_Container");
3 import _HasDropDown = require("../_HasDropDown");
4 import { _WidgetBaseConstructor } from "../_WidgetBase";
5 import { NodeOrString } from "dojo/interfaces";
6 import Button = require("./Button");
7
8 interface DropDownButton<T extends _WidgetBase> extends Button, _Container, _HasDropDown<T> {
9 baseClass: string;
10 templateString: string;
11
12 /**
13 * Overrides _TemplatedMixin#_fillContent().
14 * My inner HTML possibly contains both the button label and/or a drop down widget, like
15 * <DropDownButton> <span>push me</span> <Menu> ... </Menu> </DropDownButton>
16 */
17 _fillContent(): void;
18 startup(): void;
19
20 /**
21 * Returns whether or not we are loaded - if our dropdown has an href,
22 * then we want to check that.
23 */
24 isLoaded(): boolean;
25
26 /**
27 * Default implementation assumes that drop down already exists,
28 * but hasn't loaded it's data (ex: ContentPane w/href).
29 * App must override if the drop down is lazy-created.
30 */
31 loadDropDown(callback: () => void): void;
32
33 /**
34 * Overridden so that focus is handled by the _HasDropDown mixin, not by
35 * the _FormWidget mixin.
36 */
37 isFocusable(): boolean;
38 }
39
40 interface DropDownButtonConstructor<T extends _WidgetBase = _WidgetBase> extends _WidgetBaseConstructor<DropDownButton<T>> {
41 new <T extends _WidgetBase>(params: Object, srcNodeRef: NodeOrString): DropDownButton<T>;
42 }
43
44 declare const DropDownButton: DropDownButtonConstructor;
45 export = DropDownButton;
@@ -0,0 +1,25
1 import { DeclareConstructor } from "dojo/_base/declare";
2
3 interface _ButtonMixin {
4 /**
5 * A mixin to add a thin standard API wrapper to a normal HTML button
6 */
7 label: string;
8
9 /**
10 * Type of button (submit, reset, button, checkbox, radio)
11 */
12 type: string;
13 postCreate(): void;
14
15 /**
16 * Callback for when button is clicked.
17 * If type="submit", return true to perform submit, or false to cancel it.
18 */
19 onClick(e: DocumentEvent): boolean;
20 onSetLabel(e: DocumentEvent): void;
21 }
22
23 type _ButtonMixinConstructor = DeclareConstructor<_ButtonMixin>;
24 declare const _ButtonMixin: _ButtonMixinConstructor;
25 export = _ButtonMixin;
@@ -0,0 +1,80
1 import _WidgetBase = require("dijit/_WidgetBase");
2 import _FormWidget = require("./_FormWidget");
3 import { DeclareConstructor } from "dojo/_base/declare";
4
5 interface OnValidStateChange {
6 (isValid?: boolean): void;
7 }
8
9 interface _FormMixin {
10
11 /**
12 * Will be "Error" if one or more of the child widgets has an invalid value,
13 * "Incomplete" if not all of the required child widgets are filled in. Otherwise, "",
14 * which indicates that the form is ready to be submitted.
15 */
16 state: '' | 'Error' | 'Incomplete';
17
18 /**
19 * Returns all form widget descendants, searching through non-form child widgets like BorderContainer
20 */
21 _getDescendantFormWidgets(children?: _WidgetBase[]): _FormWidget[];
22
23 reset(): void;
24
25 /**
26 * returns if the form is valid - same as isValid - but
27 * provides a few additional (ui-specific) features:
28 *
29 * 1. it will highlight any sub-widgets that are not valid
30 * 2. it will call focus() on the first invalid sub-widget
31 */
32 validate(): boolean;
33
34 setValues(val: any): _FormMixin;
35 getValues(): any;
36
37 /**
38 * Returns true if all of the widgets are valid.
39 * Deprecated, will be removed in 2.0. Use get("state") instead.
40 */
41 isValid(): boolean;
42
43 /**
44 * Stub function to connect to if you want to do something
45 * (like disable/enable a submit button) when the valid
46 * state changes on the form as a whole.
47 *
48 * Deprecated. Will be removed in 2.0. Use watch("state", ...) instead.
49 */
50 onValidStateChange: OnValidStateChange;
51
52 /**
53 * Compute what this.state should be based on state of children
54 */
55 _getState(): '' | 'Error' | 'Incomplete';
56
57 /**
58 * Deprecated method. Applications no longer need to call this. Remove for 2.0.
59 */
60 disconnectChildren(): void;
61
62 /**
63 * You can call this function directly, ex. in the event that you
64 * programmatically add a widget to the form *after* the form has been
65 * initialized.
66 */
67 connectChildren(inStartup?: boolean): void;
68
69 /**
70 * Called when child's value or disabled state changes
71 */
72 _onChildChange(attr?: string): void;
73
74 startup(): void;
75 destroy(preserveDom?: boolean): void;
76 }
77
78 type _FormMixinConstructor = DeclareConstructor<_FormMixin>;
79 declare const _FormMixin: _FormMixinConstructor;
80 export = _FormMixin;
@@ -0,0 +1,19
1 import _Widget = require("../_Widget");
2 import _TemplatedMixin = require("../_TemplatedMixin");
3 import _CssStateMixin = require("../_CssStateMixin");
4 import { _WidgetBaseConstructor } from "../_WidgetBase";
5 import _FormWidgetMixin = require("./_FormWidgetMixin");
6
7 interface _FormWidget extends _Widget, _TemplatedMixin, _CssStateMixin, _FormWidgetMixin {
8 setDisabled(disabled: boolean): void;
9 setValue(value: string): void;
10 postMixInProperties(): void;
11
12 set(name: 'value', value: string): this;
13 set(name: string, value: any): this;
14 set(values: Object): this;
15 }
16
17 type _FormWidgetConstructor = _WidgetBaseConstructor<_FormWidget>;
18 declare const _FormWidget: _FormWidgetConstructor;
19 export = _FormWidget; No newline at end of file
@@ -0,0 +1,84
1 import { DeclareConstructor } from "dojo/_base/declare";
2
3 interface _FormWidgetMixin {
4 /**
5 * Name used when submitting form; same as "name" attribute or plain HTML elements
6 */
7 name: string;
8
9 /**
10 * Corresponds to the native HTML `<input>` element's attribute.
11 */
12 alt: string;
13
14 /**
15 * Corresponds to the native HTML `<input>` element's attribute.
16 */
17 value: any;
18
19 /**
20 * Corresponds to the native HTML `<input>` element's attribute.
21 */
22 type: string;
23
24 /**
25 * Apply aria-label in markup to the widget's focusNode
26 */
27 'aria-label': string;
28
29 /**
30 * Order fields are traversed when user hits the tab key
31 */
32 tabIndex: number;
33
34 /**
35 * Should this widget respond to user input?
36 * In markup, this is specified as "disabled='disabled'", or just "disabled".
37 */
38 disabled: boolean;
39
40 /**
41 * Fires onChange for each value change or only on demand
42 */
43 intermediateChanges: boolean;
44
45 /**
46 * On focus, should this widget scroll into view?
47 */
48 scrollOnFocus: boolean;
49
50 /**
51 * Tells if this widget is focusable or not. Used internally by dijit.
52 */
53 isFocusable(): boolean;
54
55 /**
56 * Put focus on this widget
57 */
58 focus(): void;
59
60 /**
61 * Compare 2 values (as returned by get('value') for this widget).
62 */
63 compare(val1: any, val2: any): number;
64
65 /**
66 * Callback when this widget's value is changed.
67 */
68 onChange(value: string): void;
69
70 /**
71 * Overrides _Widget.create()
72 */
73 create(params?: any, srcNodeRef?: HTMLElement): void;
74
75 destroy(preserveDom?: boolean): void;
76
77 set(name: 'disabled', value: boolean): this;
78 set(name: string, value: any): this;
79 set(values: Object): this;
80 }
81
82 type _FormWidgetMixinConstructor = DeclareConstructor<_FormWidgetMixin>;
83 declare const _FormWidgetMixin: _FormWidgetMixinConstructor;
84 export = _FormWidgetMixin;
@@ -0,0 +1,189
1 import { _WidgetBaseConstructor } from "dijit/_WidgetBase";
2 import { Deferred } from "dojo/Deferred";
3 import { ContentSetterContent } from "dojo/html";
4 import { GenericConstructor } from "dojo/interfaces";
5 import { DojoRequestPromise, XhrBaseOptions } from "dojo/request";
6 import _Widget = require("dijit/_Widget");
7 import _Container = require("dijit/_Container");
8 import _ContentPaneResizeMixin = require("./_ContentPaneResizeMixin");
9
10 interface ContentPane extends _Widget, _Container, _ContentPaneResizeMixin {
11
12 /**
13 * The href of the content that displays now
14 * Set this at construction if you want to load data externally when th
15 * pane is shown. (Set preload=true to load it immediately.
16 * Changing href after creation doesn't have any effect; Use set('href', ...);
17 */
18 href: string;
19
20 /**
21 * The innerHTML of the ContentPane
22 * Note that the initialization parameter / argument to set("content", ...
23 * can be a String, DomNode, Nodelist, or _Widget.
24 */
25 content: ContentSetterContent | _Widget;
26
27 /**
28 * Extract visible content from inside of `<body> .... </body>`
29 * I.e., strip `<html>` and `<head>` (and it's contents) from the href
30 */
31 extractContent: boolean;
32
33 /**
34 * Parse content and create the widgets, if any.
35 */
36 parseOnLoad: boolean;
37
38 /**
39 * Flag passed to parser. Root for attribute names to search for. If scopeName is dojo
40 * will search for data-dojo-type (or dojoType). For backwards compatibilit
41 * reasons defaults to dojo._scopeName (which is "dojo" except whe
42 * multi-version support is used, when it will be something like dojo16, dojo20, etc.)
43 */
44 parserScope: string;
45
46 /**
47 * Prevent caching of data from href's by appending a timestamp to the href.
48 */
49 preventCache: boolean;
50
51 /**
52 * Force load of data on initialization even if pane is hidden.
53 */
54 preload: boolean;
55
56 /**
57 * Refresh (re-download) content when pane goes from hidden to shown
58 */
59 refreshOnShow: boolean;
60
61 /**
62 * Message that shows while downloading
63 */
64 loadingMessage: string;
65
66 /**
67 * Message that shows if an error occurs
68 */
69 errorMessage: string;
70
71 /**
72 * True if the ContentPane has data in it, either specifie
73 * during initialization (via href or inline content), or se
74 * via set('content', ...) / set('href', ...
75 * False if it doesn't have any content, or if ContentPane i
76 * still in the process of downloading href.
77 */
78 isLoaded: boolean;
79
80 baseClass: string;
81
82 /**
83 * Function that should grab the content specified via href.
84 */
85 ioMethod<T>(url: string, options?: XhrBaseOptions): DojoRequestPromise<T>;
86
87 /**
88 * Parameters to pass to xhrGet() request, for example:
89 * | <div data-dojo-type="dijit/layout/ContentPane" data-dojo-props="href: './bar', ioArgs: {timeout: 500}">
90 */
91 ioArgs: { [arg: string]: string | number };
92
93 /**
94 * This is the `dojo.Deferred` returned by set('href', ...) and refresh()
95 * Calling onLoadDeferred.then() registers you
96 * callback to be called only once, when the prior set('href', ...) call o
97 * the initial href parameter to the constructor finishes loading
98 * This is different than an onLoad() handler which gets called any time any hre
99 * or content is loaded.
100 */
101 onLoadDeferred: Deferred<any>;
102
103 /**
104 * Flag to parser that I'll parse my contents, so it shouldn't.
105 */
106 stopParser: boolean;
107
108 /**
109 * Flag from the parser that this ContentPane is inside a templat
110 * so the contents are pre-parsed.
111 */
112 template: boolean;
113
114 markupFactory<T>(params: any, node: HTMLElement, ctor: GenericConstructor<T>): T;
115 postMixInProperties(): void;
116 buildRendering(): void;
117
118 /**
119 * Call startup() on all children including non _Widget ones like dojo/dnd/Source objects
120 */
121 startup(): void;
122
123 /**
124 * Deprecated. Use set('href', ...) instead.
125 */
126 setHref(href: string | URL): ContentPane;
127
128 /**
129 * Deprecated. Use set('content', ...) instead.
130 */
131 setContent(data: ContentSetterContent): ContentPane;
132
133 /**
134 * Cancels an in-flight download of content
135 */
136 cancel(): void;
137
138 /**
139 * [Re]download contents of href and display
140 */
141 refresh(): Deferred<any>;
142
143 /**
144 * Destroy all the widgets inside the ContentPane and empty containerNode
145 */
146 destroyDescendants(preserveDom?: boolean): void;
147
148 /**
149 * Event hook, is called after everything is loaded and widgetified
150 */
151 onLoad(data?: any): void;
152
153 /**
154 * Event hook, is called before old content is cleared
155 */
156 onUnload(): void;
157
158 /**
159 * Called before download starts.
160 */
161 onDownloadStart(): string;
162
163 /**
164 * Called on DOM faults, require faults etc. in content.
165 * In order to display an error message in the pane, return
166 * the error message from this method, as an HTML string.
167 * By default (if this method is not overriden), it returns
168 * nothing, so the error message is just printed to the console.
169 */
170 onContentError(error: Error): void;
171
172 /**
173 * Called when download error occurs.
174 * In order to display an error message in the pane, return
175 * the error message from this method, as an HTML string.
176 * Default behavior (if this method is not overriden) is to display
177 * the error message inside the pane.
178 */
179 onDownloadError(error: Error): void;
180
181 /**
182 * Called when download is finished.
183 */
184 onDownloadEnd(): void;
185 }
186
187 type ContentPaneConstructor = _WidgetBaseConstructor<ContentPane>;
188 declare const ContentPane: ContentPaneConstructor;
189 export = ContentPane;
@@ -0,0 +1,37
1 import { DomGeometryBox, DomGeometryWidthHeight } from "dojo/dom-geometry";
2
3 import { _WidgetBaseConstructor } from "dijit/_WidgetBase";
4
5 interface _ContentPaneResizeMixin {
6
7 /**
8 * - false - don't adjust size of children
9 * - true - if there is a single visible child widget, set it's size to however big the ContentPane is
10 */
11 doLayout: boolean;
12
13 /**
14 * Indicates that this widget will call resize() on it's child widgets
15 * when they become visible.
16 */
17 isLayoutContainer: boolean;
18
19 /**
20 * See `dijit/layout/_LayoutWidget.startup()` for description.
21 * Although ContentPane doesn't extend _LayoutWidget, it does implement
22 * the same API.
23 */
24 startup(): void;
25
26 /**
27 * See `dijit/layout/_LayoutWidget.resize()` for description.
28 * Although ContentPane doesn't extend _LayoutWidget, it does implement
29 * the same API.
30 */
31 resize(changeSize?: DomGeometryBox, resultSize?: DomGeometryWidthHeight): void;
32 }
33
34 type _ContentPaneResizeMixinConstructor = _WidgetBaseConstructor<_ContentPaneResizeMixin>;
35
36 declare const _ContentPaneResizeMixin: _ContentPaneResizeMixinConstructor;
37 export = _ContentPaneResizeMixin;
@@ -0,0 +1,2
1 import dojo = require("dojo/_base/kernel");
2 export = dojo.dijit; No newline at end of file
@@ -0,0 +1,7
1 {
2 "name": "@types/dijit",
3 "version": "1.0.1-rc1",
4 "dependencies": {
5 "@types/dojo": "^1.0.0"
6 }
7 } No newline at end of file
@@ -0,0 +1,55
1 declare namespace place {
2 interface PlacePosition {
3 x: number;
4 y: number;
5 }
6
7 interface PlaceWidthHeight {
8 w: number;
9 h: number;
10 }
11
12 interface PlaceRectangle extends PlacePosition, PlaceWidthHeight { }
13
14 type PlaceCorner = 'BL' | 'TR' | 'BR' | 'TL';
15
16 type PlacePositions = 'before' | 'after' | 'before-centered' | 'after-centered' | 'above-centered' | 'above' | 'above-alt' | 'below-centered' | 'below' | 'below-alt';
17
18 interface PlaceChoice {
19 corner: PlaceCorner;
20 pos: PlacePosition;
21 aroundCorner?: PlaceCorner;
22 }
23
24 interface PlaceLocation extends PlaceRectangle {
25 corner: PlaceCorner;
26 aroundCorner: PlaceCorner;
27 overflow: number;
28 spaceAvailable: PlaceWidthHeight;
29 }
30
31 interface LayoutNodeFunction {
32 (node: HTMLElement, aroundCorner: string, corner: string, spaceAvailable: PlaceWidthHeight, aroundNodeCoords: PlaceWidthHeight): number;
33 }
34
35 interface Place {
36 /**
37 * Positions node kitty-corner to the rectangle centered at (pos.x, pos.y) with width and height of
38 * padding.x * 2 and padding.y * 2, or zero if padding not specified. Picks first corner in corners[]
39 * where node is fully visible, or the corner where it's most visible.
40 *
41 * Node is assumed to be absolutely or relatively positioned.
42 */
43 at(node: Element, pos?: PlacePosition, corners?: PlaceCorner[], padding?: PlacePosition, layoutNode?: LayoutNodeFunction): PlaceLocation;
44
45 /**
46 * Position node adjacent or kitty-corner to anchor
47 * such that it's fully visible in viewport.
48 */
49 around(node: Element, anchor: Element | PlaceRectangle, positions: PlacePositions[], leftToRight?: boolean, layoutNode?: LayoutNodeFunction): PlaceLocation;
50 }
51
52 }
53
54 declare const place: place.Place;
55 export = place;
@@ -0,0 +1,130
1 import _WidgetBase = require("./_WidgetBase");
2 import { PlacePosition, PlaceLocation } from "./place";
3
4 interface PopupOpenArgs {
5 /**
6 * widget to display
7 */
8 popup?: _WidgetBase;
9
10 /**
11 * the button etc. that is displaying this popup
12 */
13 parent?: _WidgetBase;
14
15 /**
16 * DOM node (typically a button); place popup relative to this node. (Specify this *or* "x" and "y" parameters.)
17 */
18 around?: HTMLElement;
19
20 /**
21 * Absolute horizontal position (in pixels) to place node at. (Specify this *or* "around" parameter.)
22 */
23 x?: number;
24
25 /**
26 * Absolute vertical position (in pixels) to place node at. (Specify this *or* "around" parameter.)
27 */
28 y?: number;
29
30 /**
31 * When the around parameter is specified, orient should be a list of positions to try
32 */
33 orient?: string | string[] | { BL?: string; TR?: string; TL?: string; BR?: string; };
34
35 /**
36 * callback when user has canceled the popup by:
37 *
38 * 1. hitting ESC or
39 * 2. by using the popup widget's proprietary cancel mechanism (like a cancel button in a dialog);
40 * i.e. whenever popupWidget.onCancel() is called, args.onCancel is called
41 */
42 onCancel?: () => void;
43
44 /**
45 * callback whenever this popup is closed
46 */
47 onClose?: () => void;
48
49 /**
50 * callback when user "executed" on the popup/sub-popup by selecting a menu choice, etc. (top menu only)
51 */
52 onExecute?: () => void;
53
54 /**
55 * adding a buffer around the opening position. This is only useful when around is not set.
56 */
57 padding?: PlacePosition;
58
59 /**
60 * The max height for the popup. Any popup taller than this will have scrollbars.
61 * Set to Infinity for no max height. Default is to limit height to available space in viewport,
62 * above or below the aroundNode or specified x/y position.
63 */
64 maxHeight?: number;
65 }
66
67 interface PopupManager {
68 /**
69 * Stack of currently popped up widgets.
70 * (someone opened _stack[0], and then it opened _stack[1], etc.)
71 */
72 _stack: _WidgetBase[];
73
74 /**
75 * Z-index of the first popup. (If first popup opens other
76 * popups they get a higher z-index.)
77 */
78 _beginZIndex: number;
79
80 _idGen: number;
81
82 /**
83 * If screen has been scrolled, reposition all the popups in the stack.
84 * Then set timer to check again later.
85 */
86 _repositionAll(): void;
87
88 /**
89 * Initialization for widgets that will be used as popups.
90 * Puts widget inside a wrapper DIV (if not already in one),
91 * and returns pointer to that wrapper DIV.
92 */
93 _createWrapper(widget: _WidgetBase): HTMLDivElement;
94
95 /**
96 * Moves the popup widget off-screen.
97 * Do not use this method to hide popups when not in use, because
98 * that will create an accessibility issue: the offscreen popup is
99 * still in the tabbing order.
100 */
101 moveOffScreen(widget: _WidgetBase): HTMLDivElement;
102
103 /**
104 * Hide this popup widget (until it is ready to be shown).
105 * Initialization for widgets that will be used as popups
106 *
107 * Also puts widget inside a wrapper DIV (if not already in one)
108 *
109 * If popup widget needs to layout it should
110 * do so when it is made visible, and popup._onShow() is called.
111 */
112 hide(widget: _WidgetBase): void;
113
114 /**
115 * Compute the closest ancestor popup that's *not* a child of another popup.
116 * Ex: For a TooltipDialog with a button that spawns a tree of menus, find the popup of the button.
117 */
118 getTopPopup(): _WidgetBase;
119
120 /**
121 * Popup the widget at the specified position
122 */
123 open(args: PopupOpenArgs): PlaceLocation;
124
125 /**
126 * Close specified popup and any popups that it parented.
127 * If no popup is specified, closes all popups.
128 */
129 close(popup?: _WidgetBase): void;
130 }
@@ -0,0 +1,55
1 import _WidgetBase = require("./_WidgetBase");
2
3 interface Registry {
4 /**
5 * Number of registered widgets
6 */
7 length: number;
8
9 /**
10 * Add a widget to the registry. If a duplicate ID is detected, a error is thrown.
11 */
12 add(widget: _WidgetBase): void;
13
14 /**
15 * Remove a widget from the registry. Does not destroy the widget; simply
16 * removes the reference.
17 */
18 remove(id: string): void;
19
20 /**
21 * Find a widget by it's id.
22 * If passed a widget then just returns the widget.
23 */
24 byId(id: string | _WidgetBase): _WidgetBase;
25
26 /**
27 * Returns the widget corresponding to the given DOMNode
28 */
29 byNode(node: Element | Node): _WidgetBase;
30
31 /**
32 * Convert registry into a true Array
33 */
34 toArray(): _WidgetBase[];
35
36 /**
37 * Generates a unique id for a given widgetType
38 */
39 getUniqueId(widgetType: string): string;
40
41 /**
42 * Search subtree under root returning widgets found.
43 * Doesn't search for nested widgets (ie, widgets inside other widgets).
44 */
45 findWidgets(root: Node, skipNode?: Node): _WidgetBase[];
46
47 /**
48 * Returns the widget whose DOM tree contains the specified DOMNode, or null if
49 * the node is not contained within the DOM tree of any widget
50 */
51 getEnclosingWidget(node: Element | Node): _WidgetBase;
52 }
53
54 declare const registry: Registry;
55 export = registry;
@@ -0,0 +1,28
1 interface AdapterRegistry {
2 /**
3 * register a check function to determine if the wrap function or
4 * object gets selected
5 */
6 register(name: string, check: (...args: any[]) => boolean, wrap: Function, directReturn?: boolean, override?: boolean): void;
7
8 /**
9 * Find an adapter for the given arguments. If no suitable adapter
10 * is found, throws an exception. match() accepts any number of
11 * arguments, all of which are passed to all matching functions
12 * from the registered pairs.
13 */
14 match(...args: any[]): any;
15
16 /**
17 * Remove a named adapter from the registry
18 */
19 unregister(name: string): boolean;
20 }
21
22 interface AdapterRegistryConstructor {
23 new (returnWrappers?: boolean): AdapterRegistry;
24 prototype: AdapterRegistry;
25 }
26
27 declare const AdapterRegistry: AdapterRegistryConstructor;
28 export = AdapterRegistry;
@@ -0,0 +1,76
1 import { PromiseCallback, DojoPromise, PromiseErrback, PromiseProgback } from "./promise/Promise";
2
3 declare namespace dojoDeferred {
4
5 interface Deferred<T> {
6
7 /**
8 * The public promise object that clients can add callbacks to.
9 */
10 promise: DojoPromise<T>;
11
12 /**
13 * Checks whether the deferred has been resolved.
14 */
15 isResolved(): boolean;
16
17 /**
18 * Checks whether the deferred has been rejected.
19 */
20 isRejected(): boolean;
21
22 /**
23 * Checks whether the deferred has been resolved or rejected.
24 */
25 isFulfilled(): boolean;
26
27 /**
28 * Checks whether the deferred has been canceled.
29 */
30 isCanceled(): boolean;
31
32 /**
33 * Emit a progress update on the deferred.
34 */
35 progress(update: any, strict?: boolean): DojoPromise<T>;
36
37 /**
38 * Resolve the deferred.
39 */
40 resolve(value?: T, strict?: boolean): DojoPromise<T>;
41
42 /**
43 * Reject the deferred.
44 */
45 reject(error?: any, strict?: boolean): DojoPromise<T>;
46
47 /**
48 * Add new callbacks to the deferred.
49 */
50 then<U>(callback?: PromiseCallback<T, U>, errback?: PromiseErrback<U>, progback?: PromiseProgback): DojoPromise<U>;
51
52 /**
53 * Inform the deferred it may cancel its asynchronous operation.
54 */
55 cancel(reason?: any, strict?: boolean): any;
56
57 /**
58 * Returns `[object Deferred]`.
59 */
60 toString(): string;
61 }
62
63 interface DeferredConstructor {
64 /**
65 * Creates a new deferred. This API is preferred over
66 * `dojo/_base/Deferred`.
67 */
68 new <T>(canceller?: (reason: any) => void): Deferred<T>;
69 prototype: Deferred<any>;
70 }
71
72 }
73
74 type dojoDeferred<T> = dojoDeferred.Deferred<T>;
75 declare const dojoDeferred: dojoDeferred.DeferredConstructor;
76 export = dojoDeferred;
@@ -0,0 +1,18
1 import { Deferred } from "./Deferred";
2
3 interface DeferredList<T> extends Deferred<T[]> {
4 /**
5 * Gathers the results of the deferreds for packaging
6 * as the parameters to the Deferred Lists' callback
7 */
8 gatherResults<T>(deferredList: DeferredList<any>): DeferredList<T>;
9 }
10
11 interface DeferredListConstructor {
12 /**
13 * Deprecated, use dojo/promise/all instead.
14 * Provides event handling for a group of Deferred objects.
15 */
16 new <T>(list: T[], fireOnOneCallback?: boolean, fireOnOneErrback?: boolean, consumeErrors?: boolean, canceller?: (reason: any) => void): DeferredList<T>;
17 prototype: DeferredList<any>;
18 } No newline at end of file
@@ -0,0 +1,16
1 import { Handle } from "./interfaces";
2
3 import { DeclareConstructor } from "./_base/declare";
4 import { ExtensionEvent } from "./on";
5
6 interface Evented {
7 on(type: string | ExtensionEvent, listener: EventListener | Function): Handle;
8 emit(type: string | ExtensionEvent, ...events: any[]): boolean;
9 }
10
11 interface EventedConstructor extends DeclareConstructor<Evented> {
12 new (params?: Object): Evented;
13 }
14
15 declare const Evented: EventedConstructor;
16 export = Evented;
@@ -0,0 +1,50
1 import { DeclareConstructor } from "./_base/declare";
2 import { Handle, WatchHandle } from "./interfaces";
3
4 interface Stateful {
5 /**
6 * Used across all instances a hash to cache attribute names and their getter
7 * and setter names.
8 */
9 _attrPairNames: { [attr: string]: string };
10
11 /**
12 * Helper function for get() and set().
13 * Caches attribute name values so we don't do the string ops every time.
14 */
15 _getAttrNames(name: string): string;
16
17 /**
18 * Automatic setting of params during construction
19 */
20 postscript(params?: Object): void;
21
22 /**
23 * Get a property on a Stateful instance.
24 */
25 get(name: string): any;
26
27 /**
28 * Set a property on a Stateful instance
29 */
30 set(name: string, value: any): this;
31 set(name: Object): this;
32
33 /**
34 * Internal helper for directly changing an attribute value.
35 */
36 _changeAttrValue(name: string, value: any): this;
37
38 /**
39 * Watches a property for changes
40 */
41 watch(callback: (prop: string, oldValue: any, newValue: any) => void): WatchHandle;
42 watch(name: string, callback: (prop: string, oldValue: any, newValue: any) => void): WatchHandle;
43 }
44
45 interface StatefulConstructor extends DeclareConstructor<Stateful> {
46 new (params?: Object): Stateful;
47 }
48
49 declare const Stateful: StatefulConstructor;
50 export = Stateful;
@@ -0,0 +1,269
1 /* dojo/_base/Color */
2
3 declare namespace dojoColor {
4 type ColorValue = [number, number, number];
5 type ColorValueAlpha = [number, number, number, number];
6
7 interface ColorObject {
8 r: number;
9 g: number;
10 b: number;
11 a?: number;
12 }
13
14 interface ColorNamed {
15 'black': ColorValue;
16 'silver': ColorValue;
17 'gray': ColorValue;
18 'white': ColorValue;
19 'maroon': ColorValue;
20 'red': ColorValue;
21 'purple': ColorValue;
22 'fuchsia': ColorValue;
23 'green': ColorValue;
24 'lime': ColorValue;
25 'olive': ColorValue;
26 'yellow': ColorValue;
27 'navy': ColorValue;
28 'blue': ColorValue;
29 'teal': ColorValue;
30 'aqua': ColorValue;
31 'transparent': [number, number, number, number];
32 }
33
34 interface Color {
35 r: number;
36 g: number;
37 b: number;
38 a: number;
39 _set(r: number, g: number, b: number, a: number): void;
40
41 /** Takes a named string, hex string, array of rgb or rgba values,
42 * an object with r, g, b, and a properties, or another `Color` object
43 * and sets this color instance to that value.
44 */
45 setColor(color: ColorValue | ColorValueAlpha | ColorObject | string): Color;
46
47 /**
48 * Ensures the object has correct attributes
49 */
50 sanitize(): Color;
51
52 /**
53 * Returns 3 component array of rgb values
54 */
55 toRgb(): ColorValue;
56
57 /**
58 * Returns a 4 component array of rgba values from the color represented by
59 * this object.
60 */
61 toRgba(): ColorValueAlpha;
62
63 /**
64 * Returns a CSS color string in hexadecimal representation
65 */
66 toHex(): string;
67
68 /**
69 * Returns a css color string in rgb(a) representation
70 */
71 toCss(includeAlpha?: boolean): string;
72
73 /**
74 * Returns a visual representation of the color
75 */
76 toString(): string;
77 }
78
79 interface ColorConstructor {
80 new(color: ColorValue | ColorValueAlpha | ColorObject | string): Color;
81 prototype: Color;
82
83 /**
84 * Dictionary list of all CSS named colors, by name. Values are 3-item arrays with corresponding RG and B values.
85 */
86 named: ColorNamed;
87
88 /**
89 * Blend colors end and start with weight from 0 to 1, 0.5 being a 50/50 blend,
90 * can reuse a previously allocated Color object for the result
91 */
92 blendColors(start: Color, end: Color, weight: number, obj?: Color): Color;
93
94 /**
95 * Returns a `Color` instance from a string of the form
96 * "rgb(...)" or "rgba(...)". Optionally accepts a `Color`
97 * object to update with the parsed value and return instead of
98 * creating a new object.
99 */
100 fromRgb(color: string, obj?: Color): Color;
101
102 /**
103 * Converts a hex string with a '#' prefix to a color object.
104 * Supports 12-bit #rgb shorthand. Optionally accepts a
105 * `Color` object to update with the parsed value.
106 */
107 fromHex(color: string, obj?: Color): Color;
108
109 /**
110 * Builds a `Color` from a 3 or 4 element array, mapping each
111 * element in sequence to the rgb(a) values of the color.
112 */
113 fromArray(color: ColorValue | ColorValueAlpha, obj?: Color): Color;
114
115 /**
116 * Parses `str` for a color value. Accepts hex, rgb, and rgba
117 * style color values.
118 */
119 fromString(str: string, obj?: Color): Color;
120 }
121
122 /* dojo/colors */
123
124 interface ColorNamed {
125 'aliceblue': ColorValue;
126 'antiquewhite': ColorValue;
127 'aquamarine': ColorValue;
128 'azure': ColorValue;
129 'beige': ColorValue;
130 'bisque': ColorValue;
131 'blanchedalmond': ColorValue;
132 'blueviolet': ColorValue;
133 'brown': ColorValue;
134 'burlywood': ColorValue;
135 'cadetblue': ColorValue;
136 'chartreuse': ColorValue;
137 'chocolate': ColorValue;
138 'coral': ColorValue;
139 'cornflowerblue': ColorValue;
140 'cornsilk': ColorValue;
141 'crimson': ColorValue;
142 'cyan': ColorValue;
143 'darkblue': ColorValue;
144 'darkcyan': ColorValue;
145 'darkgoldenrod': ColorValue;
146 'darkgray': ColorValue;
147 'darkgreen': ColorValue;
148 'darkgrey': ColorValue;
149 'darkkhaki': ColorValue;
150 'darkmagenta': ColorValue;
151 'darkolivegreen': ColorValue;
152 'darkorange': ColorValue;
153 'darkorchid': ColorValue;
154 'darkred': ColorValue;
155 'darksalmon': ColorValue;
156 'darkseagreen': ColorValue;
157 'darkslateblue': ColorValue;
158 'darkslategray': ColorValue;
159 'darkslategrey': ColorValue;
160 'darkturquoise': ColorValue;
161 'darkviolet': ColorValue;
162 'deeppink': ColorValue;
163 'deepskyblue': ColorValue;
164 'dimgray': ColorValue;
165 'dimgrey': ColorValue;
166 'dodgerblue': ColorValue;
167 'firebrick': ColorValue;
168 'floralwhite': ColorValue;
169 'forestgreen': ColorValue;
170 'gainsboro': ColorValue;
171 'ghostwhite': ColorValue;
172 'gold': ColorValue;
173 'goldenrod': ColorValue;
174 'greenyellow': ColorValue;
175 'grey': ColorValue;
176 'honeydew': ColorValue;
177 'hotpink': ColorValue;
178 'indianred': ColorValue;
179 'indigo': ColorValue;
180 'ivory': ColorValue;
181 'khaki': ColorValue;
182 'lavender': ColorValue;
183 'lavenderblush': ColorValue;
184 'lawngreen': ColorValue;
185 'lemonchiffon': ColorValue;
186 'lightblue': ColorValue;
187 'lightcoral': ColorValue;
188 'lightcyan': ColorValue;
189 'lightgoldenrodyellow': ColorValue;
190 'lightgray': ColorValue;
191 'lightgreen': ColorValue;
192 'lightgrey': ColorValue;
193 'lightpink': ColorValue;
194 'lightsalmon': ColorValue;
195 'lightseagreen': ColorValue;
196 'lightskyblue': ColorValue;
197 'lightslategray': ColorValue;
198 'lightslategrey': ColorValue;
199 'lightsteelblue': ColorValue;
200 'lightyellow': ColorValue;
201 'limegreen': ColorValue;
202 'linen': ColorValue;
203 'magenta': ColorValue;
204 'mediumaquamarine': ColorValue;
205 'mediumblue': ColorValue;
206 'mediumorchid': ColorValue;
207 'mediumpurple': ColorValue;
208 'mediumseagreen': ColorValue;
209 'mediumslateblue': ColorValue;
210 'mediumspringgreen': ColorValue;
211 'mediumturquoise': ColorValue;
212 'mediumvioletred': ColorValue;
213 'midnightblue': ColorValue;
214 'mintcream': ColorValue;
215 'mistyrose': ColorValue;
216 'moccasin': ColorValue;
217 'navajowhite': ColorValue;
218 'oldlace': ColorValue;
219 'olivedrab': ColorValue;
220 'orange': ColorValue;
221 'orangered': ColorValue;
222 'orchid': ColorValue;
223 'palegoldenrod': ColorValue;
224 'palegreen': ColorValue;
225 'paleturquoise': ColorValue;
226 'palevioletred': ColorValue;
227 'papayawhip': ColorValue;
228 'peachpuff': ColorValue;
229 'peru': ColorValue;
230 'pink': ColorValue;
231 'plum': ColorValue;
232 'powderblue': ColorValue;
233 'rosybrown': ColorValue;
234 'royalblue': ColorValue;
235 'saddlebrown': ColorValue;
236 'salmon': ColorValue;
237 'sandybrown': ColorValue;
238 'seagreen': ColorValue;
239 'seashell': ColorValue;
240 'sienna': ColorValue;
241 'skyblue': ColorValue;
242 'slateblue': ColorValue;
243 'slategray': ColorValue;
244 'slategrey': ColorValue;
245 'snow': ColorValue;
246 'springgreen': ColorValue;
247 'steelblue': ColorValue;
248 'tan': ColorValue;
249 'thistle': ColorValue;
250 'tomato': ColorValue;
251 'turquoise': ColorValue;
252 'violet': ColorValue;
253 'wheat': ColorValue;
254 'whitesmoke': ColorValue;
255 'yellowgreen': ColorValue;
256 }
257
258 interface ColorConstructor {
259 /**
260 * creates a greyscale color with an optional alpha
261 */
262 makeGrey(g: number, a?: number): Color;
263 }
264
265 }
266
267 type dojoColor = dojoColor.Color;
268 declare const dojoColor: dojoColor.ColorConstructor;
269 export = dojoColor;
@@ -0,0 +1,100
1 import DojoPromise = require("../promise/Promise");
2 import { PromiseCallback, PromiseErrback, PromiseProgback } from "../promise/Promise";
3
4 /* dojo/_base/Deferred */
5
6 interface Deferred<T> {
7
8 promise: DojoPromise<T>;
9
10 /**
11 * Checks whether the deferred has been resolved.
12 */
13 isResolved(): boolean;
14
15 /**
16 * Checks whether the deferred has been rejected.
17 */
18 isRejected(): boolean;
19
20 /**
21 * Checks whether the deferred has been resolved or rejected.
22 */
23 isFulfilled(): boolean;
24
25 /**
26 * Checks whether the deferred has been canceled.
27 */
28 isCanceled(): boolean;
29
30 /**
31 * Emit a progress update on the deferred.
32 */
33 progress(update: any, strict?: boolean): DojoPromise<T>;
34
35 /**
36 * Resolve the deferred.
37 */
38 resolve(value?: T, strict?: boolean): DojoPromise<T>;
39
40 /**
41 * Reject the deferred.
42 */
43 reject(error?: any, strict?: boolean): DojoPromise<T>;
44
45 /**
46 * The results of the Deferred
47 */
48 results: [T, any];
49
50 /**
51 * Adds callback and error callback for this deferred instance.
52 */
53 addCallbacks<U1, U2 = never>(callback?: PromiseCallback<T, U1>, errback?: PromiseErrback<U2>): Deferred<U1 | U2>;
54
55 /**
56 * Add new callbacks to the deferred.
57 */
58 then<U1, U2 = never>(callback?: PromiseCallback<T, U1>, errback?: PromiseErrback<U2>, progback?: PromiseProgback): DojoPromise<U1 | U2>;
59
60 /**
61 * Cancels the asynchronous operation
62 */
63 cancel(): void;
64
65 /**
66 * Adds successful callback for this deferred instance.
67 */
68 addCallback<U>(callback: PromiseCallback<T, U>): Deferred<U>;
69
70 /**
71 * Adds error callback for this deferred instance.
72 */
73 addErrback<U>(errback: PromiseErrback<U>): Deferred<U>;
74
75 /**
76 * Add handler as both successful callback and error callback for this deferred instance.
77 */
78 addBoth<U>(callback?: PromiseErrback<U>): Deferred<U>;
79
80 fired: number;
81 }
82
83 interface DeferredConstructor {
84 /**
85 * Deprecated. This module defines the legacy dojo/_base/Deferred API.
86 * New code should use dojo/Deferred instead.
87 */
88 new <T>(canceller?: (reason: any) => void): Deferred<T>;
89
90 prototype: Deferred<any>;
91
92 /**
93 * Transparently applies callbacks to values and/or promises.
94 */
95 when<T>(valueOrPromise: any): Deferred<T>;
96 when<T, U1, U2 = never>(valueOrPromise: any, callback?: PromiseCallback<T, U1>, errback?: PromiseErrback<U2>, progback?: PromiseProgback): Deferred<U1 | U2>;
97 }
98
99 declare const Deferred: DeferredConstructor;
100 export = Deferred; No newline at end of file
@@ -0,0 +1,90
1 import { NodeOrString } from "../interfaces";
2 import { CoordBox } from "./html";
3 import { NodeList as DojoNodeList, NodeListConstructor as DojoNodeListConstructor } from "../query";
4
5 declare module "../query" {
6 interface NodeList<T extends Node> {
7 /**
8 * Attach event handlers to every item of the NodeList. Uses dojo.connect()
9 * so event properties are normalized.
10 */
11 connect(method: string, objOrFunc: EventListener | string): this;
12 connect(method: string, objOrFunc: Object, funcName: string): this;
13
14 /**
15 * Deprecated: Use position() for border-box x/y/w/h
16 * or marginBox() for margin-box w/h/l/t.
17 * Returns the box objects of all elements in a node list as
18 * an Array (*not* a NodeList). Acts like `domGeom.coords`, though assumes
19 * the node passed is each node in this list.
20 */
21 coords(node: NodeOrString, includeScroll?: boolean): CoordBox[];
22
23 onblur(method: string, objOrFunc: EventListener | string): this;
24 onblur(method: string, objOrFunc: Object, funcName: string): this;
25
26 onfocus(method: string, objOrFunc: EventListener | string): this;
27 onfocus(method: string, objOrFunc: Object, funcName: string): this;
28
29 onchange(method: string, objOrFunc: EventListener | string): this;
30 onchange(method: string, objOrFunc: Object, funcName: string): this;
31
32 onclick(method: string, objOrFunc: EventListener | string): this;
33 onclick(method: string, objOrFunc: Object, funcName: string): this;
34
35 onerror(method: string, objOrFunc: EventListener | string): this;
36 onerror(method: string, objOrFunc: Object, funcName: string): this;
37
38 onkeydown(method: string, objOrFunc: EventListener | string): this;
39 onkeydown(method: string, objOrFunc: Object, funcName: string): this;
40
41 onkeypress(method: string, objOrFunc: EventListener | string): this;
42 onkeypress(method: string, objOrFunc: Object, funcName: string): this;
43
44 onkeyup(method: string, objOrFunc: EventListener | string): this;
45 onkeyup(method: string, objOrFunc: Object, funcName: string): this;
46
47 onload(method: string, objOrFunc: EventListener | string): this;
48 onload(method: string, objOrFunc: Object, funcName: string): this;
49
50 ondown(method: string, objOrFunc: EventListener | string): this;
51 ondown(method: string, objOrFunc: Object, funcName: string): this;
52
53 onmouseenter(method: string, objOrFunc: EventListener | string): this;
54 onmouseenter(method: string, objOrFunc: Object, funcName: string): this;
55
56 onmouseleave(method: string, objOrFunc: EventListener | string): this;
57 onmouseleave(method: string, objOrFunc: Object, funcName: string): this;
58
59 onmousemove(method: string, objOrFunc: EventListener | string): this;
60 onmousemove(method: string, objOrFunc: Object, funcName: string): this;
61
62 onmouseout(method: string, objOrFunc: EventListener | string): this;
63 onmouseout(method: string, objOrFunc: Object, funcName: string): this;
64
65 onmouseover(method: string, objOrFunc: EventListener | string): this;
66 onmouseover(method: string, objOrFunc: Object, funcName: string): this;
67
68 onmouseup(method: string, objOrFunc: EventListener | string): this;
69 onmouseup(method: string, objOrFunc: Object, funcName: string): this;
70
71 onsubmit(method: string, objOrFunc: EventListener | string): this;
72 onsubmit(method: string, objOrFunc: Object, funcName: string): this;
73 }
74
75 interface NodeListConstructor {
76 // "blur", "focus", "change", "click", "error", "keydown", "keypress",
77 // "keyup", "load", "mousedown", "mouseenter", "mouseleave", "mousemove",
78 // "mouseout", "mouseover", "mouseup", "submit"
79 events: string[];
80 }
81 }
82
83 declare module "./kernel" {
84 interface Dojo {
85 NodeList: DojoNodeListConstructor
86 }
87 }
88
89 declare const DojoNodeList: DojoNodeListConstructor;
90 export = DojoNodeList;
@@ -0,0 +1,55
1 import { GenericConstructor } from "../interfaces";
2
3 /* dojo/_base/array */
4 interface DojoArray {
5 /**
6 * Determines whether or not every item in arr satisfies the condition implemented by callback.
7 * @param {T[] | string} arr the array to iterate on. If a string, operates on individual characters.
8 * @param {Function | string} callback a function is invoked with three arguments: item, index, and
9 * array and returns true if the condition is met.
10 * @param {object} thisObj may be used to scope the call to callback
11 */
12 every<T>(arr: T[] | string, callback: string | ((item: T, idx: number, arr: T[]) => boolean), thisObj?: Object): boolean;
13
14 /**
15 * Determines whether or not any item in arr satisfies the condition implemented by callback.
16 */
17 some<T>(arr: T[] | string, callback: string | ((item: T, idx: number, arr: T[]) => boolean), thisObj?: Object): boolean;
18
19 /**
20 * locates the last index of the provided value in the passed array. If the value is not found, -1
21 * is returned.
22 * @param {boolean} findLast Makes indexOf() work like lastIndexOf(). Used internally; not meant
23 * for external usage.
24 */
25 indexOf<T>(arr: T[], value: T, fromIndex?: number, findLast?: boolean): number;
26
27 /**
28 * locates the first index of the provided value in the passed array. If the value is not found,
29 * -1 is returned.
30 */
31 lastIndexOf<T>(arr: T[], value: T, fromIndex?: number): number;
32
33 /**
34 * locates the last index of the provided value in the passed array. If the value is not found,
35 * -1 is returned.
36 */
37 forEach<T>(arr: T[], callback: string | ((item: T, idx: number, arr: T[]) => void), thisObj?: Object): void;
38
39 /**
40 * for every item in arr, callback is invoked. Return values are ignored. If you want to break
41 * out of the loop, consider using array.every() or array.some().
42 */
43 map<T, U>(arr: T[] | string, callback: string | ((item: T, idx: number, arr: T[]) => U), thisObj?: Object, Ctr?: GenericConstructor<U[]>): U[];
44
45 /**
46 * Returns a new Array with those items from arr that match the condition implemented by
47 * callback.
48 */
49 filter<T>(arr: T[], callback: string | ((item: T, idx: number, arr: T[]) => boolean), thisObj?: Object): T[];
50
51 clearCache(): void;
52 }
53
54 declare const dojoArray: DojoArray;
55 export = dojoArray;
@@ -0,0 +1,13
1 import "../ready";
2 import dojo = require("./kernel");
3 import "./connect"; // until we decide if connect is going back into non-browser environments
4 import "./unload";
5 import "./window";
6 import "./event";
7 import "./html";
8 import "./NodeList";
9 import"../query";
10 import "./xhr";
11 import "./fx";
12
13 export = dojo; No newline at end of file
@@ -0,0 +1,151
1 import { ColorValue, ColorValueAlpha } from "./Color";
2 import { HasCache } from "../has";
3 interface Config {
4 /** Defaults to `false`. If set to `true`, ensures that Dojo provides
5 * extended debugging feedback via Firebug. If Firebug is not available
6 * on your platform, setting `isDebug` to `true` will force Dojo to
7 * pull in (and display) the version of Firebug Lite which is
8 * integrated into the Dojo distribution, thereby always providing a
9 * debugging/logging console when `isDebug` is enabled. Note that
10 * Firebug's `console.*` methods are ALWAYS defined by Dojo. If
11 * `isDebug` is false and you are on a platform without Firebug, these
12 * methods will be defined as no-ops.
13 */
14 isDebug: boolean;
15
16 /**
17 * The locale to assume for loading localized resources in this page,
18 * specified according to [RFC 3066](http://www.ietf.org/rfc/rfc3066.txt).
19 * Must be specified entirely in lowercase, e.g. `en-us` and `zh-cn`.
20 * See the documentation for `dojo.i18n` and `dojo.requireLocalization`
21 * for details on loading localized resources. If no locale is specified,
22 * Dojo assumes the locale of the user agent, according to `navigator.userLanguage`
23 * or `navigator.language` properties.
24 */
25 locale: string;
26
27 /**
28 * No default value. Specifies additional locales whose
29 * resources should also be loaded alongside the default locale when
30 * calls to `dojo.requireLocalization()` are processed.
31 */
32 extraLocale: string[];
33
34 /**
35 * The directory in which `dojo.js` is located. Under normal
36 * conditions, Dojo auto-detects the correct location from which it
37 * was loaded. You may need to manually configure `baseUrl` in cases
38 * where you have renamed `dojo.js` or in which `<base>` tags confuse
39 * some browsers (e.g. IE 6). The variable `dojo.baseUrl` is assigned
40 * either the value of `djConfig.baseUrl` if one is provided or the
41 * auto-detected root if not. Other modules are located relative to
42 * this path. The path should end in a slash.
43 */
44 baseUrl: string;
45
46 /**
47 * A map of module names to paths relative to `dojo.baseUrl`. The
48 * key/value pairs correspond directly to the arguments which
49 * `dojo.registerModulePath` accepts. Specifying
50 * `djConfig.modulePaths = { "foo": "../../bar" }` is the equivalent
51 * of calling `dojo.registerModulePath("foo", "../../bar");`. Multiple
52 * modules may be configured via `djConfig.modulePaths`.
53 */
54 modulePaths: { [mid: string]: string };
55
56 /**
57 * Adds a callback via dojo/ready. Useful when Dojo is added after
58 * the page loads and djConfig.afterOnLoad is true. Supports the same
59 * arguments as dojo/ready. When using a function reference, use
60 * `djConfig.addOnLoad = function(){};`. For object with function name use
61 * `djConfig.addOnLoad = [myObject, "functionName"];` and for object with
62 * function reference use
63 * `djConfig.addOnLoad = [myObject, function(){}];`
64 */
65 addOnLoad: () => void | [any, string];
66
67 /**
68 * Run the parser after the page is loaded
69 */
70 parseOnLoad: boolean;
71
72 /**
73 * An array of module names to be loaded immediately after dojo.js has been included
74 * in a page.
75 */
76 require: string[];
77
78 /**
79 * Default duration, in milliseconds, for wipe and fade animations within dijits.
80 * Assigned to dijit.defaultDuration.
81 */
82 defaultDuration: number;
83
84 /**
85 * Used by some modules to configure an empty iframe. Used by dojo/io/iframe and
86 * dojo/back, and dijit/popup support in IE where an iframe is needed to make sure native
87 * controls do not bleed through the popups. Normally this configuration variable
88 * does not need to be set, except when using cross-domain/CDN Dojo builds.
89 * Save dojo/resources/blank.html to your domain and set `djConfig.dojoBlankHtmlUrl`
90 * to the path on your domain your copy of blank.html.
91 */
92 dojoBlankHtmlUrl: string;
93
94 /**
95 * Set this to true to enable publishing of topics for the different phases of
96 * IO operations. Publishing is done via dojo/topic.publish(). See dojo/main.__IoPublish for a list
97 * of topics that are published.
98 */
99 ioPublish: boolean;
100
101 /**
102 * If set to a value that evaluates to true such as a string or array and
103 * isDebug is true and Firebug is not available or running, then it bypasses
104 * the creation of Firebug Lite allowing you to define your own console object.
105 */
106 useCustomLogger: any;
107
108 /**
109 * Array containing the r, g, b components used as transparent color in dojo.Color;
110 * if undefined, ColorValue (white) will be used.
111 */
112 transparentColor: ColorValue | ColorValueAlpha;
113
114 /**
115 * Defines dependencies to be used before the loader has been loaded.
116 * When provided, they cause the loader to execute require(deps, callback)
117 * once it has finished loading. Should be used with callback.
118 */
119 deps: () => string[] | string[];
120
121 /**
122 * Defines the cached has API variables
123 */
124 hasCache: HasCache;
125
126 /**
127 * Defines a callback to be used when dependencies are defined before
128 * the loader has been loaded. When provided, they cause the loader to
129 * execute require(deps, callback) once it has finished loading.
130 */
131 callback: (...args: any[]) => void;
132
133 /**
134 * Whether deferred instrumentation should be loaded or included
135 * in builds.
136 */
137 deferredInstrumentation: boolean;
138
139 /**
140 * Whether the deferred instrumentation should be used.
141 *
142 * * `"report-rejections"`: report each rejection as it occurs.
143 * * `true` or `1` or `"report-unhandled-rejections"`: wait 1 second
144 * in an attempt to detect unhandled rejections.
145 */
146 useDeferredInstrumentation: string | boolean | number;
147 }
148
149 type dojoConfig = Config;
150 declare const dojoConfig: Config;
151 export = dojoConfig; No newline at end of file
@@ -0,0 +1,49
1 import { Handle } from "../interfaces";
2
3 interface Connect {
4 /**
5 * TODO: Type this better
6 */
7 _keypress(object: any, listener: EventListener): Handle;
8
9 /**
10 * `dojo.connect` is a deprecated event handling and delegation method in
11 * Dojo. It allows one function to "listen in" on the execution of
12 * any other, triggering the second whenever the first is called. Many
13 * listeners may be attached to a function, and source functions may
14 * be either regular function calls or DOM events.
15 */
16 connect(obj: any, event: string, context: any, method: EventListener | string, dontFix?: boolean): Handle;
17 connect(event: string, context: any, method: EventListener | string, dontFix?: boolean): Handle;
18
19 /**
20 * Remove a link created by dojo.connect.
21 */
22 disconnect(handle: Handle): void;
23
24 /**
25 * Attach a listener to a named topic. The listener function is invoked whenever the
26 * named topic is published (see: dojo.publish).
27 * Returns a handle which is needed to unsubscribe this listener.
28 */
29 subscribe(topic: string, context: any, method: EventListener): Handle;
30
31 /**
32 * Invoke all listener method subscribed to topic.
33 */
34 publish(topic: string, args: any[]): boolean;
35
36 /**
37 * Ensure that every time obj.event() is called, a message is published
38 * on the topic. Returns a handle which can be passed to
39 * dojo.disconnect() to disable subsequent automatic publication on
40 * the topic.
41 */
42 connectPublisher(topic: string, obj: any, method: string): Handle;
43 connectPublisher(topic: string, method: EventListener): Handle;
44
45 /**
46 * Checks an event for the copy key (meta on Mac, and ctrl anywhere else)
47 */
48 isCopyKey(e: Event): boolean;
49 } No newline at end of file
@@ -0,0 +1,140
1 declare namespace declare {
2 /* dojo/_base/declare */
3
4 /**
5 * dojo/_base/declare() returns a constructor `C`. `new C()` returns an Object with the following
6 * methods, in addition to the methods and properties specified via the arguments passed to declare().
7 */
8 interface DeclareCreatedObject {
9 declaredClass: string;
10
11 /**
12 * Calls a super method.
13 *
14 * This method is used inside method of classes produced with
15 * declare() to call a super method (next in the chain). It is
16 * used for manually controlled chaining. Consider using the regular
17 * chaining, because it is faster. Use "this.inherited()" only in
18 * complex cases.
19 *
20 * This method cannot me called from automatically chained
21 * constructors including the case of a special (legacy)
22 * constructor chaining. It cannot be called from chained methods.
23 *
24 * If "this.inherited()" cannot find the next-in-chain method, it
25 * does nothing and returns "undefined". The last method in chain
26 * can be a default method implemented in Object, which will be
27 * called last.
28 *
29 * If "name" is specified, it is assumed that the method that
30 * received "args" is the parent method for this call. It is looked
31 * up in the chain list and if it is found the next-in-chain method
32 * is called. If it is not found, the first-in-chain method is
33 * called.
34 *
35 * If "name" is not specified, it will be derived from the calling
36 * method (using a methoid property "nom").
37 */
38 inherited<U>(args: IArguments, newArgs?: any[]): U;
39 inherited(args: IArguments, newArgs?: true): Function | void;
40 inherited<U>(name: string, args: IArguments, newArgs?: any[]): U;
41 inherited(name: string, args: IArguments, newArgs?: true): Function | void;
42
43 /**
44 * Returns a super method.
45 *
46 * This method is a convenience method for "this.inherited()".
47 * It uses the same algorithm but instead of executing a super
48 * method, it returns it, or "undefined" if not found.
49 */
50 getInherited(args: IArguments): Function | void;
51 getInherited(name: string, args: IArguments): Function | void;
52
53 /**
54 * Checks the inheritance chain to see if it is inherited from this class.
55 *
56 * This method is used with instances of classes produced with
57 * declare() to determine of they support a certain interface or
58 * not. It models "instanceof" operator.
59 */
60 isInstanceOf(cls: any): boolean;
61 }
62
63 interface DeclareConstructor<T> {
64 new(...args: any[]): T & DeclareCreatedObject;
65 prototype: T;
66
67 /**
68 * Adds all properties and methods of source to constructor's
69 * prototype, making them available to all instances created with
70 * constructor. This method is specific to constructors created with
71 * declare().
72 *
73 * Adds source properties to the constructor's prototype. It can
74 * override existing properties.
75 *
76 * This method is similar to dojo.extend function, but it is specific
77 * to constructors produced by declare(). It is implemented
78 * using dojo.safeMixin, and it skips a constructor property,
79 * and properly decorates copied functions.
80 */
81 extend<U>(source: U): DeclareConstructor<T & U>;
82
83 /**
84 * Create a subclass of the declared class from a list of base classes.
85 *
86 * Create a constructor using a compact notation for inheritance and
87 * prototype extension.
88 *
89 * Mixin ancestors provide a type of multiple inheritance.
90 * Prototypes of mixin ancestors are copied to the new class:
91 * changes to mixin prototypes will not affect classes to which
92 * they have been mixed in.
93 */
94 createSubclass<U, V, X>(mixins: [DeclareConstructor<U>, DeclareConstructor<V>], props: X): DeclareConstructor<T & U & V & X>;
95 createSubclass<U, V>(mixins: [DeclareConstructor<U>], props: V): DeclareConstructor<T & U & V>;
96 createSubclass<U, V>(mixins: DeclareConstructor<U>, props: V): DeclareConstructor<T & U & V>;
97 createSubclass<U>(mixins: [DeclareConstructor<U>]): DeclareConstructor<T & U>;
98 createSubclass<U>(mixins: DeclareConstructor<U>): DeclareConstructor<T & U>;
99 createSubclass<U>(mixins: any, props: U): DeclareConstructor<T & U>;
100 }
101
102 /**
103 * Create a feature-rich constructor from compact notation.
104 */
105 interface Declare {
106 <A, B, C, D>(superClass: [DeclareConstructor<A>, DeclareConstructor<B>, DeclareConstructor<C>, DeclareConstructor<D>]): DeclareConstructor<A & B & C & D>;
107 <A, B, C>(superClass: [DeclareConstructor<A>, DeclareConstructor<B>, DeclareConstructor<C>]): DeclareConstructor<A & B & C>;
108 <A, B>(superClass: [DeclareConstructor<A>, DeclareConstructor<B>]): DeclareConstructor<A & B>;
109 <A>(superClass: DeclareConstructor<A> | [DeclareConstructor<A>]): DeclareConstructor<A>;
110
111 <A, B, C, D, E>(superClass: [DeclareConstructor<A>, DeclareConstructor<B>, DeclareConstructor<C>, DeclareConstructor<D>], props: E): DeclareConstructor<A & B & C & D & E>;
112 <A, B, C, D>(superClass: [DeclareConstructor<A>, DeclareConstructor<B>, DeclareConstructor<C>], props: D): DeclareConstructor<A & B & C & D>;
113 <A, B, C>(superClass: [DeclareConstructor<A>, DeclareConstructor<B>], props: C): DeclareConstructor<A & B & C>;
114 <A, B>(superClass: DeclareConstructor<A> | [DeclareConstructor<A>], props: B): DeclareConstructor<A & B>;
115
116 <A, B, C, D>(className: string, superClass: [DeclareConstructor<A>, DeclareConstructor<B>, DeclareConstructor<C>, DeclareConstructor<D>]): DeclareConstructor<A & B & C & D>;
117 <A, B, C>(className: string, superClass: [DeclareConstructor<A>, DeclareConstructor<B>, DeclareConstructor<C>]): DeclareConstructor<A & B & C>;
118 <A, B>(className: string, superClass: [DeclareConstructor<A>, DeclareConstructor<B>]): DeclareConstructor<A & B>;
119 <A>(className: string, superClass: DeclareConstructor<A> | [DeclareConstructor<A>]): DeclareConstructor<A>;
120
121 <A, B, C, D, E>(className: string, superClass: [DeclareConstructor<A>, DeclareConstructor<B>, DeclareConstructor<C>, DeclareConstructor<D>], props: E): DeclareConstructor<A & B & C & D & E>;
122 <A, B, C, D>(className: string, superClass: [DeclareConstructor<A>, DeclareConstructor<B>, DeclareConstructor<C>], props: D): DeclareConstructor<A & B & C & D>;
123 <A, B, C>(className: string, superClass: [DeclareConstructor<A>, DeclareConstructor<B>], props: C): DeclareConstructor<A & B & C>;
124 <A, B>(className: string, superClass: DeclareConstructor<A> | [DeclareConstructor<A>], props: B): DeclareConstructor<A & B>;
125
126 <A>(className: string, superClass: any, props: A): DeclareConstructor<A>;
127 (className: string, superClass: any): DeclareConstructor<any>;
128 <A>(superClass: any, props: A): DeclareConstructor<A>;
129 (superClass: any): DeclareConstructor<any>;
130
131 /**
132 * Mix in properties skipping a constructor and decorating functions
133 * like it is done by declare().
134 */
135 safeMixin<A, B>(target: A, source: B): A & B;
136 }
137 }
138
139 declare const declare: declare.Declare;
140 export = declare;
@@ -0,0 +1,22
1 /* dojo/_base/event */
2
3 /**
4 * This module defines dojo DOM event API. Usually you should use dojo/on, and evt.stopPropagation() +
5 * evt.preventDefault(), rather than this module.
6 */
7 interface EventModule {
8 /**
9 * normalizes properties on the event object including event
10 * bubbling methods, keystroke normalization, and x/y positions
11 */
12 fix(evt: Event, sender: Element): Event;
13
14 /**
15 * prevents propagation and clobbers the default action of the
16 * passed event
17 */
18 stop(evt: Event): void;
19 }
20
21 declare const dojoEvent: EventModule;
22 export = dojoEvent;
@@ -0,0 +1,218
1 import Evented = require("../Evented");
2
3 declare namespace fx {
4 /* dojo/_base/fx */
5
6 interface Line {
7 /**
8 * Returns the point on the line
9 * @param {number} n a floating point number greater than 0 and less than 1
10 */
11 getValue(n: number): number;
12 }
13
14 /**
15 * Object used to generate values from a start value to an end value
16 */
17 interface LineConstructor {
18 new(start: number, end: number): Line;
19 }
20
21 interface EasingFunction {
22 (n?: number): number;
23 }
24
25 interface Animation extends Evented {
26 /**
27 * The time in milliseconds the animation will take to run
28 */
29 duration: number;
30
31 /**
32 * A two element array of start and end values, or a `_Line` instance to be
33 * used in the Animation.
34 */
35 curve: Line | [number, number];
36
37 /**
38 * A Function to adjust the acceleration (or deceleration) of the progress
39 * across a _Line
40 */
41 easing?: EasingFunction;
42
43 /**
44 * The number of times to loop the animation
45 */
46 repeat: number;
47
48 /**
49 * the time in milliseconds to wait before advancing to next frame
50 * (used as a fps timer: 1000/rate = fps)
51 */
52 rate: number;
53
54 /**
55 * The time in milliseconds to wait before starting animation after it
56 * has been .play()'ed
57 */
58 delay?: number;
59
60 /**
61 * Synthetic event fired before a Animation begins playing (synchronous)
62 */
63 beforeBegin?: Event;
64
65 /**
66 * Synthetic event fired as a Animation begins playing (useful?)
67 */
68 onBegin?: Event;
69
70 /**
71 * Synthetic event fired at each interval of the Animation
72 */
73 onAnimate?: Event;
74
75 /**
76 * Synthetic event fired after the final frame of the Animation
77 */
78 onEnd?: Event;
79
80 /**
81 * Synthetic event fired any time the Animation is play()'ed
82 */
83 onPlay?: Event;
84
85 /**
86 * Synthetic event fired when the Animation is paused
87 */
88 onPause?: Event;
89
90 /**
91 * Synthetic event fires when the Animation is stopped
92 */
93 onStop?: Event;
94
95 _precent: number;
96 _startRepeatCount: number;
97 _getStep(): number;
98
99 /**
100 * Convenience function. Fire event "evt" and pass it the
101 * arguments specified in "args".
102 */
103 _fire(evt: Event, args?: any[]): this;
104
105 /**
106 * Start the animation.
107 */
108 play(delay?: number, gotoStart?: boolean): this;
109
110 _play(gotoStart?: boolean): this;
111
112 /**
113 * Pauses a running animation.
114 */
115 pause(): this;
116
117 /**
118 * Sets the progress of the animation.
119 */
120 gotoPercent(precent: number, andPlay?: boolean): this;
121
122 /**
123 * Stops a running animation.
124 */
125 stop(gotoEnd?: boolean): Animation;
126
127 /**
128 * cleanup the animation
129 */
130 destroy(): void;
131
132 /**
133 * Returns a string token representation of the status of
134 * the animation, one of: "paused", "playing", "stopped"
135 */
136 status(): string;
137
138 _cycle(): Animation;
139 _clearTimer(): void;
140 _startTimer(): void;
141 _stopTimer(): void;
142 }
143
144 /**
145 * A generic animation class that fires callbacks into its handlers
146 * object at various states.
147 */
148 interface AnimationConstructor {
149 new(args: any): Animation;
150 prototype: Animation;
151 }
152
153 interface AnimationCallback {
154 (node: HTMLElement): void;
155 }
156
157 interface FadeArguments {
158 node: HTMLElement | string;
159 duration?: number;
160 easing?: EasingFunction;
161
162 start?: Function;
163 end?: Function;
164 }
165
166 interface AnimationArgumentsProperties {
167 [name: string]: any;
168 }
169
170 interface AnimationArguments extends FadeArguments {
171 properties?: AnimationArgumentsProperties;
172 onEnd?: AnimationCallback;
173 }
174
175 interface Fx {
176 _Line: LineConstructor;
177
178 Animation: AnimationConstructor;
179
180 _fade(args: any): Animation;
181
182 /**
183 * Returns an animation that will fade node defined in 'args' from
184 * its current opacity to fully opaque.
185 */
186 fadeIn(args: FadeArguments): Animation;
187
188 /**
189 * Returns an animation that will fade node defined in 'args'
190 * from its current opacity to fully transparent.
191 */
192 fadeOut(args: FadeArguments): Animation;
193
194 _defaultEasing(n?: number): number;
195
196 /**
197 * Returns an animation that will transition the properties of
198 * node defined in `args` depending how they are defined in
199 * `args.properties`
200 */
201 animateProperty(args: AnimationArguments): Animation;
202
203 /**
204 * A simpler interface to `animateProperty()`, also returns
205 * an instance of `Animation` but begins the animation
206 * immediately, unlike nearly every other Dojo animation API.
207 */
208 anim(
209 node: HTMLElement | string,
210 properties: { [name: string]: any },
211 duration?: number,
212 easing?: Function,
213 onEnd?: AnimationCallback,
214 delay?: number): Animation;
215 }
216 }
217 declare const fx: fx.Fx;
218 export = fx;
@@ -0,0 +1,312
1 // TODO: extension
2 import { NodeOrString, ElementOrString, NodeFragmentOrString, GenericObject } from "../interfaces";
3 import dojo = require("./kernel");
4 import { DomGeometryBox, Point, DomGeometryBoxExtents, DomGeometryWidthHeight, DomGeometryXYBox } from "../dom-geometry";
5 import { DomComputedStyle } from "../dom-style";
6
7 declare module "./kernel" {
8 interface CoordBox extends DomGeometryBox, Point { }
9
10 interface Dojo {
11 /**
12 * Returns DOM node with matching `id` attribute or falsy value (ex: null or undefined)
13 * if not found. Internally if `id` is not a string then `id` returned.
14 */
15 byId(id: string, doc?: Document): Element;
16
17 /**
18 * Returns true if node is a descendant of ancestor
19 */
20 isDescendant(node: NodeOrString, ancestor: NodeOrString): boolean;
21
22 /**
23 * Enable or disable selection on a node
24 */
25 setSelectable(node: ElementOrString, selectable?: boolean): void;
26
27 /**
28 * Returns true if the requested attribute is specified on the
29 * given element, and false otherwise.
30 */
31 hasAttr(node: NodeOrString, name: string): boolean;
32
33 /**
34 * Gets an attribute on an HTML element.
35 * Because sometimes this uses node.getAttribute, it should be a string,
36 * but it can also get any other attribute on a node, therefore it is unsafe
37 * to type just a string.
38 */
39 getAttr(node: ElementOrString, name: string): any;
40
41 /**
42 * Sets an attribute on an HTML element.
43 */
44 setAttr(node: ElementOrString, name: string, value: any): Element;
45 setAttr(node: ElementOrString, map: Object): Element;
46
47 /**
48 * Removes an attribute from an HTML element.
49 */
50 removeAttr(node: NodeOrString, name: string): void;
51
52 /**
53 * Returns an effective value of a property or an attribute.
54 */
55 getNodeProp(node: NodeOrString, name: string): any;
56
57 /**
58 * Gets or sets an attribute on an HTML element.
59 */
60 attr(node: NodeOrString, name: string): any;
61 attr(node: NodeOrString, map: Object): Element;
62 attr(node: NodeOrString, name: string, value: any): Element;
63
64 /**
65 * Returns whether or not the specified classes are a portion of the
66 * class list currently applied to the node.
67 */
68 containsClass(node: NodeOrString, classStr: string): boolean;
69
70 /**
71 * Adds the specified classes to the end of the class list on the
72 * passed node. Will not re-apply duplicate classes.
73 */
74 addClass(node: NodeOrString, classStr: string | string[]): void;
75
76 /**
77 * Removes the specified classes from node. No `contains()`
78 * check is required.
79 */
80 removeClass(node: NodeOrString, classStr?: string | string[]): void;
81
82 /**
83 * Replaces one or more classes on a node if not present.
84 * Operates more quickly than calling dojo.removeClass and dojo.addClass
85 */
86 replaceClass(node: NodeOrString, addClassStr: string | string[], removeClassStr?: string | string[]): void;
87
88 /**
89 * Adds a class to node if not present, or removes if present.
90 * Pass a boolean condition if you want to explicitly add or remove.
91 * Returns the condition that was specified directly or indirectly.
92 */
93 toggleClass(node: NodeOrString, classStr: string | string[], condition?: boolean): boolean;
94
95 /**
96 * instantiates an HTML fragment returning the corresponding DOM.
97 */
98 toDom(frag: string, doc?: Document): DocumentFragment | Node;
99
100 _toDom(frag: string, doc?: Document): DocumentFragment | Node;
101
102 /**
103 * Attempt to insert node into the DOM, choosing from various positioning options.
104 * Returns the first argument resolved to a DOM node.
105 */
106 place(node: NodeFragmentOrString, refNode: NodeOrString, position?: string /* PosString */ | number): HTMLElement;
107
108 /**
109 * Create an element, allowing for optional attribute decoration
110 * and placement.
111 */
112 create(tag: NodeOrString, attrs?: GenericObject, refNode?: NodeOrString, pos?: string /* PosString */ | number): HTMLElement;
113
114 /**
115 * safely removes all children of the node.
116 */
117 empty(node: NodeOrString): void;
118
119 /**
120 * Removes a node from its parent, clobbering it and all of its
121 * children.
122 */
123 destroy(node: NodeOrString): void;
124
125 _destroyElement(node: NodeOrString): void;
126
127 /**
128 * Returns object with special values specifically useful for node
129 * fitting.
130 */
131 getPadExtents(node: Element, computedStyle?: DomComputedStyle): DomGeometryBoxExtents;
132
133 _getPadExtents(node: Element, computedStyle?: DomComputedStyle): DomGeometryBoxExtents;
134
135 /**
136 * returns an object with properties useful for noting the border
137 * dimensions.
138 */
139 getBorderExtents(node: Element, computedStyle?: DomComputedStyle): DomGeometryBoxExtents;
140
141 _getBorderExtents(node: Element, computedStyle?: DomComputedStyle): DomGeometryBoxExtents;
142
143 /**
144 * Returns object with properties useful for box fitting with
145 * regards to padding.
146 */
147 getPadBorderExtents(node: Element, computedStyle?: DomComputedStyle): DomGeometryBoxExtents;
148
149 _getPadBorderExtents(node: Element, computedStyle?: DomComputedStyle): DomGeometryBoxExtents;
150
151 /**
152 * returns object with properties useful for box fitting with
153 * regards to box margins (i.e., the outer-box).
154 * - l/t = marginLeft, marginTop, respectively
155 * - w = total width, margin inclusive
156 * - h = total height, margin inclusive
157 * The w/h are used for calculating boxes.
158 * Normally application code will not need to invoke this
159 * directly, and will use the ...box... functions instead.
160 */
161 getMarginExtents(node: Element, computedStyle?: DomComputedStyle): DomGeometryBoxExtents;
162
163 _getMarginExtents(node: Element, computedStyle?: DomComputedStyle): DomGeometryBoxExtents;
164
165 /**
166 * returns an object that encodes the width, height, left and top
167 * positions of the node's margin box.
168 */
169 getMarginBox(node: Element, computedStyle?: DomComputedStyle): DomGeometryBox;
170
171 _getMarginBox(node: Element, computedStyle?: DomComputedStyle): DomGeometryBox;
172
173 /**
174 * Returns an object that encodes the width, height, left and top
175 * positions of the node's content box, irrespective of the
176 * current box model.
177 */
178 getContentBox(node: Element, computedStyle?: DomComputedStyle): DomGeometryBox;
179
180 _getContentBox(node: Element, computedStyle?: DomComputedStyle): DomGeometryBox;
181
182 /**
183 * Sets the size of the node's contents, irrespective of margins,
184 * padding, or borders.
185 */
186 setContentSize(node: Element, box: DomGeometryWidthHeight, computedStyle?: DomComputedStyle): void;
187
188 /**
189 * sets the size of the node's margin box and placement
190 * (left/top), irrespective of box model. Think of it as a
191 * passthrough to setBox that handles box-model vagaries for
192 * you.
193 */
194 setMarginBox(node: Element, box: DomGeometryBox, computedStyle?: DomComputedStyle): void;
195
196 /**
197 * Returns true if the current language is left-to-right, and false otherwise.
198 */
199 isBodyLtr(doc?: Document): boolean;
200
201 _isBodyLtr(doc?: Document): boolean;
202
203 /**
204 * Returns an object with {node, x, y} with corresponding offsets.
205 */
206 docScroll(doc?: Document): Point;
207
208 _docScroll(doc?: Document): Point;
209
210 /**
211 * Deprecated method previously used for IE6-IE7. Now, just returns `{x:0, y:0}`.
212 */
213 getIeDocumentElementOffset(doc: Document): Point;
214
215 _getIeDocumentElementOffset(doc: Document): Point;
216
217 /**
218 * In RTL direction, scrollLeft should be a negative value, but IE
219 * returns a positive one. All codes using documentElement.scrollLeft
220 * must call this function to fix this error, otherwise the position
221 * will offset to right when there is a horizontal scrollbar.
222 */
223 fixIeBiDiScrollLeft(scrollLeft: number, doc?: Document): number;
224
225 _fixIeBiDiScrollLeft(scrollLeft: number, doc?: Document): number;
226
227 /**
228 * Gets the position and size of the passed element relative to
229 * the viewport (if includeScroll==false), or relative to the
230 * document root (if includeScroll==true).
231 */
232 position(node: Element, includeScroll?: boolean): DomGeometryXYBox;
233
234 /**
235 * returns an object that encodes the width and height of
236 * the node's margin box
237 */
238 getMarginSize(node: Element, computedStyle?: DomComputedStyle): DomGeometryWidthHeight;
239
240 _getMarginSize(node: Element, computedStyle?: DomComputedStyle): DomGeometryWidthHeight;
241
242 /**
243 * Getter/setter for the margin-box of node.
244 */
245 marginBox(node: Element): DomGeometryBox;
246 marginBox(node: Element, box: DomGeometryBox): void;
247
248 /**
249 * Getter/setter for the content-box of node.
250 */
251 contentBox(node: Element): DomGeometryBox;
252 contentBox(node: Element, box: DomGeometryWidthHeight): void;
253
254 /**
255 * Deprecated: Use position() for border-box x/y/w/h
256 * or marginBox() for margin-box w/h/l/t.
257 */
258 coords(node: NodeOrString, includeScroll?: boolean): CoordBox;
259
260 /**
261 * Gets a property on an HTML element.
262 */
263 getProp(node: ElementOrString, name: string): any;
264
265 /**
266 * Sets a property on an HTML element.
267 */
268 setProp(node: ElementOrString, name: string | Object, value?: any): Element;
269
270 /**
271 * Gets or sets a property on an HTML element.
272 */
273 prop(node: ElementOrString, name: string): string;
274 prop(node: ElementOrString, name: Object): Element;
275 prop(node: ElementOrString, name: string, value: any): Element;
276
277 /**
278 * Returns a "computed style" object.
279 */
280 getComputedStyle(node: Node): DomComputedStyle;
281
282 /**
283 * Accesses styles on a node.
284 */
285 getStyle(node: ElementOrString): DomComputedStyle;
286 getStyle(node: ElementOrString, name: string): string | number;
287
288 /**
289 * Sets styles on a node.
290 */
291 setStyle(node: ElementOrString, name: string | DomComputedStyle, value?: string): DomComputedStyle;
292
293 /**
294 * converts style value to pixels on IE or return a numeric value.
295 */
296 toPixelValue(element: Element, value: string): number;
297
298 __toPixelValue(element: Element, value: string): number;
299
300 /**
301 * Accesses styles on a node. If 2 arguments are
302 * passed, acts as a getter. If 3 arguments are passed, acts
303 * as a setter.
304 */
305 style(node: ElementOrString): DomComputedStyle;
306 style(node: ElementOrString, name: string): string | number;
307 style(node: ElementOrString, name: DomComputedStyle): DomComputedStyle;
308 style(node: ElementOrString, name: string, value: string): DomComputedStyle;
309 }
310 }
311
312 export = dojo;
@@ -0,0 +1,19
1 /* dojo/_base/json */
2 import dojo = require("./kernel");
3
4 declare module "./kernel" {
5 interface Dojo {
6 /**
7 * Parses a JavaScript expression and returns a JavaScript value.
8 */
9 fromJson(js: string): any;
10
11 _escapeString(value: any, replacer?: (key: string, value: any) => any | any[], space?: string | number): string;
12
13 toJsonIndentStr: string;
14
15 toJson(it: any, prettyPrint?: boolean): string;
16 }
17 }
18
19 export = dojo;
@@ -0,0 +1,75
1 /* dojo/_base/kernel */
2 import Config = require('./config');
3
4 declare namespace dojo {
5 interface Dijit {
6
7 }
8 interface Dojox {
9
10 }
11
12 interface Dojo {
13 config: Config;
14 global: any;
15
16 // TODO: dojot, dojox
17 dijit: Dijit;
18 dojox: Dojox;
19
20 /**
21 * a map from a name used in a legacy module to the (global variable name, object addressed by that name)
22 * always map dojo, dijit, and dojox
23 */
24 scopeMap: {
25 [scope: string]: [string, any];
26 dojo: [string, Dojo];
27 dijit: [string, Dijit];
28 dojox: [string, Dojox];
29 };
30
31 baseUrl: string;
32 isAsync: boolean;
33 locale: string;
34 version: {
35 major: number;
36 minor: number;
37 patch: number;
38 flag: string;
39 revision: number;
40 toString(): string;
41 };
42
43 /**
44 * A legacy method created for use exclusively by internal Dojo methods. Do not use this method
45 * directly unless you understand its possibly-different implications on the platforms your are targeting.
46 */
47 eval(scriptText: string): any;
48
49 exit(exitcode?: number): void;
50
51 /**
52 * Log a debug message to indicate that a behavior has been
53 * deprecated.
54 */
55 deprecated(behaviour: string, extra?: string, removal?: string): void;
56
57 /**
58 * Marks code as experimental.
59 */
60 experimental(moduleName: string, extra?: string): void;
61
62 /**
63 * Returns a URL relative to a module.
64 */
65 moduleUrl(module: string, url?: string): any;
66
67 /**
68 * for backward compatibility with layers built with 1.6 tooling
69 */
70 _hasResource: any;
71 }
72 }
73
74 declare const dojo: dojo.Dojo;
75 export = dojo;
@@ -0,0 +1,143
1 import { GenericConstructor, GenericObject } from "../interfaces";
2
3 declare namespace dojoLang {
4 /* dojo/_base/lang */
5
6 interface ReplaceCallback {
7 (match: string, name: string, offset: number, tmpl: string): string;
8 }
9
10 interface Lang {
11 /**
12 * Lists property names that must be explicitly processed during for-in iteration
13 * in environments that have has("bug-for-in-skips-shadowed") true.
14 */
15 _extraNames: string[];
16
17 /**
18 * Copies/adds all properties of one or more sources to dest; returns dest.
19 */
20 _mixin<T, U>(dest: T, source: U, copyFunc?: (s: any) => any): T & U;
21
22 /**
23 * Copies/adds all properties of one or more sources to dest; returns dest.
24 */
25 mixin<T, U>(dest: T, sources: U): T & U;
26 mixin<T, U, V>(dest: T, source1: U, source2: V): T & U & V;
27 mixin<T, U, V, W>(dest: T, source1: U, source2: V, source3: W): T & U & V & W;
28 mixin<T, U, V, W, X>(dest: T, source1: U, source2: V, source3: W, source4: X): T & U & V & W & X;
29 mixin<T, U, V, W, X, Y>(dest: T, source1: U, source2: V, source3: W, source4: X, source5: Y): T & U & V & W & X & Y;
30 mixin<T, U, V, W, X, Y, Z>(dest: T, source1: U, source2: V, source3: W, source4: X, source5: Y, source6: Z): T & U & V & W & X & Y & Z;
31 mixin<T, U>(dest: T, ...sources: U[]): T & U;
32
33 /**
34 * Set a property from a dot-separated string, such as "A.B.C"
35 */
36 setObject(name: string, value: any, context?: any): any;
37
38 /**
39 * Get a property from a dot-separated string, such as "A.B.C"
40 */
41 getObject<T>(name: string, create?: boolean, context?: any): T;
42
43 /**
44 * determine if an object supports a given method
45 */
46 exists(name: string, obj?: any): boolean;
47
48 /**
49 * Return true if it is a String
50 */
51 isString(it: any): it is string;
52
53 /**
54 * Return true if it is an Array.
55 */
56 isArray(it: any): it is any[];
57
58 /**
59 * Return true if it is a Function
60 */
61 isFunction(it: any): it is Function;
62
63 /**
64 * Returns true if it is a JavaScript object (or an Array, a Function
65 * or null)
66 */
67 isObject(it: any): it is { [id: string]: any; };
68
69 /**
70 * similar to isArray() but more permissive
71 */
72 isArrayLike(it: any): boolean;
73
74 /**
75 * Returns true if it is a built-in function or some other kind of
76 * oddball that *should* report as a function but doesn't
77 */
78 isAlien(it: any): boolean;
79
80 /**
81 * Adds all properties and methods of props to constructor's
82 * prototype, making them available to all instances created with
83 * constructor.
84 */
85 extend<T, U>(ctor: GenericConstructor<T>, props: U): GenericConstructor<T & U>;
86
87 _hitchArgs<T extends Function>(scope: any, method: T): T;
88
89 /**
90 * Returns a function that will only ever execute in the given scope.
91 * This allows for easy use of object member functions
92 * in callbacks and other places in which the "this" keyword may
93 * otherwise not reference the expected scope.
94 * Any number of default positional arguments may be passed as parameters
95 * beyond "method".
96 * Each of these values will be used to "placehold" (similar to curry)
97 * for the hitched function.
98 */
99 hitch(method: string): Function;
100 hitch<T extends Function>(method: T): T;
101 hitch<T extends Function>(scope: any, method: T): T;
102 hitch<T extends Function>(scope: any, method: string | Function, ...args: any[]): T;
103
104 /**
105 * Returns a new object which "looks" to obj for properties which it
106 * does not have a value for. Optionally takes a bag of properties to
107 * seed the returned object with initially.
108 */
109 delegate<T, U>(obj: T, props?: U): T & U;
110
111 /**
112 * Converts an array-like object (i.e. arguments, DOMCollection) to an
113 * array. Returns a new Array with the elements of obj.
114 */
115 _toArray(obj: any, offset?: number, startWith?: any[]): any[];
116
117 /**
118 * similar to hitch() except that the scope object is left to be
119 * whatever the execution context eventually becomes.
120 */
121 partial<U extends Function>(method: Function | string, ...args: any[]): U;
122
123 /**
124 * Clones objects (including DOM nodes) and all children.
125 * Warning: do not clone cyclic structures.
126 */
127 clone<T>(src: T): T;
128
129 /**
130 * Trims whitespace from both sides of the string
131 */
132 trim(str: string): string;
133
134 /**
135 * Performs parameterized substitutions on a string. Throws an
136 * exception if any parameter is unmatched.
137 */
138 replace(tmpl: string, map: GenericObject | ReplaceCallback, pattern?: RegExp): string;
139 }
140 }
141
142 declare const dojoLang: dojoLang.Lang;
143 export = dojoLang;
@@ -0,0 +1,9
1 interface Loader {
2 extractLegacyApiApplications(text: string, noCommentText?: string): any;
3 require(mid: string, require: any, loaded: (...modules: any[]) => void): void;
4 loadInit(mid: string, require: any, loaded: (...modules: any[]) => void): void;
5 }
6
7 type dojoLoader = Loader;
8 declare const dojoLoader: Loader;
9 export = dojoLoader; No newline at end of file
@@ -0,0 +1,4
1 import query = require("../query");
2 import "./NodeList";
3
4 export = query; No newline at end of file
@@ -0,0 +1,95
1 import dojo = require("./kernel");
2
3 declare module "./kernel" {
4
5 interface Dojo {
6 /**
7 * True if the client is a web-browser
8 */
9 isBrowser: boolean;
10
11 /**
12 * Version as a Number if client is FireFox. undefined otherwise. Corresponds to
13 * major detected FireFox version (1.5, 2, 3, etc.)
14 */
15 isFF: number;
16
17 /**
18 * Version as a Number if client is MSIE(PC). undefined otherwise. Corresponds to
19 * major detected IE version (6, 7, 8, etc.)
20 */
21 isIE: number;
22
23 /**
24 * Version as a Number if client is a KHTML browser. undefined otherwise. Corresponds to major
25 * detected version.
26 */
27 isKhtml: number;
28
29 /**
30 * Version as a Number if client is a WebKit-derived browser (Konqueror,
31 * Safari, Chrome, etc.). undefined otherwise.
32 */
33 isWebKit: number;
34
35 /**
36 * Version as a Number if client is a Mozilla-based browser (Firefox,
37 * SeaMonkey). undefined otherwise. Corresponds to major detected version.
38 */
39 isMozilla: number;
40
41 /**
42 * Version as a Number if client is a Mozilla-based browser (Firefox,
43 * SeaMonkey). undefined otherwise. Corresponds to major detected version.
44 */
45 isMoz: number;
46
47 /**
48 * Version as a Number if client is Opera. undefined otherwise. Corresponds to
49 * major detected version.
50 */
51 isOpera: number;
52
53 /**
54 * Version as a Number if client is Safari or iPhone. undefined otherwise.
55 */
56 isSafari: number;
57
58 /**
59 * Version as a Number if client is Chrome browser. undefined otherwise.
60 */
61 isChrome: number;
62
63 /**
64 * True if the client runs on Mac
65 */
66 isMac: number;
67
68 /**
69 * Version as a Number if client is iPhone, iPod, or iPad. undefined otherwise.
70 */
71 isIos: number;
72
73 /**
74 * Version as a Number if client is android browser. undefined otherwise.
75 */
76 isAndroid: number;
77
78 /**
79 * True if client is Wii
80 */
81 isWii: boolean;
82
83 /**
84 * Page is in quirks mode.
85 */
86 isQuirks: boolean;
87
88 /**
89 * True if client is Adobe Air
90 */
91 isAir: boolean;
92 }
93 }
94
95 export = dojo;
@@ -0,0 +1,34
1 import { GenericObject } from "../interfaces";
2
3 interface Unload {
4 /**
5 * Registers a function to be triggered when window.onunload fires.
6 * Deprecated, use on(window, "unload", lang.hitch(obj, functionName)) instead.
7 */
8 addOnWindowUnload(obj: GenericObject | Function, functionName?: string | Function): void;
9
10 /**
11 * Registers a function to be triggered when the page unloads.
12 * Deprecated, use on(window, "beforeunload", lang.hitch(obj, functionName))
13 */
14 addOnUnload(obj: GenericObject | Function, functionName?: string | Function): void;
15 }
16
17 declare module "./kernel" {
18 interface Dojo {
19 /**
20 * Registers a function to be triggered when window.onunload fires.
21 * Deprecated, use on(window, "unload", lang.hitch(obj, functionName)) instead.
22 */
23 addOnWindowUnload(obj: GenericObject | Function, functionName?: string | Function): void;
24
25 /**
26 * Registers a function to be triggered when the page unloads.
27 * Deprecated, use on(window, "beforeunload", lang.hitch(obj, functionName))
28 */
29 addOnUnload(obj: GenericObject | Function, functionName?: string | Function): void;
30 }
31 }
32
33 declare const Unload: Unload;
34 export = Unload; No newline at end of file
@@ -0,0 +1,27
1 interface Url {
2 uri: string;
3 scheme: string;
4 authority: string;
5 path: string;
6 query: string;
7 fragment: string;
8 user?: string;
9 password?: string;
10 host?: string;
11 port?: string;
12 toString(): string;
13 }
14
15 interface UrlConstructor {
16 new (...args: any[]): Url;
17 prototype: Url;
18 }
19
20 declare module "./kernel" {
21 interface Dojo {
22 _Url: UrlConstructor
23 }
24 }
25
26 declare const Url: UrlConstructor;
27 export = Url;
@@ -0,0 +1,84
1 import { GenericFunction, GenericObject } from "../interfaces";
2
3 interface DojoWindow {
4 /**
5 * Alias for the current window. 'global' can be modified
6 * for temporary context shifting. See also withGlobal().
7 */
8 global: any;
9
10 /**
11 * Alias for the current document. 'doc' can be modified
12 * for temporary context shifting. See also withDoc().
13 */
14 doc: Document;
15
16 /**
17 * Return the body element of the specified document or of dojo/_base/window::doc.
18 */
19 body(doc?: Document): HTMLBodyElement;
20
21 /**
22 * changes the behavior of many core Dojo functions that deal with
23 * namespace and DOM lookup, changing them to work in a new global
24 * context (e.g., an iframe). The varibles dojo.global and dojo.doc
25 * are modified as a result of calling this function and the result of
26 * `dojo.body()` likewise differs.
27 */
28 setContext(globalObject: GenericObject, globalDocument: Document): void;
29
30 /**
31 * Invoke callback with globalObject as dojo.global and
32 * globalObject.document as dojo.doc.
33 */
34 withGlobal<T>(globalObject: GenericObject, callback: GenericFunction<T>, thisObject?: Object, cbArguments?: any[]): T;
35
36 /**
37 * Invoke callback with documentObject as dojo/_base/window::doc.
38 */
39 withDoc<T>(documentObject: Document, callback: GenericFunction<T>, thisObject?: Object, cbArguments?: any[]): T;
40 }
41
42 declare module "./kernel" {
43 interface Dojo {
44 /**
45 * Alias for the current window. 'global' can be modified
46 * for temporary context shifting. See also withGlobal().
47 */
48 global: any;
49
50 /**
51 * Alias for the current document. 'doc' can be modified
52 * for temporary context shifting. See also withDoc().
53 */
54 doc: Document;
55
56 /**
57 * Return the body element of the specified document or of dojo/_base/window::doc.
58 */
59 body(doc?: Document): HTMLBodyElement;
60
61 /**
62 * changes the behavior of many core Dojo functions that deal with
63 * namespace and DOM lookup, changing them to work in a new global
64 * context (e.g., an iframe). The varibles dojo.global and dojo.doc
65 * are modified as a result of calling this function and the result of
66 * `dojo.body()` likewise differs.
67 */
68 setContext(globalObject: GenericObject, globalDocument: Document): void;
69
70 /**
71 * Invoke callback with globalObject as dojo.global and
72 * globalObject.document as dojo.doc.
73 */
74 withGlobal<T>(globalObject: GenericObject, callback: GenericFunction<T>, thisObject?: Object, cbArguments?: any[]): T;
75
76 /**
77 * Invoke callback with documentObject as dojo/_base/window::doc.
78 */
79 withDoc<T>(documentObject: Document, callback: GenericFunction<T>, thisObject?: Object, cbArguments?: any[]): T;
80 }
81 }
82
83 declare const dojoWindow: DojoWindow;
84 export = dojoWindow; No newline at end of file
@@ -0,0 +1,288
1 import { GenericObject } from "../interfaces";
2 import DojoPromise = require("../promise/Promise");
3 import { XhrBaseOptions, DojoRequestPromise } from "../request";
4 import Deferred = require("./Deferred");
5
6 declare namespace xhr {
7 interface IoArgs {
8 /**
9 * URL to server endpoint.
10 */
11 url: string;
12
13 /**
14 * Contains properties with string values. These
15 * properties will be serialized as name1=value2 and
16 * passed in the request.
17 */
18 content?: GenericObject;
19
20 /**
21 * Milliseconds to wait for the response. If this time
22 * passes, the then error callbacks are called.
23 */
24 timeout?: number;
25
26 /**
27 * DOM node for a form. Used to extract the form values
28 * and send to the server.
29 */
30 form?: HTMLFormElement;
31
32 /**
33 * Default is false. If true, then a
34 * "dojo.preventCache" parameter is sent in the requesa
35 * with a value that changes with each requesa
36 * (timestamp). Useful only with GET-type requests.
37 */
38 preventCache?: boolean;
39
40 /**
41 * Acceptable values depend on the type of IO
42 * transport (see specific IO calls for more information).
43 */
44 handleAs?: string;
45
46 /**
47 * Sets the raw body for an HTTP request. If this is used, then the content
48 * property is ignored. This is mostly useful for HTTP methods that have
49 * a body to their requests, like PUT or POST. This property can be used instead
50 * of postData and putData for dojo/_base/xhr.rawXhrPost and dojo/_base/xhr.rawXhrPut respectively.
51 */
52 rawBody?: string;
53
54 /**
55 * Set this explicitly to false to prevent publishing of topics related to
56 * IO operations. Otherwise, if djConfig.ioPublish is set to true, topics
57 * will be published via dojo/topic.publish() for different phases of an IO operation.
58 * See dojo/main.__IoPublish for a list of topics that are published.
59 */
60 ioPublish?: boolean;
61
62 /**
63 * This function will be
64 * called on a successful HTTP response code.
65 */
66 load?: (response: any, ioArgs: IoCallbackArgs) => void;
67
68 /**
69 * This function will
70 * be called when the request fails due to a network or server error, the url
71 * is invalid, etc. It will also be called if the load or handle callback throws an
72 * exception, unless djConfig.debugAtAllCosts is true. This allows deployed applications
73 * to continue to run even when a logic error happens in the callback, while making
74 * it easier to troubleshoot while in debug mode.
75 */
76 error?: (response: any, ioArgs: IoCallbackArgs) => void;
77
78 /**
79 * This function will
80 * be called at the end of every request, whether or not an error occurs.
81 */
82 handle?: (loadOrError: string, response: any, ioArgs: IoCallbackArgs) => void;
83 }
84
85 interface IoCallbackArgs {
86 /**
87 * the original object argument to the IO call.
88 */
89 args: GenericObject;
90
91 /**
92 * For XMLHttpRequest calls only, the
93 * XMLHttpRequest object that was used for the
94 * request.
95 */
96 xhr: XMLHttpRequest;
97
98 /**
99 * The final URL used for the call. Many times it
100 * will be different than the original args.url
101 * value.
102 */
103 url: string;
104
105 /**
106 * For non-GET requests, the
107 * name1=value1&name2=value2 parameters sent up in
108 * the request.
109 */
110 query: string;
111
112 /**
113 * The final indicator on how the response will be
114 * handled.
115 */
116 handleAs: string;
117
118 /**
119 * For dojo/io/script calls only, the internal
120 * script ID used for the request.
121 */
122 id?: string;
123
124 /**
125 * For dojo/io/script calls only, indicates
126 * whether the script tag that represents the
127 * request can be deleted after callbacks have
128 * been called. Used internally to know when
129 * cleanup can happen on JSONP-type requests.
130 */
131 canDelete?: boolean;
132
133 /**
134 * For dojo/io/script calls only: holds the JSON
135 * response for JSONP-type requests. Used
136 * internally to hold on to the JSON responses.
137 * You should not need to access it directly --
138 * the same object should be passed to the success
139 * callbacks directly.
140 */
141 json?: GenericObject;
142 }
143
144 interface XhrArgs extends IoArgs {
145 /**
146 * Acceptable values are: text (default), json, json-comment-optional,
147 * json-comment-filtered, javascript, xml. See `dojo/_base/xhr.contentHandlers`
148 */
149 handleAs?: string;
150
151 /**
152 * false is default. Indicates whether the request should
153 * be a synchronous (blocking) request.
154 */
155 sync?: boolean;
156
157 /**
158 * Additional HTTP headers to send in the request.
159 */
160 headers?: GenericObject;
161
162 /**
163 * false is default. Indicates whether a request should be
164 * allowed to fail (and therefore no console error message in
165 * the event of a failure)
166 */
167 failOk?: boolean;
168
169 /**
170 * "application/x-www-form-urlencoded" is default. Set to false to
171 * prevent a Content-Type header from being sent, or to a string
172 * to send a different Content-Type.
173 */
174 contentType: boolean | string;
175 }
176
177 interface ContentHandlers {
178 'text': (xhr: { responseText: string }) => string;
179 'json': (xhr: { responseText: string }) => GenericObject;
180 'json-comment-filtered': (xhr: { responseText: string }) => GenericObject;
181 'javascript': (xhr: { responseText: string }) => any;
182 'xml': (xhr: { responseXML: string }) => Document;
183 'json-comment-optional': (xhr: { responseText: string }) => GenericObject;
184 [type: string]: (xhr: { responseText: string, responseXML: string }) => any;
185 }
186
187 interface Xhr {
188 (method: string, args: XhrArgs, hasBody?: boolean): Deferred<any>;
189
190 /**
191 * does the work of portably generating a new XMLHTTPRequest object.
192 */
193 _xhrObj(): XMLHttpRequest | ActiveXObject;
194
195 /**
196 * Serialize a form field to a JavaScript object.
197 */
198 fieldToObject(inputNode: HTMLElement | string): GenericObject;
199
200 /**
201 * Serialize a form node to a JavaScript object.
202 */
203 formToObject(fromNode: HTMLFormElement | string): GenericObject;
204
205 /**
206 * takes a name/value mapping object and returns a string representing
207 * a URL-encoded version of that object.
208 */
209 objectToQuery(map: GenericObject): string;
210
211 /**
212 * Returns a URL-encoded string representing the form passed as either a
213 * node or string ID identifying the form to serialize
214 */
215 formToQuery(fromNode: HTMLFormElement | string): string;
216
217 /**
218 * Create a serialized JSON string from a form node or string
219 * ID identifying the form to serialize
220 */
221 formToJson(formNode: HTMLFormElement | string): string;
222
223 /**
224 * Create an object representing a de-serialized query section of a
225 * URL. Query keys with multiple values are returned in an array.
226 */
227 queryToObject(str: string): GenericObject;
228
229 /**
230 * A map of available XHR transport handle types. Name matches the
231 * `handleAs` attribute passed to XHR calls.
232 */
233 contentHandlers: ContentHandlers;
234
235 _ioCancelAll(): void;
236
237 /**
238 * If dojo.publish is available, publish topics
239 * about the start of a request queue and/or the
240 * the beginning of request.
241 *
242 * Used by IO transports. An IO transport should
243 * call this method before making the network connection.
244 */
245 _ioNotifyStart<T>(dfd: DojoPromise<T>): void;
246
247 /**
248 * Watches the io request represented by dfd to see if it completes.
249 */
250 _ioWatch<T>(dfd: DojoPromise<T>, validCheck: Function, ioCheck: Function, resHandle: Function): void;
251
252 /**
253 * Adds query params discovered by the io deferred construction to the URL.
254 * Only use this for operations which are fundamentally GET-type operations.
255 */
256 _ioAddQueryToUrl(ioArgs: IoCallbackArgs): void;
257
258 /**
259 * sets up the Deferred and ioArgs property on the Deferred so it
260 * can be used in an io call.
261 */
262 _ioSetArgs(args: IoArgs, canceller: Function, okHandler: Function, errHandler: Function): Deferred<any>;
263
264 _isDocumentOk(x: Document): boolean;
265
266 _getText(url: string): string;
267
268 /**
269 * Send an HTTP GET request using the default transport for the current platform.
270 */
271 get<T>(url: string, options?: XhrBaseOptions): DojoRequestPromise<T>;
272
273 /**
274 * Send an HTTP POST request using the default transport for the current platform.
275 */
276 post<T>(url: string, options?: XhrBaseOptions): DojoRequestPromise<T>;
277
278 /**
279 * Send an HTTP PUT request using the default transport for the current platform.
280 */
281 put<T>(url: string, options?: XhrBaseOptions): DojoRequestPromise<T>;
282
283 /**
284 * Send an HTTP DELETE request using the default transport for the current platform.
285 */
286 del<T>(url: string, options?: XhrBaseOptions): DojoRequestPromise<T>;
287 }
288 } No newline at end of file
@@ -0,0 +1,47
1 import { GenericFunction, GenericObject, Handle } from "./interfaces";
2
3 interface AfterAdvice<T> {
4 (result: T, ...args: any[]): T;
5 }
6
7 interface AroundAdvice<T> {
8 (origFn: GenericFunction<T>): (...args: any[]) => T;
9 }
10
11 interface BeforeAdvice {
12 (...args: any[]): any[] | void;
13 }
14
15 /**
16 * The "before" export of the aspect module is a function that can be used to attach
17 * "before" advice to a method. This function will be executed before the original attach
18 * is executed. This function will be called with the arguments used to call the mattach
19 * This function may optionally return an array as the new arguments to use tattach
20 * the original method (or the previous, next-to-execute before advice, if one exattach
21 * If the before method doesn't return anything (returns undefined) the original argattach
22 * will be presattach
23 * If there are multiple "before" advisors, they are executed in the reverse order they were registered.
24 */
25 export declare function before<T>(target: GenericObject, methodName: string, advice: BeforeAdvice | Function): Handle;
26
27 /**
28 * The "around" export of the aspect module is a function that can be used to attach
29 * "around" advice to a method. The advisor function is immediately executeattach
30 * the around() is called, is passed a single argument that is a function that attach
31 * called to continue execution of the original method (or the next around advattach
32 * The advisor function should return a function, and this function will be called whattach
33 * the method is called. It will be called with the arguments used to call the mattach
34 * Whatever this function returns will be returned as the result of the method call (unless after advise changes it).
35 */
36 export declare function around<T>(target: GenericObject, methodName: string, advice: AroundAdvice<T> | Function): Handle;
37
38 /**
39 * The "after" export of the aspect module is a function that can be used to attach
40 * "after" advice to a method. This function will be executed after the original method
41 * is executed. By default the function will be called with a single argument, the return
42 * value of the original method, or the the return value of the last executed advice (if a previous one exists).
43 * The fourth (optional) argument can be set to true to so the function receives the original
44 * arguments (from when the original method was called) rather than the return value.
45 * If there are multiple "after" advisors, they are executed in the order they were registered.
46 */
47 export declare function after<T>(target: GenericObject, methodName: string, advice: AfterAdvice<T> | Function, receiveArguments?: boolean): Handle;
@@ -0,0 +1,49
1 import { GenericFunction } from "./interfaces";
2
3 interface BackArgs {
4 back?: GenericFunction<void>;
5 forward?: GenericFunction<void>;
6 changeUrl?: boolean | string;
7 }
8
9
10 export declare function getHash(): string;
11 export declare function setHash(h: string): void;
12
13 /**
14 * private method. Do not call this directly.
15 */
16 export declare function goBack(): void;
17
18 /**
19 * private method. Do not call this directly.
20 */
21 export declare function goForward(): void;
22
23 /**
24 * Initializes the undo stack. This must be called from a <script>
25 * block that lives inside the `<body>` tag to prevent bugs on IE.
26 * Only call this method before the page's DOM is finished loading. Otherwise
27 * it will not work. Be careful with xdomain loading or djConfig.debugAtAllCosts scenarios,
28 * in order for this method to work, dojo/back will need to be part of a build layer.
29 */
30 export declare function init(): void;
31
32 /**
33 * Sets the state object and back callback for the very first page
34 * that is loaded.
35 * It is recommended that you call this method as part of an event
36 * listener that is registered via dojo/ready.
37 */
38 export declare function setInitialState(args: BackArgs): void;
39
40 /**
41 * adds a state object (args) to the history list.
42 */
43 export declare function addToHistory(args: BackArgs): void;
44
45 /**
46 * private method. Do not call this directly.
47 */
48 export declare function _iframeLoaded(evt: Event, ifrLoc: Location): void;
49
@@ -0,0 +1,13
1 export declare const _behaviors: { [selector: string]: any };
2
3 /**
4 * Add the specified behavior to the list of behaviors, ignoring existing
5 * matches.
6 */
7 export declare function add(behaviorObject: { [selector: string]: any }): void;
8
9 /**
10 * Applies all currently registered behaviors to the document.
11 */
12 export declare function apply(): void;
13
@@ -0,0 +1,19
1 interface CookieProps {
2 expires?: Date | string | number;
3 path?: string;
4 domain?: string;
5 secure?: boolean;
6 }
7
8 interface Cookie {
9 /* Get or set a cookie. */
10 (name: string, value?: string, props?: CookieProps): string;
11
12 /**
13 * Use to determine if the current browser supports cookies or not.
14 */
15 isSupported(): boolean;
16 }
17
18 declare const cookie: Cookie;
19 export = cookie;
@@ -0,0 +1,76
1 import { NumberFormatOptions, NumberParseOptions, NumberRegexpOptions } from "./number";
2
3 export interface CurrencyFormatOptions extends NumberFormatOptions {
4
5 /**
6 * Should not be set. Value is assumed to be "currency".
7 */
8 type?: string;
9
10 /**
11 * localized currency symbol. The default will be looked up in table of supported currencies in `dojo.cldr`
12 * A [ISO4217](http://en.wikipedia.org/wiki/ISO_4217) currency code will be used if not found.
13 */
14 symbol?: string;
15
16 /**
17 * an [ISO4217](http://en.wikipedia.org/wiki/ISO_4217) currency code, a three letter sequence like "USD".
18 * For use with dojo.currency only.
19 */
20 currency?: string;
21
22 /**
23 * number of decimal places to show. Default is defined based on which currency is used.
24 */
25 places?: number;
26 }
27
28 export interface CurrencyParseOptions extends NumberParseOptions {
29
30 /**
31 * Should not be set. Value is assumed to be "currency".
32 */
33 type?: string;
34
35 /**
36 * localized currency symbol. The default will be looked up in table of supported currencies in `dojo.cldr`
37 * A [ISO4217](http://en.wikipedia.org/wiki/ISO_4217) currency code will be used if not found.
38 */
39 symbol?: string;
40
41 /**
42 * an [ISO4217](http://en.wikipedia.org/wiki/ISO_4217) currency code, a three letter sequence like "USD".
43 * For use with dojo.currency only.
44 */
45 currency?: string;
46
47 /**
48 * number of decimal places to show. Default is defined based on which currency is used.
49 */
50 places?: number;
51
52 /**
53 * Whether to include the fractional portion, where the number of decimal places are implied by the currency
54 * or explicit 'places' parameter. The value [true,false] makes the fractional portion optional.
55 * By default for currencies, it the fractional portion is optional.
56 */
57 factional?: boolean | [boolean, boolean];
58 }
59
60 export declare function _mixInDefaults(options: NumberFormatOptions): CurrencyFormatOptions;
61
62 /**
63 * Format a Number as a currency, using locale-specific settings
64 */
65 export declare function format(value: number, options?: CurrencyFormatOptions): string;
66
67 /**
68 * Builds the regular needed to parse a currency value
69 */
70 export declare function regexp(options?: NumberRegexpOptions): string;
71
72 /**
73 * Convert a properly formatted currency string to a primitive Number,
74 * using locale-specific settings.
75 */
76 export declare function parse(expression: string, options?: CurrencyParseOptions): number;
@@ -0,0 +1,10
1 interface Debounce {
2 /**
3 * Create a function that will only execute after `wait` milliseconds
4 */
5 <T extends Function>(cb: T, wait: number): T;
6 <T extends Function>(cb: Function, wait: number, ...args: any[]): T;
7 }
8
9 declare const debounce: Debounce;
10 export = debounce; No newline at end of file
@@ -0,0 +1,36
1 import { NodeOrString, ElementOrString, GenericObject } from "./interfaces";
2
3 interface DomAttr {
4 /**
5 * Returns true if the requested attribute is specified on the
6 * given element, and false otherwise.
7 */
8 has(node: NodeOrString, name: string): boolean;
9
10 /**
11 * Gets an attribute on an HTML element.
12 * Because sometimes this uses node.getAttribute, it should be a string,
13 * but it can also get any other attribute on a node, therefore it is unsafe
14 * to type just a string.
15 */
16 get(node: ElementOrString, name: string): any;
17
18 /**
19 * Sets an attribute on an HTML element.
20 */
21 set(node: ElementOrString, name: string, value: any): Element;
22 set(node: ElementOrString, map: GenericObject): Element;
23
24 /**
25 * Removes an attribute from an HTML element.
26 */
27 remove(node: NodeOrString, name: string): void;
28
29 /**
30 * Returns an effective value of a property or an attribute.
31 */
32 getNodeProp(node: NodeOrString, name: string): any;
33 }
34
35 declare const domAttr: DomAttr;
36 export = domAttr;
@@ -0,0 +1,38
1 import { NodeOrString } from "./interfaces";
2
3 interface DomClass {
4
5 /**
6 * Returns whether or not the specified classes are a portion of the
7 * class list currently applied to the node.
8 */
9 contains(node: NodeOrString, classStr: string): boolean;
10
11 /**
12 * Adds the specified classes to the end of the class list on the
13 * passed node. Will not re-apply duplicate classes.
14 */
15 add(node: NodeOrString, classStr: string | string[]): void;
16
17 /**
18 * Removes the specified classes from node. No `contains()`
19 * check is required.
20 */
21 remove(node: NodeOrString, classStr?: string | string[]): void;
22
23 /**
24 * Replaces one or more classes on a node if not present.
25 * Operates more quickly than calling dojo.removeClass and dojo.addClass
26 */
27 replace(node: NodeOrString, addClassStr: string | string[], removeClassStr?: string | string[]): void;
28
29 /**
30 * Adds a class to node if not present, or removes if present.
31 * Pass a boolean condition if you want to explicitly add or remove.
32 * Returns the condition that was specified directly or indirectly.
33 */
34 toggle(node: NodeOrString, classStr: string | string[], condition?: boolean): boolean;
35 }
36
37 declare const domClass: DomClass;
38 export = domClass;
@@ -0,0 +1,35
1 import { NodeOrString, NodeFragmentOrString, GenericObject } from "./interfaces";
2
3 interface DomConstruct {
4
5 /**
6 * instantiates an HTML fragment returning the corresponding DOM.
7 */
8 toDom(frag: string, doc?: Document): DocumentFragment | Node;
9
10 /**
11 * Attempt to insert node into the DOM, choosing from various positioning options.
12 * Returns the first argument resolved to a DOM node.
13 */
14 place(node: NodeFragmentOrString, refNode: NodeOrString, position?: string /* PosString */ | number): HTMLElement;
15
16 /**
17 * Create an element, allowing for optional attribute decoration
18 * and placement.
19 */
20 create(tag: NodeOrString, attrs?: GenericObject, refNode?: NodeOrString, pos?: string /* PosString */ | number): HTMLElement;
21
22 /**
23 * safely removes all children of the node.
24 */
25 empty(node: NodeOrString): void;
26
27 /**
28 * Removes a node from its parent, clobbering it and all of its
29 * children.
30 */
31 destroy(node: NodeOrString): void;
32 }
33
34 declare const domConstruct: DomConstruct;
35 export = domConstruct;
@@ -0,0 +1,28
1 import { NodeOrString, GenericObject } from "./interfaces";
2
3 interface DomForm {
4 /**
5 * Serialize a form field to a JavaScript object.
6 */
7 fieldToObject(inputNode: NodeOrString): GenericObject;
8
9 /**
10 * Serialize a form node to a JavaScript object.
11 */
12 toObject(fromNode: HTMLFormElement | string): GenericObject;
13
14 /**
15 * Returns a URL-encoded string representing the form passed as either a
16 * node or string ID identifying the form to serialize
17 */
18 toQuery(fromNode: HTMLFormElement | string): string;
19
20 /**
21 * Create a serialized JSON string from a form node or string
22 * ID identifying the form to serialize
23 */
24 toJson(formNode: HTMLFormElement | string, prettyPrint?: boolean): string;
25 }
26
27 declare const domForm: DomForm;
28 export = domForm; No newline at end of file
@@ -0,0 +1,133
1 import { DomComputedStyle } from "./dom-style";
2
3 declare namespace domGeometry {
4
5 interface DomGeometryWidthHeight {
6 w?: number;
7 h?: number;
8 }
9
10 interface DomGeometryBox extends DomGeometryWidthHeight {
11 l?: number;
12 t?: number;
13 }
14
15 interface DomGeometryBoxExtents extends DomGeometryBox {
16 r?: number;
17 b?: number;
18 }
19
20 interface Point {
21 x: number;
22 y: number;
23 }
24
25 interface DomGeometryXYBox extends DomGeometryWidthHeight, Point {
26 }
27
28 interface DomGeometry {
29 boxModel: string; /* TODO: string literal 'border-box' | 'content-box' */
30
31 /**
32 * Returns object with special values specifically useful for node
33 * fitting.
34 */
35 getPadExtents(node: Element, computedStyle?: DomComputedStyle): DomGeometryBoxExtents;
36
37 /**
38 * returns an object with properties useful for noting the border
39 * dimensions.
40 */
41 getBorderExtents(node: Element, computedStyle?: DomComputedStyle): DomGeometryBoxExtents;
42
43 /**
44 * Returns object with properties useful for box fitting with
45 * regards to padding.
46 */
47 getPadBorderExtents(node: Element, computedStyle?: DomComputedStyle): DomGeometryBoxExtents;
48
49 /**
50 * returns object with properties useful for box fitting with
51 * regards to box margins (i.e., the outer-box).
52 * - l/t = marginLeft, marginTop, respectively
53 * - w = total width, margin inclusive
54 * - h = total height, margin inclusive
55 * The w/h are used for calculating boxes.
56 * Normally application code will not need to invoke this
57 * directly, and will use the ...box... functions instead.
58 */
59 getMarginExtents(node: Element, computedStyle?: DomComputedStyle): DomGeometryBoxExtents;
60
61 /**
62 * returns an object that encodes the width, height, left and top
63 * positions of the node's margin box.
64 */
65 getMarginBox(node: Element, computedStyle?: DomComputedStyle): DomGeometryBox;
66
67 /**
68 * Returns an object that encodes the width, height, left and top
69 * positions of the node's content box, irrespective of the
70 * current box model.
71 */
72 getContentBox(node: Element, computedStyle?: DomComputedStyle): DomGeometryBox;
73
74 /**
75 * Sets the size of the node's contents, irrespective of margins,
76 * padding, or borders.
77 */
78 setContentSize(node: Element, box: DomGeometryWidthHeight, computedStyle?: DomComputedStyle): void;
79
80 /**
81 * sets the size of the node's margin box and placement
82 * (left/top), irrespective of box model. Think of it as a
83 * passthrough to setBox that handles box-model vagaries for
84 * you.
85 */
86 setMarginBox(node: Element, box: DomGeometryBox, computedStyle?: DomComputedStyle): void;
87
88 /**
89 * Returns true if the current language is left-to-right, and false otherwise.
90 */
91 isBodyLtr(doc?: Document): boolean;
92
93 /**
94 * Returns an object with {node, x, y} with corresponding offsets.
95 */
96 docScroll(doc?: Document): Point;
97
98 /**
99 * Deprecated method previously used for IE6-IE7. Now, just returns `{x:0, y:0}`.
100 */
101 getIeDocumentElementOffset(doc: Document): Point;
102
103 /**
104 * In RTL direction, scrollLeft should be a negative value, but IE
105 * returns a positive one. All codes using documentElement.scrollLeft
106 * must call this function to fix this error, otherwise the position
107 * will offset to right when there is a horizontal scrollbar.
108 */
109 fixIeBiDiScrollLeft(scrollLeft: number, doc?: Document): number;
110
111 /**
112 * Gets the position and size of the passed element relative to
113 * the viewport (if includeScroll==false), or relative to the
114 * document root (if includeScroll==true).
115 */
116 position(node: Element, includeScroll?: boolean): DomGeometryXYBox;
117
118 /**
119 * returns an object that encodes the width and height of
120 * the node's margin box
121 */
122 getMarginSize(node: Element, computedStyle?: DomComputedStyle): DomGeometryWidthHeight;
123
124 /**
125 * Normalizes the geometry of a DOM event, normalizing the pageX, pageY,
126 * offsetX, offsetY, layerX, and layerX properties
127 */
128 normalizeEvent(event: Event): void;
129 }
130 }
131
132 declare const domGeometry: domGeometry.DomGeometry;
133 export = domGeometry;
@@ -0,0 +1,16
1 import { ElementOrString, GenericObject } from "./interfaces";
2
3 interface DomProp {
4 /**
5 * Gets a property on an HTML element.
6 */
7 get(node: ElementOrString, name: string): any;
8
9 /**
10 * Sets a property on an HTML element.
11 */
12 set(node: ElementOrString, name: string | GenericObject, value?: any): Element;
13 }
14
15 declare const domProp: DomProp;
16 export = domProp;
@@ -0,0 +1,37
1 import { ElementOrString } from "./interfaces";
2
3 declare namespace domStyle {
4 interface DomComputedStyle {
5 position?: string;
6 width?: string;
7 height?: string;
8 [id: string]: any;
9 }
10
11 interface DomStyle {
12 /**
13 * Returns a "computed style" object.
14 */
15 getComputedStyle(node: Node): DomComputedStyle;
16
17 /**
18 * Accesses styles on a node.
19 */
20 get(node: ElementOrString): DomComputedStyle;
21 get(node: ElementOrString, name: string): string | number;
22
23 /**
24 * Sets styles on a node.
25 */
26 set(node: ElementOrString, name: DomComputedStyle): DomComputedStyle;
27 set(node: ElementOrString, name: string, value: string | number): DomComputedStyle;
28
29 /**
30 * converts style value to pixels on IE or return a numeric value.
31 */
32 toPixelValue(element: Element, value: string): number;
33 }
34 }
35
36 declare const domStyle: domStyle.DomStyle;
37 export = domStyle; No newline at end of file
@@ -0,0 +1,22
1 import { NodeOrString, ElementOrString } from "./interfaces";
2
3 interface Dom {
4 /**
5 * Returns DOM node with matching `id` attribute or falsy value (ex: null or undefined)
6 * if not found. Internally if `id` is not a string then `id` returned.
7 */
8 byId<E extends Element>(id: string | E, doc?: Document): E;
9
10 /**
11 * Returns true if node is a descendant of ancestor
12 */
13 isDescendant(node: NodeOrString, ancestor: NodeOrString): boolean;
14
15 /**
16 * Enable or disable selection on a node
17 */
18 setSelectable(node: ElementOrString, selectable?: boolean): void;
19 }
20
21 declare const dom: Dom;
22 export = dom;
@@ -0,0 +1,61
1 declare namespace has {
2 interface HasCache {
3 [feature: string]: any;
4 }
5
6 interface HasTestFunction {
7 /* TypeScript has no way of referring to the global scope see Microsoft/TypeScript#983 */
8 (global?: any, doc?: Document, element?: Element): any;
9 }
10
11 interface Has {
12 /**
13 * Return the current value of the named feature.
14 * @param {string | number} name The name (if a string) or identifier (if an integer) of the feature to test.
15 */
16 (name: string | number): any;
17 (name: 'host-browser'): boolean;
18 (name: 'host-node'): any;
19 (name: 'host-rhino'): boolean;
20 (name: 'dom'): boolean;
21 (name: 'dojo-dom-ready-api'): 1;
22 (name: 'dojo-sniff'): 1;
23 // if host-browser is true
24 (name: 'dom-addeventlistener'): void | boolean;
25 (name: 'touch'): void | boolean;
26 (name: 'touch-events'): void | boolean;
27 (name: 'pointer-events'): void | boolean;
28 (name: 'MSPointer'): void | boolean;
29 (name: 'device-width'): void | number;
30 (name: 'dom-attributes-explicit'): void | boolean;
31 (name: 'dom-attributes-specified-flag'): void | boolean;
32 // dojo/_base/browser
33 (name: 'config-selectorEngine'): string;
34
35 cache: HasCache;
36
37 /**
38 * Register a new feature test for some named feature.
39 */
40 add(name: string | number, test: HasTestFunction, now?: boolean, force?: boolean): any;
41 add<T extends (Object | string | number | boolean | null | void)>(name: string | number, test: T, now?: boolean, force?: boolean): any;
42
43 /**
44 * Deletes the contents of the element passed to test functions.
45 */
46 clearElement(element: HTMLElement): HTMLElement;
47
48 /**
49 * Resolves id into a module id based on possibly-nested tenary expression that branches on has feature test value(s).
50 */
51 normalize(id: string, toAbsMid: Function): string; /* TODO: Align with loader api */
52
53 /**
54 * Conditional loading of AMD modules based on a has feature test value.
55 */
56 load(id: string, parentRequire: Function, loaded: Function): void; /* TODO: Align with loader api */
57 }
58 }
59
60 declare const has: has.Has;
61 export = has;
@@ -0,0 +1,1
1 export declare function hash(hash?: string, replace?: boolean): string;
@@ -0,0 +1,156
1 import { PromiseOrValue, NodeOrString } from "./interfaces";
2 import Deferred = require("./_base/Deferred");
3 import { DeclareConstructor } from "./_base/declare";
4
5 declare namespace dojoHtml {
6 type ContentSetterContent = string | Node | ArrayLike<Node>;
7
8 interface ContentSetterParams {
9 node?: NodeOrString;
10 content?: ContentSetterContent;
11 id?: string;
12 cleanContent?: boolean;
13 extractContent?: boolean;
14 parseContent?: boolean;
15 parserScope?: boolean;
16 startup?: boolean;
17 onBegin?: Function;
18 onEnd?: Function;
19 tearDown?: Function;
20 onContentError?: Function;
21 onExecError?: Function;
22 }
23
24 interface ContentSetter {
25
26 /**
27 * An node which will be the parent element that we set content into
28 */
29 node: NodeOrString;
30
31 /**
32 * The content to be placed in the node. Can be an HTML string, a node reference, or a enumerable list of nodes
33 */
34 content: ContentSetterContent;
35
36 /**
37 * Usually only used internally, and auto-generated with each instance
38 */
39 id: string;
40
41 /**
42 * Should the content be treated as a full html document,
43 * and the real content stripped of <html>, <body> wrapper before injection
44 */
45 cleanContent: boolean;
46
47 /**
48 * Should the content be treated as a full html document,
49 * and the real content stripped of `<html> <body>` wrapper before injection
50 */
51 extractContent: boolean;
52
53 /**
54 * Should the node by passed to the parser after the new content is set
55 */
56 parseContent: boolean;
57
58 /**
59 * Flag passed to parser. Root for attribute names to search for. If scopeName is dojo,
60 * will search for data-dojo-type (or dojoType). For backwards compatibility
61 * reasons defaults to dojo._scopeName (which is "dojo" except when
62 * multi-version support is used, when it will be something like dojo16, dojo20, etc.)
63 */
64 parserScope: string;
65
66 /**
67 * Start the child widgets after parsing them. Only obeyed if parseContent is true.
68 */
69 startup: boolean;
70
71 /**
72 * front-end to the set-content sequence
73 */
74 set(cont?: ContentSetterContent, params?: ContentSetterParams): Promise<Node> | Node;
75
76 /**
77 * sets the content on the node
78 */
79 setContent(): void;
80
81 /**
82 * cleanly empty out existing content
83 */
84 empty(): void;
85
86 /**
87 * Called after instantiation, but before set();
88 * It allows modification of any of the object properties -
89 * including the node and content provided - before the set operation actually takes place
90 */
91 onBegin(): Node;
92
93 /**
94 * Called after set(), when the new content has been pushed into the node
95 * It provides an opportunity for post-processing before handing back the node to the caller
96 * This default implementation checks a parseContent flag to optionally run the dojo parser over the new content
97 */
98 onEnd(): Node;
99
100 /**
101 * manually reset the Setter instance if its being re-used for example for another set()
102 */
103 tearDown(): void;
104
105 onContentError(): string;
106 onExecError(): string;
107 _mixin(params: ContentSetterParams): void;
108 parseDeferred: Deferred<any[]>;
109
110 /**
111 * runs the dojo parser over the node contents, storing any results in this.parseResults
112 */
113 _parse(): void;
114
115 /**
116 * shows user the string that is returned by on[type]Error
117 * override/implement on[type]Error and return your own string to customize
118 */
119 _onError(type: string, err: Error, consoleText?: string): void;
120 }
121
122 interface ContentSetterConstructor extends DeclareConstructor<ContentSetter> {
123 new(params?: ContentSetterParams, node?: NodeOrString): ContentSetter;
124 }
125
126 interface Html {
127 /**
128 * removes !DOCTYPE and title elements from the html string.
129 *
130 * khtml is picky about dom faults, you can't attach a style or `<title>` node as child of body
131 * must go into head, so we need to cut out those tags
132 */
133 _secureForInnerHtml(cont: string): string;
134
135 /**
136 * Deprecated, should use dojo/dom-constuct.empty() directly, remove in 2.0.
137 */
138 _emptyNode(node: NodeOrString): void;
139
140 /**
141 * inserts the given content into the given node
142 */
143 _setNodeContent<T extends Node>(node: Node, cont: string | Node | ArrayLike<T>): Node;
144
145 _ContentSetter: ContentSetterConstructor;
146
147 /**
148 * inserts (replaces) the given content into the given node. dojo/dom-construct.place(cont, node, "only")
149 * may be a better choice for simple HTML insertion.
150 */
151 set(node: Node, cont?: ContentSetterContent, params?: ContentSetterParams): PromiseOrValue<Node>;
152 }
153 }
154
155 declare const dojoHtml: dojoHtml.Html;
156 export = dojoHtml;
@@ -0,0 +1,22
1 interface I18n {
2 getLocalization(moduleName: string, bundleName: string, locale?: string): any;
3
4 dynamic: boolean;
5
6 /**
7 * Resolves id into a module id based on possibly-nested tenary expression that branches on has feature test value(s).
8 */
9 normalize(id: string, toAbsMid: Function): string; /* TODO: Align with loader api */
10
11 /**
12 * Conditional loading of AMD modules based on a has feature test value.
13 */
14 load(id: string, parentRequire: Function, loaded: Function): void; /* TODO: Align with loader api */
15
16 cache: { [bundle: string]: any };
17
18 getL10nName(moduleName: string, bundleName: string, locale?: string): string;
19 }
20
21 declare const i18n: I18n;
22 export = i18n;
@@ -0,0 +1,58
1 export type NodeOrString = Node | string;
2
3 export type ElementOrString = Element | string;
4
5 export type NodeFragmentOrString = NodeOrString | DocumentFragment;
6
7 export type PromiseOrValue<T> = T | PromiseLike<T>;
8
9 export type PromiseObjectOrArray = { [name: string]: PromiseOrValue<any> } | PromiseOrValue<any>[];
10
11 export type PromiseTypedObjectOrArray<T> = { [name: string]: PromiseOrValue<T> } | PromiseOrValue<T>[];
12
13 export interface GenericConstructor<T> {
14 new(...args: any[]): T;
15 prototype: T;
16 }
17
18 export interface GenericObject {
19 [id: string]: any;
20 }
21
22 export interface GenericFunction<T> {
23 (...args: any[]): T;
24 }
25
26 export interface Handle {
27 remove(): void;
28 }
29
30 export interface WatchHandle extends Handle {
31 unwatch(): void;
32 }
33
34 export interface EventListener {
35 (evt: any): void;
36 }
37
38 export interface BuildProfile {
39 resourceTags: { [tag: string]: (filename: string, mid?: string) => boolean; };
40 }
41
42 export interface Package {
43 location?: string;
44 main?: string;
45 name?: string;
46 }
47
48 export interface ModuleMap extends ModuleMapItem {
49 [sourceMid: string]: ModuleMapReplacement;
50 }
51
52 export interface ModuleMapItem {
53 [mid: string]: /* ModuleMapReplacement | ModuleMap */ any;
54 }
55
56 export interface ModuleMapReplacement extends ModuleMapItem {
57 [findMid: string]: /* replaceMid */ string;
58 } No newline at end of file
@@ -0,0 +1,9
1 /**
2 * Parses a [JSON](http://json.org) string to return a JavaScript object.
3 */
4 export declare function parse(str: string, strict?: boolean): any;
5
6 /**
7 * Returns a [JSON](http://json.org) serialization of an object.
8 */
9 export declare function stringify(value: any, replacer?: (key: string, value: any) => any | any[], space?: string | number): string;
@@ -0,0 +1,69
1 interface Keys {
2 BACKSPACE: number;
3 TAB: number;
4 CLEAR: number;
5 ENTER: number;
6 SHIFT: number;
7 CTRL: number;
8 ALT: number;
9 META: number;
10 PAUSE: number;
11 CAPS_LOCK: number;
12 ESCAPE: number;
13 SPACE: number;
14 PAGE_UP: number;
15 PAGE_DOWN: number;
16 END: number;
17 HOME: number;
18 LEFT_ARROW: number;
19 UP_ARROW: number;
20 RIGHT_ARROW: number;
21 DOWN_ARROW: number;
22 INSERT: number;
23 DELETE: number;
24 HELP: number;
25 LEFT_WINDOW: number;
26 RIGHT_WINDOW: number;
27 SELECT: number;
28 NUMPAD_0: number;
29 NUMPAD_1: number;
30 NUMPAD_2: number;
31 NUMPAD_3: number;
32 NUMPAD_4: number;
33 NUMPAD_5: number;
34 NUMPAD_6: number;
35 NUMPAD_7: number;
36 NUMPAD_8: number;
37 NUMPAD_9: number;
38 NUMPAD_MULTIPLY: number;
39 NUMPAD_PLUS: number;
40 NUMPAD_ENTER: number;
41 NUMPAD_MINUS: number;
42 NUMPAD_PERIOD: number;
43 NUMPAD_DIVIDE: number;
44 F1: number;
45 F2: number;
46 F3: number;
47 F4: number;
48 F5: number;
49 F6: number;
50 F7: number;
51 F8: number;
52 F9: number;
53 F10: number;
54 F11: number;
55 F12: number;
56 F13: number;
57 F14: number;
58 F15: number;
59 NUM_LOCK: number;
60 SCROLL_LOCK: number;
61 UP_DPAD: number;
62 DOWN_DPAD: number;
63 LEFT_DPAD: number;
64 RIGHT_DPAD: number;
65 copyKey: number;
66 }
67
68 declare const keys: Keys;
69 export = keys;
@@ -0,0 +1,241
1 export interface NumberFormatOptions {
2
3 /**
4 * override [formatting pattern](http://www.unicode.org/reports/tr35/#Number_Format_Patterns)
5 * with this string. Default value is based on locale. Overriding this property will defeat
6 * localization. Literal characters in patterns are not supported.
7 */
8 pattern?: string;
9
10 /**
11 * choose a format type based on the locale from the following:
12 * decimal, scientific (not yet supported), percent, currency. decimal by default.
13 */
14 type?: string;
15
16 /**
17 * fixed number of decimal places to show. This overrides any
18 * information in the provided pattern.
19 */
20 places?: number;
21
22 /**
23 * 5 rounds to nearest .5; 0 rounds to nearest whole (default). -1
24 * means do not round.
25 */
26 round?: number;
27
28 /**
29 * override the locale used to determine formatting rules
30 */
31 locale?: string;
32
33 /**
34 * If false, show no decimal places, overriding places and pattern settings.
35 */
36 factional?: boolean | [boolean, boolean];
37 }
38
39 export interface NumberFormatAbsoluteOptions {
40 /**
41 * the decimal separator
42 */
43 decimal?: string;
44
45 /**
46 * the group separator
47 */
48 group?: string;
49
50 /**
51 * number of decimal places. the range "n,m" will format to m places.
52 */
53 places?: number | string;
54
55 /**
56 * 5 rounds to nearest .5; 0 rounds to nearest whole (default). -1
57 * means don't round.
58 */
59 round?: number;
60 }
61
62 export interface NumberRegexpOptions {
63
64 /**
65 * override [formatting pattern](http://www.unicode.org/reports/tr35/#Number_Format_Patterns)
66 * with this string. Default value is based on locale. Overriding this property will defeat
67 * localization.
68 */
69 pattern?: string;
70
71 /**
72 * choose a format type based on the locale from the following:
73 * decimal, scientific (not yet supported), percent, currency. decimal by default.
74 */
75 type?: string;
76
77 /**
78 * override the locale used to determine formatting rules
79 */
80 locacle?: string;
81
82 /**
83 * strict parsing, false by default. Strict parsing requires input as produced by the format() method.
84 * Non-strict is more permissive, e.g. flexible on white space, omitting thousands separators
85 */
86 strict?: boolean;
87
88 /**
89 * number of decimal places to accept: Infinity, a positive number, or
90 * a range "n,m". Defined by pattern or Infinity if pattern not provided.
91 */
92 places?: number | string;
93 }
94
95 export interface NumberParseOptions {
96
97 /**
98 * override [formatting pattern](http://www.unicode.org/reports/tr35/#Number_Format_Patterns)
99 * with this string. Default value is based on locale. Overriding this property will defeat
100 * localization. Literal characters in patterns are not supported.
101 */
102 pattern?: string;
103
104 /**
105 * choose a format type based on the locale from the following:
106 * decimal, scientific (not yet supported), percent, currency. decimal by default.
107 */
108 type?: string;
109
110 /**
111 * override the locale used to determine formatting rules
112 */
113 locale?: string;
114
115 /**
116 * strict parsing, false by default. Strict parsing requires input as produced by the format() method.
117 * Non-strict is more permissive, e.g. flexible on white space, omitting thousands separators
118 */
119 strict?: boolean;
120
121 /**
122 * Whether to include the fractional portion, where the number of decimal places are implied by pattern
123 * or explicit 'places' parameter. The value [true,false] makes the fractional portion optional.
124 */
125 factional?: boolean | [boolean, boolean];
126 }
127
128 export interface RealNumberRegexpFlags {
129
130 /**
131 * The integer number of decimal places or a range given as "n,m". If
132 * not given, the decimal part is optional and the number of places is
133 * unlimited.
134 */
135 places?: number;
136
137 /**
138 * A string for the character used as the decimal point. Default
139 * is ".".
140 */
141 decimal?: string;
142
143 /**
144 * Whether decimal places are used. Can be true, false, or [true,
145 * false]. Default is [true, false] which means optional.
146 */
147 factional?: boolean | [boolean, boolean];
148
149 /**
150 * Express in exponential notation. Can be true, false, or [true,
151 * false]. Default is [true, false], (i.e. will match if the
152 * exponential part is present are not).
153 */
154 exponent?: boolean | [boolean, boolean];
155
156 /**
157 * The leading plus-or-minus sign on the exponent. Can be true,
158 * false, or [true, false]. Default is [true, false], (i.e. will
159 * match if it is signed or unsigned). flags in regexp.integer can be
160 * applied.
161 */
162 eSigned?: boolean | [boolean, boolean];
163 }
164
165 export interface IntegerRegexpFlags {
166
167 /**
168 * The leading plus-or-minus sign. Can be true, false, or `[true,false]`.
169 * Default is `[true, false]`, (i.e. will match if it is signed
170 * or unsigned).
171 */
172 signed?: boolean;
173
174 /**
175 * The character used as the thousands separator. Default is no
176 * separator. For more than one symbol use an array, e.g. `[",", ""]`,
177 * makes ',' optional.
178 */
179 separator?: string;
180
181 /**
182 * group size between separators
183 */
184 groupSize?: number;
185
186 /**
187 * second grouping, where separators 2..n have a different interval than the first separator (for India)
188 */
189 groupSize2?: number;
190 }
191
192 /**
193 * Format a Number as a String, using locale-specific settings
194 */
195 export declare function format(value: number, options?: NumberFormatOptions): string;
196
197 /**
198 * not precise, but good enough
199 */
200 export declare const _numberPatternRE: RegExp;
201
202 /**
203 * Apply pattern to format value as a string using options. Gives no
204 * consideration to local customs.
205 */
206 export declare function _applyPattern(value: number, pattern: string, options?: NumberFormatOptions): string;
207
208 /**
209 * Rounds to the nearest value with the given number of decimal places, away from zero
210 */
211 export declare function round(value: number, places?: number, increment?: number): number;
212
213 /**
214 * Apply numeric pattern to absolute value using options. Gives no
215 * consideration to local customs.
216 */
217 export declare function _formatAbsolute(value: number, pattern: string, options?: NumberFormatAbsoluteOptions): string;
218
219 /**
220 * Builds the regular needed to parse a number
221 */
222 export declare function regexp(options?: NumberRegexpOptions): string;
223
224 export declare function _parseInfo(options?: any): { regexp: string, group: string, decimal: string, factor: number };
225
226 /**
227 * Convert a properly formatted string to a primitive Number, using
228 * locale-specific settings.
229 */
230 export declare function parse(expression: string, options?: NumberParseOptions): number;
231
232 /**
233 * Builds a regular expression to match a real number in exponential
234 * notation
235 */
236 export declare function _realNumberRegexp(flags: RealNumberRegexpFlags): string;
237
238 /**
239 * Builds a regular expression that matches an integer
240 */
241 export declare function _integerRegexp(flags: IntegerRegexpFlags): string;
@@ -0,0 +1,71
1 import { GenericObject, Handle } from "./interfaces";
2
3 declare namespace dojoOn {
4
5 interface ExtensionEvent {
6 (target: Element | GenericObject, listener: EventListener): Handle;
7 }
8
9 interface PauseHandle extends Handle {
10 pause(): void;
11 resume(): void;
12 }
13
14 interface MatchesTarget {
15 matches(node: Element, selector: string, context?: any): any[];
16 [id: string]: any;
17 }
18
19 interface On {
20 /**
21 * A function that provides core event listening functionality. With this function
22 * you can provide a target, event type, and listener to be notified of
23 * future matching events that are fired.
24 */
25 (target: Element | GenericObject, type: string | ExtensionEvent, listener: EventListener | Function, dontFix?: boolean): Handle;
26
27 /**
28 * This function acts the same as on(), but with pausable functionality. The
29 * returned signal object has pause() and resume() functions. Calling the
30 * pause() method will cause the listener to not be called for future events.
31 */
32 pausable(target: Element | GenericObject, type: string | ExtensionEvent, listener: EventListener | Function, dontFix?: boolean): Handle;
33
34 /**
35 * This function acts the same as on(), but will only call the listener once. The
36 * listener will be called for the first
37 * event that takes place and then listener will automatically be removed.
38 */
39 once(target: Element | GenericObject, type: string | ExtensionEvent, listener: EventListener | Function, dontFix?: boolean): Handle;
40
41 parse(target: Element | GenericObject, type: string | ExtensionEvent, listener: EventListener | Function, dontFix: boolean, matchesTarget: Element | GenericObject): Handle;
42
43 /**
44 * Check if a node match the current selector within the constraint of a context
45 */
46 matches(node: Element, selector: string, context: Element, children: boolean, matchesTarget?: MatchesTarget): Element | boolean;
47
48 /**
49 * Creates a new extension event with event delegation. This is based on
50 * the provided event type (can be extension event) that
51 * only calls the listener when the CSS selector matches the target of the event.
52 *
53 * The application must require() an appropriate level of dojo/query to handle the selector.
54 */
55 selector(selector: string, type: string | ExtensionEvent, children?: boolean): ExtensionEvent;
56
57 /**
58 * Fires an event on the target object.
59 */
60 emit(target: Element | GenericObject, type: string | ExtensionEvent, event?: any): boolean;
61
62 /**
63 * normalizes properties on the event object including event
64 * bubbling methods, keystroke normalization, and x/y positions
65 */
66 _fixEvent(evt: any, sender: any): any;
67 }
68 }
69
70 declare const dojoOn: dojoOn.On;
71 export = dojoOn;
@@ -0,0 +1,4
1 {
2 "name": "@types/dojo",
3 "version": "1.0.1-rc1"
4 } No newline at end of file
@@ -0,0 +1,83
1 import { PromiseOrValue, GenericConstructor } from "./interfaces";
2 import DojoPromise = require("./promise/Promise");
3
4 declare namespace dojoParser {
5 interface ParserOptions { }
6
7 interface ParserObjects {
8 ctor?: GenericConstructor<any>;
9 types?: string[];
10 node: Node;
11 scripts?: HTMLScriptElement[];
12 inherited?: { [prop: string]: any; };
13 }
14
15 interface InstancesArray extends Array<any>, DojoPromise<any> {}
16
17 interface Parser {
18 /**
19 * Clear cached data. Used mainly for benchmarking.
20 */
21 _clearCache(): void;
22
23 /**
24 * Convert a `<script type="dojo/method" args="a, b, c"> ... </script>`
25 * into a function
26 */
27 _functionFromScript(node: HTMLScriptElement, attrData: string): Function;
28
29 /**
30 * Takes array of nodes, and turns them into class instances and
31 * potentially calls a startup method to allow them to connect with
32 * any children.
33 */
34 instantiate(nodes: Node[], mixin?: Object, options?: ParserOptions): any[];
35
36 /**
37 * Takes array of objects representing nodes, and turns them into class instances and
38 * potentially calls a startup method to allow them to connect with
39 * any children.
40 */
41 _instantiate(nodes: ParserObjects[], mixin?: Object, options?: ParserOptions, returnPromise?: boolean): PromiseOrValue<any[]>;
42
43 /**
44 * Calls new ctor(params, node), where params is the hash of parameters specified on the node,
45 * excluding data-dojo-type and data-dojo-mixins. Does not call startup().
46 */
47 construct<T>(
48 ctor: GenericConstructor<T>,
49 node: Node, mixin?: Object,
50 options?: ParserOptions,
51 scripts?: HTMLScriptElement[],
52 inherited?: { [prop: string]: any; }
53 ): PromiseOrValue<T>;
54
55 /**
56 * Scan a DOM tree and return an array of objects representing the DOMNodes
57 * that need to be turned into widgets.
58 */
59 scan(root?: Node, options?: ParserOptions): DojoPromise<ParserObjects[]>;
60
61 /**
62 * Helper for _scanAMD(). Takes a `<script type=dojo/require>bar: "acme/bar", ...</script>` node,
63 * calls require() to load the specified modules and (asynchronously) assign them to the specified global
64 * variables, and returns a Promise for when that operation completes.
65 *
66 * In the example above, it is effectively doing a require(["acme/bar", ...], function(a){ bar = a; }).
67 */
68 _require(script: HTMLScriptElement, options: ParserOptions): DojoPromise<any>;
69
70 /**
71 * Scans the DOM for any declarative requires and returns their values.
72 */
73 _scanAmd(root?: Node, options?: ParserOptions): DojoPromise<boolean>;
74
75 /**
76 * Scan the DOM for class instances, and instantiate them.
77 */
78 parse(rootNode?: Node, options?: ParserOptions): InstancesArray;
79 }
80 }
81
82 declare const dojoParser: dojoParser.Parser;
83 export = dojoParser;
@@ -0,0 +1,68
1 declare namespace DojoPromise {
2 interface Thenable<T> extends PromiseLike<T> {
3 /**
4 * Add new callbacks to the promise.
5 */
6 then<U1, U2>(callback?: PromiseCallback<T, U1>, errback?: PromiseErrback<U2>, progback?: PromiseProgback): Thenable<U1 | U2>;
7 }
8
9 type PromiseCallback<T, U> = ((value: T) => U | PromiseLike<U>) | undefined | null;
10
11 type PromiseErrback<U> = PromiseCallback<any, U>;
12
13 type PromiseProgback = (progress: any) => void;
14
15 interface DojoPromise<T> extends Thenable<T> {
16
17 /**
18 * Inform the deferred it may cancel its asynchronous operation.
19 */
20 cancel(reason?: any, strict?: boolean): any;
21
22 /**
23 * Checks whether the promise has been resolved.
24 */
25 isResolved(): boolean;
26
27 /**
28 * Checks whether the promise has been rejected.
29 */
30 isRejected(): boolean;
31
32 /**
33 * Checks whether the promise has been resolved or rejected.
34 */
35 isFulfilled(): boolean;
36
37 /**
38 * Checks whether the promise has been canceled.
39 */
40 isCanceled(): boolean;
41
42 /**
43 * Add a callback to be invoked when the promise is resolved
44 * or rejected.
45 */
46 always<U>(callbackOrErrback: PromiseCallback<any, U>): DojoPromise<U>;
47
48 /**
49 * Add new errbacks to the promise.
50 */
51 otherwise<U>(errback: PromiseErrback<U>): DojoPromise<U>;
52
53 trace(): this;
54 traceRejected(): this;
55 toString(): string;
56 }
57
58 interface DojoPromiseConstructor {
59 /**
60 * The public interface to a deferred.
61 */
62 new <T>(): DojoPromise<T>;
63 }
64 }
65
66 type DojoPromise<T> = DojoPromise.DojoPromise<T>;
67 declare const DojoPromise: DojoPromise.DojoPromiseConstructor;
68 export = DojoPromise;
@@ -0,0 +1,24
1 import { PromiseOrValue } from "../interfaces";
2
3 declare namespace promiseAll {
4
5
6 interface All {
7 /**
8 * Takes multiple promises and returns a new promise that is fulfilled
9 * when all promises have been resolved or one has been rejected.
10 * @param objectOrArray The promise will be fulfilled with a list of results if invoked with an
11 * array, or an object of results when passed an object (using the same
12 * keys). If passed neither an object or array it is resolved with an
13 * undefined value.
14 */
15 <T>(array: PromiseOrValue<T>[]): PromiseOrValue<T[]>;
16 <T>(object: { [name: string]: PromiseOrValue<T> }): PromiseLike<{ [name: string]: T }>;
17 (array: PromiseOrValue<any>[]): PromiseOrValue<any[]>;
18 (object: { [name: string]: PromiseOrValue<any> }): PromiseLike<{ [name: string]: any }>;
19 }
20 }
21
22 declare const promiseAll: promiseAll.All;
23 export = promiseAll;
24
@@ -0,0 +1,15
1 import { PromiseTypedObjectOrArray, PromiseObjectOrArray } from "../interfaces";
2
3 interface First {
4 /**
5 * Takes multiple promises and returns a new promise that is fulfilled
6 * when the first of these promises is fulfilled.
7 * @param objectOrArray The promises are taken from the array or object values. If no value
8 * is passed, the returned promise is resolved with an undefined value.
9 */
10 <T>(objectOrArray?: PromiseTypedObjectOrArray<T>): Promise<T>;
11 (objectOrArray?: PromiseObjectOrArray): Promise<any>;
12 }
13
14 declare const First: First;
15 export = First;
@@ -0,0 +1,11
1 import { DeferredConstructor } from "../Deferred";
2
3 interface Instrumentation {
4 /**
5 * Initialize instrumentation for the Deferred class.
6 */
7 (Deferred: DeferredConstructor): void;
8 }
9
10 declare const Instrumentation: Instrumentation;
11 export = Instrumentation; No newline at end of file
@@ -0,0 +1,11
1 import { Handle } from "../interfaces";
2
3 interface Tracer {
4 /**
5 * Subscribe to traces.
6 */
7 on(type: string /* TracerEvent */, listener: EventListener): Handle;
8 }
9
10 declare const Tracer: Tracer;
11 export = Tracer;
@@ -0,0 +1,186
1 import { NodeOrString, Handle, GenericConstructor } from "./interfaces";
2
3 declare namespace dojoQuery {
4 /* dojo/query */
5
6 interface NodeListFilterCallback<T extends Node> {
7 (item: T, idx: number, nodeList: this): boolean;
8 }
9
10 type NodeListFilter<T extends Node> = string | NodeListFilterCallback<T>;
11
12 interface NodeList<T extends Node> extends ArrayLike<T> {
13 /**
14 * decorate an array to make it look like a `dojo/NodeList`.
15 */
16 _wrap<U extends Node, V extends Node>(a: U[], parent?: NodeList<V>, NodeListCtor?: NodeListConstructor): NodeList<U>;
17
18 _NodeListCtor: NodeListConstructor;
19 toString(): string;
20
21 /**
22 * private function to hold to a parent NodeList. end() to return the parent NodeList.
23 */
24 _stash(parent: Node): this;
25
26 /**
27 * Listen for events on the nodes in the NodeList.
28 */
29 on(eventName: string, listener: EventListener): Handle[];
30
31 /**
32 * Ends use of the current `NodeList` by returning the previous NodeList
33 * that generated the current NodeList.
34 */
35 end<U extends Node>(): NodeList<U>;
36
37 /**
38 * Returns a new NodeList, maintaining this one in place
39 */
40 slice(begin: number, end?: number): this;
41
42 /**
43 * Returns a new NodeList, manipulating this NodeList based on
44 * the arguments passed, potentially splicing in new elements
45 * at an offset, optionally deleting elements
46 */
47 splice(index: number, howmany?: number, ...items: T[]): this;
48
49 /**
50 * see `dojo/_base/array.indexOf()`. The primary difference is that the acted-on
51 * array is implicitly this NodeList
52 */
53 indexOf(value: T, fromIndex?: number, findLast?: boolean): number;
54
55 /**
56 * see `dojo/_base/array.lastIndexOf()`. The primary difference is that the
57 * acted-on array is implicitly this NodeList
58 */
59 lastIndexOf(value: T, fromIndex?: number): number;
60
61 /**
62 * see `dojo/_base/array.every()` and the [Array.every
63 * docs](https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Array/every).
64 * Takes the same structure of arguments and returns as
65 * dojo/_base/array.every() with the caveat that the passed array is
66 * implicitly this NodeList
67 */
68 every(callback: (item: T, idx: number, nodeList: this) => boolean | string, thisObj?: Object): boolean;
69
70 /**
71 * Takes the same structure of arguments and returns as
72 * `dojo/_base/array.some()` with the caveat that the passed array as
73 * implicitly this NodeList. See `dojo/_base/array.some()` and Mozillaas
74 * [Array.soas
75 * documentation](https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Array/some).
76 */
77 some(callback: (item: T, idx: number, nodeList: this) => boolean | string, thisObj?: Object): boolean;
78
79 /**
80 * Returns a new NodeList comprised of items in this NodeList
81 * as well as items passed in as parameters
82 */
83 concat(...items: T[]): this;
84
85 /**
86 * see `dojo/_base/array.map()`. The primary difference is that the acted-on
87 * array is implicitly this NodeList and the return is a
88 * NodeList (a subclass of Array)
89 */
90 map<U extends Node>(func: (item: T, idx: number, nodeList: this) => U, obj?: Object): NodeList<U>;
91
92 /**
93 * see `dojo/_base/array.forEach()`. The primary difference is that the acted-on
94 * array is implicitly this NodeList. If you want the option to break out
95 * of the forEach loop, use every() or some() instead.
96 */
97 forEach(callback: (item: T, idx: number, nodeList: this) => void, thisObj?: Object): this;
98
99 /**
100 * "masks" the built-in javascript filter() method (supported
101 * in Dojo via `dojo/_base/array.filter`) to support passing a simple
102 * string filter in addition to supporting filtering function
103 * objects.
104 */
105 filter<U extends Node>(filter: NodeListFilter<T>, thisObj?: Object): NodeList<U>;
106
107 /**
108 * Create a new instance of a specified class, using the
109 * specified properties and each node in the NodeList as a
110 * srcNodeRef.
111 */
112 instantiate(declaredClass: string | GenericConstructor<any>, properties?: Object): this;
113
114 /**
115 * Returns a new NodeList comprised of items in this NodeList
116 * at the given index or indices.
117 */
118 at(...indices: number[]): this;
119
120 }
121
122 interface NodeListConstructor {
123 new <T extends Node>(array: number | Array<T>): NodeList<T>;
124 new <T extends Node>(...args: T[]): NodeList<T>;
125 <T extends Node>(array: number | Array<T>): NodeList<T>;
126 <T extends Node>(...args: T[]): NodeList<T>;
127
128 prototype: NodeList<any>;
129
130 /**
131 * decorate an array to make it look like a `dojo/NodeList`.
132 */
133 _wrap<U extends Node, V extends Node>(a: U[], parent?: NodeList<V>, NodeListCtor?: NodeListConstructor): NodeList<U>;
134
135 /**
136 * adapts a single node function to be used in the map-type
137 * actions. The return is a new array of values, as via `dojo/_base/array.map`
138 */
139 _adaptAsMap<T extends Node, U extends Node>(f: (node: T) => U, o?: Object): NodeList<U>;
140
141 /**
142 * adapts a single node function to be used in the forEach-type
143 * actions. The initial object is returned from the specialized
144 * function.
145 */
146 _adaptAsForEach<T extends Node>(f: (node: T) => void, o?: Object): this;
147
148 /**
149 * adapts a single node function to be used in the filter-type actions
150 */
151 _adaptAsFilter<T extends Node>(f: (node: T) => boolean, o?: Object): this;
152
153 /**
154 * adapts a single node function to be used in the map-type
155 * actions, behaves like forEach() or map() depending on arguments
156 */
157 _adaptWithCondition<T extends Node, U extends Node>(f: (node: T) => U | void, g: (...args: any[]) => boolean, o?: Object): NodeList<U> | this;
158 }
159
160 interface Query {
161 /**
162 * Returns nodes which match the given CSS selector, searching the
163 * entire document by default but optionally taking a node to scope
164 * the search by. Returns an instance of NodeList.
165 */
166 <T extends Node>(query: string, root?: NodeOrString): NodeList<T>;
167
168 /**
169 * Test to see if a node matches a selector
170 */
171 matches(node: Node, selector: string, root?: NodeOrString): boolean;
172
173 /**
174 * Filters an array of nodes. Note that this does not guarantee to return a NodeList, just an array.
175 */
176 filter<T extends Node>(nodes: NodeList<T> | T[], select: string, root?: NodeOrString): T[] | NodeList<T>;
177
178 /**
179 * can be used as AMD plugin to conditionally load new query engine
180 */
181 load(id: string, parentRequire: Function, loaded: Function): void; /* TODO: Align with loader api */
182 }
183 }
184
185 declare const dojoQuery: dojoQuery.Query;
186 export = dojoQuery; No newline at end of file
@@ -0,0 +1,11
1 /**
2 * Add a function to execute on DOM content loaded and all requested modules have arrived and been evaluated.
3 * In most cases, the `domReady` plug-in should suffice and this method should not be needed.
4 *
5 * When called in a non-browser environment, just checks that all requested modules have arrived and been
6 * evaluated.
7 */
8 export declare function ready(callback: Function): void;
9 export declare function ready(context: Object, callback: Function | string): void;
10 export declare function ready(priority: number, callback: Function): void;
11 export declare function ready(priority: number, context: Object, callback: Function | string): void;
@@ -0,0 +1,436
1 import { GenericObject, Handle } from "./interfaces";
2 import { DojoPromise } from "./promise/Promise";
3 import { Deferred } from "./Deferred";
4
5 declare namespace dojoRequest {
6
7 /* dojo/request */
8
9 interface DojoRequestPromise<T> extends DojoPromise<T> {
10 response: DojoPromise<Response<T>>;
11 }
12
13 interface BaseOptions {
14 /**
15 * Query parameters to append to the URL.
16 */
17 query?: string | { [name: string]: any };
18
19 /**
20 * Data to transfer. This is ignored for GET and DELETE
21 * requests.
22 */
23 data?: string | { [name: string]: any };
24
25 /**
26 * Whether to append a cache-busting parameter to the URL.
27 */
28 preventCache?: boolean;
29
30 /**
31 * Milliseconds to wait for the response. If this time
32 * passes, the then the promise is rejected.
33 */
34 timeout?: number;
35
36 /**
37 * How to handle the response from the server. Default is
38 * 'text'. Other values are 'json', 'javascript', and 'xml'.
39 */
40 handleAs?: string;
41 }
42
43 interface MethodOptions {
44 /**
45 * The HTTP method to use to make the request. Must be
46 * uppercase.
47 */
48 method?: string;
49 }
50
51 interface RequestOptions extends BaseOptions, MethodOptions { }
52
53 interface Request {
54 /**
55 * Send a request using the default transport for the current platform.
56 */
57 <T>(url: string, options?: RequestOptions): DojoRequestPromise<T>;
58
59 /**
60 * Send an HTTP GET request using the default transport for the current platform.
61 */
62 get<T>(url: string, options?: BaseOptions): DojoRequestPromise<T>;
63
64 /**
65 * Send an HTTP POST request using the default transport for the current platform.
66 */
67 post<T>(url: string, options?: BaseOptions): DojoRequestPromise<T>;
68
69 /**
70 * Send an HTTP PUT request using the default transport for the current platform.
71 */
72 put<T>(url: string, options?: BaseOptions): DojoRequestPromise<T>;
73
74 /**
75 * Send an HTTP DELETE request using the default transport for the current platform.
76 */
77 del<T>(url: string, options?: BaseOptions): DojoRequestPromise<T>;
78 }
79
80 /* dojo/request/default */
81
82 interface Default {
83
84 getPlatformId(): string; /* './xhr' | './node' */ /* TODO: Uncomment for TS 1.8 */
85
86 load(id: string, parentRequire: Function, loaded: Function): void; /* TODO: Align with loader api */
87 }
88
89 /* dojo/request/handlers */
90
91 interface Handlers {
92 <T>(response: Response<any>): Response<T>;
93 register(name: string, handler: (response: Response<any>) => Response<any>): void;
94 }
95
96 /* dojo/request/iframe */
97
98 interface IFrameBaseOptions extends BaseOptions {
99 form?: HTMLFormElement;
100 data?: string | Object;
101 }
102
103 interface IFrameOptions extends IFrameBaseOptions, MethodOptions { }
104
105 interface IFrame {
106 <T>(url: string, options: IFrameOptions, returnDeferred: boolean): RequestDeferred<T>;
107 <T>(url: string, options?: IFrameOptions): DojoRequestPromise<T>;
108
109 create(name: string, onloadstr?: string, uri?: string): HTMLIFrameElement;
110 doc(iframenode: HTMLIFrameElement): Document;
111 setSrc(_iframe: HTMLIFrameElement, src: string, replace?: boolean): void;
112
113 _iframeName: string;
114 _notifyStart: Function;
115 _dfdQueue: RequestDeferred<any>[];
116 _currentDfd: RequestDeferred<any>;
117 _fireNextRequest(): void;
118
119 /**
120 * Send an HTTP GET request using the default transport for the current platform.
121 */
122 get<T>(url: string, options?: IFrameBaseOptions): DojoRequestPromise<T>;
123
124 /**
125 * Send an HTTP POST request using the default transport for the current platform.
126 */
127 post<T>(url: string, options?: IFrameBaseOptions): DojoRequestPromise<T>;
128 }
129
130 /* dojo/request/node */
131
132 interface NodeRequestBaseOptions extends BaseOptions {
133 socketPath?: string;
134 headers?: { [header: string]: string };
135 agent?: string;
136 pfx?: any;
137 key?: string;
138 passphrase?: string;
139 cert?: any;
140 ca?: any;
141 ciphers?: string;
142 rejectUnauthorized?: boolean;
143 path?: string;
144 auth?: string;
145 username?: string;
146 password?: string;
147 socketOptions?: { timeout: number, noDelay: number, keepAlive: number };
148 }
149
150 interface NodeRequestOptions extends NodeRequestBaseOptions, MethodOptions { }
151
152 interface Node {
153 <T>(url: string, options?: NodeRequestOptions): DojoRequestPromise<T>;
154
155 /**
156 * Send an HTTP GET request using the default transport for the current platform.
157 */
158 get<T>(url: string, options?: NodeRequestBaseOptions): DojoRequestPromise<T>;
159
160 /**
161 * Send an HTTP POST request using the default transport for the current platform.
162 */
163 post<T>(url: string, options?: NodeRequestBaseOptions): DojoRequestPromise<T>;
164
165 /**
166 * Send an HTTP PUT request using the default transport for the current platform.
167 */
168 put<T>(url: string, options?: NodeRequestBaseOptions): DojoRequestPromise<T>;
169
170 /**
171 * Send an HTTP DELETE request using the default transport for the current platform.
172 */
173 del<T>(url: string, options?: NodeRequestBaseOptions): DojoRequestPromise<T>;
174 }
175
176 /* dojo/request/notify */
177
178 /* TODO: Type in TS 1.8 */
179 /* type NotifyType = 'start' | 'send' | 'load' | 'error' | 'done' | 'stop'; */
180
181 interface Notify {
182 /**
183 * Register a listener to be notified when an event
184 * in dojo/request happens.
185 */
186 (type: string /* NotifyType */, listener: (event: any) => void): Handle;
187
188 emit(type: string, event: any, cancel: boolean): any;
189 }
190
191 /* dojo/request/registry */
192
193 interface RegistryOptions extends BaseOptions, MethodOptions { }
194
195 interface RegistryFunction {
196 (url: string, options?: RequestOptions): boolean;
197 }
198
199 interface Provider<T> {
200 (url: string, options?: RequestOptions): DojoRequestPromise<T>;
201 }
202
203 type RegisterUrlType = string | RegExp | RegistryFunction;
204
205 interface Registry {
206 <T>(url: string, options?: RegistryOptions): DojoRequestPromise<T>;
207
208 register<T>(url: RegisterUrlType, provider: Provider<T>, first?: boolean): Handle;
209
210 load(id: string, parentRequire: Function, loaded: Function): void; /* TODO: Align with loader api */
211
212 /**
213 * Send an HTTP GET request using the default transport for the current platform.
214 */
215 get<T>(url: string, options?: BaseOptions): DojoRequestPromise<T>;
216
217 /**
218 * Send an HTTP POST request using the default transport for the current platform.
219 */
220 post<T>(url: string, options?: BaseOptions): DojoRequestPromise<T>;
221
222 /**
223 * Send an HTTP PUT request using the default transport for the current platform.
224 */
225 put<T>(url: string, options?: BaseOptions): DojoRequestPromise<T>;
226
227 /**
228 * Send an HTTP DELETE request using the default transport for the current platform.
229 */
230 del<T>(url: string, options?: BaseOptions): DojoRequestPromise<T>;
231 }
232
233 /* dojo/request/script */
234
235 interface ScriptBaseOptions extends BaseOptions {
236
237 /**
238 * The URL parameter name that indicates the JSONP callback string.
239 * For instance, when using Yahoo JSONP calls it is normally,
240 * jsonp: "callback". For AOL JSONP calls it is normally
241 * jsonp: "c".
242 */
243 jsonp?: string;
244
245 /**
246 * A string of JavaScript that when evaluated like so:
247 * "typeof(" + checkString + ") != 'undefined'"
248 * being true means that the script fetched has been loaded.
249 * Do not use this if doing a JSONP type of call (use `jsonp` instead).
250 */
251 checkString?: string;
252
253 /**
254 * The Document object of a child iframe. If this is passed in, the script
255 * will be attached to that document. This can be helpful in some comet long-polling
256 * scenarios with Firefox and Opera.
257 */
258 frameDoc?: Document;
259 }
260
261 interface ScriptOptions extends ScriptBaseOptions, MethodOptions { }
262
263 interface Script {
264 /**
265 * Sends a request using a script element with the given URL and options.
266 */
267 <T>(url: string, options: ScriptOptions, returnDeferred: boolean): RequestDeferred<T>;
268 <T>(url: string, options?: ScriptOptions): DojoRequestPromise<T>;
269
270 /**
271 * Send an HTTP GET request using XMLHttpRequest with the given URL and options.
272 */
273 get<T>(url: string, options?: ScriptBaseOptions): DojoRequestPromise<T>;
274
275 _attach(id: string, url: string, frameDoc?: Document): HTMLScriptElement;
276 _remove(id: string, frameDoc?: Document, cleanup?: boolean): void;
277 _callbacksProperty: string;
278 }
279
280 /* dojo/request/util */
281
282 interface Response<T> extends ParsedArgs {
283 xhr?: XMLHttpRequest;
284 requestOptions?: NodeRequestOptions;
285 clientRequest?: any;
286 hasSocket?: boolean;
287 clientResponse?: any;
288 status?: number;
289 text?: string;
290 data?: T;
291 }
292
293 interface RequestDeferred<T> extends Deferred<T> {
294 response: Response<T>;
295 isValid(response: Response<T>): boolean;
296 isReady(response: Response<T>): boolean;
297 handleResponse(response: Response<T>): Response<T>;
298 }
299
300 interface CommonMethods<O extends BaseOptions> {
301
302 /**
303 * Send an HTTP GET request using XMLHttpRequest with the given URL and options.
304 */
305 get<T>(url: string, options?: O): DojoRequestPromise<T>;
306
307 /**
308 * Send an HTTP POST request using XMLHttpRequest with the given URL and options.
309 */
310 post<T>(url: string, options?: O): DojoRequestPromise<T>;
311
312 /**
313 * Send an HTTP PUT request using XMLHttpRequest with the given URL and options.
314 */
315 put<T>(url: string, options?: O): DojoRequestPromise<T>;
316
317 /**
318 * Send an HTTP DELETE request using XMLHttpRequest with the given URL and options.
319 */
320 del<T>(url: string, options?: O): DojoRequestPromise<T>;
321 }
322
323 interface ParsedArgs {
324 url: string;
325 options: RequestOptions;
326 getHeader(headerName: string): string;
327 }
328
329 interface Util {
330 deepCopy<T extends Object, S extends Object>(target: T, source: S): T & S;
331 deepCreate<T extends Object, P extends Object>(source: T, properties?: P): T & P;
332
333 deferred<T>(
334 response: Response<T>,
335 cancel: (def: Deferred<Response<T>>, response: Response<T>) => void,
336 isValid: (response: Response<T>) => boolean,
337 isReady: (response: Response<T>) => boolean,
338 last?: boolean
339 ): RequestDeferred<Response<T>>;
340
341 addCommonMethods<T extends Object>(provider: T, methods: string[]): T;
342 addCommonMethods<T extends Object>(provider: T): T & CommonMethods<BaseOptions>;
343
344 parseArgs(url: string, options: BaseOptions, skipData?: boolean): ParsedArgs;
345
346 checkStatus(): boolean;
347 }
348
349 /* dojo/request/watch */
350
351 interface Watch {
352 /**
353 * Watches the io request represented by dfd to see if it completes.
354 */
355 <T>(dfd: DojoRequestPromise<T>): void;
356
357 /**
358 * Cancels all pending IO requests, regardless of IO type
359 */
360 cancelAll(): void;
361 }
362
363 /* dojo/request/xhr */
364
365 interface XhrBaseOptions extends BaseOptions {
366 /**
367 * Whether to make a synchronous request or not. Default
368 * is `false` (asynchronous).
369 */
370 sync?: boolean;
371
372 /**
373 * Data to transfer. This is ignored for GET and DELETE
374 * requests.
375 */
376 data?: string | GenericObject | FormData;
377
378 /**
379 * Headers to use for the request.
380 */
381 headers?: { [header: string]: string };
382
383 /**
384 * Username to use during the request.
385 */
386 user?: string;
387
388 /**
389 * Password to use during the request.
390 */
391 password?: string;
392
393 /**
394 * For cross-site requests, whether to send credentials
395 * or not.
396 */
397 withCredentials?: boolean;
398 }
399
400 interface XhrOptions extends XhrBaseOptions, MethodOptions { }
401
402 interface Xhr {
403 /**
404 * Sends a request using XMLHttpRequest with the given URL and options.
405 */
406 <T>(url: string, options?: XhrOptions): DojoRequestPromise<T>;
407
408 /**
409 * Send an HTTP GET request using XMLHttpRequest with the given URL and options.
410 */
411 get<T>(url: string, options?: XhrBaseOptions): DojoRequestPromise<T>;
412
413 /**
414 * Send an HTTP POST request using XMLHttpRequest with the given URL and options.
415 */
416 post<T>(url: string, options?: XhrBaseOptions): DojoRequestPromise<T>;
417
418 /**
419 * Send an HTTP PUT request using XMLHttpRequest with the given URL and options.
420 */
421 put<T>(url: string, options?: XhrBaseOptions): DojoRequestPromise<T>;
422
423 /**
424 * Send an HTTP DELETE request using XMLHttpRequest with the given URL and options.
425 */
426 del<T>(url: string, options?: XhrBaseOptions): DojoRequestPromise<T>;
427
428 /**
429 * does the work of portably generating a new XMLHTTPRequest object.
430 */
431 _create(): XMLHttpRequest | ActiveXObject;
432 }
433 }
434
435 declare const dojoRequest: dojoRequest.Request;
436 export = dojoRequest; No newline at end of file
@@ -0,0 +1,32
1 import has = require("./has");
2
3 declare module "./has" {
4 interface Has {
5 (name: 'air'): boolean;
6 (name: 'wp'): void | number;
7 (name: 'msapp'): void | number;
8 (name: 'khtml'): void | number;
9 (name: 'edge'): void | number;
10 (name: 'opr'): void | number;
11 (name: 'webkit'): void | number;
12 (name: 'chrome'): void | number;
13 (name: 'android'): void | number;
14 (name: 'safari'): void | number;
15 (name: 'mac'): boolean;
16 (name: 'quirks'): boolean;
17 (name: 'iphone'): void | number;
18 (name: 'ipod'): void | number;
19 (name: 'ipad'): void | number;
20 (name: 'ios'): void | number;
21 (name: 'bb'): void | number | boolean;
22 (name: 'trident'): void | number;
23 (name: 'svg'): boolean;
24 (name: 'opera'): void | number;
25 (name: 'mozilla'): void | number;
26 (name: 'ff'): void | number;
27 (name: 'ie'): void | number;
28 (name: 'wii'): boolean | any;
29 }
30 }
31
32 export = has; No newline at end of file
@@ -0,0 +1,28
1
2 /**
3 * Efficiently escape a string for insertion into HTML (innerHTML or attributes), replacing &, <, >, ", ', and / characters.
4 */
5 export declare function escape(str: string): string;
6
7 /**
8 * Efficiently replicate a string `n` times.
9 */
10 export declare function rep(str: string, num: number): string;
11
12 /**
13 * Pad a string to guarantee that it is at least `size` length by
14 * filling with the character `ch` at either the start or end of the
15 * string. Pads at the start, by default.
16 */
17 export declare function pad(text: string, size: number, ch?: string, end?: boolean): string;
18
19 /**
20 * Performs parameterized substitutions on a string. Throws an
21 * exception if any parameter is unmatched.
22 */
23 export declare function substitute(template: string, map: Object | any[], transform?: (value: any, key: string) => any, thisObject?: Object): string;
24
25 /**
26 * Trims whitespace from both sides of the string
27 */
28 export declare function trim(str: string): string;
@@ -0,0 +1,16
1 import { GenericObject } from "./interfaces";
2
3 interface Cache {
4 (module: string | GenericObject, url: string, value?: string | { value: string, sanitize?: boolean }): string;
5 }
6
7 interface Text {
8 /**
9 * the dojo/text caches it's own resources because of dojo.cache
10 */
11 dynamic: boolean;
12
13 normalize(id: string, toAbsMid: Function): string; /* TODO: Align with loader api */
14
15 load(id: string, parentRequire: Function, loaded: Function): void; /* TODO: Align with loader api */
16 } No newline at end of file
@@ -0,0 +1,14
1 import { ExtensionEvent } from "./on";
2 import { Handle } from "./interfaces";
3
4 /**
5 * Publishes a message to a topic on the pub/sub hub. All arguments after
6 * the first will be passed to the subscribers, so any number of arguments
7 * can be provided (not just event).
8 */
9 export declare function publish(topic: string | ExtensionEvent, ...event: any[]): boolean;
10
11 /**
12 * Subscribes to a topic on the pub/sub hub
13 */
14 export declare function subscribe(topic: string | ExtensionEvent, listener: EventListener | Function): Handle;
@@ -0,0 +1,21
1 import { ExtensionEvent } from "./on";
2
3 interface Touch {
4 press: ExtensionEvent;
5 move: ExtensionEvent;
6 release: ExtensionEvent;
7 cancel: ExtensionEvent;
8 over: ExtensionEvent;
9 out: ExtensionEvent;
10 enter: ExtensionEvent;
11 leave: ExtensionEvent;
12 }
13
14 declare module "./_base/kernel" {
15 interface Dojo {
16 touch: Touch;
17 }
18 }
19
20 declare const touch: Touch;
21 export = touch; No newline at end of file
@@ -0,0 +1,8
1 import { PromiseOrValue } from "./interfaces";
2 import { PromiseCallback, PromiseErrback, PromiseProgback } from "./promise/Promise";
3
4 /**
5 * Transparently applies callbacks to values and/or promises.
6 */
7 export declare function when<T>(value: PromiseOrValue<T>): PromiseLike<T>;
8 export declare function when<T, U1, U2>(value: PromiseOrValue<T>, callback?: PromiseCallback<T, U1>, errback?: PromiseErrback<U2>, progress?: PromiseProgback): PromiseOrValue<U1 | U2>; No newline at end of file
@@ -0,0 +1,16
1 import { DomGeometryBox, DomGeometryXYBox } from "./dom-geometry";
2
3 /**
4 * Returns the dimensions and scroll position of the viewable area of a browser window
5 */
6 export declare function getBox(doc?: Document): DomGeometryBox;
7
8 /**
9 * Get window object associated with document doc.
10 */
11 export declare function get(doc?: Document): Window;
12
13 /**
14 * Scroll the passed node into view using minimal movement, if it is not already.
15 */
16 export declare function scrollIntoView(node: Element, pos?: DomGeometryXYBox): void;
@@ -0,0 +1,9
1 {
2 "extends": "../tsconfig",
3 "compilerOptions": {
4 "baseUrl": "./",
5 "types": [
6 "requirejs"
7 ]
8 }
9 } No newline at end of file
@@ -6,7 +6,7 plugins {
6 typescript {
6 typescript {
7 compilerOptions {
7 compilerOptions {
8 lib = ["es5", "dom", "scripthost", "es2015.promise", "es2015.symbol", "es2015.iterable"]
8 lib = ["es5", "dom", "scripthost", "es2015.promise", "es2015.symbol", "es2015.iterable"]
9 listFiles = true
9 //listFiles = true
10 declaration = true
10 declaration = true
11 strict = true
11 strict = true
12 types = []
12 types = []
@@ -16,6 +16,11 typescript {
16 jsx = "react"
16 jsx = "react"
17 jsxFactory = "createElement"
17 jsxFactory = "createElement"
18 moduleResolution = "node"
18 moduleResolution = "node"
19 // traceResolution = true
20 // baseUrl = "./"
21 // paths = [ "*": [ "$projectDir/src/typings/*" ] ]
22 // baseUrl = "$projectDir/src/typings"
23 // typeRoots = ["$projectDir/src/typings"]
19 }
24 }
20
25
21 tscCmd = "$projectDir/node_modules/.bin/tsc"
26 tscCmd = "$projectDir/node_modules/.bin/tsc"
@@ -25,13 +30,28 typescript {
25
30
26 configureTsMain {
31 configureTsMain {
27 compilerOptions {
32 compilerOptions {
28 types = ["requirejs", "dojo-typings"]
33 types = ["requirejs"]
34 }
35 }
36
37 npmPackMeta {
38 meta {
39 name = "@$npmScope/$project.name"
40 }
29 }
41 }
42
43 task npmPackTypings(type: Copy) {
44 dependsOn sources.main.output
45
46 npmPack.dependsOn it
47
48 from sources.main.output.typingsDir
49 into npm.packageDir
30 }
50 }
31
51
32 task printVersion {
52 task printVersion {
33 doLast {
53 doLast {
34 println "packageName: $packageName";
54 println "packageName: ${npmPackMeta.metadata.get().name}";
35 println "version: $version";
55 println "version: $version";
36 println "target: $typescript.compilerOptions.target";
56 println "target: $typescript.compilerOptions.target";
37 println "module: $typescript.compilerOptions.module";
57 println "module: $typescript.compilerOptions.module";
@@ -43,6 +43,25
43 "integrity": "sha512-f5dXGzOJycyzSMdaXVhiBhauL4dYydXwVpavfQ1mVCaGjR56a9QfklXObUxlIY9bGTmCPHEEZ04I16BZ/8w5ww==",
43 "integrity": "sha512-f5dXGzOJycyzSMdaXVhiBhauL4dYydXwVpavfQ1mVCaGjR56a9QfklXObUxlIY9bGTmCPHEEZ04I16BZ/8w5ww==",
44 "dev": true
44 "dev": true
45 },
45 },
46 "@types/dijit": {
47 "version": "file:src/typings/dijit",
48 "dev": true,
49 "requires": {
50 "@types/dojo": "^1.0.0"
51 },
52 "dependencies": {
53 "@types/dojo": {
54 "version": "1.9.42",
55 "resolved": "https://registry.npmjs.org/@types/dojo/-/dojo-1.9.42.tgz",
56 "integrity": "sha512-yFfw7uoOlCy6QgxTWIzii4/QOsIDXq9gX3/6iXQ2nz//Y23yWXFRaYpoQ7GW0fvPN3lKtYkXgv6GXtdtWlHFXg==",
57 "dev": true
58 }
59 }
60 },
61 "@types/dojo": {
62 "version": "file:src/typings/dojo",
63 "dev": true
64 },
46 "@types/requirejs": {
65 "@types/requirejs": {
47 "version": "2.1.31",
66 "version": "2.1.31",
48 "resolved": "https://registry.npmjs.org/@types/requirejs/-/requirejs-2.1.31.tgz",
67 "resolved": "https://registry.npmjs.org/@types/requirejs/-/requirejs-2.1.31.tgz",
@@ -297,15 +316,6
297 "integrity": "sha512-DUiXyoLK6vMF5BPr/qiMLTxDMfiM9qlzN1jxfDsVfuvB/CwhYpNxA/M4mbqKN8PCVGLmccXBJbfmFJPP5+zmzw==",
316 "integrity": "sha512-DUiXyoLK6vMF5BPr/qiMLTxDMfiM9qlzN1jxfDsVfuvB/CwhYpNxA/M4mbqKN8PCVGLmccXBJbfmFJPP5+zmzw==",
298 "dev": true
317 "dev": true
299 },
318 },
300 "dojo-typings": {
301 "version": "1.11.9",
302 "resolved": "https://registry.npmjs.org/dojo-typings/-/dojo-typings-1.11.9.tgz",
303 "integrity": "sha512-mh8w+Mau2Y1QfTEszEAdO7j6ycNhYxF/Ing6nAk1eUg6NxjeT0viVHjICMd9sU3U463vM2G+KfBBK5grk3/Mlw==",
304 "dev": true,
305 "requires": {
306 "@types/chai": "^4.0.4"
307 }
308 },
309 "emoji-regex": {
319 "emoji-regex": {
310 "version": "8.0.0",
320 "version": "8.0.0",
311 "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz",
321 "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz",
@@ -2,7 +2,6
2 "devDependencies": {
2 "devDependencies": {
3 "@types/requirejs": "2.1.31",
3 "@types/requirejs": "2.1.31",
4 "dojo": "1.16.0",
4 "dojo": "1.16.0",
5 "dojo-typings": "1.11.9",
6 "typescript": "~3.7.5",
5 "typescript": "~3.7.5",
7 "eslint": "6.8.0",
6 "eslint": "6.8.0",
8 "tslint": "6.0.0",
7 "tslint": "6.0.0",
@@ -10,6 +9,8
10 "yaml": "~1.7.2",
9 "yaml": "~1.7.2",
11 "@types/yaml": "1.2.0",
10 "@types/yaml": "1.2.0",
12 "chai": "4.2.0",
11 "chai": "4.2.0",
13 "@types/chai": "4.1.3"
12 "@types/chai": "4.1.3",
13 "@types/dojo": "./src/typings/dojo",
14 "@types/dijit": "./src/typings/dijit"
14 }
15 }
15 }
16 }
@@ -12,4 +12,4
12
12
13 //include 'sub-project-name'
13 //include 'sub-project-name'
14
14
15 //rootProject.name = 'djx' No newline at end of file
15 rootProject.name = 'djx' No newline at end of file
@@ -1,6 +1,7
1 import declare = require("dojo/_base/declare");
1 import declare = require("dojo/_base/declare");
2 import { each } from "@implab/core-amd/safe";
2 import { each } from "@implab/core-amd/safe";
3 import { Constructor } from "@implab/core-amd/interfaces";
3 import { Constructor } from "@implab/core-amd/interfaces";
4 import { DeclareConstructor } from "dojo/_base/declare";
4
5
5 export interface AbstractConstructor<T = {}> {
6 export interface AbstractConstructor<T = {}> {
6 prototype: T;
7 prototype: T;
@@ -14,25 +15,25 interface DjMockConstructor<T = {}> {
14
15
15 export function djbase<T>(
16 export function djbase<T>(
16 b0: AbstractConstructor<T>
17 b0: AbstractConstructor<T>
17 ): dojo._base.DeclareConstructor<T>;
18 ): DeclareConstructor<T>;
18
19
19 export function djbase<T0, T1>(
20 export function djbase<T0, T1>(
20 b0: AbstractConstructor<T0>,
21 b0: AbstractConstructor<T0>,
21 b1: AbstractConstructor<T1>
22 b1: AbstractConstructor<T1>
22 ): dojo._base.DeclareConstructor<T0 & T1>;
23 ): DeclareConstructor<T0 & T1>;
23
24
24 export function djbase<T0, T1, T2>(
25 export function djbase<T0, T1, T2>(
25 b0: AbstractConstructor<T0>,
26 b0: AbstractConstructor<T0>,
26 b1: AbstractConstructor<T1>,
27 b1: AbstractConstructor<T1>,
27 b2: AbstractConstructor<T2>
28 b2: AbstractConstructor<T2>
28 ): dojo._base.DeclareConstructor<T0 & T1 & T2>;
29 ): DeclareConstructor<T0 & T1 & T2>;
29
30
30 export function djbase<T0, T1, T2, T3>(
31 export function djbase<T0, T1, T2, T3>(
31 b0: AbstractConstructor<T0>,
32 b0: AbstractConstructor<T0>,
32 b1: AbstractConstructor<T1>,
33 b1: AbstractConstructor<T1>,
33 b2: AbstractConstructor<T2>,
34 b2: AbstractConstructor<T2>,
34 b3: AbstractConstructor<T3>
35 b3: AbstractConstructor<T3>
35 ): dojo._base.DeclareConstructor<T0 & T1 & T2 & T3>;
36 ): DeclareConstructor<T0 & T1 & T2 & T3>;
36
37
37 export function djbase<T0, T1, T2, T3, T4>(
38 export function djbase<T0, T1, T2, T3, T4>(
38 b0: AbstractConstructor<T0>,
39 b0: AbstractConstructor<T0>,
@@ -40,7 +41,7 export function djbase<T0, T1, T2, T3, T
40 b2: AbstractConstructor<T2>,
41 b2: AbstractConstructor<T2>,
41 b3: AbstractConstructor<T3>,
42 b3: AbstractConstructor<T3>,
42 b4: AbstractConstructor<T4>
43 b4: AbstractConstructor<T4>
43 ): dojo._base.DeclareConstructor<T0 & T1 & T2 & T3 & T4>;
44 ): DeclareConstructor<T0 & T1 & T2 & T3 & T4>;
44
45
45 export function djbase<T0, T1, T2, T3, T4, T5>(
46 export function djbase<T0, T1, T2, T3, T4, T5>(
46 b0: AbstractConstructor<T0>,
47 b0: AbstractConstructor<T0>,
@@ -49,7 +50,7 export function djbase<T0, T1, T2, T3, T
49 b3: AbstractConstructor<T3>,
50 b3: AbstractConstructor<T3>,
50 b4: AbstractConstructor<T4>,
51 b4: AbstractConstructor<T4>,
51 b5: AbstractConstructor<T5>
52 b5: AbstractConstructor<T5>
52 ): dojo._base.DeclareConstructor<T0 & T1 & T2 & T3 & T4 & T5>;
53 ): DeclareConstructor<T0 & T1 & T2 & T3 & T4 & T5>;
53
54
54 export function djbase<T0, T1, T2, T3, T4, T5, T6>(
55 export function djbase<T0, T1, T2, T3, T4, T5, T6>(
55 b0: AbstractConstructor<T0>,
56 b0: AbstractConstructor<T0>,
@@ -59,7 +60,7 export function djbase<T0, T1, T2, T3, T
59 b4: AbstractConstructor<T4>,
60 b4: AbstractConstructor<T4>,
60 b5: AbstractConstructor<T5>,
61 b5: AbstractConstructor<T5>,
61 b6: AbstractConstructor<T6>
62 b6: AbstractConstructor<T6>
62 ): dojo._base.DeclareConstructor<T0 & T1 & T2 & T3 & T4 & T5 & T6>;
63 ): DeclareConstructor<T0 & T1 & T2 & T3 & T4 & T5 & T6>;
63
64
64 export function djbase<T0, T1, T2, T3, T4, T5, T6, T7>(
65 export function djbase<T0, T1, T2, T3, T4, T5, T6, T7>(
65 b0: AbstractConstructor<T0>,
66 b0: AbstractConstructor<T0>,
@@ -70,7 +71,7 export function djbase<T0, T1, T2, T3, T
70 b5: AbstractConstructor<T5>,
71 b5: AbstractConstructor<T5>,
71 b6: AbstractConstructor<T6>,
72 b6: AbstractConstructor<T6>,
72 b7: AbstractConstructor<T7>
73 b7: AbstractConstructor<T7>
73 ): dojo._base.DeclareConstructor<T0 & T1 & T2 & T3 & T4 & T5 & T6 & T7>;
74 ): DeclareConstructor<T0 & T1 & T2 & T3 & T4 & T5 & T6 & T7>;
74
75
75 /** Создает конструктор-заглушку из списка базовых классов, используется
76 /** Создает конструктор-заглушку из списка базовых классов, используется
76 * для объявления классов при помощи `dojo/_base/declare`.
77 * для объявления классов при помощи `dojo/_base/declare`.
@@ -3,6 +3,7 import _WidgetBase = require("dijit/_Wid
3 import _AttachMixin = require("dijit/_AttachMixin");
3 import _AttachMixin = require("dijit/_AttachMixin");
4 import { BuildContext, isNode } from "./traits";
4 import { BuildContext, isNode } from "./traits";
5 import registry = require("dijit/registry");
5 import registry = require("dijit/registry");
6 import { Handle } from "dojo/interfaces";
6
7
7 @djclass
8 @djclass
8 export abstract class DjxWidgetBase extends djbase(_WidgetBase, _AttachMixin) {
9 export abstract class DjxWidgetBase extends djbase(_WidgetBase, _AttachMixin) {
@@ -18,7 +19,7 export abstract class DjxWidgetBase exte
18 baseNode: T,
19 baseNode: T,
19 getAttrFunc: (baseNode: T, attr: string) => string,
20 getAttrFunc: (baseNode: T, attr: string) => string,
20 // tslint:disable-next-line: ban-types
21 // tslint:disable-next-line: ban-types
21 attachFunc: (node: T, type: string, func?: Function) => dojo.Handle
22 attachFunc: (node: T, type: string, func?: Function) => Handle
22 ): boolean {
23 ): boolean {
23 if (isNode(baseNode)) {
24 if (isNode(baseNode)) {
24 const w = registry.byNode(baseNode);
25 const w = registry.byNode(baseNode);
@@ -1,8 +1,8
1 import dom = require("dojo/dom-construct");
1 import dom = require("dojo/dom-construct");
2 import { argumentNotNull, isNull, mixin } from "@implab/core-amd/safe";
2 import { argumentNotNull } from "@implab/core-amd/safe";
3 import _WidgetBase = require("dijit/_WidgetBase");
3 import _WidgetBase = require("dijit/_WidgetBase");
4 import { _WidgetBaseConstructor, isNode } from "./traits";
5 import { BuildContextBase } from "./BuildContextBase";
4 import { BuildContextBase } from "./BuildContextBase";
5 import { _WidgetBaseConstructor } from "dijit/_WidgetBase";
6
6
7 export class WidgetContext extends BuildContextBase {
7 export class WidgetContext extends BuildContextBase {
8 widgetClass: _WidgetBaseConstructor;
8 widgetClass: _WidgetBaseConstructor;
@@ -1,4 +1,5
1 import _WidgetBase = require("dijit/_WidgetBase");
1 import _WidgetBase = require("dijit/_WidgetBase");
2 import { _WidgetBaseConstructor } from "dijit/_WidgetBase";
2
3
3 export interface BuildContext {
4 export interface BuildContext {
4 getDomElement(): HTMLElement;
5 getDomElement(): HTMLElement;
@@ -24,8 +25,6 export function isPlainObject(v: object)
24 return !vp || vp === Object.prototype;
25 return !vp || vp === Object.prototype;
25 }
26 }
26
27
27 export type _WidgetBaseConstructor = dijit._WidgetBaseConstructor<_WidgetBase>;
28
29 export function isWidgetConstructor(v: any): v is _WidgetBaseConstructor {
28 export function isWidgetConstructor(v: any): v is _WidgetBaseConstructor {
30 return typeof v === "function" && v.prototype && "domNode" in v.prototype;
29 return typeof v === "function" && v.prototype && "domNode" in v.prototype;
31 }
30 }
@@ -6,7 +6,8 export function bundle<T extends object>
6 const nlsBundle = new NlsBundle(nls, locales);
6 const nlsBundle = new NlsBundle(nls, locales);
7
7
8 const fn = (locale?: string) => {
8 const fn = (locale?: string) => {
9 const result = nlsBundle.getLocale(locale);
9 const result = locale ? nlsBundle.getLocale(locale) : nlsBundle.default;
10
10 if (isPromise(result))
11 if (isPromise(result))
11 throw new Error(`The bundle '${locale}' isn't loaded`);
12 throw new Error(`The bundle '${locale}' isn't loaded`);
12 else
13 else
@@ -2,6 +2,8
2 "extends": "../tsconfig",
2 "extends": "../tsconfig",
3 "compilerOptions": {
3 "compilerOptions": {
4 "rootDir": "ts",
4 "rootDir": "ts",
5 "types": ["requirejs", "dojo-typings"]
5 "types": [
6 "requirejs"
7 ]
6 }
8 }
7 } No newline at end of file
9 }
@@ -11,11 +11,11 export class TapeWriter implements IDest
11 private readonly _t: TapWriter;
11 private readonly _t: TapWriter;
12
12
13 private readonly _subscriptions = new Array<IDestroyable>();
13 private readonly _subscriptions = new Array<IDestroyable>();
14 private _destroyed;
14 private _destroyed = false;
15
15
16 constructor(t: TapWriter) {
16 constructor(t: TapWriter) {
17 argumentNotNull(t, "test");
17 argumentNotNull(t, "test");
18
18 this._t = t;
19 }
19 }
20
20
21 writeEvents(source: IObservable<TraceEvent>, ct: ICancellation = Cancellation.none) {
21 writeEvents(source: IObservable<TraceEvent>, ct: ICancellation = Cancellation.none) {
@@ -41,13 +41,18 export class TapeWriter implements IDest
41 }
41 }
42
42
43 destroy() {
43 destroy() {
44 if (this._destroyed)
45 return;
46 this._destroyed = true;
44 this._subscriptions.forEach(destroy);
47 this._subscriptions.forEach(destroy);
45 }
48 }
46 }
49 }
47
50
48 type TestCallback = (ok: (msg:string) => void, fail: (msg:string) => void, trace: TraceSource) => void;
51 type TestCallback = (ok: (msg: string) => void, fail: (msg: string) => void, trace: TraceSource) => void;
49 type AsyncTestCallback = (trace: TraceSource) => PromiseLike<void> | void;
52 type AsyncTestCallback = (trace: TraceSource) => PromiseLike<void>;
50
53
54 export function test(name: string, cb: TestCallback ): void;
55 export function test(name: string, cb: AsyncTestCallback): void;
51 export function test(name: string, cb: TestCallback | AsyncTestCallback) {
56 export function test(name: string, cb: TestCallback | AsyncTestCallback) {
52
57
53 }
58 }
@@ -6,6 +6,6
6 "ts",
6 "ts",
7 "../main/ts"
7 "../main/ts"
8 ],
8 ],
9 "types": ["requirejs", "dojo-typings"]
9 "types": ["requirejs"]
10 }
10 }
11 } No newline at end of file
11 }
1 NO CONTENT: file was removed
NO CONTENT: file was removed
General Comments 0
You need to be logged in to leave comments. Login now