##// END OF EJS Templates
switched back to dojo-typings module...
cin -
r4:fc9f82c082ef v1.0.0-rc2 default
parent child
Show More
@@ -0,0 +1,22
1 Copyright 2017-2019 Implab team
2
3 Redistribution and use in source and binary forms, with or without
4 modification, are permitted provided that the following conditions are met:
5
6 1. Redistributions of source code must retain the above copyright notice, this
7 list of conditions and the following disclaimer.
8
9 2. Redistributions in binary form must reproduce the above copyright notice,
10 this list of conditions and the following disclaimer in the documentation
11 and/or other materials provided with the distribution.
12
13 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
14 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
15 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
16 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
17 FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
18 DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
19 SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
20 CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
21 OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
22 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. No newline at end of file
@@ -0,0 +1,3
1 # @implab/djx
2
3 TODO No newline at end of file
@@ -0,0 +1,33
1 import { Constructor } from "@implab/core-amd/interfaces";
2 import { HtmlElementContext } from "./djx/HtmlElementContext";
3 import { WidgetContext } from "./djx/WidgetContext";
4 import { isWidgetConstructor, BuildContext } from "./djx/traits";
5
6 export function createElement<T extends Constructor>(elementType: string | T, ...args: any[]): BuildContext {
7 if (typeof elementType === "string") {
8 const ctx = new HtmlElementContext(elementType);
9 if (args)
10 args.forEach(x => ctx.visitNext(x));
11
12 return ctx;
13 } else if (isWidgetConstructor(elementType)) {
14 const ctx = new WidgetContext(elementType);
15 if (args)
16 args.forEach(x => ctx.visitNext(x));
17
18 return ctx;
19 } else {
20 throw new Error(`The element type '${elementType}' is unsupported`);
21 }
22 }
23
24 export interface EventDetails<T = any> {
25 detail: T;
26 }
27
28 export interface EventSelector {
29 selectorTarget: HTMLElement;
30 target: HTMLElement;
31 }
32
33 export type DojoMouseEvent<T = any> = MouseEvent & EventSelector & EventDetails<T>;
@@ -16,6 +16,8 typescript {
16 16 jsx = "react"
17 17 jsxFactory = "createElement"
18 18 moduleResolution = "node"
19 // dojo-typings are sick
20 skipLibCheck = true
19 21 // traceResolution = true
20 22 // baseUrl = "./"
21 23 // paths = [ "*": [ "$projectDir/src/typings/*" ] ]
@@ -30,7 +32,7 typescript {
30 32
31 33 configureTsMain {
32 34 compilerOptions {
33 types = ["requirejs"]
35 types = ["requirejs", "dojo-typings"]
34 36 }
35 37 }
36 38
@@ -45,14 +45,6
45 45 "integrity": "sha512-f5dXGzOJycyzSMdaXVhiBhauL4dYydXwVpavfQ1mVCaGjR56a9QfklXObUxlIY9bGTmCPHEEZ04I16BZ/8w5ww==",
46 46 "dev": true
47 47 },
48 "@types/dijit": {
49 "version": "file:src/typings/dijit",
50 "dev": true
51 },
52 "@types/dojo": {
53 "version": "file:src/typings/dojo",
54 "dev": true
55 },
56 48 "@types/requirejs": {
57 49 "version": "2.1.31",
58 50 "resolved": "https://registry.npmjs.org/@types/requirejs/-/requirejs-2.1.31.tgz",
@@ -307,6 +299,15
307 299 "integrity": "sha512-DUiXyoLK6vMF5BPr/qiMLTxDMfiM9qlzN1jxfDsVfuvB/CwhYpNxA/M4mbqKN8PCVGLmccXBJbfmFJPP5+zmzw==",
308 300 "dev": true
309 301 },
302 "dojo-typings": {
303 "version": "1.11.9",
304 "resolved": "https://registry.npmjs.org/dojo-typings/-/dojo-typings-1.11.9.tgz",
305 "integrity": "sha512-mh8w+Mau2Y1QfTEszEAdO7j6ycNhYxF/Ing6nAk1eUg6NxjeT0viVHjICMd9sU3U463vM2G+KfBBK5grk3/Mlw==",
306 "dev": true,
307 "requires": {
308 "@types/chai": "^4.0.4"
309 }
310 },
310 311 "emoji-regex": {
311 312 "version": "8.0.0",
312 313 "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz",
@@ -8,7 +8,12
8 8 "typescript",
9 9 "widgets"
10 10 ],
11 "repository": "",
11 "author": "Implab team",
12 "license": "BSD-2-Clause",
13 "repository": "https://hg.code.sf.net/p/implabjs/djx",
14 "publishConfig": {
15 "access": "public"
16 },
12 17 "peerDependencies": {
13 18 "dojo": "1.16.0",
14 19 "@implab/core-amd": "^1.3.2"
@@ -24,7 +29,6
24 29 "@types/yaml": "1.2.0",
25 30 "chai": "4.2.0",
26 31 "@types/chai": "4.1.3",
27 "@types/dojo": "./src/typings/dojo",
28 "@types/dijit": "./src/typings/dijit"
32 "dojo-typings": "~1.11.9"
29 33 }
30 34 }
@@ -1,7 +1,9
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";
4 // import { DeclareConstructor } from "dojo/_base/declare";
5
6 type DeclareConstructor<T> = dojo._base.DeclareConstructor<T>;
5 7
6 8 export interface AbstractConstructor<T = {}> {
7 9 prototype: T;
@@ -3,7 +3,8 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";
6 // import { Handle } from "dojo/interfaces";
7 type Handle = dojo.Handle;
7 8
8 9 @djclass
9 10 export abstract class DjxWidgetBase extends djbase(_WidgetBase, _AttachMixin) {
@@ -1,5 +1,7
1 1 import _WidgetBase = require("dijit/_WidgetBase");
2 import { _WidgetBaseConstructor } from "dijit/_WidgetBase";
2
3 type _WidgetBaseConstructor = typeof _WidgetBase;
4
3 5
4 6 export interface BuildContext {
5 7 getDomElement(): HTMLElement;
@@ -3,7 +3,7
3 3 "compilerOptions": {
4 4 "rootDir": "ts",
5 5 "types": [
6 "requirejs"
6 "requirejs", "dojo-typings"
7 7 ]
8 8 }
9 9 } No newline at end of file
@@ -6,6 +6,7
6 6 "types": [],
7 7 "experimentalDecorators": true,
8 8 "jsxFactory": "createElement",
9 "skipLibCheck": true,
9 10 "jsx": "react",
10 11 "lib": ["es5", "es2015.promise", "es2015.symbol", "es2015.iterable", "dom", "scripthost"]
11 12 }
General Comments 0
You need to be logged in to leave comments. Login now