dothtml-interfaces 0.1.17 → 0.1.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/i-component.d.ts +6 -4
- package/src/i-dot.d.ts +18 -17
package/package.json
CHANGED
package/src/i-component.d.ts
CHANGED
|
@@ -3,17 +3,19 @@ import { IDotElement, IDotGenericElement } from "./i-dot";
|
|
|
3
3
|
import IDotCss from "./i-dot-css";
|
|
4
4
|
|
|
5
5
|
export interface FrameworkItems {
|
|
6
|
+
/**
|
|
7
|
+
* The root element of the component.
|
|
8
|
+
*/
|
|
6
9
|
el: HTMLElement;
|
|
7
|
-
css: IDotCss;
|
|
8
|
-
html: IDotGenericElement;
|
|
9
10
|
refs: { [key: string]: HTMLElement };
|
|
11
|
+
emit: (event: string, ...args: Array<any>)=>void;
|
|
10
12
|
restyle(): void;
|
|
13
|
+
// css: IDotCss;
|
|
14
|
+
// html: IDotGenericElement;
|
|
11
15
|
}
|
|
12
16
|
|
|
13
17
|
export default interface IComponent {
|
|
14
18
|
// Properties
|
|
15
|
-
props?: { [key: string]: any };
|
|
16
|
-
bindings?: { [key: string]: any };
|
|
17
19
|
events?: Array<string>;
|
|
18
20
|
|
|
19
21
|
readonly $?: FrameworkItems;
|
package/src/i-dot.d.ts
CHANGED
|
@@ -6,9 +6,11 @@ import IObservable from "./i-observable";
|
|
|
6
6
|
|
|
7
7
|
type DotContentPrimitive = string|number|boolean;
|
|
8
8
|
type DotContentBasic = DotContentPrimitive|Node|Element|NodeList|IComponent|IDotDocument//typeof DotDocument;
|
|
9
|
-
export type DotContent = DotContentBasic|Array<DotContent>|IObservable
|
|
9
|
+
export type DotContent = DotContentBasic|Array<DotContent>|IObservable;//|(()=>DotContent);
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
/**
|
|
12
|
+
* Global interface containing elements.
|
|
13
|
+
*/
|
|
12
14
|
export interface IDotDocument
|
|
13
15
|
{
|
|
14
16
|
// Creating a blank DotDocument.
|
|
@@ -46,6 +48,10 @@ export interface IDotDocument
|
|
|
46
48
|
* Creates a text node that will render as a string, rather than being parsed as markup.
|
|
47
49
|
*/
|
|
48
50
|
text(content: string|number|boolean|IObservable): IDotDocument;
|
|
51
|
+
/**
|
|
52
|
+
* Mounts a component.
|
|
53
|
+
*/
|
|
54
|
+
mount(component: IComponent): IMountedComponent;
|
|
49
55
|
/**
|
|
50
56
|
* Iterates n times, appending the result of each iteration to the VDBO.
|
|
51
57
|
* @param n The number of iterations.
|
|
@@ -68,16 +74,8 @@ export interface IDotDocument
|
|
|
68
74
|
*/
|
|
69
75
|
empty(): IDotDocument;
|
|
70
76
|
|
|
71
|
-
/**
|
|
72
|
-
* Executes a function immediately.
|
|
73
|
-
*/
|
|
74
|
-
script(callback: Function): IDotDocument;
|
|
75
|
-
|
|
76
77
|
scopeClass(prefix: number|string|null, content: DotContent): IDotDocument;
|
|
77
78
|
|
|
78
|
-
wait(timeout, callback);
|
|
79
|
-
defer(callback);
|
|
80
|
-
|
|
81
79
|
// Tags.
|
|
82
80
|
a(content?: DotContent): IDotA;
|
|
83
81
|
|
|
@@ -224,7 +222,9 @@ export interface IDotDocument
|
|
|
224
222
|
wbr(content?: DotContent): IDotElementDocument<IDotGenericElement>;
|
|
225
223
|
}
|
|
226
224
|
|
|
227
|
-
|
|
225
|
+
/**
|
|
226
|
+
* Interface for the dot object.
|
|
227
|
+
*/
|
|
228
228
|
export interface IDotCore extends IDotDocument
|
|
229
229
|
{
|
|
230
230
|
(targetSelector: string|Element|Node|NodeList|Array<Node|Element>): IDotElementDocument<IDotGenericElement>;
|
|
@@ -238,7 +238,7 @@ export interface IDotCore extends IDotDocument
|
|
|
238
238
|
|
|
239
239
|
observe<Ti = IObservable|Array<any>|{[key: string|number]: any}|string|number|boolean, To = Ti>(props?: {value: Ti, key?: string, transformer?: (value: Ti)=>To}): IObservable<Ti, To>;
|
|
240
240
|
|
|
241
|
-
component<T extends
|
|
241
|
+
component<T extends IComponent>(ComponentClass: new(...args: any[])=>T): (new(...args: any[])=>(T&{readonly $:FrameworkItems}));
|
|
242
242
|
}
|
|
243
243
|
|
|
244
244
|
export interface IDotWindowBuilder{
|
|
@@ -272,11 +272,6 @@ export interface IDotElementDocument<T extends IDotDocument> extends IDotDocumen
|
|
|
272
272
|
// TODO: I'd really like to enable this. Unfortunately it's not terribly easy to implement.
|
|
273
273
|
// Might be impossible in ES5 (notwithstanding some possible hackery).
|
|
274
274
|
//(content?: DotContent): IDotElementDocument<IDotGenericElement>;
|
|
275
|
-
|
|
276
|
-
/**
|
|
277
|
-
* A conditional function, analogous to if. Renders the specified DOT if a condition is met. Dynamic binding is possible when condition and callback are functions.
|
|
278
|
-
*/
|
|
279
|
-
when(condition: IObservable|boolean, callback: DotContent): IDotConditionalDocument;
|
|
280
275
|
|
|
281
276
|
// TODO: this will erase element context, which could be a bug.
|
|
282
277
|
// It can be duplicated multiple times below, or find a new solution.
|
|
@@ -383,6 +378,12 @@ export interface IDotElementDocument<T extends IDotDocument> extends IDotDocumen
|
|
|
383
378
|
export interface IDotGenericElement extends IDotElementDocument<IDotGenericElement>{}
|
|
384
379
|
|
|
385
380
|
// Interface for specific elements:
|
|
381
|
+
|
|
382
|
+
interface IMountedComponent extends IDotDocument{
|
|
383
|
+
on(event: string, callback: (...args: Array<any>)=>void): IMountedComponent;
|
|
384
|
+
prop(name: string, value: any): IMountedComponent;
|
|
385
|
+
}
|
|
386
|
+
|
|
386
387
|
interface IDotA extends IDotElementDocument<IDotA>{
|
|
387
388
|
download(value: unknown): IDotA;
|
|
388
389
|
hRef(value: unknown): IDotA;
|