domma-js 0.56.0 → 0.58.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 (121) hide show
  1. package/README.md +2 -2
  2. package/assets/types/generated/public/assets/flags/africa.d.ts +6 -0
  3. package/assets/types/generated/public/assets/flags/americas.d.ts +6 -0
  4. package/assets/types/generated/public/assets/flags/asia.d.ts +6 -0
  5. package/assets/types/generated/public/assets/flags/europe.d.ts +9 -0
  6. package/assets/types/generated/public/assets/flags/index.d.ts +11 -0
  7. package/assets/types/generated/public/assets/flags/oceania.d.ts +2 -0
  8. package/assets/types/generated/public/assets/icons/buildings.d.ts +6 -0
  9. package/assets/types/generated/public/assets/icons/code.d.ts +2 -0
  10. package/assets/types/generated/public/assets/icons/commerce.d.ts +7 -0
  11. package/assets/types/generated/public/assets/icons/communication.d.ts +7 -0
  12. package/assets/types/generated/public/assets/icons/devices.d.ts +6 -0
  13. package/assets/types/generated/public/assets/icons/emojis.d.ts +6 -0
  14. package/assets/types/generated/public/assets/icons/files.d.ts +7 -0
  15. package/assets/types/generated/public/assets/icons/finance.d.ts +6 -0
  16. package/assets/types/generated/public/assets/icons/forms.d.ts +5 -0
  17. package/assets/types/generated/public/assets/icons/health.d.ts +6 -0
  18. package/assets/types/generated/public/assets/icons/index.d.ts +24 -0
  19. package/assets/types/generated/public/assets/icons/media.d.ts +7 -0
  20. package/assets/types/generated/public/assets/icons/navigation.d.ts +7 -0
  21. package/assets/types/generated/public/assets/icons/seasonal.d.ts +6 -0
  22. package/assets/types/generated/public/assets/icons/social.d.ts +7 -0
  23. package/assets/types/generated/public/assets/icons/sport.d.ts +6 -0
  24. package/assets/types/generated/public/assets/icons/status.d.ts +7 -0
  25. package/assets/types/generated/public/assets/icons/transport.d.ts +7 -0
  26. package/assets/types/generated/public/assets/icons/ui.d.ts +7 -0
  27. package/assets/types/generated/public/assets/icons/weather.d.ts +6 -0
  28. package/assets/types/generated/src/auth.d.ts +424 -0
  29. package/assets/types/generated/src/avatar.d.ts +270 -0
  30. package/assets/types/generated/src/binding-source.d.ts +58 -0
  31. package/assets/types/generated/src/butterfly-drawing.d.ts +2 -0
  32. package/assets/types/generated/src/component-factory.d.ts +150 -0
  33. package/assets/types/generated/src/component.d.ts +162 -0
  34. package/assets/types/generated/src/components/back-to-top.d.ts +150 -0
  35. package/assets/types/generated/src/components/badge.d.ts +208 -0
  36. package/assets/types/generated/src/components/card.d.ts +189 -0
  37. package/assets/types/generated/src/components/command-palette.d.ts +352 -0
  38. package/assets/types/generated/src/components/dropzone.d.ts +342 -0
  39. package/assets/types/generated/src/components/focus-trap.d.ts +238 -0
  40. package/assets/types/generated/src/components/loader.d.ts +133 -0
  41. package/assets/types/generated/src/components/modal.d.ts +339 -0
  42. package/assets/types/generated/src/components/range-slider.d.ts +267 -0
  43. package/assets/types/generated/src/components/shared.d.ts +91 -0
  44. package/assets/types/generated/src/components/split-pane.d.ts +239 -0
  45. package/assets/types/generated/src/components/toast.d.ts +284 -0
  46. package/assets/types/generated/src/components/tooltip.d.ts +200 -0
  47. package/assets/types/generated/src/components/virtual-list.d.ts +340 -0
  48. package/assets/types/generated/src/config.d.ts +193 -0
  49. package/assets/types/generated/src/context-cursor.d.ts +69 -0
  50. package/assets/types/generated/src/context-menu.d.ts +596 -0
  51. package/assets/types/generated/src/dates.d.ts +367 -0
  52. package/assets/types/generated/src/dom.d.ts +1221 -0
  53. package/assets/types/generated/src/effects.d.ts +1281 -0
  54. package/assets/types/generated/src/elements.d.ts +4994 -0
  55. package/assets/types/generated/src/escape.d.ts +5 -0
  56. package/assets/types/generated/src/flags-bundle.d.ts +4 -0
  57. package/assets/types/generated/src/flags.d.ts +338 -0
  58. package/assets/types/generated/src/forms.d.ts +1060 -0
  59. package/assets/types/generated/src/globals.d.ts +45 -0
  60. package/assets/types/generated/src/http.d.ts +131 -0
  61. package/assets/types/generated/src/i18n.d.ts +261 -0
  62. package/assets/types/generated/src/icons.d.ts +213 -0
  63. package/assets/types/generated/src/index.d.ts +249 -0
  64. package/assets/types/generated/src/input-group.d.ts +135 -0
  65. package/assets/types/generated/src/models.d.ts +968 -0
  66. package/assets/types/generated/src/popover.d.ts +413 -0
  67. package/assets/types/generated/src/router.d.ts +344 -0
  68. package/assets/types/generated/src/safe-url.d.ts +10 -0
  69. package/assets/types/generated/src/sanitize.d.ts +97 -0
  70. package/assets/types/generated/src/schema-builder.d.ts +420 -0
  71. package/assets/types/generated/src/skeleton.d.ts +135 -0
  72. package/assets/types/generated/src/smooth-caret.d.ts +61 -0
  73. package/assets/types/generated/src/sortable.d.ts +368 -0
  74. package/assets/types/generated/src/storage.d.ts +93 -0
  75. package/assets/types/generated/src/tables.d.ts +901 -0
  76. package/assets/types/generated/src/theme.d.ts +262 -0
  77. package/assets/types/generated/src/ticker-tape-drawing.d.ts +2 -0
  78. package/assets/types/generated/src/treeview.d.ts +504 -0
  79. package/assets/types/generated/src/utils.d.ts +1667 -0
  80. package/assets/types/generated/src/web-components/base/domma-element.d.ts +134 -0
  81. package/assets/types/generated/src/web-components/index.d.ts +14 -0
  82. package/assets/types/generated/vendor/domma-reactive.d.ts +587 -0
  83. package/assets/types/index.d.ts +104 -226
  84. package/package.json +5 -2
  85. package/public/dist/bundles/domma-complete.css +20 -14
  86. package/public/dist/bundles/domma-data-focused.css +20 -14
  87. package/public/dist/bundles/domma-essentials.css +20 -14
  88. package/public/dist/bundles/domma-full.css +20 -14
  89. package/public/dist/bundles/domma-minimal.css +8 -8
  90. package/public/dist/domma-flags.esm.js +3 -3
  91. package/public/dist/domma-flags.esm.js.map +1 -1
  92. package/public/dist/domma-flags.min.js +3 -3
  93. package/public/dist/domma-flags.min.js.map +1 -1
  94. package/public/dist/domma-syntax.min.js +3 -3
  95. package/public/dist/domma.css +3 -3
  96. package/public/dist/domma.esm.js +5 -5
  97. package/public/dist/domma.esm.js.map +1 -1
  98. package/public/dist/domma.min.js +5 -5
  99. package/public/dist/domma.min.js.map +1 -1
  100. package/public/dist/elements.css +9 -3
  101. package/public/dist/grid.css +3 -3
  102. package/public/dist/syntax.css +3 -3
  103. package/public/dist/themes/domma-themes.css +3 -3
  104. package/templates/kickstart/.claude/snippets.md +1 -1
  105. package/templates/kickstart/CLAUDE.md +1 -1
  106. package/templates/kickstart/frontend/types/domma.d.ts +7 -4
  107. package/templates/kickstart-spa/.claude/snippets.md +1 -1
  108. package/assets/types/config.d.ts +0 -136
  109. package/assets/types/dates.d.ts +0 -209
  110. package/assets/types/dom.d.ts +0 -448
  111. package/assets/types/elements.d.ts +0 -1168
  112. package/assets/types/flags.d.ts +0 -130
  113. package/assets/types/http.d.ts +0 -97
  114. package/assets/types/i18n.d.ts +0 -99
  115. package/assets/types/icons.d.ts +0 -147
  116. package/assets/types/models.d.ts +0 -260
  117. package/assets/types/smooth-caret.d.ts +0 -12
  118. package/assets/types/storage.d.ts +0 -93
  119. package/assets/types/tables.d.ts +0 -327
  120. package/assets/types/theme.d.ts +0 -137
  121. package/assets/types/utils.d.ts +0 -675
