@ponchia/ui 0.6.0 → 0.6.3
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.
- package/CHANGELOG.md +64 -4
- package/README.md +1 -1
- package/annotations/index.d.ts.map +1 -1
- package/annotations/index.js +36 -33
- package/behaviors/carousel.d.ts +28 -0
- package/behaviors/carousel.d.ts.map +1 -0
- package/behaviors/carousel.js +3 -0
- package/behaviors/combobox.d.ts +40 -0
- package/behaviors/combobox.d.ts.map +1 -0
- package/behaviors/combobox.js +71 -20
- package/behaviors/command.d.ts +41 -0
- package/behaviors/command.d.ts.map +1 -0
- package/behaviors/command.js +9 -0
- package/behaviors/connectors.d.ts +17 -0
- package/behaviors/connectors.d.ts.map +1 -0
- package/behaviors/connectors.js +3 -0
- package/behaviors/crosshair.d.ts +42 -0
- package/behaviors/crosshair.d.ts.map +1 -0
- package/behaviors/crosshair.js +19 -1
- package/behaviors/dialog.d.ts +20 -0
- package/behaviors/dialog.d.ts.map +1 -0
- package/behaviors/dialog.js +3 -0
- package/behaviors/disclosure.d.ts +10 -0
- package/behaviors/disclosure.d.ts.map +1 -0
- package/behaviors/disclosure.js +3 -0
- package/behaviors/dismissible.d.ts +10 -0
- package/behaviors/dismissible.d.ts.map +1 -0
- package/behaviors/dismissible.js +3 -0
- package/behaviors/forms.d.ts +27 -0
- package/behaviors/forms.d.ts.map +1 -0
- package/behaviors/forms.js +18 -5
- package/behaviors/glyph.d.ts +14 -0
- package/behaviors/glyph.d.ts.map +1 -0
- package/behaviors/glyph.js +24 -0
- package/behaviors/index.d.ts +31 -237
- package/behaviors/index.d.ts.map +1 -0
- package/behaviors/index.js +17 -0
- package/behaviors/inert.d.ts +20 -0
- package/behaviors/inert.d.ts.map +1 -0
- package/behaviors/inert.js +46 -0
- package/behaviors/internal.d.ts +25 -0
- package/behaviors/internal.d.ts.map +1 -0
- package/behaviors/internal.js +30 -1
- package/behaviors/legend.d.ts +35 -0
- package/behaviors/legend.d.ts.map +1 -0
- package/behaviors/legend.js +9 -0
- package/behaviors/menu.d.ts +16 -0
- package/behaviors/menu.d.ts.map +1 -0
- package/behaviors/menu.js +3 -0
- package/behaviors/modal.d.ts +41 -0
- package/behaviors/modal.d.ts.map +1 -0
- package/behaviors/modal.js +124 -0
- package/behaviors/popover.d.ts +28 -0
- package/behaviors/popover.d.ts.map +1 -0
- package/behaviors/popover.js +17 -17
- package/behaviors/spotlight.d.ts +17 -0
- package/behaviors/spotlight.d.ts.map +1 -0
- package/behaviors/spotlight.js +3 -0
- package/behaviors/table.d.ts +36 -0
- package/behaviors/table.d.ts.map +1 -0
- package/behaviors/table.js +48 -8
- package/behaviors/tabs.d.ts +20 -0
- package/behaviors/tabs.d.ts.map +1 -0
- package/behaviors/tabs.js +3 -0
- package/behaviors/theme.d.ts +54 -0
- package/behaviors/theme.d.ts.map +1 -0
- package/behaviors/theme.js +17 -0
- package/behaviors/toast.d.ts +49 -0
- package/behaviors/toast.d.ts.map +1 -0
- package/behaviors/toast.js +34 -2
- package/classes/classes.json +683 -13
- package/classes/index.d.ts +106 -2
- package/classes/index.js +249 -65
- package/connectors/index.d.ts +12 -0
- package/connectors/index.d.ts.map +1 -1
- package/connectors/index.js +23 -2
- package/css/app.css +26 -0
- package/css/bullet.css +108 -0
- package/css/code.css +98 -0
- package/css/content.css +15 -2
- package/css/crosshair.css +7 -7
- package/css/diff.css +153 -0
- package/css/disclosure.css +18 -4
- package/css/dots.css +37 -7
- package/css/feedback.css +39 -7
- package/css/forms.css +71 -3
- package/css/legend.css +5 -2
- package/css/motion.css +79 -14
- package/css/overlay.css +59 -2
- package/css/primitives.css +67 -8
- package/css/report.css +40 -0
- package/css/sidenote.css +67 -0
- package/css/spark.css +62 -0
- package/css/table.css +9 -2
- package/css/term.css +110 -0
- package/css/textref.css +63 -0
- package/css/toc.css +91 -0
- package/css/tokens.css +14 -1
- package/css/tree.css +134 -0
- package/dist/bronto.css +1 -1
- package/dist/css/analytical.css +1 -1
- package/dist/css/app.css +1 -1
- package/dist/css/bullet.css +1 -0
- package/dist/css/code.css +1 -0
- package/dist/css/content.css +1 -1
- package/dist/css/crosshair.css +1 -1
- package/dist/css/diff.css +1 -0
- package/dist/css/disclosure.css +1 -1
- package/dist/css/dots.css +1 -1
- package/dist/css/feedback.css +1 -1
- package/dist/css/forms.css +1 -1
- package/dist/css/legend.css +1 -1
- package/dist/css/motion.css +1 -1
- package/dist/css/overlay.css +1 -1
- package/dist/css/primitives.css +1 -1
- package/dist/css/report.css +1 -1
- package/dist/css/sidenote.css +1 -0
- package/dist/css/spark.css +1 -0
- package/dist/css/table.css +1 -1
- package/dist/css/term.css +1 -0
- package/dist/css/textref.css +1 -0
- package/dist/css/toc.css +1 -0
- package/dist/css/tokens.css +1 -1
- package/dist/css/tree.css +1 -0
- package/docs/annotations.md +39 -0
- package/docs/architecture.md +2 -3
- package/docs/bullet.md +78 -0
- package/docs/code.md +76 -0
- package/docs/d2.md +4 -3
- package/docs/diff.md +146 -0
- package/docs/legends.md +8 -4
- package/docs/mermaid.md +21 -4
- package/docs/reference.md +127 -8
- package/docs/reporting.md +35 -14
- package/docs/sidenote.md +64 -0
- package/docs/spark.md +78 -0
- package/docs/stability.md +1 -0
- package/docs/term.md +81 -0
- package/docs/textref.md +78 -0
- package/docs/theming.md +44 -5
- package/docs/toc.md +83 -0
- package/docs/tree.md +74 -0
- package/docs/usage.md +264 -23
- package/docs/vega.md +22 -3
- package/glyphs/glyphs.js +7 -1
- package/llms.txt +159 -13
- package/package.json +47 -7
- package/qwik/index.d.ts +4 -2
- package/qwik/index.d.ts.map +1 -1
- package/qwik/index.js +10 -0
- package/react/index.d.ts +4 -2
- package/react/index.d.ts.map +1 -1
- package/react/index.js +6 -0
- package/solid/index.d.ts +6 -2
- package/solid/index.d.ts.map +1 -1
- package/solid/index.js +6 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tabs.d.ts","sourceRoot":"","sources":["tabs.js"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;GAiBG;AACH,oCAHW,OAAO,eAAe,EAAE,YAAY,GAClC,OAAO,eAAe,EAAE,OAAO,CAuF3C"}
|
package/behaviors/tabs.js
CHANGED
|
@@ -14,6 +14,9 @@ import { hasDom, resolveHost, noop, bindOnce, nextFieldUid, collectHosts } from
|
|
|
14
14
|
* `initTabs` is guaranteed to run client-side — without it the panels
|
|
15
15
|
* stay hidden with no keyboard/pointer way to reveal them. Prefer
|
|
16
16
|
* authoring all panels visible and letting `initTabs` add `hidden`.
|
|
17
|
+
*
|
|
18
|
+
* @param {import('./internal.js').DelegateOpts} [opts]
|
|
19
|
+
* @returns {import('./internal.js').Cleanup}
|
|
17
20
|
*/
|
|
18
21
|
export function initTabs({ root } = {}) {
|
|
19
22
|
if (!hasDom()) return noop;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @typedef {object} ThemeStorageOpts
|
|
3
|
+
* @property {string} [storageKey] localStorage key for the persisted theme. Default: `"bronto-theme"`.
|
|
4
|
+
*
|
|
5
|
+
* @typedef {ThemeStorageOpts & { root?: Element }} ApplyThemeOpts
|
|
6
|
+
* `root` is the element to set `data-theme` on. Default: `<html>`.
|
|
7
|
+
*
|
|
8
|
+
* @typedef {object} ThemeChangeDetail
|
|
9
|
+
* @property {'light' | 'dark'} theme `bronto:themechange` CustomEvent detail.
|
|
10
|
+
*/
|
|
11
|
+
/**
|
|
12
|
+
* Apply the persisted theme to <html data-theme>. Call as early as
|
|
13
|
+
* possible (an inline module in <head>) to avoid a flash before the
|
|
14
|
+
* toggle wires up. No stored value → leaves prefers-color-scheme to act.
|
|
15
|
+
*
|
|
16
|
+
* @param {ApplyThemeOpts} [opts]
|
|
17
|
+
* @returns {void}
|
|
18
|
+
*/
|
|
19
|
+
export function applyStoredTheme({ storageKey, root }?: ApplyThemeOpts): void;
|
|
20
|
+
/**
|
|
21
|
+
* Wire `[data-bronto-theme-toggle]` controls. Click toggles light/dark,
|
|
22
|
+
* persists to localStorage, and **always** sets `data-theme` on <html>
|
|
23
|
+
* (a theme is document-global). State is reflected via `aria-pressed`
|
|
24
|
+
* and a `bronto:themechange` CustomEvent ({ detail: { theme } }) is
|
|
25
|
+
* dispatched on <html> so consumers can sync their own UI without
|
|
26
|
+
* racing the click handler. A control may set
|
|
27
|
+
* `data-bronto-theme-toggle="dark"` to force a specific theme.
|
|
28
|
+
*
|
|
29
|
+
* `root` scopes event delegation and which controls are queried/reflected
|
|
30
|
+
* (default `document`); it does not change where the theme is applied.
|
|
31
|
+
*
|
|
32
|
+
* @param {ThemeStorageOpts & import('./internal.js').DelegateOpts} [opts]
|
|
33
|
+
* @returns {import('./internal.js').Cleanup}
|
|
34
|
+
*/
|
|
35
|
+
export function initThemeToggle({ storageKey, root }?: ThemeStorageOpts & import("./internal.js").DelegateOpts): import("./internal.js").Cleanup;
|
|
36
|
+
export type ThemeStorageOpts = {
|
|
37
|
+
/**
|
|
38
|
+
* localStorage key for the persisted theme. Default: `"bronto-theme"`.
|
|
39
|
+
*/
|
|
40
|
+
storageKey?: string | undefined;
|
|
41
|
+
};
|
|
42
|
+
/**
|
|
43
|
+
* `root` is the element to set `data-theme` on. Default: `<html>`.
|
|
44
|
+
*/
|
|
45
|
+
export type ApplyThemeOpts = ThemeStorageOpts & {
|
|
46
|
+
root?: Element;
|
|
47
|
+
};
|
|
48
|
+
export type ThemeChangeDetail = {
|
|
49
|
+
/**
|
|
50
|
+
* `bronto:themechange` CustomEvent detail.
|
|
51
|
+
*/
|
|
52
|
+
theme: "light" | "dark";
|
|
53
|
+
};
|
|
54
|
+
//# sourceMappingURL=theme.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["theme.js"],"names":[],"mappings":"AAIA;;;;;;;;;GASG;AAEH;;;;;;;GAOG;AACH,wDAHW,cAAc,GACZ,IAAI,CAahB;AAED;;;;;;;;;;;;;;GAcG;AACH,uDAHW,gBAAgB,GAAG,OAAO,eAAe,EAAE,YAAY,GACrD,OAAO,eAAe,EAAE,OAAO,CAmD3C;;;;;;;;;;6BA5FY,gBAAgB,GAAG;IAAE,IAAI,CAAC,EAAE,OAAO,CAAA;CAAE;;;;;WAIpC,OAAO,GAAG,MAAM"}
|
package/behaviors/theme.js
CHANGED
|
@@ -2,10 +2,24 @@ import { hasDom, resolveHost, noop, bindOnce } from './internal.js';
|
|
|
2
2
|
|
|
3
3
|
const THEMES = ['light', 'dark'];
|
|
4
4
|
|
|
5
|
+
/**
|
|
6
|
+
* @typedef {object} ThemeStorageOpts
|
|
7
|
+
* @property {string} [storageKey] localStorage key for the persisted theme. Default: `"bronto-theme"`.
|
|
8
|
+
*
|
|
9
|
+
* @typedef {ThemeStorageOpts & { root?: Element }} ApplyThemeOpts
|
|
10
|
+
* `root` is the element to set `data-theme` on. Default: `<html>`.
|
|
11
|
+
*
|
|
12
|
+
* @typedef {object} ThemeChangeDetail
|
|
13
|
+
* @property {'light' | 'dark'} theme `bronto:themechange` CustomEvent detail.
|
|
14
|
+
*/
|
|
15
|
+
|
|
5
16
|
/**
|
|
6
17
|
* Apply the persisted theme to <html data-theme>. Call as early as
|
|
7
18
|
* possible (an inline module in <head>) to avoid a flash before the
|
|
8
19
|
* toggle wires up. No stored value → leaves prefers-color-scheme to act.
|
|
20
|
+
*
|
|
21
|
+
* @param {ApplyThemeOpts} [opts]
|
|
22
|
+
* @returns {void}
|
|
9
23
|
*/
|
|
10
24
|
export function applyStoredTheme({ storageKey = 'bronto-theme', root } = {}) {
|
|
11
25
|
if (!hasDom()) return;
|
|
@@ -31,6 +45,9 @@ export function applyStoredTheme({ storageKey = 'bronto-theme', root } = {}) {
|
|
|
31
45
|
*
|
|
32
46
|
* `root` scopes event delegation and which controls are queried/reflected
|
|
33
47
|
* (default `document`); it does not change where the theme is applied.
|
|
48
|
+
*
|
|
49
|
+
* @param {ThemeStorageOpts & import('./internal.js').DelegateOpts} [opts]
|
|
50
|
+
* @returns {import('./internal.js').Cleanup}
|
|
34
51
|
*/
|
|
35
52
|
export function initThemeToggle({ storageKey = 'bronto-theme', root } = {}) {
|
|
36
53
|
if (!hasDom()) return noop;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @typedef {object} ToastOpts
|
|
3
|
+
* @property {'accent' | 'success' | 'warning' | 'danger' | 'info'} [tone] Status tone — maps to `ui-toast--<tone>`.
|
|
4
|
+
* @property {string} [title] Optional uppercase label rendered above the message.
|
|
5
|
+
* @property {number} [duration] Auto-dismiss delay in ms. `0` keeps it until dismissed. Default: `4000`.
|
|
6
|
+
* @property {boolean} [assertive] Route to the assertive live region so AT interrupts immediately. Defaults to `true` when `tone === 'danger'`.
|
|
7
|
+
* @property {boolean} [closable] Render a dismiss button on the toast.
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* Push a transient toast into a shared, screen-anchored stack. The stack
|
|
11
|
+
* is the `aria-live="polite"` region: it is created once, appended to
|
|
12
|
+
* <body>, and **kept resident even when empty** so the live region is
|
|
13
|
+
* always present before content is inserted (a freshly created region
|
|
14
|
+
* that receives its first child in the same tick is not reliably
|
|
15
|
+
* announced by VoiceOver/NVDA). On first creation the empty region is
|
|
16
|
+
* inserted and the toast is appended on the next frame for the same
|
|
17
|
+
* reason. `tone` is accent/success/warning/danger/info; `title` is an
|
|
18
|
+
* optional uppercase label; `duration` ms before auto-dismiss (0 keeps
|
|
19
|
+
* it until dismissed). Returns a function that dismisses the toast
|
|
20
|
+
* early. SSR-safe (no-op).
|
|
21
|
+
*
|
|
22
|
+
* @param {string} message
|
|
23
|
+
* @param {ToastOpts} [opts]
|
|
24
|
+
* @returns {import('./internal.js').Cleanup}
|
|
25
|
+
*/
|
|
26
|
+
export function toast(message: string, { tone, title, duration, assertive, closable }?: ToastOpts): import("./internal.js").Cleanup;
|
|
27
|
+
export type ToastOpts = {
|
|
28
|
+
/**
|
|
29
|
+
* Status tone — maps to `ui-toast--<tone>`.
|
|
30
|
+
*/
|
|
31
|
+
tone?: "accent" | "success" | "warning" | "danger" | "info" | undefined;
|
|
32
|
+
/**
|
|
33
|
+
* Optional uppercase label rendered above the message.
|
|
34
|
+
*/
|
|
35
|
+
title?: string | undefined;
|
|
36
|
+
/**
|
|
37
|
+
* Auto-dismiss delay in ms. `0` keeps it until dismissed. Default: `4000`.
|
|
38
|
+
*/
|
|
39
|
+
duration?: number | undefined;
|
|
40
|
+
/**
|
|
41
|
+
* Route to the assertive live region so AT interrupts immediately. Defaults to `true` when `tone === 'danger'`.
|
|
42
|
+
*/
|
|
43
|
+
assertive?: boolean | undefined;
|
|
44
|
+
/**
|
|
45
|
+
* Render a dismiss button on the toast.
|
|
46
|
+
*/
|
|
47
|
+
closable?: boolean | undefined;
|
|
48
|
+
};
|
|
49
|
+
//# sourceMappingURL=toast.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toast.d.ts","sourceRoot":"","sources":["toast.js"],"names":[],"mappings":"AA2HA;;;;;;;GAOG;AAEH;;;;;;;;;;;;;;;;GAgBG;AACH,+BAJW,MAAM,mDACN,SAAS,GACP,OAAO,eAAe,EAAE,OAAO,CAgD3C"}
|
package/behaviors/toast.js
CHANGED
|
@@ -25,7 +25,13 @@ function toastStack(isAssertive) {
|
|
|
25
25
|
stack = document.createElement('div');
|
|
26
26
|
stack.className = isAssertive ? 'ui-toast-stack ui-toast-stack--assertive' : 'ui-toast-stack';
|
|
27
27
|
stack.setAttribute('aria-live', isAssertive ? 'assertive' : 'polite');
|
|
28
|
-
if (isAssertive)
|
|
28
|
+
if (isAssertive) {
|
|
29
|
+
stack.setAttribute('role', 'alert');
|
|
30
|
+
// The assertive region carries one error at a time and must be read whole;
|
|
31
|
+
// aria-atomic ensures the full toast (title + message) announces, not just
|
|
32
|
+
// the diff. (component audit C38.)
|
|
33
|
+
stack.setAttribute('aria-atomic', 'true');
|
|
34
|
+
}
|
|
29
35
|
document.body.appendChild(stack);
|
|
30
36
|
}
|
|
31
37
|
return { stack, fresh };
|
|
@@ -57,7 +63,12 @@ function toastElement(message, { tone, title }) {
|
|
|
57
63
|
}
|
|
58
64
|
el.className = validTone ? `ui-toast ui-toast--${validTone}` : 'ui-toast';
|
|
59
65
|
// No per-item role: the stack itself is the live region; a nested
|
|
60
|
-
// live region risks double announcement in some SRs.
|
|
66
|
+
// live region risks double announcement in some SRs. But mark the toast
|
|
67
|
+
// aria-atomic so a *titled* toast announces title + message as one unit, not
|
|
68
|
+
// disjointly — and unlike aria-atomic on the polite STACK (which would re-read
|
|
69
|
+
// every resident toast on each new one), scoping it to the toast keeps sibling
|
|
70
|
+
// toasts out of the announcement. (component audit C23.)
|
|
71
|
+
el.setAttribute('aria-atomic', 'true');
|
|
61
72
|
if (title) {
|
|
62
73
|
const t = document.createElement('p');
|
|
63
74
|
t.className = 'ui-toast__title';
|
|
@@ -110,6 +121,15 @@ function addToastClose(el, dismiss) {
|
|
|
110
121
|
el.appendChild(close);
|
|
111
122
|
}
|
|
112
123
|
|
|
124
|
+
/**
|
|
125
|
+
* @typedef {object} ToastOpts
|
|
126
|
+
* @property {'accent' | 'success' | 'warning' | 'danger' | 'info'} [tone] Status tone — maps to `ui-toast--<tone>`.
|
|
127
|
+
* @property {string} [title] Optional uppercase label rendered above the message.
|
|
128
|
+
* @property {number} [duration] Auto-dismiss delay in ms. `0` keeps it until dismissed. Default: `4000`.
|
|
129
|
+
* @property {boolean} [assertive] Route to the assertive live region so AT interrupts immediately. Defaults to `true` when `tone === 'danger'`.
|
|
130
|
+
* @property {boolean} [closable] Render a dismiss button on the toast.
|
|
131
|
+
*/
|
|
132
|
+
|
|
113
133
|
/**
|
|
114
134
|
* Push a transient toast into a shared, screen-anchored stack. The stack
|
|
115
135
|
* is the `aria-live="polite"` region: it is created once, appended to
|
|
@@ -122,6 +142,10 @@ function addToastClose(el, dismiss) {
|
|
|
122
142
|
* optional uppercase label; `duration` ms before auto-dismiss (0 keeps
|
|
123
143
|
* it until dismissed). Returns a function that dismisses the toast
|
|
124
144
|
* early. SSR-safe (no-op).
|
|
145
|
+
*
|
|
146
|
+
* @param {string} message
|
|
147
|
+
* @param {ToastOpts} [opts]
|
|
148
|
+
* @returns {import('./internal.js').Cleanup}
|
|
125
149
|
*/
|
|
126
150
|
export function toast(message, { tone, title, duration = 4000, assertive, closable } = {}) {
|
|
127
151
|
if (!hasDom()) return noop;
|
|
@@ -158,6 +182,14 @@ export function toast(message, { tone, title, duration = 4000, assertive, closab
|
|
|
158
182
|
// it gets a dismiss affordance by default; any toast can opt in via
|
|
159
183
|
// `closable`. The button carries no text node (glyph is a CSS
|
|
160
184
|
// ::before) so the toast's announced/textContent stays the message.
|
|
185
|
+
// Explicitly opting OUT of the close button on a sticky toast strands it with
|
|
186
|
+
// no in-UI dismissal — warn that the caller must retain and call the returned
|
|
187
|
+
// dismiss fn. (component audit C37.)
|
|
188
|
+
if (duration === 0 && closable === false && typeof console !== 'undefined') {
|
|
189
|
+
console.warn(
|
|
190
|
+
'[bronto] toast(): duration:0 + closable:false has no in-UI dismissal — keep the returned dismiss() and call it yourself, or set closable:true.',
|
|
191
|
+
);
|
|
192
|
+
}
|
|
161
193
|
if (closable ?? duration === 0) addToastClose(el, dismiss);
|
|
162
194
|
if (duration > 0) timer = setTimeout(dismiss, duration);
|
|
163
195
|
return dismiss;
|