@ponchia/ui 0.8.1 → 0.10.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 (85) hide show
  1. package/CHANGELOG.md +149 -3
  2. package/MIGRATIONS.json +117 -27
  3. package/README.md +19 -11
  4. package/behaviors/index.d.ts +0 -2
  5. package/behaviors/index.d.ts.map +1 -1
  6. package/behaviors/index.js +0 -2
  7. package/behaviors/popover.js +4 -4
  8. package/classes/classes.json +48 -10
  9. package/classes/index.d.ts +16 -3
  10. package/classes/index.js +28 -3
  11. package/classes/vscode.css-custom-data.json +10 -10
  12. package/css/app.css +52 -30
  13. package/css/base.css +10 -14
  14. package/css/content.css +23 -21
  15. package/css/core.css +1 -0
  16. package/css/disclosure.css +17 -17
  17. package/css/feedback.css +15 -15
  18. package/css/forms.css +8 -7
  19. package/css/navigation.css +3 -3
  20. package/css/overlay.css +37 -39
  21. package/css/primitives.css +48 -28
  22. package/css/report.css +66 -42
  23. package/css/row.css +154 -0
  24. package/css/state.css +95 -6
  25. package/css/table.css +3 -3
  26. package/css/tokens.css +10 -10
  27. package/css/workbench.css +22 -10
  28. package/dist/bronto.css +1 -1
  29. package/dist/css/app.css +1 -1
  30. package/dist/css/base.css +1 -1
  31. package/dist/css/content.css +1 -1
  32. package/dist/css/disclosure.css +1 -1
  33. package/dist/css/feedback.css +1 -1
  34. package/dist/css/forms.css +1 -1
  35. package/dist/css/navigation.css +1 -1
  36. package/dist/css/overlay.css +1 -1
  37. package/dist/css/primitives.css +1 -1
  38. package/dist/css/report-kit.css +1 -1
  39. package/dist/css/report.css +1 -1
  40. package/dist/css/row.css +1 -0
  41. package/dist/css/state.css +1 -1
  42. package/dist/css/table.css +1 -1
  43. package/dist/css/tokens.css +1 -1
  44. package/dist/css/workbench.css +1 -1
  45. package/docs/adr/0004-prune-unused-adapters.md +5 -1
  46. package/docs/adr/0005-productive-tools-and-editorial-reports.md +58 -0
  47. package/docs/adr/0006-trusted-publishing.md +92 -0
  48. package/docs/architecture.md +16 -23
  49. package/docs/command.md +1 -2
  50. package/docs/compositions.md +110 -0
  51. package/docs/frontier-primitives.md +1 -2
  52. package/docs/migrations/0.8-to-0.9.md +66 -0
  53. package/docs/migrations/0.9-to-0.10.md +47 -0
  54. package/docs/package-contract.md +13 -13
  55. package/docs/reference.md +43 -18
  56. package/docs/reporting.md +15 -9
  57. package/docs/stability.md +20 -55
  58. package/docs/state.md +47 -0
  59. package/docs/theming.md +16 -0
  60. package/docs/usage.md +60 -30
  61. package/llms.txt +7 -18
  62. package/package.json +15 -54
  63. package/tokens/figma.variables.json +20 -20
  64. package/tokens/index.js +10 -10
  65. package/tokens/index.json +20 -20
  66. package/tokens/resolved.json +10 -10
  67. package/tokens/tokens.dtcg.json +20 -20
  68. package/behaviors/modal.d.ts +0 -45
  69. package/behaviors/modal.d.ts.map +0 -1
  70. package/behaviors/modal.js +0 -373
  71. package/qwik/index.d.ts +0 -48
  72. package/qwik/index.d.ts.map +0 -1
  73. package/qwik/index.js +0 -227
  74. package/react/index.d.ts +0 -45
  75. package/react/index.d.ts.map +0 -1
  76. package/react/index.js +0 -165
  77. package/solid/index.d.ts +0 -75
  78. package/solid/index.d.ts.map +0 -1
  79. package/solid/index.js +0 -172
  80. package/svelte/index.d.ts +0 -114
  81. package/svelte/index.d.ts.map +0 -1
  82. package/svelte/index.js +0 -197
  83. package/vue/index.d.ts +0 -116
  84. package/vue/index.d.ts.map +0 -1
  85. package/vue/index.js +0 -266
