@adia-ai/web-components 0.8.3 → 0.8.5

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 (95) hide show
  1. package/CHANGELOG.md +33 -0
  2. package/USAGE.md +60 -25
  3. package/components/accordion/accordion.css +5 -0
  4. package/components/adia-mark/adia-mark.a2ui.json +123 -0
  5. package/components/adia-mark/adia-mark.class.js +64 -0
  6. package/components/adia-mark/adia-mark.css +48 -0
  7. package/components/adia-mark/adia-mark.d.ts +20 -0
  8. package/components/adia-mark/adia-mark.examples.md +26 -0
  9. package/components/adia-mark/adia-mark.js +17 -0
  10. package/components/adia-mark/adia-mark.test.js +69 -0
  11. package/components/adia-mark/adia-mark.yaml +121 -0
  12. package/components/agent-artifact/agent-artifact.css +1 -0
  13. package/components/agent-questions/agent-questions.a2ui.json +2 -1
  14. package/components/agent-questions/agent-questions.class.js +96 -53
  15. package/components/agent-questions/agent-questions.css +27 -106
  16. package/components/agent-questions/agent-questions.yaml +1 -0
  17. package/components/agent-reasoning/agent-reasoning.css +9 -5
  18. package/components/button/button.class.js +9 -2
  19. package/components/button/button.css +1 -1
  20. package/components/calendar-grid/calendar-grid.a2ui.json +3 -1
  21. package/components/calendar-grid/calendar-grid.class.js +11 -6
  22. package/components/calendar-grid/calendar-grid.css +42 -20
  23. package/components/calendar-grid/calendar-grid.yaml +5 -0
  24. package/components/calendar-picker/calendar-picker.a2ui.json +3 -1
  25. package/components/calendar-picker/calendar-picker.class.js +11 -6
  26. package/components/calendar-picker/calendar-picker.css +41 -19
  27. package/components/calendar-picker/calendar-picker.yaml +5 -0
  28. package/components/chart/chart.class.js +17 -14
  29. package/components/chat-thread/chat-input.a2ui.json +3 -1
  30. package/components/chat-thread/chat-input.css +12 -13
  31. package/components/chat-thread/chat-input.js +6 -2
  32. package/components/chat-thread/chat-input.yaml +3 -0
  33. package/components/check/check.css +1 -1
  34. package/components/color-input/color-input.class.js +8 -5
  35. package/components/color-picker/color-picker.class.js +6 -3
  36. package/components/combobox/combobox.a2ui.json +3 -1
  37. package/components/combobox/combobox.class.js +1 -3
  38. package/components/combobox/combobox.css +9 -12
  39. package/components/combobox/combobox.yaml +2 -0
  40. package/components/date-range-picker/date-range-picker.css +1 -0
  41. package/components/field/field.class.js +10 -7
  42. package/components/fields/fields.class.js +15 -12
  43. package/components/icon/icon.class.js +9 -5
  44. package/components/index.js +1 -0
  45. package/components/input/input.css +6 -2
  46. package/components/nav/nav.class.js +2 -1
  47. package/components/nav-group/nav-group.css +5 -6
  48. package/components/noodles/noodles.class.js +14 -10
  49. package/components/option-card/option-card.css +1 -0
  50. package/components/page/page.class.js +3 -2
  51. package/components/radio/radio.css +1 -1
  52. package/components/range/range.css +2 -0
  53. package/components/select/select.a2ui.json +2 -1
  54. package/components/select/select.class.js +12 -11
  55. package/components/select/select.css +29 -40
  56. package/components/select/select.test.js +6 -2
  57. package/components/select/select.yaml +1 -0
  58. package/components/swatch/swatch.a2ui.json +3 -1
  59. package/components/swatch/swatch.class.js +41 -32
  60. package/components/swatch/swatch.css +13 -18
  61. package/components/swatch/swatch.yaml +2 -0
  62. package/components/swiper/swiper.class.js +4 -1
  63. package/components/swiper/swiper.css +13 -4
  64. package/components/switch/switch.css +1 -1
  65. package/components/tag/tag.a2ui.json +4 -1
  66. package/components/tag/tag.class.js +3 -1
  67. package/components/tag/tag.css +13 -15
  68. package/components/tag/tag.yaml +3 -0
  69. package/components/tags-input/tags-input.css +1 -0
  70. package/components/textarea/textarea.css +2 -0
  71. package/components/time-picker/time-picker.css +2 -0
  72. package/components/timeline/timeline.a2ui.json +2 -1
  73. package/components/timeline/timeline.class.js +7 -8
  74. package/components/timeline/timeline.css +14 -26
  75. package/components/timeline/timeline.yaml +1 -0
  76. package/components/toggle-group/toggle-group.css +1 -0
  77. package/components/toolbar/toolbar.class.js +11 -6
  78. package/components/tree/tree.class.js +5 -2
  79. package/components/tree/tree.css +5 -2
  80. package/components/upload/upload.css +1 -0
  81. package/core/data-stream.js +21 -15
  82. package/core/element.js +36 -1
  83. package/core/element.test.js +67 -0
  84. package/core/icons-phosphor.js +86 -22
  85. package/core/icons.js +22 -8
  86. package/dist/theme-provider.min.js +2 -2
  87. package/dist/web-components.min.css +1 -1
  88. package/dist/web-components.min.js +109 -108
  89. package/dist/web-components.sheet.js +1 -1
  90. package/package.json +1 -5
  91. package/styles/colors/semantics/features.css +6 -1
  92. package/styles/components.css +1 -0
  93. package/traits/error-shake/error-shake.js +23 -17
  94. package/traits/fade-presence/fade-presence.js +19 -15
  95. package/traits/success-checkmark/success-checkmark.js +21 -16
