domma-js 1.1.0 → 1.2.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 (66) hide show
  1. package/README.md +6 -0
  2. package/assets/types/catalogue.json +29 -29
  3. package/assets/types/generated/public/assets/icons/code.d.ts +236 -1
  4. package/assets/types/generated/src/auth.d.ts +38 -38
  5. package/assets/types/generated/src/avatar.d.ts +31 -31
  6. package/assets/types/generated/src/binding-source.d.ts +3 -3
  7. package/assets/types/generated/src/component-factory.d.ts +15 -15
  8. package/assets/types/generated/src/component.d.ts +4 -4
  9. package/assets/types/generated/src/components/back-to-top.d.ts +18 -18
  10. package/assets/types/generated/src/components/badge.d.ts +26 -26
  11. package/assets/types/generated/src/components/card.d.ts +30 -30
  12. package/assets/types/generated/src/components/command-palette.d.ts +69 -69
  13. package/assets/types/generated/src/components/dropzone.d.ts +54 -54
  14. package/assets/types/generated/src/components/focus-trap.d.ts +22 -22
  15. package/assets/types/generated/src/components/loader.d.ts +15 -15
  16. package/assets/types/generated/src/components/modal.d.ts +59 -59
  17. package/assets/types/generated/src/components/range-slider.d.ts +54 -54
  18. package/assets/types/generated/src/components/shared.d.ts +1 -1
  19. package/assets/types/generated/src/components/split-pane.d.ts +45 -45
  20. package/assets/types/generated/src/components/toast.d.ts +38 -38
  21. package/assets/types/generated/src/components/tooltip.d.ts +24 -24
  22. package/assets/types/generated/src/components/virtual-list.d.ts +61 -61
  23. package/assets/types/generated/src/config.d.ts +21 -21
  24. package/assets/types/generated/src/context-cursor.d.ts +6 -6
  25. package/assets/types/generated/src/context-menu.d.ts +72 -72
  26. package/assets/types/generated/src/dom.d.ts +12 -12
  27. package/assets/types/generated/src/effects.d.ts +154 -141
  28. package/assets/types/generated/src/elements.d.ts +644 -644
  29. package/assets/types/generated/src/flags.d.ts +38 -38
  30. package/assets/types/generated/src/forms.d.ts +100 -100
  31. package/assets/types/generated/src/globals.d.ts +6 -6
  32. package/assets/types/generated/src/http.d.ts +12 -12
  33. package/assets/types/generated/src/i18n.d.ts +8 -8
  34. package/assets/types/generated/src/icons.d.ts +13 -13
  35. package/assets/types/generated/src/index.d.ts +10 -10
  36. package/assets/types/generated/src/input-group.d.ts +21 -21
  37. package/assets/types/generated/src/models.d.ts +21 -21
  38. package/assets/types/generated/src/popover.d.ts +45 -45
  39. package/assets/types/generated/src/router.d.ts +30 -30
  40. package/assets/types/generated/src/sanitize.d.ts +13 -5
  41. package/assets/types/generated/src/schema-builder.d.ts +34 -34
  42. package/assets/types/generated/src/skeleton.d.ts +11 -11
  43. package/assets/types/generated/src/sortable.d.ts +46 -46
  44. package/assets/types/generated/src/tables.d.ts +75 -75
  45. package/assets/types/generated/src/theme.d.ts +8 -8
  46. package/assets/types/generated/src/treeview.d.ts +48 -48
  47. package/assets/types/generated/src/utils.d.ts +13 -13
  48. package/assets/types/generated/vendor/domma-reactive.d.ts +2 -2
  49. package/package.json +22 -16
  50. package/public/dist/bundles/domma-complete.css +53 -14
  51. package/public/dist/bundles/domma-data-focused.css +53 -14
  52. package/public/dist/bundles/domma-essentials.css +53 -14
  53. package/public/dist/bundles/domma-full.css +53 -14
  54. package/public/dist/bundles/domma-minimal.css +47 -8
  55. package/public/dist/domma-flags.esm.js +3 -3
  56. package/public/dist/domma-flags.min.js +3 -3
  57. package/public/dist/domma-syntax.min.js +3 -3
  58. package/public/dist/domma.css +42 -3
  59. package/public/dist/domma.esm.js +4 -4
  60. package/public/dist/domma.esm.js.map +1 -1
  61. package/public/dist/domma.min.js +4 -4
  62. package/public/dist/domma.min.js.map +1 -1
  63. package/public/dist/elements.css +3 -3
  64. package/public/dist/grid.css +3 -3
  65. package/public/dist/syntax.css +3 -3
  66. package/public/dist/themes/domma-themes.css +3 -3