@@ -0,0 +1,596 @@
1
+ export default ContextMenu;
2
+ /**
3
+ * The open context: passed to callbacks, item actions and resolvers.
4
+ */
5
+ export type ContextMenuContext = {
6
+ /**
7
+ * - The delegated element the menu was opened against (or the container when no `match` is set)
8
+ */
9
+ target: HTMLElement;
10
+ /**
11
+ * - The bound container that claimed the gesture
12
+ */
13
+ container: HTMLElement;
14
+ /**
15
+ * - Viewport x of the opening point
16
+ */
17
+ x: number;
18
+ /**
19
+ * - Viewport y of the opening point
20
+ */
21
+ y: number;
22
+ /**
23
+ * - Originating event, or null when opened programmatically
24
+ */
25
+ event: Event | null;
26
+ /**
27
+ * - The menu element, once rendered
28
+ */
29
+ menu: HTMLElement | null;
30
+ /**
31
+ * - The instance that owns the menu
32
+ */
33
+ instance: ContextMenu;
34
+ };
35
+ export type ContextMenuItem = {
36
+ /**
37
+ * - Item text
38
+ */
39
+ label?: string;
40
+ /**
41
+ * - Item text, when there is no label
42
+ */
43
+ text?: string;
44
+ /**
45
+ * - Item text, when there is no label or text
46
+ */
47
+ name?: string;
48
+ /**
49
+ * - Domma icon name, rendered through data-icon
50
+ */
51
+ icon?: string;
52
+ /**
53
+ * - Arbitrary value carried to onSelect (with the item)
54
+ */
55
+ value?: any;
56
+ /**
57
+ * - Invoked with the delegated target and the open context
58
+ */
59
+ action?: (target: HTMLElement | null, ctx: ContextMenuContext) => void | Promise<void>;
60
+ /**
61
+ * - Greyed but still shown; a function is resolved per target
62
+ */
63
+ disabled?: boolean | ((target: HTMLElement, ctx: ContextMenuContext) => boolean);
64
+ /**
65
+ * - Omitted entirely when false; a function is resolved per target
66
+ */
67
+ visible?: boolean | ((target: HTMLElement, ctx: ContextMenuContext) => boolean);
68
+ /**
69
+ * - Destructive styling
70
+ */
71
+ danger?: boolean;
72
+ /**
73
+ * - Extra classes on the item
74
+ */
75
+ className?: string | string[];
76
+ /**
77
+ * - Right-aligned hint text - display only, no key is bound
78
+ */
79
+ shortcut?: string;
80
+ /**
81
+ * - Nested items, to unlimited depth
82
+ */
83
+ submenu?: ContextMenuItem[] | ((target: HTMLElement, ctx: ContextMenuContext) => ContextMenuItem[]);
84
+ /**
85
+ * - Item kind (default 'item')
86
+ */
87
+ type?: "item" | "divider" | "header" | "checkbox" | "radio";
88
+ /**
89
+ * - Checked state for checkbox/radio types
90
+ */
91
+ checked?: boolean | ((target: HTMLElement, ctx: ContextMenuContext) => boolean);
92
+ /**
93
+ * - Shorthand for type: 'divider'
94
+ */
95
+ divider?: boolean;
96
+ /**
97
+ * - Shorthand for type: 'header'
98
+ */
99
+ header?: string;
100
+ };
101
+ export type ContextMenuOptions = {
102
+ /**
103
+ * - Items, or a resolver called with the delegated target. Accepts a Domma Reactive observable.
104
+ */
105
+ items?: ContextMenuItem[] | ((target: HTMLElement, ctx: ContextMenuContext) => ContextMenuItem[]) | import("../vendor/domma-reactive.js").Observable<ContextMenuItem[]>;
106
+ /**
107
+ * - Delegation selector - the menu claims only descendants matching it (default: the whole container)
108
+ */
109
+ match?: string | null;
110
+ /**
111
+ * - Regions inside the container that decline and fall through outward
112
+ */
113
+ exclude?: string | null;
114
+ /**
115
+ * - False declines the gesture and falls through to the next menu outward
116
+ */
117
+ enabled?: boolean | ((target: HTMLElement, ctx: ContextMenuContext) => boolean);
118
+ /**
119
+ * - Merge ancestor menus' items rather than replacing them (default 'append')
120
+ */
121
+ inherit?: "append" | "prepend" | false;
122
+ /**
123
+ * - Tie-break only when two menus bind the SAME element; depth wins otherwise
124
+ */
125
+ priority?: number;
126
+ /**
127
+ * - This menu owns its region: once it encloses the click and accepts it, nothing bound deeper is offered the gesture. Not a veto - an exclusive menu that declines steps aside.
128
+ */
129
+ exclusive?: boolean;
130
+ /**
131
+ * - Shift+right-click passes through to the browser's own menu (default true)
132
+ */
133
+ nativeOnShift?: boolean;
134
+ /**
135
+ * - Close after an item is chosen (default true)
136
+ */
137
+ closeOnSelect?: boolean;
138
+ /**
139
+ * - Close on Esc (default true)
140
+ */
141
+ closeOnEscape?: boolean;
142
+ /**
143
+ * - Close on outside mousedown (default true)
144
+ */
145
+ closeOnClickOutside?: boolean;
146
+ /**
147
+ * - Close on scroll - the anchoring point has moved (default true)
148
+ */
149
+ closeOnScroll?: boolean;
150
+ /**
151
+ * - Long-press duration in ms for touch, or false to disable (default 500)
152
+ */
153
+ longPress?: number | false;
154
+ /**
155
+ * - Pointer over a claimed region: 'auto' (the CSS `context-menu` keyword, default), 'glyph' (a generated themed cursor), false (leave it alone) or any CSS cursor value
156
+ */
157
+ cursor?: "auto" | "glyph" | false | (string & {});
158
+ /**
159
+ * - Glyph cursor size in px, clamped to 32 - browsers ignore anything larger (default 26)
160
+ */
161
+ cursorSize?: number;
162
+ /**
163
+ * - Extra class on the menu root
164
+ */
165
+ className?: string;
166
+ /**
167
+ * - Minimum menu width (default '200px')
168
+ */
169
+ minWidth?: string;
170
+ /**
171
+ * - Maximum menu width (default '320px')
172
+ */
173
+ maxWidth?: string;
174
+ /**
175
+ * - Maximum menu height before it scrolls (default '60vh')
176
+ */
177
+ maxHeight?: string;
178
+ /**
179
+ * - Offset [x, y] from the cursor point (default [2, 2])
180
+ */
181
+ offset?: [number, number];
182
+ /**
183
+ * - Flip across the cursor and clamp to the viewport (default true)
184
+ */
185
+ flip?: boolean;
186
+ /**
187
+ * - Whether to transition on open and close (default true)
188
+ */
189
+ animation?: boolean;
190
+ /**
191
+ * - Transition duration in ms (default 120)
192
+ */
193
+ animationDuration?: number;
194
+ /**
195
+ * - How the panel enters (default 'scale')
196
+ */
197
+ transition?: "scale" | "fade" | "slide" | "none";
198
+ /**
199
+ * - Any CSS easing (default cubic-bezier(0.16, 1, 0.3, 1))
200
+ */
201
+ easing?: string;
202
+ /**
203
+ * - Preset key ('primary'|'success'|'danger'|'warning'|'info') or any CSS colour
204
+ */
205
+ accent?: string | null;
206
+ /**
207
+ * - Overrides the panel background
208
+ */
209
+ surface?: string | null;
210
+ /**
211
+ * - 'none'|'sm'|'md'|'lg'|'xl', or any CSS length
212
+ */
213
+ radius?: string | null;
214
+ /**
215
+ * - 'none'|'sm'|'md'|'lg'|'xl'
216
+ */
217
+ shadow?: string | null;
218
+ /**
219
+ * - 20-100; translucent panel with a blurred backdrop. Clamped.
220
+ */
221
+ opacity?: number | null;
222
+ /**
223
+ * - Row height and font size (default 'comfortable')
224
+ */
225
+ density?: "comfortable" | "compact";
226
+ /**
227
+ * - Custom item renderer returning HTML
228
+ */
229
+ itemTemplate?: ((item: ContextMenuItem, index: number) => string) | null;
230
+ /**
231
+ * - Hover grace before a submenu opens, in ms (default 150)
232
+ */
233
+ submenuDelay?: number;
234
+ /**
235
+ * - Render your own panel instead of an item list. Called only once this menu has claimed the gesture. Return an element for Domma to position and dismiss, or nothing to manage it yourself.
236
+ */
237
+ render?: ((ctx: ContextMenuContext) => HTMLElement | void) | null;
238
+ /**
239
+ * - Open on Shift+F10 and the Menu key against the focused element (default true)
240
+ */
241
+ keyboardTrigger?: boolean;
242
+ /**
243
+ * - Jump to an item by typing (default true)
244
+ */
245
+ typeahead?: boolean;
246
+ /**
247
+ * - aria-label for the menu
248
+ */
249
+ ariaLabel?: string;
250
+ /**
251
+ * - Bind items to a Domma Model
252
+ */
253
+ model?: {
254
+ get(key: string): any;
255
+ } | null;
256
+ /**
257
+ * - Model key holding the items array
258
+ */
259
+ modelKey?: string | null;
260
+ /**
261
+ * - Return false to decline and fall through to the next menu outward
262
+ */
263
+ onBeforeOpen?: ((ctx: ContextMenuContext) => boolean | void) | null;
264
+ /**
265
+ * - Fired once the menu is on screen
266
+ */
267
+ onOpen?: ((ctx: ContextMenuContext) => void) | null;
268
+ /**
269
+ * - Return false to keep it open
270
+ */
271
+ onBeforeClose?: ((ctx: ContextMenuContext | null) => boolean | void) | null;
272
+ /**
273
+ * - Fired after the menu is dismissed
274
+ */
275
+ onClose?: ((ctx: ContextMenuContext | null) => void) | null;
276
+ /**
277
+ * - Fired before the item's own action
278
+ */
279
+ onSelect?: ((item: ContextMenuItem, ctx: ContextMenuContext) => void) | null;
280
+ };
281
+ /**
282
+ * One accepted candidate for a gesture.
283
+ */
284
+ export type ContextMenuHit = {
285
+ instance: ContextMenu;
286
+ container: HTMLElement;
287
+ target: HTMLElement;
288
+ ctx: ContextMenuContext;
289
+ };
290
+ export type ContextMenuInstance = ContextMenu;
291
+ /**
292
+ * `E.contextMenu` - the factory plus its statics: `closeAll()` closes whichever menu is open;
293
+ * `active()` is the open instance, or null - only one can be open at a time; `registry(el)`
294
+ * lists the bound menus, or with an element the resolution chain for it, innermost first.
295
+ */
296
+ export type ContextMenuStatic = {
297
+ (selector: string | HTMLElement, options?: ContextMenuOptions): ContextMenu;
298
+ closeAll(): void;
299
+ active(): ContextMenu | null;
300
+ registry(forElement?: HTMLElement | null): ContextMenu[];
301
+ };
302
+ /**
303
+ * The open context: passed to callbacks, item actions and resolvers.
304
+ * @typedef {object} ContextMenuContext
305
+ * @property {HTMLElement} target - The delegated element the menu was opened against (or the container when no `match` is set)
306
+ * @property {HTMLElement} container - The bound container that claimed the gesture
307
+ * @property {number} x - Viewport x of the opening point
308
+ * @property {number} y - Viewport y of the opening point
309
+ * @property {Event|null} event - Originating event, or null when opened programmatically
310
+ * @property {HTMLElement|null} menu - The menu element, once rendered
311
+ * @property {ContextMenu} instance - The instance that owns the menu
312
+ */
313
+ /**
314
+ * @typedef {object} ContextMenuItem
315
+ * @property {string} [label] - Item text
316
+ * @property {string} [text] - Item text, when there is no label
317
+ * @property {string} [name] - Item text, when there is no label or text
318
+ * @property {string} [icon] - Domma icon name, rendered through data-icon
319
+ * @property {*} [value] - Arbitrary value carried to onSelect (with the item)
320
+ * @property {(target: HTMLElement|null, ctx: ContextMenuContext) => void|Promise<void>} [action] - Invoked with the delegated target and the open context
321
+ * @property {boolean|((target: HTMLElement, ctx: ContextMenuContext) => boolean)} [disabled] - Greyed but still shown; a function is resolved per target
322
+ * @property {boolean|((target: HTMLElement, ctx: ContextMenuContext) => boolean)} [visible] - Omitted entirely when false; a function is resolved per target
323
+ * @property {boolean} [danger] - Destructive styling
324
+ * @property {string|string[]} [className] - Extra classes on the item
325
+ * @property {string} [shortcut] - Right-aligned hint text - display only, no key is bound
326
+ * @property {ContextMenuItem[]|((target: HTMLElement, ctx: ContextMenuContext) => ContextMenuItem[])} [submenu] - Nested items, to unlimited depth
327
+ * @property {'item'|'divider'|'header'|'checkbox'|'radio'} [type] - Item kind (default 'item')
328
+ * @property {boolean|((target: HTMLElement, ctx: ContextMenuContext) => boolean)} [checked] - Checked state for checkbox/radio types
329
+ * @property {boolean} [divider] - Shorthand for type: 'divider'
330
+ * @property {string} [header] - Shorthand for type: 'header'
331
+ */
332
+ /**
333
+ * @typedef {object} ContextMenuOptions
334
+ * @property {ContextMenuItem[]|((target: HTMLElement, ctx: ContextMenuContext) => ContextMenuItem[])|import('../vendor/domma-reactive.js').Observable<ContextMenuItem[]>} [items] - Items, or a resolver called with the delegated target. Accepts a Domma Reactive observable.
335
+ * @property {string|null} [match] - Delegation selector - the menu claims only descendants matching it (default: the whole container)
336
+ * @property {string|null} [exclude] - Regions inside the container that decline and fall through outward
337
+ * @property {boolean|((target: HTMLElement, ctx: ContextMenuContext) => boolean)} [enabled] - False declines the gesture and falls through to the next menu outward
338
+ * @property {'append'|'prepend'|false} [inherit] - Merge ancestor menus' items rather than replacing them (default 'append')
339
+ * @property {number} [priority] - Tie-break only when two menus bind the SAME element; depth wins otherwise
340
+ * @property {boolean} [exclusive] - This menu owns its region: once it encloses the click and accepts it, nothing bound deeper is offered the gesture. Not a veto - an exclusive menu that declines steps aside.
341
+ * @property {boolean} [nativeOnShift] - Shift+right-click passes through to the browser's own menu (default true)
342
+ * @property {boolean} [closeOnSelect] - Close after an item is chosen (default true)
343
+ * @property {boolean} [closeOnEscape] - Close on Esc (default true)
344
+ * @property {boolean} [closeOnClickOutside] - Close on outside mousedown (default true)
345
+ * @property {boolean} [closeOnScroll] - Close on scroll - the anchoring point has moved (default true)
346
+ * @property {number|false} [longPress] - Long-press duration in ms for touch, or false to disable (default 500)
347
+ * @property {'auto'|'glyph'|false|(string & {})} [cursor] - Pointer over a claimed region: 'auto' (the CSS `context-menu` keyword, default), 'glyph' (a generated themed cursor), false (leave it alone) or any CSS cursor value
348
+ * @property {number} [cursorSize] - Glyph cursor size in px, clamped to 32 - browsers ignore anything larger (default 26)
349
+ * @property {string} [className] - Extra class on the menu root
350
+ * @property {string} [minWidth] - Minimum menu width (default '200px')
351
+ * @property {string} [maxWidth] - Maximum menu width (default '320px')
352
+ * @property {string} [maxHeight] - Maximum menu height before it scrolls (default '60vh')
353
+ * @property {[number, number]} [offset] - Offset [x, y] from the cursor point (default [2, 2])
354
+ * @property {boolean} [flip] - Flip across the cursor and clamp to the viewport (default true)
355
+ * @property {boolean} [animation] - Whether to transition on open and close (default true)
356
+ * @property {number} [animationDuration] - Transition duration in ms (default 120)
357
+ * @property {'scale'|'fade'|'slide'|'none'} [transition] - How the panel enters (default 'scale')
358
+ * @property {string} [easing] - Any CSS easing (default cubic-bezier(0.16, 1, 0.3, 1))
359
+ * @property {string|null} [accent] - Preset key ('primary'|'success'|'danger'|'warning'|'info') or any CSS colour
360
+ * @property {string|null} [surface] - Overrides the panel background
361
+ * @property {string|null} [radius] - 'none'|'sm'|'md'|'lg'|'xl', or any CSS length
362
+ * @property {string|null} [shadow] - 'none'|'sm'|'md'|'lg'|'xl'
363
+ * @property {number|null} [opacity] - 20-100; translucent panel with a blurred backdrop. Clamped.
364
+ * @property {'comfortable'|'compact'} [density] - Row height and font size (default 'comfortable')
365
+ * @property {((item: ContextMenuItem, index: number) => string)|null} [itemTemplate] - Custom item renderer returning HTML
366
+ * @property {number} [submenuDelay] - Hover grace before a submenu opens, in ms (default 150)
367
+ * @property {((ctx: ContextMenuContext) => HTMLElement|void)|null} [render] - Render your own panel instead of an item list. Called only once this menu has claimed the gesture. Return an element for Domma to position and dismiss, or nothing to manage it yourself.
368
+ * @property {boolean} [keyboardTrigger] - Open on Shift+F10 and the Menu key against the focused element (default true)
369
+ * @property {boolean} [typeahead] - Jump to an item by typing (default true)
370
+ * @property {string} [ariaLabel] - aria-label for the menu
371
+ * @property {{get(key: string): any}|null} [model] - Bind items to a Domma Model
372
+ * @property {string|null} [modelKey] - Model key holding the items array
373
+ * @property {((ctx: ContextMenuContext) => boolean|void)|null} [onBeforeOpen] - Return false to decline and fall through to the next menu outward
374
+ * @property {((ctx: ContextMenuContext) => void)|null} [onOpen] - Fired once the menu is on screen
375
+ * @property {((ctx: ContextMenuContext|null) => boolean|void)|null} [onBeforeClose] - Return false to keep it open
376
+ * @property {((ctx: ContextMenuContext|null) => void)|null} [onClose] - Fired after the menu is dismissed
377
+ * @property {((item: ContextMenuItem, ctx: ContextMenuContext) => void)|null} [onSelect] - Fired before the item's own action
378
+ */
379
+ /**
380
+ * One accepted candidate for a gesture.
381
+ * @typedef {object} ContextMenuHit
382
+ * @property {ContextMenu} instance
383
+ * @property {HTMLElement} container
384
+ * @property {HTMLElement} target
385
+ * @property {ContextMenuContext} ctx
386
+ */
387
+ /** @typedef {ContextMenu} ContextMenuInstance */
388
+ /**
389
+ * `E.contextMenu` - the factory plus its statics: `closeAll()` closes whichever menu is open;
390
+ * `active()` is the open instance, or null - only one can be open at a time; `registry(el)`
391
+ * lists the bound menus, or with an element the resolution chain for it, innermost first.
392
+ * @typedef {{
393
+ * (selector: string|HTMLElement, options?: ContextMenuOptions): ContextMenu,
394
+ * closeAll(): void,
395
+ * active(): ContextMenu|null,
396
+ * registry(forElement?: HTMLElement|null): ContextMenu[]
397
+ * }} ContextMenuStatic
398
+ */
399
+ declare class ContextMenu extends Component {
400
+ /** @type {ContextMenuOptions} */
401
+ static defaults: ContextMenuOptions;
402
+ /**
403
+ * @param {string|HTMLElement} selector - A selector (matched live, so later elements are covered) or one element
404
+ * @param {ContextMenuOptions} [options]
405
+ */
406
+ constructor(selector: string | HTMLElement, options?: ContextMenuOptions);
407
+ selector: string;
408
+ _node: HTMLElement;
409
+ _menu: any;
410
+ _submenus: any[];
411
+ _isOpen: boolean;
412
+ _enabledFlag: boolean;
413
+ _focusIndex: number;
414
+ _renderedItems: any[];
415
+ _ctx: any;
416
+ _typeaheadBuffer: string;
417
+ _typeaheadTimer: number;
418
+ _submenuTimer: number;
419
+ _observableDispose: any;
420
+ _restoreFocusTo: Element;
421
+ _chain: any;
422
+ _cursorId: number;
423
+ /**
424
+ * Put this menu's cursor into the shared stylesheet.
425
+ *
426
+ * The rule is composed from the same selector and `match` the cascade
427
+ * resolves against, so it covers elements that do not exist yet - which is
428
+ * the whole reason this is a rule rather than a class applied at bind time.
429
+ *
430
+ * A menu bound to a node rather than a selector has nothing to write a
431
+ * rule against, so the node is stamped with a marker attribute and the
432
+ * rule targets that. Both paths end up as ordinary CSS.
433
+ */
434
+ _applyCursor(): void;
435
+ /**
436
+ * iOS answers a long press with its own text-callout, which arrives before
437
+ * any timer and cannot be cancelled once shown.
438
+ */
439
+ _applyTouchCallout(): void;
440
+ /**
441
+ * Whether `el` is a container this menu is bound to.
442
+ * @param {Element} el
443
+ * @returns {boolean}
444
+ */
445
+ matchesContainer(el: Element): boolean;
446
+ /**
447
+ * Decide whether this instance takes the gesture for `container`. Returning
448
+ * null is not a dead click: the caller carries on walking outward, so the
449
+ * next menu up gets its chance.
450
+ * @param {HTMLElement} container
451
+ * @param {HTMLElement} target
452
+ * @param {MouseEvent|{clientX: number, clientY: number, target: Element}|null} event
453
+ * @returns {ContextMenuHit|null}
454
+ */
455
+ _accept(container: HTMLElement, target: HTMLElement, event: MouseEvent | {
456
+ clientX: number;
457
+ clientY: number;
458
+ target: Element;
459
+ } | null): ContextMenuHit | null;
460
+ _ownItems(hit: any): any[];
461
+ /**
462
+ * The primary menu's items, plus - when it inherits - the items of every
463
+ * ancestor menu that also accepted, each behind a divider. Inheritance is
464
+ * the primary's decision: an inner menu that wants to stand alone sets
465
+ * `inherit: false` and the outer items stay out.
466
+ */
467
+ _assembleItems(chain: any, event: any): any[];
468
+ /** Drop invisible items and collapse the dividers that stranded. */
469
+ _filterItems(items: any, hit: any): any[];
470
+ /**
471
+ * Programmatic open. Resolves the chain itself so a menu opened from a
472
+ * "..." button behaves exactly like the right-click on the same row.
473
+ * @param {number} x - Viewport x
474
+ * @param {number} y - Viewport y
475
+ * @param {HTMLElement} [target] - Open against this element (default: the bound container)
476
+ * @returns {this}
477
+ */
478
+ open(x: number, y: number, target?: HTMLElement): this;
479
+ _openResolved(x: any, y: any, hit: any, items: any, event: any, fromKeyboard?: boolean, chain?: any): void;
480
+ /**
481
+ * Close the menu.
482
+ * @returns {this}
483
+ */
484
+ close(): this;
485
+ /**
486
+ * Rebuild the open menu in place, keeping its position.
487
+ * @returns {this}
488
+ */
489
+ refresh(): this;
490
+ /**
491
+ * Whether this menu is currently open.
492
+ * @returns {boolean}
493
+ */
494
+ isOpen(): boolean;
495
+ /**
496
+ * Close if open, else open at (x, y) as open() does.
497
+ * @param {number} x
498
+ * @param {number} y
499
+ * @param {HTMLElement} [target]
500
+ * @returns {this}
501
+ */
502
+ toggle(x: number, y: number, target?: HTMLElement): this;
503
+ /**
504
+ * Alias of open(x, y, target).
505
+ * @param {...*} args
506
+ * @returns {this}
507
+ */
508
+ show(...args: any[]): this;
509
+ /**
510
+ * Alias of close().
511
+ * @param {...*} args
512
+ * @returns {this}
513
+ */
514
+ hide(...args: any[]): this;
515
+ /** @returns {boolean} */
516
+ isVisible(): boolean;
517
+ /**
518
+ * Replace the items.
519
+ * @param {ContextMenuOptions['items']} items
520
+ * @returns {this}
521
+ */
522
+ setItems(items: ContextMenuOptions["items"]): this;
523
+ /**
524
+ * Re-arm the menu.
525
+ * @returns {this}
526
+ */
527
+ enable(): this;
528
+ /**
529
+ * Suppress the menu; right-clicks fall through to the next menu outward.
530
+ * @returns {this}
531
+ */
532
+ disable(): this;
533
+ _createMenu(isSub?: boolean): HTMLDivElement;
534
+ /**
535
+ * Theming rides on custom properties rather than on generated rules, so a
536
+ * menu left unstyled still follows whatever the active theme sets and only
537
+ * the values actually passed are overridden.
538
+ */
539
+ _applyTheme(menu: any): void;
540
+ _renderInto(menu: any, items: any, hit: any): void;
541
+ _depthOf(menu: any): number;
542
+ _openSubmenu(itemEl: any, item: any, hit: any, depth: any): void;
543
+ _closeSubmenus(fromDepth: any): void;
544
+ _activate(item: any, index: any): void;
545
+ /**
546
+ * Anchored to a point, not to a rect. `position: fixed`, so there is no
547
+ * scroll offset to fold in - and the menu closes on scroll anyway.
548
+ *
549
+ * A menu that will not fit below-right of the cursor flips to the other
550
+ * side OF THE CURSOR rather than to the other side of an element, which is
551
+ * the part that differs from Dropdown._positionMenu().
552
+ */
553
+ _positionAt(menu: any, x: any, y: any, anchorRect?: any): void;
554
+ _bindOpenListeners(): void;
555
+ _outsideHandler: (e: any) => void;
556
+ _contextHandler: (e: any) => void;
557
+ _keyHandler: (e: any) => void;
558
+ _scrollHandler: () => this;
559
+ _resizeHandler: () => this;
560
+ _unbindOpenListeners(): void;
561
+ _focusableItems(): any[];
562
+ _moveFocus(delta: any): void;
563
+ _onKeyDown(e: any): void;
564
+ _typeahead(char: any): void;
565
+ }
566
+ declare namespace ContextMenu {
567
+ /**
568
+ * Close whichever menu is open.
569
+ * @returns {void}
570
+ */
571
+ function closeAll(): void;
572
+ /**
573
+ * The open instance, or null - only one can be open at a time.
574
+ * @returns {ContextMenu|null}
575
+ */
576
+ function active(): ContextMenu | null;
577
+ /**
578
+ * Bound containers, innermost-first for a given element, else registration order.
579
+ * @param {Element|null} [forElement]
580
+ * @returns {ContextMenu[]}
581
+ */
582
+ function registry(forElement?: Element | null): ContextMenu[];
583
+ }
584
+ /** @type {Set<ContextMenu>} */
585
+ declare const registry: Set<ContextMenu>;
586
+ /**
587
+ * Walk outward from `target` collecting the registered containers that enclose
588
+ * it, innermost first. An element carrying two menus is ordered by `priority`,
589
+ * highest first; depth beats priority in every other case.
590
+ */
591
+ declare function collectCandidates(target: any): {
592
+ instance: ContextMenu;
593
+ container: Element;
594
+ }[];
595
+ import Component from './component.js';
596
+ export { registry as _registry, collectCandidates as _collectCandidates };