@@ -25,52 +25,52 @@
25
25
  "xl": {
26
26
  "$type": "dimension",
27
27
  "$value": {
28
- "value": 4,
28
+ "value": 8,
29
29
  "unit": "px"
30
30
  },
31
31
  "$extensions": {
32
32
  "com.ponchia.css": {
33
33
  "variable": "--radius-xl",
34
- "authoredValue": "4px"
34
+ "authoredValue": "8px"
35
35
  }
36
36
  }
37
37
  },
38
38
  "lg": {
39
39
  "$type": "dimension",
40
40
  "$value": {
41
- "value": 3,
41
+ "value": 6,
42
42
  "unit": "px"
43
43
  },
44
44
  "$extensions": {
45
45
  "com.ponchia.css": {
46
46
  "variable": "--radius-lg",
47
- "authoredValue": "3px"
47
+ "authoredValue": "6px"
48
48
  }
49
49
  }
50
50
  },
51
51
  "md": {
52
52
  "$type": "dimension",
53
53
  "$value": {
54
- "value": 2,
54
+ "value": 4,
55
55
  "unit": "px"
56
56
  },
57
57
  "$extensions": {
58
58
  "com.ponchia.css": {
59
59
  "variable": "--radius-md",
60
- "authoredValue": "2px"
60
+ "authoredValue": "4px"
61
61
  }
62
62
  }
63
63
  },
64
64
  "sm": {
65
65
  "$type": "dimension",
66
66
  "$value": {
67
- "value": 1,
67
+ "value": 2,
68
68
  "unit": "px"
69
69
  },
70
70
  "$extensions": {
71
71
  "com.ponchia.css": {
72
72
  "variable": "--radius-sm",
73
- "authoredValue": "1px"
73
+ "authoredValue": "2px"
74
74
  }
75
75
  }
76
76
  },
@@ -310,78 +310,78 @@
310
310
  "2xs": {
311
311
  "$type": "dimension",
312
312
  "$value": {
313
- "value": 0.72,
313
+ "value": 0.75,
314
314
  "unit": "rem"
315
315
  },
316
316
  "$extensions": {
317
317
  "com.ponchia.css": {
318
318
  "variable": "--text-2xs",
319
- "authoredValue": "0.72rem"
319
+ "authoredValue": "0.75rem"
320
320
  }
321
321
  }
322
322
  },
323
323
  "xs": {
324
324
  "$type": "dimension",
325
325
  "$value": {
326
- "value": 0.76,
326
+ "value": 0.8125,
327
327
  "unit": "rem"
328
328
  },
329
329
  "$extensions": {
330
330
  "com.ponchia.css": {
331
331
  "variable": "--text-xs",
332
- "authoredValue": "0.76rem"
332
+ "authoredValue": "0.8125rem"
333
333
  }
334
334
  }
335
335
  },
336
336
  "sm": {
337
337
  "$type": "dimension",
338
338
  "$value": {
339
- "value": 0.86,
339
+ "value": 0.875,
340
340
  "unit": "rem"
341
341
  },
342
342
  "$extensions": {
343
343
  "com.ponchia.css": {
344
344
  "variable": "--text-sm",
345
- "authoredValue": "0.86rem"
345
+ "authoredValue": "0.875rem"
346
346
  }
347
347
  }
348
348
  },
349
349
  "base": {
350
350
  "$type": "dimension",
351
351
  "$value": {
352
- "value": 0.95,
352
+ "value": 1,
353
353
  "unit": "rem"
354
354
  },
355
355
  "$extensions": {
356
356
  "com.ponchia.css": {
357
357
  "variable": "--text-base",
358
- "authoredValue": "0.95rem"
358
+ "authoredValue": "1rem"
359
359
  }
360
360
  }
361
361
  },
362
362
  "lg": {
363
363
  "$type": "dimension",
364
364
  "$value": {
365
- "value": 1.15,
365
+ "value": 1.125,
366
366
  "unit": "rem"
367
367
  },
368
368
  "$extensions": {
369
369
  "com.ponchia.css": {
370
370
  "variable": "--text-lg",
371
- "authoredValue": "1.15rem"
371
+ "authoredValue": "1.125rem"
372
372
  }
373
373
  }
374
374
  },
