native-document 1.0.93 → 1.0.94
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/elements.js +1 -0
- package/index.def.js +350 -0
- package/package.json +1 -1
- package/src/core/elements/content-formatter.js +138 -1
- package/src/core/elements/control/for-each-array.js +1 -1
- package/src/core/elements/control/for-each.js +1 -1
- package/src/core/elements/control/show-if.js +3 -3
- package/src/core/elements/control/show-when.js +2 -2
- package/src/core/elements/control/switch.js +1 -1
- package/src/core/elements/description-list.js +14 -0
- package/src/core/elements/form.js +188 -4
- package/src/core/elements/html5-semantics.js +44 -1
- package/src/core/elements/img.js +22 -10
- package/src/core/elements/index.js +5 -0
- package/src/core/elements/interactive.js +19 -1
- package/src/core/elements/list.js +28 -1
- package/src/core/elements/medias.js +29 -0
- package/src/core/elements/meta-data.js +34 -0
- package/src/core/elements/table.js +59 -0
- package/src/core/utils/helpers.js +7 -2
- package/src/core/utils/memoize.js +1 -1
- package/src/core/wrappers/HtmlElementWrapper.js +2 -2
- package/src/core/wrappers/NDElement.js +1 -1
- package/src/core/wrappers/TemplateCloner.js +1 -1
- package/types/elements.d.ts +495 -113
- package/types/forms.d.ts +85 -48
- package/types/images.d.ts +16 -9
package/types/elements.d.ts
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
|
-
// DOM elements and components type definitions
|
|
1
|
+
// DOM elements and components type definitions
|
|
2
2
|
import { ObservableItem } from './observable';
|
|
3
|
-
import {BindingHydrator} from "./template-cloner";
|
|
4
|
-
import {NDElement} from "./nd-element";
|
|
3
|
+
import { BindingHydrator } from "./template-cloner";
|
|
4
|
+
import { NDElement } from "./nd-element";
|
|
5
5
|
|
|
6
|
+
// ─────────────────────────────────────────────
|
|
7
|
+
// Base types
|
|
8
|
+
// ─────────────────────────────────────────────
|
|
6
9
|
|
|
7
10
|
export type ValidChild =
|
|
8
11
|
| string
|
|
@@ -18,128 +21,507 @@ export type ValidChild =
|
|
|
18
21
|
| ValidChild[]
|
|
19
22
|
| ((...args: any[]) => ValidChild);
|
|
20
23
|
|
|
24
|
+
type Observable<T> = ObservableItem<T> | T;
|
|
21
25
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
+
type NdClassMap = Record<string, Observable<boolean>>;
|
|
27
|
+
type NdStyleMap = Record<string, Observable<string>>;
|
|
28
|
+
|
|
29
|
+
// ─────────────────────────────────────────────
|
|
30
|
+
// Shared attribute sets
|
|
31
|
+
// ─────────────────────────────────────────────
|
|
32
|
+
|
|
33
|
+
interface GlobalAttributes {
|
|
34
|
+
id?: Observable<string>;
|
|
35
|
+
class?: Observable<string> | NdClassMap | string;
|
|
36
|
+
style?: Observable<NdStyleMap> | NdStyleMap | string;
|
|
37
|
+
title?: string;
|
|
38
|
+
lang?: string;
|
|
39
|
+
dir?: 'ltr' | 'rtl' | 'auto';
|
|
40
|
+
hidden?: Observable<boolean>;
|
|
41
|
+
draggable?: Observable<boolean>;
|
|
42
|
+
contenteditable?: Observable<boolean>;
|
|
43
|
+
contentEditable?: Observable<boolean>;
|
|
44
|
+
tabindex?: string | number;
|
|
45
|
+
tabIndex?: string | number;
|
|
46
|
+
accesskey?: string;
|
|
47
|
+
accessKey?: string;
|
|
48
|
+
spellcheck?: Observable<boolean>;
|
|
49
|
+
spellCheck?: Observable<boolean>;
|
|
50
|
+
role?: string;
|
|
51
|
+
[key: `data-${string}`]: string;
|
|
52
|
+
[key: `aria-${string}`]: string;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
interface SharedFormAttributes {
|
|
56
|
+
name?: string;
|
|
57
|
+
disabled?: Observable<boolean>;
|
|
58
|
+
required?: Observable<boolean>;
|
|
59
|
+
autofocus?: Observable<boolean>;
|
|
60
|
+
autoFocus?: Observable<boolean>;
|
|
61
|
+
form?: string;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
// ─────────────────────────────────────────────
|
|
65
|
+
// Element-specific attribute interfaces
|
|
66
|
+
// ─────────────────────────────────────────────
|
|
67
|
+
|
|
68
|
+
interface AnchorAttributes extends GlobalAttributes {
|
|
69
|
+
href?: Observable<string>;
|
|
70
|
+
target?: '_blank' | '_self' | '_parent' | '_top' | string;
|
|
71
|
+
rel?: string;
|
|
72
|
+
download?: Observable<boolean> | boolean | string;
|
|
73
|
+
hreflang?: string;
|
|
74
|
+
hrefLang?: string;
|
|
75
|
+
type?: string;
|
|
76
|
+
referrerpolicy?: string;
|
|
77
|
+
referrerPolicy?: string;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
interface ImgAttributes extends GlobalAttributes {
|
|
81
|
+
src?: Observable<string>;
|
|
82
|
+
alt?: Observable<string>;
|
|
83
|
+
width?: Observable<string> | string | number;
|
|
84
|
+
height?: Observable<string> | string | number;
|
|
85
|
+
loading?: 'lazy' | 'eager' | 'auto';
|
|
86
|
+
decoding?: 'async' | 'sync' | 'auto';
|
|
87
|
+
srcset?: string;
|
|
88
|
+
srcSet?: string;
|
|
89
|
+
sizes?: string;
|
|
90
|
+
crossorigin?: 'anonymous' | 'use-credentials';
|
|
91
|
+
crossOrigin?: 'anonymous' | 'use-credentials';
|
|
92
|
+
referrerpolicy?: string;
|
|
93
|
+
referrerPolicy?: string;
|
|
94
|
+
fetchpriority?: 'high' | 'low' | 'auto';
|
|
95
|
+
fetchPriority?: 'high' | 'low' | 'auto';
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
interface InputAttributes extends GlobalAttributes, SharedFormAttributes {
|
|
99
|
+
type?: 'text' | 'email' | 'password' | 'number' | 'tel' | 'url' | 'search' |
|
|
100
|
+
'date' | 'time' | 'datetime-local' | 'week' | 'month' |
|
|
101
|
+
'checkbox' | 'radio' | 'range' | 'color' | 'file' | 'hidden';
|
|
102
|
+
value?: Observable<string>;
|
|
103
|
+
placeholder?: Observable<string>;
|
|
104
|
+
checked?: Observable<boolean>;
|
|
105
|
+
readonly?: Observable<boolean>;
|
|
106
|
+
readOnly?: Observable<boolean>;
|
|
107
|
+
multiple?: Observable<boolean>;
|
|
108
|
+
min?: Observable<string> | string | number;
|
|
109
|
+
max?: Observable<string> | string | number;
|
|
110
|
+
step?: Observable<string> | string | number;
|
|
111
|
+
minlength?: number;
|
|
112
|
+
minLength?: number;
|
|
113
|
+
maxlength?: number;
|
|
114
|
+
maxLength?: number;
|
|
115
|
+
pattern?: string;
|
|
116
|
+
accept?: string;
|
|
117
|
+
autocomplete?: 'on' | 'off' | string;
|
|
118
|
+
autoComplete?: 'on' | 'off' | string;
|
|
119
|
+
list?: string;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
interface TextAreaAttributes extends GlobalAttributes, SharedFormAttributes {
|
|
123
|
+
value?: Observable<string>;
|
|
124
|
+
placeholder?: Observable<string>;
|
|
125
|
+
readonly?: Observable<boolean>;
|
|
126
|
+
readOnly?: Observable<boolean>;
|
|
127
|
+
rows?: number;
|
|
128
|
+
cols?: number;
|
|
129
|
+
minlength?: number;
|
|
130
|
+
minLength?: number;
|
|
131
|
+
maxlength?: number;
|
|
132
|
+
maxLength?: number;
|
|
133
|
+
wrap?: 'hard' | 'soft' | 'off';
|
|
134
|
+
autocomplete?: 'on' | 'off' | string;
|
|
135
|
+
autoComplete?: 'on' | 'off' | string;
|
|
136
|
+
spellcheck?: Observable<boolean>;
|
|
137
|
+
spellCheck?: Observable<boolean>;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
interface SelectAttributes extends GlobalAttributes, SharedFormAttributes {
|
|
141
|
+
value?: Observable<string>;
|
|
142
|
+
multiple?: Observable<boolean>;
|
|
143
|
+
size?: number;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
interface OptionAttributes extends GlobalAttributes {
|
|
147
|
+
value?: Observable<string>;
|
|
148
|
+
selected?: Observable<boolean>;
|
|
149
|
+
disabled?: Observable<boolean>;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
interface FormAttributes extends GlobalAttributes, SharedFormAttributes {
|
|
153
|
+
action?: string;
|
|
154
|
+
method?: 'get' | 'post';
|
|
155
|
+
enctype?: 'application/x-www-form-urlencoded' | 'multipart/form-data' | 'text/plain';
|
|
156
|
+
encType?: 'application/x-www-form-urlencoded' | 'multipart/form-data' | 'text/plain';
|
|
157
|
+
novalidate?: Observable<boolean>;
|
|
158
|
+
noValidate?: Observable<boolean>;
|
|
159
|
+
target?: '_blank' | '_self' | '_parent' | '_top' | string;
|
|
160
|
+
autocomplete?: 'on' | 'off';
|
|
161
|
+
autoComplete?: 'on' | 'off';
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
interface ButtonAttributes extends GlobalAttributes, SharedFormAttributes {
|
|
165
|
+
type?: 'button' | 'submit' | 'reset';
|
|
166
|
+
value?: Observable<string>;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
interface VideoAttributes extends GlobalAttributes {
|
|
170
|
+
src?: Observable<string>;
|
|
171
|
+
autoplay?: Observable<boolean>;
|
|
172
|
+
autoPlay?: Observable<boolean>;
|
|
173
|
+
controls?: Observable<boolean>;
|
|
174
|
+
loop?: Observable<boolean>;
|
|
175
|
+
muted?: Observable<boolean>;
|
|
176
|
+
preload?: 'auto' | 'metadata' | 'none';
|
|
177
|
+
width?: Observable<string> | string | number;
|
|
178
|
+
height?: Observable<string> | string | number;
|
|
179
|
+
poster?: string;
|
|
180
|
+
playsinline?: Observable<boolean>;
|
|
181
|
+
playsInline?: Observable<boolean>;
|
|
182
|
+
crossorigin?: 'anonymous' | 'use-credentials';
|
|
183
|
+
crossOrigin?: 'anonymous' | 'use-credentials';
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
interface AudioAttributes extends GlobalAttributes {
|
|
187
|
+
src?: Observable<string>;
|
|
188
|
+
autoplay?: Observable<boolean>;
|
|
189
|
+
autoPlay?: Observable<boolean>;
|
|
190
|
+
controls?: Observable<boolean>;
|
|
191
|
+
loop?: Observable<boolean>;
|
|
192
|
+
muted?: Observable<boolean>;
|
|
193
|
+
preload?: 'auto' | 'metadata' | 'none';
|
|
194
|
+
crossorigin?: 'anonymous' | 'use-credentials';
|
|
195
|
+
crossOrigin?: 'anonymous' | 'use-credentials';
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
interface CanvasAttributes extends GlobalAttributes {
|
|
199
|
+
width?: Observable<string> | string | number;
|
|
200
|
+
height?: Observable<string> | string | number;
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
interface DetailsAttributes extends GlobalAttributes {
|
|
204
|
+
open?: Observable<boolean>;
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
interface DialogAttributes extends GlobalAttributes {
|
|
208
|
+
open?: Observable<boolean>;
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
interface ProgressAttributes extends GlobalAttributes {
|
|
212
|
+
value?: Observable<string> | string | number;
|
|
213
|
+
max?: number;
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
interface MeterAttributes extends GlobalAttributes {
|
|
217
|
+
value?: Observable<string> | string | number;
|
|
218
|
+
min?: number;
|
|
219
|
+
max?: number;
|
|
220
|
+
low?: number;
|
|
221
|
+
high?: number;
|
|
222
|
+
optimum?: number;
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
interface SourceAttributes extends GlobalAttributes {
|
|
226
|
+
src?: string;
|
|
227
|
+
type?: string;
|
|
228
|
+
media?: string;
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
interface TrackAttributes extends GlobalAttributes {
|
|
232
|
+
src?: string;
|
|
233
|
+
kind?: 'subtitles' | 'captions' | 'descriptions' | 'chapters' | 'metadata';
|
|
234
|
+
srclang?: string;
|
|
235
|
+
srcLang?: string;
|
|
236
|
+
label?: string;
|
|
237
|
+
default?: Observable<boolean>;
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
interface ThAttributes extends GlobalAttributes {
|
|
241
|
+
colspan?: number;
|
|
242
|
+
colSpan?: number;
|
|
243
|
+
rowspan?: number;
|
|
244
|
+
rowSpan?: number;
|
|
245
|
+
headers?: string;
|
|
246
|
+
scope?: 'row' | 'col' | 'rowgroup' | 'colgroup';
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
interface TdAttributes extends GlobalAttributes {
|
|
250
|
+
colspan?: number;
|
|
251
|
+
colSpan?: number;
|
|
252
|
+
rowspan?: number;
|
|
253
|
+
rowSpan?: number;
|
|
254
|
+
headers?: string;
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
interface LabelAttributes extends GlobalAttributes {
|
|
258
|
+
for?: string;
|
|
259
|
+
htmlFor?: string;
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
interface OutputAttributes extends GlobalAttributes {
|
|
263
|
+
for?: string;
|
|
264
|
+
form?: string;
|
|
265
|
+
name?: string;
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
interface TimeAttributes extends GlobalAttributes {
|
|
269
|
+
datetime?: string;
|
|
270
|
+
dateTime?: string;
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
interface ModAttributes extends GlobalAttributes {
|
|
274
|
+
cite?: string;
|
|
275
|
+
datetime?: string;
|
|
276
|
+
dateTime?: string;
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
interface OlAttributes extends GlobalAttributes {
|
|
280
|
+
reversed?: Observable<boolean>;
|
|
281
|
+
start?: number;
|
|
282
|
+
type?: '1' | 'a' | 'A' | 'i' | 'I';
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
interface SvgAttributes extends GlobalAttributes {
|
|
286
|
+
viewBox?: string;
|
|
287
|
+
viewbox?: string;
|
|
288
|
+
xmlns?: string;
|
|
289
|
+
width?: Observable<string> | string | number;
|
|
290
|
+
height?: Observable<string> | string | number;
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
// ─────────────────────────────────────────────
|
|
294
|
+
// Element function return type
|
|
295
|
+
// ─────────────────────────────────────────────
|
|
296
|
+
|
|
297
|
+
type NdElement<T extends Element = HTMLElement> = T & { nd: NDElement };
|
|
26
298
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
// HTML Elements
|
|
31
|
-
export declare const Link: ElementFunction;
|
|
32
|
-
export declare const Abbr: ElementFunction;
|
|
33
|
-
export declare const Cite: ElementFunction;
|
|
34
|
-
export declare const Quote: ElementFunction;
|
|
35
|
-
|
|
36
|
-
// Lists
|
|
37
|
-
export declare const Dl: ElementFunction;
|
|
38
|
-
export declare const Dt: ElementFunction;
|
|
39
|
-
export declare const Dd: ElementFunction;
|
|
40
|
-
|
|
41
|
-
export declare const Div: ElementFunction;
|
|
42
|
-
export declare const Span: ElementFunction;
|
|
43
|
-
export declare const P: ElementFunction;
|
|
44
|
-
export declare const Paragraph: ElementFunction;
|
|
45
|
-
export declare const Strong: ElementFunction;
|
|
46
|
-
export declare const H1: ElementFunction;
|
|
47
|
-
export declare const H2: ElementFunction;
|
|
48
|
-
export declare const H3: ElementFunction;
|
|
49
|
-
export declare const H4: ElementFunction;
|
|
50
|
-
export declare const H5: ElementFunction;
|
|
51
|
-
export declare const H6: ElementFunction;
|
|
52
|
-
export declare const Label: ElementFunction;
|
|
53
|
-
export declare const Br: ElementFunctionWithoutAttrs;
|
|
54
|
-
export declare const Hr: ElementFunctionWithoutAttrs;
|
|
55
|
-
|
|
56
|
-
export declare const Pre: ElementFunction;
|
|
57
|
-
export declare const Code: ElementFunction;
|
|
58
|
-
export declare const Blockquote: ElementFunction;
|
|
59
|
-
export declare const Em: ElementFunction;
|
|
60
|
-
export declare const Small: ElementFunction;
|
|
61
|
-
export declare const Mark: ElementFunction;
|
|
62
|
-
export declare const Del: ElementFunction;
|
|
63
|
-
export declare const Ins: ElementFunction;
|
|
64
|
-
export declare const Sub: ElementFunction;
|
|
65
|
-
export declare const Sup: ElementFunction;
|
|
299
|
+
type ElementFunction<A = GlobalAttributes, T extends Element = HTMLElement> =
|
|
300
|
+
(attributes?: A, children?: ValidChild) => NdElement<T>;
|
|
66
301
|
|
|
302
|
+
type ElementFunctionNoChildren<A = GlobalAttributes, T extends Element = HTMLElement> =
|
|
303
|
+
(attributes?: A) => NdElement<T>;
|
|
304
|
+
|
|
305
|
+
// ─────────────────────────────────────────────
|
|
306
|
+
// Text elements
|
|
307
|
+
// ─────────────────────────────────────────────
|
|
308
|
+
|
|
309
|
+
export declare const Div: ElementFunction<GlobalAttributes, HTMLDivElement>;
|
|
310
|
+
export declare const Span: ElementFunction<GlobalAttributes, HTMLSpanElement>;
|
|
311
|
+
export declare const P: ElementFunction<GlobalAttributes, HTMLParagraphElement>;
|
|
312
|
+
export declare const Paragraph: typeof P;
|
|
313
|
+
export declare const Strong: ElementFunction<GlobalAttributes, HTMLElement>;
|
|
314
|
+
export declare const H1: ElementFunction<GlobalAttributes, HTMLHeadingElement>;
|
|
315
|
+
export declare const H2: ElementFunction<GlobalAttributes, HTMLHeadingElement>;
|
|
316
|
+
export declare const H3: ElementFunction<GlobalAttributes, HTMLHeadingElement>;
|
|
317
|
+
export declare const H4: ElementFunction<GlobalAttributes, HTMLHeadingElement>;
|
|
318
|
+
export declare const H5: ElementFunction<GlobalAttributes, HTMLHeadingElement>;
|
|
319
|
+
export declare const H6: ElementFunction<GlobalAttributes, HTMLHeadingElement>;
|
|
320
|
+
export declare const Pre: ElementFunction<GlobalAttributes, HTMLPreElement>;
|
|
321
|
+
export declare const Code: ElementFunction<GlobalAttributes, HTMLElement>;
|
|
322
|
+
export declare const Blockquote: ElementFunction<GlobalAttributes & { cite?: string }, HTMLQuoteElement>;
|
|
323
|
+
export declare const Em: ElementFunction<GlobalAttributes, HTMLElement>;
|
|
324
|
+
export declare const Small: ElementFunction<GlobalAttributes, HTMLElement>;
|
|
325
|
+
export declare const Mark: ElementFunction<GlobalAttributes, HTMLElement>;
|
|
326
|
+
export declare const Del: ElementFunction<ModAttributes, HTMLModElement>;
|
|
327
|
+
export declare const Ins: ElementFunction<ModAttributes, HTMLModElement>;
|
|
328
|
+
export declare const Sub: ElementFunction<GlobalAttributes, HTMLElement>;
|
|
329
|
+
export declare const Sup: ElementFunction<GlobalAttributes, HTMLElement>;
|
|
330
|
+
export declare const Abbr: ElementFunction<GlobalAttributes, HTMLElement>;
|
|
331
|
+
export declare const Cite: ElementFunction<GlobalAttributes, HTMLElement>;
|
|
332
|
+
export declare const Quote: ElementFunction<GlobalAttributes & { cite?: string }, HTMLQuoteElement>;
|
|
333
|
+
export declare const Br: ElementFunctionNoChildren<GlobalAttributes, HTMLBRElement>;
|
|
334
|
+
export declare const Hr: ElementFunctionNoChildren<GlobalAttributes, HTMLHRElement>;
|
|
335
|
+
|
|
336
|
+
// ─────────────────────────────────────────────
|
|
67
337
|
// Semantic elements
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
export declare const
|
|
71
|
-
export declare const
|
|
72
|
-
export declare const
|
|
73
|
-
export declare const
|
|
74
|
-
export declare const
|
|
75
|
-
export declare const
|
|
76
|
-
export declare const
|
|
77
|
-
|
|
78
|
-
export declare const
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
export declare const
|
|
85
|
-
export declare const
|
|
86
|
-
export declare const
|
|
87
|
-
export declare const
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
//
|
|
92
|
-
|
|
93
|
-
export declare const
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
338
|
+
// ─────────────────────────────────────────────
|
|
339
|
+
|
|
340
|
+
export declare const Main: ElementFunction<GlobalAttributes, HTMLElement>;
|
|
341
|
+
export declare const Section: ElementFunction<GlobalAttributes, HTMLElement>;
|
|
342
|
+
export declare const Article: ElementFunction<GlobalAttributes, HTMLElement>;
|
|
343
|
+
export declare const Aside: ElementFunction<GlobalAttributes, HTMLElement>;
|
|
344
|
+
export declare const Nav: ElementFunction<GlobalAttributes, HTMLElement>;
|
|
345
|
+
export declare const Figure: ElementFunction<GlobalAttributes, HTMLElement>;
|
|
346
|
+
export declare const FigCaption: ElementFunction<GlobalAttributes, HTMLElement>;
|
|
347
|
+
export declare const Header: ElementFunction<GlobalAttributes, HTMLElement>;
|
|
348
|
+
export declare const Footer: ElementFunction<GlobalAttributes, HTMLElement>;
|
|
349
|
+
|
|
350
|
+
// ─────────────────────────────────────────────
|
|
351
|
+
// Interactive elements
|
|
352
|
+
// ─────────────────────────────────────────────
|
|
353
|
+
|
|
354
|
+
export declare const Details: ElementFunction<DetailsAttributes, HTMLDetailsElement>;
|
|
355
|
+
export declare const Summary: ElementFunction<GlobalAttributes, HTMLElement>;
|
|
356
|
+
export declare const Dialog: ElementFunction<DialogAttributes, HTMLDialogElement>;
|
|
357
|
+
export declare const Menu: ElementFunction<GlobalAttributes, HTMLMenuElement>;
|
|
358
|
+
|
|
359
|
+
// ─────────────────────────────────────────────
|
|
360
|
+
// Link
|
|
361
|
+
// ─────────────────────────────────────────────
|
|
362
|
+
|
|
363
|
+
export declare const Link: ElementFunction<AnchorAttributes, HTMLAnchorElement>;
|
|
364
|
+
|
|
365
|
+
// ─────────────────────────────────────────────
|
|
366
|
+
// Form elements
|
|
367
|
+
// ─────────────────────────────────────────────
|
|
368
|
+
|
|
369
|
+
export declare const Form: (
|
|
370
|
+
attributes?: FormAttributes,
|
|
371
|
+
children?: ValidChild
|
|
372
|
+
) => NdElement<HTMLFormElement> & {
|
|
373
|
+
submit: (actionOrFn: string | ((e: SubmitEvent) => void)) => NdElement<HTMLFormElement>;
|
|
374
|
+
post: (action: string) => NdElement<HTMLFormElement>;
|
|
375
|
+
get: (action: string) => NdElement<HTMLFormElement>;
|
|
376
|
+
multipartFormData: () => NdElement<HTMLFormElement>;
|
|
377
|
+
};
|
|
378
|
+
|
|
379
|
+
export declare const Input: ElementFunctionNoChildren<InputAttributes, HTMLInputElement>;
|
|
380
|
+
export declare const TextArea: ElementFunction<TextAreaAttributes, HTMLTextAreaElement>;
|
|
381
|
+
export declare const TextInput: typeof TextArea;
|
|
382
|
+
export declare const Select: ElementFunction<SelectAttributes, HTMLSelectElement>;
|
|
383
|
+
export declare const FieldSet: ElementFunction<GlobalAttributes & { disabled?: Observable<boolean> }, HTMLFieldSetElement>;
|
|
384
|
+
export declare const Option: ElementFunction<OptionAttributes, HTMLOptionElement>;
|
|
385
|
+
export declare const Legend: ElementFunction<GlobalAttributes, HTMLLegendElement>;
|
|
386
|
+
export declare const Label: ElementFunction<LabelAttributes, HTMLLabelElement>;
|
|
387
|
+
export declare const Datalist: ElementFunction<GlobalAttributes, HTMLDataListElement>;
|
|
388
|
+
export declare const Output: ElementFunction<OutputAttributes, HTMLOutputElement>;
|
|
389
|
+
export declare const Progress: ElementFunction<ProgressAttributes, HTMLProgressElement>;
|
|
390
|
+
export declare const Meter: ElementFunction<MeterAttributes, HTMLMeterElement>;
|
|
391
|
+
|
|
392
|
+
export declare const ReadonlyInput: (attributes?: Omit<InputAttributes, 'type' | 'readonly' | 'readOnly'>) => NdElement<HTMLInputElement>;
|
|
393
|
+
export declare const HiddenInput: (attributes?: Omit<InputAttributes, 'type'>) => NdElement<HTMLInputElement>;
|
|
394
|
+
export declare const FileInput: (attributes?: Omit<InputAttributes, 'type'>) => NdElement<HTMLInputElement>;
|
|
395
|
+
export declare const PasswordInput: (attributes?: Omit<InputAttributes, 'type'>) => NdElement<HTMLInputElement>;
|
|
396
|
+
export declare const Checkbox: (attributes?: Omit<InputAttributes, 'type'>) => NdElement<HTMLInputElement>;
|
|
397
|
+
export declare const Radio: (attributes?: Omit<InputAttributes, 'type'>) => NdElement<HTMLInputElement>;
|
|
398
|
+
export declare const RangeInput: (attributes?: Omit<InputAttributes, 'type'>) => NdElement<HTMLInputElement>;
|
|
399
|
+
export declare const ColorInput: (attributes?: Omit<InputAttributes, 'type'>) => NdElement<HTMLInputElement>;
|
|
400
|
+
export declare const DateInput: (attributes?: Omit<InputAttributes, 'type'>) => NdElement<HTMLInputElement>;
|
|
401
|
+
export declare const TimeInput: (attributes?: Omit<InputAttributes, 'type'>) => NdElement<HTMLInputElement>;
|
|
402
|
+
export declare const DateTimeInput: (attributes?: Omit<InputAttributes, 'type'>) => NdElement<HTMLInputElement>;
|
|
403
|
+
export declare const WeekInput: (attributes?: Omit<InputAttributes, 'type'>) => NdElement<HTMLInputElement>;
|
|
404
|
+
export declare const MonthInput: (attributes?: Omit<InputAttributes, 'type'>) => NdElement<HTMLInputElement>;
|
|
405
|
+
export declare const SearchInput: (attributes?: Omit<InputAttributes, 'type'>) => NdElement<HTMLInputElement>;
|
|
406
|
+
export declare const TelInput: (attributes?: Omit<InputAttributes, 'type'>) => NdElement<HTMLInputElement>;
|
|
407
|
+
export declare const UrlInput: (attributes?: Omit<InputAttributes, 'type'>) => NdElement<HTMLInputElement>;
|
|
408
|
+
export declare const EmailInput: (attributes?: Omit<InputAttributes, 'type'>) => NdElement<HTMLInputElement>;
|
|
409
|
+
export declare const NumberInput: (attributes?: Omit<InputAttributes, 'type'>) => NdElement<HTMLInputElement>;
|
|
410
|
+
|
|
411
|
+
export declare const Button: ElementFunction<ButtonAttributes, HTMLButtonElement>;
|
|
412
|
+
export declare const SimpleButton: (children?: ValidChild, attributes?: Omit<ButtonAttributes, 'type'>) => NdElement<HTMLButtonElement>;
|
|
413
|
+
export declare const SubmitButton: (children?: ValidChild, attributes?: Omit<ButtonAttributes, 'type'>) => NdElement<HTMLButtonElement>;
|
|
414
|
+
|
|
415
|
+
// ─────────────────────────────────────────────
|
|
416
|
+
// Image elements
|
|
417
|
+
// ─────────────────────────────────────────────
|
|
418
|
+
|
|
419
|
+
export declare const BaseImage: ElementFunctionNoChildren<ImgAttributes, HTMLImageElement>;
|
|
107
420
|
|
|
421
|
+
export declare function Img(
|
|
422
|
+
src: Observable<string>,
|
|
423
|
+
attributes?: Omit<ImgAttributes, 'src'>
|
|
424
|
+
): NdElement<HTMLImageElement>;
|
|
425
|
+
|
|
426
|
+
export declare function AsyncImg(
|
|
427
|
+
src: Observable<string>,
|
|
428
|
+
defaultImage: string | null,
|
|
429
|
+
attributes?: Omit<ImgAttributes, 'src'>,
|
|
430
|
+
callback?: (error: Error | null, img: HTMLImageElement) => void
|
|
431
|
+
): NdElement<HTMLImageElement>;
|
|
432
|
+
|
|
433
|
+
export declare function LazyImg(
|
|
434
|
+
src: Observable<string>,
|
|
435
|
+
attributes?: Omit<ImgAttributes, 'src' | 'loading'>
|
|
436
|
+
): NdElement<HTMLImageElement>;
|
|
437
|
+
|
|
438
|
+
// ─────────────────────────────────────────────
|
|
439
|
+
// Media elements
|
|
440
|
+
// ─────────────────────────────────────────────
|
|
441
|
+
|
|
442
|
+
export declare const Audio: ElementFunction<AudioAttributes, HTMLAudioElement>;
|
|
443
|
+
export declare const Video: ElementFunction<VideoAttributes, HTMLVideoElement>;
|
|
444
|
+
export declare const Source: ElementFunctionNoChildren<SourceAttributes, HTMLSourceElement>;
|
|
445
|
+
export declare const Track: ElementFunctionNoChildren<TrackAttributes, HTMLTrackElement>;
|
|
446
|
+
export declare const Canvas: ElementFunction<CanvasAttributes, HTMLCanvasElement>;
|
|
447
|
+
export declare const Svg: ElementFunction<SvgAttributes, HTMLElement>;
|
|
448
|
+
|
|
449
|
+
// ─────────────────────────────────────────────
|
|
450
|
+
// List elements
|
|
451
|
+
// ─────────────────────────────────────────────
|
|
452
|
+
|
|
453
|
+
export declare const OrderedList: ElementFunction<OlAttributes, HTMLOListElement>;
|
|
454
|
+
export declare const UnorderedList: ElementFunction<GlobalAttributes, HTMLUListElement>;
|
|
455
|
+
export declare const ListItem: ElementFunction<GlobalAttributes & { value?: number }, HTMLLIElement>;
|
|
456
|
+
export declare const Li: typeof ListItem;
|
|
457
|
+
export declare const Ol: typeof OrderedList;
|
|
458
|
+
export declare const Ul: typeof UnorderedList;
|
|
459
|
+
|
|
460
|
+
// ─────────────────────────────────────────────
|
|
461
|
+
// Definition list elements
|
|
462
|
+
// ─────────────────────────────────────────────
|
|
463
|
+
|
|
464
|
+
export declare const Dl: ElementFunction<GlobalAttributes, HTMLDListElement>;
|
|
465
|
+
export declare const Dt: ElementFunction<GlobalAttributes, HTMLElement>;
|
|
466
|
+
export declare const Dd: ElementFunction<GlobalAttributes, HTMLElement>;
|
|
467
|
+
|
|
468
|
+
// ─────────────────────────────────────────────
|
|
108
469
|
// Table elements
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
export declare const
|
|
112
|
-
export declare const
|
|
113
|
-
export declare const
|
|
114
|
-
export declare const
|
|
115
|
-
export declare const
|
|
116
|
-
export declare const
|
|
117
|
-
export declare const
|
|
118
|
-
export declare const
|
|
119
|
-
export declare const
|
|
120
|
-
export declare const
|
|
470
|
+
// ─────────────────────────────────────────────
|
|
471
|
+
|
|
472
|
+
export declare const Caption: ElementFunction<GlobalAttributes, HTMLTableCaptionElement>;
|
|
473
|
+
export declare const Table: ElementFunction<GlobalAttributes, HTMLTableElement>;
|
|
474
|
+
export declare const THead: ElementFunction<GlobalAttributes, HTMLTableSectionElement>;
|
|
475
|
+
export declare const TFoot: ElementFunction<GlobalAttributes, HTMLTableSectionElement>;
|
|
476
|
+
export declare const TBody: ElementFunction<GlobalAttributes, HTMLTableSectionElement>;
|
|
477
|
+
export declare const Tr: ElementFunction<GlobalAttributes, HTMLTableRowElement>;
|
|
478
|
+
export declare const TRow: typeof Tr;
|
|
479
|
+
export declare const Th: ElementFunction<ThAttributes, HTMLTableCellElement>;
|
|
480
|
+
export declare const THeadCell: typeof Th;
|
|
481
|
+
export declare const TFootCell: typeof Th;
|
|
482
|
+
export declare const Td: ElementFunction<TdAttributes, HTMLTableCellElement>;
|
|
483
|
+
export declare const TBodyCell: typeof Td;
|
|
484
|
+
|
|
485
|
+
// ─────────────────────────────────────────────
|
|
486
|
+
// Misc elements
|
|
487
|
+
// ─────────────────────────────────────────────
|
|
488
|
+
|
|
489
|
+
export declare const Time: ElementFunction<TimeAttributes, HTMLTimeElement>;
|
|
490
|
+
export declare const Data: ElementFunction<GlobalAttributes & { value?: Observable<string> }, HTMLDataElement>;
|
|
491
|
+
export declare const Address: ElementFunction<GlobalAttributes, HTMLElement>;
|
|
492
|
+
export declare const Kbd: ElementFunction<GlobalAttributes, HTMLElement>;
|
|
493
|
+
export declare const Samp: ElementFunction<GlobalAttributes, HTMLElement>;
|
|
494
|
+
export declare const Var: ElementFunction<GlobalAttributes, HTMLElement>;
|
|
495
|
+
export declare const Wbr: ElementFunctionNoChildren<GlobalAttributes, HTMLElement>;
|
|
121
496
|
|
|
497
|
+
// ─────────────────────────────────────────────
|
|
122
498
|
// Fragment
|
|
123
|
-
|
|
499
|
+
// ─────────────────────────────────────────────
|
|
500
|
+
|
|
501
|
+
export declare const Fragment: ElementFunction<GlobalAttributes, HTMLElement>;
|
|
124
502
|
export declare const NativeDocumentFragment: typeof Anchor;
|
|
125
503
|
|
|
504
|
+
// ─────────────────────────────────────────────
|
|
505
|
+
// Anchor
|
|
506
|
+
// ─────────────────────────────────────────────
|
|
126
507
|
|
|
127
508
|
export declare type AnchorDocumentFragment = DocumentFragment & {
|
|
128
|
-
detach:
|
|
129
|
-
restore:
|
|
130
|
-
clear:
|
|
131
|
-
remove:
|
|
132
|
-
removeChildren:
|
|
133
|
-
insertBefore:
|
|
134
|
-
replaceContent:
|
|
135
|
-
setContent:
|
|
136
|
-
appendElement:
|
|
137
|
-
append:
|
|
138
|
-
getByIndex:
|
|
139
|
-
endElement:
|
|
140
|
-
startElement:
|
|
509
|
+
detach: () => void;
|
|
510
|
+
restore: () => void;
|
|
511
|
+
clear: () => void;
|
|
512
|
+
remove: () => void;
|
|
513
|
+
removeChildren: () => void;
|
|
514
|
+
insertBefore: (child: ValidChild, before: HTMLElement | Comment | null) => void;
|
|
515
|
+
replaceContent: (child: ValidChild) => void;
|
|
516
|
+
setContent: (child: ValidChild) => void;
|
|
517
|
+
appendElement: (child: ValidChild, before: HTMLElement | Comment | null) => void;
|
|
518
|
+
append: (...args: ValidChild[]) => void;
|
|
519
|
+
getByIndex: (index: number) => HTMLElement | null;
|
|
520
|
+
endElement: () => Comment;
|
|
521
|
+
startElement: () => Comment;
|
|
141
522
|
removeWithAnchors: () => void;
|
|
142
523
|
};
|
|
143
524
|
|
|
144
|
-
|
|
145
|
-
|
|
525
|
+
export declare function Anchor(name?: string, isUniqueChild?: boolean): AnchorDocumentFragment;
|
|
526
|
+
|
|
527
|
+
export type NdHTMLElement<T extends HTMLElement = HTMLElement> = T & { nd: NDElement };
|