@@ -82,30 +82,30 @@ export type RequestOwnOptions = {
82
82
  * Request headers (plain object, `Headers` or entry pairs); copied, never mutated.
83
83
  * `Content-Type: application/json` is added for a JSON body unless one is given.
84
84
  */
85
- headers?: HeadersInit;
85
+ headers?: HeadersInit | undefined;
86
86
  /**
87
87
  * Do not log a failure to the console (useful for expected errors such as a 401 check).
88
88
  */
89
- silent?: boolean;
89
+ silent?: boolean | undefined;
90
90
  /**
91
91
  * Abort after this many milliseconds (rejects with a `TimeoutError`).
92
92
  */
93
- timeout?: number;
93
+ timeout?: number | undefined;
94
94
  /**
95
95
  * Defaults to `'same-origin'`; pass `'include'` to send cookies cross-origin.
96
96
  */
97
- credentials?: RequestCredentials;
97
+ credentials?: RequestCredentials | undefined;
98
98
  /**
99
99
  * Abort signal, composed with `timeout` (whichever fires first aborts).
100
100
  */
101
- signal?: AbortSignal;
102
- mode?: RequestMode;
103
- cache?: RequestCache;
104
- redirect?: RequestRedirect;
105
- referrer?: string;
106
- referrerPolicy?: ReferrerPolicy;
107
- integrity?: string;
108
- keepalive?: boolean;
101
+ signal?: AbortSignal | undefined;
102
+ mode?: RequestMode | undefined;
103
+ cache?: RequestCache | undefined;
104
+ redirect?: RequestRedirect | undefined;
105
+ referrer?: string | undefined;
106
+ referrerPolicy?: ReferrerPolicy | undefined;
107
+ integrity?: string | undefined;
108
+ keepalive?: boolean | undefined;
109
109
  };
110
110
  /**
111
111
  * Options for `http.delete()`: a body is sent only when given as `data`.
@@ -208,37 +208,37 @@ export type I18nTranslateOptions = {
208
208
  /**
209
209
  * Translate in this locale instead of the current one
210
210
  */
211
- locale?: string;
211
+ locale?: string | undefined;
212
212
  /**
213
213
  * Returned (interpolated) when the key is missing, instead of the key
214
214
  */
215
- default?: string;
215
+ default?: string | undefined;
216
216
  /**
217
217
  * Choose plural forms by ordinal rules
218
218
  */
219
- ordinal?: boolean;
219
+ ordinal?: boolean | undefined;
220
220
  };
221
221
  export type I18nDetectOptions = {
222
222
  /**
223
223
  * Sources in order. Default ['storage', 'navigator', 'html']
224
224
  */
225
- from?: Array<"storage" | "navigator" | "html">;
225
+ from?: ("html" | "storage" | "navigator")[] | undefined;
226
226
  /**
227
227
  * S key: read in 'storage', and every later locale(code) is saved there
228
228
  */
229
- storageKey?: string;
229
+ storageKey?: string | undefined;
230
230
  /**
231
231
  * Only these locales (or their base language) are accepted
232
232
  */
233
- supported?: string[];
233
+ supported?: string[] | undefined;
234
234
  /**
235
235
  * Used when nothing matches (else the current locale stays)
236
236
  */
237
- fallback?: string;
237
+ fallback?: string | undefined;
238
238
  /**
239
239
  * Set the found locale (default true)
240
240
  */
241
- apply?: boolean;
241
+ apply?: boolean | undefined;
242
242
  };
