dothtml-interfaces 0.4.6 → 1.0.0

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.
Files changed (27) hide show
  1. package/README.md +3 -3
  2. package/package.json +6 -4
  3. package/src/bindings/{i-binding.d.ts → i-binding.ts} +11 -11
  4. package/src/bindings/{i-observer.d.ts → i-observer.ts} +2 -2
  5. package/src/bindings/{i-reactive.d.ts → i-reactive.ts} +4 -4
  6. package/src/bindings/i-ref.ts +5 -0
  7. package/src/bindings/{i-watcher.d.ts → i-watcher.ts} +52 -38
  8. package/src/{i-dot-component.d.ts → i-dot-component.ts} +113 -84
  9. package/src/{i-dot.d.ts → i-dot.ts} +1041 -1047
  10. package/src/{i-event-bus.d.ts → i-event-bus.ts} +10 -10
  11. package/src/{index.d.ts → index.ts} +14 -14
  12. package/src/styles/at-rules/{i-at-color-profile-builder.d.ts → i-at-color-profile-builder.ts} +4 -4
  13. package/src/styles/at-rules/{i-at-counter-style-builder.d.ts → i-at-counter-style-builder.ts} +14 -14
  14. package/src/styles/at-rules/{i-at-font-family-builder.d.ts → i-at-font-family-builder.ts} +18 -18
  15. package/src/styles/at-rules/{i-at-font-palette-values.d.ts → i-at-font-palette-values.ts} +5 -5
  16. package/src/styles/at-rules/{i-at-keyframes-builder.d.ts → i-at-keyframes-builder.ts} +7 -7
  17. package/src/styles/at-rules/{i-at-page-builder.d.ts → i-at-page-builder.ts} +19 -19
  18. package/src/styles/complex-css-types/{i-filter-prop.d.ts → i-filter-prop.ts} +19 -19
  19. package/src/styles/complex-css-types/{i-shadow-prop.d.ts → i-shadow-prop.ts} +11 -11
  20. package/src/styles/complex-css-types/{i-transformation-prop.d.ts → i-transformation-prop.ts} +32 -32
  21. package/src/styles/{css-types.d.ts → css-types.ts} +141 -141
  22. package/src/styles/{i-css-prop.d.ts → i-css-prop.ts} +295 -295
  23. package/src/styles/{i-dot-css.d.ts → i-dot-css.ts} +218 -214
  24. package/src/styles/mapped-types/{angle-prop.d.ts → angle-prop.ts} +15 -15
  25. package/src/styles/mapped-types/{color-props.d.ts → color-props.ts} +60 -60
  26. package/src/styles/mapped-types/{length-prop.d.ts → length-prop.ts} +21 -19
  27. package/src/bindings/i-ref.d.ts +0 -4
