@adia-ai/web-components 0.8.30 → 0.8.32

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 (120) hide show
  1. package/CHANGELOG.md +59 -0
  2. package/components/accordion/accordion.d.ts +2 -2
  3. package/components/action-list/action-list.class.js +6 -2
  4. package/components/action-list/action-list.d.ts +1 -1
  5. package/components/agent-artifact/agent-artifact.d.ts +1 -1
  6. package/components/agent-feedback-bar/agent-feedback-bar.d.ts +2 -2
  7. package/components/agent-questions/agent-questions.d.ts +1 -1
  8. package/components/agent-reasoning/agent-reasoning.d.ts +3 -3
  9. package/components/agent-suggestions/agent-suggestions.d.ts +1 -1
  10. package/components/agent-trace/agent-trace.d.ts +1 -1
  11. package/components/alert/alert.d.ts +2 -2
  12. package/components/anchor-bar/anchor-bar.d.ts +2 -2
  13. package/components/avatar/avatar.class.js +0 -1
  14. package/components/avatar/avatar.css +16 -2
  15. package/components/badge/badge.css +30 -2
  16. package/components/breadcrumb/breadcrumb.css +15 -3
  17. package/components/button/button.d.ts +1 -1
  18. package/components/calendar-grid/calendar-grid.d.ts +2 -2
  19. package/components/card/card.css +21 -0
  20. package/components/card/card.yaml +9 -0
  21. package/components/chart/chart.d.ts +4 -4
  22. package/components/chart-legend/chart-legend.d.ts +1 -1
  23. package/components/chat-thread/chat-input.css +1 -1
  24. package/components/chat-thread/chat-input.js +9 -1
  25. package/components/chat-thread/chat-thread.class.js +6 -0
  26. package/components/chat-thread/chat-thread.d.ts +2 -2
  27. package/components/check/check.css +3 -3
  28. package/components/command/command.d.ts +2 -2
  29. package/components/context-menu/context-menu.d.ts +3 -3
  30. package/components/datetime-picker/datetime-picker.d.ts +5 -5
  31. package/components/demo-toggle/demo-toggle.d.ts +1 -1
  32. package/components/drawer/drawer.d.ts +2 -2
  33. package/components/heatmap/heatmap.d.ts +5 -5
  34. package/components/index.js +1 -0
  35. package/components/inline-edit/inline-edit.d.ts +4 -4
  36. package/components/input/input.a2ui.json +4 -1
  37. package/components/input/input.css +18 -0
  38. package/components/input/input.yaml +11 -1
  39. package/components/integration-card/integration-card.d.ts +4 -4
  40. package/components/link/link.d.ts +1 -1
  41. package/components/list/list-item.a2ui.json +6 -0
  42. package/components/list/list-item.yaml +13 -0
  43. package/components/list/list.class.js +28 -7
  44. package/components/list/list.d.ts +1 -1
  45. package/components/list-window/list-window.d.ts +5 -5
  46. package/components/menu/menu.css +2 -2
  47. package/components/menu/menu.d.ts +1 -1
  48. package/components/modal/modal.d.ts +1 -1
  49. package/components/nav/nav.css +8 -0
  50. package/components/nav/nav.d.ts +1 -1
  51. package/components/nav-group/nav-group.css +58 -9
  52. package/components/nav-group/nav-group.d.ts +1 -1
  53. package/components/nav-item/nav-item.css +7 -4
  54. package/components/nav-item/nav-item.d.ts +1 -1
  55. package/components/noodles/noodles.d.ts +3 -3
  56. package/components/option-card/option-card.css +1 -1
  57. package/components/pagination/pagination.d.ts +1 -1
  58. package/components/pane/pane.d.ts +1 -1
  59. package/components/password-strength/password-strength.d.ts +1 -1
  60. package/components/pipeline-status/pipeline-status.a2ui.json +14 -8
  61. package/components/pipeline-status/pipeline-status.d.ts +5 -4
  62. package/components/pipeline-status/pipeline-status.yaml +17 -11
  63. package/components/radio/radio.a2ui.json +4 -3
  64. package/components/radio/radio.css +2 -2
  65. package/components/radio/radio.yaml +7 -14
  66. package/components/radio-group/radio-group.a2ui.json +118 -0
  67. package/components/radio-group/radio-group.class.js +75 -0
  68. package/components/radio-group/radio-group.css +31 -0
  69. package/components/radio-group/radio-group.d.ts +20 -0
  70. package/components/radio-group/radio-group.examples.md +37 -0
  71. package/components/radio-group/radio-group.js +17 -0
  72. package/components/radio-group/radio-group.yaml +114 -0
  73. package/components/segmented/segmented.a2ui.json +5 -0
  74. package/components/segmented/segmented.class.js +20 -2
  75. package/components/segmented/segmented.yaml +5 -0
  76. package/components/stat/stat.css +12 -8
  77. package/components/stat/stat.js +66 -1
  78. package/components/stat/stat.yaml +3 -0
  79. package/components/stepper/stepper-item.a2ui.json +5 -0
  80. package/components/stepper/stepper-item.yaml +11 -0
  81. package/components/stepper/stepper.a2ui.json +38 -3
  82. package/components/stepper/stepper.class.js +199 -2
  83. package/components/stepper/stepper.css +30 -0
  84. package/components/stepper/stepper.d.ts +28 -1
  85. package/components/stepper/stepper.yaml +76 -2
  86. package/components/stream/stream.d.ts +3 -3
  87. package/components/swatch/swatch.class.js +1 -1
  88. package/components/swatch/swatch.d.ts +1 -1
  89. package/components/swiper/swiper.d.ts +3 -3
  90. package/components/table/table.a2ui.json +2 -2
  91. package/components/table/table.d.ts +7 -7
  92. package/components/table/table.yaml +9 -1
  93. package/components/table-toolbar/table-toolbar.d.ts +4 -4
  94. package/components/tabs/tabs.css +11 -3
  95. package/components/tabs/tabs.d.ts +1 -1
  96. package/components/tag/tag.a2ui.json +1 -1
  97. package/components/tag/tag.css +78 -13
  98. package/components/tag/tag.d.ts +12 -8
  99. package/components/tag/tag.examples.md +4 -4
  100. package/components/tag/tag.yaml +18 -7
  101. package/components/tags-input/tags-input.d.ts +4 -4
  102. package/components/timeline/timeline.d.ts +1 -1
  103. package/components/toc/toc.d.ts +1 -1
  104. package/components/toggle-group/toggle-group.d.ts +1 -1
  105. package/components/toggle-scheme/toggle-scheme.d.ts +1 -1
  106. package/components/tour/tour.d.ts +4 -4
  107. package/components/tree/tree.d.ts +1 -1
  108. package/core/icons-phosphor.js +129 -71
  109. package/core/provider.js +84 -23
  110. package/dist/host.min.css +1 -1
  111. package/dist/host.sheet.js +1 -1
  112. package/dist/theme-provider.min.js +1 -1
  113. package/dist/web-components.min.css +1 -1
  114. package/dist/web-components.min.js +89 -87
  115. package/dist/web-components.sheet.js +1 -1
  116. package/package.json +1 -1
  117. package/styles/api/sizing-fallback.css +32 -0
  118. package/styles/api/sizing.css +7 -3
  119. package/styles/components.css +1 -0
  120. package/styles/tokens.css +1 -0