243
243
  export type I18nChangeDetail = {
244
244
  locale: string;
@@ -24,29 +24,29 @@ export type IconDefinition = {
24
24
  /**
25
25
  * SVG viewBox (default '0 0 24 24')
26
26
  */
27
- viewBox?: string;
27
+ viewBox?: string | undefined;
28
28
  /**
29
29
  * Single path data
30
30
  */
31
- path?: string;
31
+ path?: string | undefined;
32
32
  /**
33
33
  * Multiple path data
34
34
  */
35
- paths?: string[];
35
+ paths?: string[] | undefined;
36
36
  /**
37
37
  * Stroke colour (usually 'currentColor')
38
38
  */
39
- stroke?: string;
39
+ stroke?: string | undefined;
40
40
  /**
41
41
  * Fill colour ('none', or 'currentColor' for filled icons)
42
42
  */
43
- fill?: string;
43
+ fill?: string | undefined;
44
44
  /**
45
45
  * Stroke width
46
46
  */
47
- strokeWidth?: number | string;
48
- strokeLinecap?: string;
49
- strokeLinejoin?: string;
47
+ strokeWidth?: string | number | undefined;
48
+ strokeLinecap?: string | undefined;
49
+ strokeLinejoin?: string | undefined;
50
50
  };
51
51
  /**
52
52
  * Options for `render()`, `html()` and `use()` (`use()` reads only `size` and `class`).
@@ -55,23 +55,23 @@ export type RenderOptions = {
55
55
  /**
56
56
  * Icon size in pixels
57
57
  */
58
- size?: number | string;
58
+ size?: string | number | undefined;
59
59
  /**
60
60
  * Additional CSS classes
61
61
  */
62
- class?: string;
62
+ class?: string | undefined;
63
63
  /**
64
64
  * Icon colour (overrides currentColor)
65
65
  */
66
- colour?: string;
66
+ colour?: string | undefined;
67
67
  /**
68
68
  * Alias for colour
69
69
  */
70
- color?: string;
70
+ color?: string | undefined;
71
71
  /**
72
72
  * Additional attributes
73
73
  */
74
- attrs?: Record<string, string>;
74
+ attrs?: Record<string, string> | undefined;
75
75
  };
76
76
  /**
77
77
  * Options for `inject()`: render options plus where the icon goes.
@@ -12,31 +12,31 @@ export type DommaSetupOptions = {
12
12
  /**
13
13
  * false: reveal the page now and stop cloaking it
14
14
  */
15
- cloak?: boolean;
15
+ cloak?: boolean | undefined;
16
16
  /**
17
17
  * true: switch Domma's theming off (bring your own styles)
18
18
  */
19
- noStyles?: boolean;
19
+ noStyles?: boolean | undefined;
20
20
  /**
21
21
  * Theme to start, e.g. 'ocean-dark'
22
22
  */
23
- theme?: string;
23
+ theme?: string | undefined;
24
24
  /**
25
25
  * Follow the system light/dark preference
26
26
  */
27
- autoDetectTheme?: boolean;
27
+ autoDetectTheme?: boolean | undefined;
28
28
  /**
29
29
  * false: do not remember the theme (default true)
30
30
  */
31
- persistTheme?: boolean;
31
+ persistTheme?: boolean | undefined;
32
32
  /**
33
33
  * true: run `I.scan()` over the page
34
34
  */
35
- scanIcons?: boolean;
35
+ scanIcons?: boolean | undefined;
36
36
  /**
37
37
  * Runs once, before the selectors
38
38
  */
39
- $init?: () => void;
39
+ $init?: (() => void) | undefined;
40
40
  };
41
41
  /**
42
42
  * The Domma function and everything on it. `$` is the same function.
@@ -56,11 +56,11 @@ export type DommaExtras = {
56
56
  /**
57
57
  * Nation flags - present when domma-flags is loaded
58
58
  */