@@ -31,13 +31,66 @@
31
31
  * import { installIconLoaders } from '@adia-ai/web-components/core/icons';
32
32
  * installIconLoaders({
33
33
  * regular: import.meta.glob(
34
- * '/node_modules/@phosphor-icons/core/assets/regular/{caret-right,moon,sun,x}.svg',
34
+ * '../node_modules/@phosphor-icons/core/assets/regular/{caret-right,moon,sun,x}.svg',
35
35
  * { query: '?raw', import: 'default', eager: true }
36
36
  * ),
37
37
  * });
38
38
  *
39
39
  * Brace-list globs are statically analyzed; only the named files are
40
- * emitted as chunks (or inlined when `eager: true`).
40
+ * emitted as chunks (or inlined when `eager: true`). Use the `../node_modules/...`
41
+ * form shown here, not `/node_modules/...` — see "Why the glob is entry-relative,
42
+ * not root-relative" below; the same reasoning applies to a hand-written
43
+ * scoped glob as to the auto-discovery globs this file installs by default.
44
+ *
45
+ * ## Why the glob is entry-relative, not root-relative
46
+ *
47
+ * `import.meta.glob` only accepts a small set of static forms (`/`-rooted,
48
+ * `./`, `../`, `**\/`, or a `#`-subpath with a literal `*`), and each resolves
49
+ * via a literal path join, not module resolution (confirmed against Vite 8's
50
+ * `toAbsoluteGlob`, gh#287). A `/`-rooted glob joins to Vite's CONFIGURED
51
+ * PROJECT ROOT — for a consumer app, that only reaches `@phosphor-icons/core`
52
+ * when it's ALSO hoisted to that exact root. Under pnpm's default
53
+ * (non-hoisted, symlinked) linking, a package you depend on only
54
+ * TRANSITIVELY — `@phosphor-icons/core` is a dependency of THIS package, not
55
+ * necessarily your app's — is linked only inside that package's own
56
+ * resolution scope, never flattened into your app's top-level `node_modules`.
57
+ * A root-rooted glob then silently matches zero files.
58
+ *
59
+ * A `../`-prefixed glob instead joins to THIS FILE'S OWN directory
60
+ * (`core/`), one level inside `@adia-ai/web-components` — so `../node_modules`
61
+ * reaches `@adia-ai/web-components`'s own local `node_modules`, which pnpm
62
+ * always populates with a package's own direct dependencies (a symlink into
63
+ * the pnpm store) regardless of whether your app also hoists them. This
64
+ * holds for the published package too — `core/icons-phosphor.js` ships at
65
+ * the same one-level depth (see `package.json`'s `files` field). Verified
66
+ * empirically against a real hoisting-gap install (a pnpm workspace where
67
+ * `@phosphor-icons/core` is declared only by a nested package, not the
68
+ * workspace root): the root-rooted form matches zero files; the
69
+ * entry-relative form matches the full set with real content.
70
+ *
71
+ * ## Vite dep-optimizer pre-bundling (gh#287, second independent failure mode)
72
+ *
73
+ * In DEV, Vite pre-bundles bare-specifier dependencies with esbuild
74
+ * (`optimizeDeps`) for faster cold starts, BEFORE its own plugin pipeline
75
+ * (which includes the glob transform) ever sees them. Confirmed empirically:
76
+ * when this package gets swept into that pre-bundling step, esbuild's scan
77
+ * transforms each `import.meta.glob(...)` call into a literal `Object.assign({})`
78
+ * — no exception, `hasViteGlob` stays `true`, but every weight's map is empty.
79
+ * This is indistinguishable from a genuine zero-match glob to the code below,
80
+ * so the same `totalIcons === 0` diagnostic fires — the fix differs, though:
81
+ * add this package to your Vite config's `optimizeDeps.exclude` so it's
82
+ * requested directly instead of pre-bundled (confirmed empirically to restore
83
+ * full auto-discovery with no code change):
84
+ *
85
+ * // vite.config.js
86
+ * export default defineConfig({
87
+ * optimizeDeps: { exclude: ['@adia-ai/web-components', '@adia-ai/web-modules'] },
88
+ * });
89
+ *
90
+ * If you can't control the Vite config (e.g. Astro, or another framework
91
+ * that manages it), fall back to the scoped, explicit-import recipe above —
92
+ * plain bare-specifier imports in your OWN first-party source are never
93
+ * swept into `optimizeDeps` in the first place.
41
94
  *
