domma-js 0.55.0 → 0.57.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 (116) hide show
  1. package/assets/types/generated/public/assets/flags/africa.d.ts +6 -0
  2. package/assets/types/generated/public/assets/flags/americas.d.ts +6 -0
  3. package/assets/types/generated/public/assets/flags/asia.d.ts +6 -0
  4. package/assets/types/generated/public/assets/flags/europe.d.ts +9 -0
  5. package/assets/types/generated/public/assets/flags/index.d.ts +11 -0
  6. package/assets/types/generated/public/assets/flags/oceania.d.ts +2 -0
  7. package/assets/types/generated/public/assets/icons/buildings.d.ts +6 -0
  8. package/assets/types/generated/public/assets/icons/code.d.ts +2 -0
  9. package/assets/types/generated/public/assets/icons/commerce.d.ts +7 -0
  10. package/assets/types/generated/public/assets/icons/communication.d.ts +7 -0
  11. package/assets/types/generated/public/assets/icons/devices.d.ts +6 -0
  12. package/assets/types/generated/public/assets/icons/emojis.d.ts +6 -0
  13. package/assets/types/generated/public/assets/icons/files.d.ts +7 -0
  14. package/assets/types/generated/public/assets/icons/finance.d.ts +6 -0
  15. package/assets/types/generated/public/assets/icons/forms.d.ts +5 -0
  16. package/assets/types/generated/public/assets/icons/health.d.ts +6 -0
  17. package/assets/types/generated/public/assets/icons/index.d.ts +24 -0
  18. package/assets/types/generated/public/assets/icons/media.d.ts +7 -0
  19. package/assets/types/generated/public/assets/icons/navigation.d.ts +7 -0
  20. package/assets/types/generated/public/assets/icons/seasonal.d.ts +6 -0
  21. package/assets/types/generated/public/assets/icons/social.d.ts +7 -0
  22. package/assets/types/generated/public/assets/icons/sport.d.ts +6 -0
  23. package/assets/types/generated/public/assets/icons/status.d.ts +7 -0
  24. package/assets/types/generated/public/assets/icons/transport.d.ts +7 -0
  25. package/assets/types/generated/public/assets/icons/ui.d.ts +7 -0
  26. package/assets/types/generated/public/assets/icons/weather.d.ts +6 -0
  27. package/assets/types/generated/src/auth.d.ts +424 -0
  28. package/assets/types/generated/src/avatar.d.ts +270 -0
  29. package/assets/types/generated/src/binding-source.d.ts +58 -0
  30. package/assets/types/generated/src/butterfly-drawing.d.ts +2 -0
  31. package/assets/types/generated/src/component-factory.d.ts +150 -0
  32. package/assets/types/generated/src/component.d.ts +162 -0
  33. package/assets/types/generated/src/components/back-to-top.d.ts +150 -0
  34. package/assets/types/generated/src/components/badge.d.ts +208 -0
  35. package/assets/types/generated/src/components/card.d.ts +189 -0
  36. package/assets/types/generated/src/components/command-palette.d.ts +352 -0
  37. package/assets/types/generated/src/components/dropzone.d.ts +342 -0
  38. package/assets/types/generated/src/components/focus-trap.d.ts +238 -0
  39. package/assets/types/generated/src/components/loader.d.ts +133 -0
  40. package/assets/types/generated/src/components/modal.d.ts +341 -0
  41. package/assets/types/generated/src/components/range-slider.d.ts +267 -0
  42. package/assets/types/generated/src/components/shared.d.ts +91 -0
  43. package/assets/types/generated/src/components/split-pane.d.ts +239 -0
  44. package/assets/types/generated/src/components/toast.d.ts +284 -0
  45. package/assets/types/generated/src/components/tooltip.d.ts +200 -0
  46. package/assets/types/generated/src/components/virtual-list.d.ts +340 -0
  47. package/assets/types/generated/src/config.d.ts +193 -0
  48. package/assets/types/generated/src/context-cursor.d.ts +69 -0
  49. package/assets/types/generated/src/context-menu.d.ts +596 -0
  50. package/assets/types/generated/src/dates.d.ts +367 -0
  51. package/assets/types/generated/src/dom.d.ts +1221 -0
  52. package/assets/types/generated/src/effects.d.ts +1281 -0
  53. package/assets/types/generated/src/elements.d.ts +4996 -0
  54. package/assets/types/generated/src/escape.d.ts +5 -0
  55. package/assets/types/generated/src/flags-bundle.d.ts +4 -0
  56. package/assets/types/generated/src/flags.d.ts +338 -0
  57. package/assets/types/generated/src/forms.d.ts +1060 -0
  58. package/assets/types/generated/src/globals.d.ts +45 -0
  59. package/assets/types/generated/src/http.d.ts +131 -0
  60. package/assets/types/generated/src/i18n.d.ts +261 -0
  61. package/assets/types/generated/src/icons.d.ts +213 -0
  62. package/assets/types/generated/src/index.d.ts +249 -0
  63. package/assets/types/generated/src/input-group.d.ts +135 -0
  64. package/assets/types/generated/src/models.d.ts +968 -0
  65. package/assets/types/generated/src/popover.d.ts +412 -0
  66. package/assets/types/generated/src/router.d.ts +344 -0
  67. package/assets/types/generated/src/safe-url.d.ts +10 -0
  68. package/assets/types/generated/src/sanitize.d.ts +97 -0
  69. package/assets/types/generated/src/schema-builder.d.ts +420 -0
  70. package/assets/types/generated/src/skeleton.d.ts +135 -0
  71. package/assets/types/generated/src/smooth-caret.d.ts +61 -0
  72. package/assets/types/generated/src/sortable.d.ts +369 -0
  73. package/assets/types/generated/src/storage.d.ts +93 -0
  74. package/assets/types/generated/src/tables.d.ts +901 -0
  75. package/assets/types/generated/src/theme.d.ts +277 -0
  76. package/assets/types/generated/src/ticker-tape-drawing.d.ts +2 -0
  77. package/assets/types/generated/src/treeview.d.ts +504 -0
  78. package/assets/types/generated/src/utils.d.ts +1667 -0
  79. package/assets/types/generated/src/web-components/base/domma-element.d.ts +134 -0
  80. package/assets/types/generated/src/web-components/index.d.ts +14 -0
  81. package/assets/types/generated/vendor/domma-reactive.d.ts +587 -0
  82. package/assets/types/index.d.ts +104 -216
  83. package/package.json +5 -2
  84. package/public/dist/bundles/domma-complete.css +1084 -14
  85. package/public/dist/bundles/domma-data-focused.css +1084 -14
  86. package/public/dist/bundles/domma-essentials.css +1084 -14
  87. package/public/dist/bundles/domma-full.css +1084 -14
  88. package/public/dist/bundles/domma-minimal.css +8 -8
  89. package/public/dist/domma-flags.esm.js +3 -3
  90. package/public/dist/domma-flags.esm.js.map +1 -1
  91. package/public/dist/domma-flags.min.js +3 -3
  92. package/public/dist/domma-flags.min.js.map +1 -1
  93. package/public/dist/domma-syntax.min.js +3 -3
  94. package/public/dist/domma.css +3 -3
  95. package/public/dist/domma.esm.js +5 -5
  96. package/public/dist/domma.esm.js.map +1 -1
  97. package/public/dist/domma.min.js +5 -5
  98. package/public/dist/domma.min.js.map +1 -1
  99. package/public/dist/elements.css +1073 -3
  100. package/public/dist/grid.css +3 -3
  101. package/public/dist/syntax.css +3 -3
  102. package/public/dist/themes/domma-themes.css +3 -3
  103. package/templates/kickstart/frontend/types/domma.d.ts +2 -1
  104. package/assets/types/config.d.ts +0 -136
  105. package/assets/types/dates.d.ts +0 -209
  106. package/assets/types/dom.d.ts +0 -448
  107. package/assets/types/elements.d.ts +0 -682
  108. package/assets/types/flags.d.ts +0 -130
  109. package/assets/types/http.d.ts +0 -97
  110. package/assets/types/icons.d.ts +0 -147
  111. package/assets/types/models.d.ts +0 -260
  112. package/assets/types/smooth-caret.d.ts +0 -12
  113. package/assets/types/storage.d.ts +0 -93
  114. package/assets/types/tables.d.ts +0 -327
  115. package/assets/types/theme.d.ts +0 -137
  116. package/assets/types/utils.d.ts +0 -675
