@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
package/solid/index.js DELETED
@@ -1,172 +0,0 @@
1
- /**
2
- * @ponchia/ui/solid — thin Solid bindings over @ponchia/ui/behaviors.
3
- *
4
- * The CSS is the framework; these are *optional* primitives that wrap the
5
- * SSR-safe vanilla `init*` behaviors in Solid's lifecycle (run on mount, clean
6
- * up on dispose). Thin adapters, not a component library (architecture ADR).
7
- * `solid-js` is an optional peer dependency.
8
- *
9
- * Behaviors delegate from a root (default `document`); call a primitive once in
10
- * a component that owns the relevant subtree, and pass a root resolver to scope
11
- * it when the element is assigned by Solid's ref lifecycle.
12
- *
13
- * import { useDialog, useToast } from '@ponchia/ui/solid';
14
- * function App() {
15
- * useDialog(); // wires every .ui-modal under document
16
- * const toast = useToast();
17
- * return <button onClick={() => toast('Saved', { tone: 'success' })}>Save</button>;
18
- * }
19
- *
20
- * The public types below are JSDoc `@typedef`s; the shipped `index.d.ts` is
21
- * generated from them (and these signatures) by `tsc --emitDeclarationOnly`.
22
- *
23
- * @deprecated Import the framework-agnostic behavior initializers directly.
24
- * This adapter remains compatible in 0.7 and is scheduled for removal no
25
- * earlier than 0.8 because no real consumer adopted it.
26
- *
27
- * @typedef {import('../behaviors/index.js').Cleanup} Cleanup
28
- * @typedef {import('../behaviors/index.js').DelegateOpts} DelegateOpts
29
- * @typedef {import('../behaviors/index.js').ThemeStorageOpts} ThemeStorageOpts
30
- * @typedef {import('../behaviors/index.js').ToastOpts} ToastOpts
31
- *
32
- * @typedef {Document
33
- * | Element
34
- * | { current: Document | Element | null | undefined }
35
- * | (() => Document | Element | null | undefined)
36
- * | null
37
- * | undefined} BrontoBindingRoot
38
- */
39
-
40
- /**
41
- * Behavior options with the `root` widened to accept Solid refs/resolvers.
42
- * @template {DelegateOpts} [T=DelegateOpts]
43
- * @typedef {Omit<T, 'root'> & { root?: BrontoBindingRoot }} BrontoBindingOpts
44
- */
45
-
46
- /**
47
- * `BrontoBindingOpts<T>`, or a callback that returns it on mount (after refs).
48
- * @template {DelegateOpts} [T=DelegateOpts]
49
- * @typedef {BrontoBindingOpts<T>
50
- * | (() => BrontoBindingOpts<T> | null | undefined)
51
- * | null
52
- * | undefined} BrontoBindingOptsResolver
53
- */
54
- import { createEffect, onCleanup, onMount } from 'solid-js';
55
- import {
56
- applyStoredTheme,
57
- initThemeToggle,
58
- dismissible,
59
- initDisabledGuard,
60
- initDisclosure,
61
- initMenu,
62
- initFormValidation,
63
- initCombobox,
64
- initPopover,
65
- initTableSort,
66
- initTabs,
67
- initDialog,
68
- initModal,
69
- initCarousel,
70
- initDotGlyph,
71
- initLegend,
72
- initConnectors,
73
- initSpotlight,
74
- initCrosshair,
75
- initCommand,
76
- initSources,
77
- initSplitter,
78
- toast,
79
- } from '../behaviors/index.js';
80
-
81
- function resolveMaybe(v) {
82
- return typeof v === 'function' ? v() : v;
83
- }
84
-
85
- function resolveRoot(root) {
86
- const value = resolveMaybe(root);
87
- if (value && typeof value === 'object' && 'current' in value) return value.current;
88
- return value;
89
- }
90
-
91
- function resolveOpts(opts) {
92
- const value = resolveMaybe(opts);
93
- if (!value || typeof value !== 'object') return undefined;
94
- // No `root` key → no scope requested; leave root out so the behavior
95
- // delegates from `document`. A `root` key that resolves falsy means a scope
96
- // WAS requested but the ref is not ready: emit `root: null` so the behavior
97
- // no-ops instead of hijacking the whole document.
98
- if (!('root' in value)) return { ...value };
99
- const root = resolveRoot(value.root);
100
- return { ...value, root: root || null };
101
- }
102
-
103
- /** Run a delegated behavior for the component's lifetime (init after mount, its
104
- * returned cleanup before re-init/dispose). Options resolve after mount and
105
- * re-resolve when tracked Solid signals change.
106
- * @template {DelegateOpts} [T=DelegateOpts]
107
- * @param {(opts?: T) => Cleanup | void} init
108
- * @param {BrontoBindingOptsResolver<T>} [opts]
109
- * @returns {void}
110
- */
111
- export function useBrontoBehavior(init, opts) {
112
- onMount(() => {
113
- createEffect(() => {
114
- const cleanup = init(resolveOpts(opts));
115
- if (typeof cleanup === 'function') onCleanup(cleanup);
116
- });
117
- });
118
- }
119
-
120
- /** @type {(opts?: BrontoBindingOptsResolver<ThemeStorageOpts & DelegateOpts>) => void} */
121
- export const useThemeToggle = (opts) => useBrontoBehavior(initThemeToggle, opts);
122
- /** @type {(opts?: BrontoBindingOptsResolver) => void} */
123
- export const useDismissible = (opts) => useBrontoBehavior(dismissible, opts);
124
- /** @type {(opts?: BrontoBindingOptsResolver) => void} */
125
- export const useDisabledGuard = (opts) => useBrontoBehavior(initDisabledGuard, opts);
126
- /** @type {(opts?: BrontoBindingOptsResolver) => void} */
127
- export const useDisclosure = (opts) => useBrontoBehavior(initDisclosure, opts);
128
- /** @type {(opts?: BrontoBindingOptsResolver) => void} */
129
- export const useMenu = (opts) => useBrontoBehavior(initMenu, opts);
130
- /** @type {(opts?: BrontoBindingOptsResolver) => void} */
131
- export const useFormValidation = (opts) => useBrontoBehavior(initFormValidation, opts);
132
- /** @type {(opts?: BrontoBindingOptsResolver) => void} */
133
- export const useCombobox = (opts) => useBrontoBehavior(initCombobox, opts);
134
- /** @type {(opts?: BrontoBindingOptsResolver) => void} */
135
- export const usePopover = (opts) => useBrontoBehavior(initPopover, opts);
136
- /** @type {(opts?: BrontoBindingOptsResolver) => void} */
137
- export const useTableSort = (opts) => useBrontoBehavior(initTableSort, opts);
138
- /** @type {(opts?: BrontoBindingOptsResolver) => void} */
139
- export const useTabs = (opts) => useBrontoBehavior(initTabs, opts);
140
- /** @type {(opts?: BrontoBindingOptsResolver) => void} */
141
- export const useDialog = (opts) => useBrontoBehavior(initDialog, opts);
142
- /** @type {(opts?: BrontoBindingOptsResolver) => void} */
143
- export const useModal = (opts) => useBrontoBehavior(initModal, opts);
144
- /** @type {(opts?: BrontoBindingOptsResolver) => void} */
145
- export const useCarousel = (opts) => useBrontoBehavior(initCarousel, opts);
146
- /** @type {(opts?: BrontoBindingOptsResolver) => void} */
147
- export const useDotGlyph = (opts) => useBrontoBehavior(initDotGlyph, opts);
148
- /** @type {(opts?: BrontoBindingOptsResolver) => void} */
149
- export const useLegend = (opts) => useBrontoBehavior(initLegend, opts);
150
- /** @type {(opts?: BrontoBindingOptsResolver) => void} */
151
- export const useConnectors = (opts) => useBrontoBehavior(initConnectors, opts);
152
- /** @type {(opts?: BrontoBindingOptsResolver) => void} */
153
- export const useSpotlight = (opts) => useBrontoBehavior(initSpotlight, opts);
154
- /** @type {(opts?: BrontoBindingOptsResolver) => void} */
155
- export const useCrosshair = (opts) => useBrontoBehavior(initCrosshair, opts);
156
- /** @type {(opts?: BrontoBindingOptsResolver) => void} */
157
- export const useCommand = (opts) => useBrontoBehavior(initCommand, opts);
158
- /** @type {(opts?: BrontoBindingOptsResolver) => void} */
159
- export const useSources = (opts) => useBrontoBehavior(initSources, opts);
160
- /** @type {(opts?: BrontoBindingOptsResolver) => void} */
161
- export const useSplitter = (opts) => useBrontoBehavior(initSplitter, opts);
162
-
163
- /** The `toast()` imperative (no lifecycle of its own).
164
- * @type {() => (message: string, opts?: ToastOpts) => Cleanup} */
165
- export const useToast = () => toast;
166
-
167
- // No-flash theme application must run before paint — do it in an inline head
168
- // script, not on mount. Re-exported for manual/SSR-bootstrap use.
169
- export { applyStoredTheme };
170
-
171
- // Convenience: the framework-agnostic class contract, re-exported.
172
- export { cls, ui, cx } from '../classes/index.js';
package/svelte/index.d.ts DELETED
@@ -1,114 +0,0 @@
1
- /**
2
- * Create a Svelte action from any Bronto delegated behavior initializer.
3
- *
4
- * @param {(opts?: DelegateOpts) => Cleanup | void} init
5
- * @returns {BrontoAction}
6
- */
7
- export function createBrontoAction(init: (opts?: DelegateOpts) => Cleanup | void): BrontoAction;
8
- /**
9
- * Generic escape hatch for custom behavior initializers.
10
- *
11
- * @param {Element} node
12
- * @param {BrontoBehaviorParams | null | undefined} params
13
- * @returns {SvelteActionReturn}
14
- */
15
- export function brontoBehavior(node: Element, params: BrontoBehaviorParams | null | undefined): SvelteActionReturn;
16
- /**
17
- * Generic escape hatch for custom behavior initializers.
18
- *
19
- * @param {Element} node
20
- * @param {BrontoBehaviorParams | null | undefined} params
21
- * @returns {SvelteActionReturn}
22
- */
23
- export function useBrontoBehavior(node: Element, params: BrontoBehaviorParams | null | undefined): SvelteActionReturn;
24
- /** @type {BrontoThemeAction} */
25
- export const themeToggle: BrontoThemeAction;
26
- /** @type {BrontoAction} */
27
- export const dismissible: BrontoAction;
28
- /** @type {BrontoAction} */
29
- export const disabledGuard: BrontoAction;
30
- /** @type {BrontoAction} */
31
- export const disclosure: BrontoAction;
32
- /** @type {BrontoAction} */
33
- export const menu: BrontoAction;
34
- /** @type {BrontoAction} */
35
- export const formValidation: BrontoAction;
36
- /** @type {BrontoAction} */
37
- export const combobox: BrontoAction;
38
- /** @type {BrontoAction} */
39
- export const popover: BrontoAction;
40
- /** @type {BrontoAction} */
41
- export const tableSort: BrontoAction;
42
- /** @type {BrontoAction} */
43
- export const tabs: BrontoAction;
44
- /** @type {BrontoAction} */
45
- export const dialog: BrontoAction;
46
- /** @type {BrontoAction} */
47
- export const modal: BrontoAction;
48
- /** @type {BrontoAction} */
49
- export const carousel: BrontoAction;
50
- /** @type {BrontoAction} */
51
- export const dotGlyph: BrontoAction;
52
- /** @type {BrontoAction} */
53
- export const legend: BrontoAction;
54
- /** @type {BrontoAction} */
55
- export const connectors: BrontoAction;
56
- /** @type {BrontoAction} */
57
- export const spotlight: BrontoAction;
58
- /** @type {BrontoAction} */
59
- export const crosshair: BrontoAction;
60
- /** @type {BrontoAction} */
61
- export const command: BrontoAction;
62
- /** @type {BrontoAction} */
63
- export const sources: BrontoAction;
64
- /** @type {BrontoAction} */
65
- export const splitter: BrontoAction;
66
- /** @type {BrontoThemeAction} */
67
- export const useThemeToggle: BrontoThemeAction;
68
- export const useDismissible: BrontoAction;
69
- export const useDisabledGuard: BrontoAction;
70
- export const useDisclosure: BrontoAction;
71
- export const useMenu: BrontoAction;
72
- export const useFormValidation: BrontoAction;
73
- export const useCombobox: BrontoAction;
74
- export const usePopover: BrontoAction;
75
- export const useTableSort: BrontoAction;
76
- export const useTabs: BrontoAction;
77
- export const useDialog: BrontoAction;
78
- export const useModal: BrontoAction;
79
- export const useCarousel: BrontoAction;
80
- export const useDotGlyph: BrontoAction;
81
- export const useLegend: BrontoAction;
82
- export const useConnectors: BrontoAction;
83
- export const useSpotlight: BrontoAction;
84
- export const useCrosshair: BrontoAction;
85
- export const useCommand: BrontoAction;
86
- export const useSources: BrontoAction;
87
- export const useSplitter: BrontoAction;
88
- export function useToast(): (message: string, opts?: ToastOpts) => Cleanup;
89
- export type Cleanup = import("../behaviors/index.js").Cleanup;
90
- export type DelegateOpts = import("../behaviors/index.js").DelegateOpts;
91
- export type ThemeStorageOpts = import("../behaviors/index.js").ThemeStorageOpts;
92
- export type ToastOpts = import("../behaviors/index.js").ToastOpts;
93
- export type BrontoActionRoot = Document | Element | null | undefined;
94
- export type BrontoActionOpts = Omit<DelegateOpts, "root"> & {
95
- root?: BrontoActionRoot;
96
- };
97
- export type BrontoThemeActionOpts = Omit<ThemeStorageOpts & DelegateOpts, "root"> & {
98
- root?: BrontoActionRoot;
99
- };
100
- export type BrontoBehaviorParams = {
101
- init: (opts?: DelegateOpts) => Cleanup | void;
102
- opts?: BrontoActionOpts | null | undefined;
103
- };
104
- export type BrontoAction = (node: Element, opts?: BrontoActionOpts | null | undefined) => SvelteActionReturn;
105
- export type BrontoThemeAction = (node: Element, opts?: BrontoThemeActionOpts | null | undefined) => SvelteActionReturn;
106
- export type SvelteActionReturn = {
107
- update?: (next?: unknown) => void;
108
- destroy: () => void;
109
- };
110
- import { applyStoredTheme } from '../behaviors/index.js';
111
- import { toast } from '../behaviors/index.js';
112
- export { applyStoredTheme, toast };
113
- export { cls, ui, cx } from "../classes/index.js";
114
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.js"],"names":[],"mappings":"AAiFA;;;;;GAKG;AACH,yCAHW,CAAC,IAAI,CAAC,EAAE,YAAY,KAAK,OAAO,GAAG,IAAI,GACrC,YAAY,CAexB;AAED;;;;;;GAMG;AACH,qCAJW,OAAO,UACP,oBAAoB,GAAG,IAAI,GAAG,SAAS,GACrC,kBAAkB,CAa9B;AAlBD;;;;;;GAMG;AACH,wCAJW,OAAO,UACP,oBAAoB,GAAG,IAAI,GAAG,SAAS,GACrC,kBAAkB,CAa9B;AAID,gCAAgC;AAChC,0BADW,iBAAiB,CACmC;AAC/D,2BAA2B;AAC3B,0BADW,YAAY,CACwC;AAC/D,2BAA2B;AAC3B,4BADW,YAAY,CAC4C;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O,uBAAuB,EAAE,gBAAgB;wBAChD,OAAO,uBAAuB,EAAE,SAAS;+BAEzC,QAAQ,GAAG,OAAO,GAAG,IAAI,GAAG,SAAS;+BAErC,IAAI,CAAC,YAAY,EAAE,MAAM,CAAC,GAAG;IAAE,IAAI,CAAC,EAAE,gBAAgB,CAAA;CAAE;oCAExD,IAAI,CAAC,gBAAgB,GAAG,YAAY,EAAE,MAAM,CAAC,GAAG;IAAE,IAAI,CAAC,EAAE,gBAAgB,CAAA;CAAE;mCAE3E;IAAE,IAAI,EAAE,CAAC,IAAI,CAAC,EAAE,YAAY,KAAK,OAAO,GAAG,IAAI,CAAC;IAAC,IAAI,CAAC,EAAE,gBAAgB,GAAG,IAAI,GAAG,SAAS,CAAA;CAAE;2BAE7F,CAAC,IAAI,EAAE,OAAO,EAAE,IAAI,CAAC,EAAE,gBAAgB,GAAG,IAAI,GAAG,SAAS,KAAK,kBAAkB;gCAEjF,CAAC,IAAI,EAAE,OAAO,EAAE,IAAI,CAAC,EAAE,qBAAqB,GAAG,IAAI,GAAG,SAAS,KAAK,kBAAkB;iCAEtF;IAAE,MAAM,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,OAAO,KAAK,IAAI,CAAC;IAAC,OAAO,EAAE,MAAM,IAAI,CAAA;CAAE;iCA0BhE,uBAAuB;sBAAvB,uBAAuB"}
package/svelte/index.js DELETED
@@ -1,197 +0,0 @@
1
- /**
2
- * @ponchia/ui/svelte — thin Svelte actions over @ponchia/ui/behaviors.
3
- *
4
- * The CSS is the framework; these are optional lifecycle adapters that run the
5
- * SSR-safe vanilla behavior initializers when a Svelte action mounts and clean
6
- * them up when the action updates or is destroyed. They do not define markup,
7
- * own state, or depend on Svelte at runtime.
8
- *
9
- * <script>
10
- * import { themeToggle } from '@ponchia/ui/svelte';
11
- * </script>
12
- *
13
- * <main use:themeToggle>
14
- * <button data-bronto-theme-toggle>Toggle theme</button>
15
- * </main>
16
- *
17
- * @deprecated Import the framework-agnostic behavior initializers directly.
18
- * This adapter remains compatible in 0.7 and is scheduled for removal no
19
- * earlier than 0.8 because no real consumer adopted it.
20
- *
21
- * @typedef {import('../behaviors/index.js').Cleanup} Cleanup
22
- * @typedef {import('../behaviors/index.js').DelegateOpts} DelegateOpts
23
- * @typedef {import('../behaviors/index.js').ThemeStorageOpts} ThemeStorageOpts
24
- * @typedef {import('../behaviors/index.js').ToastOpts} ToastOpts
25
- *
26
- * @typedef {Document | Element | null | undefined} BrontoActionRoot
27
- *
28
- * @typedef {Omit<DelegateOpts, 'root'> & { root?: BrontoActionRoot }} BrontoActionOpts
29
- *
30
- * @typedef {Omit<ThemeStorageOpts & DelegateOpts, 'root'> & { root?: BrontoActionRoot }} BrontoThemeActionOpts
31
- *
32
- * @typedef {{ init: (opts?: DelegateOpts) => Cleanup | void, opts?: BrontoActionOpts | null | undefined }} BrontoBehaviorParams
33
- *
34
- * @typedef {(node: Element, opts?: BrontoActionOpts | null | undefined) => SvelteActionReturn} BrontoAction
35
- *
36
- * @typedef {(node: Element, opts?: BrontoThemeActionOpts | null | undefined) => SvelteActionReturn} BrontoThemeAction
37
- *
38
- * @typedef {{ update?: (next?: unknown) => void, destroy: () => void }} SvelteActionReturn
39
- */
40
- import {
41
- applyStoredTheme,
42
- initThemeToggle,
43
- dismissible as initDismissible,
44
- initDisabledGuard,
45
- initDisclosure,
46
- initMenu,
47
- initFormValidation,
48
- initCombobox,
49
- initPopover,
50
- initTableSort,
51
- initTabs,
52
- initDialog,
53
- initModal,
54
- initCarousel,
55
- initDotGlyph,
56
- initLegend,
57
- initConnectors,
58
- initSpotlight,
59
- initCrosshair,
60
- initCommand,
61
- initSources,
62
- initSplitter,
63
- toast,
64
- } from '../behaviors/index.js';
65
-
66
- function stop(cleanup) {
67
- if (typeof cleanup === 'function') cleanup();
68
- }
69
-
70
- function resolveOpts(node, opts) {
71
- if (!opts || typeof opts !== 'object') return { root: node };
72
- if (!('root' in opts)) return { ...opts, root: node };
73
- return { ...opts, root: opts.root || null };
74
- }
75
-
76
- function run(node, init, opts) {
77
- if (typeof init !== 'function') return () => {};
78
- const cleanup = init(resolveOpts(node, opts));
79
- return typeof cleanup === 'function' ? cleanup : () => {};
80
- }
81
-
82
- /**
83
- * Create a Svelte action from any Bronto delegated behavior initializer.
84
- *
85
- * @param {(opts?: DelegateOpts) => Cleanup | void} init
86
- * @returns {BrontoAction}
87
- */
88
- export function createBrontoAction(init) {
89
- return (node, opts) => {
90
- let cleanup = run(node, init, opts);
91
- return {
92
- update(next) {
93
- stop(cleanup);
94
- cleanup = run(node, init, next);
95
- },
96
- destroy() {
97
- stop(cleanup);
98
- },
99
- };
100
- };
101
- }
102
-
103
- /**
104
- * Generic escape hatch for custom behavior initializers.
105
- *
106
- * @param {Element} node
107
- * @param {BrontoBehaviorParams | null | undefined} params
108
- * @returns {SvelteActionReturn}
109
- */
110
- export function brontoBehavior(node, params) {
111
- let cleanup = run(node, params?.init, params?.opts);
112
- return {
113
- update(next) {
114
- stop(cleanup);
115
- cleanup = run(node, next?.init, next?.opts);
116
- },
117
- destroy() {
118
- stop(cleanup);
119
- },
120
- };
121
- }
122
-
123
- export const useBrontoBehavior = brontoBehavior;
124
-
125
- /** @type {BrontoThemeAction} */
126
- export const themeToggle = createBrontoAction(initThemeToggle);
127
- /** @type {BrontoAction} */
128
- export const dismissible = createBrontoAction(initDismissible);
129
- /** @type {BrontoAction} */
130
- export const disabledGuard = createBrontoAction(initDisabledGuard);
131
- /** @type {BrontoAction} */
132
- export const disclosure = createBrontoAction(initDisclosure);
133
- /** @type {BrontoAction} */
134
- export const menu = createBrontoAction(initMenu);
135
- /** @type {BrontoAction} */
136
- export const formValidation = createBrontoAction(initFormValidation);
137
- /** @type {BrontoAction} */
138
- export const combobox = createBrontoAction(initCombobox);
139
- /** @type {BrontoAction} */
140
- export const popover = createBrontoAction(initPopover);
141
- /** @type {BrontoAction} */
142
- export const tableSort = createBrontoAction(initTableSort);
143
- /** @type {BrontoAction} */
144
- export const tabs = createBrontoAction(initTabs);
145
- /** @type {BrontoAction} */
146
- export const dialog = createBrontoAction(initDialog);
147
- /** @type {BrontoAction} */
148
- export const modal = createBrontoAction(initModal);
149
- /** @type {BrontoAction} */
150
- export const carousel = createBrontoAction(initCarousel);
151
- /** @type {BrontoAction} */
152
- export const dotGlyph = createBrontoAction(initDotGlyph);
153
- /** @type {BrontoAction} */
154
- export const legend = createBrontoAction(initLegend);
155
- /** @type {BrontoAction} */
156
- export const connectors = createBrontoAction(initConnectors);
157
- /** @type {BrontoAction} */
158
- export const spotlight = createBrontoAction(initSpotlight);
159
- /** @type {BrontoAction} */
160
- export const crosshair = createBrontoAction(initCrosshair);
161
- /** @type {BrontoAction} */
162
- export const command = createBrontoAction(initCommand);
163
- /** @type {BrontoAction} */
164
- export const sources = createBrontoAction(initSources);
165
- /** @type {BrontoAction} */
166
- export const splitter = createBrontoAction(initSplitter);
167
-
168
- // Hook-style aliases keep this action surface parallel with React/Solid/Qwik.
169
- /** @type {BrontoThemeAction} */
170
- export const useThemeToggle = themeToggle;
171
- export const useDismissible = dismissible;
172
- export const useDisabledGuard = disabledGuard;
173
- export const useDisclosure = disclosure;
174
- export const useMenu = menu;
175
- export const useFormValidation = formValidation;
176
- export const useCombobox = combobox;
177
- export const usePopover = popover;
178
- export const useTableSort = tableSort;
179
- export const useTabs = tabs;
180
- export const useDialog = dialog;
181
- export const useModal = modal;
182
- export const useCarousel = carousel;
183
- export const useDotGlyph = dotGlyph;
184
- export const useLegend = legend;
185
- export const useConnectors = connectors;
186
- export const useSpotlight = spotlight;
187
- export const useCrosshair = crosshair;
188
- export const useCommand = command;
189
- export const useSources = sources;
190
- export const useSplitter = splitter;
191
-
192
- /** The `toast()` imperative (no lifecycle of its own).
193
- * @returns {(message: string, opts?: ToastOpts) => Cleanup} */
194
- export const useToast = () => toast;
195
-
196
- export { applyStoredTheme, toast };
197
- export { cls, ui, cx } from '../classes/index.js';
package/vue/index.d.ts DELETED
@@ -1,116 +0,0 @@
1
- /**
2
- * Create a Vue directive object from any Bronto delegated behavior initializer.
3
- *
4
- * @param {(opts?: DelegateOpts) => Cleanup | void} init
5
- * @returns {BrontoDirective}
6
- */
7
- export function createBrontoDirective(init: (opts?: DelegateOpts) => Cleanup | void): BrontoDirective;
8
- /** @type {BrontoThemeDirective} */
9
- export const vThemeToggle: BrontoThemeDirective;
10
- /** @type {BrontoDirective} */
11
- export const vDismissible: BrontoDirective;
12
- /** @type {BrontoDirective} */
13
- export const vDisabledGuard: BrontoDirective;
14
- /** @type {BrontoDirective} */
15
- export const vDisclosure: BrontoDirective;
16
- /** @type {BrontoDirective} */
17
- export const vMenu: BrontoDirective;
18
- /** @type {BrontoDirective} */
19
- export const vFormValidation: BrontoDirective;
20
- /** @type {BrontoDirective} */
21
- export const vCombobox: BrontoDirective;
22
- /** @type {BrontoDirective} */
23
- export const vPopover: BrontoDirective;
24
- /** @type {BrontoDirective} */
25
- export const vTableSort: BrontoDirective;
26
- /** @type {BrontoDirective} */
27
- export const vTabs: BrontoDirective;
28
- /** @type {BrontoDirective} */
29
- export const vDialog: BrontoDirective;
30
- /** @type {BrontoDirective} */
31
- export const vModal: BrontoDirective;
32
- /** @type {BrontoDirective} */
33
- export const vCarousel: BrontoDirective;
34
- /** @type {BrontoDirective} */
35
- export const vDotGlyph: BrontoDirective;
36
- /** @type {BrontoDirective} */
37
- export const vLegend: BrontoDirective;
38
- /** @type {BrontoDirective} */
39
- export const vConnectors: BrontoDirective;
40
- /** @type {BrontoDirective} */
41
- export const vSpotlight: BrontoDirective;
42
- /** @type {BrontoDirective} */
43
- export const vCrosshair: BrontoDirective;
44
- /** @type {BrontoDirective} */
45
- export const vCommand: BrontoDirective;
46
- /** @type {BrontoDirective} */
47
- export const vSources: BrontoDirective;
48
- /** @type {BrontoDirective} */
49
- export const vSplitter: BrontoDirective;
50
- export const directives: Readonly<{
51
- themeToggle: BrontoThemeDirective;
52
- dismissible: BrontoDirective;
53
- disabledGuard: BrontoDirective;
54
- disclosure: BrontoDirective;
55
- menu: BrontoDirective;
56
- formValidation: BrontoDirective;
57
- combobox: BrontoDirective;
58
- popover: BrontoDirective;
59
- tableSort: BrontoDirective;
60
- tabs: BrontoDirective;
61
- dialog: BrontoDirective;
62
- modal: BrontoDirective;
63
- carousel: BrontoDirective;
64
- dotGlyph: BrontoDirective;
65
- legend: BrontoDirective;
66
- connectors: BrontoDirective;
67
- spotlight: BrontoDirective;
68
- crosshair: BrontoDirective;
69
- command: BrontoDirective;
70
- sources: BrontoDirective;
71
- splitter: BrontoDirective;
72
- }>;
73
- /** @type {BrontoVuePlugin} */
74
- export const brontoVue: BrontoVuePlugin;
75
- export default brontoVue;
76
- export function useToast(): (message: string, opts?: ToastOpts) => Cleanup;
77
- export type Cleanup = import("../behaviors/index.js").Cleanup;
78
- export type DelegateOpts = import("../behaviors/index.js").DelegateOpts;
79
- export type ThemeStorageOpts = import("../behaviors/index.js").ThemeStorageOpts;
80
- export type ToastOpts = import("../behaviors/index.js").ToastOpts;
81
- export type BrontoDirectiveRoot = Document | Element | null | undefined;
82
- export type BrontoDirectiveOpts = Omit<DelegateOpts, "root"> & {
83
- root?: BrontoDirectiveRoot;
84
- };
85
- export type BrontoThemeDirectiveOpts = Omit<ThemeStorageOpts & DelegateOpts, "root"> & {
86
- root?: BrontoDirectiveRoot;
87
- };
88
- export type BrontoDirectiveBinding = {
89
- value?: BrontoDirectiveOpts | null | undefined;
90
- oldValue?: BrontoDirectiveOpts | null | undefined;
91
- };
92
- export type BrontoThemeDirectiveBinding = {
93
- value?: BrontoThemeDirectiveOpts | null | undefined;
94
- oldValue?: BrontoThemeDirectiveOpts | null | undefined;
95
- };
96
- export type BrontoDirective = {
97
- mounted: (el: Element, binding?: BrontoDirectiveBinding) => void;
98
- updated: (el: Element, binding?: BrontoDirectiveBinding) => void;
99
- beforeUnmount: (el: Element) => void;
100
- };
101
- export type BrontoThemeDirective = {
102
- mounted: (el: Element, binding?: BrontoThemeDirectiveBinding) => void;
103
- updated: (el: Element, binding?: BrontoThemeDirectiveBinding) => void;
104
- beforeUnmount: (el: Element) => void;
105
- };
106
- export type BrontoVueApp = {
107
- directive: (name: string, directive: BrontoDirective | BrontoThemeDirective) => unknown;
108
- };
109
- export type BrontoVuePlugin = {
110
- install: (app: BrontoVueApp) => void;
111
- };
112
- import { applyStoredTheme } from '../behaviors/index.js';
113
- import { toast } from '../behaviors/index.js';
114
- export { applyStoredTheme, toast };
115
- export { cls, ui, cx } from "../classes/index.js";
116
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.js"],"names":[],"mappings":"AAkIA;;;;;GAKG;AACH,4CAHW,CAAC,IAAI,CAAC,EAAE,YAAY,KAAK,OAAO,GAAG,IAAI,GACrC,eAAe,CAkB3B;AAED,mCAAmC;AACnC,2BADW,oBAAoB,CACoC;AACnE,8BAA8B;AAC9B,2BADW,eAAe,CACyC;AACnE,8BAA8B;AAC9B,6BADW,eAAe,CAC6C;AACvE,8BAA8B;AAC9B,0BADW,eAAe,CACuC;AACjE,8BAA8B;AAC9B,oBADW,eAAe,CAC2B;AACrD,8BAA8B;AAC9B,8BADW,eAAe,CAC+C;AACzE,8BAA8B;AAC9B,wBADW,eAAe,CACmC;AAC7D,8BAA8B;AAC9B,uBADW,eAAe,CACiC;AAC3D,8BAA8B;AAC9B,yBADW,eAAe,CACqC;AAC/D,8BAA8B;AAC9B,oBADW,eAAe,CAC2B;AACrD,8BAA8B;AAC9B,sBADW,eAAe,CAC+B;AACzD,8BAA8B;AAC9B,qBADW,eAAe,CAC6B;AACvD,8BAA8B;AAC9B,wBADW,eAAe,CACmC;AAC7D,8BAA8B;AAC9B,wBADW,eAAe,CACmC;AAC7D,8BAA8B;AAC9B,sBADW,eAAe,CAC+B;AACzD,8BAA8B;AAC9B,0BADW,eAAe,CACuC;AACjE,8BAA8B;AAC9B,yBADW,eAAe,CACqC;AAC/D,8BAA8B;AAC9B,yBADW,eAAe,CACqC;AAC/D,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