@adia-ai/web-components 0.4.8 → 0.5.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.
- package/USAGE.md +255 -2
- package/components/action-list/action-list.a2ui.json +15 -1
- package/components/action-list/action-list.d.ts +10 -1
- package/components/action-list/action-list.yaml +10 -0
- package/components/agent-artifact/agent-artifact.a2ui.json +7 -1
- package/components/agent-artifact/agent-artifact.d.ts +6 -1
- package/components/agent-artifact/agent-artifact.yaml +4 -0
- package/components/agent-feedback-bar/agent-feedback-bar.a2ui.json +7 -1
- package/components/agent-feedback-bar/agent-feedback-bar.d.ts +6 -1
- package/components/agent-feedback-bar/agent-feedback-bar.yaml +4 -0
- package/components/agent-questions/agent-questions.a2ui.json +11 -1
- package/components/agent-questions/agent-questions.d.ts +8 -1
- package/components/agent-questions/agent-questions.yaml +7 -0
- package/components/agent-reasoning/agent-reasoning.a2ui.json +25 -3
- package/components/agent-reasoning/agent-reasoning.d.ts +20 -3
- package/components/agent-reasoning/agent-reasoning.yaml +15 -0
- package/components/agent-suggestions/agent-suggestions.a2ui.json +15 -1
- package/components/agent-suggestions/agent-suggestions.d.ts +10 -1
- package/components/agent-suggestions/agent-suggestions.yaml +10 -0
- package/components/agent-trace/agent-trace.a2ui.json +7 -1
- package/components/agent-trace/agent-trace.d.ts +6 -1
- package/components/agent-trace/agent-trace.yaml +4 -0
- package/components/canvas/canvas.yaml +9 -7
- package/components/chart/chart.a2ui.json +3 -0
- package/components/chart/chart.d.ts +2 -0
- package/components/chart/chart.yaml +5 -0
- package/components/chart-legend/chart-legend.a2ui.json +15 -1
- package/components/chart-legend/chart-legend.d.ts +10 -1
- package/components/chart-legend/chart-legend.yaml +10 -0
- package/components/chat-thread/chat-thread.a2ui.json +11 -1
- package/components/chat-thread/chat-thread.d.ts +8 -1
- package/components/chat-thread/chat-thread.yaml +7 -0
- package/components/code/code.a2ui.json +36 -7
- package/components/code/code.d.ts +30 -0
- package/components/code/code.yaml +29 -6
- package/components/color-picker/class.js +59 -1
- package/components/color-picker/color-picker.a2ui.json +34 -0
- package/components/color-picker/color-picker.d.ts +70 -8
- package/components/color-picker/color-picker.yaml +49 -0
- package/components/command/command.a2ui.json +11 -1
- package/components/command/command.d.ts +8 -1
- package/components/command/command.yaml +7 -0
- package/components/demo-toggle/demo-toggle.a2ui.json +7 -1
- package/components/demo-toggle/demo-toggle.d.ts +6 -1
- package/components/demo-toggle/demo-toggle.yaml +4 -0
- package/components/heatmap/heatmap.a2ui.json +11 -2
- package/components/heatmap/heatmap.d.ts +6 -0
- package/components/heatmap/heatmap.yaml +17 -2
- package/components/link/link.a2ui.json +11 -1
- package/components/link/link.d.ts +8 -1
- package/components/link/link.yaml +7 -0
- package/components/list/list.a2ui.json +11 -1
- package/components/list/list.d.ts +8 -1
- package/components/list/list.yaml +7 -0
- package/components/menu/menu.a2ui.json +11 -1
- package/components/menu/menu.d.ts +8 -1
- package/components/menu/menu.yaml +7 -0
- package/components/nav/nav.a2ui.json +15 -1
- package/components/nav/nav.d.ts +10 -1
- package/components/nav/nav.yaml +10 -0
- package/components/nav-group/nav-group.a2ui.json +11 -1
- package/components/nav-group/nav-group.d.ts +8 -1
- package/components/nav-group/nav-group.yaml +7 -0
- package/components/nav-item/nav-item.a2ui.json +15 -1
- package/components/nav-item/nav-item.d.ts +10 -1
- package/components/nav-item/nav-item.yaml +10 -0
- package/components/noodles/noodles.a2ui.json +46 -2
- package/components/noodles/noodles.d.ts +28 -2
- package/components/noodles/noodles.yaml +32 -0
- package/components/otp-input/otp-input.a2ui.json +14 -2
- package/components/otp-input/otp-input.d.ts +11 -0
- package/components/otp-input/otp-input.yaml +10 -2
- package/components/pagination/pagination.a2ui.json +7 -1
- package/components/pagination/pagination.d.ts +6 -1
- package/components/pagination/pagination.yaml +4 -0
- package/components/stream/stream.a2ui.json +7 -1
- package/components/stream/stream.d.ts +6 -1
- package/components/stream/stream.yaml +4 -0
- package/components/swatch/class.js +362 -15
- package/components/swatch/swatch.a2ui.json +68 -1
- package/components/swatch/swatch.css +150 -0
- package/components/swatch/swatch.d.ts +43 -0
- package/components/swatch/swatch.yaml +67 -1
- package/components/swiper/swiper.a2ui.json +18 -2
- package/components/swiper/swiper.d.ts +14 -2
- package/components/swiper/swiper.yaml +11 -0
- package/components/table/table.a2ui.json +80 -5
- package/components/table/table.d.ts +58 -5
- package/components/table/table.yaml +54 -2
- package/components/tabs/tabs.a2ui.json +7 -1
- package/components/tabs/tabs.d.ts +6 -1
- package/components/tabs/tabs.yaml +4 -0
- package/components/tag/tag.a2ui.json +11 -1
- package/components/tag/tag.d.ts +8 -1
- package/components/tag/tag.yaml +7 -0
- package/components/timeline/timeline.a2ui.json +3 -7
- package/components/timeline/timeline.d.ts +2 -4
- package/components/timeline/timeline.yaml +3 -6
- package/components/toggle-group/toggle-group.a2ui.json +7 -1
- package/components/toggle-group/toggle-group.d.ts +6 -1
- package/components/toggle-group/toggle-group.yaml +4 -0
- package/components/toggle-scheme/toggle-scheme.a2ui.json +11 -1
- package/components/toggle-scheme/toggle-scheme.d.ts +8 -1
- package/components/toggle-scheme/toggle-scheme.yaml +7 -0
- package/components/tree/tree.a2ui.json +15 -1
- package/components/tree/tree.d.ts +10 -1
- package/components/tree/tree.yaml +10 -0
- package/core/data-stream.d.ts +56 -0
- package/core/element.d.ts +10 -0
- package/core/index.d.ts +6 -0
- package/index.d.ts +9 -2
- package/package.json +2 -2
package/USAGE.md
CHANGED
|
@@ -166,11 +166,46 @@ function MinLSlider({ minL, onMinLChange }) {
|
|
|
166
166
|
<slider-ui value={minL * 100} on:change={e => minL = e.detail.value / 100}></slider-ui>
|
|
167
167
|
```
|
|
168
168
|
|
|
169
|
+
### Derived reactive bindings
|
|
170
|
+
|
|
171
|
+
When the value you want to render is a **transformation of a signal** — e.g. you store `0..1` but the slider displays `0..100`, or the displayed text is `${count} items` — pass a **function** as the binding. The template engine detects functions and wraps them in an `effect()`, so the binding re-evaluates whenever any signal read inside the function changes.
|
|
172
|
+
|
|
173
|
+
```js
|
|
174
|
+
// ✅ Derived reactive — re-evaluates whenever minL changes
|
|
175
|
+
html`<slider-ui .value=${() => minL.value * 100} min="0" max="100" />`
|
|
176
|
+
|
|
177
|
+
// ✅ Direct signal — re-evaluates whenever minL changes
|
|
178
|
+
html`<slider-ui .value=${minL} min="0" max="1" step="0.01" />`
|
|
179
|
+
|
|
180
|
+
// ❌ Static snapshot — reads minL.value ONCE at render time; thumb never moves
|
|
181
|
+
html`<slider-ui .value=${minL.value * 100} />`
|
|
182
|
+
|
|
183
|
+
// ❌ Function as the value, not a binding — slider receives the function object, not its result
|
|
184
|
+
html`<slider-ui .value=${(v) => v * 100} />`
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
The rule: **inside `.prop=${…}`, anything that reads `.value` directly is a snapshot. Wrap in `() => …` to get reactivity.**
|
|
188
|
+
|
|
189
|
+
For more complex derived values, `computed()` gives you a named reactive holder you can pass directly or read in templates:
|
|
190
|
+
|
|
191
|
+
```js
|
|
192
|
+
import { signal, computed, html } from '@adia-ai/web-components/core';
|
|
193
|
+
|
|
194
|
+
const minL = signal(0.4);
|
|
195
|
+
const displayPct = computed(() => Math.round(minL.value * 100));
|
|
196
|
+
|
|
197
|
+
html`<slider-ui .value=${displayPct} />` // ✅ pass the computed signal direct
|
|
198
|
+
html`<text-ui>${displayPct}</text-ui>` // ✅ same in text bindings
|
|
199
|
+
html`<text-ui>${() => `${displayPct.value}%`}</text-ui>` // ✅ function form with template literal
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
`computed()` memoizes (re-runs only when its dependencies change) and gives you a stable handle you can pass to multiple bindings without re-instantiating the effect at every render.
|
|
203
|
+
|
|
169
204
|
### The eager-evaluation trap
|
|
170
205
|
|
|
171
206
|
Reported real-world bug: a consumer wrote `.value=${signal.value * 100}` and reported "the slider doesn't move on undo." The slider IS reactive; the binding pattern wasn't. `signal.value * 100` evaluates eagerly to a number; the template system never sees the signal, so it can't subscribe.
|
|
172
207
|
|
|
173
|
-
**Fix:** pass `${signal}` (signal direct) or `${() => signal.value * 100}` (function as value). Both get effect-wrapped.
|
|
208
|
+
**Fix:** pass `${signal}` (signal direct) or `${() => signal.value * 100}` (function as value). Both get effect-wrapped. See the "Derived reactive bindings" section above for the full pattern.
|
|
174
209
|
|
|
175
210
|
---
|
|
176
211
|
|
|
@@ -218,7 +253,7 @@ Some primitives emit named events beyond `change`/`input`:
|
|
|
218
253
|
- `<select-ui>` — emits `action` for option-callbacks with `detail.action`
|
|
219
254
|
- `<search-ui>` — emits `search` after debounce with `detail.value`
|
|
220
255
|
- `<chat-composer>` — emits `composer-submit` on Enter with `detail.value`
|
|
221
|
-
- `<color-picker-ui>` — emits
|
|
256
|
+
- `<color-picker-ui>` — emits `input` + `change` with rich detail (`{ value, l, c, h, hex, oklch }`)
|
|
222
257
|
|
|
223
258
|
Each primitive's yaml lists its complete event surface. Live demos at `https://ui-kit.exe.xyz/site/components/<name>`.
|
|
224
259
|
|
|
@@ -226,6 +261,90 @@ Each primitive's yaml lists its complete event surface. Live demos at `https://u
|
|
|
226
261
|
|
|
227
262
|
All standard events bubble. Internal-routing collisions (e.g. a trait listening for an event then re-emitting one with the same name) are avoided by name discipline — see the `event-name-collision` memory entry for the lesson.
|
|
228
263
|
|
|
264
|
+
### Authoring events in yaml (for contributors)
|
|
265
|
+
|
|
266
|
+
> *This subsection is for contributors authoring new primitives or extending an existing primitive's event surface. If you're a consumer integrating AdiaUI, skip ahead.*
|
|
267
|
+
|
|
268
|
+
Each component's `<name>.yaml` declares its event surface in a top-level `events:` block. The build pipeline (`npm run build:components`) carries that block into `<name>.a2ui.json` under `x-adiaui.events`, and v0.4.8 §80 codegen reads it from there to emit typed `addEventListener` overloads + `CustomEvent<X>` aliases in `<name>.d.ts`. **The yaml is the single source of truth**; the sidecar + `.d.ts` regenerate from it.
|
|
269
|
+
|
|
270
|
+
#### When to add an `events:` entry
|
|
271
|
+
|
|
272
|
+
Whenever your primitive's `class.js` calls `this.dispatchEvent(new CustomEvent('NAME', ...))` or `new Event('NAME', ...)`, the yaml needs a matching entry. The `check-form-bearing-dts.mjs` audit (v0.5.0-staged) catches drift between dispatch literals and `.d.ts` typings; populating yaml correctly prevents that drift.
|
|
273
|
+
|
|
274
|
+
#### The shape
|
|
275
|
+
|
|
276
|
+
```yaml
|
|
277
|
+
events:
|
|
278
|
+
open:
|
|
279
|
+
description: Fired when the modal becomes visible.
|
|
280
|
+
detail:
|
|
281
|
+
trigger:
|
|
282
|
+
type: string
|
|
283
|
+
description: One of 'click' | 'keyboard' | 'programmatic'.
|
|
284
|
+
close:
|
|
285
|
+
description: Fired when the modal is dismissed.
|
|
286
|
+
# No detail block → CustomEvent<unknown> at the .d.ts surface.
|
|
287
|
+
toggle:
|
|
288
|
+
description: Fired when state flips.
|
|
289
|
+
detail:
|
|
290
|
+
open:
|
|
291
|
+
type: boolean
|
|
292
|
+
description: New open state after the toggle.
|
|
293
|
+
bubbles: false # default is true; set false only for non-bubbling events
|
|
294
|
+
```
|
|
295
|
+
|
|
296
|
+
#### What ends up where
|
|
297
|
+
|
|
298
|
+
For a yaml entry like the `toggle` event above on `<my-thing-ui>`:
|
|
299
|
+
|
|
300
|
+
| Surface | Shape |
|
|
301
|
+
|---|---|
|
|
302
|
+
| `<my-thing-ui>.a2ui.json` | `x-adiaui.events.toggle = { description, detail: { open: { type, description } }, bubbles? }` |
|
|
303
|
+
| `<my-thing-ui>.d.ts` (codegen) | `interface MyThingToggleEventDetail { open: boolean; }` + `type MyThingToggleEvent = CustomEvent<MyThingToggleEventDetail>` + `addEventListener` overload for `'toggle'` |
|
|
304
|
+
| Runtime | `this.dispatchEvent(new CustomEvent('toggle', { detail: { open: this.open }, bubbles: true }))` |
|
|
305
|
+
|
|
306
|
+
#### Detail-key types
|
|
307
|
+
|
|
308
|
+
The codegen recognizes these `type:` values inside a detail key:
|
|
309
|
+
|
|
310
|
+
| yaml `type:` | TS emitted |
|
|
311
|
+
|---|---|
|
|
312
|
+
| `string` | `string` |
|
|
313
|
+
| `number` / `integer` | `number` |
|
|
314
|
+
| `boolean` | `boolean` |
|
|
315
|
+
| `object` | `Record<string, unknown>` |
|
|
316
|
+
| `array` | `unknown[]` |
|
|
317
|
+
| missing | `unknown` |
|
|
318
|
+
|
|
319
|
+
If you need a string-literal union, declare via `enum: [a, b, c]` and the codegen emits `'a' | 'b' | 'c'`.
|
|
320
|
+
|
|
321
|
+
#### Worked example: `<modal-ui>` close
|
|
322
|
+
|
|
323
|
+
Yaml at `packages/web-components/components/modal/modal.yaml`:
|
|
324
|
+
|
|
325
|
+
```yaml
|
|
326
|
+
events:
|
|
327
|
+
close:
|
|
328
|
+
description: Fires when the modal is dismissed (backdrop click, Escape, programmatic hide()).
|
|
329
|
+
```
|
|
330
|
+
|
|
331
|
+
Sidecar after `npm run build:components`:
|
|
332
|
+
|
|
333
|
+
```json
|
|
334
|
+
{ "x-adiaui": { "events": { "close": { "description": "Fires when the modal is dismissed..." } } } }
|
|
335
|
+
```
|
|
336
|
+
|
|
337
|
+
Emitted `.d.ts` after `npm run codegen:dts`:
|
|
338
|
+
|
|
339
|
+
```ts
|
|
340
|
+
export type ModalCloseEvent = CustomEvent<unknown>;
|
|
341
|
+
export class UIModal extends UIElement {
|
|
342
|
+
addEventListener(type: 'close', listener: (ev: ModalCloseEvent) => unknown, options?: ...): void;
|
|
343
|
+
}
|
|
344
|
+
```
|
|
345
|
+
|
|
346
|
+
Reference: [`docs/conventions/component-events.md`](../../docs/conventions/component-events.md) for the 1-page convention summary; [`scripts/build/dts-codegen.mjs`](../../scripts/build/dts-codegen.mjs) for the codegen logic that reads `x-adiaui.events`; [`scripts/release/check-form-bearing-dts.mjs`](../../scripts/release/check-form-bearing-dts.mjs) for the drift audit.
|
|
347
|
+
|
|
229
348
|
---
|
|
230
349
|
|
|
231
350
|
## Form participation
|
|
@@ -592,6 +711,140 @@ Properties are installed by `installProps()` in `super()`, but the host's render
|
|
|
592
711
|
|
|
593
712
|
---
|
|
594
713
|
|
|
714
|
+
## Worked examples
|
|
715
|
+
|
|
716
|
+
Migrations from common custom-helper shapes to AdiaUI primitives. Each example pairs a real consumer's pre-AdiaUI helper with the equivalent AdiaUI declaration.
|
|
717
|
+
|
|
718
|
+
### Replace a hand-rolled color-token swatch with `<swatch-ui>` (v0.4.9+)
|
|
719
|
+
|
|
720
|
+
Pre-v0.4.9, design-token tools commonly hand-rolled a `renderSwatch()` helper composing: background color, key label, gamut badge (sRGB / P3 markers), APCA contrast badge, copy-to-clipboard button, light/dark auto-contrast label, keyboard select. v0.4.9 extends `<swatch-ui>` with all six surfaces — the helper collapses to one declarative tag.
|
|
721
|
+
|
|
722
|
+
```diff
|
|
723
|
+
- // Pre — 70 LOC helper
|
|
724
|
+
- function renderSwatch({ color, label, detail, gamutBadge, copyValue, selected, onSelect }) {
|
|
725
|
+
- const el = document.createElement('div')
|
|
726
|
+
- el.className = 'token-swatch'
|
|
727
|
+
- el.style.backgroundColor = color
|
|
728
|
+
- el.tabIndex = 0
|
|
729
|
+
- el.setAttribute('role', 'button')
|
|
730
|
+
- el.setAttribute('aria-pressed', String(selected))
|
|
731
|
+
- if (selected) el.classList.add('selected')
|
|
732
|
+
-
|
|
733
|
+
- const labelEl = document.createElement('span')
|
|
734
|
+
- labelEl.className = 'swatch-label'
|
|
735
|
+
- labelEl.textContent = label
|
|
736
|
+
- labelEl.style.color = isLight(color) ? 'var(--fg-dark)' : 'var(--fg-light)'
|
|
737
|
+
- el.appendChild(labelEl)
|
|
738
|
+
-
|
|
739
|
+
- const detailEl = document.createElement('span')
|
|
740
|
+
- detailEl.className = 'swatch-detail'
|
|
741
|
+
- detailEl.textContent = detail
|
|
742
|
+
- el.appendChild(detailEl)
|
|
743
|
+
-
|
|
744
|
+
- if (gamutBadge) {
|
|
745
|
+
- const badge = document.createElement('span')
|
|
746
|
+
- badge.className = 'swatch-badge'
|
|
747
|
+
- badge.textContent = gamutBadge === 'out-of-gamut' ? '△' : '✦'
|
|
748
|
+
- badge.setAttribute('aria-label', gamutBadge)
|
|
749
|
+
- el.appendChild(badge)
|
|
750
|
+
- }
|
|
751
|
+
-
|
|
752
|
+
- const copyBtn = document.createElement('button')
|
|
753
|
+
- copyBtn.className = 'swatch-copy'
|
|
754
|
+
- copyBtn.textContent = '⧉'
|
|
755
|
+
- copyBtn.setAttribute('aria-label', `Copy ${copyValue}`)
|
|
756
|
+
- copyBtn.addEventListener('click', async (e) => {
|
|
757
|
+
- e.stopPropagation()
|
|
758
|
+
- try { await navigator.clipboard.writeText(copyValue); copyBtn.textContent = '✓' }
|
|
759
|
+
- catch { copyBtn.textContent = '⚠' }
|
|
760
|
+
- setTimeout(() => { copyBtn.textContent = '⧉' }, 1200)
|
|
761
|
+
- })
|
|
762
|
+
- el.appendChild(copyBtn)
|
|
763
|
+
-
|
|
764
|
+
- el.addEventListener('click', (e) => {
|
|
765
|
+
- if (e.target === copyBtn) return
|
|
766
|
+
- onSelect({ color, label })
|
|
767
|
+
- })
|
|
768
|
+
- el.addEventListener('keydown', (e) => {
|
|
769
|
+
- if (e.key !== 'Enter' && e.key !== ' ') return
|
|
770
|
+
- if (e.target === copyBtn) return
|
|
771
|
+
- e.preventDefault()
|
|
772
|
+
- onSelect({ color, label })
|
|
773
|
+
- })
|
|
774
|
+
-
|
|
775
|
+
- return el
|
|
776
|
+
- }
|
|
777
|
+
|
|
778
|
+
+ // Post — one declarative tag
|
|
779
|
+
+ html`<swatch-ui
|
|
780
|
+
+ shape="block" size="lg"
|
|
781
|
+
+ color=${color}
|
|
782
|
+
+ label=${label}
|
|
783
|
+
+ detail=${detail}
|
|
784
|
+
+ badge=${gamutBadge}
|
|
785
|
+
+ copyable
|
|
786
|
+
+ copy-value=${copyValue}
|
|
787
|
+
+ selectable
|
|
788
|
+
+ ?selected=${selected}
|
|
789
|
+
+ auto-contrast
|
|
790
|
+
+ @select=${(e) => onSelect({ color: e.detail.color, label: e.detail.label })}
|
|
791
|
+
+ ></swatch-ui>`
|
|
792
|
+
```
|
|
793
|
+
|
|
794
|
+
The primitive owns: badge symbol + ARIA mapping, copy-clipboard state machine (⧉ → ✓ / ⚠ → ⧉ after 1.2s), `role="button"` + `tabindex="0"` only when `[selectable]`, focus ring on `:focus-visible` + always-on when `[selected]`, click-on-copy-doesn't-toggle-selection guard, label auto-contrast via OKLCH luminance (when `[auto-contrast]` is set).
|
|
795
|
+
|
|
796
|
+
The `select` event detail is `{ value, color, label }` — `value` is `[color]` (or `[label]` as fallback) so consumers binding to a value-shaped select handler get the canonical accessor uniformly across form-bearing primitives.
|
|
797
|
+
|
|
798
|
+
For multiple simultaneous badges (e.g. both `out-of-gamut` and `apca-fail`), pass a comma-separated list: `badge="out-of-gamut, apca-fail"` — v0.4.9 renders both stacked in the upper-right.
|
|
799
|
+
|
|
800
|
+
### Guard global keyboard shortcuts with `isFocusInInput()` (v0.4.8+)
|
|
801
|
+
|
|
802
|
+
```diff
|
|
803
|
+
- // Pre — manual cast boilerplate at every shortcut site
|
|
804
|
+
- document.addEventListener('keydown', (e) => {
|
|
805
|
+
- const active = document.activeElement as HTMLElement | null
|
|
806
|
+
- if (active && (
|
|
807
|
+
- active.tagName === 'INPUT' ||
|
|
808
|
+
- active.tagName === 'TEXTAREA' ||
|
|
809
|
+
- active.isContentEditable
|
|
810
|
+
- )) return
|
|
811
|
+
- if (e.key === '/') openCommandPalette()
|
|
812
|
+
- })
|
|
813
|
+
|
|
814
|
+
+ // Post — one import + one call
|
|
815
|
+
+ import { isFocusInInput } from '@adia-ai/web-modules/editor'
|
|
816
|
+
+
|
|
817
|
+
+ document.addEventListener('keydown', (e) => {
|
|
818
|
+
+ if (isFocusInInput()) return
|
|
819
|
+
+ if (e.key === '/') openCommandPalette()
|
|
820
|
+
+ })
|
|
821
|
+
```
|
|
822
|
+
|
|
823
|
+
`isFocusInInput()` also recognizes AdiaUI text-input primitives (`<input-ui>`, `<textarea-ui>`, `<otp-input-ui>`, `<search-ui>`) by host tag-name — important because focus may land on the custom-element host before the inner native input mounts.
|
|
824
|
+
|
|
825
|
+
### Use derived reactive bindings for unit-conversion (v0.4.6+)
|
|
826
|
+
|
|
827
|
+
```diff
|
|
828
|
+
- // Pre — eager evaluation; slider doesn't move on undo
|
|
829
|
+
- <slider-ui .value=${minL.value * 100} min="0" max="100" step="1"></slider-ui>
|
|
830
|
+
|
|
831
|
+
+ // Post — function-as-value gets effect-wrapped
|
|
832
|
+
+ <slider-ui .value=${() => minL.value * 100} min="0" max="100" step="1"></slider-ui>
|
|
833
|
+
```
|
|
834
|
+
|
|
835
|
+
The function re-runs on every dependency mutation. Same pattern works for derived computations (e.g. `() => clamp(minL.value * 100, 0, 100)`) and signal-array transforms.
|
|
836
|
+
|
|
837
|
+
### Persist `<editor-sidebar>` width across reloads (v0.4.9+)
|
|
838
|
+
|
|
839
|
+
```diff
|
|
840
|
+
- <editor-sidebar collapsible name="dts-layout">
|
|
841
|
+
+ <editor-sidebar collapsible persist="dts-layout">
|
|
842
|
+
```
|
|
843
|
+
|
|
844
|
+
`[persist]` is the preferred name in v0.4.9+. `[name]` keeps working (back-compat alias; deprecated, not scheduled for v0.5.x removal). Storage namespace + `sidebar-toggle` event detail are unchanged.
|
|
845
|
+
|
|
846
|
+
---
|
|
847
|
+
|
|
595
848
|
## More
|
|
596
849
|
|
|
597
850
|
- [`README.md`](./README.md) — package overview + authoring guide
|
|
@@ -29,7 +29,21 @@
|
|
|
29
29
|
],
|
|
30
30
|
"events": {
|
|
31
31
|
"action": {
|
|
32
|
-
"description": "Fired on action."
|
|
32
|
+
"description": "Fired on action.",
|
|
33
|
+
"detail": {
|
|
34
|
+
"item": {
|
|
35
|
+
"description": "The triggering list-item element.",
|
|
36
|
+
"type": "object"
|
|
37
|
+
},
|
|
38
|
+
"text": {
|
|
39
|
+
"description": "Item text content or [text] attribute.",
|
|
40
|
+
"type": "string"
|
|
41
|
+
},
|
|
42
|
+
"value": {
|
|
43
|
+
"description": "Item value attribute (preferred over text for stable IDs).",
|
|
44
|
+
"type": "string"
|
|
45
|
+
}
|
|
46
|
+
}
|
|
33
47
|
}
|
|
34
48
|
},
|
|
35
49
|
"examples": [
|
|
@@ -12,7 +12,16 @@
|
|
|
12
12
|
|
|
13
13
|
import { UIElement } from '../../core/element.js';
|
|
14
14
|
|
|
15
|
-
export
|
|
15
|
+
export interface ActionListActionEventDetail {
|
|
16
|
+
/** The triggering list-item element. */
|
|
17
|
+
item: Record<string, unknown>;
|
|
18
|
+
/** Item text content or [text] attribute. */
|
|
19
|
+
text: string;
|
|
20
|
+
/** Item value attribute (preferred over text for stable IDs). */
|
|
21
|
+
value: string;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export type ActionListActionEvent = CustomEvent<ActionListActionEventDetail>;
|
|
16
25
|
|
|
17
26
|
export class UIActionList extends UIElement {
|
|
18
27
|
|
|
@@ -16,6 +16,16 @@ props: {}
|
|
|
16
16
|
events:
|
|
17
17
|
action:
|
|
18
18
|
description: "Fired on action."
|
|
19
|
+
detail:
|
|
20
|
+
value:
|
|
21
|
+
type: string
|
|
22
|
+
description: Item value attribute (preferred over text for stable IDs).
|
|
23
|
+
text:
|
|
24
|
+
type: string
|
|
25
|
+
description: Item text content or [text] attribute.
|
|
26
|
+
item:
|
|
27
|
+
type: object
|
|
28
|
+
description: The triggering list-item element.
|
|
19
29
|
slots:
|
|
20
30
|
default (action-item-ui children):
|
|
21
31
|
description: "Child content region for the `default (action-item-ui children)` slot."
|
|
@@ -55,7 +55,13 @@
|
|
|
55
55
|
],
|
|
56
56
|
"events": {
|
|
57
57
|
"artifact-toggle": {
|
|
58
|
-
"description": "Fired on artifact-toggle."
|
|
58
|
+
"description": "Fired on artifact-toggle.",
|
|
59
|
+
"detail": {
|
|
60
|
+
"collapsed": {
|
|
61
|
+
"description": "New collapsed state after the toggle.",
|
|
62
|
+
"type": "boolean"
|
|
63
|
+
}
|
|
64
|
+
}
|
|
59
65
|
}
|
|
60
66
|
},
|
|
61
67
|
"examples": [
|
|
@@ -12,7 +12,12 @@
|
|
|
12
12
|
|
|
13
13
|
import { UIElement } from '../../core/element.js';
|
|
14
14
|
|
|
15
|
-
export
|
|
15
|
+
export interface AgentArtifactArtifactToggleEventDetail {
|
|
16
|
+
/** New collapsed state after the toggle. */
|
|
17
|
+
collapsed: boolean;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export type AgentArtifactArtifactToggleEvent = CustomEvent<AgentArtifactArtifactToggleEventDetail>;
|
|
16
21
|
|
|
17
22
|
export class UIAgentArtifact extends UIElement {
|
|
18
23
|
/** Header title. */
|
|
@@ -36,6 +36,10 @@ props:
|
|
|
36
36
|
events:
|
|
37
37
|
artifact-toggle:
|
|
38
38
|
description: "Fired on artifact-toggle."
|
|
39
|
+
detail:
|
|
40
|
+
collapsed:
|
|
41
|
+
type: boolean
|
|
42
|
+
description: New collapsed state after the toggle.
|
|
39
43
|
slots:
|
|
40
44
|
default:
|
|
41
45
|
description: "Default slot — primary child content."
|
|
@@ -44,7 +44,13 @@
|
|
|
44
44
|
],
|
|
45
45
|
"events": {
|
|
46
46
|
"feedback-rate": {
|
|
47
|
-
"description": "Fired on feedback-rate."
|
|
47
|
+
"description": "Fired on feedback-rate.",
|
|
48
|
+
"detail": {
|
|
49
|
+
"rating": {
|
|
50
|
+
"description": "Rating value selected by the user.",
|
|
51
|
+
"type": "number"
|
|
52
|
+
}
|
|
53
|
+
}
|
|
48
54
|
},
|
|
49
55
|
"feedback-save": {
|
|
50
56
|
"description": "Fired on feedback-save."
|
|
@@ -12,7 +12,12 @@
|
|
|
12
12
|
|
|
13
13
|
import { UIElement } from '../../core/element.js';
|
|
14
14
|
|
|
15
|
-
export
|
|
15
|
+
export interface AgentFeedbackBarFeedbackRateEventDetail {
|
|
16
|
+
/** Rating value selected by the user. */
|
|
17
|
+
rating: number;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export type AgentFeedbackBarFeedbackRateEvent = CustomEvent<AgentFeedbackBarFeedbackRateEventDetail>;
|
|
16
21
|
export type AgentFeedbackBarFeedbackSaveEvent = CustomEvent<unknown>;
|
|
17
22
|
|
|
18
23
|
export class UIAgentFeedbackBar extends UIElement {
|
|
@@ -49,7 +49,17 @@
|
|
|
49
49
|
],
|
|
50
50
|
"events": {
|
|
51
51
|
"questions-answer": {
|
|
52
|
-
"description": "Fired on questions-answer."
|
|
52
|
+
"description": "Fired on questions-answer.",
|
|
53
|
+
"detail": {
|
|
54
|
+
"option": {
|
|
55
|
+
"description": "The full selected option object.",
|
|
56
|
+
"type": "object"
|
|
57
|
+
},
|
|
58
|
+
"selected": {
|
|
59
|
+
"description": "Array of selected option IDs.",
|
|
60
|
+
"type": "array"
|
|
61
|
+
}
|
|
62
|
+
}
|
|
53
63
|
}
|
|
54
64
|
},
|
|
55
65
|
"examples": [
|
|
@@ -12,7 +12,14 @@
|
|
|
12
12
|
|
|
13
13
|
import { UIElement } from '../../core/element.js';
|
|
14
14
|
|
|
15
|
-
export
|
|
15
|
+
export interface AgentQuestionsQuestionsAnswerEventDetail {
|
|
16
|
+
/** The full selected option object. */
|
|
17
|
+
option: Record<string, unknown>;
|
|
18
|
+
/** Array of selected option IDs. */
|
|
19
|
+
selected: unknown[];
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export type AgentQuestionsQuestionsAnswerEvent = CustomEvent<AgentQuestionsQuestionsAnswerEventDetail>;
|
|
16
23
|
|
|
17
24
|
export class UIAgentQuestions extends UIElement {
|
|
18
25
|
/** Helper text. */
|
|
@@ -32,6 +32,13 @@ props:
|
|
|
32
32
|
events:
|
|
33
33
|
questions-answer:
|
|
34
34
|
description: "Fired on questions-answer."
|
|
35
|
+
detail:
|
|
36
|
+
selected:
|
|
37
|
+
type: array
|
|
38
|
+
description: Array of selected option IDs.
|
|
39
|
+
option:
|
|
40
|
+
type: object
|
|
41
|
+
description: The full selected option object.
|
|
35
42
|
slots:
|
|
36
43
|
default:
|
|
37
44
|
description: "Default slot — primary child content."
|
|
@@ -56,13 +56,35 @@
|
|
|
56
56
|
],
|
|
57
57
|
"events": {
|
|
58
58
|
"reasoning-finish": {
|
|
59
|
-
"description": "Fired on reasoning-finish."
|
|
59
|
+
"description": "Fired on reasoning-finish.",
|
|
60
|
+
"detail": {
|
|
61
|
+
"status": {
|
|
62
|
+
"description": "Whether reasoning was resolved.",
|
|
63
|
+
"type": "boolean"
|
|
64
|
+
},
|
|
65
|
+
"summary": {
|
|
66
|
+
"description": "Summary label text rendered after finish.",
|
|
67
|
+
"type": "string"
|
|
68
|
+
}
|
|
69
|
+
}
|
|
60
70
|
},
|
|
61
71
|
"reasoning-step-toggle": {
|
|
62
|
-
"description": "Fired on reasoning-step-toggle."
|
|
72
|
+
"description": "Fired on reasoning-step-toggle.",
|
|
73
|
+
"detail": {
|
|
74
|
+
"stepId": {
|
|
75
|
+
"description": "ID of the toggled reasoning step (matches data-step-id).",
|
|
76
|
+
"type": "string"
|
|
77
|
+
}
|
|
78
|
+
}
|
|
63
79
|
},
|
|
64
80
|
"reasoning-toggle": {
|
|
65
|
-
"description": "Fired on reasoning-toggle."
|
|
81
|
+
"description": "Fired on reasoning-toggle.",
|
|
82
|
+
"detail": {
|
|
83
|
+
"collapsed": {
|
|
84
|
+
"description": "Whether the reasoning section is now collapsed.",
|
|
85
|
+
"type": "boolean"
|
|
86
|
+
}
|
|
87
|
+
}
|
|
66
88
|
}
|
|
67
89
|
},
|
|
68
90
|
"examples": [
|
|
@@ -12,9 +12,26 @@
|
|
|
12
12
|
|
|
13
13
|
import { UIElement } from '../../core/element.js';
|
|
14
14
|
|
|
15
|
-
export
|
|
16
|
-
|
|
17
|
-
|
|
15
|
+
export interface AgentReasoningReasoningFinishEventDetail {
|
|
16
|
+
/** Whether reasoning was resolved. */
|
|
17
|
+
status: boolean;
|
|
18
|
+
/** Summary label text rendered after finish. */
|
|
19
|
+
summary: string;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export type AgentReasoningReasoningFinishEvent = CustomEvent<AgentReasoningReasoningFinishEventDetail>;
|
|
23
|
+
export interface AgentReasoningReasoningStepToggleEventDetail {
|
|
24
|
+
/** ID of the toggled reasoning step (matches data-step-id). */
|
|
25
|
+
stepId: string;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export type AgentReasoningReasoningStepToggleEvent = CustomEvent<AgentReasoningReasoningStepToggleEventDetail>;
|
|
29
|
+
export interface AgentReasoningReasoningToggleEventDetail {
|
|
30
|
+
/** Whether the reasoning section is now collapsed. */
|
|
31
|
+
collapsed: boolean;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export type AgentReasoningReasoningToggleEvent = CustomEvent<AgentReasoningReasoningToggleEventDetail>;
|
|
18
35
|
|
|
19
36
|
export class UIAgentReasoning extends UIElement {
|
|
20
37
|
/** Start collapsed. */
|
|
@@ -35,10 +35,25 @@ props:
|
|
|
35
35
|
events:
|
|
36
36
|
reasoning-finish:
|
|
37
37
|
description: "Fired on reasoning-finish."
|
|
38
|
+
detail:
|
|
39
|
+
summary:
|
|
40
|
+
type: string
|
|
41
|
+
description: Summary label text rendered after finish.
|
|
42
|
+
status:
|
|
43
|
+
type: boolean
|
|
44
|
+
description: Whether reasoning was resolved.
|
|
38
45
|
reasoning-step-toggle:
|
|
39
46
|
description: "Fired on reasoning-step-toggle."
|
|
47
|
+
detail:
|
|
48
|
+
stepId:
|
|
49
|
+
type: string
|
|
50
|
+
description: ID of the toggled reasoning step (matches data-step-id).
|
|
40
51
|
reasoning-toggle:
|
|
41
52
|
description: "Fired on reasoning-toggle."
|
|
53
|
+
detail:
|
|
54
|
+
collapsed:
|
|
55
|
+
type: boolean
|
|
56
|
+
description: Whether the reasoning section is now collapsed.
|
|
42
57
|
slots:
|
|
43
58
|
default:
|
|
44
59
|
description: "Default slot — primary child content."
|
|
@@ -44,7 +44,21 @@
|
|
|
44
44
|
],
|
|
45
45
|
"events": {
|
|
46
46
|
"suggestion-select": {
|
|
47
|
-
"description": "Fired on suggestion-select."
|
|
47
|
+
"description": "Fired on suggestion-select.",
|
|
48
|
+
"detail": {
|
|
49
|
+
"index": {
|
|
50
|
+
"description": "Index of the selected suggestion.",
|
|
51
|
+
"type": "number"
|
|
52
|
+
},
|
|
53
|
+
"label": {
|
|
54
|
+
"description": "Suggestion label text.",
|
|
55
|
+
"type": "string"
|
|
56
|
+
},
|
|
57
|
+
"prompt": {
|
|
58
|
+
"description": "Suggestion prompt content.",
|
|
59
|
+
"type": "string"
|
|
60
|
+
}
|
|
61
|
+
}
|
|
48
62
|
}
|
|
49
63
|
},
|
|
50
64
|
"examples": [
|
|
@@ -12,7 +12,16 @@
|
|
|
12
12
|
|
|
13
13
|
import { UIElement } from '../../core/element.js';
|
|
14
14
|
|
|
15
|
-
export
|
|
15
|
+
export interface AgentSuggestionsSuggestionSelectEventDetail {
|
|
16
|
+
/** Index of the selected suggestion. */
|
|
17
|
+
index: number;
|
|
18
|
+
/** Suggestion label text. */
|
|
19
|
+
label: string;
|
|
20
|
+
/** Suggestion prompt content. */
|
|
21
|
+
prompt: string;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export type AgentSuggestionsSuggestionSelectEvent = CustomEvent<AgentSuggestionsSuggestionSelectEventDetail>;
|
|
16
25
|
|
|
17
26
|
export class UIAgentSuggestions extends UIElement {
|
|
18
27
|
/** Disable all chips. */
|
|
@@ -28,6 +28,16 @@ props:
|
|
|
28
28
|
events:
|
|
29
29
|
suggestion-select:
|
|
30
30
|
description: "Fired on suggestion-select."
|
|
31
|
+
detail:
|
|
32
|
+
label:
|
|
33
|
+
type: string
|
|
34
|
+
description: Suggestion label text.
|
|
35
|
+
prompt:
|
|
36
|
+
type: string
|
|
37
|
+
description: Suggestion prompt content.
|
|
38
|
+
index:
|
|
39
|
+
type: number
|
|
40
|
+
description: Index of the selected suggestion.
|
|
31
41
|
slots:
|
|
32
42
|
default:
|
|
33
43
|
description: "Default slot — primary child content."
|
|
@@ -37,7 +37,13 @@
|
|
|
37
37
|
"composes": [],
|
|
38
38
|
"events": {
|
|
39
39
|
"trace-toggle": {
|
|
40
|
-
"description": "Fired on trace-toggle."
|
|
40
|
+
"description": "Fired on trace-toggle.",
|
|
41
|
+
"detail": {
|
|
42
|
+
"collapsed": {
|
|
43
|
+
"description": "Whether the trace is now collapsed.",
|
|
44
|
+
"type": "boolean"
|
|
45
|
+
}
|
|
46
|
+
}
|
|
41
47
|
}
|
|
42
48
|
},
|
|
43
49
|
"examples": [
|