@@ -0,0 +1,420 @@
1
+ /**
2
+ * Saved templates and the auto-saved active schema, in localStorage. Every method swallows storage
3
+ * errors (a failed read gives an empty list / null, a failed write gives false).
4
+ */
5
+ export class SchemaTemplateManager {
6
+ /** @type {string} */
7
+ static STORAGE_KEY: string;
8
+ /** @type {string} */
9
+ static ACTIVE_KEY: string;
10
+ /**
11
+ * List all saved template names.
12
+ * @returns {string[]}
13
+ */
14
+ static list(): string[];
15
+ /**
16
+ * Load a template by name.
17
+ * @param {string} name
18
+ * @returns {SchemaTemplate|null}
19
+ */
20
+ static load(name: string): SchemaTemplate | null;
21
+ /**
22
+ * Save a template (stamps `updatedAt`).
23
+ * @param {string} name
24
+ * @param {{name: string, fields: FieldDefinition[]}} schema
25
+ * @returns {boolean} false when storage failed
26
+ */
27
+ static save(name: string, schema: {
28
+ name: string;
29
+ fields: FieldDefinition[];
30
+ }): boolean;
31
+ /**
32
+ * Delete a template.
33
+ * @param {string} name
34
+ * @returns {boolean} false when there was nothing stored or storage failed
35
+ */
36
+ static delete(name: string): boolean;
37
+ /**
38
+ * Save the active schema (auto-save).
39
+ * @param {FieldDefinition[]} fields
40
+ * @returns {boolean} false when storage failed
41
+ */
42
+ static saveActive(fields: FieldDefinition[]): boolean;
43
+ /**
44
+ * Load the active (auto-saved) schema.
45
+ * @returns {FieldDefinition[]|null}
46
+ */
47
+ static loadActive(): FieldDefinition[] | null;
48
+ }
49
+ /**
50
+ * A field type in the Field Library (a key of the field type registry).
51
+ */
52
+ export type FieldType = "string" | "number" | "boolean" | "email" | "password" | "url" | "tel" | "color" | "range" | "hidden" | "date" | "datetime" | "time" | "select" | "multiselect" | "radio" | "checkbox-group" | "textarea" | "file" | "array" | "object";
53
+ /**
54
+ * Export format passed to `onExport`.
55
+ */
56
+ export type ExportFormat = "js" | "json" | "typescript";
57
+ /**
58
+ * Live preview form layout. `grid-N` renders a grid form with N columns.
59
+ */
60
+ export type PreviewLayout = "stacked" | "inline" | "grid-2" | "grid-3" | "grid-4" | "grid-6" | "grid-12";
61
+ /**
62
+ * A choice for select / radio / checkbox-group / multiselect fields.
63
+ */
64
+ export type FieldOption = {
65
+ value: string | number;
66
+ label: string;
67
+ };
68
+ /**
69
+ * An addon for `formConfig.prefix` / `formConfig.suffix`: `{icon}`, `{text}`, `{html}` (raw, the caller's
70
+ * responsibility) or a string (shorthand for `{text}`).
71
+ */
72
+ export type FormAddon = import("./forms.js").FormAddon;
73
+ /**
74
+ * Accessible names for the input extras' buttons.
75
+ */
76
+ export type InputExtrasLabels = {
77
+ /**
78
+ * - Default 'Show password'
79
+ */
80
+ reveal?: string;
81
+ /**
82
+ * - Default 'Clear'
83
+ */
84
+ clear?: string;
85
+ /**
86
+ * - Default 'Decrease'
87
+ */
88
+ decrease?: string;
89
+ /**
90
+ * - Default 'Increase'
91
+ */
92
+ increase?: string;
93
+ };
94
+ /**
95
+ * How a field is presented (`field.formConfig`). The preview hands the blueprint to `F.create`, so every
96
+ * form field option applies; `columns` is the column span the builder's Properties panel edits (1-12).
97
+ */
98
+ export type FormConfig = Omit<import("./forms.js").FormFieldConfig, "labels"> & {
99
+ columns?: number;
100
+ labels?: InputExtrasLabels | import("./forms.js").FormFieldConfig["labels"];
101
+ };
102
+ /**
103
+ * One field as the builder holds it. `getFields()` entries carry `name`; in a blueprint the name is the key.
104
+ */
105
+ export type FieldDefinition = {
106
+ /**
107
+ * - Field data type (date fields store 'string', datetime 'datetime-local')
108
+ */
109
+ type: FieldType | "datetime-local" | (string & {});
110
+ /**
111
+ * - Field name (getFields() / templates; not present in blueprints)
112
+ */
113
+ name?: string;
114
+ /**
115
+ * - Is field required?
116
+ */
117
+ required?: boolean;
118
+ /**
119
+ * - Default value
120
+ */
121
+ default?: any;
122
+ /**
123
+ * - Minimum string length
124
+ */
125
+ minLength?: number | null;
126
+ /**
127
+ * - Maximum string length
128
+ */
129
+ maxLength?: number | null;
130
+ /**
131
+ * - Regex pattern for validation
132
+ */
133
+ pattern?: RegExp | string;
134
+ /**
135
+ * - Minimum numeric value
136
+ */
137
+ min?: number | null;
138
+ /**
139
+ * - Maximum numeric value
140
+ */
141
+ max?: number | null;
142
+ /**
143
+ * - Step increment for number / range inputs
144
+ */
145
+ step?: number;
146
+ /**
147
+ * - Options for select, multiselect, radio, checkbox-group
148
+ */
149
+ options?: FieldOption[] | string[];
150
+ /**
151
+ * - Custom validation: true passes, a string is the error
152
+ */
153
+ validate?: (value: any) => boolean | string;
154
+ /**
155
+ * - file: accepted types
156
+ */
157
+ accept?: string;
158
+ /**
159
+ * - file: allow several files
160
+ */
161
+ multiple?: boolean;
162
+ /**
163
+ * - Display label
164
+ */
165
+ label?: string;
166
+ /**
167
+ * - Input placeholder
168
+ */
169
+ placeholder?: string;
170
+ /**
171
+ * - Help text displayed below the field
172
+ */
173
+ help?: string;
174
+ /**
175
+ * - Disable the field
176
+ */
177
+ disabled?: boolean;
178
+ /**
179
+ * - Form configuration
180
+ */
181
+ formConfig?: FormConfig;
182
+ };
183
+ /**
184
+ * A blueprint: field name -> definition.
185
+ */
186
+ export type Blueprint = {
187
+ [fieldName: string]: FieldDefinition;
188
+ };
189
+ /**
190
+ * An entry of the field type registry (the Field Library).
191
+ */
192
+ export type FieldTypeInfo = {
193
+ /**
194
+ * - Display name
195
+ */
196
+ name: string;
197
+ /**
198
+ * - Icon name
199
+ */
200
+ icon: string;
201
+ /**
202
+ * - Category (basic, inputs, selection, datetime, advanced)
203
+ */
204
+ category: string;
205
+ /**
206
+ * - Field description
207
+ */
208
+ description: string;
209
+ /**
210
+ * - Default field definition
211
+ */
212
+ defaults: FieldDefinition;
213
+ };
214
+ /**
215
+ * A saved template (localStorage, `domma:schema-builder-templates`).
216
+ */
217
+ export type SchemaTemplate = {
218
+ name: string;
219
+ fields: FieldDefinition[];
220
+ /**
221
+ * - Date.now() of the last save
222
+ */
223
+ updatedAt: number;
224
+ };
225
+ /**
226
+ * Schema Builder options.
227
+ */
228
+ export type SchemaBuilderOptions = {
229
+ /**
230
+ * - Theme variant (default 'light')
231
+ */
232
+ theme?: "light" | "dark";
233
+ /**
234
+ * - Auto-save the active schema to localStorage (default true)
235
+ */
236
+ autoSave?: boolean;
237
+ /**
238
+ * - Auto-save interval in milliseconds (default 30000)
239
+ */
240
+ autoSaveInterval?: number;
241
+ /**
242
+ * - Show the live preview panel on start (default true)
243
+ */
244
+ showPreview?: boolean;
245
+ /**
246
+ * - Preview form layout (default 'stacked')
247
+ */
248
+ previewLayout?: PreviewLayout;
249
+ /**
250
+ * - Called when the schema changes
251
+ */
252
+ onChange?: ((fields: FieldDefinition[]) => void) | null;
253
+ /**
254
+ * - Called when a template is saved
255
+ */
256
+ onSave?: ((name: string, schema: {
257
+ name: string;
258
+ fields: FieldDefinition[];
259
+ }) => void) | null;
260
+ /**
261
+ * - Called on every export
262
+ */
263
+ onExport?: ((format: ExportFormat, data: string) => void) | null;
264
+ };
265
+ /**
266
+ * Options for `exportJS()`. None are read at present.
267
+ */
268
+ export type ExportJSOptions = Record<string, unknown>;
269
+ /**
270
+ * Options for `exportJSON()`. None are read at present.
271
+ */
272
+ export type ExportJSONOptions = Record<string, unknown>;
273
+ /**
274
+ * Options for `exportTypeScript()`.
275
+ */
276
+ export type ExportTypeScriptOptions = {
277
+ /**
278
+ * - TypeScript interface name (default 'FormData')
279
+ */
280
+ interfaceName?: string;
281
+ };
282
+ /**
283
+ * Create a Schema Builder instance (`E.schemaBuilder`).
284
+ */
285
+ export type SchemaBuilderFactory = (selector: string | HTMLElement, options?: SchemaBuilderOptions) => SchemaBuilderInstance;
286
+ export type SchemaBuilderInstance = SchemaBuilder;
287
+ /**
288
+ * Visual drag-and-drop blueprint designer.
289
+ */
290
+ export class SchemaBuilder extends Component {
291
+ /** @type {Required<SchemaBuilderOptions>} */
292
+ static defaults: Required<SchemaBuilderOptions>;
293
+ /**
294
+ * @param {string|HTMLElement} selector - CSS selector or HTMLElement
295
+ * @param {SchemaBuilderOptions} [options] - Configuration options
296
+ */
297
+ constructor(selector: string | HTMLElement, options?: SchemaBuilderOptions);
298
+ /** @type {FieldDefinition[]} */
299
+ _fields: FieldDefinition[];
300
+ _selectedIndex: number;
301
+ _schemaName: string;
302
+ _isDirty: boolean;
303
+ _dragSource: string;
304
+ _autoSaveTimer: number;
305
+ _previewForm: any;
306
+ _refs: {};
307
+ _init(): void;
308
+ _render(): void;
309
+ _renderLibrary(): void;
310
+ _renderCanvas(): void;
311
+ _renderEditor(fieldIndex: any): void;
312
+ _renderFieldSpecificProperties(field: any): string;
313
+ _attachOptionsEditor(): void;
314
+ _renderPreview(): void;
315
+ _attachEvents(): void;
316
+ /**
317
+ * Utility for event delegation with cleanup tracking
318
+ * @private
319
+ */
320
+ private _on;
321
+ _handlePropertyChange(e: any): void;
322
+ _selectField(index: any): void;
323
+ /**
324
+ * Add a field to the schema and select it. An unknown type does nothing.
325
+ * @param {FieldType} type - Field type
326
+ * @param {number} position - Position to insert (0-based index)
327
+ * @returns {this}
328
+ */
329
+ addField(type: FieldType, position: number): this;
330
+ /**
331
+ * Remove a field from the schema.
332
+ * @param {number} index - Field index to remove
333
+ * @returns {this}
334
+ */
335
+ removeField(index: number): this;
336
+ /**
337
+ * Duplicate a field (the copy's name gets `_copy`) and select the copy.
338
+ * @param {number} index - Field index to duplicate
339
+ * @returns {this}
340
+ */
341
+ duplicateField(index: number): this;
342
+ /**
343
+ * Update field properties (shallow merge).
344
+ * @param {number} index - Field index to update
345
+ * @param {Partial<FieldDefinition>} updates - Property updates
346
+ * @returns {this}
347
+ */
348
+ updateField(index: number, updates: Partial<FieldDefinition>): this;
349
+ /**
350
+ * Get all fields (a deep copy).
351
+ * @returns {FieldDefinition[]}
352
+ */
353
+ getFields(): FieldDefinition[];
354
+ /**
355
+ * Get the blueprint object (field names as keys; unnamed fields are left out).
356
+ * @returns {Blueprint}
357
+ */
358
+ getBlueprint(): Blueprint;
359
+ /**
360
+ * Export to a JavaScript object literal (`const blueprint = {...};`). Calls `onExport('js', output)`.
361
+ * @param {ExportJSOptions} [options] - Not read at present
362
+ * @returns {string}
363
+ */
364
+ exportJS(options?: ExportJSOptions): string;
365
+ /**
366
+ * Export to JSON. Calls `onExport('json', output)`.
367
+ * @param {ExportJSONOptions} [options] - Not read at present
368
+ * @returns {string}
369
+ */
370
+ exportJSON(options?: ExportJSONOptions): string;
371
+ /**
372
+ * Export to a TypeScript interface. Calls `onExport('typescript', output)`.
373
+ * @param {ExportTypeScriptOptions} [options] - Export options
374
+ * @returns {string}
375
+ */
376
+ exportTypeScript(options?: ExportTypeScriptOptions): string;
377
+ /**
378
+ * Import an existing blueprint, replacing the current fields.
379
+ * @param {Blueprint} blueprint - Blueprint object to import
380
+ * @param {string} [name] - Optional name for the schema
381
+ * @returns {this}
382
+ */
383
+ importBlueprint(blueprint: Blueprint, name?: string): this;
384
+ /**
385
+ * Save the current schema as a template. Calls `onSave(name, schema)`.
386
+ * @param {string} name - Template name
387
+ * @returns {this}
388
+ */
389
+ saveTemplate(name: string): this;
390
+ /**
391
+ * Load a saved template. An unknown name does nothing.
392
+ * @param {string} name - Template name
393
+ * @returns {this}
394
+ */
395
+ loadTemplate(name: string): this;
396
+ /**
397
+ * Create a new schema (clear all fields).
398
+ * @param {string} [name] - Optional schema name
399
+ * @returns {this}
400
+ */
401
+ newSchema(name?: string): this;
402
+ /**
403
+ * Set the preview layout.
404
+ * @param {PreviewLayout} layout - Layout mode
405
+ * @returns {this}
406
+ */
407
+ setPreviewLayout(layout: PreviewLayout): this;
408
+ _togglePreview(): this;
409
+ _toBlueprint(): {};
410
+ _mapToTSType(type: any): any;
411
+ _showSaveModal(): void;
412
+ _showLoadModal(): void;
413
+ _showExportModal(): void;
414
+ _createModal(title: any, content: any): HTMLDivElement;
415
+ _startAutoSave(): void;
416
+ _markDirty(): void;
417
+ _capitalize(str: any): any;
418
+ _escapeHtml(str: any): string;
419
+ }
420
+ import Component from './component.js';
@@ -0,0 +1,135 @@
1
+ /**
2
+ * Placeholder markup for one type. Exported for tests and for hosts (such as
3
+ * the DataTable) that want the shapes without the container handling.
4
+ * @param {SkeletonOptions} [options]
5
+ * @returns {string}
6
+ */
7
+ export function skeletonMarkup(options?: SkeletonOptions): string;
8
+ /**
9
+ * Fill a container with placeholders.
10
+ *
11
+ * Fills the container, marks it aria-busy with a polite "Loading..." status and
12
+ * returns a handle; null if nothing matched.
13
+ *
14
+ * @param {string|Element|ArrayLike<Element>|null} target - selector, element or Domma collection
15
+ * @param {SkeletonOptions} [options]
16
+ * @returns {SkeletonHandle|null}
17
+ */
18
+ export function skeleton(target: string | Element | ArrayLike<Element> | null, options?: SkeletonOptions): SkeletonHandle | null;
19
+ export namespace skeleton {
20
+ /**
21
+ * Show a skeleton until a promise settles. Resolves with the promise's value
22
+ * once the skeleton is gone, so the caller renders into a clean container;
23
+ * rejects with the promise's error, also with the skeleton gone.
24
+ * `promise` may be a function returning one.
25
+ * @template T
26
+ * @param {string|Element|ArrayLike<Element>|null} target
27
+ * @param {Promise<T>|(() => Promise<T>|T)} promise
28
+ * @param {SkeletonOptions} [options]
29
+ * @returns {Promise<T>}
30
+ */
31
+ function _while<T>(target: string | Element | ArrayLike<Element> | null, promise: Promise<T> | (() => Promise<T> | T), options?: SkeletonOptions): Promise<T>;
32
+ export { _while as while };
33
+ /**
34
+ * The live handle on a container, if any - the same answer as E.get(target, 'skeleton').
35
+ * @param {string|Element|ArrayLike<Element>|null} target
36
+ * @returns {SkeletonHandle|null}
37
+ */
38
+ export function get(target: string | Element | ArrayLike<Element> | null): SkeletonHandle | null;
39
+ /**
40
+ * Remove the skeleton from a container, restoring its content.
41
+ * @param {string|Element|ArrayLike<Element>|null} target
42
+ * @returns {HTMLElement|null}
43
+ */
44
+ export function remove(target: string | Element | ArrayLike<Element> | null): HTMLElement | null;
45
+ /**
46
+ * Fill every `[data-skeleton]` container under `root` that has no skeleton
47
+ * yet and has not had one removed (`data-skeleton-done`). Options come from
48
+ * `data-skeleton-*` attributes. Returns the handles.
49
+ * @param {string|Element|Document} [root]
50
+ * @returns {SkeletonHandle[]}
51
+ */
52
+ export function scan(root?: string | Element | Document): SkeletonHandle[];
53
+ export { skeletonMarkup as markup };
54
+ }
55
+ export default skeleton;
56
+ export type SkeletonType = "text" | "card" | "list" | "table" | "custom";
57
+ export type SkeletonOptions = {
58
+ /**
59
+ * - Shape to draw (default 'text')
60
+ */
61
+ type?: SkeletonType;
62
+ /**
63
+ * - Lines per paragraph, card or list item (default 3; list 2)
64
+ */
65
+ lines?: number | string | null;
66
+ /**
67
+ * - Paragraphs, cards or list items (default 1; list 3)
68
+ */
69
+ count?: number | string | null;
70
+ /**
71
+ * - Table rows (default 5)
72
+ */
73
+ rows?: number | string;
74
+ /**
75
+ * - Table columns (default 4)
76
+ */
77
+ columns?: number | string;
78
+ /**
79
+ * - Table header row (default true)
80
+ */
81
+ header?: boolean;
82
+ /**
83
+ * - A circle at the start of each list item (default true)
84
+ */
85
+ avatar?: boolean;
86
+ /**
87
+ * - An image block at the top of each card (default true)
88
+ */
89
+ image?: boolean;
90
+ /**
91
+ * - false = still tint, no sweep (default true)
92
+ */
93
+ animate?: boolean;
94
+ /**
95
+ * - Markup for type 'custom', or a function returning it
96
+ */
97
+ template?: string | ((options: SkeletonOptions) => string) | null;
98
+ /**
99
+ * - Screen-reader status text (default 'Loading...')
100
+ */
101
+ label?: string;
102
+ };
103
+ /**
104
+ * The handle E.skeleton() returns.
105
+ */
106
+ export type SkeletonHandle = {
107
+ /**
108
+ * - The container
109
+ */
110
+ element: HTMLElement;
111
+ /**
112
+ * - The resolved options
113
+ */
114
+ options: SkeletonOptions;
115
+ /**
116
+ * - Whether the skeleton is still showing (read only)
117
+ */
118
+ active: boolean;
119
+ /**
120
+ * - Take the skeleton away and restore the previous children (the same nodes)
121
+ */
122
+ remove: () => HTMLElement;
123
+ /**
124
+ * - Take the skeleton away and show content instead: an HTML string (unsanitised) or a node
125
+ */
126
+ replace: (content: string | Node | ArrayLike<Node> | null) => HTMLElement;
127
+ /**
128
+ * - Alias of remove()
129
+ */
130
+ destroy: () => HTMLElement;
131
+ };
132
+ /**
133
+ * `E.skeleton` - the factory with its helpers (`while`, `get`, `remove`, `scan`, `markup`).
134
+ */
135
+ export type SkeletonStatic = typeof skeleton;
@@ -0,0 +1,61 @@
1
+ /**
2
+ * Whether an element can carry the smooth caret: an enabled, writable textarea, a text-like
3
+ * input (text, search, url, tel) or a contenteditable element.
4
+ * @param {Element|null|undefined} element
5
+ * @returns {boolean}
6
+ */
7
+ export function supportsSmoothCaret(element: Element | null | undefined): boolean;
8
+ /**
9
+ * The stored caret preference ('auto' when none or unreadable).
10
+ * @param {Window} [win]
11
+ * @returns {CaretPreference}
12
+ */
13
+ export function getCaretPreference(win?: Window): CaretPreference;
14
+ /**
15
+ * Store the caret preference (anything else is stored as 'auto') and tell every attached caret.
16
+ * @param {CaretPreference} value
17
+ * @param {Window} [win]
18
+ * @returns {void}
19
+ */
20
+ export function setCaretPreference(value: CaretPreference, win?: Window): void;
21
+ /**
22
+ * Attach a smooth caret to one control. Attaching twice returns the same handle; an element
23
+ * that cannot carry one gets a handle that does nothing.
24
+ * @param {HTMLInputElement|HTMLTextAreaElement|HTMLElement} textarea
25
+ * @returns {SmoothCaretHandle}
26
+ */
27
+ export function attachSmoothCaret(textarea: HTMLInputElement | HTMLTextAreaElement | HTMLElement): SmoothCaretHandle;
28
+ /**
29
+ * Enhance controls on focus, including controls rendered later by a wizard,
30
+ * dialog or Web Component. Only the focused automatic instance is retained.
31
+ * Explicitly attached editor instances keep their owner's lifecycle.
32
+ * @param {Document|HTMLElement|ShadowRoot} [root=document]
33
+ * @returns {{destroy(): void}}
34
+ */
35
+ export function installSmoothCarets(root?: Document | HTMLElement | ShadowRoot): {
36
+ destroy(): void;
37
+ };
38
+ export namespace smoothCaret {
39
+ export { attachSmoothCaret as attach };
40
+ export { installSmoothCarets as install };
41
+ export { getCaretPreference as getPreference };
42
+ export { setCaretPreference as setPreference };
43
+ }
44
+ /**
45
+ * Caret preference kept in localStorage: 'auto' follows prefers-reduced-motion.
46
+ */
47
+ export type CaretPreference = "auto" | "smooth" | "native";
48
+ /**
49
+ * What `attach()` returns.
50
+ */
51
+ export type SmoothCaretHandle = {
52
+ /**
53
+ * Re-measure and redraw the caret now
54
+ */
55
+ refresh: () => void;
56
+ /**
57
+ * Remove the caret and every listener, restoring the control
58
+ */
59
+ destroy: () => void;
60
+ };
61
+ export type SmoothCaret = typeof smoothCaret;