native-document 1.0.92 → 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.
Files changed (85) hide show
  1. package/dist/native-document.components.min.js +1088 -65
  2. package/dist/native-document.dev.js +695 -142
  3. package/dist/native-document.dev.js.map +1 -1
  4. package/dist/native-document.devtools.min.js +1 -1
  5. package/dist/native-document.min.js +1 -1
  6. package/docs/advanced-components.md +814 -0
  7. package/docs/anchor.md +71 -11
  8. package/docs/cache.md +888 -0
  9. package/docs/conditional-rendering.md +91 -1
  10. package/docs/core-concepts.md +9 -2
  11. package/docs/elements.md +127 -2
  12. package/docs/extending-native-document-element.md +7 -1
  13. package/docs/filters.md +1216 -0
  14. package/docs/getting-started.md +12 -3
  15. package/docs/lifecycle-events.md +10 -2
  16. package/docs/list-rendering.md +453 -54
  17. package/docs/memory-management.md +9 -7
  18. package/docs/native-document-element.md +30 -9
  19. package/docs/native-fetch.md +744 -0
  20. package/docs/observables.md +135 -6
  21. package/docs/routing.md +7 -1
  22. package/docs/state-management.md +7 -1
  23. package/docs/validation.md +8 -1
  24. package/elements.js +1 -0
  25. package/eslint.config.js +3 -3
  26. package/index.def.js +350 -0
  27. package/package.json +3 -2
  28. package/readme.md +53 -14
  29. package/src/components/$traits/HasItems.js +42 -1
  30. package/src/components/BaseComponent.js +4 -1
  31. package/src/components/accordion/Accordion.js +112 -8
  32. package/src/components/accordion/AccordionItem.js +93 -4
  33. package/src/components/alert/Alert.js +164 -4
  34. package/src/components/avatar/Avatar.js +236 -22
  35. package/src/components/menu/index.js +1 -2
  36. package/src/core/data/ObservableArray.js +120 -2
  37. package/src/core/data/ObservableChecker.js +50 -0
  38. package/src/core/data/ObservableItem.js +124 -4
  39. package/src/core/data/ObservableWhen.js +36 -6
  40. package/src/core/data/observable-helpers/array.js +12 -3
  41. package/src/core/data/observable-helpers/computed.js +17 -4
  42. package/src/core/data/observable-helpers/object.js +19 -3
  43. package/src/core/elements/content-formatter.js +138 -1
  44. package/src/core/elements/control/for-each-array.js +20 -2
  45. package/src/core/elements/control/for-each.js +17 -5
  46. package/src/core/elements/control/show-if.js +31 -15
  47. package/src/core/elements/control/show-when.js +23 -0
  48. package/src/core/elements/control/switch.js +40 -10
  49. package/src/core/elements/description-list.js +14 -0
  50. package/src/core/elements/form.js +188 -4
  51. package/src/core/elements/html5-semantics.js +44 -1
  52. package/src/core/elements/img.js +22 -10
  53. package/src/core/elements/index.js +5 -0
  54. package/src/core/elements/interactive.js +19 -1
  55. package/src/core/elements/list.js +28 -1
  56. package/src/core/elements/medias.js +29 -0
  57. package/src/core/elements/meta-data.js +34 -0
  58. package/src/core/elements/table.js +59 -0
  59. package/src/core/utils/cache.js +5 -0
  60. package/src/core/utils/helpers.js +7 -2
  61. package/src/core/utils/memoize.js +25 -16
  62. package/src/core/utils/prototypes.js +3 -2
  63. package/src/core/wrappers/AttributesWrapper.js +1 -1
  64. package/src/core/wrappers/HtmlElementWrapper.js +2 -2
  65. package/src/core/wrappers/NDElement.js +42 -2
  66. package/src/core/wrappers/NdPrototype.js +4 -0
  67. package/src/core/wrappers/TemplateCloner.js +14 -11
  68. package/src/core/wrappers/prototypes/bind-class-extensions.js +1 -1
  69. package/src/core/wrappers/prototypes/nd-element-extensions.js +3 -0
  70. package/src/router/Route.js +9 -4
  71. package/src/router/Router.js +28 -9
  72. package/src/router/errors/RouterError.js +0 -1
  73. package/types/control-flow.d.ts +9 -6
  74. package/types/elements.d.ts +496 -111
  75. package/types/filters/index.d.ts +4 -0
  76. package/types/forms.d.ts +85 -48
  77. package/types/images.d.ts +16 -9
  78. package/types/nd-element.d.ts +5 -238
  79. package/types/observable.d.ts +9 -3
  80. package/types/router.d.ts +5 -1
  81. package/types/template-cloner.ts +1 -0
  82. package/types/validator.ts +11 -1
  83. package/utils.d.ts +2 -1
  84. package/utils.js +4 -4
  85. package/src/core/utils/service.js +0 -6
