@adia-ai/web-components 0.8.31 → 0.8.33

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 (164) hide show
  1. package/CHANGELOG.md +66 -0
  2. package/MIGRATION.md +136 -0
  3. package/components/accordion/accordion-item.a2ui.json +8 -0
  4. package/components/accordion/accordion-item.yaml +6 -0
  5. package/components/accordion/accordion.css +3 -1
  6. package/components/accordion/accordion.d.ts +2 -2
  7. package/components/action-list/action-list.class.js +6 -2
  8. package/components/action-list/action-list.d.ts +1 -1
  9. package/components/agent-artifact/agent-artifact.d.ts +1 -1
  10. package/components/agent-feedback-bar/agent-feedback-bar.d.ts +2 -2
  11. package/components/agent-questions/agent-questions.d.ts +1 -1
  12. package/components/agent-reasoning/agent-reasoning.d.ts +3 -3
  13. package/components/agent-suggestions/agent-suggestions.d.ts +1 -1
  14. package/components/agent-trace/agent-trace.d.ts +1 -1
  15. package/components/alert/alert.a2ui.json +3 -5
  16. package/components/alert/alert.class.js +3 -3
  17. package/components/alert/alert.css +5 -12
  18. package/components/alert/alert.d.ts +4 -4
  19. package/components/alert/alert.yaml +6 -5
  20. package/components/anchor-bar/anchor-bar.d.ts +2 -2
  21. package/components/avatar/avatar.class.js +0 -1
  22. package/components/avatar/avatar.css +16 -2
  23. package/components/badge/badge.a2ui.json +6 -9
  24. package/components/badge/badge.class.js +4 -4
  25. package/components/badge/badge.css +134 -74
  26. package/components/badge/badge.d.ts +34 -12
  27. package/components/badge/badge.examples.md +1 -1
  28. package/components/badge/badge.yaml +37 -16
  29. package/components/breadcrumb/breadcrumb.css +15 -3
  30. package/components/button/button.a2ui.json +1 -1
  31. package/components/button/button.css +4 -2
  32. package/components/button/button.d.ts +3 -3
  33. package/components/button/button.yaml +1 -1
  34. package/components/calendar-grid/calendar-grid.d.ts +2 -2
  35. package/components/card/card.css +21 -0
  36. package/components/card/card.yaml +10 -1
  37. package/components/chart/chart.class.js +8 -4
  38. package/components/chart/chart.d.ts +4 -4
  39. package/components/chart-legend/chart-legend.d.ts +1 -1
  40. package/components/chat-thread/chat-input.css +1 -1
  41. package/components/chat-thread/chat-thread.d.ts +2 -2
  42. package/components/check/check.css +3 -3
  43. package/components/command/command.d.ts +2 -2
  44. package/components/context-menu/context-menu.d.ts +3 -3
  45. package/components/datetime-picker/datetime-picker.d.ts +5 -5
  46. package/components/demo-toggle/demo-toggle.d.ts +1 -1
  47. package/components/drawer/drawer.d.ts +2 -2
  48. package/components/heatmap/heatmap.d.ts +5 -5
  49. package/components/index.js +1 -0
  50. package/components/inline-edit/inline-edit.d.ts +4 -4
  51. package/components/input/input.a2ui.json +4 -1
  52. package/components/input/input.css +18 -0
  53. package/components/input/input.yaml +11 -1
  54. package/components/integration-card/integration-card.class.js +11 -2
  55. package/components/integration-card/integration-card.d.ts +4 -4
  56. package/components/link/link.d.ts +1 -1
  57. package/components/list/list.class.js +22 -7
  58. package/components/list/list.d.ts +1 -1
  59. package/components/list-window/list-window.d.ts +5 -5
  60. package/components/mark/mark.a2ui.json +6 -7
  61. package/components/mark/mark.class.js +1 -1
  62. package/components/mark/mark.css +7 -4
  63. package/components/mark/mark.d.ts +2 -2
  64. package/components/mark/mark.examples.md +0 -4
  65. package/components/mark/mark.yaml +16 -6
  66. package/components/menu/menu.css +2 -2
  67. package/components/menu/menu.d.ts +1 -1
  68. package/components/modal/modal.d.ts +1 -1
  69. package/components/nav/nav.css +8 -0
  70. package/components/nav/nav.d.ts +1 -1
  71. package/components/nav-group/nav-group.css +58 -9
  72. package/components/nav-group/nav-group.d.ts +1 -1
  73. package/components/nav-item/nav-item.css +7 -4
  74. package/components/nav-item/nav-item.d.ts +1 -1
  75. package/components/noodles/noodles.d.ts +3 -3
  76. package/components/option-card/option-card.css +1 -1
  77. package/components/option-card/option-card.examples.md +1 -1
  78. package/components/pagination/pagination.d.ts +1 -1
  79. package/components/pane/pane.d.ts +1 -1
  80. package/components/password-strength/password-strength.d.ts +1 -1
  81. package/components/popover/popover.a2ui.json +5 -0
  82. package/components/popover/popover.class.js +9 -4
  83. package/components/popover/popover.css +5 -2
  84. package/components/popover/popover.yaml +8 -0
  85. package/components/preview/preview.examples.md +1 -1
  86. package/components/radio/radio.a2ui.json +4 -3
  87. package/components/radio/radio.css +2 -2
  88. package/components/radio/radio.yaml +7 -14
  89. package/components/radio-group/radio-group.a2ui.json +118 -0
  90. package/components/radio-group/radio-group.class.js +75 -0
  91. package/components/radio-group/radio-group.css +31 -0
  92. package/components/radio-group/radio-group.d.ts +20 -0
  93. package/components/radio-group/radio-group.examples.md +37 -0
  94. package/components/radio-group/radio-group.js +17 -0
  95. package/components/radio-group/radio-group.yaml +114 -0
  96. package/components/stat/stat.css +12 -8
  97. package/components/stat/stat.js +66 -1
  98. package/components/stat/stat.yaml +3 -0
  99. package/components/stepper/stepper-item.a2ui.json +5 -0
  100. package/components/stepper/stepper-item.yaml +11 -0
  101. package/components/stepper/stepper.a2ui.json +38 -3
  102. package/components/stepper/stepper.class.js +199 -2
  103. package/components/stepper/stepper.css +30 -0
  104. package/components/stepper/stepper.d.ts +28 -1
  105. package/components/stepper/stepper.yaml +76 -2
  106. package/components/stream/stream.d.ts +3 -3
  107. package/components/swatch/swatch.d.ts +1 -1
  108. package/components/swiper/swiper.d.ts +3 -3
  109. package/components/table/cell-types.js +12 -1
  110. package/components/table/table.a2ui.json +2 -2
  111. package/components/table/table.d.ts +7 -7
  112. package/components/table/table.yaml +9 -1
  113. package/components/table-toolbar/table-toolbar.class.js +1 -1
  114. package/components/table-toolbar/table-toolbar.d.ts +4 -4
  115. package/components/tabs/tabs.d.ts +1 -1
  116. package/components/tag/tag.a2ui.json +5 -5
  117. package/components/tag/tag.class.js +1 -1
  118. package/components/tag/tag.css +149 -71
  119. package/components/tag/tag.d.ts +21 -11
  120. package/components/tag/tag.examples.md +4 -4
  121. package/components/tag/tag.yaml +35 -13
  122. package/components/tags-input/tags-input.d.ts +4 -4
  123. package/components/timeline/timeline.d.ts +1 -1
  124. package/components/toast/toast.a2ui.json +2 -4
  125. package/components/toast/toast.css +0 -12
  126. package/components/toast/toast.yaml +3 -4
  127. package/components/toc/toc.d.ts +1 -1
  128. package/components/toggle-group/toggle-group.d.ts +1 -1
  129. package/components/toggle-scheme/toggle-scheme.d.ts +1 -1
  130. package/components/tour/tour.d.ts +4 -4
  131. package/components/tree/tree.d.ts +1 -1
  132. package/core/icons-phosphor.js +129 -71
  133. package/core/provider.js +84 -23
  134. package/dist/host.min.css +1 -1
  135. package/dist/host.sheet.js +1 -1
  136. package/dist/theme-provider.min.js +1 -1
  137. package/dist/web-components.min.css +1 -1
  138. package/dist/web-components.min.js +90 -88
  139. package/dist/web-components.sheet.js +1 -1
  140. package/package.json +1 -1
  141. package/patterns/admin-keys-and-export/admin-keys-and-export.examples.html +1 -1
  142. package/patterns/agent-memory/agent-memory.examples.html +5 -5
  143. package/patterns/agent-prompt-library/agent-prompt-library.examples.html +2 -2
  144. package/patterns/audit-log/audit-log.examples.js +12 -5
  145. package/patterns/bulk-action-toolbar/bulk-action-toolbar.examples.js +4 -1
  146. package/patterns/changelog-feed/changelog-feed.examples.html +1 -1
  147. package/patterns/comments-and-collaboration/comments-and-collaboration.examples.html +1 -1
  148. package/patterns/conversion-funnel/conversion-funnel.examples.html +1 -1
  149. package/patterns/diff-review/diff-review.examples.html +9 -9
  150. package/patterns/filter-bar/filter-bar.examples.html +12 -8
  151. package/patterns/filter-bar/filter-bar.examples.js +4 -1
  152. package/patterns/marketing-engagement/marketing-engagement.examples.html +1 -1
  153. package/patterns/notifications-bell-and-digest/notifications-bell-and-digest.examples.html +1 -1
  154. package/patterns/permissions-matrix/permissions-matrix.examples.html +1 -1
  155. package/patterns/permissions-sharing/permissions-sharing.examples.html +1 -1
  156. package/patterns/profile-public-and-verification/profile-public-and-verification.examples.html +2 -2
  157. package/patterns/record-detail-drawer/record-detail-drawer.examples.html +1 -1
  158. package/patterns/retention-cohort/retention-cohort.examples.html +1 -1
  159. package/patterns/retention-cohort/retention-cohort.examples.js +4 -1
  160. package/patterns/system-banners/system-banners.examples.html +3 -3
  161. package/styles/api/sizing-fallback.css +32 -0
  162. package/styles/api/sizing.css +7 -3
  163. package/styles/components.css +1 -0
  164. package/styles/tokens.css +1 -0