42
95
  * ## Vite glob detection
43
96
  *
@@ -57,12 +110,12 @@ let weightModules;
57
110
  let hasViteGlob = false;
58
111
  try {
59
112
  weightModules = {
60
- regular: import.meta.glob('/node_modules/@phosphor-icons/core/assets/regular/*.svg', { query: '?raw', import: 'default' }),
61
- thin: import.meta.glob('/node_modules/@phosphor-icons/core/assets/thin/*.svg', { query: '?raw', import: 'default' }),
62
- light: import.meta.glob('/node_modules/@phosphor-icons/core/assets/light/*.svg', { query: '?raw', import: 'default' }),
63
- bold: import.meta.glob('/node_modules/@phosphor-icons/core/assets/bold/*.svg', { query: '?raw', import: 'default' }),
64
- fill: import.meta.glob('/node_modules/@phosphor-icons/core/assets/fill/*.svg', { query: '?raw', import: 'default' }),
65
- duotone: import.meta.glob('/node_modules/@phosphor-icons/core/assets/duotone/*.svg', { query: '?raw', import: 'default' }),
113
+ regular: import.meta.glob('../node_modules/@phosphor-icons/core/assets/regular/*.svg', { query: '?raw', import: 'default' }),
114
+ thin: import.meta.glob('../node_modules/@phosphor-icons/core/assets/thin/*.svg', { query: '?raw', import: 'default' }),
115
+ light: import.meta.glob('../node_modules/@phosphor-icons/core/assets/light/*.svg', { query: '?raw', import: 'default' }),
116
+ bold: import.meta.glob('../node_modules/@phosphor-icons/core/assets/bold/*.svg', { query: '?raw', import: 'default' }),
117
+ fill: import.meta.glob('../node_modules/@phosphor-icons/core/assets/fill/*.svg', { query: '?raw', import: 'default' }),
118
+ duotone: import.meta.glob('../node_modules/@phosphor-icons/core/assets/duotone/*.svg', { query: '?raw', import: 'default' }),
66
119
  };
67
120
  hasViteGlob = true;
68
121
  } catch (err) {
@@ -85,28 +138,39 @@ if (hasViteGlob) {
85
138
  // FB-08: detect the silent-empty-glob case — `import.meta.glob` returns
86
139
  // `{}` when zero files match (it does NOT throw). The previous behavior
87
140
  // installed empty per-weight maps and the consumer saw an empty icon
88
- // registry with no diagnostic. This happens when the consumer's Vite
89
- // root sits below `node_modules`, or with pnpm/yarn-berry virtual paths,
90
- // or when this file runs from inside a published package directory
91
- // (its absolute-style glob is resolved relative to the Vite root, not
92
- // this file's directory).
141
+ // registry with no diagnostic. gh#287 names two independent causes, both
142
+ // producing this same empty-map symptom:
143
+ // 1. A packaging/bundler step re-nested this file at a different depth
144
+ // than it ships at (breaks the `../`-relative glob's one-level-inside
145
+ // assumption see "Why the glob is entry-relative" above), a Yarn
146
+ // Berry PnP install (virtual/zip filesystem), or @phosphor-icons/core
147
+ // missing entirely.
148
+ // 2. Vite's dev-server `optimizeDeps` pre-bundled this package (see
149
+ // "Vite dep-optimizer pre-bundling" above) — confirmed empirically to
150
+ // transform the glob into a literal empty object, no exception.
93
151
  const totalIcons = Object.values(weightModules).reduce(
94
152
  (sum, weight) => sum + Object.keys(weight).length, 0
95
153
  );
96
154
  if (totalIcons === 0) {
97
155
  console.warn(
98
156
  `[icons-phosphor] No Phosphor icons matched the auto-install glob ` +
99
- `\`/node_modules/@phosphor-icons/core/assets/<weight>/*.svg\`. ` +
100
- `This usually means your Vite root sits below node_modules, you use ` +
101
- `pnpm/yarn-berry virtual paths, or this module is loaded from a ` +
102
- `published package directory. Install loaders manually from your app entry:\n` +
157
+ `\`../node_modules/@phosphor-icons/core/assets/<weight>/*.svg\` (resolved ` +
158
+ `relative to this file's own directory hoisting-safe under pnpm, gh#287). ` +
159
+ `Two known causes: (1) this package got pre-bundled by Vite's dev-server ` +
160
+ `optimizeDeps, which empties the glob add it to optimizeDeps.exclude in ` +
161
+ `your Vite config:\n` +
162
+ ` optimizeDeps: { exclude: ['@adia-ai/web-components', '@adia-ai/web-modules'] }\n` +
163
+ `(2) @phosphor-icons/core is missing, or this file was re-nested to a ` +
164
+ `different depth by a packaging step (Yarn PnP, a custom bundler). If ` +
165
+ `neither fix applies, install loaders manually instead:\n` +
103
166
  ` import { installIconLoaders } from '@adia-ai/web-components/core/icons';\n` +
167
+ ` import caretRight from '@phosphor-icons/core/assets/regular/caret-right.svg?raw';\n` +
104
168
  ` installIconLoaders({\n` +
105
- ` regular: import.meta.glob(\n` +
106
- ` '../node_modules/@phosphor-icons/core/assets/regular/*.svg',\n` +
107
- ` { query: '?raw', import: 'default', eager: true }\n` +
108
- ` ),\n` +
109
- ` });`
169
+ ` regular: {\n` +
170
+ ` '/node_modules/@phosphor-icons/core/assets/regular/caret-right.svg': caretRight,\n` +
171
+ ` },\n` +
172
+ ` });\n` +
173
+ `See the JSDoc header of icons-phosphor.js for the full recipe.`
110
174
  );
111
175
  }
112
176
  installIconLoaders(weightModules);
package/core/icons.js CHANGED
@@ -33,17 +33,25 @@
33
33
  * import '@adia-ai/web-components/core/icons-phosphor';
34
34
  *
35
35
  * 3. **Scoped registration (recommended for production bundle-size
36
- * SLOs).** Skip `icons-phosphor.js` entirely and register only the
37
- * icons you actually use. `import.meta.glob` with a brace-list emits
38
- * one chunk per matched file — for a 4-icon app, that's ~4 chunks
39
- * instead of the ~9000 the full set would produce:
36
+ * SLOs, and for Vite dev-servers that pre-bundle this package via
37
+ * `optimizeDeps` see `icons-phosphor.js`'s JSDoc header, "Vite
38
+ * dep-optimizer pre-bundling", gh#287).** Skip `icons-phosphor.js`
39
+ * entirely and register only the icons you actually use, via plain
40
+ * bare-specifier imports in your OWN first-party source — never swept
41
+ * into `optimizeDeps`, unlike a glob written inside this package:
40
42
  *
41
43
  * import { installIconLoaders } from '@adia-ai/web-components/core/icons';
44
+ * import caretRight from '@phosphor-icons/core/assets/regular/caret-right.svg?raw';
45
+ * import caretUpDown from '@phosphor-icons/core/assets/regular/caret-up-down.svg?raw';
46
+ * import moon from '@phosphor-icons/core/assets/regular/moon.svg?raw';
47
+ * import sun from '@phosphor-icons/core/assets/regular/sun.svg?raw';
42
48
  * installIconLoaders({
43
- * regular: import.meta.glob(
44
- * '/node_modules/@phosphor-icons/core/assets/regular/{caret-right,caret-up-down,moon,sun}.svg',
45
- * { query: '?raw', import: 'default', eager: true }
46
- * ),
49
+ * regular: {
50
+ * '/node_modules/@phosphor-icons/core/assets/regular/caret-right.svg': caretRight,
51
+ * '/node_modules/@phosphor-icons/core/assets/regular/caret-up-down.svg': caretUpDown,
52
+ * '/node_modules/@phosphor-icons/core/assets/regular/moon.svg': moon,
53
+ * '/node_modules/@phosphor-icons/core/assets/regular/sun.svg': sun,
54
+ * },
47
55
  * });
48
56
  *
49
57
  * Or register single SVGs directly:
@@ -236,6 +244,12 @@ export function installIconLoaders(modules) {
236
244
  * import { installIconLoadersForRegistered } from '@adia-ai/web-components/core/icons';
237
245
  *
238
246
  * // Build the Phosphor loader map from your bundler (Vite, Webpack, etc.).
247
+ * // NOTE: this glob only matches under a hoisted install (npm/yarn classic,
248
+ * // or pnpm with @phosphor-icons/core hoisted to your project root). Plain
249
+ * // pnpm links a transitive dependency like this one inside its own
250
+ * // resolution scope only — the glob silently matches zero files there.
251
+ * // Use the plain bare-specifier import recipe in this file's own JSDoc
252
+ * // header (path 3, above) instead if that's your install. See gh#287.
239
253
  * const modules = import.meta.glob('/node_modules/@phosphor-icons/core/assets/regular/*.svg', { query: '?raw' });
240
254
  *
241
255
  * // Aggregate requiredIcons across all defined primitives + install.