@@ -1,1047 +1,1041 @@
1
-
2
- import IDotComponent from "./i-dot-component";
3
- import IDotCss from "./styles/i-dot-css";
4
- import IEventBus from "./i-event-bus";
5
- import {IReactive} from "./bindings/i-reactive";
6
- import { IBinding } from "./bindings/i-binding";
7
- import { IWatcher } from "./bindings/i-watcher";
8
- import IDotcssProp from "./styles/i-css-prop";
9
- import { IRef } from "./bindings/i-ref";
10
-
11
- type DotContentPrimitive = string | number | boolean | undefined | null;
12
- type DotContentBasic = DotContentPrimitive | Node | Element | NodeList | IDotComponent | IDotDocument//typeof DotDocument;
13
- export type DotContent = DotContentBasic | Array<DotContent> | IReactive;//|(()=>DotContent);
14
-
15
- type AttrVal<T = string | number | boolean> = T | IReactive;
16
-
17
- /**
18
- * Global interface containing elements.
19
- */
20
- export interface IDotDocument {
21
- // Creating a blank DotDocument.
22
- // (document?: Element, classPrefix?: number, targetWindow?: Window): void;
23
-
24
- // Internal use only:
25
- // Removed in v6.
26
- // _appendOrCreateDocument(content: DotContent, parentEl?: Element, beforeNode?: Node|number);
27
-
28
- /**
29
- * 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.
30
- */
31
- when(condition: IReactive | boolean, DotContent): IDotConditionalDocument;
32
-
33
- // Main functions.
34
- // TODO: please make this into a test case.
35
- /**
36
- * Cast any document to any other element type. This can be used to access attributes when dotHTML doesn't know the type.
37
- * @example
38
- * dot("#my-input").as(dot.input).value("Hello, world!")
39
- * @example
40
- * dot.h("<a>Click me!</a>").as(dot.a).hRef("https://dothtml.com/")
41
- */
42
- as<T extends IDotDocument>(dotElement: (...props: any[]) => T): T;
43
- /**
44
- * Creates a custom element.
45
- */
46
- el(tag: string, content?: DotContent): IDotDocument
47
-
48
- // Special "tags"
49
- /**
50
- * Creates a generic HTML node that can render a string, HTML nodes, or dotHTML content.
51
- */
52
- html(content: string | number | boolean | IReactive): IDotDocument;
53
- /**
54
- * Creates a text node that will render as a string, rather than being parsed as markup.
55
- */
56
- text(content: string | number | boolean | IReactive): IDotDocument;
57
- /**
58
- * Mounts a component.
59
- * TODO: add second arg.
60
- */
61
- mount<T extends IDotComponent>(component: T): IDotDocument;
62
- // mount<T extends IComponent>(init: (c: IMountedComponent<T>) => IMountedComponent<T> | void, component: T): IDotDocument;
63
- // mount(component: IComponent, init: (init=>IMountedComponent): IMountedComponent|void): IDotDocument;
64
- /**
65
- * Iterates n times, appending the result of each iteration to the VDBO.
66
- * @param n The number of iterations.
67
- * @param callback The markup-generating callback.
68
- */
69
- iterate(n: number, callback: (i: number) => DotContent): IDotDocument;
70
- each<T>(a: Array<T> | { [key: string | number]: T }, callback: (x: T, i: number, k: string | number) => DotContent): IDotDocument;
71
- each<T>(a:
72
- IWatcher<Array<T>>
73
- |IWatcher<Record<string|number, T>>
74
- |IBinding<any, Array<T>>
75
- |IBinding<any, IWatcher<Record<string|number, T>>>
76
- , callback: (x: T, i: IBinding<number>, k: string | number) => DotContent): IDotDocument;
77
-
78
- /**
79
- * Removes the targeted document and everything in it.
80
- */
81
- remove(): void;
82
- /**
83
- * Get the last HTML element added to the targeted document.
84
- */
85
- // getLast(): HTMLElement;
86
- /**
87
- * Deletes each element within the targeted document.
88
- */
89
- empty(): IDotDocument;
90
-
91
- // Redundant in v6.
92
- // scopeClass(prefix: number|string|null, content: DotContent): IDotDocument;
93
-
94
- // Tags.
95
- a(content?: DotContent, attrs?: IDotA): IDotDocument;
96
- a(attrs: IDotA, content?: DotContent): IDotDocument;
97
-
98
- aside(content?: DotContent, attrs?: IDotGlobalAttrs): IDotDocument;
99
- aside(attrs: IDotGlobalAttrs, content?: DotContent): IDotDocument;
100
- abbr(content?: DotContent, attrs?: IDotGlobalAttrs): IDotDocument;
101
- abbr(attrs: IDotGlobalAttrs, content?: DotContent): IDotDocument;
102
- address(content?: DotContent, attrs?: IDotGlobalAttrs): IDotDocument;
103
- address(attrs: IDotGlobalAttrs, content?: DotContent): IDotDocument;
104
-
105
- area(content?: DotContent, attrs?: IDotArea): IDotDocument;
106
- area(attrs: IDotArea, content?: DotContent): IDotDocument;
107
-
108
- article(content?: DotContent, attrs?: IDotGlobalAttrs): IDotDocument;
109
- article(attrs: IDotGlobalAttrs, content?: DotContent): IDotDocument;
110
-
111
- audio(content?: DotContent, attrs?: IDotAudio): IDotDocument;
112
- audio(attrs: IDotAudio, content?: DotContent): IDotDocument;
113
-
114
- b(content?: DotContent, attrs?: IDotGlobalAttrs): IDotDocument;
115
- b(attrs: IDotGlobalAttrs, content?: DotContent): IDotDocument;
116
- bdi(content?: DotContent, attrs?: IDotGlobalAttrs): IDotDocument;
117
- bdi(attrs: IDotGlobalAttrs, content?: DotContent): IDotDocument;
118
- bdo(content?: DotContent, attrs?: IDotGlobalAttrs): IDotDocument;
119
- bdo(attrs: IDotGlobalAttrs, content?: DotContent): IDotDocument;
120
-
121
- blockQuote(content?: DotContent, attrs?: IDotBlockQuote): IDotDocument;
122
- blockQuote(attrs: IDotBlockQuote, content?: DotContent): IDotDocument;
123
-
124
- // This shouldn't really be used - if it is, then it should have the custom behavior of rewriting the existing document body, rather than adding a second one.
125
- body(content?: DotContent, attrs?: IDotBody): IDotDocument;
126
- body(attrs: IDotBody, content?: DotContent): IDotDocument;
127
-
128
- br(content?: DotContent, attrs?: IDotBr): IDotDocument;
129
- br(attrs: IDotBr, content?: DotContent): IDotDocument;
130
- button(content?: DotContent, attrs?: IDotButton): IDotDocument;
131
- button(attrs: IDotButton, content?: DotContent): IDotDocument;
132
- canvas(content?: DotContent, attrs?: IDotCanvas): IDotDocument;
133
- canvas(attrs: IDotCanvas, content?: DotContent): IDotDocument;
134
-
135
- caption(content?: DotContent, attrs?: IDotGlobalAttrs): IDotDocument;
136
- caption(attrs: IDotGlobalAttrs, content?: DotContent): IDotDocument;
137
- cite(content?: DotContent, attrs?: IDotGlobalAttrs): IDotDocument;
138
- cite(attrs: IDotGlobalAttrs, content?: DotContent): IDotDocument;
139
- code(content?: DotContent, attrs?: IDotGlobalAttrs): IDotDocument;
140
- code(attrs: IDotGlobalAttrs, content?: DotContent): IDotDocument;
141
-
142
- col(content?: DotContent, attrs?: IDotCol): IDotDocument;
143
- col(attrs: IDotCol, content?: DotContent): IDotDocument;
144
- colGroup(content?: DotContent, attrs?: IDotColGroup): IDotDocument;
145
- colGroup(attrs: IDotColGroup, content?: DotContent): IDotDocument;
146
-
147
- content(content?: DotContent, attrs?: IDotGlobalAttrs): IDotDocument;
148
- content(attrs: IDotGlobalAttrs, content?: DotContent): IDotDocument;
149
- data(content?: DotContent, attrs?: IDotGlobalAttrs): IDotDocument;
150
- data(attrs: IDotGlobalAttrs, content?: DotContent): IDotDocument;
151
- dataList(content?: DotContent, attrs?: IDotGlobalAttrs): IDotDocument;
152
- dataList(attrs: IDotGlobalAttrs, content?: DotContent): IDotDocument;
153
- dd(content?: DotContent, attrs?: IDotGlobalAttrs): IDotDocument;
154
- dd(attrs: IDotGlobalAttrs, content?: DotContent): IDotDocument;
155
-
156
- del(content?: DotContent, attrs?: IDotDel): IDotDocument;
157
- del(attrs: IDotDel, content?: DotContent): IDotDocument;
158
- details(content?: DotContent, attrs?: IDotDetails): IDotDocument;
159
- details(attrs: IDotDetails, content?: DotContent): IDotDocument;
160
-
161
- dfn(content?: DotContent, attrs?: IDotGlobalAttrs): IDotDocument;
162
- dfn(attrs: IDotGlobalAttrs, content?: DotContent): IDotDocument;
163
- dialog(content?: DotContent, attrs?: IDotGlobalAttrs): IDotDocument;
164
- dialog(attrs: IDotGlobalAttrs, content?: DotContent): IDotDocument;
165
- div(content?: DotContent, attrs?: IDotGlobalAttrs): IDotDocument;
166
- div(attrs: IDotGlobalAttrs, content?: DotContent): IDotDocument;
167
- dl(content?: DotContent, attrs?: IDotGlobalAttrs): IDotDocument;
168
- dl(attrs: IDotGlobalAttrs, content?: DotContent): IDotDocument;
169
- dt(content?: DotContent, attrs?: IDotGlobalAttrs): IDotDocument;
170
- dt(attrs: IDotGlobalAttrs, content?: DotContent): IDotDocument;
171
- em(content?: DotContent, attrs?: IDotGlobalAttrs): IDotDocument;
172
- em(attrs: IDotGlobalAttrs, content?: DotContent): IDotDocument;
173
-
174
- embed(content?: DotContent, attrs?: IDotEmbed): IDotDocument;
175
- embed(attrs: IDotEmbed, content?: DotContent): IDotDocument;
176
- fieldSet(content?: DotContent, attrs?: IDotFieldSet): IDotDocument;
177
- fieldSet(attrs: IDotFieldSet, content?: DotContent): IDotDocument;
178
-
179
- figCaption(content?: DotContent, attrs?: IDotGlobalAttrs): IDotDocument;
180
- figCaption(attrs: IDotGlobalAttrs, content?: DotContent): IDotDocument;
181
- figure(content?: DotContent, attrs?: IDotGlobalAttrs): IDotDocument;
182
- figure(attrs: IDotGlobalAttrs, content?: DotContent): IDotDocument;
183
- footer(content?: DotContent, attrs?: IDotGlobalAttrs): IDotDocument;
184
- footer(attrs: IDotGlobalAttrs, content?: DotContent): IDotDocument;
185
-
186
- form(content?: DotContent, attrs?: IDotForm): IDotDocument;
187
- form(attrs: IDotForm, content?: DotContent): IDotDocument;
188
-
189
- h1(content?: DotContent, attrs?: IDotGlobalAttrs): IDotDocument;
190
- h1(attrs: IDotGlobalAttrs, content?: DotContent): IDotDocument;
191
- h2(content?: DotContent, attrs?: IDotGlobalAttrs): IDotDocument;
192
- h2(attrs: IDotGlobalAttrs, content?: DotContent): IDotDocument;
193
- h3(content?: DotContent, attrs?: IDotGlobalAttrs): IDotDocument;
194
- h3(attrs: IDotGlobalAttrs, content?: DotContent): IDotDocument;
195
- h4(content?: DotContent, attrs?: IDotGlobalAttrs): IDotDocument;
196
- h4(attrs: IDotGlobalAttrs, content?: DotContent): IDotDocument;
197
- h5(content?: DotContent, attrs?: IDotGlobalAttrs): IDotDocument;
198
- h5(attrs: IDotGlobalAttrs, content?: DotContent): IDotDocument;
199
- h6(content?: DotContent, attrs?: IDotGlobalAttrs): IDotDocument;
200
- h6(attrs: IDotGlobalAttrs, content?: DotContent): IDotDocument;
201
- header(content?: DotContent, attrs?: IDotGlobalAttrs): IDotDocument;
202
- header(attrs: IDotGlobalAttrs, content?: DotContent): IDotDocument;
203
-
204
- hr(content?: DotContent, attrs?: (attrs: IDotHr) => IDotHr): IDotDocument;
205
- hr(attrs: (attrs: IDotHr) => IDotHr, content?: DotContent): IDotDocument;
206
-
207
- i(content?: DotContent, attrs?: IDotGlobalAttrs): IDotDocument;
208
- i(attrs: IDotGlobalAttrs, content?: DotContent): IDotDocument;
209
-
210
- iFrame(content?: DotContent, attrs?: IDotIFrame): IDotDocument;
211
- iFrame(attrs: IDotIFrame, content?: DotContent): IDotDocument;
212
- img(content?: DotContent, attrs?: IDotImg): IDotDocument;
213
- img(attrs: IDotImg, content?: DotContent): IDotDocument;
214
- input(content?: DotContent, attrs?: IDotInput): IDotDocument;
215
- input(attrs: IDotInput, content?: DotContent): IDotDocument;
216
- ins(content?: DotContent, attrs?: IDotIns): IDotDocument;
217
- ins(attrs: IDotIns, content?: DotContent): IDotDocument;
218
-
219
- kbd(content?: DotContent, attrs?: IDotGlobalAttrs): IDotDocument;
220
- kbd(attrs: IDotGlobalAttrs, content?: DotContent): IDotDocument;
221
-
222
- /** @deprecated Deprecated in HTML5. */
223
- keyGen(content?: DotContent, attrs?: IDotKeyGen): IDotDocument;
224
- keyGen(attrs: IDotKeyGen, content?: DotContent): IDotDocument;
225
- label(content?: DotContent, attrs?: IDotLabel): IDotDocument;
226
- label(attrs: IDotLabel, content?: DotContent): IDotDocument;
227
-
228
- legend(content?: DotContent, attrs?: IDotGlobalAttrs): IDotDocument;
229
- legend(attrs: IDotGlobalAttrs, content?: DotContent): IDotDocument;
230
-
231
- li(content?: DotContent, attrs?: IDotLi): IDotDocument;
232
- li(attrs: IDotLi, content?: DotContent): IDotDocument;
233
-
234
- main(content?: DotContent, attrs?: IDotGlobalAttrs): IDotDocument;
235
- main(attrs: IDotGlobalAttrs, content?: DotContent): IDotDocument;
236
-
237
- map(content?: DotContent, attrs?: IDotMap): IDotDocument;
238
- map(attrs: IDotMap, content?: DotContent): IDotDocument;
239
-
240
- mark(content?: DotContent, attrs?: IDotGlobalAttrs): IDotDocument;
241
- mark(attrs: IDotGlobalAttrs, content?: DotContent): IDotDocument;
242
-
243
- menu(content?: DotContent, attrs?: IDotMenu): IDotDocument;
244
- menu(attrs: IDotMenu, content?: DotContent): IDotDocument;
245
- meter(content?: DotContent, attrs?: IDotMeter): IDotDocument;
246
- meter(attrs: IDotMeter, content?: DotContent): IDotDocument;
247
-
248
- nav(content?: DotContent, attrs?: IDotGlobalAttrs): IDotDocument;
249
- nav(attrs: IDotGlobalAttrs, content?: DotContent): IDotDocument;
250
-
251
- object(content?: DotContent, attrs?: IDotObject): IDotDocument;
252
- object(attrs: IDotObject, content?: DotContent): IDotDocument;
253
- ol(content?: DotContent, attrs?: IDotOl): IDotDocument;
254
- ol(attrs: IDotOl, content?: DotContent): IDotDocument;
255
- optGroup(content?: DotContent, attrs?: IDotOptGroup): IDotDocument;
256
- optGroup(attrs: IDotOptGroup, content?: DotContent): IDotDocument;
257
- option(content?: DotContent, attrs?: IDotOption): IDotDocument;
258
- option(attrs: IDotOption, content?: DotContent): IDotDocument;
259
- output(content?: DotContent, attrs?: IDotOutput): IDotDocument;
260
- output(attrs: IDotOutput, content?: DotContent): IDotDocument;
261
-
262
- p(content?: DotContent, attrs?: IDotGlobalAttrs): IDotDocument;
263
- p(attrs: IDotGlobalAttrs, content?: DotContent): IDotDocument;
264
-
265
- param(content?: DotContent, attrs?: IDotParam): IDotDocument;
266
- param(attrs: IDotParam, content?: DotContent): IDotDocument;
267
-
268
- pre(content?: DotContent, attrs?: IDotGlobalAttrs): IDotDocument;
269
- pre(attrs: IDotGlobalAttrs, content?: DotContent): IDotDocument;
270
-
271
- progress(content?: DotContent, attrs?: IDotProgress): IDotDocument;
272
- progress(attrs: IDotProgress, content?: DotContent): IDotDocument;
273
- q(content?: DotContent, attrs?: IDotQ): IDotDocument;
274
- q(attrs: IDotQ, content?: DotContent): IDotDocument;
275
-
276
- rp(content?: DotContent, attrs?: IDotGlobalAttrs): IDotDocument;
277
- rp(attrs: IDotGlobalAttrs, content?: DotContent): IDotDocument;
278
- rt(content?: DotContent, attrs?: IDotGlobalAttrs): IDotDocument;
279
- rt(attrs: IDotGlobalAttrs, content?: DotContent): IDotDocument;
280
- ruby(content?: DotContent, attrs?: IDotGlobalAttrs): IDotDocument;
281
- ruby(attrs: IDotGlobalAttrs, content?: DotContent): IDotDocument;
282
- s(content?: DotContent, attrs?: IDotGlobalAttrs): IDotDocument;
283
- s(attrs: IDotGlobalAttrs, content?: DotContent): IDotDocument;
284
- samp(content?: DotContent, attrs?: IDotGlobalAttrs): IDotDocument;
285
- samp(attrs: IDotGlobalAttrs, content?: DotContent): IDotDocument;
286
- section(content?: DotContent, attrs?: IDotGlobalAttrs): IDotDocument;
287
- section(attrs: IDotGlobalAttrs, content?: DotContent): IDotDocument;
288
-
289
- select(content?: DotContent, attrs?: IDotSelect): IDotDocument;
290
- select(attrs: IDotSelect, content?: DotContent): IDotDocument;
291
-
292
- small(content?: DotContent, attrs?: IDotGlobalAttrs): IDotDocument;
293
- small(attrs: IDotGlobalAttrs, content?: DotContent): IDotDocument;
294
-
295
- source(content?: DotContent, attrs?: IDotSource): IDotDocument;
296
- source(attrs: IDotSource, content?: DotContent): IDotDocument;
297
-
298
- span(content?: DotContent, attrs?: IDotGlobalAttrs): IDotDocument;
299
- span(attrs: IDotGlobalAttrs, content?: DotContent): IDotDocument;
300
- strong(content?: DotContent, attrs?: IDotGlobalAttrs): IDotDocument;
301
- strong(attrs: IDotGlobalAttrs, content?: DotContent): IDotDocument;
302
- svg(content?: DotContent, attrs?: IDotGlobalAttrs): IDotDocument;
303
- svg(attrs: IDotGlobalAttrs, content?: DotContent): IDotDocument;
304
- sub(content?: DotContent, attrs?: IDotGlobalAttrs): IDotDocument;
305
- sub(attrs: IDotGlobalAttrs, content?: DotContent): IDotDocument;
306
- summary(content?: DotContent, attrs?: IDotGlobalAttrs): IDotDocument;
307
- summary(attrs: IDotGlobalAttrs, content?: DotContent): IDotDocument;
308
- sup(content?: DotContent, attrs?: IDotGlobalAttrs): IDotDocument;
309
- sup(attrs: IDotGlobalAttrs, content?: DotContent): IDotDocument;
310
-
311
- table(content?: DotContent, attrs?: IDotTable): IDotDocument;
312
- table(attrs: IDotTable, content?: DotContent): IDotDocument;
313
- tBody(content?: DotContent, attrs?: IDotTBody): IDotDocument;
314
- tBody(attrs: IDotTBody, content?: DotContent): IDotDocument;
315
- td(content?: DotContent, attrs?: IDotTd): IDotDocument;
316
- td(attrs: IDotTd, content?: DotContent): IDotDocument;
317
- textArea(content?: DotContent, attrs?: IDotTextArea): IDotDocument;
318
- textArea(attrs: IDotTextArea, content?: DotContent): IDotDocument;
319
- tFoot(content?: DotContent, attrs?: IDotTFoot): IDotDocument;
320
- tFoot(attrs: IDotTFoot, content?: DotContent): IDotDocument;
321
- th(content?: DotContent, attrs?: IDotTh): IDotDocument;
322
- th(attrs: IDotTh, content?: DotContent): IDotDocument;
323
- tHead(content?: DotContent, attrs?: IDotTHead): IDotDocument;
324
- tHead(attrs: IDotTHead, content?: DotContent): IDotDocument;
325
- time(content?: DotContent, attrs?: IDotTime): IDotDocument;
326
- time(attrs: IDotTime, content?: DotContent): IDotDocument;
327
- tr(content?: DotContent, attrs?: IDotTr): IDotDocument;
328
- tr(attrs: IDotTr, content?: DotContent): IDotDocument;
329
- track(content?: DotContent, attrs?: IDotTrack): IDotDocument;
330
- track(attrs: IDotTrack, content?: DotContent): IDotDocument;
331
-
332
- u(content?: DotContent, attrs?: IDotGlobalAttrs): IDotDocument;
333
- u(attrs: IDotGlobalAttrs, content?: DotContent): IDotDocument;
334
- ul(content?: DotContent, attrs?: IDotGlobalAttrs): IDotDocument;
335
- ul(attrs: IDotGlobalAttrs, content?: DotContent): IDotDocument;
336
- var(content?: DotContent, attrs?: IDotGlobalAttrs): IDotDocument;
337
- var(attrs: IDotGlobalAttrs, content?: DotContent): IDotDocument;
338
-
339
- video(content?: DotContent, attrs?: IDotVideo): IDotDocument;
340
- video(attrs: IDotVideo, content?: DotContent): IDotDocument;
341
-
342
- wbr(content?: DotContent, attrs?: IDotGlobalAttrs): IDotDocument;
343
- wbr(attrs: IDotGlobalAttrs, content?: DotContent): IDotDocument;
344
- }
345
-
346
- type Styles = string | IDotcssProp;
347
- // interface IComponentFactory {
348
- // <TProps extends string[], TEvents extends string[], T extends IComponent<TProps, TEvents>>(
349
- // Base: new () => T, styles?: Styles | Styles[]
350
- // ): new (attrs?: ComponentArgs<TProps, TEvents>) => T & { new (attrs?: ComponentArgs<TProps, TEvents>): IComponent<TProps, TEvents> };
351
- // }
352
-
353
- // interface IComponentFactory {
354
- // <TProps extends string[], TEvents extends string[], T extends IComponent<TProps, TEvents>>(
355
- // Base: new () => T, styles?: Styles | Styles[]
356
- // ): new (attrs?: ComponentArgs<TProps, TEvents>) => T & IComponent<TProps, TEvents>;
357
- // }
358
-
359
- // useStyles<T extends IComponent>(styles: Styles | Styles[]): (Base: new () => T) => new () => T;
360
- // hasEvents<T extends IComponent>(styles: Styles | Styles[]): (Base: new () => T) => new () => T;
361
- // prop(target: any, propertyKey: string): void;
362
-
363
- export type ComponentArgs<TProps extends Array<string> = [], TEvents extends Array<string> = []> = {
364
- [key in TProps[number]]?: any;
365
- } & Partial<{
366
- [key in TEvents[number]]?: (...args: any[]) => void;
367
- }>;
368
-
369
- /**
370
- * Interface for the dot object.
371
- */
372
- export interface IDotCore extends IDotDocument {
373
- (targetSelector: string | Element | Node | NodeList | Array<Node | Element>, targetWindow?: Window): IDotDocument;
374
-
375
- version: string;
376
- styleMode: "sync" | "async";
377
-
378
- navigate(path: string, noHistory?: boolean, force?: boolean): void;
379
- css: IDotCss;
380
- bus: IEventBus;
381
- window: IDotWindowBuilder;
382
-
383
- watch<Ti = IReactive | Array<any> | { [key: string | number]: any } | string | number | boolean>(initValue?: Ti, key?: (Ti extends Array<any> | { [key: string | number]: any } ? string : never)): IWatcher<Ti>;
384
- ref(): IRef;
385
-
386
- // Keep these around for a bit to show how it was done before in case I need to change anything prior to the v6 launch.
387
- // component<T extends IComponent>(Base: new (...args: Parameters<T['build']>) => T): new (...args: Parameters<T['build']>) => T;
388
- // useStyles<T extends IComponent>(styles: string|((css: IDotCss)=>IDotcssProp|string)): ((Base: new (...args: Parameters<T['build']>) => T) => new (...args: Parameters<T['build']>) => T);
389
-
390
- // component: IComponentFactory;
391
- // Works but doesn't infer types from the component.
392
- // There's room for improvement here but it's not clear to me how to do it.
393
- // What I'd like to do is have the types tied to the IComponent interface rather than the component factory function.
394
- component<TProps extends string[] = [], TEvents extends string[] = []>(Base: new () => IDotComponent, styles?: string|IDotcssProp|Array<string|IDotcssProp>)
395
- : new (attrs?: ComponentArgs<TProps, TEvents>) => IDotComponent & { new (attrs?: ComponentArgs<TProps, TEvents>): IDotComponent };
396
-
397
- useStyles(document: Document, styles: Styles): HTMLStyleElement;
398
- }
399
-
400
- export interface IDotWindowWrapper{
401
- open(): void;
402
- close(): void;
403
- window: Window;
404
- document: Document;
405
- title: string;
406
- width: number;
407
- height: number;
408
- }
409
-
410
- export interface IDotWindowBuilder {
411
- (options: {content: IDotComponent|IDotDocument, width?: number, height?: number, title?: string}): IDotWindowWrapper;
412
- }
413
-
414
- export interface IDotConditionalDocument extends IDotDocument {
415
- /**
416
- * A conditional catch, analogous to else if. Can be used after a when function. Evaluates if the previous when's condition was false.
417
- * Renders the specified DOT if a condition is met. Dynamic binding is possible when condition and callback are functions.
418
- */
419
- otherwiseWhen(condition: IReactive | boolean, callback: DotContent): IDotConditionalDocument;
420
- /**
421
- * A conditional final catch, analogous to else. Can be used after a when or otherwiseWhen function. Evaluates if the previous when/otherwiseWhen evaluated to false.
422
- * Renders the specified DOT if a condition is met. Dynamic binding is possible when callback is a function.
423
- */
424
- otherwise(callback: DotContent): IDotDocument;
425
- }
426
-
427
- // Attribute interface (for all elements):
428
- export interface IDotGlobalAttrs<T extends HTMLElement = HTMLElement> {
429
- /**
430
- * Create a custom attribute.
431
- */
432
- // attr(name: string, value: unknown, arg3?: unknown): T;
433
- custom?: Record<string, AttrVal<unknown>>
434
- /**
435
- * Adds a data-<suffix> attribute to the current element which can contain custom data.
436
- */
437
- customData?: Record<string, AttrVal<unknown>>;
438
- /**
439
- * Create a named reference to the current element so that it can be accessed within the current component.
440
- */
441
- // TODO: this needs to be redone now.
442
- // The better way might be using the new reactive system instead of references.
443
- // For now I'll leave it like this:
444
- ref?: IRef<T>;
445
-
446
- /** @deprecated Deprecated in HTML5. Use CSS. */
447
- bgColor?: AttrVal<unknown>;
448
- /** @deprecated Deprecated in HTML5. Use CSS. */
449
- color?: AttrVal<unknown>;
450
- /** @deprecated Deprecated in HTML5. Use CSS. */
451
- aLink?: AttrVal<unknown>;
452
- /** @deprecated Deprecated in HTML5. */
453
- archive?: AttrVal<unknown>;
454
-
455
- // TODO: we're still missing some additional global attributes. See https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/
456
- areaHidden?: AttrVal<boolean>;
457
- areaLabel?: AttrVal<string>;
458
- areaDescribedBy?: AttrVal<string>;
459
- areaControls?: AttrVal<string>;
460
- areaExpanded?: AttrVal<boolean>;
461
- areaChecked?: AttrVal<string>;
462
- areaSelected?: AttrVal<boolean>;
463
- accessKey?: AttrVal<string>; // This could potentially be enumerated. But care should be taken as these types are already quite complex.
464
- class?: AttrVal<string> | Array<AttrVal<string>> | AttrVal<Array<string>> | Record<string, AttrVal<boolean>>; // Space-separated. TODO: need tests.
465
- contentEditable?: AttrVal<"true"> | AttrVal<"false"> | AttrVal<"plaintext-only">;
466
- contextMenu?: AttrVal<string>;
467
- dir?: AttrVal<string>;
468
- draggable?: AttrVal<"true"> | AttrVal<"false">;
469
- dropZone?: AttrVal<"move"> | AttrVal<"copy"> | AttrVal<"link">;
470
- exportParts?: AttrVal<string>;
471
- hidden?: AttrVal<boolean>;
472
- id?: string;
473
- inert?: AttrVal<boolean>;
474
- inputMode?: AttrVal<string>;
475
- is?: AttrVal<string>;
476
- itemId?: AttrVal<string>;
477
- itemProp?: AttrVal<string>;
478
- itemRef?: AttrVal<string>;
479
- itemScope?: AttrVal<string>;
480
- itemType?: AttrVal<string>;
481
- lang?: AttrVal<string>;
482
- nOnce?: AttrVal<string>;
483
- part?: AttrVal<string>;
484
- role?: AttrVal<string>;
485
- spellCheck?: AttrVal<"true"> | AttrVal<"false">;
486
- style?: string | IDotcssProp;
487
- tabIndex?: AttrVal<number>;
488
- title?: AttrVal<string>;
489
- translate?: AttrVal<string>;
490
- virtualKeyboardPolicy?: AttrVal<"auto"> | AttrVal<"manual">;
491
-
492
- // Events
493
-
494
- onContextMenu?: (e: MouseEvent) => void; // global
495
- onCopy?: (e: ClipboardEvent) => void; // global
496
- onCut?: (e: ClipboardEvent) => void; // global
497
- onPagePaste?: (e: ClipboardEvent) => void; // global
498
-
499
- onDrag?: (e: DragEvent) => void; // global
500
- onDragEnd?: (e: DragEvent) => void; // global
501
- onDragStart?: (e: DragEvent) => void; // global
502
- onDragEnter?: (e: DragEvent) => void; // global
503
- onDragOver?: (e: DragEvent) => void; // global
504
- onDragLeave?: (e: DragEvent) => void; // global
505
- onDrop?: (e: DragEvent) => void; // global
506
- onError?: (e: Event) => void; // loading elements.
507
- onInvalid?: (e: Event) => void; // global
508
- onMouseWheel?: (e: WheelEvent) => void; // global
509
- onWheel?: (e: WheelEvent) => void; // global
510
-
511
- // Configured.
512
- onBlur?: (e: FocusEvent) => void;
513
- onChange?: (e: Event) => void;
514
- onClick?: (e: MouseEvent) => void;
515
- onDblClick?: (e: MouseEvent) => void;
516
- onFocus?: (e: FocusEvent) => void;
517
- onInput?: (e: InputEvent) => void;
518
- onKeyDown?: (e: KeyboardEvent) => void;
519
- onKeyPress?: (e: KeyboardEvent) => void;
520
- onKeyUp?: (e: KeyboardEvent) => void;
521
- onLoad?: (e: Event) => void; // On specific resources only.
522
- onMouseDown?: (e: MouseEvent) => void;
523
- onMouseEnter?: (e: MouseEvent) => void;
524
- onMouseLeave?: (e: MouseEvent) => void;
525
- onMouseMove?: (e: MouseEvent) => void;
526
- onMouseOut?: (e: MouseEvent) => void;
527
- onMouseOver?: (e: MouseEvent) => void;
528
- onMouseUp?: (e: MouseEvent) => void;
529
- onPointerCancel?: (e: PointerEvent) => void;
530
- onPointerDown?: (e: PointerEvent) => void;
531
- onPointerEnter?: (e: PointerEvent) => void;
532
- onPointerLeave?: (e: PointerEvent) => void;
533
- onPointerMove?: (e: PointerEvent) => void;
534
- onPointerOut?: (e: PointerEvent) => void;
535
- onPointerOver?: (e: PointerEvent) => void;
536
- onPointerUp?: (e: PointerEvent) => void;
537
-
538
- onTouchMove?: (e: TouchEvent) => void;
539
- onTouchCancel?: (e: TouchEvent) => void;
540
- onTouchEnd?: (e: TouchEvent) => void;
541
- onTouchStart?: (e: TouchEvent) => void;
542
-
543
- onReset?: (e: Event) => void;
544
- onScroll?: (e: UIEvent) => void;
545
- onSelect?: (e: Event) => void;
546
- onSubmit?: (e: Event) => void;
547
- onUnload?: (e: Event) => void;
548
- }
549
-
550
- // Interface for specific elements:
551
-
552
- // interface IMountedComponent<T extends IComponent> {
553
- // on(event: string, callback: (...args: Array<any>) => void): IMountedComponent<T>;
554
- // prop(name: string, value: any): IMountedComponent<T>;
555
- // }
556
-
557
- interface IDotA extends IDotGlobalAttrs<HTMLAnchorElement> {
558
- download?: AttrVal<boolean>;
559
- hRef?: AttrVal<string>;
560
- hRefLang?: AttrVal<string>;
561
- charset?: AttrVal<string>;
562
- coords?: AttrVal<string>;
563
- shape?: AttrVal<string>;
564
- media?: AttrVal<string>;
565
- ping?: AttrVal<string> | Array<AttrVal<string>> | AttrVal<Array<string>> | Record<string, AttrVal<string>>; // Space-separated. TODO: need tests.
566
- rel?: AttrVal<string>;
567
- /** @deprecated Deprecated in HTML5. */
568
- rev?: AttrVal<unknown>;
569
- name?: AttrVal<string>;
570
- target?: AttrVal<"_blank"> | AttrVal<"_parent"> | AttrVal<"_self"> | AttrVal<"_top">;
571
- type?: AttrVal<string>;
572
- }
573
- interface IDotArea extends IDotGlobalAttrs<HTMLAreaElement> {
574
- alt?: AttrVal<string>;
575
- coords?: AttrVal<string>;
576
- download?: AttrVal<string>;
577
- hRef?: AttrVal<string>;
578
- hRefLang?: AttrVal<string>;
579
- media?: AttrVal<string>;
580
- noHRef?: AttrVal<string>; // Deprecated in HTML5.
581
- rel?: AttrVal<string>;
582
- shape?: AttrVal<string>;
583
- target?: AttrVal<string>;
584
- }
585
- interface IDotAudio extends IDotGlobalAttrs<HTMLAudioElement> {
586
- autoPlay?: AttrVal<boolean>;
587
- // buffered?: unknown; // Not used?
588
- controls?: AttrVal<boolean>;
589
- loop?: AttrVal<boolean>;
590
- muted?: AttrVal<boolean>;
591
- preload?: AttrVal<"auto"> | AttrVal<"metadata"> | AttrVal<"none">;
592
- src?: AttrVal<string>;
593
- crossOrigin?: AttrVal<"anonymous"> | AttrVal<"use-credentials">;
594
-
595
- // Special functions:
596
- // TODO: these need to be removed from here.
597
- // pause(): IDotAudio;
598
- // play(): IDotAudio;
599
- // stop(): IDotAudio;
600
-
601
- // Events:
602
- onAbort?: (e: Event) => void;
603
- onCantPlayThrough?: (e: Event) => void;
604
- onDurationChange?: (e: Event) => void;
605
- onEmptied?: (e: Event) => void;
606
- onEnded?: (e: Event) => void;
607
- onLoadedData?: (e: Event) => void;
608
- onLoadStart?: (e: Event) => void;
609
- onLoadedMetadata?: (e: Event) => void;
610
- onPause?: (e: Event) => void;
611
- onPlay?: (e: Event) => void;
612
- onPlaying?: (e: Event) => void;
613
- onProgress?: (e: Event) => void;
614
- onRateChange?: (e: Event) => void;
615
- onSeeked?: (e: Event) => void;
616
- onSeeking?: (e: Event) => void;
617
- onStalled?: (e: Event) => void;
618
- onSuspend?: (e: Event) => void;
619
- onTimeUpdate?: (e: Event) => void;
620
- onVolumeChange?: (e: Event) => void;
621
- onWaiting?: (e: Event) => void;
622
- onCanPlay?: (e: Event) => void;
623
- }
624
- interface IDotBlockQuote extends IDotGlobalAttrs<HTMLQuoteElement> {
625
- quoteCite?: AttrVal<string>; // alias for cite
626
- }
627
-
628
- interface IDotBody extends IDotGlobalAttrs<HTMLBodyElement> {
629
- align?: unknown; // Deprecated in HTML5. Use CSS.
630
- background?: unknown; // Deprecated in HTML5. Use CSS.
631
-
632
- // Events
633
- onHashChange?: (e: HashChangeEvent) => void;
634
- onOffline?: (e: Event) => void;
635
- onOnline?: (e: Event) => void;
636
- onPageHide?: (e: PageTransitionEvent) => void;
637
- onPageShow?: (e: PageTransitionEvent) => void;
638
- onPopState?: (e: PopStateEvent) => void;
639
- onResize?: (e: UIEvent) => void;
640
- onStorage?: (e: StorageEvent) => void;
641
- }
642
-
643
- interface IDotBr extends IDotGlobalAttrs<HTMLBRElement> {
644
- /** @deprecated Deprecated in HTML5. Use CSS. */
645
- clear?: unknown;
646
- }
647
- interface IDotButton extends IDotGlobalAttrs<HTMLButtonElement> {
648
- autoFocus?: AttrVal<boolean>;
649
- formAction?: AttrVal<string>;
650
- disabled?: AttrVal<boolean>;
651
- name?: AttrVal<string>;
652
- type?: AttrVal<"button"> | AttrVal<"submit"> | AttrVal<"reset">;
653
- whichForm?: AttrVal<string>; // alias for form
654
- value?: AttrVal<string>;
655
- }
656
- interface IDotCanvas extends IDotGlobalAttrs<HTMLCanvasElement> {
657
- height?: AttrVal<number>;
658
- width?: AttrVal<number>;
659
- }
660
-
661
- interface IDotCol extends IDotGlobalAttrs<HTMLTableColElement> {
662
- /** @deprecated Deprecated in HTML5. Use CSS. */
663
- charOff?: AttrVal<unknown>;
664
- colSpan?: AttrVal<number>; // alias for span
665
- vAlign?: AttrVal<number>;
666
- }
667
-
668
- interface IDotColGroup extends IDotGlobalAttrs<HTMLTableColElement> {
669
- /** @deprecated Deprecated in HTML5. Use CSS. */
670
- charOff?: AttrVal<unknown>;
671
- colSpan?: AttrVal<number>; // alias for span
672
- /** @deprecated Deprecated in HTML5. Use CSS. */
673
- vAlign?: AttrVal<unknown>;
674
- }
675
-
676
- interface IDotDel extends IDotGlobalAttrs {
677
- dateTime?: AttrVal<string>; // Would be cool if this could accept dates and just format them internally...
678
- quoteCite?: AttrVal<string>; // alias for cite
679
- }
680
-
681
- interface IDotDetails extends IDotGlobalAttrs<HTMLDetailsElement> {
682
- open?: AttrVal<boolean>;
683
- // Events:
684
- onToggle?: (e: Event) => void;
685
- }
686
- interface IDotEmbed extends IDotGlobalAttrs<HTMLEmbedElement> {
687
- height?: AttrVal<number>;
688
- src?: AttrVal<string>;
689
- type?: AttrVal<string>;
690
- width?: AttrVal<number>;
691
- }
692
- interface IDotFieldSet extends IDotGlobalAttrs<HTMLFieldSetElement> {
693
- disabled?: AttrVal<boolean>;
694
- name?: AttrVal<string>;
695
- whichForm?: AttrVal<string>; // alias for form
696
- }
697
- interface IDotForm extends IDotGlobalAttrs<HTMLFormElement> {
698
- acceptCharset?: AttrVal<string>; // accept-charset, apparently the only hyphenated attribute (aside from data-*)...
699
- action?: AttrVal<string>;
700
- autoComplete?: AttrVal<"on"> | AttrVal<"off">;
701
- encType?: AttrVal<"application/x-www-form-urlencoded"> | AttrVal<"multipart/form-data"> | AttrVal<"text/plain">;
702
- method?: AttrVal<"get"> | AttrVal<"post">;
703
- name?: AttrVal<string>;
704
- noValidate?: AttrVal<boolean>;
705
- target?: AttrVal<"_self"> | AttrVal<"_blank"> | AttrVal<"_parent"> | AttrVal<"_top">;
706
- // rel?: PrimativeOrObservable<string> IDotForm; // Not used with forms?
707
- }
708
- interface IDotHr extends IDotGlobalAttrs<HTMLHRElement> {
709
- noShade?: AttrVal<unknown>;
710
- }
711
- interface IDotIFrame extends IDotGlobalAttrs<HTMLIFrameElement> {
712
- allow?: AttrVal<string>;
713
- allowFullScreen?: AttrVal<boolean>;
714
- /** @deprecated Deprecated in HTML5. */
715
- frameBorder?: AttrVal<0> | AttrVal<1>;
716
- height?: AttrVal<number>;
717
- /** @deprecated Deprecated in HTML5. */
718
- longDesc?: AttrVal<string>;
719
- marginHeight?: AttrVal<number>;
720
- marginWidth?: AttrVal<number>;
721
- name?: AttrVal<string>;
722
- referrerPolicy?: AttrVal<string>;
723
- sandbox?: AttrVal<string>;
724
- /** @deprecated Deprecated in HTML5. */
725
- scrolling?: AttrVal<string>;
726
- seamless?: AttrVal<boolean>;
727
- src?: AttrVal<string>;
728
- srcDoc?: AttrVal<string>;
729
- width?: AttrVal<number>;
730
- }
731
- interface IDotImg extends IDotGlobalAttrs<HTMLImageElement> {
732
- alt?: AttrVal<string>;
733
- crossOrigin?: AttrVal<"anonymous"> | AttrVal<"use-credentials">;
734
- decoding?: AttrVal<"async"> | AttrVal<"auto"> | AttrVal<"sync">;
735
- height?: AttrVal<number>;
736
- /** @deprecated Deprecated in HTML5. Use CSS. */
737
- hSpace?: AttrVal<unknown>;
738
- isMap?: AttrVal<boolean>;
739
- /** @deprecated Deprecated in HTML5. Use CSS. */
740
- loading?: AttrVal<"eager"> | AttrVal<"lazy">;
741
- longDesc?: AttrVal<string>;
742
- referrerPolicy?: AttrVal<string>;
743
- sizes?: AttrVal<string>;
744
- src?: AttrVal<string>;
745
- srcSet?: AttrVal<string>; // Comma separated. Consider accepting an array.
746
- useMap?: AttrVal<number>;
747
- width?: AttrVal<number>;
748
- }
749
- interface IDotInput extends IDotGlobalAttrs<HTMLInputElement> {
750
- accept?: AttrVal<string>;
751
- alt?: AttrVal<string>;
752
- autoCapitalize?: AttrVal<"none"> | AttrVal<"sentences"> | AttrVal<"words"> | AttrVal<"characters">;
753
- autoComplete?: AttrVal<"on"> | AttrVal<"off">;
754
- autoFocus?: AttrVal<boolean>;
755
- checked?: AttrVal<boolean>;
756
- enterKeyHint?: AttrVal<"enter"> | AttrVal<"done"> | AttrVal<"go"> | AttrVal<"next"> | AttrVal<"preveous"> | AttrVal<"search"> | AttrVal<"send">;
757
- dirName?: AttrVal<string>;
758
- disabled?: AttrVal<boolean>;
759
- formAction?: AttrVal<string>;
760
- height?: AttrVal<number>;
761
- list?: AttrVal<string>;
762
- max?: AttrVal<number>;
763
- maxLength?: AttrVal<number>;
764
- min?: AttrVal<number>;
765
- multiple?: AttrVal<boolean>;
766
- name?: AttrVal<string>;
767
- pattern?: AttrVal<string>;
768
- placeholder?: AttrVal<string>;
769
- readOnly?: AttrVal<boolean>;
770
- required?: AttrVal<boolean>;
771
- size?: AttrVal<number>;
772
- src?: AttrVal<string>;
773
- step?: AttrVal<string> | AttrVal<number>;
774
- type?: "button" | "checkbox" | "color" | "date" | "datetime-local" | "email" | "file" | "hidden" | "image" | "month" | "number" | "password" | "radio" | "range" | "reset" | "search" | "submit" | "tel" | "text" | "time" | "url" | "week";
775
- value?: AttrVal<string>;
776
- whichForm?: AttrVal<string>; // form
777
- width?: AttrVal<number>;
778
-
779
- // Special functions:
780
- // getVal(): string
781
- // setVal(value: unknown): IDotInput;
782
-
783
- // Input-specific events:
784
- onSearch?: (e: Event) => void;
785
- }
786
-
787
- interface IDotIns extends IDotGlobalAttrs {
788
- dateTime?: AttrVal<string>;
789
- quoteCite?: AttrVal<string>; // Alias for cite.
790
- }
791
-
792
- interface IDotKeyGen extends IDotGlobalAttrs {
793
- challenge?: AttrVal<string>;
794
- keyType?: AttrVal<string>;
795
- }
796
-
797
- interface IDotLabel extends IDotGlobalAttrs<HTMLLabelElement> {
798
- for?: AttrVal<string>;
799
- }
800
-
801
- interface IDotLi extends IDotGlobalAttrs<HTMLLIElement> {
802
- value?: AttrVal<number>;
803
- }
804
-
805
- interface IDotMap extends IDotGlobalAttrs<HTMLMapElement> {
806
- name?: AttrVal<string>;
807
- }
808
-
809
- interface IDotMenu extends IDotGlobalAttrs<HTMLMenuElement> {
810
- type?: AttrVal<string>;
811
- }
812
-
813
- interface IDotMeter extends IDotGlobalAttrs<HTMLMeterElement> {
814
- high?: AttrVal<number>;
815
- low?: AttrVal<number>;
816
- max?: AttrVal<number>;
817
- min?: AttrVal<number>;
818
- optimum?: AttrVal<number>;
819
- value?: AttrVal<number>;
820
- }
821
-
822
- interface IDotObject extends IDotGlobalAttrs<HTMLObjectElement> {
823
- archive?: AttrVal<string>;
824
- classId?: AttrVal<string>;
825
- codeBase?: AttrVal<string>;
826
- codeType?: AttrVal<string>;
827
- objectData?: AttrVal<string>; // Alias for data.
828
- declare?: AttrVal<boolean>;
829
- height?: AttrVal<number>;
830
- name?: AttrVal<string>;
831
- standby?: AttrVal<string>;
832
- type?: AttrVal<string>;
833
- useMap?: AttrVal<string>;
834
- width?: AttrVal<number>;
835
- }
836
-
837
- interface IDotOl extends IDotGlobalAttrs<HTMLUListElement> {
838
- /** @deprecated Deprecated in HTML5. */
839
- reversed?: AttrVal<boolean>;
840
- start?: AttrVal<number>;
841
- }
842
-
843
- interface IDotOptGroup extends IDotGlobalAttrs<HTMLUListElement> {
844
- disabled?: AttrVal<boolean>;
845
- }
846
-
847
- interface IDotOption extends IDotGlobalAttrs<HTMLUListElement> {
848
- disabled?: AttrVal<boolean>;
849
- optionLabel?: AttrVal<string>; // Alias for label
850
- selected?: AttrVal<boolean>;
851
- value?: AttrVal<string>;
852
- }
853
-
854
- interface IDotOutput extends IDotGlobalAttrs<HTMLOutputElement> {
855
- for?: AttrVal<string>;
856
- name?: AttrVal<string>;
857
- whichForm?: AttrVal<string>; // Alias for form
858
- }
859
-
860
- interface IDotParam extends IDotGlobalAttrs<HTMLParamElement> {
861
- name?: AttrVal<string>;
862
- value?: AttrVal<string>;
863
- /** @deprecated Deprecated in HTML5. */
864
- valueType?: AttrVal<unknown>;
865
- }
866
-
867
- interface IDotProgress extends IDotGlobalAttrs<HTMLProgressElement> {
868
- max?: AttrVal<number>;
869
- value?: AttrVal<number>;
870
- }
871
-
872
- interface IDotQ extends IDotGlobalAttrs<HTMLQuoteElement> {
873
- quoteCite?: AttrVal<string>; // alias for cite
874
- }
875
-
876
- interface IDotSelect extends IDotGlobalAttrs<HTMLSelectElement> {
877
- autoFocus?: AttrVal<boolean>;
878
- disabled?: AttrVal<boolean>;
879
- multiple?: AttrVal<boolean>;
880
- name?: AttrVal<string>;
881
- required?: AttrVal<boolean>;
882
- size?: AttrVal<number>;
883
- whichForm?: AttrVal<string>; // alias for form
884
- value?: AttrVal<string>; // Pseudo attribute for convenience.
885
- }
886
-
887
- interface IDotSource extends IDotGlobalAttrs<HTMLSourceElement> {
888
- media?: AttrVal<string>;
889
- src?: AttrVal<string>;
890
- type?: AttrVal<string>;
891
- sizes?: AttrVal<string>;
892
- srcSet?: AttrVal<string>;
893
- }
894
- interface IDotTable extends IDotGlobalAttrs<HTMLTableElement> {
895
- /** @deprecated Deprecated in HTML5. Use CSS. */
896
- border?: AttrVal<string> | AttrVal<number>;
897
- /** @deprecated Deprecated in HTML5. Use CSS. */
898
- cellPadding?: AttrVal<string> | AttrVal<number>;
899
- /** @deprecated Deprecated in HTML5. Use CSS. */
900
- cellSpacing?: AttrVal<string> | AttrVal<number>;
901
- /** @deprecated Deprecated in HTML5. Use CSS. */
902
- frame?: AttrVal<string> | AttrVal<number>;
903
- /** @deprecated Deprecated in HTML5. */
904
- height?: AttrVal<number>;
905
- /** @deprecated Deprecated in HTML5. Use CSS. */
906
- rules?: AttrVal<string>;
907
- /** @deprecated Deprecated in HTML5. */
908
- tableSummary?: AttrVal<string>;
909
- /** @deprecated Deprecated in HTML5. */
910
- width?: AttrVal<number>;
911
- }
912
-
913
- interface IDotTextArea extends IDotGlobalAttrs<HTMLTextAreaElement> {
914
- autoCapitalize?: AttrVal<"none"> | AttrVal<"sentences"> | AttrVal<"words"> | AttrVal<"characters">;
915
- autoFocus?: AttrVal<boolean>;
916
- cols?: AttrVal<number>;
917
- dirName?: AttrVal<string>;
918
- disabled?: AttrVal<boolean>;
919
- enterKeyHint?: AttrVal<"enter"> | AttrVal<"done"> | AttrVal<"go"> | AttrVal<"next"> | AttrVal<"preveous"> | AttrVal<"search"> | AttrVal<"send">;
920
- maxLength?: AttrVal<number>;
921
- name?: AttrVal<string>;
922
- placeholder?: AttrVal<string>;
923
- readOnly?: AttrVal<boolean>;
924
- required?: AttrVal<boolean>;
925
- rows?: AttrVal<number>;
926
- whichForm?: AttrVal<string>; // alias for form
927
- wrap?: AttrVal<string>;
928
- value?: AttrVal<string>; // Pseudo attribute for convenience.
929
- }
930
-
931
- interface IDotTBody extends IDotGlobalAttrs<HTMLTableSectionElement> {
932
- /** @deprecated Deprecated in HTML5. Use CSS. */
933
- charOff?: AttrVal<unknown>;
934
- /** @deprecated Deprecated in HTML5. Use CSS. */
935
- vAlign?: AttrVal<unknown>;
936
- }
937
-
938
- interface IDotTd extends IDotGlobalAttrs<HTMLTableCellElement> {
939
-
940
- /** @deprecated Deprecated in HTML5. Use CSS. */
941
- axis?: AttrVal<string>;
942
- /** @deprecated Deprecated in HTML5. Use CSS. */
943
- char?: AttrVal<string>;
944
- colSpan?: AttrVal<number>;
945
- /** @deprecated Deprecated in HTML5. Use CSS. */
946
- charOff?: AttrVal<string>;
947
- headers?: AttrVal<string>;
948
- /** @deprecated Deprecated in HTML5. Use CSS. */
949
- noWrap?: AttrVal<boolean>;
950
- rowSpan?: AttrVal<number>;
951
- scope?: AttrVal<string>;
952
- /** @deprecated Deprecated in HTML5. Use CSS. */
953
- vAlign?: AttrVal<string>;
954
- }
955
-
956
- interface IDotTFoot extends IDotGlobalAttrs<HTMLTableSectionElement> {
957
- /** @deprecated Deprecated in HTML5. Use CSS. */
958
- charOff?: AttrVal<number>;
959
- /** @deprecated Deprecated in HTML5. Use CSS. */
960
- vAlign?: AttrVal<string>;
961
- }
962
-
963
- interface IDotTime extends IDotGlobalAttrs<HTMLTimeElement> {
964
- dateTime?: AttrVal<string>;
965
- }
966
-
967
- interface IDotTh extends IDotGlobalAttrs<HTMLTableCellElement> {
968
- /** @deprecated Deprecated in HTML5. Use CSS. */
969
- axis?: AttrVal<string>;
970
- colSpan?: AttrVal<number>;
971
- /** @deprecated Deprecated in HTML5. Use CSS. */
972
- charOff?: AttrVal<string>;
973
- headers?: AttrVal<string>;
974
- rowSpan?: AttrVal<number>;
975
- scope?: AttrVal<string>;
976
- /** @deprecated Deprecated in HTML5. Use CSS. */
977
- vAlign?: AttrVal<string>;
978
- }
979
-
980
- interface IDotTHead extends IDotGlobalAttrs<HTMLTableSectionElement> {
981
- /** @deprecated Deprecated in HTML5. Use CSS. */
982
- charOff?: AttrVal<string> | AttrVal<number>;
983
- /** @deprecated Deprecated in HTML5. Use CSS. */
984
- vAlign?: AttrVal<string>;
985
- }
986
-
987
- interface IDotTr extends IDotGlobalAttrs<HTMLTableRowElement> {
988
- /** @deprecated Deprecated in HTML5. Use CSS. */
989
- charOff?: AttrVal<string> | AttrVal<number>;
990
- /** @deprecated Deprecated in HTML5. Use CSS. */
991
- vAlign?: AttrVal<string>;
992
- }
993
-
994
- interface IDotTrack extends IDotGlobalAttrs<HTMLTrackElement> {
995
- default?: AttrVal<boolean>;
996
- kind?: AttrVal<string>;
997
- src?: AttrVal<string>;
998
- srcLang?: AttrVal<string>;
999
- trackLabel?: AttrVal<string>; // alias for label
1000
-
1001
- // Events:
1002
- onCueChange?: (e: Event) => void;
1003
- }
1004
-
1005
- interface IDotVideo extends IDotGlobalAttrs<HTMLVideoElement> {
1006
- autoPlay?: AttrVal<boolean>;
1007
- buffered?: IReactive; // Managed by browser not user. TODO: we can possibly use events to update observable objects.
1008
- controls?: AttrVal<boolean>;
1009
- crossOrigin?: AttrVal<"anonymous"> | AttrVal<"use-credentials">;
1010
- height?: AttrVal<number>;
1011
- loop?: AttrVal<boolean>;
1012
- muted?: AttrVal<boolean>;
1013
- playsInline?: AttrVal<boolean>;
1014
- poster?: AttrVal<string>;
1015
- preload?: AttrVal<"none"> | AttrVal<"metadata"> | AttrVal<"auto">;
1016
- src?: AttrVal<string>;
1017
- width?: AttrVal<number>;
1018
-
1019
- // Special functions:
1020
- // TODO:
1021
- // pause(): IDotVideo;
1022
- // play(): IDotVideo;
1023
- // stop(): IDotVideo;
1024
-
1025
- // Events:
1026
- onAbort?: (e: Event) => void;
1027
- onCantPlayThrough?: (e: Event) => void;
1028
- onDurationChange?: (e: Event) => void;
1029
- onEmptied?: (e: Event) => void;
1030
- onEnded?: (e: Event) => void;
1031
- onLoadedData?: (e: Event) => void;
1032
- onLoadStart?: (e: Event) => void;
1033
- onLoadedMetadata?: (e: Event) => void;
1034
- onPause?: (e: Event) => void;
1035
- onPlay?: (e: Event) => void;
1036
- onPlaying?: (e: Event) => void;
1037
- onProgress?: (e: Event) => void;
1038
- onRateChange?: (e: Event) => void;
1039
- onSeeked?: (e: Event) => void;
1040
- onSeeking?: (e: Event) => void;
1041
- onStalled?: (e: Event) => void;
1042
- onSuspend?: (e: Event) => void;
1043
- onTimeUpdate?: (e: Event) => void;
1044
- onVolumeChange?: (e: Event) => void;
1045
- onWaiting?: (e: Event) => void;
1046
- onCanPlay?: (e: Event) => void;
1047
- }
1
+
2
+ import IDotComponent from "./i-dot-component";
3
+ import IDotCss from "./styles/i-dot-css";
4
+ import IEventBus from "./i-event-bus";
5
+ import {IReactive} from "./bindings/i-reactive";
6
+ import { IBinding } from "./bindings/i-binding";
7
+ import { IWatcher } from "./bindings/i-watcher";
8
+ import IDotcssProp from "./styles/i-css-prop";
9
+ import { IRef } from "./bindings/i-ref";
10
+
11
+ type DotContentPrimitive = string | number | boolean | undefined | null;
12
+ type DotContentBasic = DotContentPrimitive | Node | Element | NodeList | IDotComponent | IDotDocument//typeof DotDocument;
13
+ export type DotContent = DotContentBasic | Array<DotContent> | IReactive;//|(()=>DotContent);
14
+
15
+ export type ISignal<T = any> = IWatcher<T>;
16
+
17
+ type AttrVal<T = string | number | boolean> = T | IReactive;
18
+
19
+ /**
20
+ * Global interface containing elements.
21
+ */
22
+ export interface IDotDocument {
23
+ // Creating a blank DotDocument.
24
+ // (document?: Element, classPrefix?: number, targetWindow?: Window): void;
25
+
26
+ // Internal use only:
27
+ // Removed in v6.
28
+ // _appendOrCreateDocument(content: DotContent, parentEl?: Element, beforeNode?: Node|number);
29
+
30
+ /**
31
+ * 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.
32
+ */
33
+ when(condition: IReactive<boolean> | boolean, callback: DotContent): IDotConditionalDocument;
34
+
35
+ // Main functions.
36
+ // TODO: please make this into a test case.
37
+ /**
38
+ * Cast any document to any other element type. This can be used to access attributes when dotHTML doesn't know the type.
39
+ * @example
40
+ * dot("#my-input").as(dot.input).value("Hello, world!")
41
+ * @example
42
+ * dot.h("<a>Click me!</a>").as(dot.a).hRef("https://dothtml.com/")
43
+ */
44
+ as<T extends IDotDocument>(dotElement: (...props: any[]) => T): T;
45
+ /**
46
+ * Creates a custom element.
47
+ */
48
+ el(tag: string, content?: DotContent): IDotDocument
49
+
50
+ // Special "tags"
51
+ /**
52
+ * Creates a generic HTML node that can render a string, HTML nodes, or dotHTML content.
53
+ */
54
+ html(content: string | number | boolean | IReactive): IDotDocument;
55
+ /**
56
+ * Creates a text node that will render as a string, rather than being parsed as markup.
57
+ */
58
+ text(content: string | number | boolean | IReactive): IDotDocument;
59
+ /**
60
+ * Creates a text node that will render as a string, rather than being parsed as markup.
61
+ */
62
+ md(content: string | number | boolean | IReactive): IDotDocument;
63
+ /**
64
+ * Mounts a component.
65
+ */
66
+ mount<T extends IDotComponent>(component: T, ...args: any[]): IDotDocument;
67
+ slot(name?: string | any, fallback?: any): IDotDocument;
68
+ // mount<T extends IComponent>(init: (c: IMountedComponent<T>) => IMountedComponent<T> | void, component: T): IDotDocument;
69
+ // mount(component: IComponent, init: (init=>IMountedComponent): IMountedComponent|void): IDotDocument;
70
+ /**
71
+ * Iterates n times, appending the result of each iteration to the VDBO.
72
+ * @param n The number of iterations.
73
+ * @param callback The markup-generating callback.
74
+ */
75
+ iterate(n: number, callback: (i: number) => DotContent): IDotDocument;
76
+ each<T>(a: Array<T> | { [key: string | number]: T }, callback: (x: T, i: number, k: string | number) => DotContent): IDotDocument;
77
+ each<T>(a:
78
+ IWatcher<Array<T>>
79
+ |IWatcher<Record<string|number, T>>
80
+ |IBinding<any, Array<T>>
81
+ |IBinding<any, IWatcher<Record<string|number, T>>>
82
+ , callback: (x: T, i: IBinding<number>, k: string | number) => DotContent): IDotDocument;
83
+
84
+ /**
85
+ * Removes the targeted document and everything in it.
86
+ */
87
+ remove(): void;
88
+
89
+ style(c: string | ISignal<any> | IBinding<any, any> | IDotCss | ((s: IDotCss) => void)): this;
90
+ class(name: string, condition?: any): this;
91
+ attr(name: string, value: any): this;
92
+ on(event: string, callback: (e: any) => void): this;
93
+ onEnter(callback: (el: HTMLElement) => void): this;
94
+ onLeave(callback: (el: HTMLElement) => Promise<void> | void): this;
95
+
96
+ fade(duration?: number): this;
97
+ slide(duration?: number): this;
98
+
99
+ /**
100
+ * Get the last HTML element added to the targeted document.
101
+ */
102
+ // getLast(): HTMLElement;
103
+ /**
104
+ * Deletes each element within the targeted document.
105
+ */
106
+ empty(): IDotDocument;
107
+
108
+ // Redundant in v6.
109
+ // scopeClass(prefix: number|string|null, content: DotContent): IDotDocument;
110
+
111
+ // Tags.
112
+ a(...args: (DotContent | IDotA)[]): IDotDocument;
113
+
114
+ aside(...args: (DotContent | IDotGlobalAttrs)[]): IDotDocument;
115
+ abbr(...args: (DotContent | IDotGlobalAttrs)[]): IDotDocument;
116
+ address(...args: (DotContent | IDotGlobalAttrs)[]): IDotDocument;
117
+
118
+ area(...args: (DotContent | IDotArea)[]): IDotDocument;
119
+
120
+ article(...args: (DotContent | IDotGlobalAttrs)[]): IDotDocument;
121
+
122
+ audio(...args: (DotContent | IDotAudio)[]): IDotDocument;
123
+
124
+ b(...args: (DotContent | IDotGlobalAttrs)[]): IDotDocument;
125
+ bdi(...args: (DotContent | IDotGlobalAttrs)[]): IDotDocument;
126
+ bdo(...args: (DotContent | IDotGlobalAttrs)[]): IDotDocument;
127
+
128
+ blockQuote(...args: (DotContent | IDotBlockQuote)[]): IDotDocument;
129
+
130
+ // This shouldn't really be used - if it is, then it should have the custom behavior of rewriting the existing document body, rather than adding a second one.
131
+ body(...args: (DotContent | IDotBody)[]): IDotDocument;
132
+
133
+ br(...args: (DotContent | IDotBr)[]): IDotDocument;
134
+ button(...args: (DotContent | IDotButton)[]): IDotDocument;
135
+ canvas(...args: (DotContent | IDotCanvas)[]): IDotDocument;
136
+
137
+ caption(...args: (DotContent | IDotGlobalAttrs)[]): IDotDocument;
138
+ cite(...args: (DotContent | IDotGlobalAttrs)[]): IDotDocument;
139
+ code(...args: (DotContent | IDotGlobalAttrs)[]): IDotDocument;
140
+
141
+ col(...args: (DotContent | IDotCol)[]): IDotDocument;
142
+ colGroup(...args: (DotContent | IDotColGroup)[]): IDotDocument;
143
+
144
+ content(...args: (DotContent | IDotGlobalAttrs)[]): IDotDocument;
145
+ data(...args: (DotContent | IDotGlobalAttrs)[]): IDotDocument;
146
+ dataList(...args: (DotContent | IDotGlobalAttrs)[]): IDotDocument;
147
+ dd(...args: (DotContent | IDotGlobalAttrs)[]): IDotDocument;
148
+
149
+ del(...args: (DotContent | IDotDel)[]): IDotDocument;
150
+ details(...args: (DotContent | IDotDetails)[]): IDotDocument;
151
+
152
+ dfn(...args: (DotContent | IDotGlobalAttrs)[]): IDotDocument;
153
+ dialog(...args: (DotContent | IDotGlobalAttrs)[]): IDotDocument;
154
+ div(...args: (DotContent | IDotGlobalAttrs)[]): IDotDocument;
155
+ dl(...args: (DotContent | IDotGlobalAttrs)[]): IDotDocument;
156
+ dt(...args: (DotContent | IDotGlobalAttrs)[]): IDotDocument;
157
+ em(...args: (DotContent | IDotGlobalAttrs)[]): IDotDocument;
158
+
159
+ embed(...args: (DotContent | IDotEmbed)[]): IDotDocument;
160
+ fieldSet(...args: (DotContent | IDotFieldSet)[]): IDotDocument;
161
+
162
+ figCaption(...args: (DotContent | IDotGlobalAttrs)[]): IDotDocument;
163
+ figure(...args: (DotContent | IDotGlobalAttrs)[]): IDotDocument;
164
+ footer(...args: (DotContent | IDotGlobalAttrs)[]): IDotDocument;
165
+
166
+ form(...args: (DotContent | IDotForm)[]): IDotDocument;
167
+
168
+ h1(...args: (DotContent | IDotGlobalAttrs)[]): IDotDocument;
169
+ h2(...args: (DotContent | IDotGlobalAttrs)[]): IDotDocument;
170
+ h3(...args: (DotContent | IDotGlobalAttrs)[]): IDotDocument;
171
+ h4(...args: (DotContent | IDotGlobalAttrs)[]): IDotDocument;
172
+ h5(...args: (DotContent | IDotGlobalAttrs)[]): IDotDocument;
173
+ h6(...args: (DotContent | IDotGlobalAttrs)[]): IDotDocument;
174
+ header(...args: (DotContent | IDotGlobalAttrs)[]): IDotDocument;
175
+
176
+ hr(...args: (DotContent | ((attrs: IDotHr) => IDotHr))[]): IDotDocument;
177
+
178
+ i(...args: (DotContent | IDotGlobalAttrs)[]): IDotDocument;
179
+
180
+ iFrame(...args: (DotContent | IDotIFrame)[]): IDotDocument;
181
+ img(...args: (DotContent | IDotImg)[]): IDotDocument;
182
+ input(...args: (DotContent | IDotInput)[]): IDotDocument;
183
+ ins(...args: (DotContent | IDotIns)[]): IDotDocument;
184
+
185
+ kbd(...args: (DotContent | IDotGlobalAttrs)[]): IDotDocument;
186
+
187
+ /** @deprecated Deprecated in HTML5. */
188
+ keyGen(...args: (DotContent | IDotKeyGen)[]): IDotDocument;
189
+ label(...args: (DotContent | IDotLabel)[]): IDotDocument;
190
+
191
+ legend(...args: (DotContent | IDotGlobalAttrs)[]): IDotDocument;
192
+
193
+ li(...args: (DotContent | IDotLi)[]): IDotDocument;
194
+
195
+ main(...args: (DotContent | IDotGlobalAttrs)[]): IDotDocument;
196
+
197
+ map(...args: (DotContent | IDotMap)[]): IDotDocument;
198
+
199
+ mark(...args: (DotContent | IDotGlobalAttrs)[]): IDotDocument;
200
+
201
+ menu(...args: (DotContent | IDotMenu)[]): IDotDocument;
202
+ meter(...args: (DotContent | IDotMeter)[]): IDotDocument;
203
+
204
+ nav(...args: (DotContent | IDotGlobalAttrs)[]): IDotDocument;
205
+
206
+ object(...args: (DotContent | IDotObject)[]): IDotDocument;
207
+ ol(...args: (DotContent | IDotOl)[]): IDotDocument;
208
+ optGroup(...args: (DotContent | IDotOptGroup)[]): IDotDocument;
209
+ option(...args: (DotContent | IDotOption)[]): IDotDocument;
210
+ output(...args: (DotContent | IDotOutput)[]): IDotDocument;
211
+
212
+ p(...args: (DotContent | IDotGlobalAttrs)[]): IDotDocument;
213
+
214
+ param(...args: (DotContent | IDotParam)[]): IDotDocument;
215
+
216
+ pre(...args: (DotContent | IDotGlobalAttrs)[]): IDotDocument;
217
+
218
+ progress(...args: (DotContent | IDotProgress)[]): IDotDocument;
219
+ q(...args: (DotContent | IDotQ)[]): IDotDocument;
220
+
221
+ rp(...args: (DotContent | IDotGlobalAttrs)[]): IDotDocument;
222
+ rt(...args: (DotContent | IDotGlobalAttrs)[]): IDotDocument;
223
+ ruby(...args: (DotContent | IDotGlobalAttrs)[]): IDotDocument;
224
+ s(...args: (DotContent | IDotGlobalAttrs)[]): IDotDocument;
225
+ samp(...args: (DotContent | IDotGlobalAttrs)[]): IDotDocument;
226
+ section(...args: (DotContent | IDotGlobalAttrs)[]): IDotDocument;
227
+
228
+ select(...args: (DotContent | IDotSelect)[]): IDotDocument;
229
+
230
+ small(...args: (DotContent | IDotGlobalAttrs)[]): IDotDocument;
231
+
232
+ source(...args: (DotContent | IDotSource)[]): IDotDocument;
233
+
234
+ span(...args: (DotContent | IDotGlobalAttrs)[]): IDotDocument;
235
+ strong(...args: (DotContent | IDotGlobalAttrs)[]): IDotDocument;
236
+ svg(...args: (DotContent | IDotGlobalAttrs)[]): IDotDocument;
237
+ sub(...args: (DotContent | IDotGlobalAttrs)[]): IDotDocument;
238
+ summary(...args: (DotContent | IDotGlobalAttrs)[]): IDotDocument;
239
+ sup(...args: (DotContent | IDotGlobalAttrs)[]): IDotDocument;
240
+
241
+ table(...args: (DotContent | IDotTable)[]): IDotDocument;
242
+ tBody(...args: (DotContent | IDotTBody)[]): IDotDocument;
243
+ td(...args: (DotContent | IDotTd)[]): IDotDocument;
244
+ textArea(...args: (DotContent | IDotTextArea)[]): IDotDocument;
245
+ tFoot(...args: (DotContent | IDotTFoot)[]): IDotDocument;
246
+ th(...args: (DotContent | IDotTh)[]): IDotDocument;
247
+ tHead(...args: (DotContent | IDotTHead)[]): IDotDocument;
248
+ time(...args: (DotContent | IDotTime)[]): IDotDocument;
249
+ tr(...args: (DotContent | IDotTr)[]): IDotDocument;
250
+ track(...args: (DotContent | IDotTrack)[]): IDotDocument;
251
+
252
+ u(...args: (DotContent | IDotGlobalAttrs)[]): IDotDocument;
253
+ ul(...args: (DotContent | IDotGlobalAttrs)[]): IDotDocument;
254
+ var(...args: (DotContent | IDotGlobalAttrs)[]): IDotDocument;
255
+
256
+ video(...args: (DotContent | IDotVideo)[]): IDotDocument;
257
+
258
+ wbr(...args: (DotContent | IDotGlobalAttrs)[]): IDotDocument;
259
+ }
260
+
261
+ type Styles = string | IDotcssProp;
262
+ // interface IComponentFactory {
263
+ // <TProps extends string[], TEvents extends string[], T extends IComponent<TProps, TEvents>>(
264
+ // Base: new () => T, styles?: Styles | Styles[]
265
+ // ): new (attrs?: ComponentArgs<TProps, TEvents>) => T & { new (attrs?: ComponentArgs<TProps, TEvents>): IComponent<TProps, TEvents> };
266
+ // }
267
+
268
+ // interface IComponentFactory {
269
+ // <TProps extends string[], TEvents extends string[], T extends IComponent<TProps, TEvents>>(
270
+ // Base: new () => T, styles?: Styles | Styles[]
271
+ // ): new (attrs?: ComponentArgs<TProps, TEvents>) => T & IComponent<TProps, TEvents>;
272
+ // }
273
+
274
+ // useStyles<T extends IComponent>(styles: Styles | Styles[]): (Base: new () => T) => new () => T;
275
+ // hasEvents<T extends IComponent>(styles: Styles | Styles[]): (Base: new () => T) => new () => T;
276
+ // prop(target: any, propertyKey: string): void;
277
+
278
+ export type ComponentArgs<TProps extends Array<string> = [], TEvents extends Array<string> = []> = {
279
+ [key in TProps[number]]?: any;
280
+ } & Partial<{
281
+ [key in TEvents[number]]?: (...args: any[]) => void;
282
+ }>;
283
+
284
+ /**
285
+ * Interface for the dot object.
286
+ */
287
+ export interface IDotCore extends IDotDocument {
288
+ (targetSelector: string | Element | Node | NodeList | Array<Node | Element>, targetWindow?: Window): IDotDocument;
289
+
290
+ version: string;
291
+ styleMode: "sync" | "async";
292
+
293
+ navigate(path: string, replace?: boolean): void;
294
+ css: IDotCss;
295
+ bus: IEventBus;
296
+ window: IDotWindowBuilder;
297
+
298
+ state<Ti = IReactive | Array<any> | { [key: string | number]: any } | string | number | boolean>(initValue?: Ti, key?: (Ti extends Array<any> | { [key: string | number]: any } ? string : never)): ISignal<Ti>;
299
+ computed<T>(getter: () => T): ISignal<T>;
300
+
301
+ /**
302
+ * Registers a side effect that runs automatically when its dependencies change.
303
+ * If called within a component or store, it is automatically cleaned up when the owner is disposed.
304
+ * @param callback The function to execute. Can return a cleanup function.
305
+ * @returns A manual dispose function.
306
+ */
307
+ effect(callback: () => void | (() => void)): () => void;
308
+
309
+ alpha(color: string | ISignal<string> | IBinding<any, string>, opacity: number | ISignal<number> | IBinding<any, number>): ISignal<string>;
310
+ flushSync(): void;
311
+ setSync(sync: boolean): void;
312
+
313
+ currentPath: ISignal<string>;
314
+ currentSearch: ISignal<string>;
315
+ currentHash: ISignal<string>;
316
+
317
+ useQueryParams(): ISignal<Record<string, string>>;
318
+ useHash(): ISignal<string>;
319
+
320
+ create<T extends IDotComponent>(Ctor: { new(...args: any[]): T }, ...args: any[]): T;
321
+
322
+ store: <TState extends Record<string, any>, TActions extends Record<string, Function>, TGetters extends Record<string, (state: any) => any>>(options: { id?: string, state?: () => TState, getters?: TGetters, actions?: TActions }) => () => any;
323
+ getStore: (id: string) => any;
324
+ clearStores: () => void;
325
+ stores: Record<string, any>;
326
+ useGlobalStyles: (styles: string | CSSStyleSheet | Array<string | CSSStyleSheet>) => void;
327
+ setTheme: (theme: any) => void;
328
+
329
+ Router: any;
330
+ Link: any;
331
+
332
+ slot(name?: string | any, fallback?: any): IDotDocument;
333
+
334
+ /**
335
+ * Creates a reactive reference to a DOM element or component instance.
336
+ * Refs are signals that are automatically populated when the element is mounted.
337
+ * @template T The type of the element or component.
338
+ */
339
+ ref<T extends HTMLElement | IDotComponent = HTMLElement>(): IRef<T>;
340
+
341
+ // Keep these around for a bit to show how it was done before in case I need to change anything prior to the v6 launch.
342
+ // component<T extends IComponent>(Base: new (...args: Parameters<T['build']>) => T): new (...args: Parameters<T['build']>) => T;
343
+ // useStyles<T extends IComponent>(styles: string|((css: IDotCss)=>IDotcssProp|string)): ((Base: new (...args: Parameters<T['build']>) => T) => new (...args: Parameters<T['build']>) => T);
344
+
345
+ // component: IComponentFactory;
346
+ // Works but doesn't infer types from the component.
347
+ // There's room for improvement here but it's not clear to me how to do it.
348
+ // What I'd like to do is have the types tied to the IComponent interface rather than the component factory function.
349
+ component<T extends { new(...args: any[]): IDotComponent }>(Ctor: T): T;
350
+ component<TProps extends string[] = [], TEvents extends string[] = []>(Base: new (...args: any[]) => IDotComponent, styles?: string|IDotcssProp|Array<string|IDotcssProp>)
351
+ : new (attrs?: ComponentArgs<TProps, TEvents>) => IDotComponent;
352
+
353
+ useStyles(document: Document, styles: Styles): HTMLStyleElement;
354
+
355
+ /**
356
+ * A global error handler that is called when an error occurs during the rendering or update process.
357
+ */
358
+ onError?: (error: any) => void;
359
+ }
360
+
361
+ export interface IDotWindowWrapper{
362
+ open(): Promise<void>;
363
+ close(): void;
364
+ window: Window;
365
+ document: Document;
366
+ title: string;
367
+ width: number;
368
+ height: number;
369
+ isOpen: boolean;
370
+ syncStyles: boolean;
371
+ tether: boolean;
372
+ position: "center" | "parent-center" | "beside-parent" | {left: number, top: number} | null;
373
+ on(event: string, callback: (e: any) => void): this;
374
+ focus(): void;
375
+ bringToFront(): void;
376
+ resizeTo(width: number, height: number): void;
377
+ moveTo(left: number, top: number): void;
378
+ }
379
+
380
+ export interface IDotWindowBuilder {
381
+ (options: {content: IDotComponent, width?: number, height?: number, title?: string, tether?: boolean, syncStyles?: boolean, position?: "center" | "parent-center" | "beside-parent" | {left: number, top: number}}): IDotWindowWrapper;
382
+ }
383
+
384
+ export interface IDotConditionalDocument extends IDotDocument {
385
+ /**
386
+ * A conditional catch, analogous to else if. Can be used after a when function. Evaluates if the previous when's condition was false.
387
+ * Renders the specified DOT if a condition is met. Dynamic binding is possible when condition and callback are functions.
388
+ */
389
+ otherwiseWhen(condition: IReactive<boolean> | boolean, callback: DotContent): IDotConditionalDocument;
390
+ /**
391
+ * A conditional final catch, analogous to else. Can be used after a when or otherwiseWhen function. Evaluates if the previous when/otherwiseWhen evaluated to false.
392
+ * Renders the specified DOT if a condition is met. Dynamic binding is possible when callback is a function.
393
+ */
394
+ otherwise(callback: DotContent): IDotDocument;
395
+ }
396
+
397
+ // Attribute interface (for all elements):
398
+ export interface IDotGlobalAttrs<T extends HTMLElement = HTMLElement> {
399
+ /**
400
+ * Create a custom attribute.
401
+ */
402
+ // attr(name: string, value: unknown, arg3?: unknown): T;
403
+ custom?: Record<string, AttrVal<unknown>>
404
+ /**
405
+ * Adds a data-<suffix> attribute to the current element which can contain custom data.
406
+ */
407
+ customData?: Record<string, AttrVal<unknown>>;
408
+ /**
409
+ * Create a named reference to the current element so that it can be accessed within the current component.
410
+ */
411
+ // TODO: this needs to be redone now.
412
+ // The better way might be using the new reactive system instead of references.
413
+ // For now I'll leave it like this:
414
+ ref?: IRef<T>;
415
+
416
+ /** @deprecated Deprecated in HTML5. Use CSS. */
417
+ bgColor?: AttrVal<unknown>;
418
+ /** @deprecated Deprecated in HTML5. Use CSS. */
419
+ color?: AttrVal<unknown>;
420
+ /** @deprecated Deprecated in HTML5. Use CSS. */
421
+ aLink?: AttrVal<unknown>;
422
+ /** @deprecated Deprecated in HTML5. */
423
+ archive?: AttrVal<unknown>;
424
+
425
+ // TODO: we're still missing some additional global attributes. See https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/
426
+ areaHidden?: AttrVal<boolean>;
427
+ areaLabel?: AttrVal<string>;
428
+ areaDescribedBy?: AttrVal<string>;
429
+ areaControls?: AttrVal<string>;
430
+ areaExpanded?: AttrVal<boolean>;
431
+ areaChecked?: AttrVal<string>;
432
+ areaSelected?: AttrVal<boolean>;
433
+ accessKey?: AttrVal<string>; // This could potentially be enumerated. But care should be taken as these types are already quite complex.
434
+ class?: AttrVal<string> | Array<AttrVal<string>> | AttrVal<Array<string>> | Record<string, AttrVal<boolean>> | (string | Record<string, any>)[]; // Space-separated. TODO: need tests.
435
+ contentEditable?: AttrVal<"true"> | AttrVal<"false"> | AttrVal<"plaintext-only">;
436
+ contextMenu?: AttrVal<string>;
437
+ dir?: AttrVal<string>;
438
+ draggable?: AttrVal<"true"> | AttrVal<"false">;
439
+ dropZone?: AttrVal<"move"> | AttrVal<"copy"> | AttrVal<"link">;
440
+ exportParts?: AttrVal<string>;
441
+ hidden?: AttrVal<boolean>;
442
+ id?: string;
443
+ inert?: AttrVal<boolean>;
444
+ inputMode?: AttrVal<string>;
445
+ is?: AttrVal<string>;
446
+ itemId?: AttrVal<string>;
447
+ itemProp?: AttrVal<string>;
448
+ itemRef?: AttrVal<string>;
449
+ itemScope?: AttrVal<string>;
450
+ itemType?: AttrVal<string>;
451
+ lang?: AttrVal<string>;
452
+ nOnce?: AttrVal<string>;
453
+ part?: AttrVal<string>;
454
+ role?: AttrVal<string>;
455
+ spellCheck?: AttrVal<"true"> | AttrVal<"false">;
456
+ style?: AttrVal<string> | IDotcssProp | ((s: IDotCss) => void);
457
+ tabIndex?: AttrVal<number>;
458
+ title?: AttrVal<string>;
459
+ translate?: AttrVal<string>;
460
+ virtualKeyboardPolicy?: AttrVal<"auto"> | AttrVal<"manual">;
461
+
462
+ // Events
463
+
464
+ onAbort?: (e: Event) => void;
465
+ onCanPlay?: (e: Event) => void;
466
+ onCantPlayThrough?: (e: Event) => void;
467
+ onContextMenu?: (e: MouseEvent) => void; // global
468
+ onCopy?: (e: ClipboardEvent) => void; // global
469
+ onCueChange?: (e: Event) => void;
470
+ onCut?: (e: ClipboardEvent) => void; // global
471
+ onPagePaste?: (e: ClipboardEvent) => void; // global
472
+
473
+ onDrag?: (e: DragEvent) => void; // global
474
+ onDragEnd?: (e: DragEvent) => void; // global
475
+ onDragStart?: (e: DragEvent) => void; // global
476
+ onDragEnter?: (e: DragEvent) => void; // global
477
+ onDragOver?: (e: DragEvent) => void; // global
478
+ onDragLeave?: (e: DragEvent) => void; // global
479
+ onDrop?: (e: DragEvent) => void; // global
480
+ onDurationChange?: (e: Event) => void;
481
+ onEmptied?: (e: Event) => void;
482
+ onEnded?: (e: Event) => void;
483
+ onError?: (e: Event) => void; // loading elements.
484
+ onHashChange?: (e: HashChangeEvent) => void;
485
+ onInvalid?: (e: Event) => void; // global
486
+ onLoadedData?: (e: Event) => void;
487
+ onLoadedMetadata?: (e: Event) => void;
488
+ onLoadStart?: (e: Event) => void;
489
+ onMouseWheel?: (e: WheelEvent) => void; // global
490
+ onWheel?: (e: WheelEvent) => void; // global
491
+
492
+ // Configured.
493
+ onBlur?: (e: FocusEvent) => void;
494
+ onChange?: (e: Event) => void;
495
+ onClick?: (e: MouseEvent) => void;
496
+ onDblClick?: (e: MouseEvent) => void;
497
+ onFocus?: (e: FocusEvent) => void;
498
+ onInput?: (e: InputEvent) => void;
499
+ onKeyDown?: (e: KeyboardEvent) => void;
500
+ onKeyPress?: (e: KeyboardEvent) => void;
501
+ onKeyUp?: (e: KeyboardEvent) => void;
502
+ onLoad?: (e: Event) => void; // On specific resources only.
503
+ onMouseDown?: (e: MouseEvent) => void;
504
+ onMouseEnter?: (e: MouseEvent) => void;
505
+ onMouseLeave?: (e: MouseEvent) => void;
506
+ onMouseMove?: (e: MouseEvent) => void;
507
+ onMouseOut?: (e: MouseEvent) => void;
508
+ onMouseOver?: (e: MouseEvent) => void;
509
+ onMouseUp?: (e: MouseEvent) => void;
510
+ onOffline?: (e: Event) => void;
511
+ onOnline?: (e: Event) => void;
512
+ onPageHide?: (e: PageTransitionEvent) => void;
513
+ onPageShow?: (e: PageTransitionEvent) => void;
514
+ onPause?: (e: Event) => void;
515
+ onPlay?: (e: Event) => void;
516
+ onPlaying?: (e: Event) => void;
517
+ onPointerCancel?: (e: PointerEvent) => void;
518
+ onPointerDown?: (e: PointerEvent) => void;
519
+ onPointerEnter?: (e: PointerEvent) => void;
520
+ onPointerLeave?: (e: PointerEvent) => void;
521
+ onPointerMove?: (e: PointerEvent) => void;
522
+ onPointerOut?: (e: PointerEvent) => void;
523
+ onPointerOver?: (e: PointerEvent) => void;
524
+ onPointerUp?: (e: PointerEvent) => void;
525
+ onPopState?: (e: PopStateEvent) => void;
526
+ onProgress?: (e: Event) => void;
527
+ onRateChange?: (e: Event) => void;
528
+
529
+ onTouchMove?: (e: TouchEvent) => void;
530
+ onTouchCancel?: (e: TouchEvent) => void;
531
+ onTouchEnd?: (e: TouchEvent) => void;
532
+ onTouchStart?: (e: TouchEvent) => void;
533
+
534
+ onReset?: (e: Event) => void;
535
+ onResize?: (e: UIEvent) => void;
536
+ onScroll?: (e: UIEvent) => void;
537
+ onSearch?: (e: Event) => void;
538
+ onSeeked?: (e: Event) => void;
539
+ onSeeking?: (e: Event) => void;
540
+ onSelect?: (e: Event) => void;
541
+ onStalled?: (e: Event) => void;
542
+ onStorage?: (e: StorageEvent) => void;
543
+ onSubmit?: (e: Event) => void;
544
+ onSuspend?: (e: Event) => void;
545
+ onTimeUpdate?: (e: Event) => void;
546
+ onToggle?: (e: Event) => void;
547
+ onUnload?: (e: Event) => void;
548
+ onVolumeChange?: (e: Event) => void;
549
+ onWaiting?: (e: Event) => void;
550
+ }
551
+
552
+ // Interface for specific elements:
553
+
554
+ // interface IMountedComponent<T extends IComponent> {
555
+ // on(event: string, callback: (...args: Array<any>) => void): IMountedComponent<T>;
556
+ // prop(name: string, value: any): IMountedComponent<T>;
557
+ // }
558
+
559
+ export interface IDotA extends IDotGlobalAttrs<HTMLAnchorElement> {
560
+ download?: AttrVal<boolean>;
561
+ hRef?: AttrVal<string>;
562
+ href?: AttrVal<string>;
563
+ hRefLang?: AttrVal<string>;
564
+ charset?: AttrVal<string>;
565
+ coords?: AttrVal<string>;
566
+ shape?: AttrVal<string>;
567
+ media?: AttrVal<string>;
568
+ ping?: AttrVal<string> | Array<AttrVal<string>> | AttrVal<Array<string>> | Record<string, AttrVal<string>>; // Space-separated. TODO: need tests.
569
+ rel?: AttrVal<string>;
570
+ /** @deprecated Deprecated in HTML5. */
571
+ rev?: AttrVal<unknown>;
572
+ name?: AttrVal<string>;
573
+ target?: AttrVal<"_blank"> | AttrVal<"_parent"> | AttrVal<"_self"> | AttrVal<"_top">;
574
+ type?: AttrVal<string>;
575
+ }
576
+ export interface IDotArea extends IDotGlobalAttrs<HTMLAreaElement> {
577
+ alt?: AttrVal<string>;
578
+ coords?: AttrVal<string>;
579
+ download?: AttrVal<string>;
580
+ hRef?: AttrVal<string>;
581
+ href?: AttrVal<string>;
582
+ hRefLang?: AttrVal<string>;
583
+ media?: AttrVal<string>;
584
+ noHRef?: AttrVal<string>; // Deprecated in HTML5.
585
+ rel?: AttrVal<string>;
586
+ shape?: AttrVal<string>;
587
+ target?: AttrVal<string>;
588
+ }
589
+ export interface IDotAudio extends IDotGlobalAttrs<HTMLAudioElement> {
590
+ autoPlay?: AttrVal<boolean>;
591
+ // buffered?: unknown; // Not used?
592
+ controls?: AttrVal<boolean>;
593
+ loop?: AttrVal<boolean>;
594
+ muted?: AttrVal<boolean>;
595
+ preload?: AttrVal<"auto"> | AttrVal<"metadata"> | AttrVal<"none">;
596
+ src?: AttrVal<string>;
597
+ crossOrigin?: AttrVal<"anonymous"> | AttrVal<"use-credentials">;
598
+
599
+ // Special functions:
600
+ // TODO: these need to be removed from here.
601
+ // pause(): IDotAudio;
602
+ // play(): IDotAudio;
603
+ // stop(): IDotAudio;
604
+
605
+ // Events:
606
+ onAbort?: (e: Event) => void;
607
+ onCantPlayThrough?: (e: Event) => void;
608
+ onDurationChange?: (e: Event) => void;
609
+ onEmptied?: (e: Event) => void;
610
+ onEnded?: (e: Event) => void;
611
+ onLoadedData?: (e: Event) => void;
612
+ onLoadStart?: (e: Event) => void;
613
+ onLoadedMetadata?: (e: Event) => void;
614
+ onPause?: (e: Event) => void;
615
+ onPlay?: (e: Event) => void;
616
+ onPlaying?: (e: Event) => void;
617
+ onProgress?: (e: Event) => void;
618
+ onRateChange?: (e: Event) => void;
619
+ onSeeked?: (e: Event) => void;
620
+ onSeeking?: (e: Event) => void;
621
+ onStalled?: (e: Event) => void;
622
+ onSuspend?: (e: Event) => void;
623
+ onTimeUpdate?: (e: Event) => void;
624
+ onVolumeChange?: (e: Event) => void;
625
+ onWaiting?: (e: Event) => void;
626
+ onCanPlay?: (e: Event) => void;
627
+ }
628
+ export interface IDotBlockQuote extends IDotGlobalAttrs<HTMLQuoteElement> {
629
+ quoteCite?: AttrVal<string>; // alias for cite
630
+ }
631
+
632
+ export interface IDotBody extends IDotGlobalAttrs<HTMLBodyElement> {
633
+ align?: unknown; // Deprecated in HTML5. Use CSS.
634
+ background?: unknown; // Deprecated in HTML5. Use CSS.
635
+ }
636
+
637
+ export interface IDotBr extends IDotGlobalAttrs<HTMLBRElement> {
638
+ /** @deprecated Deprecated in HTML5. Use CSS. */
639
+ clear?: unknown;
640
+ }
641
+ export interface IDotButton extends IDotGlobalAttrs<HTMLButtonElement> {
642
+ autoFocus?: AttrVal<boolean>;
643
+ formAction?: AttrVal<string>;
644
+ disabled?: AttrVal<boolean>;
645
+ name?: AttrVal<string>;
646
+ type?: AttrVal<"button"> | AttrVal<"submit"> | AttrVal<"reset">;
647
+ whichForm?: AttrVal<string>; // alias for form
648
+ value?: AttrVal<string>;
649
+ }
650
+ export interface IDotCanvas extends IDotGlobalAttrs<HTMLCanvasElement> {
651
+ height?: AttrVal<number>;
652
+ width?: AttrVal<number>;
653
+ }
654
+
655
+ export interface IDotCol extends IDotGlobalAttrs<HTMLTableColElement> {
656
+ /** @deprecated Deprecated in HTML5. Use CSS. */
657
+ charOff?: AttrVal<unknown>;
658
+ colSpan?: AttrVal<number>; // alias for span
659
+ vAlign?: AttrVal<number>;
660
+ }
661
+
662
+ export interface IDotColGroup extends IDotGlobalAttrs<HTMLTableColElement> {
663
+ /** @deprecated Deprecated in HTML5. Use CSS. */
664
+ charOff?: AttrVal<unknown>;
665
+ colSpan?: AttrVal<number>; // alias for span
666
+ /** @deprecated Deprecated in HTML5. Use CSS. */
667
+ vAlign?: AttrVal<unknown>;
668
+ }
669
+
670
+ export interface IDotDel extends IDotGlobalAttrs {
671
+ dateTime?: AttrVal<string>; // Would be cool if this could accept dates and just format them internally...
672
+ quoteCite?: AttrVal<string>; // alias for cite
673
+ }
674
+
675
+ export interface IDotDetails extends IDotGlobalAttrs<HTMLDetailsElement> {
676
+ open?: AttrVal<boolean>;
677
+ // Events:
678
+ onToggle?: (e: Event) => void;
679
+ }
680
+ export interface IDotEmbed extends IDotGlobalAttrs<HTMLEmbedElement> {
681
+ height?: AttrVal<number>;
682
+ src?: AttrVal<string>;
683
+ type?: AttrVal<string>;
684
+ width?: AttrVal<number>;
685
+ }
686
+ export interface IDotFieldSet extends IDotGlobalAttrs<HTMLFieldSetElement> {
687
+ disabled?: AttrVal<boolean>;
688
+ name?: AttrVal<string>;
689
+ whichForm?: AttrVal<string>; // alias for form
690
+ }
691
+ export interface IDotForm extends IDotGlobalAttrs<HTMLFormElement> {
692
+ acceptCharset?: AttrVal<string>; // accept-charset, apparently the only hyphenated attribute (aside from data-*)...
693
+ action?: AttrVal<string>;
694
+ autoComplete?: AttrVal<"on"> | AttrVal<"off">;
695
+ encType?: AttrVal<"application/x-www-form-urlencoded"> | AttrVal<"multipart/form-data"> | AttrVal<"text/plain">;
696
+ method?: AttrVal<"get"> | AttrVal<"post">;
697
+ name?: AttrVal<string>;
698
+ noValidate?: AttrVal<boolean>;
699
+ target?: AttrVal<"_self"> | AttrVal<"_blank"> | AttrVal<"_parent"> | AttrVal<"_top">;
700
+ // rel?: PrimativeOrObservable<string> IDotForm; // Not used with forms?
701
+ }
702
+ export interface IDotHr extends IDotGlobalAttrs<HTMLHRElement> {
703
+ noShade?: AttrVal<unknown>;
704
+ }
705
+ export interface IDotIFrame extends IDotGlobalAttrs<HTMLIFrameElement> {
706
+ allow?: AttrVal<string>;
707
+ allowFullScreen?: AttrVal<boolean>;
708
+ /** @deprecated Deprecated in HTML5. */
709
+ frameBorder?: AttrVal<0> | AttrVal<1>;
710
+ height?: AttrVal<number>;
711
+ /** @deprecated Deprecated in HTML5. */
712
+ longDesc?: AttrVal<string>;
713
+ marginHeight?: AttrVal<number>;
714
+ marginWidth?: AttrVal<number>;
715
+ name?: AttrVal<string>;
716
+ referrerPolicy?: AttrVal<string>;
717
+ sandbox?: AttrVal<string>;
718
+ /** @deprecated Deprecated in HTML5. */
719
+ scrolling?: AttrVal<string>;
720
+ seamless?: AttrVal<boolean>;
721
+ src?: AttrVal<string>;
722
+ srcDoc?: AttrVal<string>;
723
+ width?: AttrVal<number>;
724
+ }
725
+ export interface IDotImg extends IDotGlobalAttrs<HTMLImageElement> {
726
+ alt?: AttrVal<string>;
727
+ crossOrigin?: AttrVal<"anonymous"> | AttrVal<"use-credentials">;
728
+ decoding?: AttrVal<"async"> | AttrVal<"auto"> | AttrVal<"sync">;
729
+ height?: AttrVal<number>;
730
+ /** @deprecated Deprecated in HTML5. Use CSS. */
731
+ hSpace?: AttrVal<unknown>;
732
+ isMap?: AttrVal<boolean>;
733
+ /** @deprecated Deprecated in HTML5. Use CSS. */
734
+ loading?: AttrVal<"eager"> | AttrVal<"lazy">;
735
+ longDesc?: AttrVal<string>;
736
+ referrerPolicy?: AttrVal<string>;
737
+ sizes?: AttrVal<string>;
738
+ src?: AttrVal<string>;
739
+ srcSet?: AttrVal<string>; // Comma separated. Consider accepting an array.
740
+ useMap?: AttrVal<number>;
741
+ width?: AttrVal<number>;
742
+ }
743
+ export interface IDotInput extends IDotGlobalAttrs<HTMLInputElement> {
744
+ accept?: AttrVal<string>;
745
+ alt?: AttrVal<string>;
746
+ autoCapitalize?: AttrVal<"none"> | AttrVal<"sentences"> | AttrVal<"words"> | AttrVal<"characters">;
747
+ autoComplete?: AttrVal<"on"> | AttrVal<"off">;
748
+ autoFocus?: AttrVal<boolean>;
749
+ checked?: AttrVal<boolean>;
750
+ enterKeyHint?: AttrVal<"enter"> | AttrVal<"done"> | AttrVal<"go"> | AttrVal<"next"> | AttrVal<"preveous"> | AttrVal<"search"> | AttrVal<"send">;
751
+ dirName?: AttrVal<string>;
752
+ disabled?: AttrVal<boolean>;
753
+ formAction?: AttrVal<string>;
754
+ height?: AttrVal<number>;
755
+ list?: AttrVal<string>;
756
+ max?: AttrVal<number>;
757
+ maxLength?: AttrVal<number>;
758
+ min?: AttrVal<number>;
759
+ multiple?: AttrVal<boolean>;
760
+ name?: AttrVal<string>;
761
+ pattern?: AttrVal<string>;
762
+ placeholder?: AttrVal<string>;
763
+ readOnly?: AttrVal<boolean>;
764
+ required?: AttrVal<boolean>;
765
+ size?: AttrVal<number>;
766
+ src?: AttrVal<string>;
767
+ step?: AttrVal<string> | AttrVal<number>;
768
+ type?: "button" | "checkbox" | "color" | "date" | "datetime-local" | "email" | "file" | "hidden" | "image" | "month" | "number" | "password" | "radio" | "range" | "reset" | "search" | "submit" | "tel" | "text" | "time" | "url" | "week";
769
+ value?: AttrVal<string>;
770
+ whichForm?: AttrVal<string>; // form
771
+ width?: AttrVal<number>;
772
+
773
+ // Special functions:
774
+ // getVal(): string
775
+ // setVal(value: unknown): IDotInput;
776
+
777
+ // Input-specific events:
778
+ onSearch?: (e: Event) => void;
779
+ }
780
+
781
+ export interface IDotIns extends IDotGlobalAttrs {
782
+ dateTime?: AttrVal<string>;
783
+ quoteCite?: AttrVal<string>; // Alias for cite.
784
+ }
785
+
786
+ export interface IDotKeyGen extends IDotGlobalAttrs {
787
+ challenge?: AttrVal<string>;
788
+ keyType?: AttrVal<string>;
789
+ }
790
+
791
+ export interface IDotLabel extends IDotGlobalAttrs<HTMLLabelElement> {
792
+ for?: AttrVal<string>;
793
+ }
794
+
795
+ export interface IDotLi extends IDotGlobalAttrs<HTMLLIElement> {
796
+ value?: AttrVal<number>;
797
+ }
798
+
799
+ export interface IDotMap extends IDotGlobalAttrs<HTMLMapElement> {
800
+ name?: AttrVal<string>;
801
+ }
802
+
803
+ export interface IDotMenu extends IDotGlobalAttrs<HTMLMenuElement> {
804
+ type?: AttrVal<string>;
805
+ }
806
+
807
+ export interface IDotMeter extends IDotGlobalAttrs<HTMLMeterElement> {
808
+ high?: AttrVal<number>;
809
+ low?: AttrVal<number>;
810
+ max?: AttrVal<number>;
811
+ min?: AttrVal<number>;
812
+ optimum?: AttrVal<number>;
813
+ value?: AttrVal<number>;
814
+ }
815
+
816
+ export interface IDotObject extends IDotGlobalAttrs<HTMLObjectElement> {
817
+ archive?: AttrVal<string>;
818
+ classId?: AttrVal<string>;
819
+ codeBase?: AttrVal<string>;
820
+ codeType?: AttrVal<string>;
821
+ objectData?: AttrVal<string>; // Alias for data.
822
+ declare?: AttrVal<boolean>;
823
+ height?: AttrVal<number>;
824
+ name?: AttrVal<string>;
825
+ standby?: AttrVal<string>;
826
+ type?: AttrVal<string>;
827
+ useMap?: AttrVal<string>;
828
+ width?: AttrVal<number>;
829
+ }
830
+
831
+ export interface IDotOl extends IDotGlobalAttrs<HTMLUListElement> {
832
+ /** @deprecated Deprecated in HTML5. */
833
+ reversed?: AttrVal<boolean>;
834
+ start?: AttrVal<number>;
835
+ }
836
+
837
+ export interface IDotOptGroup extends IDotGlobalAttrs<HTMLUListElement> {
838
+ disabled?: AttrVal<boolean>;
839
+ }
840
+
841
+ export interface IDotOption extends IDotGlobalAttrs<HTMLUListElement> {
842
+ disabled?: AttrVal<boolean>;
843
+ optionLabel?: AttrVal<string>; // Alias for label
844
+ selected?: AttrVal<boolean>;
845
+ value?: AttrVal<string>;
846
+ }
847
+
848
+ export interface IDotOutput extends IDotGlobalAttrs<HTMLOutputElement> {
849
+ for?: AttrVal<string>;
850
+ name?: AttrVal<string>;
851
+ whichForm?: AttrVal<string>; // Alias for form
852
+ }
853
+
854
+ export interface IDotParam extends IDotGlobalAttrs<HTMLParamElement> {
855
+ name?: AttrVal<string>;
856
+ value?: AttrVal<string>;
857
+ /** @deprecated Deprecated in HTML5. */
858
+ valueType?: AttrVal<unknown>;
859
+ }
860
+
861
+ export interface IDotProgress extends IDotGlobalAttrs<HTMLProgressElement> {
862
+ max?: AttrVal<number>;
863
+ value?: AttrVal<number>;
864
+ }
865
+
866
+ export interface IDotQ extends IDotGlobalAttrs<HTMLQuoteElement> {
867
+ quoteCite?: AttrVal<string>; // alias for cite
868
+ }
869
+
870
+ export interface IDotSelect extends IDotGlobalAttrs<HTMLSelectElement> {
871
+ autoFocus?: AttrVal<boolean>;
872
+ disabled?: AttrVal<boolean>;
873
+ multiple?: AttrVal<boolean>;
874
+ name?: AttrVal<string>;
875
+ required?: AttrVal<boolean>;
876
+ size?: AttrVal<number>;
877
+ whichForm?: AttrVal<string>; // alias for form
878
+ value?: AttrVal<string>; // Pseudo attribute for convenience.
879
+ }
880
+
881
+ export interface IDotSource extends IDotGlobalAttrs<HTMLSourceElement> {
882
+ media?: AttrVal<string>;
883
+ src?: AttrVal<string>;
884
+ type?: AttrVal<string>;
885
+ sizes?: AttrVal<string>;
886
+ srcSet?: AttrVal<string>;
887
+ }
888
+ export interface IDotTable extends IDotGlobalAttrs<HTMLTableElement> {
889
+ /** @deprecated Deprecated in HTML5. Use CSS. */
890
+ border?: AttrVal<string> | AttrVal<number>;
891
+ /** @deprecated Deprecated in HTML5. Use CSS. */
892
+ cellPadding?: AttrVal<string> | AttrVal<number>;
893
+ /** @deprecated Deprecated in HTML5. Use CSS. */
894
+ cellSpacing?: AttrVal<string> | AttrVal<number>;
895
+ /** @deprecated Deprecated in HTML5. Use CSS. */
896
+ frame?: AttrVal<string> | AttrVal<number>;
897
+ /** @deprecated Deprecated in HTML5. */
898
+ height?: AttrVal<number>;
899
+ /** @deprecated Deprecated in HTML5. Use CSS. */
900
+ rules?: AttrVal<string>;
901
+ /** @deprecated Deprecated in HTML5. */
902
+ tableSummary?: AttrVal<string>;
903
+ /** @deprecated Deprecated in HTML5. */
904
+ width?: AttrVal<number>;
905
+ }
906
+
907
+ export interface IDotTextArea extends IDotGlobalAttrs<HTMLTextAreaElement> {
908
+ autoCapitalize?: AttrVal<"none"> | AttrVal<"sentences"> | AttrVal<"words"> | AttrVal<"characters">;
909
+ autoFocus?: AttrVal<boolean>;
910
+ cols?: AttrVal<number>;
911
+ dirName?: AttrVal<string>;
912
+ disabled?: AttrVal<boolean>;
913
+ enterKeyHint?: AttrVal<"enter"> | AttrVal<"done"> | AttrVal<"go"> | AttrVal<"next"> | AttrVal<"preveous"> | AttrVal<"search"> | AttrVal<"send">;
914
+ maxLength?: AttrVal<number>;
915
+ name?: AttrVal<string>;
916
+ placeholder?: AttrVal<string>;
917
+ readOnly?: AttrVal<boolean>;
918
+ required?: AttrVal<boolean>;
919
+ rows?: AttrVal<number>;
920
+ whichForm?: AttrVal<string>; // alias for form
921
+ wrap?: AttrVal<string>;
922
+ value?: AttrVal<string>; // Pseudo attribute for convenience.
923
+ }
924
+
925
+ export interface IDotTBody extends IDotGlobalAttrs<HTMLTableSectionElement> {
926
+ /** @deprecated Deprecated in HTML5. Use CSS. */
927
+ charOff?: AttrVal<unknown>;
928
+ /** @deprecated Deprecated in HTML5. Use CSS. */
929
+ vAlign?: AttrVal<unknown>;
930
+ }
931
+
932
+ export interface IDotTd extends IDotGlobalAttrs<HTMLTableCellElement> {
933
+
934
+ /** @deprecated Deprecated in HTML5. Use CSS. */
935
+ axis?: AttrVal<string>;
936
+ /** @deprecated Deprecated in HTML5. Use CSS. */
937
+ char?: AttrVal<string>;
938
+ colSpan?: AttrVal<number>;
939
+ /** @deprecated Deprecated in HTML5. Use CSS. */
940
+ charOff?: AttrVal<string>;
941
+ headers?: AttrVal<string>;
942
+ /** @deprecated Deprecated in HTML5. Use CSS. */
943
+ noWrap?: AttrVal<boolean>;
944
+ rowSpan?: AttrVal<number>;
945
+ scope?: AttrVal<string>;
946
+ /** @deprecated Deprecated in HTML5. Use CSS. */
947
+ vAlign?: AttrVal<string>;
948
+ }
949
+
950
+ export interface IDotTFoot extends IDotGlobalAttrs<HTMLTableSectionElement> {
951
+ /** @deprecated Deprecated in HTML5. Use CSS. */
952
+ charOff?: AttrVal<number>;
953
+ /** @deprecated Deprecated in HTML5. Use CSS. */
954
+ vAlign?: AttrVal<string>;
955
+ }
956
+
957
+ export interface IDotTime extends IDotGlobalAttrs<HTMLTimeElement> {
958
+ dateTime?: AttrVal<string>;
959
+ }
960
+
961
+ export interface IDotTh extends IDotGlobalAttrs<HTMLTableCellElement> {
962
+ /** @deprecated Deprecated in HTML5. Use CSS. */
963
+ axis?: AttrVal<string>;
964
+ colSpan?: AttrVal<number>;
965
+ /** @deprecated Deprecated in HTML5. Use CSS. */
966
+ charOff?: AttrVal<string>;
967
+ headers?: AttrVal<string>;
968
+ rowSpan?: AttrVal<number>;
969
+ scope?: AttrVal<string>;
970
+ /** @deprecated Deprecated in HTML5. Use CSS. */
971
+ vAlign?: AttrVal<string>;
972
+ }
973
+
974
+ export interface IDotTHead extends IDotGlobalAttrs<HTMLTableSectionElement> {
975
+ /** @deprecated Deprecated in HTML5. Use CSS. */
976
+ charOff?: AttrVal<string> | AttrVal<number>;
977
+ /** @deprecated Deprecated in HTML5. Use CSS. */
978
+ vAlign?: AttrVal<string>;
979
+ }
980
+
981
+ export interface IDotTr extends IDotGlobalAttrs<HTMLTableRowElement> {
982
+ /** @deprecated Deprecated in HTML5. Use CSS. */
983
+ charOff?: AttrVal<string> | AttrVal<number>;
984
+ /** @deprecated Deprecated in HTML5. Use CSS. */
985
+ vAlign?: AttrVal<string>;
986
+ }
987
+
988
+ export interface IDotTrack extends IDotGlobalAttrs<HTMLTrackElement> {
989
+ default?: AttrVal<boolean>;
990
+ kind?: AttrVal<string>;
991
+ src?: AttrVal<string>;
992
+ srcLang?: AttrVal<string>;
993
+ trackLabel?: AttrVal<string>; // alias for label
994
+
995
+ // Events:
996
+ onCueChange?: (e: Event) => void;
997
+ }
998
+
999
+ export interface IDotVideo extends IDotGlobalAttrs<HTMLVideoElement> {
1000
+ autoPlay?: AttrVal<boolean>;
1001
+ buffered?: IReactive; // Managed by browser not user. TODO: we can possibly use events to update observable objects.
1002
+ controls?: AttrVal<boolean>;
1003
+ crossOrigin?: AttrVal<"anonymous"> | AttrVal<"use-credentials">;
1004
+ height?: AttrVal<number>;
1005
+ loop?: AttrVal<boolean>;
1006
+ muted?: AttrVal<boolean>;
1007
+ playsInline?: AttrVal<boolean>;
1008
+ poster?: AttrVal<string>;
1009
+ preload?: AttrVal<"none"> | AttrVal<"metadata"> | AttrVal<"auto">;
1010
+ src?: AttrVal<string>;
1011
+ width?: AttrVal<number>;
1012
+
1013
+ // Special functions:
1014
+ // TODO:
1015
+ // pause(): IDotVideo;
1016
+ // play(): IDotVideo;
1017
+ // stop(): IDotVideo;
1018
+
1019
+ // Events:
1020
+ onAbort?: (e: Event) => void;
1021
+ onCantPlayThrough?: (e: Event) => void;
1022
+ onDurationChange?: (e: Event) => void;
1023
+ onEmptied?: (e: Event) => void;
1024
+ onEnded?: (e: Event) => void;
1025
+ onLoadedData?: (e: Event) => void;
1026
+ onLoadStart?: (e: Event) => void;
1027
+ onLoadedMetadata?: (e: Event) => void;
1028
+ onPause?: (e: Event) => void;
1029
+ onPlay?: (e: Event) => void;
1030
+ onPlaying?: (e: Event) => void;
1031
+ onProgress?: (e: Event) => void;
1032
+ onRateChange?: (e: Event) => void;
1033
+ onSeeked?: (e: Event) => void;
1034
+ onSeeking?: (e: Event) => void;
1035
+ onStalled?: (e: Event) => void;
1036
+ onSuspend?: (e: Event) => void;
1037
+ onTimeUpdate?: (e: Event) => void;
1038
+ onVolumeChange?: (e: Event) => void;
1039
+ onWaiting?: (e: Event) => void;
1040
+ onCanPlay?: (e: Event) => void;
1041
+ }