59
- flags?: import("./flags.js").Flags;
59
+ flags?: import("./flags.js").FlagRegistry | undefined;
60
60
  /**
61
61
  * Alias for `flags` (opt-in module)
62
62
  */
63
- FL?: import("./flags.js").Flags;
63
+ FL?: import("./flags.js").FlagRegistry | undefined;
64
64
  };
65
65
  /**
66
66
  * Wrap elements in a {@link DommaCollection}: a CSS selector, an HTML string (`'<li>One</li>'`), an element,
@@ -70,7 +70,7 @@ export type DommaExtras = {
70
70
  * @param {Document | Element | DocumentFragment} [context] - Where to look for a CSS selector (default: document)
71
71
  * @returns {import('./dom.js').DommaCollection}
72
72
  */
73
- export function Domma(selector: import("./dom.js").DommaSelector, context?: Document | Element | DocumentFragment): import("./dom.js").DommaCollection;
73
+ export function Domma(selector: import("./dom.js").DommaSelector, context?: Element | Document | DocumentFragment | undefined): import("./dom.js").DommaCollection;
74
74
  /**
75
75
  * Run a function when the DOM is ready (straight away if it already is).
76
76
  * @overload
@@ -13,31 +13,31 @@ export type InputGroupOptions = {
13
13
  /**
14
14
  * - Addon joined to the start of the input
15
15
  */
16
- prefix?: InputGroupSlot;
16
+ prefix?: InputGroupSlot | undefined;
17
17
  /**
18
18
  * - Addon joined to the end of the input
19
19
  */
20
- suffix?: InputGroupSlot;
20
+ suffix?: InputGroupSlot | undefined;
21
21
  /**
22
22
  * - Password inputs: show / hide toggle button (aria-pressed, eye / eye-off)
23
23
  */
24
- reveal?: boolean;
24
+ reveal?: boolean | undefined;
25
25
  /**
26
26
  * - Text-like inputs and textareas: clear button shown while there is a
27
27
  * value; clearing fires input + change and refocuses the input
28
28
  */
29
- clear?: boolean;
29
+ clear?: boolean | undefined;
30
30
  /**
31
31
  * - Number inputs: - and + buttons honouring min / max / step, disabled at
32
32
  * the limits, input + change per step, hold to repeat
33
33
  */
34
- stepper?: boolean;
34
+ stepper?: boolean | undefined;
35
35
  /**
36
36
  * - Text-like inputs and textareas: live "12 / 200" counter after the group
37
37
  * (aria-live polite, added to aria-describedby). `true` reads maxLength;
38
38
  * a number is the limit. `.is-warning` from 90%, `.is-over` past it
39
39
  */
40
- counter?: boolean | number;
40
+ counter?: number | boolean | undefined;
41
41
  /**
42
42
  * - Accessible names for the buttons
43
43
  */
@@ -46,23 +46,23 @@ export type InputGroupOptions = {
46
46
  clear?: string;
47
47
  decrease?: string;
48
48
  increase?: string;
49
- };
49
+ } | undefined;
50
50
  };
51
51
  /**
52
52
  * The extras' elements, present only for the extras in use.
53
53
  */
54
54
  export type InputGroupExtras = {
55
- reveal?: HTMLButtonElement;
56
- clear?: HTMLButtonElement;
57
- decrease?: HTMLButtonElement;
58
- increase?: HTMLButtonElement;
59
- counter?: HTMLElement;
55
+ reveal?: HTMLButtonElement | undefined;
56
+ clear?: HTMLButtonElement | undefined;
57
+ decrease?: HTMLButtonElement | undefined;
58
+ increase?: HTMLButtonElement | undefined;
59
+ counter?: HTMLElement | undefined;
60
60
  };
61
61
  export type InputGroupInstance = InputGroup;