@@ -46,35 +46,46 @@ props:
46
46
  type: string
47
47
  dynamic: true
48
48
  variant:
49
- description: Semantic variant — `default | accent | info | success | warning | danger`.
50
- `accent` is brand-primary emphasis for non-semantic labels — a filter chip
49
+ description: Semantic variant — `default | info | success | warning | danger | primary`.
50
+ `primary` is brand emphasis for non-semantic labels — a filter chip
51
51
  or taxonomy tag that shouldn't imply a success/warning/danger state. Mirrors
52
- <badge-ui>'s `accent` variant token-for-token.
52
+ <badge-ui>'s `primary` variant token-for-token (`accent` retired, gh#874 —
53
+ the capability survives renamed, sibling parity with badge preserved).
53
54
  type: string
54
55
  default: default
55
56
  enum:
56
57
  - default
57
- - accent
58
58
  - info
59
59
  - success
60
60
  - warning
61
61
  - danger
62
+ - primary
62
63
  tone:
63
64
  description: |
64
65
  Fill style — orthogonal to [variant]. Three values:
65
- - `solid` (default for family variants)saturated bg + on-strong
66
- (near-white) text. The chip IS the state.
67
- - `muted` tinted bg with scheme-paired text. Matches <badge-ui>'s
68
- default look. Use on metadata chips in dense lists where the
69
- saturated default would compete for attention.
66
+ - `muted` (default for the family variants — info/success/warning/
67
+ danger/primary gh#864: tag and badge were swapped relative to
68
+ their reported default formulas; this restores tag's own)
69
+ tinted bg with scheme-paired text. Matches <badge-ui>'s
70
+ `[tone="muted"]` look. Use on metadata / citation chips in dense
71
+ lists or tables where a saturated fill would compete for
72
+ attention (gh#778's oversized-pill concern). Does NOT apply to
73
+ the family-less `default` variant, which stays solid
74
+ unconditionally (gh#794, unaffected by gh#864) — a bare
75
+ `<tag-ui text="…">` still renders that solid look with no
76
+ attributes at all.
77
+ - `solid` — saturated bg + on-strong (near-white) text. The chip
78
+ IS the state. Opt in explicitly for a family variant (gh#864),
79
+ or it's already the unconditional look for the family-less
80
+ `default` variant (gh#794).
70
81
  - `outline` — transparent bg + family-colored border + family-colored
71
82
  text. The lightest visual weight; good in dense data tables or
72
83
  faceted filter rows where multiple chips would otherwise compete.
73
- The `default` variant (no family) stays quiet chrome regardless of
74
- tone unless `tone="solid"` is set explicitly (high-contrast neutral
75
- inverse), or `tone="outline"` (fg-muted text + subtle border).
84
+ `tone` is a declarative presentational attribute (not a reactive
85
+ prop see tag.class.js) so its schema `default` here is documentation
86
+ of the rendered-by-default look, not a reflected attribute value.
76
87
  type: string
77
- default: solid
88
+ default: muted
78
89
  enum:
79
90
  - solid
80
91
  - muted
@@ -127,6 +138,17 @@ a2ui:
127
138
  Group multiple tags inside a <row-ui gap="2"> — never stack them
128
139
  vertically; vertical lists of dismissable items are an
129
140
  <action-list-ui> use case, not <tag-ui>.
141
+ - >-
142
+ A family-less <tag-ui text="…"> (no [variant], no [tone]) renders
143
+ the high-contrast solid pill by default (gh#794). In dense tables,
144
+ tight metadata rows, or citation/footnote strips where many tags
145
+ sit close together, set [tone="muted"] to keep the quieter tinted
146
+ look instead — a wall of solid pills reads as visual noise there
147
+ (gh#778).
148
+ - >-
149
+ A family [variant] (info/success/warning/danger/primary) with no
150
+ [tone] renders the tinted-container look by default (gh#864). Set
151
+ [tone="solid"] for a saturated status stamp instead.
130
152
  anti_patterns: []
131
153
  examples:
132
154
  - name: basic-tag
@@ -108,13 +108,13 @@ replaces the rendered chips. Reflection skipped — array values
108
108
  do not round-trip through attribute strings. */
109
109
  value: string;
110
110
 
111
+ addEventListener(type: 'change', listener: (ev: TagsInputChangeEvent) => unknown, options?: boolean | AddEventListenerOptions): void;
112
+ addEventListener(type: 'commit', listener: (ev: TagsInputCommitEvent) => unknown, options?: boolean | AddEventListenerOptions): void;
113
+ addEventListener(type: 'input', listener: (ev: TagsInputInputEvent) => unknown, options?: boolean | AddEventListenerOptions): void;
114
+ addEventListener(type: 'invalid', listener: (ev: TagsInputInvalidEvent) => unknown, options?: boolean | AddEventListenerOptions): void;
111
115
  addEventListener<K extends keyof HTMLElementEventMap>(
112
116
  type: K,
113
117
  listener: (this: UITagsInput, ev: HTMLElementEventMap[K]) => unknown,
114
118
  options?: boolean | AddEventListenerOptions,
115
119
  ): void;
116
- addEventListener(type: 'change', listener: (ev: TagsInputChangeEvent) => unknown, options?: boolean | AddEventListenerOptions): void;
117
- addEventListener(type: 'commit', listener: (ev: TagsInputCommitEvent) => unknown, options?: boolean | AddEventListenerOptions): void;
118
- addEventListener(type: 'input', listener: (ev: TagsInputInputEvent) => unknown, options?: boolean | AddEventListenerOptions): void;
119
- addEventListener(type: 'invalid', listener: (ev: TagsInputInvalidEvent) => unknown, options?: boolean | AddEventListenerOptions): void;
120
120
  }
@@ -25,12 +25,12 @@ export class UITimeline extends UIElement {
25
25
  /** Rail size preset — use `sm` for agent-reasoning/pipeline views; `md` is the default. */
26
26
  size: 'sm' | 'md';
27
27
 
28
+ addEventListener(type: 'timeline-toggle', listener: (ev: TimelineToggleEvent) => unknown, options?: boolean | AddEventListenerOptions): void;
28
29
  addEventListener<K extends keyof HTMLElementEventMap>(
29
30
  type: K,
30
31
  listener: (this: UITimeline, ev: HTMLElementEventMap[K]) => unknown,
31
32
  options?: boolean | AddEventListenerOptions,
32
33
  ): void;
33
- addEventListener(type: 'timeline-toggle', listener: (ev: TimelineToggleEvent) => unknown, options?: boolean | AddEventListenerOptions): void;
34
34
  }
35
35
 
36
36
  export class UITimelineItem extends UIElement {
@@ -40,7 +40,7 @@
40
40
  "default": ""
41
41
  },
42
42
  "variant": {
43
- "description": "Semantic variant — `default | info | success | warning | danger`. `primary` and `muted` are style hints; canonical \"neutral but interesting\" tone is `info`.",
43
+ "description": "Semantic variant — `default | info | success | warning | danger | primary`. `primary` is the brand-emphasis fill (mirrors badge-ui/button-ui's `primary`); canonical \"neutral but interesting\" tone is `info`.",
44
44
  "type": "string",
45
45
  "enum": [
46
46
  "default",
@@ -48,9 +48,7 @@
48
48
  "success",
49
49
  "warning",
50
50
  "danger",
51
- "primary",
52
- "muted",
53
- "neutral"
51
+ "primary"
54
52
  ],
55
53
  "default": "info"
56
54
  }
@@ -148,18 +148,6 @@ toast-ui[data-closing][position="top-left"] {
148
148
  --toast-border: var(--md-sys-color-primary-outline-variant);
149
149
  }
150
150
 
151
- /* `muted` and `neutral` are semantic aliases of the base canvas
152
- surface — same tokens as the unstyled `:scope`, declared explicitly
153
- so the yaml enum and the CSS contract agree. Use cases: quiet
154
- status nudges that shouldn't carry tonal weight (e.g. "Draft
155
- saved" without success-green). Mirrors alert-ui's pattern. */
156
- :where(:scope[variant="muted"]),
157
- :where(:scope[variant="neutral"]) {
158
- --toast-bg: var(--a-bg-subtle);
159
- --toast-fg: var(--md-sys-color-neutral-on-surface);
160
- --toast-border: var(--md-sys-color-neutral-outline-variant);
161
- }
162
-
163
151
  /* ── Message slot ── */
164
152
 
165
153
  [slot="message"] {
@@ -37,8 +37,9 @@ props:
37
37
  default: ""
38
38
  variant:
39
39
  description: >-
40
- Semantic variant — `default | info | success | warning | danger`.
41
- `primary` and `muted` are style hints; canonical "neutral but
40
+ Semantic variant — `default | info | success | warning | danger |
41
+ primary`. `primary` is the brand-emphasis fill (mirrors
42
+ badge-ui/button-ui's `primary`); canonical "neutral but
42
43
  interesting" tone is `info`.
43
44
  type: string
44
45
  default: info
@@ -49,8 +50,6 @@ props:
49
50
  - warning
50
51
  - danger
51
52
  - primary
52
- - muted
53
- - neutral
54
53
  events: {}
55
54
  usage: |-
56
55
  §224 (v0.5.9): `UIToast.show()` routes through `UIFeed.post()` — the
@@ -52,10 +52,10 @@ scans the toc-ui's parent element. Set to `#article` /
52
52
  */
53
53
  target: string;
54
54
 
55
+ addEventListener(type: 'section-change', listener: (ev: TableOfContentsSectionChangeEvent) => unknown, options?: boolean | AddEventListenerOptions): void;
55
56
  addEventListener<K extends keyof HTMLElementEventMap>(
56
57
  type: K,
57
58
  listener: (this: UITableOfContents, ev: HTMLElementEventMap[K]) => unknown,
58
59
  options?: boolean | AddEventListenerOptions,
59
60
  ): void;
60
- addEventListener(type: 'section-change', listener: (ev: TableOfContentsSectionChangeEvent) => unknown, options?: boolean | AddEventListenerOptions): void;
61
61
  }
@@ -25,12 +25,12 @@ export class UIToggleGroup extends UIElement {
25
25
  /** Comma-separated selected values */
26
26
  value: string;
27
27
 
28
+ addEventListener(type: 'change', listener: (ev: ToggleGroupChangeEvent) => unknown, options?: boolean | AddEventListenerOptions): void;
28
29
  addEventListener<K extends keyof HTMLElementEventMap>(
29
30
  type: K,
30
31
  listener: (this: UIToggleGroup, ev: HTMLElementEventMap[K]) => unknown,
31
32
  options?: boolean | AddEventListenerOptions,
32
33
  ): void;
33
- addEventListener(type: 'change', listener: (ev: ToggleGroupChangeEvent) => unknown, options?: boolean | AddEventListenerOptions): void;
34
34
  }
35
35
 
36
36
  export class UIToggleOption extends UIElement {
@@ -49,10 +49,10 @@ export class UIToggleScheme extends UIElement {
49
49
  /** Visual style forwarded to the internal <button-ui>. Defaults to "ghost" (matches app practice). */
50
50
  variant: 'default' | 'solid' | 'outline' | 'ghost' | 'primary' | 'secondary' | 'soft';
51
51
 
52
+ addEventListener(type: 'scheme-change', listener: (ev: ToggleSchemeSchemeChangeEvent) => unknown, options?: boolean | AddEventListenerOptions): void;
52
53
  addEventListener<K extends keyof HTMLElementEventMap>(
53
54
  type: K,
54
55
  listener: (this: UIToggleScheme, ev: HTMLElementEventMap[K]) => unknown,
55
56
  options?: boolean | AddEventListenerOptions,
56
57
  ): void;
57
- addEventListener(type: 'scheme-change', listener: (ev: ToggleSchemeSchemeChangeEvent) => unknown, options?: boolean | AddEventListenerOptions): void;
58
58
  }
@@ -48,15 +48,15 @@ tour to that step (updating spotlight + popover position).
48
48
  */
49
49
  step: number;
50
50
 
51
+ addEventListener(type: 'tour-finish', listener: (ev: TourFinishEvent) => unknown, options?: boolean | AddEventListenerOptions): void;
52
+ addEventListener(type: 'tour-skip', listener: (ev: TourSkipEvent) => unknown, options?: boolean | AddEventListenerOptions): void;
53
+ addEventListener(type: 'tour-start', listener: (ev: TourStartEvent) => unknown, options?: boolean | AddEventListenerOptions): void;
54
+ addEventListener(type: 'tour-step-change', listener: (ev: TourStepChangeEvent) => unknown, options?: boolean | AddEventListenerOptions): void;
51
55
  addEventListener<K extends keyof HTMLElementEventMap>(
52
56
  type: K,
53
57
  listener: (this: UITour, ev: HTMLElementEventMap[K]) => unknown,
54
58
  options?: boolean | AddEventListenerOptions,
55
59
  ): void;
56
- addEventListener(type: 'tour-finish', listener: (ev: TourFinishEvent) => unknown, options?: boolean | AddEventListenerOptions): void;
57
- addEventListener(type: 'tour-skip', listener: (ev: TourSkipEvent) => unknown, options?: boolean | AddEventListenerOptions): void;
58
- addEventListener(type: 'tour-start', listener: (ev: TourStartEvent) => unknown, options?: boolean | AddEventListenerOptions): void;
59
- addEventListener(type: 'tour-step-change', listener: (ev: TourStepChangeEvent) => unknown, options?: boolean | AddEventListenerOptions): void;
60
60
  }
61
61
 
62
62
  export class UITourStep extends UIElement {
@@ -31,12 +31,12 @@ export type TreeSelectEvent = CustomEvent<TreeSelectEventDetail>;
31
31
 
32
32
  export class UITree extends UIElement {
33
33
 
34
+ addEventListener(type: 'tree-select', listener: (ev: TreeSelectEvent) => unknown, options?: boolean | AddEventListenerOptions): void;
34
35
  addEventListener<K extends keyof HTMLElementEventMap>(
35
36
  type: K,
36
37
  listener: (this: UITree, ev: HTMLElementEventMap[K]) => unknown,
37
38
  options?: boolean | AddEventListenerOptions,
38
39
  ): void;
39
- addEventListener(type: 'tree-select', listener: (ev: TreeSelectEvent) => unknown, options?: boolean | AddEventListenerOptions): void;
40
40
  }
41
41
 
42
42
  export class UITreeItem extends UIElement {
@@ -37,36 +37,48 @@
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`). 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.
40
+ * emitted as chunks (or inlined when `eager: true`). Better yet, in your OWN
41
+ * source you can skip globs entirely and use plain bare-specifier `?raw`
42
+ * imports (see `icons.js`'s JSDoc, loading path 3) module resolution finds
43
+ * the package under any layout. If you do hand-write a glob, note it resolves
44
+ * by literal path join from YOUR file, not module resolution — see "Why there
45
+ * are three candidate globs" below.
44
46
  *
45
- * ## Why the glob is entry-relative, not root-relative
47
+ * ## Why there are three candidate globs, not one (gh#287 · gh#340 · gh#786)
46
48
  *
47
49
  * `import.meta.glob` only accepts a small set of static forms (`/`-rooted,
48
50
  * `./`, `../`, `**\/`, or a `#`-subpath with a literal `*`), and each resolves
49
51
  * 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.
52
+ * `toAbsoluteGlob`, gh#287). No single literal path exists that reaches
53
+ * `@phosphor-icons/core` under every package manager's `node_modules` layout,
54
+ * so this file probes THREE entry-relative candidates (resolved from this
55
+ * file's own directory, `core/`, one level inside `@adia-ai/web-components`
56
+ * the published package ships at the same depth) and installs the first that
57
+ * matches anything:
58
+ *
59
+ * 1. `../node_modules/@phosphor-icons/core/…` pnpm's nested layout.
60
+ * pnpm always populates a package's OWN local `node_modules` with its
61
+ * direct dependencies (a symlink into the store), regardless of what the
62
+ * consumer app hoists. gh#287's original fix; still first preference.
63
+ * 2. `../../../@phosphor-icons/core/…` npm / yarn-classic hoisting in a
64
+ * consumer install. `core/` sits at
65
+ * `node_modules/@adia-ai/web-components/core/`, so three levels up IS
66
+ * the consumer's (or workspace root's) `node_modules`, where hoisting
67
+ * flattens transitive deps as siblings. This is the layout gh#786's
68
+ * npm-workspace consumer has candidate 1 is structurally guaranteed
69
+ * to match zero files there.
70
+ * 3. `../../../node_modules/@phosphor-icons/core/…` THIS repo's own
71
+ * checkout when `node_modules` is npm-shaped (gh#340: `npm ci` /
72
+ * `npm install` re-shape it). `core/` sits at
73
+ * `packages/web-components/core/`, so three levels up is the repo root
74
+ * and the hoisted copy lives in its `node_modules/`.
75
+ *
76
+ * A `/`-rooted glob is NOT among the candidates: it joins to Vite's
77
+ * CONFIGURED PROJECT ROOT, which only reaches `@phosphor-icons/core` when
78
+ * it happens to be hoisted to that exact root — the original gh#287 failure.
79
+ * Globs that match zero files are free: `import.meta.glob` returns `{}`
80
+ * without touching the filesystem at runtime, so the losing candidates cost
81
+ * nothing.
70
82
  *
71
83
  * ## Vite dep-optimizer pre-bundling (gh#287, second independent failure mode)
72
84
  *
@@ -104,19 +116,50 @@
104
116
  * to the manifest fetch below
105
117
  */
106
118
 
107
- import { installIconLoaders } from './icons.js';
119
+ import { installIconLoaders, iconRegistryUnwired } from './icons.js';
108
120
 
109
- let weightModules;
121
+ let candidates;
110
122
  let hasViteGlob = false;
111
123
  try {
112
- weightModules = {
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' }),
119
- };
124
+ // Three node_modules layouts, probed in order — see the JSDoc section
125
+ // "Why there are three candidate globs" above. Every glob string and its
126
+ // options object must stay a static literal (Vite's macro constraint), so
127
+ // the 18 calls can't be generated from a loop.
128
+ candidates = [
129
+ {
130
+ layout: 'pnpm-nested `../node_modules/@phosphor-icons/core`',
131
+ weights: {
132
+ regular: import.meta.glob('../node_modules/@phosphor-icons/core/assets/regular/*.svg', { query: '?raw', import: 'default' }),
133
+ thin: import.meta.glob('../node_modules/@phosphor-icons/core/assets/thin/*.svg', { query: '?raw', import: 'default' }),
134
+ light: import.meta.glob('../node_modules/@phosphor-icons/core/assets/light/*.svg', { query: '?raw', import: 'default' }),
135
+ bold: import.meta.glob('../node_modules/@phosphor-icons/core/assets/bold/*.svg', { query: '?raw', import: 'default' }),
136
+ fill: import.meta.glob('../node_modules/@phosphor-icons/core/assets/fill/*.svg', { query: '?raw', import: 'default' }),
137
+ duotone: import.meta.glob('../node_modules/@phosphor-icons/core/assets/duotone/*.svg', { query: '?raw', import: 'default' }),
138
+ },
139
+ },
140
+ {
141
+ layout: 'npm/yarn-hoisted sibling `../../../@phosphor-icons/core`',
142
+ weights: {
143
+ regular: import.meta.glob('../../../@phosphor-icons/core/assets/regular/*.svg', { query: '?raw', import: 'default' }),
144
+ thin: import.meta.glob('../../../@phosphor-icons/core/assets/thin/*.svg', { query: '?raw', import: 'default' }),
145
+ light: import.meta.glob('../../../@phosphor-icons/core/assets/light/*.svg', { query: '?raw', import: 'default' }),
146
+ bold: import.meta.glob('../../../@phosphor-icons/core/assets/bold/*.svg', { query: '?raw', import: 'default' }),
147
+ fill: import.meta.glob('../../../@phosphor-icons/core/assets/fill/*.svg', { query: '?raw', import: 'default' }),
148
+ duotone: import.meta.glob('../../../@phosphor-icons/core/assets/duotone/*.svg', { query: '?raw', import: 'default' }),
149
+ },
150
+ },
151
+ {
152
+ layout: 'workspace-root `../../../node_modules/@phosphor-icons/core` (npm-shaped monorepo checkout)',
153
+ weights: {
154
+ regular: import.meta.glob('../../../node_modules/@phosphor-icons/core/assets/regular/*.svg', { query: '?raw', import: 'default' }),
155
+ thin: import.meta.glob('../../../node_modules/@phosphor-icons/core/assets/thin/*.svg', { query: '?raw', import: 'default' }),
156
+ light: import.meta.glob('../../../node_modules/@phosphor-icons/core/assets/light/*.svg', { query: '?raw', import: 'default' }),
157
+ bold: import.meta.glob('../../../node_modules/@phosphor-icons/core/assets/bold/*.svg', { query: '?raw', import: 'default' }),
158
+ fill: import.meta.glob('../../../node_modules/@phosphor-icons/core/assets/fill/*.svg', { query: '?raw', import: 'default' }),
159
+ duotone: import.meta.glob('../../../node_modules/@phosphor-icons/core/assets/duotone/*.svg', { query: '?raw', import: 'default' }),
160
+ },
161
+ },
162
+ ];
120
163
  hasViteGlob = true;
121
164
  } catch (err) {
122
165
  // FB-08: distinguish "no Vite at all" (expected, ReferenceError) from
@@ -135,45 +178,60 @@ try {
135
178
  }
136
179
 
137
180
  if (hasViteGlob) {
138
- // FB-08: detect the silent-empty-glob case `import.meta.glob` returns
139
- // `{}` when zero files match (it does NOT throw). The previous behavior
140
- // installed empty per-weight maps and the consumer saw an empty icon
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.
151
- const totalIcons = Object.values(weightModules).reduce(
181
+ // Install the first candidate layout whose globs matched anything.
182
+ // `import.meta.glob` returns `{}` when zero files match (it does NOT
183
+ // throw), so the losing layouts cost nothing.
184
+ const candidateTotal = (c) => Object.values(c.weights).reduce(
152
185
  (sum, weight) => sum + Object.keys(weight).length, 0
153
186
  );
154
- if (totalIcons === 0) {
155
- console.warn(
156
- `[icons-phosphor] No Phosphor icons matched the auto-install glob ` +
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` +
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` +
168
- ` installIconLoaders({\n` +
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.`
174
- );
187
+ const matched = candidates.find(c => candidateTotal(c) > 0);
188
+ if (matched) {
189
+ installIconLoaders(matched.weights);
190
+ } else {
191
+ // Every candidate matched zero files. Two possibilities remain, and
192
+ // only one is a failure:
193
+ // - The consumer registers icons manually (installIconLoaders /
194
+ // registerIcon) and never wanted the auto-install path — gh#786's
195
+ // reporter. Their registration runs later in the same startup, so
196
+ // defer the verdict and stay silent once the registry is wired.
197
+ // - The registry genuinely ends up empty: Vite's dev-server
198
+ // optimizeDeps pre-bundled this package (esbuild rewrites the globs
199
+ // to empty literals, gh#287), @phosphor-icons/core is missing, or
200
+ // the install layout is one this file doesn't probe (e.g. Yarn PnP's
201
+ // virtual filesystem). Zero icons will render — fail loudly, once,
202
+ // naming the fix (gh#340's acceptance).
203
+ // Deliberately NOT calling installIconLoaders with empty maps here:
204
+ // that would mark the registry "ready", suppressing <icon-ui>'s own
205
+ // unwired-registry diagnostic and clobbering nothing-yet for manual
206
+ // consumers.
207
+ setTimeout(() => {
208
+ if (!iconRegistryUnwired()) return; // manual registration landed — working setup, no noise
209
+ console.error(
210
+ `[icons-phosphor] Zero-config icon auto-install failed: no Phosphor ` +
211
+ `SVGs found under any known node_modules layout (probed pnpm-nested ` +
212
+ `\`../node_modules/\`, npm/yarn-hoisted \`../../../\`, and workspace-root ` +
213
+ `\`../../../node_modules/\` — all relative to icons-phosphor.js), and no ` +
214
+ `icons were registered manually. Every <icon-ui> will render blank. ` +
215
+ `Fixes, most likely first:\n` +
216
+ `(1) Vite dev-server pre-bundling emptied the globs — exclude this ` +
217
+ `package from optimizeDeps in vite.config.js:\n` +
218
+ ` optimizeDeps: { exclude: ['@adia-ai/web-components', '@adia-ai/web-modules'] }\n` +
219
+ `(2) @phosphor-icons/core is not installed, or your package manager ` +
220
+ `lays out node_modules somewhere this file doesn't probe (Yarn PnP is ` +
221
+ `not supported by the zero-config path).\n` +
222
+ `(3) Register the icons you use manually — this also silences this ` +
223
+ `error permanently:\n` +
224
+ ` import { installIconLoaders } from '@adia-ai/web-components/core/icons';\n` +
225
+ ` import caretRight from '@phosphor-icons/core/assets/regular/caret-right.svg?raw';\n` +
226
+ ` installIconLoaders({\n` +
227
+ ` regular: {\n` +
228
+ ` '/node_modules/@phosphor-icons/core/assets/regular/caret-right.svg': caretRight,\n` +
229
+ ` },\n` +
230
+ ` });\n` +
231
+ `See the JSDoc header of icons-phosphor.js for the full recipe (gh#786).`
232
+ );
233
+ }, 0);
175
234
  }
176
- installIconLoaders(weightModules);
177
235
  } else {
178
236
  // Non-Vite static serving: fetch the build-time manifest in the
179
237
  // background. No top-level await — module finishes loading immediately;