@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/vue/index.js DELETED
@@ -1,266 +0,0 @@
1
- /**
2
- * @ponchia/ui/vue — thin Vue directives over @ponchia/ui/behaviors.
3
- *
4
- * @deprecated Import the framework-agnostic behavior initializers directly.
5
- * This adapter remains compatible in 0.7 and is scheduled for removal no
6
- * earlier than 0.8 because no real consumer adopted it.
7
- *
8
- * The CSS is the framework; these are optional lifecycle adapters that run the
9
- * vanilla behavior initializers from Vue directive hooks. They are plain
10
- * directive objects, so this module has no runtime dependency on Vue.
11
- *
12
- * import { brontoVue } from '@ponchia/ui/vue';
13
- * app.use(brontoVue);
14
- *
15
- * <main v-bronto-theme-toggle>
16
- * <button data-bronto-theme-toggle>Toggle theme</button>
17
- * </main>
18
- *
19
- * @typedef {import('../behaviors/index.js').Cleanup} Cleanup
20
- * @typedef {import('../behaviors/index.js').DelegateOpts} DelegateOpts
21
- * @typedef {import('../behaviors/index.js').ThemeStorageOpts} ThemeStorageOpts
22
- * @typedef {import('../behaviors/index.js').ToastOpts} ToastOpts
23
- *
24
- * @typedef {Document | Element | null | undefined} BrontoDirectiveRoot
25
- *
26
- * @typedef {Omit<DelegateOpts, 'root'> & { root?: BrontoDirectiveRoot }} BrontoDirectiveOpts
27
- *
28
- * @typedef {Omit<ThemeStorageOpts & DelegateOpts, 'root'> & { root?: BrontoDirectiveRoot }} BrontoThemeDirectiveOpts
29
- *
30
- * @typedef {{ value?: BrontoDirectiveOpts | null | undefined, oldValue?: BrontoDirectiveOpts | null | undefined }} BrontoDirectiveBinding
31
- *
32
- * @typedef {{ value?: BrontoThemeDirectiveOpts | null | undefined, oldValue?: BrontoThemeDirectiveOpts | null | undefined }} BrontoThemeDirectiveBinding
33
- *
34
- * @typedef {{ mounted: (el: Element, binding?: BrontoDirectiveBinding) => void, updated: (el: Element, binding?: BrontoDirectiveBinding) => void, beforeUnmount: (el: Element) => void }} BrontoDirective
35
- *
36
- * @typedef {{ mounted: (el: Element, binding?: BrontoThemeDirectiveBinding) => void, updated: (el: Element, binding?: BrontoThemeDirectiveBinding) => void, beforeUnmount: (el: Element) => void }} BrontoThemeDirective
37
- *
38
- * @typedef {{ directive: (name: string, directive: BrontoDirective | BrontoThemeDirective) => unknown }} BrontoVueApp
39
- *
40
- * @typedef {{ install: (app: BrontoVueApp) => void }} BrontoVuePlugin
41
- */
42
- import {
43
- applyStoredTheme,
44
- initThemeToggle,
45
- dismissible as initDismissible,
46
- initDisabledGuard,
47
- initDisclosure,
48
- initMenu,
49
- initFormValidation,
50
- initCombobox,
51
- initPopover,
52
- initTableSort,
53
- initTabs,
54
- initDialog,
55
- initModal,
56
- initCarousel,
57
- initDotGlyph,
58
- initLegend,
59
- initConnectors,
60
- initSpotlight,
61
- initCrosshair,
62
- initCommand,
63
- initSources,
64
- initSplitter,
65
- toast,
66
- } from '../behaviors/index.js';
67
-
68
- const cleanups = new WeakMap();
69
- const optionSignatures = new WeakMap();
70
-
71
- function cleanupMap(el) {
72
- let map = cleanups.get(el);
73
- if (!map) {
74
- map = new Map();
75
- cleanups.set(el, map);
76
- }
77
- return map;
78
- }
79
-
80
- function optionSignatureMap(el) {
81
- let map = optionSignatures.get(el);
82
- if (!map) {
83
- map = new Map();
84
- optionSignatures.set(el, map);
85
- }
86
- return map;
87
- }
88
-
89
- function optionSignature(opts) {
90
- return Object.entries(opts).sort(([a], [b]) => a.localeCompare(b));
91
- }
92
-
93
- function sameOptionSignature(a, b) {
94
- if (a === b) return true;
95
- if (!a || !b || a.length !== b.length) return false;
96
- return a.every(([key, value], index) => {
97
- const [otherKey, otherValue] = b[index];
98
- return key === otherKey && Object.is(value, otherValue);
99
- });
100
- }
101
-
102
- function stop(el, key) {
103
- const map = cleanups.get(el);
104
- const cleanup = map?.get(key);
105
- if (typeof cleanup === 'function') cleanup();
106
- map?.delete(key);
107
- if (map?.size === 0) cleanups.delete(el);
108
- const signatures = optionSignatures.get(el);
109
- signatures?.delete(key);
110
- if (signatures?.size === 0) optionSignatures.delete(el);
111
- }
112
-
113
- function resolveOpts(el, opts) {
114
- if (!opts || typeof opts !== 'object') return { root: el };
115
- if (!('root' in opts)) return { ...opts, root: el };
116
- return { ...opts, root: opts.root || null };
117
- }
118
-
119
- function start(el, key, init, opts) {
120
- const resolved = resolveOpts(el, opts);
121
- startResolved(el, key, init, resolved, optionSignature(resolved));
122
- }
123
-
124
- function startResolved(el, key, init, resolved, signature) {
125
- stop(el, key);
126
- const cleanup = init(resolved);
127
- if (typeof cleanup === 'function') cleanupMap(el).set(key, cleanup);
128
- optionSignatureMap(el).set(key, signature);
129
- }
130
-
131
- /**
132
- * Create a Vue directive object from any Bronto delegated behavior initializer.
133
- *
134
- * @param {(opts?: DelegateOpts) => Cleanup | void} init
135
- * @returns {BrontoDirective}
136
- */
137
- export function createBrontoDirective(init) {
138
- const key = Symbol('bronto-vue-directive');
139
- return {
140
- mounted(el, binding) {
141
- start(el, key, init, binding?.value);
142
- },
143
- updated(el, binding) {
144
- const resolved = resolveOpts(el, binding?.value);
145
- const signature = optionSignature(resolved);
146
- if (sameOptionSignature(optionSignatures.get(el)?.get(key), signature)) return;
147
- startResolved(el, key, init, resolved, signature);
148
- },
149
- beforeUnmount(el) {
150
- stop(el, key);
151
- },
152
- };
153
- }
154
-
155
- /** @type {BrontoThemeDirective} */
156
- export const vThemeToggle = createBrontoDirective(initThemeToggle);
157
- /** @type {BrontoDirective} */
158
- export const vDismissible = createBrontoDirective(initDismissible);
159
- /** @type {BrontoDirective} */
160
- export const vDisabledGuard = createBrontoDirective(initDisabledGuard);
161
- /** @type {BrontoDirective} */
162
- export const vDisclosure = createBrontoDirective(initDisclosure);
163
- /** @type {BrontoDirective} */
164
- export const vMenu = createBrontoDirective(initMenu);
165
- /** @type {BrontoDirective} */
166
- export const vFormValidation = createBrontoDirective(initFormValidation);
167
- /** @type {BrontoDirective} */
168
- export const vCombobox = createBrontoDirective(initCombobox);
169
- /** @type {BrontoDirective} */
170
- export const vPopover = createBrontoDirective(initPopover);
171
- /** @type {BrontoDirective} */
172
- export const vTableSort = createBrontoDirective(initTableSort);
173
- /** @type {BrontoDirective} */
174
- export const vTabs = createBrontoDirective(initTabs);
175
- /** @type {BrontoDirective} */
176
- export const vDialog = createBrontoDirective(initDialog);
177
- /** @type {BrontoDirective} */
178
- export const vModal = createBrontoDirective(initModal);
179
- /** @type {BrontoDirective} */
180
- export const vCarousel = createBrontoDirective(initCarousel);
181
- /** @type {BrontoDirective} */
182
- export const vDotGlyph = createBrontoDirective(initDotGlyph);
183
- /** @type {BrontoDirective} */
184
- export const vLegend = createBrontoDirective(initLegend);
185
- /** @type {BrontoDirective} */
186
- export const vConnectors = createBrontoDirective(initConnectors);
187
- /** @type {BrontoDirective} */
188
- export const vSpotlight = createBrontoDirective(initSpotlight);
189
- /** @type {BrontoDirective} */
190
- export const vCrosshair = createBrontoDirective(initCrosshair);
191
- /** @type {BrontoDirective} */
192
- export const vCommand = createBrontoDirective(initCommand);
193
- /** @type {BrontoDirective} */
194
- export const vSources = createBrontoDirective(initSources);
195
- /** @type {BrontoDirective} */
196
- export const vSplitter = createBrontoDirective(initSplitter);
197
-
198
- export const directives = Object.freeze({
199
- themeToggle: vThemeToggle,
200
- dismissible: vDismissible,
201
- disabledGuard: vDisabledGuard,
202
- disclosure: vDisclosure,
203
- menu: vMenu,
204
- formValidation: vFormValidation,
205
- combobox: vCombobox,
206
- popover: vPopover,
207
- tableSort: vTableSort,
208
- tabs: vTabs,
209
- dialog: vDialog,
210
- modal: vModal,
211
- carousel: vCarousel,
212
- dotGlyph: vDotGlyph,
213
- legend: vLegend,
214
- connectors: vConnectors,
215
- spotlight: vSpotlight,
216
- crosshair: vCrosshair,
217
- command: vCommand,
218
- sources: vSources,
219
- splitter: vSplitter,
220
- });
221
-
222
- const directiveNames = {
223
- themeToggle: 'bronto-theme-toggle',
224
- dismissible: 'bronto-dismissible',
225
- disabledGuard: 'bronto-disabled-guard',
226
- disclosure: 'bronto-disclosure',
227
- menu: 'bronto-menu',
228
- formValidation: 'bronto-form-validation',
229
- combobox: 'bronto-combobox',
230
- popover: 'bronto-popover',
231
- tableSort: 'bronto-table-sort',
232
- tabs: 'bronto-tabs',
233
- dialog: 'bronto-dialog',
234
- modal: 'bronto-modal',
235
- carousel: 'bronto-carousel',
236
- dotGlyph: 'bronto-dot-glyph',
237
- legend: 'bronto-legend',
238
- connectors: 'bronto-connectors',
239
- spotlight: 'bronto-spotlight',
240
- crosshair: 'bronto-crosshair',
241
- command: 'bronto-command',
242
- sources: 'bronto-sources',
243
- splitter: 'bronto-splitter',
244
- };
245
-
246
- const camelizeDirectiveName = (name) => name.replace(/-([a-z])/g, (_m, ch) => ch.toUpperCase());
247
-
248
- /** @type {BrontoVuePlugin} */
249
- export const brontoVue = Object.freeze({
250
- install(app) {
251
- for (const [key, directive] of Object.entries(directives)) {
252
- const name = directiveNames[key];
253
- app.directive(name, directive);
254
- app.directive(camelizeDirectiveName(name), directive);
255
- }
256
- },
257
- });
258
-
259
- export default brontoVue;
260
-
261
- /** The `toast()` imperative (no lifecycle of its own).
262
- * @returns {(message: string, opts?: ToastOpts) => Cleanup} */
263
- export const useToast = () => toast;
264
-
265
- export { applyStoredTheme, toast };
266
- export { cls, ui, cx } from '../classes/index.js';