dothtml-interfaces 0.1.17 → 0.1.19
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 +84 -81
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,13 @@ 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
|
+
type PrimativeOrObservable<T = string|number|boolean> = T|IObservable<T>;
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Global interface containing elements.
|
|
15
|
+
*/
|
|
12
16
|
export interface IDotDocument
|
|
13
17
|
{
|
|
14
18
|
// Creating a blank DotDocument.
|
|
@@ -46,6 +50,10 @@ export interface IDotDocument
|
|
|
46
50
|
* Creates a text node that will render as a string, rather than being parsed as markup.
|
|
47
51
|
*/
|
|
48
52
|
text(content: string|number|boolean|IObservable): IDotDocument;
|
|
53
|
+
/**
|
|
54
|
+
* Mounts a component.
|
|
55
|
+
*/
|
|
56
|
+
mount(component: IComponent): IMountedComponent;
|
|
49
57
|
/**
|
|
50
58
|
* Iterates n times, appending the result of each iteration to the VDBO.
|
|
51
59
|
* @param n The number of iterations.
|
|
@@ -68,16 +76,8 @@ export interface IDotDocument
|
|
|
68
76
|
*/
|
|
69
77
|
empty(): IDotDocument;
|
|
70
78
|
|
|
71
|
-
/**
|
|
72
|
-
* Executes a function immediately.
|
|
73
|
-
*/
|
|
74
|
-
script(callback: Function): IDotDocument;
|
|
75
|
-
|
|
76
79
|
scopeClass(prefix: number|string|null, content: DotContent): IDotDocument;
|
|
77
80
|
|
|
78
|
-
wait(timeout, callback);
|
|
79
|
-
defer(callback);
|
|
80
|
-
|
|
81
81
|
// Tags.
|
|
82
82
|
a(content?: DotContent): IDotA;
|
|
83
83
|
|
|
@@ -224,7 +224,9 @@ export interface IDotDocument
|
|
|
224
224
|
wbr(content?: DotContent): IDotElementDocument<IDotGenericElement>;
|
|
225
225
|
}
|
|
226
226
|
|
|
227
|
-
|
|
227
|
+
/**
|
|
228
|
+
* Interface for the dot object.
|
|
229
|
+
*/
|
|
228
230
|
export interface IDotCore extends IDotDocument
|
|
229
231
|
{
|
|
230
232
|
(targetSelector: string|Element|Node|NodeList|Array<Node|Element>): IDotElementDocument<IDotGenericElement>;
|
|
@@ -238,7 +240,7 @@ export interface IDotCore extends IDotDocument
|
|
|
238
240
|
|
|
239
241
|
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
242
|
|
|
241
|
-
component<T extends
|
|
243
|
+
component<T extends IComponent>(ComponentClass: new(...args: any[])=>T): (new(...args: any[])=>(T&{readonly $:FrameworkItems}));
|
|
242
244
|
}
|
|
243
245
|
|
|
244
246
|
export interface IDotWindowBuilder{
|
|
@@ -272,11 +274,6 @@ export interface IDotElementDocument<T extends IDotDocument> extends IDotDocumen
|
|
|
272
274
|
// TODO: I'd really like to enable this. Unfortunately it's not terribly easy to implement.
|
|
273
275
|
// Might be impossible in ES5 (notwithstanding some possible hackery).
|
|
274
276
|
//(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
277
|
|
|
281
278
|
// TODO: this will erase element context, which could be a bug.
|
|
282
279
|
// It can be duplicated multiple times below, or find a new solution.
|
|
@@ -306,20 +303,21 @@ export interface IDotElementDocument<T extends IDotDocument> extends IDotDocumen
|
|
|
306
303
|
// /** @deprecated Non-standard attribute. */
|
|
307
304
|
// autoSave(value: unknown): IDotMajor;
|
|
308
305
|
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
306
|
+
// TODO: we're still missing some additional global attributes. See https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/
|
|
307
|
+
accessKey(value: PrimativeOrObservable<string>): T; // This could potentially be enumerated. But care should be taken as these types are already quite complex.
|
|
308
|
+
class(value: unknown): T; // TODO: need a better way of setting classes.
|
|
309
|
+
contentEditable(value: PrimativeOrObservable<"true"|"false"|"plaintext-only">): T;
|
|
310
|
+
dir(value: PrimativeOrObservable<string>): T;
|
|
311
|
+
draggable(value: PrimativeOrObservable<"true"|"false">): T; // This one is enumerated. "true" or "false" is mandatory.
|
|
314
312
|
dropZone(value: "move"|"copy"|"link"): T; // Might not be supported anywhere.
|
|
315
|
-
hidden(value:
|
|
316
|
-
id(value:
|
|
317
|
-
itemProp(value:
|
|
318
|
-
lang(value:
|
|
319
|
-
spellCheck(value:
|
|
313
|
+
hidden(value: PrimativeOrObservable<boolean>): T;
|
|
314
|
+
id(value: string): T;
|
|
315
|
+
itemProp(value: PrimativeOrObservable<string>): T;
|
|
316
|
+
lang(value: PrimativeOrObservable<string>): T;
|
|
317
|
+
spellCheck(value: PrimativeOrObservable<"true"|"false">): T; // This one should ideally render as "true" or "false", not be removed.
|
|
320
318
|
style(value: string|IDotcssProp): T;
|
|
321
|
-
tabIndex(value:
|
|
322
|
-
title(value:
|
|
319
|
+
tabIndex(value: PrimativeOrObservable<number>): T;
|
|
320
|
+
title(value: PrimativeOrObservable<string>): T;
|
|
323
321
|
|
|
324
322
|
// Events
|
|
325
323
|
|
|
@@ -328,7 +326,6 @@ export interface IDotElementDocument<T extends IDotDocument> extends IDotDocumen
|
|
|
328
326
|
onCut(callback: (e: Event)=>void): T; // global
|
|
329
327
|
onPagePaste(callback: (e: Event)=>void): T; // global
|
|
330
328
|
|
|
331
|
-
// TODO: Really really add:
|
|
332
329
|
onDrag(callback: (e: DragEvent)=>void): T; // global
|
|
333
330
|
onDragEnd(callback: (e: DragEvent)=>void): T; // global
|
|
334
331
|
onDragStart(callback: (e: DragEvent)=>void): T; // global
|
|
@@ -383,16 +380,22 @@ export interface IDotElementDocument<T extends IDotDocument> extends IDotDocumen
|
|
|
383
380
|
export interface IDotGenericElement extends IDotElementDocument<IDotGenericElement>{}
|
|
384
381
|
|
|
385
382
|
// Interface for specific elements:
|
|
383
|
+
|
|
384
|
+
interface IMountedComponent extends IDotDocument{
|
|
385
|
+
on(event: string, callback: (...args: Array<any>)=>void): IMountedComponent;
|
|
386
|
+
prop(name: string, value: any): IMountedComponent;
|
|
387
|
+
}
|
|
388
|
+
|
|
386
389
|
interface IDotA extends IDotElementDocument<IDotA>{
|
|
387
|
-
download(value:
|
|
388
|
-
hRef(value:
|
|
389
|
-
hRefLang(value:
|
|
390
|
+
download(value: PrimativeOrObservable<boolean>): IDotA;
|
|
391
|
+
hRef(value: PrimativeOrObservable<string>): IDotA;
|
|
392
|
+
hRefLang(value: PrimativeOrObservable<string>): IDotA;
|
|
390
393
|
media(value: unknown): IDotA;
|
|
391
394
|
ping(value: unknown): IDotA;
|
|
392
|
-
rel(value:
|
|
395
|
+
rel(value: PrimativeOrObservable<string>): IDotA;
|
|
393
396
|
rev(value: unknown): IDotA;
|
|
394
|
-
target(value:
|
|
395
|
-
type(value: unknown): IDotA;
|
|
397
|
+
target(value: PrimativeOrObservable<"_blank"|"_parent"|"_self"|"_top">): IDotA;
|
|
398
|
+
type(value: unknown): IDotA; // This might be fake news.
|
|
396
399
|
}
|
|
397
400
|
interface IDotArea extends IDotElementDocument<IDotArea>{
|
|
398
401
|
alt(value: unknown): IDotArea;
|
|
@@ -401,19 +404,19 @@ interface IDotArea extends IDotElementDocument<IDotArea>{
|
|
|
401
404
|
hRef(value: unknown): IDotArea;
|
|
402
405
|
hRefLang(value: unknown): IDotArea;
|
|
403
406
|
media(value: unknown): IDotArea;
|
|
404
|
-
noHRef(value:
|
|
405
|
-
rel(value: unknown): IDotArea;
|
|
406
|
-
shape(value:
|
|
407
|
-
target(value:
|
|
407
|
+
noHRef(value: PrimativeOrObservable<string>): IDotArea;
|
|
408
|
+
rel(value: unknown): IDotArea; // Fake?
|
|
409
|
+
shape(value: PrimativeOrObservable<string>): IDotArea;
|
|
410
|
+
target(value: PrimativeOrObservable<string>): IDotArea;
|
|
408
411
|
}
|
|
409
412
|
interface IDotAudio extends IDotElementDocument<IDotAudio>{
|
|
410
|
-
autoPlay(value:
|
|
413
|
+
autoPlay(value: PrimativeOrObservable<boolean>): IDotAudio;
|
|
411
414
|
buffered(value: unknown): IDotAudio;
|
|
412
|
-
controls(value:
|
|
413
|
-
loop(value:
|
|
414
|
-
muted(value:
|
|
415
|
-
preload(value:
|
|
416
|
-
src(value:
|
|
415
|
+
controls(value: PrimativeOrObservable<boolean>): IDotAudio;
|
|
416
|
+
loop(value: PrimativeOrObservable<boolean>): IDotAudio;
|
|
417
|
+
muted(value: PrimativeOrObservable<boolean>): IDotAudio;
|
|
418
|
+
preload(value: PrimativeOrObservable<"auto"|"metadata"|"none">): IDotAudio;
|
|
419
|
+
src(value: PrimativeOrObservable<string>): IDotAudio;
|
|
417
420
|
|
|
418
421
|
// Special functions:
|
|
419
422
|
pause(): IDotAudio;
|
|
@@ -540,44 +543,44 @@ interface IDotIFrame extends IDotElementDocument<IDotIFrame>{
|
|
|
540
543
|
width(value: unknown): IDotIFrame;
|
|
541
544
|
}
|
|
542
545
|
interface IDotImg extends IDotElementDocument<IDotImg>{
|
|
543
|
-
alt(value:
|
|
544
|
-
height(value:
|
|
546
|
+
alt(value: PrimativeOrObservable<string>): IDotImg;
|
|
547
|
+
height(value: PrimativeOrObservable<number>): IDotImg;
|
|
545
548
|
/** @deprecated Deprecated in HTML5. Use CSS. */
|
|
546
549
|
hSpace(value: unknown): IDotImg;
|
|
547
550
|
isMap(value: unknown): IDotImg;
|
|
548
551
|
longDesc(value: unknown): IDotImg;
|
|
549
552
|
sizes(value: unknown): IDotImg;
|
|
550
|
-
src(value:
|
|
553
|
+
src(value: PrimativeOrObservable<string>): IDotImg;
|
|
551
554
|
srcSet(value: unknown): IDotImg;
|
|
552
555
|
useMap(value: unknown): IDotImg;
|
|
553
|
-
width(value:
|
|
556
|
+
width(value: PrimativeOrObservable<number>): IDotImg;
|
|
554
557
|
}
|
|
555
558
|
interface IDotInput extends IDotElementDocument<IDotInput>{
|
|
556
559
|
accept(value: unknown): IDotInput;
|
|
557
560
|
alt(value: unknown): IDotInput;
|
|
558
561
|
autoComplete(value: unknown): IDotInput;
|
|
559
562
|
autoFocus(value: unknown): IDotInput;
|
|
560
|
-
checked(value?: boolean): IDotInput;
|
|
561
|
-
dirName(value:
|
|
562
|
-
disabled(value:
|
|
563
|
+
checked(value?: PrimativeOrObservable<boolean>): IDotInput;
|
|
564
|
+
dirName(value: PrimativeOrObservable<string>): IDotInput;
|
|
565
|
+
disabled(value: PrimativeOrObservable<boolean>): IDotInput;
|
|
563
566
|
formAction(value: unknown): IDotInput;
|
|
564
567
|
list(value: unknown): IDotInput;
|
|
565
|
-
max(value:
|
|
566
|
-
maxLength(value:
|
|
567
|
-
min(value:
|
|
568
|
+
max(value: PrimativeOrObservable<number>): IDotInput;
|
|
569
|
+
maxLength(value: PrimativeOrObservable<number>): IDotInput;
|
|
570
|
+
min(value: PrimativeOrObservable<number>): IDotInput;
|
|
568
571
|
multiple(value: unknown): IDotInput;
|
|
569
|
-
name(value:
|
|
570
|
-
pattern(value:
|
|
572
|
+
name(value: PrimativeOrObservable<string>): IDotInput;
|
|
573
|
+
pattern(value: PrimativeOrObservable<string>): IDotInput;
|
|
571
574
|
placeholder(value: unknown): IDotInput;
|
|
572
|
-
readOnly(value:
|
|
573
|
-
required(value:
|
|
575
|
+
readOnly(value: PrimativeOrObservable<boolean>): IDotInput;
|
|
576
|
+
required(value: PrimativeOrObservable<boolean>): IDotInput;
|
|
574
577
|
size(value: unknown): IDotInput;
|
|
575
|
-
src(value:
|
|
578
|
+
src(value: PrimativeOrObservable<string>): IDotInput;
|
|
576
579
|
step(value: unknown): IDotInput;
|
|
577
|
-
type(value:
|
|
580
|
+
type(value: "button"|"checkbox"|"color"|"date"|"datetime-local"|"email"|"file"|"hidden"|"image"|"month"|"number"|"password"|"radio"|"range"|"reset"|"search"|"submit"|"tel"|"text"|"time"|"url"|"week"): IDotInput;
|
|
578
581
|
whichForm(value: unknown): IDotInput; // form
|
|
579
|
-
value(value:
|
|
580
|
-
width(value:
|
|
582
|
+
value(value: PrimativeOrObservable<string|boolean|number>): IDotInput;
|
|
583
|
+
width(value: PrimativeOrObservable<number>): IDotInput;
|
|
581
584
|
|
|
582
585
|
// Special functions:
|
|
583
586
|
// getVal(): string
|
|
@@ -648,8 +651,8 @@ interface IDotOption extends IDotElementDocument<IDotOption>{
|
|
|
648
651
|
// setVal(value: unknown): IDotOption;
|
|
649
652
|
}
|
|
650
653
|
interface IDotOutput extends IDotElementDocument<IDotOutput>{
|
|
651
|
-
for(value:
|
|
652
|
-
name(value:
|
|
654
|
+
for(value: PrimativeOrObservable<string>): IDotOutput;
|
|
655
|
+
name(value: PrimativeOrObservable<string>): IDotOutput;
|
|
653
656
|
whichForm(value: unknown): IDotOutput; // form
|
|
654
657
|
}
|
|
655
658
|
interface IDotParam extends IDotElementDocument<IDotParam>{
|
|
@@ -699,16 +702,16 @@ interface IDotTable extends IDotElementDocument<IDotTable>{
|
|
|
699
702
|
tableSummary(value: unknown): IDotTable; // summary
|
|
700
703
|
}
|
|
701
704
|
interface IDotTextArea extends IDotElementDocument<IDotTextArea>{
|
|
702
|
-
autoFocus(value:
|
|
703
|
-
cols(value:
|
|
704
|
-
dirName(value:
|
|
705
|
-
disabled(value:
|
|
705
|
+
autoFocus(value: PrimativeOrObservable<boolean>): IDotTextArea;
|
|
706
|
+
cols(value: PrimativeOrObservable<number>): IDotTextArea;
|
|
707
|
+
dirName(value: PrimativeOrObservable<string>): IDotTextArea;
|
|
708
|
+
disabled(value: PrimativeOrObservable<boolean>): IDotTextArea;
|
|
706
709
|
maxLength(value: unknown): IDotTextArea;
|
|
707
|
-
name(value:
|
|
710
|
+
name(value: string): IDotTextArea;
|
|
708
711
|
placeholder(value: unknown): IDotTextArea;
|
|
709
712
|
readOnly(value: unknown): IDotTextArea;
|
|
710
713
|
required(value: unknown): IDotTextArea;
|
|
711
|
-
rows(value:
|
|
714
|
+
rows(value: PrimativeOrObservable<number>): IDotTextArea;
|
|
712
715
|
whichForm(value: unknown): IDotTextArea; // form
|
|
713
716
|
wrap(value: unknown): IDotTextArea;
|
|
714
717
|
|
|
@@ -777,16 +780,16 @@ interface IDotTrack extends IDotElementDocument<IDotTrack>{
|
|
|
777
780
|
onCueChange(callback: (e: Event)=>void): IDotTrack;
|
|
778
781
|
}
|
|
779
782
|
interface IDotVideo extends IDotElementDocument<IDotVideo>{
|
|
780
|
-
autoPlay(value:
|
|
783
|
+
autoPlay(value: PrimativeOrObservable<boolean>): IDotVideo;
|
|
781
784
|
buffered(value: unknown): IDotVideo;
|
|
782
|
-
controls(value:
|
|
783
|
-
height(value:
|
|
784
|
-
loop(value:
|
|
785
|
-
muted(value:
|
|
786
|
-
poster(value:
|
|
787
|
-
preload(value:
|
|
788
|
-
src(value:
|
|
789
|
-
width(value:
|
|
785
|
+
controls(value: PrimativeOrObservable<boolean>): IDotVideo;
|
|
786
|
+
height(value: PrimativeOrObservable<number>): IDotVideo;
|
|
787
|
+
loop(value: PrimativeOrObservable<boolean>): IDotVideo;
|
|
788
|
+
muted(value: PrimativeOrObservable<boolean>): IDotVideo;
|
|
789
|
+
poster(value: PrimativeOrObservable<string>): IDotVideo;
|
|
790
|
+
preload(value: PrimativeOrObservable<boolean>): IDotVideo;
|
|
791
|
+
src(value: PrimativeOrObservable<string>): IDotVideo;
|
|
792
|
+
width(value: PrimativeOrObservable<number>): IDotVideo;
|
|
790
793
|
|
|
791
794
|
// Special functions:
|
|
792
795
|
pause(): IDotVideo;
|