package/core/provider.js CHANGED
@@ -25,6 +25,7 @@
25
25
  import { UIElement } from './element.js';
26
26
  import { defineIfFree } from './register.js';
27
27
  import { BaseController } from './controller.js';
28
+ import { viewTransition } from '../traits/view-transition/view-transition.js';
28
29
 
29
30
  // ═══════════════════════════════════════════════════════════════
30
31
  // ADIA PROVIDER (inline — tiny base class)
@@ -163,6 +164,15 @@ export class RouteController extends BaseController {
163
164
  // ═══════════════════════════════════════════════════════════════
164
165
 
165
166
  export class UIRouter extends UIProvider {
167
+ // gh#815 slice 1 — every route/content swap this element performs (the
168
+ // fetched-content path in #loadContent AND the content-less data-route-path
169
+ // swap consumers drive directly via setRoutePath()) rides the shared
170
+ // view-transition trait. That installs `this.startTransition(callback)`,
171
+ // which no-ops to a synchronous callback under prefers-reduced-motion or
172
+ // when the API is unsupported — this element never re-implements either
173
+ // fallback itself.
174
+ static traits = [viewTransition];
175
+
166
176
  #cache = new Map();
167
177
  #ownCtrl = null;
168
178
  #lastPath = null;
@@ -195,7 +205,32 @@ export class UIRouter extends UIProvider {
195
205
  navigate(path) { this.#ctrl?.commands.navigate(path); }
196
206
  replace(path) { this.#ctrl?.commands.replace(path); }
197
207
 
208
+ // Content-less usage (gh#815 slice 1): no `route.content` to fetch — a
209
+ // consumer's own CSS reveals children via `router-ui[data-route-path="…"]`
210
+ // selectors (embedded-app's tab routers do this) and the caller just wants
211
+ // the path attribute set. Routing that swap through the same trait as
212
+ // #loadContent gives it the identical no-flash guarantee instead of every
213
+ // consumer hand-rolling its own setAttribute + reduced-motion check.
214
+ setRoutePath(path) {
215
+ if (this.getAttribute('data-route-path') === path) return;
216
+ this.startTransition(() => { this.setAttribute('data-route-path', path); });
217
+ }
218
+
198
219
  connected() {
220
+ // Sensible default (motion tokens, foundation/motion.css) — a consumer
221
+ // that wants a different feel sets data-view-transition-duration itself;
222
+ // this only fills the gap when they haven't. Set BEFORE super.connected()
223
+ // (a no-op here, but PR #819 review: viewTransition.setup() reads these
224
+ // attributes once at trait-apply time, which happens after connected()
225
+ // returns in full — keeping the defaults first in program order makes
226
+ // that dependency obvious at the call site, not just true by accident
227
+ // of UIElement's connectedCallback ordering).
228
+ if (!this.hasAttribute('data-view-transition-duration')) {
229
+ this.setAttribute('data-view-transition-duration', 'var(--a-duration)');
230
+ }
231
+ if (!this.hasAttribute('data-view-transition-easing')) {
232
+ this.setAttribute('data-view-transition-easing', 'var(--a-easing)');
233
+ }
199
234
  super.connected();
200
235
  document.addEventListener('click', this.#onClick);
201
236
  }
@@ -251,30 +286,56 @@ export class UIRouter extends UIProvider {
251
286
  if (nav !== this.#navSeq) return; // superseded while resolving
252
287
  }
253
288
 
254
- this.innerHTML = html;
255
- // Re-stamp executable <script> tags so consumer demos can wire data via
256
- // imperative JS APIs (the documented `el.items = […]` / `el.invoice = {…}`
257
- // pattern used by plan-picker, invoice-detail, list-window et al). HTML
258
- // assigned via innerHTML does NOT execute embedded <script> elements per
259
- // the HTML spec; we replicate the canonical standalone-wrapper rehydration
260
- // pattern by cloning each script + swapping the inert original. `<script
261
- // type="application/json" …>` blocks are left untouched so the receiving
262
- // custom element's connectedCallback can absorb them (the documented
263
- // in-band data pattern; see PlanPicker.#absorbInlinePlansScript et al).
264
- for (const oldScript of this.querySelectorAll('script')) {
265
- const type = oldScript.getAttribute('type') || '';
266
- // Skip data blocks those are consumed by the runtime, not executed.
267
- if (type === 'application/json' || type === 'application/ld+json') continue;
268
- const newScript = document.createElement('script');
269
- if (type) newScript.type = type;
270
- if (oldScript.src) newScript.src = oldScript.src;
271
- else newScript.textContent = oldScript.textContent;
272
- oldScript.replaceWith(newScript);
273
- }
274
- this.scrollTo(0, 0);
275
- (this.closest('section') || this.parentElement)?.scrollTo(0, 0);
289
+ // gh#815 slice 1 — the actual pane swap (old content → new) rides the
290
+ // view-transition trait so the browser cross-fades instead of a bare
291
+ // synchronous replace. startTransition() already degrades to running
292
+ // this callback synchronously under prefers-reduced-motion or when the
293
+ // API is unsupported (view-transition.js owns both fallbacks).
294
+ //
295
+ // PR #819 review (CodeRabbit) on a REAL view transition the browser
296
+ // runs this callback asynchronously (it has to capture the "old"
297
+ // snapshot first, which needs a render pass); startTransition() itself
298
+ // returns before that callback has necessarily run. Two consequences,
299
+ // both closed here:
300
+ // 1. the callback itself must re-check `nav` — a newer navigation can
301
+ // supersede this one during that async gap, same incident class
302
+ // #navSeq exists to prevent (see the class comment above), and
303
+ // without this guard a stale callback could paint old content
304
+ // OVER a newer navigation's already-painted content.
305
+ // 2. everything downstream of the paint (setup-module import,
306
+ // route-loaded emit) must wait for the paint to actually finish —
307
+ // `transition.updateCallbackDone` resolves once the callback's
308
+ // return value settles — or the setup module runs against the
309
+ // PREVIOUS route's DOM instead of the one it was written for.
310
+ const transition = this.startTransition(() => {
311
+ if (nav !== this.#navSeq) return; // superseded — never paint stale content
312
+ this.innerHTML = html;
313
+ // Re-stamp executable <script> tags so consumer demos can wire data via
314
+ // imperative JS APIs (the documented `el.items = […]` / `el.invoice = {…}`
315
+ // pattern used by plan-picker, invoice-detail, list-window et al). HTML
316
+ // assigned via innerHTML does NOT execute embedded <script> elements per
317
+ // the HTML spec; we replicate the canonical standalone-wrapper rehydration
318
+ // pattern by cloning each script + swapping the inert original. `<script
319
+ // type="application/json" …>` blocks are left untouched so the receiving
320
+ // custom element's connectedCallback can absorb them (the documented
321
+ // in-band data pattern; see PlanPicker.#absorbInlinePlansScript et al).
322
+ for (const oldScript of this.querySelectorAll('script')) {
323
+ const type = oldScript.getAttribute('type') || '';
324
+ // Skip data blocks — those are consumed by the runtime, not executed.
325
+ if (type === 'application/json' || type === 'application/ld+json') continue;
326
+ const newScript = document.createElement('script');
327
+ if (type) newScript.type = type;
328
+ if (oldScript.src) newScript.src = oldScript.src;
329
+ else newScript.textContent = oldScript.textContent;
330
+ oldScript.replaceWith(newScript);
331
+ }
332
+ this.scrollTo(0, 0);
333
+ (this.closest('section') || this.parentElement)?.scrollTo(0, 0);
276
334
 
277
- if (route.title) document.title = route.title;
335
+ if (route.title) document.title = route.title;
336
+ });
337
+ await transition.updateCallbackDone;
338
+ if (nav !== this.#navSeq) return; // superseded while the DOM update was in flight
278
339
 
279
340
  // Auto-import setup module
280
341
  if (route.content?.endsWith('.content.html')) {