375
375
  "xl": {
376
376
  "$type": "dimension",
377
377
  "$value": {
378
- "value": 1.45,
378
+ "value": 1.5,
379
379
  "unit": "rem"
380
380
  },
381
381
  "$extensions": {
382
382
  "com.ponchia.css": {
383
383
  "variable": "--text-xl",
384
- "authoredValue": "1.45rem"
384
+ "authoredValue": "1.5rem"
385
385
  }
386
386
  }
387
387
  }
@@ -1,45 +0,0 @@
1
- /**
2
- * @typedef {object} ModalCloseDetail
3
- * @property {'escape'} reason What asked the modal to close (currently only Escape).
4
- */
5
- /**
6
- * Focus management for the **controlled, non-`<dialog>` modal** — the
7
- * `.ui-modal.is-open` path a portal/React overlay uses when it genuinely can't
8
- * be a native `<dialog>`. The native `<dialog>` path gets a focus trap, Escape,
9
- * and the top layer for free (use `initDialog`); this supplies the equivalent
10
- * for the `.is-open` path, which otherwise leaves focus management to the
11
- * consumer.
12
- *
13
- * Mark the overlay `[data-bronto-modal]` (opt-in). On bind it gives the modal a
14
- * `role="dialog"` + `aria-modal="true"` (unless the author set a role) and
15
- * dev-warns when it has no accessible name. While open, a document-level stack
16
- * reconciler keeps only the top controlled modal interactive, marks the rest of
17
- * the page `inert`, admits an open popover owned by the top modal even when the
18
- * panel is portaled elsewhere, and applies the trap to background nodes added
19
- * after open. Nested and sibling portal modals therefore share one ownership
20
- * model instead of independently inverting each other's `inert` state.
21
- *
22
- * Bronto owns focus only: the **consumer still owns open/close state** (the
23
- * `is-open` class). Escape dispatches a cancelable `bronto:modal:close`
24
- * ({@link ModalCloseDetail}) on the modal so the consumer can drop `is-open` in
25
- * response; the behavior never changes visibility itself. Closing a parent
26
- * modal temporarily suspends any still-`is-open` controlled descendants; they
27
- * resume at the top of the stack if the parent reopens.
28
- *
29
- * SSR-safe, idempotent per modal; returns a cleanup function.
30
- *
31
- * @deprecated Use a native `<dialog>` with `initDialog()`. This controlled
32
- * non-dialog path remains compatible in 0.7 and is scheduled for removal no
33
- * earlier than 0.8 because no real consumer adopted it.
34
- *
35
- * @param {import('./internal.js').DelegateOpts} [opts]
36
- * @returns {import('./internal.js').Cleanup}
37
- */
38
- export function initModal({ root }?: import("./internal.js").DelegateOpts): import("./internal.js").Cleanup;
39
- export type ModalCloseDetail = {
40
- /**
41
- * What asked the modal to close (currently only Escape).
42
- */
43
- reason: "escape";
44
- };
45
- //# sourceMappingURL=modal.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"modal.d.ts","sourceRoot":"","sources":["modal.js"],"names":[],"mappings":"AAmQA;;;GAGG;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,qCAHW,OAAO,eAAe,EAAE,YAAY,GAClC,OAAO,eAAe,EAAE,OAAO,CA6E3C;;;;;YA/Ga,QAAQ"}
@@ -1,373 +0,0 @@
1
- import {
2
- hasDom,
3
- resolveHost,
4
- noop,
5
- bindOnce,
6
- byIdInHost,
7
- collectHosts,
8
- focusInto,
9
- closestSafe,
10
- } from './internal.js';
11
-
12
- const states = new WeakMap();
13
-
14
- const snapshotAttrs = (el, names) => {
15
- const attrs = {};
16
- for (const name of names) {
17
- attrs[name] = {
18
- had: el.hasAttribute(name),
19
- value: el.getAttribute(name),
20
- };
21
- }
22
- return attrs;
23
- };
24
-
25
- const restoreAttrs = (el, attrs) => {
26
- for (const [name, state] of Object.entries(attrs)) {
27
- if (state.had) el.setAttribute(name, state.value);
28
- else el.removeAttribute(name);
29
- }
30
- };
31
-
32
- function modalState(doc) {
33
- let state = states.get(doc);
34
- if (state) return state;
35
- state = {
36
- doc,
37
- records: new Set(),
38
- byModal: new Map(),
39
- ownedInert: new Set(),
40
- pendingOverlays: new Set(),
41
- observer: null,
42
- observing: false,
43
- sequence: 0,
44
- scheduled: false,
45
- top: null,
46
- };
47
- states.set(doc, state);
48
- return state;
49
- }
50
-
51
- function isEffectivelyActive(record, state) {
52
- if (!record.active || !record.modal.isConnected) return false;
53
- for (let node = record.modal.parentElement; node; node = node.parentElement) {
54
- const ancestor = state.byModal.get(node);
55
- if (ancestor && (!ancestor.active || !ancestor.modal.isConnected)) return false;
56
- }
57
- return true;
58
- }
59
-
60
- function activeTop(state) {
61
- let top = null;
62
- for (const record of state.records) {
63
- if (!isEffectivelyActive(record, state)) continue;
64
- if (!top || top.modal.contains(record.modal)) {
65
- top = record;
66
- continue;
67
- }
68
- if (!record.modal.contains(top.modal) && record.openedAt > top.openedAt) top = record;
69
- }
70
- return top;
71
- }
72
-
73
- function popoverIsOpen(panel, state) {
74
- if (state.pendingOverlays.has(panel) || panel.classList.contains('is-open')) return true;
75
- try {
76
- return panel.matches(':popover-open');
77
- } catch {
78
- return false;
79
- }
80
- }
81
-
82
- function modalOwnsPopover(modal, panel) {
83
- if (modal.contains(panel)) return true;
84
- if (!panel.id) return false;
85
- return collectHosts(modal, '[data-bronto-popover]').some(
86
- (trigger) => trigger.getAttribute('data-bronto-popover') === panel.id,
87
- );
88
- }
89
-
90
- function liveRoots(state, top) {
91
- const roots = new Set([top.modal]);
92
- for (const trigger of collectHosts(top.modal, '[data-bronto-popover]')) {
93
- const panel = byIdInHost(top.modal, trigger.getAttribute('data-bronto-popover'));
94
- if (panel && popoverIsOpen(panel, state)) roots.add(panel);
95
- }
96
- for (const panel of state.pendingOverlays) {
97
- if (modalOwnsPopover(top.modal, panel)) roots.add(panel);
98
- }
99
- return roots;
100
- }
101
-
102
- function desiredInert(state, top) {
103
- const body = state.doc.body;
104
- if (!body || !top) return new Set();
105
- const roots = liveRoots(state, top);
106
- const livePath = new Set([body]);
107
- for (const root of roots) {
108
- for (let node = root; node && node !== body; node = node.parentElement) {
109
- livePath.add(node);
110
- }
111
- }
112
-
113
- const desired = new Set();
114
- for (const parent of livePath) {
115
- if (roots.has(parent)) continue;
116
- for (const child of parent.children || []) {
117
- if (!livePath.has(child)) desired.add(child);
118
- }
119
- }
120
- return desired;
121
- }
122
-
123
- function reconcileInert(state) {
124
- const previousTop = state.top;
125
- const nextTop = activeTop(state);
126
- const desired = desiredInert(state, nextTop);
127
-
128
- for (const element of [...state.ownedInert]) {
129
- if (desired.has(element)) {
130
- if (!element.inert) element.inert = true;
131
- continue;
132
- }
133
- element.inert = false;
134
- state.ownedInert.delete(element);
135
- }
136
- for (const element of desired) {
137
- if (state.ownedInert.has(element) || element.inert) continue;
138
- element.inert = true;
139
- state.ownedInert.add(element);
140
- }
141
- state.top = nextTop;
142
- return { previousTop, nextTop };
143
- }
144
-
145
- function scheduleReconcile(state) {
146
- if (state.scheduled) return;
147
- state.scheduled = true;
148
- queueMicrotask(() => {
149
- state.scheduled = false;
150
- reconcileInert(state);
151
- });
152
- }
153
-
154
- function ensureDocumentObserver(state) {
155
- if (state.observing) return;
156
- state.observing = true;
157
- const view = state.doc.defaultView;
158
- const Observer = view?.MutationObserver;
159
- if (Observer && state.doc.body) {
160
- state.observer = new Observer((mutations) => {
161
- const relevant = mutations.some(
162
- (mutation) =>
163
- mutation.type === 'childList' || mutation.target.matches?.('.ui-popover, [popover]'),
164
- );
165
- if (relevant && state.top) scheduleReconcile(state);
166
- });
167
- state.observer.observe(state.doc.body, {
168
- attributes: true,
169
- attributeFilter: ['class'],
170
- childList: true,
171
- subtree: true,
172
- });
173
- }
174
-
175
- state.onBeforeToggle = (event) => {
176
- const panel = event.target;
177
- if (!panel?.matches?.('[popover]')) return;
178
- if (event.newState === 'open') state.pendingOverlays.add(panel);
179
- else state.pendingOverlays.delete(panel);
180
- reconcileInert(state);
181
- };
182
- state.onToggle = (event) => {
183
- state.pendingOverlays.delete(event.target);
184
- scheduleReconcile(state);
185
- };
186
- state.doc.addEventListener('beforetoggle', state.onBeforeToggle, true);
187
- state.doc.addEventListener('toggle', state.onToggle, true);
188
- }
189
-
190
- function releaseDocumentState(state) {
191
- if (state.records.size) return;
192
- state.observer?.disconnect();
193
- state.observer = null;
194
- state.observing = false;
195
- state.doc.removeEventListener('beforetoggle', state.onBeforeToggle, true);
196
- state.doc.removeEventListener('toggle', state.onToggle, true);
197
- state.pendingOverlays.clear();
198
- reconcileInert(state);
199
- states.delete(state.doc);
200
- }
201
-
202
- function restoreAfterClose(record, nextTop) {
203
- const back = record.opener;
204
- record.opener = null;
205
- if (nextTop) {
206
- if (back?.isConnected && nextTop.modal.contains(back)) back.focus?.();
207
- else focusInto(nextTop.modal);
208
- return;
209
- }
210
- if (back?.isConnected && typeof back.focus === 'function') back.focus();
211
- }
212
-
213
- function syncRecord(record) {
214
- const { modal, state } = record;
215
- const nextActive = modal.classList.contains('is-open');
216
- if (nextActive === record.active) {
217
- if (!record.isNativeDialog) modal.hidden = !nextActive;
218
- scheduleReconcile(state);
219
- return;
220
- }
221
-
222
- const oldTop = state.top ?? activeTop(state);
223
- record.active = nextActive;
224
- if (nextActive) {
225
- record.opener = state.doc.activeElement;
226
- record.openedAt = ++state.sequence;
227
- if (!record.isNativeDialog) modal.hidden = false;
228
- const { nextTop } = reconcileInert(state);
229
- if (nextTop && (nextTop === record || modal.contains(nextTop.modal))) {
230
- focusInto(nextTop.modal);
231
- }
232
- return;
233
- }
234
-
235
- if (!record.isNativeDialog) modal.hidden = true;
236
- const closedOwnedTop = oldTop && (oldTop === record || modal.contains(oldTop.modal));
237
- const { nextTop } = reconcileInert(state);
238
- if (closedOwnedTop) restoreAfterClose(record, nextTop);
239
- else record.opener = null;
240
- }
241
-
242
- function unregisterRecord(record) {
243
- const { state, modal } = record;
244
- const oldTop = state.top ?? activeTop(state);
245
- const removedOwnedTop = oldTop && (oldTop === record || modal.contains(oldTop.modal));
246
- record.active = false;
247
- state.records.delete(record);
248
- state.byModal.delete(modal);
249
- const { nextTop } = reconcileInert(state);
250
- if (removedOwnedTop) restoreAfterClose(record, nextTop);
251
- else record.opener = null;
252
- releaseDocumentState(state);
253
- }
254
-
255
- function targetIsOwnedPopover(target, modal, state) {
256
- const panel = closestSafe(target, '.ui-popover, [popover]');
257
- return Boolean(panel && popoverIsOpen(panel, state) && modalOwnsPopover(modal, panel));
258
- }
259
-
260
- /**
261
- * @typedef {object} ModalCloseDetail
262
- * @property {'escape'} reason What asked the modal to close (currently only Escape).
263
- */
264
-
265
- /**
266
- * Focus management for the **controlled, non-`<dialog>` modal** — the
267
- * `.ui-modal.is-open` path a portal/React overlay uses when it genuinely can't
268
- * be a native `<dialog>`. The native `<dialog>` path gets a focus trap, Escape,
269
- * and the top layer for free (use `initDialog`); this supplies the equivalent
270
- * for the `.is-open` path, which otherwise leaves focus management to the
271
- * consumer.
272
- *
273
- * Mark the overlay `[data-bronto-modal]` (opt-in). On bind it gives the modal a
274
- * `role="dialog"` + `aria-modal="true"` (unless the author set a role) and
275
- * dev-warns when it has no accessible name. While open, a document-level stack
276
- * reconciler keeps only the top controlled modal interactive, marks the rest of
277
- * the page `inert`, admits an open popover owned by the top modal even when the
278
- * panel is portaled elsewhere, and applies the trap to background nodes added
279
- * after open. Nested and sibling portal modals therefore share one ownership
280
- * model instead of independently inverting each other's `inert` state.
281
- *
282
- * Bronto owns focus only: the **consumer still owns open/close state** (the
283
- * `is-open` class). Escape dispatches a cancelable `bronto:modal:close`
284
- * ({@link ModalCloseDetail}) on the modal so the consumer can drop `is-open` in
285
- * response; the behavior never changes visibility itself. Closing a parent
286
- * modal temporarily suspends any still-`is-open` controlled descendants; they
287
- * resume at the top of the stack if the parent reopens.
288
- *
289
- * SSR-safe, idempotent per modal; returns a cleanup function.
290
- *
291
- * @deprecated Use a native `<dialog>` with `initDialog()`. This controlled
292
- * non-dialog path remains compatible in 0.7 and is scheduled for removal no
293
- * earlier than 0.8 because no real consumer adopted it.
294
- *
295
- * @param {import('./internal.js').DelegateOpts} [opts]
296
- * @returns {import('./internal.js').Cleanup}
297
- */
298
- export function initModal({ root } = {}) {
299
- if (!hasDom()) return noop;
300
- const host = resolveHost(root);
301
- if (!host) return noop;
302
- const modals = collectHosts(host, '[data-bronto-modal]');
303
- const cleanups = [];
304
-
305
- for (const modal of modals) {
306
- const doc = modal.ownerDocument;
307
- if (!doc) continue;
308
- const view = doc.defaultView;
309
- cleanups.push(
310
- bindOnce(modal, 'modal', () => {
311
- const attrs = snapshotAttrs(modal, ['role', 'aria-modal', 'tabindex', 'hidden']);
312
- const state = modalState(doc);
313
- const record = {
314
- active: modal.classList.contains('is-open'),
315
- isNativeDialog: modal.localName === 'dialog',
316
- modal,
317
- openedAt: 0,
318
- opener: null,
319
- state,
320
- };
321
-
322
- if (!modal.hasAttribute('role')) modal.setAttribute('role', 'dialog');
323
- if (!modal.hasAttribute('aria-modal')) modal.setAttribute('aria-modal', 'true');
324
- const named =
325
- modal.hasAttribute('aria-label') ||
326
- modal.hasAttribute('aria-labelledby') ||
327
- modal.hasAttribute('title');
328
- if (!named && typeof console !== 'undefined') {
329
- console.warn(
330
- `[bronto] initModal(): a [data-bronto-modal] has no accessible name — add aria-label or aria-labelledby so it is announced as a named dialog.`,
331
- );
332
- }
333
-
334
- if (record.active) {
335
- record.opener = doc.activeElement;
336
- record.openedAt = ++state.sequence;
337
- }
338
- if (!record.isNativeDialog) modal.hidden = !record.active;
339
- state.records.add(record);
340
- state.byModal.set(modal, record);
341
- ensureDocumentObserver(state);
342
- reconcileInert(state);
343
- if (state.top === record) focusInto(modal);
344
-
345
- const Observer = view?.MutationObserver;
346
- const observer = Observer ? new Observer(() => syncRecord(record)) : null;
347
- observer?.observe(modal, { attributes: true, attributeFilter: ['class'] });
348
- const onKey = (event) => {
349
- if (event.key !== 'Escape' || state.top !== record) return;
350
- if (targetIsOwnedPopover(event.target, modal, state)) return;
351
- const ModalCloseEvent = view?.CustomEvent ?? CustomEvent;
352
- modal.dispatchEvent(
353
- new ModalCloseEvent('bronto:modal:close', {
354
- detail: { reason: 'escape' },
355
- bubbles: true,
356
- cancelable: true,
357
- }),
358
- );
359
- };
360
- doc.addEventListener('keydown', onKey, true);
361
-
362
- return () => {
363
- observer?.disconnect();
364
- doc.removeEventListener('keydown', onKey, true);
365
- unregisterRecord(record);
366
- restoreAttrs(modal, attrs);
367
- };
368
- }),
369
- );
370
- }
371
-
372
- return () => cleanups.forEach((fn) => fn());
373
- }
package/qwik/index.d.ts DELETED
@@ -1,48 +0,0 @@
1
- /** Generic escape hatch. NOTE for Qwik: prefer the specific `use*` hooks
2
- * below — they inline a statically-imported behavior so the optimizer can
3
- * serialize the task. Passing a runtime function here is only safe when it
4
- * is itself optimizer-visible (a module import).
5
- * @template {DelegateOpts} [T=DelegateOpts]
6
- * @param {(opts?: T) => Cleanup | void} init
7
- * @param {BrontoBindingOptsResolver<T>} [opts]
8
- * @returns {void} */
9
- export function useBrontoBehavior<T extends DelegateOpts = import("../behaviors/internal.js").DelegateOpts>(init: (opts?: T) => Cleanup | void, opts?: BrontoBindingOptsResolver<T>): void;
10
- export function useThemeToggle(opts?: BrontoBindingOptsResolver<ThemeStorageOpts & DelegateOpts>): void;
11
- export function useDismissible(opts?: BrontoBindingOptsResolver): void;
12
- export function useDisabledGuard(opts?: BrontoBindingOptsResolver): void;
13
- export function useDisclosure(opts?: BrontoBindingOptsResolver): void;
14
- export function useMenu(opts?: BrontoBindingOptsResolver): void;
15
- export function useFormValidation(opts?: BrontoBindingOptsResolver): void;
16
- export function useCombobox(opts?: BrontoBindingOptsResolver): void;
17
- export function usePopover(opts?: BrontoBindingOptsResolver): void;
18
- export function useTableSort(opts?: BrontoBindingOptsResolver): void;
19
- export function useTabs(opts?: BrontoBindingOptsResolver): void;
20
- export function useDialog(opts?: BrontoBindingOptsResolver): void;
21
- export function useModal(opts?: BrontoBindingOptsResolver): void;
22
- export function useCarousel(opts?: BrontoBindingOptsResolver): void;
23
- export function useDotGlyph(opts?: BrontoBindingOptsResolver): void;
24
- export function useLegend(opts?: BrontoBindingOptsResolver): void;
25
- export function useConnectors(opts?: BrontoBindingOptsResolver): void;
26
- export function useSpotlight(opts?: BrontoBindingOptsResolver): void;
27
- export function useCrosshair(opts?: BrontoBindingOptsResolver): void;
28
- export function useCommand(opts?: BrontoBindingOptsResolver): void;
29
- export function useSources(opts?: BrontoBindingOptsResolver): void;
30
- export function useSplitter(opts?: BrontoBindingOptsResolver): void;
31
- export function useToast(): (message: string, opts?: ToastOpts) => Cleanup;
32
- export { applyStoredTheme };
33
- export type Cleanup = import("../behaviors/index.js").Cleanup;
34
- export type DelegateOpts = import("../behaviors/index.js").DelegateOpts;
35
- export type ThemeStorageOpts = import("../behaviors/index.js").ThemeStorageOpts;
36
- export type ToastOpts = import("../behaviors/index.js").ToastOpts;
37
- export type BrontoBindingRoot = Document | Element | {
38
- value: Document | Element | null | undefined;
39
- } | {
40
- current: Document | Element | null | undefined;
41
- } | (() => Document | Element | null | undefined) | null | undefined;
42
- export type BrontoBindingOpts<T extends DelegateOpts = import("../behaviors/internal.js").DelegateOpts> = Omit<T, "root"> & {
43
- root?: BrontoBindingRoot;
44
- };
45
- export type BrontoBindingOptsResolver<T extends DelegateOpts = import("../behaviors/internal.js").DelegateOpts> = BrontoBindingOpts<T> | (() => BrontoBindingOpts<T> | null | undefined) | null | undefined;
46
- import { applyStoredTheme } from '../behaviors/index.js';
47
- export { cls, ui, cx } from "../classes/index.js";
48
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.js"],"names":[],"mappings":"AAuHA;;;;;;;sBAOsB;AACtB,kCAJ8B,CAAC,SAAhB,YAAa,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