62
62
  declare class InputGroup extends Component {
63
63
  static defaults: {
64
- prefix: any;
65
- suffix: any;
64
+ prefix: null;
65
+ suffix: null;
66
66
  reveal: boolean;
67
67
  clear: boolean;
68
68
  stepper: boolean;
@@ -85,10 +85,10 @@ declare class InputGroup extends Component {
85
85
  _timers: {};
86
86
  /** The extras' elements (reveal, clear, decrease, increase, counter). @type {InputGroupExtras} */
87
87
  extras: InputGroupExtras;
88
- _ownsWrapper: boolean;
88
+ _ownsWrapper: boolean | undefined;
89
89
  /** The `.input-group-icon` wrapper; null after destroy(). @type {HTMLElement|null} */
90
90
  wrapper: HTMLElement | null;
91
- _manageAddons: boolean;
91
+ _manageAddons: boolean | undefined;
92
92
  /**
93
93
  * Change the addons or the extras; `null` removes an addon, `false` an
94
94
  * extra; a key left out is kept. Returns the instance.
@@ -111,13 +111,13 @@ declare class InputGroup extends Component {
111
111
  _syncEdges(): void;
112
112
  _listen(el: any, event: any, handler: any, opts: any): void;
113
113
  _limits(): {
114
- min: number;
115
- max: number;
116
- step: number;
114
+ min: number | null;
115
+ max: number | null;
116
+ step: number | null;
117
117
  };
118
118
  _counterLimit(): any;
119
119
  _buildExtras(): void;
120
- _describedBy: string;
120
+ _describedBy: string | null | undefined;
121
121
  _setRevealed(on: any): void;
122
122
  /** Dispatch input and change so Forma's model and any listener see it. */
123
123
  _fireInput(): void;
@@ -128,7 +128,7 @@ declare class InputGroup extends Component {
128
128
  */
129
129
  step(dir: 1 | -1 | number): this;
130
130
  _bindStep(btn: any, dir: any): void;
131
- _pointerStepped: boolean;
131
+ _pointerStepped: boolean | undefined;
132
132
  _stopRepeat(): void;
133
133
  _teardownExtras(): void;
134
134
  }
@@ -500,7 +500,7 @@ export namespace models {
500
500
  * @param {ComputedOptions<T>} [options]
501
501
  * @returns {ComputedRef<T>}
502
502
  */
503
- export function computed<T = any>(fn: () => T, options?: ComputedOptions<T>): ComputedRef<T>;
503
+ export function computed<T = any>(fn: () => T, options?: ComputedOptions<T> | undefined): ComputedRef<T>;
504
504
  /**
505
505
  * @template [T=any]
506
506
  * @overload
@@ -508,7 +508,7 @@ export namespace models {
508
508
  * @param {ComputedOptions<T>} [options]
509
509
  * @returns {ComputedRef<T>}
510
510
  */
511
- export function computed<T = any>(fn: WritableComputedDefinition<T>, options?: ComputedOptions<T>): ComputedRef<T>;
511
+ export function computed<T = any>(fn: WritableComputedDefinition<T>, options?: ComputedOptions<T> | undefined): ComputedRef<T>;
512
512
  /**
513
513
  * Run a function now, and again whenever any field it read changes.
514
514
  *
@@ -739,7 +739,7 @@ export type FieldDefinition = {
739
739
  * Checked with
740
740
  * `M.types[type]` when the value is not empty; a type with no validator (e.g. a form's `email`) is not checked
741
741
  */
742
- type?: "string" | "number" | "boolean" | "array" | "object" | "date" | "any" | (string & {});
742
+ type?: "string" | "number" | "boolean" | "object" | (string & {}) | "any" | "array" | "date" | undefined;
743
743
  /**
744
744
  * Initial value when the data gives none (otherwise `null`)
745
745
  */
@@ -747,32 +747,32 @@ export type FieldDefinition = {
747
747
  /**
748
748
  * `null`, `undefined` and `''` fail
749
749
  */
750
- required?: boolean;
750
+ required?: boolean | undefined;
751
751
  /**
752
752
  * Minimum, for a number value
753
753
  */
754
- min?: number;
754
+ min?: number | undefined;
755
755
  /**
756
756
  * Maximum, for a number value
757
757
  */
758
- max?: number;
758
+ max?: number | undefined;
759
759
  /**
760
760
  * Minimum length, for a string value
761
761
  */
762
- minLength?: number;
762
+ minLength?: number | undefined;
763
763
  /**
764
764
  * Maximum length, for a string value
765
765
  */
766
- maxLength?: number;
766
+ maxLength?: number | undefined;
767
767
  /**
768
768
  * Pattern a string value must match
769
769
  */
770
- pattern?: RegExp;
770
+ pattern?: RegExp | undefined;
771
771
  /**
772
772
  * Custom check: `false` fails, a string fails with
773
773
  * that message, anything else passes
774
774
  */
775
- validate?: (value: any) => boolean | string | void;
775
+ validate?: ((value: any) => boolean | string | void) | undefined;
776
776
  };
777
777
  /**
778
778
  * A blueprint: field name -> definition.
@@ -793,11 +793,11 @@ export type ModelOptions = {
793
793
  /**
794
794
  * localStorage key (stored as `model:<persist>`); loaded on creation and saved on change
795
795
  */
796
- persist?: string;
796
+ persist?: string | undefined;
797
797
  /**
798
798
  * Save on every change when `persist` is set
799
799
  */
800
- autoSave?: boolean;
800
+ autoSave?: boolean | undefined;
801
801
  };
802
802
  export type ChangeEvent = {
803
803
  field: string;
@@ -815,15 +815,15 @@ export type BindingOptions = {
815
815
  /**
816
816
  * Model value -> what the element shows
817
817
  */
818
- format?: (value: any) => any;
818
+ format?: ((value: any) => any) | undefined;
819
819
  /**
820
820
  * Element value -> what the model stores (two-way only)
821
821
  */
822
- parse?: (value: any) => any;
822
+ parse?: ((value: any) => any) | undefined;
823
823
  /**
824
824
  * Write the element's input back to the model
825
825
  */
826
- twoWay?: boolean;
826
+ twoWay?: boolean | undefined;
827
827
  };
828
828
  /**
829
829
  * A single reactive value (`M.observable()`), from domma-reactive.
@@ -864,12 +864,12 @@ export type ComputedOptions<T = any> = {
864
864
  /**
865
865
  * Debug label used in warnings
866
866
  */
867
- label?: string;
867
+ label?: string | undefined;
868
868
  /**
869
869
  * Called with the
870
870
  * new value whenever it changes
871
871
  */
872
- onChange?: (value: T, computation: import("../vendor/domma-reactive.js").Computation<T>) => void;
872
+ onChange?: ((value: T, computation: import("../vendor/domma-reactive.js").Computation<T>) => void) | undefined;
873
873
  };
874
874
  /**
875
875
  * A writable computed: where a write should land.
@@ -882,7 +882,7 @@ export type EffectOptions = {
882
882
  /**
883
883
  * Debug label used in warnings
884
884
  */
885
- label?: string;
885
+ label?: string | undefined;
886
886
  };
887
887
  /**
888
888
  * Options for `M.applyBindings()`.
@@ -892,16 +892,16 @@ export type ApplyBindingsOptions = {
892
892
  * Handlers for `data-on-*`. Looked up only when the
893
893
  * data has no such key.
894
894
  */
895
- methods?: Record<string, (...args: any[]) => any>;
895
+ methods?: Record<string, (...args: any[]) => any> | undefined;
896
896
  /**
897
897
  * Template renderer for `data-each` item bodies.
898
898
  * Defaults to `utils.render`.
899
899
  */
900
- render?: import("../vendor/domma-reactive.js").RenderFn;
900
+ render?: import("../vendor/domma-reactive.js").RenderFn | undefined;
901
901
  /**
902
902
  * A name for this subtree, used in warnings
903
903
  */
904
- template?: string;
904
+ template?: string | undefined;
905
905
  };
906
906
  /**
907
907
  * One activated binding record, from domma-reactive. `deps` are the names its expression reads.