@@ -1,8 +1,11 @@
1
- // DOM elements and components type definitions - Version complète
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,125 +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
- export type Attributes = Record<string, any> & {
23
- class?: string | Record<string, boolean | ObservableItem<boolean>>;
24
- style?: string | Record<string, string | ObservableItem<string>>;
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
- export type ElementFunction = (attributes?: Attributes, children?: ValidChild) => HTMLElement & { nd: NDElement };
28
- export type ElementFunctionWithoutAttrs = (children?: ValidChild) => HTMLElement & { nd: NDElement };
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
- export declare const Main: ElementFunction;
69
- export declare const Section: ElementFunction;
70
- export declare const Article: ElementFunction;
71
- export declare const Aside: ElementFunction;
72
- export declare const Nav: ElementFunction;
73
- export declare const Figure: ElementFunction;
74
- export declare const FigCaption: ElementFunction;
75
- export declare const Header: ElementFunction;
76
- export declare const Footer: ElementFunction;
77
-
78
- export declare const Details: ElementFunction;
79
- export declare const Summary: ElementFunction;
80
- export declare const Dialog: ElementFunction;
81
- export declare const Menu: ElementFunction;
82
-
83
- // Lists
84
- export declare const OrderedList: ElementFunction;
85
- export declare const UnorderedList: ElementFunction;
86
- export declare const ListItem: ElementFunction;
87
- export declare const Li: ElementFunction;
88
- export declare const Ol: ElementFunction;
89
- export declare const Ul: ElementFunction;
90
-
91
- // Media
92
- export declare const Audio: ElementFunction;
93
- export declare const Video: ElementFunction;
94
- export declare const Source: ElementFunction;
95
- export declare const Track: ElementFunction;
96
- export declare const Canvas: ElementFunction;
97
- export declare const Svg: ElementFunction;
98
-
99
- // Other elements
100
- export declare const Time: ElementFunction;
101
- export declare const Data: ElementFunction;
102
- export declare const Address: ElementFunction;
103
- export declare const Kbd: ElementFunction;
104
- export declare const Samp: ElementFunction;
105
- export declare const Var: ElementFunction;
106
- export declare const Wbr: ElementFunctionWithoutAttrs;
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
- export declare const Caption: ElementFunction;
110
- export declare const Table: ElementFunction;
111
- export declare const THead: ElementFunction;
112
- export declare const TFoot: ElementFunction;
113
- export declare const TBody: ElementFunction;
114
- export declare const Tr: ElementFunction;
115
- export declare const TRow: ElementFunction;
116
- export declare const Th: ElementFunction;
117
- export declare const THeadCell: ElementFunction;
118
- export declare const TFootCell: ElementFunction;
119
- export declare const Td: ElementFunction;
120
- export declare const TBodyCell: ElementFunction;
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
- export declare const Fragment: ElementFunction;
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: () => void;
129
- restore: () => void;
130
- clear: () => void;
131
- remove: () => void;
132
- removeChildren: () => void;
133
- insertBefore: (child: ValidChild, before: HTMLElement|Comment) => void;
134
- replaceContent: (child: ValidChild) => void;
135
- appendElement: (child: ValidChild, before: HTMLElement) => void;
136
- getByIndex: (index: number) => HTMLElement;
137
- endElement: () => Comment;
138
- startElement: () => Comment;
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;
522
+ removeWithAnchors: () => void;
139
523
  };
140
524
 
141
- // Anchor
142
- export declare function Anchor(name?: string, isUniqueChild?: boolean): AnchorDocumentFragment;
525
+ export declare function Anchor(name?: string, isUniqueChild?: boolean): AnchorDocumentFragment;
526
+
527
+ export type NdHTMLElement<T extends HTMLElement = HTMLElement> = T & { nd: NDElement };
@@ -0,0 +1,4 @@
1
+ export * from './types';
2
+ export * from './dates';
3
+ export * from './standard';
4
+ export * from './strings';