##// END OF EJS Templates
Working on dojo typings
cin -
r15:8ef85ad13241 default
parent child
Show More
@@ -32,7 +32,12 typescript {
32 32
33 33 configureTsMain {
34 34 compilerOptions {
35 types = ["requirejs", "dojo-typings"]
35 baseUrl = "$projectDir/src"
36 paths = [
37 "dojo/*" : [ "typings/dojo/*" ],
38 "dijit/*" : [ "typings/dijit/*" ]
39 ]
40 types = ["requirejs", "$projectDir/src/typings/dojo/index" /*, "dojo-typings"*/]
36 41 }
37 42 }
38 43
@@ -1145,9 +1145,9
1145 1145 "dev": true
1146 1146 },
1147 1147 "typescript": {
1148 "version": "3.7.5",
1149 "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.7.5.tgz",
1150 "integrity": "sha512-/P5lkRXkWHNAbcJIiHPfRoKqyd7bsyCma1hZNUGfn20qm64T6ZBlrzprymeu918H+mB/0rIg2gGK/BXkhhYgBw==",
1148 "version": "3.8.3",
1149 "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.8.3.tgz",
1150 "integrity": "sha512-MYlEfn5VrLNsgudQTVJeNaQFUAI7DkhnOjdpAp4T+ku1TfQClewlbSuTVHiA+8skNBgaf02TL/kLOvig4y3G8w==",
1151 1151 "dev": true
1152 1152 },
1153 1153 "uri-js": {
@@ -21,7 +21,7
21 21 "devDependencies": {
22 22 "@types/requirejs": "2.1.31",
23 23 "dojo": "1.16.0",
24 "typescript": "~3.7.5",
24 "typescript": "~3.8.3",
25 25 "eslint": "6.8.0",
26 26 "tslint": "6.0.0",
27 27 "@implab/core-amd": "^1.3.2",
@@ -1,9 +1,10
1 1 import declare = require("dojo/_base/declare");
2 2 import { each } from "@implab/core-amd/safe";
3 3 import { Constructor } from "@implab/core-amd/interfaces";
4 // import { DeclareConstructor } from "dojo/_base/declare";
5 4
6 type DeclareConstructor<T> = dojo._base.DeclareConstructor<T>;
5 // declare const declare: any;
6
7 type DeclareConstructor<T> = declare.DeclareConstructor<T>;
7 8
8 9 export interface AbstractConstructor<T = {}> {
9 10 prototype: T;
@@ -3,8 +3,9 import _WidgetBase = require("dijit/_Wid
3 3 import _AttachMixin = require("dijit/_AttachMixin");
4 4 import { BuildContext, isNode } from "./traits";
5 5 import registry = require("dijit/registry");
6 // import { Handle } from "dojo/interfaces";
7 type Handle = dojo.Handle;
6 import { Handle } from "dojo/interfaces";
7
8 // type Handle = dojo.Handle;
8 9
9 10 @djclass
10 11 export abstract class DjxWidgetBase extends djbase(_WidgetBase, _AttachMixin) {
@@ -1,13 +1,18
1 1 {
2 2 "extends": "../tsconfig",
3 3 "compilerOptions": {
4 "baseUrl": "../",
4 5 "rootDir": "ts",
5 6 "rootDirs": [
6 7 "ts",
7 8 "typings"
8 9 ],
10 "paths" : {
11 "dojo/*" : [ "typings/dojo/*" ],
12 "dijit/*" : [ "typings/dijit/*" ]
13 },
9 14 "types": [
10 "requirejs", "dojo-typings", "./typings/index"
15 "requirejs", "./typings/index", "../typings/dojo/index"
11 16 ]
12 17 }
13 18 } No newline at end of file
@@ -11,7 +11,7 test("simple", (ok, fail, log) => {
11 11 }, 100);
12 12 });
13 13
14 test("simple", async log => {
14 test("simple", async (log, fail) => {
15 15 await delay(0);
16 16
17 17 assert.ok(true); // everything is fine
@@ -1,6 +1,6
1 import { DeclareConstructor } from "dojo/_base/declare";
2 1 import { Handle } from "dojo/interfaces";
3 2 import _WidgetBase = require("./_WidgetBase");
3 import declare = require("dojo/_base/declare");
4 4
5 5 declare module "./_WidgetBase" {
6 6 interface _WidgetBase {
@@ -81,7 +81,7 interface _AttachMixin {
81 81 destroyRendering(preserveDom?: boolean): void;
82 82 }
83 83
84 interface _AttachMixinConstructor extends DeclareConstructor<_AttachMixin> { }
84 interface _AttachMixinConstructor extends declare.DeclareConstructor<_AttachMixin> { }
85 85
86 86 declare const _AttachMixin: _AttachMixinConstructor;
87 87 export = _AttachMixin;
@@ -2,7 +2,6 import Stateful = require("dojo/Stateful
2 2 import Destroyable = require("./Destroyable");
3 3 import { ExtensionEvent } from "dojo/on";
4 4 import { NodeFragmentOrString, Handle, NodeOrString, WatchHandle } from "dojo/interfaces";
5 import { DeclareConstructor } from "dojo/_base/declare";
6 5
7 6 declare namespace _WidgetBase {
8 7 interface _WidgetBase extends Stateful, Destroyable {
@@ -231,7 +230,7 declare namespace _WidgetBase {
231 230 }
232 231
233 232 interface _WidgetBaseConstructor<W = _WidgetBase> extends DeclareConstructor<W> {
234 new(params: Object, srcNodeRef: NodeOrString): W;
233 new(params: Object, srcNodeRef?: NodeOrString): W;
235 234 }
236 235
237 236 }
@@ -1,6 +1,6
1 1 /* dojo/_base/Color */
2 2
3 declare namespace dojoColor {
3 declare namespace Color {
4 4 type ColorValue = [number, number, number];
5 5 type ColorValueAlpha = [number, number, number, number];
6 6
@@ -264,6 +264,6 declare namespace dojoColor {
264 264
265 265 }
266 266
267 type dojoColor = dojoColor.Color;
268 declare const dojoColor: dojoColor.ColorConstructor;
269 export = dojoColor;
267 type Color = Color.Color;
268 declare const Color: Color.ColorConstructor;
269 export = Color;
@@ -1,5 +1,6
1 1 import DojoPromise = require("../promise/Promise");
2 2 import { PromiseCallback, PromiseErrback, PromiseProgback } from "../promise/Promise";
3 import declare = require("./declare");
3 4
4 5 /* dojo/_base/Deferred */
5 6
@@ -1,7 +1,7
1 1 import { GenericConstructor } from "../interfaces";
2 2
3 3 /* dojo/_base/array */
4 interface DojoArray {
4
5 5 /**
6 6 * Determines whether or not every item in arr satisfies the condition implemented by callback.
7 7 * @param {T[] | string} arr the array to iterate on. If a string, operates on individual characters.
@@ -9,12 +9,12 interface DojoArray {
9 9 * array and returns true if the condition is met.
10 10 * @param {object} thisObj may be used to scope the call to callback
11 11 */
12 every<T>(arr: T[] | string, callback: string | ((item: T, idx: number, arr: T[]) => boolean), thisObj?: Object): boolean;
12 export function every<T>(arr: T[] | string, callback: string | ((item: T, idx: number, arr: T[]) => boolean), thisObj?: Object): boolean;
13 13
14 14 /**
15 15 * Determines whether or not any item in arr satisfies the condition implemented by callback.
16 16 */
17 some<T>(arr: T[] | string, callback: string | ((item: T, idx: number, arr: T[]) => boolean), thisObj?: Object): boolean;
17 export function some<T>(arr: T[] | string, callback: string | ((item: T, idx: number, arr: T[]) => boolean), thisObj?: Object): boolean;
18 18
19 19 /**
20 20 * locates the last index of the provided value in the passed array. If the value is not found, -1
@@ -22,34 +22,30 interface DojoArray {
22 22 * @param {boolean} findLast Makes indexOf() work like lastIndexOf(). Used internally; not meant
23 23 * for external usage.
24 24 */
25 indexOf<T>(arr: T[], value: T, fromIndex?: number, findLast?: boolean): number;
25 export function indexOf<T>(arr: T[], value: T, fromIndex?: number, findLast?: boolean): number;
26 26
27 27 /**
28 28 * locates the first index of the provided value in the passed array. If the value is not found,
29 29 * -1 is returned.
30 30 */
31 lastIndexOf<T>(arr: T[], value: T, fromIndex?: number): number;
31 export function lastIndexOf<T>(arr: T[], value: T, fromIndex?: number): number;
32 32
33 33 /**
34 34 * locates the last index of the provided value in the passed array. If the value is not found,
35 35 * -1 is returned.
36 36 */
37 forEach<T>(arr: T[], callback: string | ((item: T, idx: number, arr: T[]) => void), thisObj?: Object): void;
37 export function forEach<T>(arr: T[], callback: string | ((item: T, idx: number, arr: T[]) => void), thisObj?: Object): void;
38 38
39 39 /**
40 40 * for every item in arr, callback is invoked. Return values are ignored. If you want to break
41 41 * out of the loop, consider using array.every() or array.some().
42 42 */
43 map<T, U>(arr: T[] | string, callback: string | ((item: T, idx: number, arr: T[]) => U), thisObj?: Object, Ctr?: GenericConstructor<U[]>): U[];
43 export function map<T, U>(arr: T[] | string, callback: string | ((item: T, idx: number, arr: T[]) => U), thisObj?: Object, Ctr?: GenericConstructor<U[]>): U[];
44 44
45 45 /**
46 46 * Returns a new Array with those items from arr that match the condition implemented by
47 47 * callback.
48 48 */
49 filter<T>(arr: T[], callback: string | ((item: T, idx: number, arr: T[]) => boolean), thisObj?: Object): T[];
49 export function filter<T>(arr: T[], callback: string | ((item: T, idx: number, arr: T[]) => boolean), thisObj?: Object): T[];
50 50
51 clearCache(): void;
52 }
53
54 declare const dojoArray: DojoArray;
55 export = dojoArray;
51 export function clearCache(): void;
@@ -10,4 +10,4 import"../query";
10 10 import "./xhr";
11 11 import "./fx";
12 12
13 export = dojo; No newline at end of file
13 export = dojo;
@@ -1,5 +1,7
1 1 import { ColorValue, ColorValueAlpha } from "./Color";
2 2 import { HasCache } from "../has";
3
4 declare namespace config {
3 5 interface Config {
4 6 /** Defaults to `false`. If set to `true`, ensures that Dojo provides
5 7 * extended debugging feedback via Firebug. If Firebug is not available
@@ -146,6 +148,7 interface Config {
146 148 useDeferredInstrumentation: string | boolean | number;
147 149 }
148 150
149 type dojoConfig = Config;
150 declare const dojoConfig: Config;
151 export = dojoConfig; No newline at end of file
151 }
152
153 declare const config: config.Config;
154 export = config;
@@ -1,10 +1,9
1 1 import { Handle } from "../interfaces";
2 2
3 interface Connect {
4 3 /**
5 4 * TODO: Type this better
6 5 */
7 _keypress(object: any, listener: EventListener): Handle;
6 export function _keypress(object: any, listener: EventListener): Handle;
8 7
9 8 /**
10 9 * `dojo.connect` is a deprecated event handling and delegation method in
@@ -13,25 +12,25 interface Connect {
13 12 * listeners may be attached to a function, and source functions may
14 13 * be either regular function calls or DOM events.
15 14 */
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;
15 export function connect(obj: any, event: string, context: any, method: EventListener | string, dontFix?: boolean): Handle;
16 export function connect(event: string, context: any, method: EventListener | string, dontFix?: boolean): Handle;
18 17
19 18 /**
20 19 * Remove a link created by dojo.connect.
21 20 */
22 disconnect(handle: Handle): void;
21 export function disconnect(handle: Handle): void;
23 22
24 23 /**
25 24 * Attach a listener to a named topic. The listener function is invoked whenever the
26 25 * named topic is published (see: dojo.publish).
27 26 * Returns a handle which is needed to unsubscribe this listener.
28 27 */
29 subscribe(topic: string, context: any, method: EventListener): Handle;
28 export function subscribe(topic: string, context: any, method: EventListener): Handle;
30 29
31 30 /**
32 31 * Invoke all listener method subscribed to topic.
33 32 */
34 publish(topic: string, args: any[]): boolean;
33 export function publish(topic: string, args: any[]): boolean;
35 34
36 35 /**
37 36 * Ensure that every time obj.event() is called, a message is published
@@ -39,11 +38,10 interface Connect {
39 38 * dojo.disconnect() to disable subsequent automatic publication on
40 39 * the topic.
41 40 */
42 connectPublisher(topic: string, obj: any, method: string): Handle;
43 connectPublisher(topic: string, method: EventListener): Handle;
41 export function connectPublisher(topic: string, obj: any, method: string): Handle;
42 export function connectPublisher(topic: string, method: EventListener): Handle;
44 43
45 44 /**
46 45 * Checks an event for the copy key (meta on Mac, and ctrl anywhere else)
47 46 */
48 isCopyKey(e: Event): boolean;
49 } No newline at end of file
47 export function isCopyKey(e: Event): boolean;
@@ -1,10 +1,11
1 declare namespace declare {
2 /* dojo/_base/declare */
1 declare module "./kernel" {
2 interface Dojo {
3 declare: declare.Declare;
4 safeMixin: typeof declare.safeMixin;
5 }
6 }
3 7
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 declare namespace declare {
8 9 interface DeclareCreatedObject {
9 10 declaredClass: string;
10 11
@@ -99,9 +100,6 declare namespace declare {
99 100 createSubclass<U>(mixins: any, props: U): DeclareConstructor<T & U>;
100 101 }
101 102
102 /**
103 * Create a feature-rich constructor from compact notation.
104 */
105 103 interface Declare {
106 104 <A, B, C, D>(superClass: [DeclareConstructor<A>, DeclareConstructor<B>, DeclareConstructor<C>, DeclareConstructor<D>]): DeclareConstructor<A & B & C & D>;
107 105 <A, B, C>(superClass: [DeclareConstructor<A>, DeclareConstructor<B>, DeclareConstructor<C>]): DeclareConstructor<A & B & C>;
@@ -1,22 +1,21
1 1 /* dojo/_base/event */
2 2
3 3 /**
4 * @module
4 5 * This module defines dojo DOM event API. Usually you should use dojo/on, and evt.stopPropagation() +
5 6 * evt.preventDefault(), rather than this module.
6 7 */
7 interface EventModule {
8
9
8 10 /**
9 11 * normalizes properties on the event object including event
10 12 * bubbling methods, keystroke normalization, and x/y positions
11 13 */
12 fix(evt: Event, sender: Element): Event;
14 export declare function fix(evt: Event, sender: Element): Event;
13 15
14 16 /**
15 17 * prevents propagation and clobbers the default action of the
16 18 * passed event
17 19 */
18 stop(evt: Event): void;
19 }
20 export declare function stop(evt: Event): void;
20 21
21 declare const dojoEvent: EventModule;
22 export = dojoEvent;
@@ -1,9 +1,8
1 1 import Evented = require("../Evented");
2 2
3 declare namespace fx {
4 3 /* dojo/_base/fx */
5 4
6 interface Line {
5 export interface _Line {
7 6 /**
8 7 * Returns the point on the line
9 8 * @param {number} n a floating point number greater than 0 and less than 1
@@ -14,15 +13,17 declare namespace fx {
14 13 /**
15 14 * Object used to generate values from a start value to an end value
16 15 */
17 interface LineConstructor {
18 new(start: number, end: number): Line;
16 export interface LineConstructor {
17 new(start: number, end: number): _Line;
18
19 prototype: _Line;
19 20 }
20 21
21 interface EasingFunction {
22 export interface EasingFunction {
22 23 (n?: number): number;
23 24 }
24 25
25 interface Animation extends Evented {
26 export interface Animation extends Evented {
26 27 /**
27 28 * The time in milliseconds the animation will take to run
28 29 */
@@ -32,7 +33,7 declare namespace fx {
32 33 * A two element array of start and end values, or a `_Line` instance to be
33 34 * used in the Animation.
34 35 */
35 curve: Line | [number, number];
36 curve: _Line | [number, number];
36 37
37 38 /**
38 39 * A Function to adjust the acceleration (or deceleration) of the progress
@@ -92,7 +93,7 declare namespace fx {
92 93 */
93 94 onStop?: Event;
94 95
95 _precent: number;
96 _percent: number;
96 97 _startRepeatCount: number;
97 98 _getStep(): number;
98 99
@@ -145,16 +146,16 declare namespace fx {
145 146 * A generic animation class that fires callbacks into its handlers
146 147 * object at various states.
147 148 */
148 interface AnimationConstructor {
149 export interface AnimationConstructor {
149 150 new(args: any): Animation;
150 151 prototype: Animation;
151 152 }
152 153
153 interface AnimationCallback {
154 export interface AnimationCallback {
154 155 (node: HTMLElement): void;
155 156 }
156 157
157 interface FadeArguments {
158 export interface FadeArguments {
158 159 node: HTMLElement | string;
159 160 duration?: number;
160 161 easing?: EasingFunction;
@@ -163,56 +164,52 declare namespace fx {
163 164 end?: Function;
164 165 }
165 166
166 interface AnimationArgumentsProperties {
167 export interface AnimationArgumentsProperties {
167 168 [name: string]: any;
168 169 }
169 170
170 interface AnimationArguments extends FadeArguments {
171 export interface AnimationArguments extends FadeArguments {
171 172 properties?: AnimationArgumentsProperties;
172 173 onEnd?: AnimationCallback;
173 174 }
174 175
175 interface Fx {
176 _Line: LineConstructor;
176
177 export const _Line: LineConstructor;
177 178
178 Animation: AnimationConstructor;
179 export const Animation: AnimationConstructor;
179 180
180 _fade(args: any): Animation;
181 export function _fade(args: any): Animation;
181 182
182 183 /**
183 184 * Returns an animation that will fade node defined in 'args' from
184 185 * its current opacity to fully opaque.
185 186 */
186 fadeIn(args: FadeArguments): Animation;
187 export function fadeIn(args: FadeArguments): Animation;
187 188
188 189 /**
189 190 * Returns an animation that will fade node defined in 'args'
190 191 * from its current opacity to fully transparent.
191 192 */
192 fadeOut(args: FadeArguments): Animation;
193 export function fadeOut(args: FadeArguments): Animation;
193 194
194 _defaultEasing(n?: number): number;
195 export function _defaultEasing(n?: number): number;
195 196
196 197 /**
197 198 * Returns an animation that will transition the properties of
198 199 * node defined in `args` depending how they are defined in
199 200 * `args.properties`
200 201 */
201 animateProperty(args: AnimationArguments): Animation;
202 export function animateProperty(args: AnimationArguments): Animation;
202 203
203 204 /**
204 205 * A simpler interface to `animateProperty()`, also returns
205 206 * an instance of `Animation` but begins the animation
206 207 * immediately, unlike nearly every other Dojo animation API.
207 208 */
208 anim(
209 export function anim(
209 210 node: HTMLElement | string,
210 211 properties: { [name: string]: any },
211 212 duration?: number,
212 213 easing?: Function,
213 214 onEnd?: AnimationCallback,
214 215 delay?: number): Animation;
215 }
216 }
217 declare const fx: fx.Fx;
218 export = fx;
@@ -1,5 +1,5
1 1 /* dojo/_base/kernel */
2 import Config = require('./config');
2 import { Config } from './config';
3 3
4 4 declare namespace dojo {
5 5 interface Dijit {
@@ -13,7 +13,6 declare namespace dojo {
13 13 config: Config;
14 14 global: any;
15 15
16 // TODO: dojot, dojox
17 16 dijit: Dijit;
18 17 dojox: Dojox;
19 18
General Comments 0
You need to be logged in to leave comments. Login now