@aceshooting/lyra-ui 30.2.0 → 30.4.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/CHANGELOG.md +87 -0
- package/dist/ai/adapters/a2ui.d.ts +10 -4
- package/dist/ai/adapters/a2ui.js +1 -1
- package/dist/ai/adapters/ag-ui.d.ts +17 -4
- package/dist/ai/adapters/ag-ui.js +1 -1
- package/dist/ai/adapters/ai-sdk.js +1 -1
- package/dist/ai/runtime.js +1 -1
- package/dist/components/agent-tools/mcp-app/mcp-app-protocol.d.ts +15 -0
- package/dist/components/agent-tools/mcp-app/mcp-app-protocol.js +36 -0
- package/dist/components/agent-tools/mcp-app/mcp-app.class.d.ts +31 -4
- package/dist/components/agent-tools/mcp-app/mcp-app.class.js +4 -4
- package/dist/components/conversation/chat-viewport/chat-viewport.class.d.ts +2 -2
- package/dist/components/conversation/chat-viewport/chat-viewport.class.js +1 -1
- package/dist/components/conversation/message-actions/message-actions.class.d.ts +3 -3
- package/dist/components/conversation/message-parts/message-parts.class.d.ts +13 -4
- package/dist/components/conversation/message-parts/message-parts.class.js +12 -10
- package/dist/components/conversation/message-parts/message-parts.d.ts +1 -1
- package/dist/components/conversation/message-parts/message-parts.js +1 -1
- package/dist/components/conversation/voice-picker/voice-picker.class.d.ts +1 -1
- package/dist/components/data/flow-minimap/flow-minimap.class.d.ts +1 -1
- package/dist/components/forms/select/select.class.js +1 -1
- package/dist/components/layout/app-rail/app-rail.class.d.ts +1 -1
- package/dist/components/layout/app-rail/app-rail.class.js +1 -1
- package/dist/components/layout/multi-split/multi-split.class.d.ts +4 -1
- package/dist/components/layout/multi-split/multi-split.class.js +6 -3
- package/dist/components/layout/multi-split/multi-split.styles.js +1 -1
- package/dist/components/layout/navigation-menu/navigation-menu.class.js +1 -1
- package/dist/components/layout/page/page.class.d.ts +3 -1
- package/dist/components/layout/page/page.class.js +1 -1
- package/dist/components/layout/responsive-panel/responsive-panel.class.d.ts +6 -4
- package/dist/components/layout/responsive-panel/responsive-panel.class.js +1 -1
- package/dist/components/layout/scroller/scroller.class.d.ts +1 -1
- package/dist/components/layout/scroller/scroller.class.js +1 -1
- package/dist/components/layout/split-panel/split-panel.class.d.ts +1 -1
- package/dist/components/layout/split-panel/split-panel.class.js +1 -1
- package/dist/components/layout/stepper/stepper.class.d.ts +1 -1
- package/dist/components/layout/stepper/stepper.class.js +1 -1
- package/dist/components/layout/widget/widget.class.d.ts +1 -1
- package/dist/components/layout/widget/widget.class.js +1 -1
- package/dist/components/media/file-input/file-input.styles.js +1 -1
- package/dist/components/media/map/map-control-chrome.js +1 -0
- package/dist/components/media/map/map-control-options.d.ts +6 -2
- package/dist/components/media/map/map-control-options.js +1 -1
- package/dist/components/media/map/map-controls-lifecycle.js +1 -1
- package/dist/components/media/map/map-controls-readiness.js +1 -0
- package/dist/components/media/map/map.class.d.ts +39 -2
- package/dist/components/media/map/map.class.js +13 -7
- package/dist/components/media/map/map.styles.js +1 -1
- package/dist/components/overlays/dialog/dialog.class.d.ts +2 -2
- package/dist/components/overlays/dialog/dialog.class.js +1 -1
- package/dist/components/utility/copy-button/copy-button.class.d.ts +13 -15
- package/dist/components/utility/copy-button/copy-button.class.js +3 -3
- package/dist/components/utility/copy-button/copy-button.styles.js +1 -1
- package/dist/components/utility/tour/tour.class.d.ts +2 -2
- package/dist/components/utility/tour/tour.class.js +1 -1
- package/dist/events.d.ts +10 -1
- package/dist/framework-types.d.ts +1 -1
- package/dist/internal/localization-types.d.ts +1 -1
- package/dist/internal/localization.js +1 -1
- package/dist/internal/modal-host.styles.js +1 -0
- package/dist/internal/modal-surface-controller.js +1 -1
- package/dist/internal/overlay-stack.d.ts +1 -1
- package/dist/internal/overlay-stack.js +1 -1
- package/dist/internal/package-metadata.js +1 -1
- package/dist/internal/scoped-definitions.generated.js +1 -1
- package/dist/internal/style-property-lease.js +1 -1
- package/dist/lyra.d.ts +1 -1
- package/llms/components/lr-app-rail.md +4 -0
- package/llms/components/lr-badge.md +3 -0
- package/llms/components/lr-copy-button.md +15 -7
- package/llms/components/lr-file-input.md +5 -0
- package/llms/components/lr-map.md +80 -8
- package/llms/components/lr-mcp-app.md +94 -4
- package/llms/components/lr-message-parts.md +18 -0
- package/llms/components/lr-multi-split.md +4 -0
- package/llms/components/lr-page.md +5 -1
- package/llms/components/lr-responsive-panel.md +5 -1
- package/llms/components/lr-select.md +3 -2
- package/llms/components/lr-token-input.md +4 -3
- package/llms/components/lr-tooltip.md +4 -4
- package/llms/peers.md +1 -1
- package/llms/shared/ai-and-peers.md +88 -3
- package/llms/shared/events-and-types.md +25 -1
- package/llms/shared/localization-and-rtl.md +29 -0
- package/llms/shared/styles-and-tokens.md +75 -14
- package/llms/shared.md +217 -18
- package/locales.json +1 -1
- package/package.json +8 -4
- package/registrations.json +1 -1
- package/skills/compose-lyra-interfaces/SKILL.md +5 -3
- package/skills/compose-lyra-interfaces/references/composition-patterns.md +8 -1
- package/skills/lyra-ui/SKILL.md +17 -8
- package/skills/lyra-ui/lyra-gen.md +95 -0
|
@@ -313,6 +313,35 @@ Pluralized messages use one object-valued entry keyed by CLDR categories. A cata
|
|
|
313
313
|
singular and `<key>Plural` entries should fold them into `{ one: …, other: … }` under the singular
|
|
314
314
|
key's name; the plural key is not read.
|
|
315
315
|
|
|
316
|
+
### Generated views and embedded apps
|
|
317
|
+
|
|
318
|
+
`@aceshooting/lyra-gen` uses the same locale registry and inherited `lang`/`locale` as Lyra UI.
|
|
319
|
+
The seven `genView*` renderer messages ship in each locale's `conversation` slice, including
|
|
320
|
+
empty, invalid, loading, load-failure, field-value, unavailable-action and confirmation messages.
|
|
321
|
+
Import the full matching `@aceshooting/lyra-translations/<locale>.js` catalog, or the
|
|
322
|
+
`<locale>/conversation.js` slice plus the families and `shared.js` used by generated child controls.
|
|
323
|
+
The translations package matches the **Lyra UI** version; Gen is versioned independently.
|
|
324
|
+
|
|
325
|
+
```ts
|
|
326
|
+
import '@aceshooting/lyra-translations/fr/conversation.js';
|
|
327
|
+
import '@aceshooting/lyra-translations/fr/forms.js';
|
|
328
|
+
import '@aceshooting/lyra-translations/fr/shared.js';
|
|
329
|
+
import '@aceshooting/lyra-gen/gen-view.js';
|
|
330
|
+
```
|
|
331
|
+
|
|
332
|
+
The renderer keeps its own small English defaults and does not load the complete English catalog.
|
|
333
|
+
Its `.strings` overrides affect its own messages; registered locale messages also reach nested
|
|
334
|
+
controls. Changing the inherited locale or registering a catalog after mounting refreshes the
|
|
335
|
+
renderer. Caller labels and model-generated prose remain caller content: the host chooses their
|
|
336
|
+
language separately. Numeric/date formatting follows the host locale without changing stored
|
|
337
|
+
JSON numbers or ISO dates. Host-created chat stream messages still require the host's localized
|
|
338
|
+
`strings` configuration.
|
|
339
|
+
|
|
340
|
+
A loaded `lr-mcp-app` publishes changed locale/direction context without reloading its frame.
|
|
341
|
+
Official MCP Apps sessions retain context updates during initialization and deliver the latest
|
|
342
|
+
context when the app becomes ready. Resource content remains responsible for rendering its own
|
|
343
|
+
translations and direction; the iframe does not inherit the parent document's CSS or `dir`.
|
|
344
|
+
|
|
316
345
|
## RTL and direction
|
|
317
346
|
|
|
318
347
|
Direction is inherited from the platform `dir` cascade; locale/`lang` selection does not change it,
|
|
@@ -323,8 +323,9 @@ needs to sit inside a Lyra UI without looking foreign, and the file's header lis
|
|
|
323
323
|
| Typography | `--lr-font`, `--lr-font-mono`, the ten `--lr-font-size-*` steps, the four `--lr-font-weight-*` steps |
|
|
324
324
|
| State and motion | `--lr-focus-ring`, `--lr-focus-ring-color`, `--lr-focus-ring-width`, `--lr-focus-ring-offset`, `--lr-opacity-disabled`, `--lr-opacity-muted`, `--lr-duration-fast`, `--lr-duration-base`, `--lr-easing-standard`, `--lr-easing-emphasized`, `--lr-transition-fast`, `--lr-transition-base`, `--lr-transition-interactive` |
|
|
325
325
|
|
|
326
|
-
The grid is stable as a whole because its contrast
|
|
327
|
-
|
|
326
|
+
The grid is stable as a whole because its [contrast contract](#semantic-colour-contrast-contract)
|
|
327
|
+
covers matching `on`/`fill` tiers **and** the loud-fill accent text used on quiet fills and page
|
|
328
|
+
surfaces. Custom palettes must preserve both kinds of pairing.
|
|
328
329
|
|
|
329
330
|
**Visible but internal** (read them at your own risk; they may change in any release): `--lr-size-*`,
|
|
330
331
|
`--lr-layer-*`, `--lr-color-mix-*`, `--lr-hover-brightness`, `--lr-line-height-*`,
|
|
@@ -460,19 +461,32 @@ the semantic grid instead; it picks the right value per mode and supports theme
|
|
|
460
461
|
layer to build on. Its _shape_ is identical in light and dark; the generator resolves different
|
|
461
462
|
ramp steps into each mode's literal fallback, so a rule written against it is mode-independent.
|
|
462
463
|
|
|
463
|
-
- `fill` — a background
|
|
464
|
-
outline.
|
|
464
|
+
- `fill` — a background; `fill-loud` also supplies accent text and icons. `on` — text and icons
|
|
465
|
+
that sit **on** the matching `fill`. `border` — an outline.
|
|
465
466
|
- `emphasis` runs `quiet → normal → loud`. Louder means more prominent, not lighter or darker: in
|
|
466
467
|
light mode it descends the ramp and in dark mode it climbs it.
|
|
467
468
|
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
469
|
+
#### Semantic colour contrast contract
|
|
470
|
+
|
|
471
|
+
The built-in palettes and looks meet these minimum ratios
|
|
472
|
+
for every variant in both modes:
|
|
473
|
+
|
|
474
|
+
| Foreground or boundary | Background | Minimum contrast |
|
|
475
|
+
| --- | --- | --- |
|
|
476
|
+
| `on-quiet`, `on-normal`, `on-loud` | The matching `fill-quiet`, `fill-normal`, `fill-loud` | 4.5:1 |
|
|
477
|
+
| `fill-loud`, when used as accent text | The same variant's `fill-quiet` | 4.5:1 |
|
|
478
|
+
| `fill-loud`, when used as accent text | Page and raised surfaces | 4.5:1 |
|
|
479
|
+
| `border-normal`, `border-loud` | Page surface | 3:1 |
|
|
480
|
+
|
|
481
|
+
For example, a non-neutral `lr-badge` with `appearance="filled-outlined"` or `"filled"` uses
|
|
482
|
+
`fill-loud` text on `fill-quiet`; its `"outlined"` and `"plain"` appearances use that text on the
|
|
483
|
+
surrounding surface. A current `lr-app-rail-item` uses brand loud-fill text on the brand quiet
|
|
484
|
+
fill. The flat `--lr-color-brand` alias is the loud fill, so it inherits these accent-text
|
|
485
|
+
requirements. A matching `on-loud`/`fill-loud` pair alone does not qualify a custom palette.
|
|
486
|
+
|
|
487
|
+
`border-quiet` is deliberately exempt: it exists for decoration that is not load-bearing — a rule
|
|
488
|
+
between table rows, a hairline inside an already-bounded card — so never use it as a control's only
|
|
489
|
+
boundary. Other cross-tier pairings require their own contrast check.
|
|
476
490
|
|
|
477
491
|
**Every slot has its own `--lr-theme-*` override**, named after the slot, so one decision can be
|
|
478
492
|
rethemed without forking anything beneath it:
|
|
@@ -487,7 +501,44 @@ rethemed without forking anything beneath it:
|
|
|
487
501
|
|
|
488
502
|
The full runtime chain for one colour is your `--lr-theme-*` input, else the grid slot's generated
|
|
489
503
|
fallback. To move a whole tone, set its nine `--lr-theme-color-<variant>-*` inputs; the ramp remains
|
|
490
|
-
a design-tool input rather than a consumer override point.
|
|
504
|
+
a design-tool input rather than a consumer override point. Static CSS inputs are applied as
|
|
505
|
+
authored: Lyra does not repair their contrast. Qualify every affected pairing above in light and
|
|
506
|
+
dark mode, including inherited slots when overriding only part of a row. Also check the actual
|
|
507
|
+
surrounding surface and rendered hover/press states, especially with component foreground or
|
|
508
|
+
background overrides and translucent surfaces.
|
|
509
|
+
|
|
510
|
+
For a complete static brand row, this example meets the contract on the **Lyra look with a solid
|
|
511
|
+
surface**: its page/raised colours are `#ffffff`/`#f6f8fa` in light mode and
|
|
512
|
+
`#1a1a1a`/`#22272e` in dark mode. Put the inputs on an explicit scope such as
|
|
513
|
+
`<section class="app-brand" data-lr-look="lyra" data-lr-surface="solid" data-lr-accent="custom" data-lr-theme="light" data-lr-theme-scope>`;
|
|
514
|
+
change `data-lr-theme` to `dark` to select the second row. Import `theme.css` as usual.
|
|
515
|
+
|
|
516
|
+
```css
|
|
517
|
+
.app-brand[data-lr-theme='light'] {
|
|
518
|
+
--lr-theme-color-brand-fill-quiet: #eef2ff;
|
|
519
|
+
--lr-theme-color-brand-fill-normal: #c7d2fe;
|
|
520
|
+
--lr-theme-color-brand-fill-loud: #4338ca;
|
|
521
|
+
--lr-theme-color-brand-on-quiet: #312e81;
|
|
522
|
+
--lr-theme-color-brand-on-normal: #312e81;
|
|
523
|
+
--lr-theme-color-brand-on-loud: #ffffff;
|
|
524
|
+
--lr-theme-color-brand-border-quiet: #c7d2fe;
|
|
525
|
+
--lr-theme-color-brand-border-normal: #6366f1;
|
|
526
|
+
--lr-theme-color-brand-border-loud: #4338ca;
|
|
527
|
+
}
|
|
528
|
+
.app-brand[data-lr-theme='dark'] {
|
|
529
|
+
--lr-theme-color-brand-fill-quiet: #1e1b4b;
|
|
530
|
+
--lr-theme-color-brand-fill-normal: #3730a3;
|
|
531
|
+
--lr-theme-color-brand-fill-loud: #a5b4fc;
|
|
532
|
+
--lr-theme-color-brand-on-quiet: #e0e7ff;
|
|
533
|
+
--lr-theme-color-brand-on-normal: #ffffff;
|
|
534
|
+
--lr-theme-color-brand-on-loud: #1e1b4b;
|
|
535
|
+
--lr-theme-color-brand-border-quiet: #3730a3;
|
|
536
|
+
--lr-theme-color-brand-border-normal: #818cf8;
|
|
537
|
+
--lr-theme-color-brand-border-loud: #a5b4fc;
|
|
538
|
+
}
|
|
539
|
+
```
|
|
540
|
+
|
|
541
|
+
Recheck these values when changing the look, surfaces, interaction fills or component overrides.
|
|
491
542
|
|
|
492
543
|
The flat names are aliases into the grid, kept because they read well at the call site:
|
|
493
544
|
|
|
@@ -914,7 +965,17 @@ accentBackground is an absolute CSS color used as the accent ramps' reference su
|
|
|
914
965
|
|
|
915
966
|
A LyraLook is a named token definition. Define an application look with defineLyraLook({ id, tokens }), then pass it as the look choice. A look supplies --lr-theme-* inputs; overrides applies an independent map of those inputs to the document root. Both accept CSS strings or per-mode { light, dark } values. Overrides replace the previous map wholesale; compose them with object spread. Values are validated, trimmed, and deep-frozen. Invalid entries are ignored, and maps are limited to 512 entries.
|
|
916
967
|
|
|
917
|
-
The token grammar rejects CSS-wide keywords, control characters, unsafe punctuation, unbalanced
|
|
968
|
+
The token grammar rejects CSS-wide keywords, control characters, unsafe punctuation, unbalanced
|
|
969
|
+
functions or quotes, and functions outside the documented color and layout set. For resolvable
|
|
970
|
+
colors and references, runtime token maps floor body/quiet text against page and raised surfaces;
|
|
971
|
+
synthesize or correct semantic on-colors when the corresponding fill is supplied; and qualify
|
|
972
|
+
strong-overlay text, boundaries, focus, chart series and terminal colors. This does not repair the
|
|
973
|
+
loud-fill accent-text cross-pairings in the [semantic contrast contract](#semantic-colour-contrast-contract):
|
|
974
|
+
explicit look/override maps and static CSS must supply compatible values. Runtime `accent`
|
|
975
|
+
derivation qualifies those cross-pairings when it generates the ramp; CSS or component overrides
|
|
976
|
+
of the resulting foreground/background still need checking. The snapshot and stored record retain
|
|
977
|
+
the normalized requested values. Inline style ownership records only properties Lyra wrote and
|
|
978
|
+
restores an earlier author value when a choice is cleared.
|
|
918
979
|
|
|
919
980
|
**Saved styles and the no-flash bootstrap.** getLyraStyle() re-reads storage on each call, so a value written by another tab is visible. If storage is unavailable, the runtime reports its last applied style and continues applying changes without persistence. lyraThemeBootstrap is a self-contained IIFE string for a script in head before stylesheets; it restores the saved style before first paint. createLyraThemeBootstrap({ storageKey }) produces the same string for an application-owned key. Both runtime and bootstrap safely read v1 records using mode: "auto", surface, and tokens, translating them to the current style axes. Keep this reader when migrating old saved preferences; new writes use the current style record.
|
|
920
981
|
|
package/llms/shared.md
CHANGED
|
@@ -1267,8 +1267,9 @@ needs to sit inside a Lyra UI without looking foreign, and the file's header lis
|
|
|
1267
1267
|
| Typography | `--lr-font`, `--lr-font-mono`, the ten `--lr-font-size-*` steps, the four `--lr-font-weight-*` steps |
|
|
1268
1268
|
| State and motion | `--lr-focus-ring`, `--lr-focus-ring-color`, `--lr-focus-ring-width`, `--lr-focus-ring-offset`, `--lr-opacity-disabled`, `--lr-opacity-muted`, `--lr-duration-fast`, `--lr-duration-base`, `--lr-easing-standard`, `--lr-easing-emphasized`, `--lr-transition-fast`, `--lr-transition-base`, `--lr-transition-interactive` |
|
|
1269
1269
|
|
|
1270
|
-
The grid is stable as a whole because its contrast
|
|
1271
|
-
|
|
1270
|
+
The grid is stable as a whole because its [contrast contract](#semantic-colour-contrast-contract)
|
|
1271
|
+
covers matching `on`/`fill` tiers **and** the loud-fill accent text used on quiet fills and page
|
|
1272
|
+
surfaces. Custom palettes must preserve both kinds of pairing.
|
|
1272
1273
|
|
|
1273
1274
|
**Visible but internal** (read them at your own risk; they may change in any release): `--lr-size-*`,
|
|
1274
1275
|
`--lr-layer-*`, `--lr-color-mix-*`, `--lr-hover-brightness`, `--lr-line-height-*`,
|
|
@@ -1404,19 +1405,32 @@ the semantic grid instead; it picks the right value per mode and supports theme
|
|
|
1404
1405
|
layer to build on. Its _shape_ is identical in light and dark; the generator resolves different
|
|
1405
1406
|
ramp steps into each mode's literal fallback, so a rule written against it is mode-independent.
|
|
1406
1407
|
|
|
1407
|
-
- `fill` — a background
|
|
1408
|
-
outline.
|
|
1408
|
+
- `fill` — a background; `fill-loud` also supplies accent text and icons. `on` — text and icons
|
|
1409
|
+
that sit **on** the matching `fill`. `border` — an outline.
|
|
1409
1410
|
- `emphasis` runs `quiet → normal → loud`. Louder means more prominent, not lighter or darker: in
|
|
1410
1411
|
light mode it descends the ramp and in dark mode it climbs it.
|
|
1411
1412
|
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1413
|
+
#### Semantic colour contrast contract
|
|
1414
|
+
|
|
1415
|
+
The built-in palettes and looks meet these minimum ratios
|
|
1416
|
+
for every variant in both modes:
|
|
1417
|
+
|
|
1418
|
+
| Foreground or boundary | Background | Minimum contrast |
|
|
1419
|
+
| --- | --- | --- |
|
|
1420
|
+
| `on-quiet`, `on-normal`, `on-loud` | The matching `fill-quiet`, `fill-normal`, `fill-loud` | 4.5:1 |
|
|
1421
|
+
| `fill-loud`, when used as accent text | The same variant's `fill-quiet` | 4.5:1 |
|
|
1422
|
+
| `fill-loud`, when used as accent text | Page and raised surfaces | 4.5:1 |
|
|
1423
|
+
| `border-normal`, `border-loud` | Page surface | 3:1 |
|
|
1424
|
+
|
|
1425
|
+
For example, a non-neutral `lr-badge` with `appearance="filled-outlined"` or `"filled"` uses
|
|
1426
|
+
`fill-loud` text on `fill-quiet`; its `"outlined"` and `"plain"` appearances use that text on the
|
|
1427
|
+
surrounding surface. A current `lr-app-rail-item` uses brand loud-fill text on the brand quiet
|
|
1428
|
+
fill. The flat `--lr-color-brand` alias is the loud fill, so it inherits these accent-text
|
|
1429
|
+
requirements. A matching `on-loud`/`fill-loud` pair alone does not qualify a custom palette.
|
|
1430
|
+
|
|
1431
|
+
`border-quiet` is deliberately exempt: it exists for decoration that is not load-bearing — a rule
|
|
1432
|
+
between table rows, a hairline inside an already-bounded card — so never use it as a control's only
|
|
1433
|
+
boundary. Other cross-tier pairings require their own contrast check.
|
|
1420
1434
|
|
|
1421
1435
|
**Every slot has its own `--lr-theme-*` override**, named after the slot, so one decision can be
|
|
1422
1436
|
rethemed without forking anything beneath it:
|
|
@@ -1431,7 +1445,44 @@ rethemed without forking anything beneath it:
|
|
|
1431
1445
|
|
|
1432
1446
|
The full runtime chain for one colour is your `--lr-theme-*` input, else the grid slot's generated
|
|
1433
1447
|
fallback. To move a whole tone, set its nine `--lr-theme-color-<variant>-*` inputs; the ramp remains
|
|
1434
|
-
a design-tool input rather than a consumer override point.
|
|
1448
|
+
a design-tool input rather than a consumer override point. Static CSS inputs are applied as
|
|
1449
|
+
authored: Lyra does not repair their contrast. Qualify every affected pairing above in light and
|
|
1450
|
+
dark mode, including inherited slots when overriding only part of a row. Also check the actual
|
|
1451
|
+
surrounding surface and rendered hover/press states, especially with component foreground or
|
|
1452
|
+
background overrides and translucent surfaces.
|
|
1453
|
+
|
|
1454
|
+
For a complete static brand row, this example meets the contract on the **Lyra look with a solid
|
|
1455
|
+
surface**: its page/raised colours are `#ffffff`/`#f6f8fa` in light mode and
|
|
1456
|
+
`#1a1a1a`/`#22272e` in dark mode. Put the inputs on an explicit scope such as
|
|
1457
|
+
`<section class="app-brand" data-lr-look="lyra" data-lr-surface="solid" data-lr-accent="custom" data-lr-theme="light" data-lr-theme-scope>`;
|
|
1458
|
+
change `data-lr-theme` to `dark` to select the second row. Import `theme.css` as usual.
|
|
1459
|
+
|
|
1460
|
+
```css
|
|
1461
|
+
.app-brand[data-lr-theme='light'] {
|
|
1462
|
+
--lr-theme-color-brand-fill-quiet: #eef2ff;
|
|
1463
|
+
--lr-theme-color-brand-fill-normal: #c7d2fe;
|
|
1464
|
+
--lr-theme-color-brand-fill-loud: #4338ca;
|
|
1465
|
+
--lr-theme-color-brand-on-quiet: #312e81;
|
|
1466
|
+
--lr-theme-color-brand-on-normal: #312e81;
|
|
1467
|
+
--lr-theme-color-brand-on-loud: #ffffff;
|
|
1468
|
+
--lr-theme-color-brand-border-quiet: #c7d2fe;
|
|
1469
|
+
--lr-theme-color-brand-border-normal: #6366f1;
|
|
1470
|
+
--lr-theme-color-brand-border-loud: #4338ca;
|
|
1471
|
+
}
|
|
1472
|
+
.app-brand[data-lr-theme='dark'] {
|
|
1473
|
+
--lr-theme-color-brand-fill-quiet: #1e1b4b;
|
|
1474
|
+
--lr-theme-color-brand-fill-normal: #3730a3;
|
|
1475
|
+
--lr-theme-color-brand-fill-loud: #a5b4fc;
|
|
1476
|
+
--lr-theme-color-brand-on-quiet: #e0e7ff;
|
|
1477
|
+
--lr-theme-color-brand-on-normal: #ffffff;
|
|
1478
|
+
--lr-theme-color-brand-on-loud: #1e1b4b;
|
|
1479
|
+
--lr-theme-color-brand-border-quiet: #3730a3;
|
|
1480
|
+
--lr-theme-color-brand-border-normal: #818cf8;
|
|
1481
|
+
--lr-theme-color-brand-border-loud: #a5b4fc;
|
|
1482
|
+
}
|
|
1483
|
+
```
|
|
1484
|
+
|
|
1485
|
+
Recheck these values when changing the look, surfaces, interaction fills or component overrides.
|
|
1435
1486
|
|
|
1436
1487
|
The flat names are aliases into the grid, kept because they read well at the call site:
|
|
1437
1488
|
|
|
@@ -1858,7 +1909,17 @@ accentBackground is an absolute CSS color used as the accent ramps' reference su
|
|
|
1858
1909
|
|
|
1859
1910
|
A LyraLook is a named token definition. Define an application look with defineLyraLook({ id, tokens }), then pass it as the look choice. A look supplies --lr-theme-* inputs; overrides applies an independent map of those inputs to the document root. Both accept CSS strings or per-mode { light, dark } values. Overrides replace the previous map wholesale; compose them with object spread. Values are validated, trimmed, and deep-frozen. Invalid entries are ignored, and maps are limited to 512 entries.
|
|
1860
1911
|
|
|
1861
|
-
The token grammar rejects CSS-wide keywords, control characters, unsafe punctuation, unbalanced
|
|
1912
|
+
The token grammar rejects CSS-wide keywords, control characters, unsafe punctuation, unbalanced
|
|
1913
|
+
functions or quotes, and functions outside the documented color and layout set. For resolvable
|
|
1914
|
+
colors and references, runtime token maps floor body/quiet text against page and raised surfaces;
|
|
1915
|
+
synthesize or correct semantic on-colors when the corresponding fill is supplied; and qualify
|
|
1916
|
+
strong-overlay text, boundaries, focus, chart series and terminal colors. This does not repair the
|
|
1917
|
+
loud-fill accent-text cross-pairings in the [semantic contrast contract](#semantic-colour-contrast-contract):
|
|
1918
|
+
explicit look/override maps and static CSS must supply compatible values. Runtime `accent`
|
|
1919
|
+
derivation qualifies those cross-pairings when it generates the ramp; CSS or component overrides
|
|
1920
|
+
of the resulting foreground/background still need checking. The snapshot and stored record retain
|
|
1921
|
+
the normalized requested values. Inline style ownership records only properties Lyra wrote and
|
|
1922
|
+
restores an earlier author value when a choice is cleared.
|
|
1862
1923
|
|
|
1863
1924
|
**Saved styles and the no-flash bootstrap.** getLyraStyle() re-reads storage on each call, so a value written by another tab is visible. If storage is unavailable, the runtime reports its last applied style and continues applying changes without persistence. lyraThemeBootstrap is a self-contained IIFE string for a script in head before stylesheets; it restores the saved style before first paint. createLyraThemeBootstrap({ storageKey }) produces the same string for an application-owned key. Both runtime and bootstrap safely read v1 records using mode: "auto", surface, and tokens, translating them to the current style axes. Keep this reader when migrating old saved preferences; new writes use the current style record.
|
|
1864
1925
|
|
|
@@ -2679,6 +2740,35 @@ Pluralized messages use one object-valued entry keyed by CLDR categories. A cata
|
|
|
2679
2740
|
singular and `<key>Plural` entries should fold them into `{ one: …, other: … }` under the singular
|
|
2680
2741
|
key's name; the plural key is not read.
|
|
2681
2742
|
|
|
2743
|
+
### Generated views and embedded apps
|
|
2744
|
+
|
|
2745
|
+
`@aceshooting/lyra-gen` uses the same locale registry and inherited `lang`/`locale` as Lyra UI.
|
|
2746
|
+
The seven `genView*` renderer messages ship in each locale's `conversation` slice, including
|
|
2747
|
+
empty, invalid, loading, load-failure, field-value, unavailable-action and confirmation messages.
|
|
2748
|
+
Import the full matching `@aceshooting/lyra-translations/<locale>.js` catalog, or the
|
|
2749
|
+
`<locale>/conversation.js` slice plus the families and `shared.js` used by generated child controls.
|
|
2750
|
+
The translations package matches the **Lyra UI** version; Gen is versioned independently.
|
|
2751
|
+
|
|
2752
|
+
```ts
|
|
2753
|
+
import '@aceshooting/lyra-translations/fr/conversation.js';
|
|
2754
|
+
import '@aceshooting/lyra-translations/fr/forms.js';
|
|
2755
|
+
import '@aceshooting/lyra-translations/fr/shared.js';
|
|
2756
|
+
import '@aceshooting/lyra-gen/gen-view.js';
|
|
2757
|
+
```
|
|
2758
|
+
|
|
2759
|
+
The renderer keeps its own small English defaults and does not load the complete English catalog.
|
|
2760
|
+
Its `.strings` overrides affect its own messages; registered locale messages also reach nested
|
|
2761
|
+
controls. Changing the inherited locale or registering a catalog after mounting refreshes the
|
|
2762
|
+
renderer. Caller labels and model-generated prose remain caller content: the host chooses their
|
|
2763
|
+
language separately. Numeric/date formatting follows the host locale without changing stored
|
|
2764
|
+
JSON numbers or ISO dates. Host-created chat stream messages still require the host's localized
|
|
2765
|
+
`strings` configuration.
|
|
2766
|
+
|
|
2767
|
+
A loaded `lr-mcp-app` publishes changed locale/direction context without reloading its frame.
|
|
2768
|
+
Official MCP Apps sessions retain context updates during initialization and deliver the latest
|
|
2769
|
+
context when the app becomes ready. Resource content remains responsible for rendering its own
|
|
2770
|
+
translations and direction; the iframe does not inherit the parent document's CSS or `dir`.
|
|
2771
|
+
|
|
2682
2772
|
## RTL and direction
|
|
2683
2773
|
|
|
2684
2774
|
Direction is inherited from the platform `dir` cascade; locale/`lang` selection does not change it,
|
|
@@ -2742,9 +2832,12 @@ import {
|
|
|
2742
2832
|
and strictly increasing `sequence`. A newer generation atomically retires the previous run, while
|
|
2743
2833
|
an older or replayed cursor is ignored. JSON Patch input is structurally validated and rejects
|
|
2744
2834
|
prototype-mutating paths.
|
|
2745
|
-
- **
|
|
2746
|
-
|
|
2747
|
-
|
|
2835
|
+
- **Structural adapters** — `adaptAiSdkMessage()` maps structural provider messages and
|
|
2836
|
+
`AgUiStreamAdapter` maps events onto the neutral runtime without pulling vendor SDKs into the
|
|
2837
|
+
package. Feed AG-UI events through `new AgUiStreamAdapter().push(event)`; the constructor accepts
|
|
2838
|
+
`(limits?: Partial<AgUiAdapterLimits>, options?: AgUiAdapterOptions)`.
|
|
2839
|
+
`adaptA2UiSurface()` is a limited A2UI-like graph helper, described below; it does not implement
|
|
2840
|
+
the native A2UI protocol or its surface lifecycle.
|
|
2748
2841
|
Adapter inputs are treated as untrusted data, recursively snapshotted, and rejected without
|
|
2749
2842
|
throwing when malformed, non-serializable, or over their configured budgets.
|
|
2750
2843
|
`adaptAiSdkMessage()` maps AI SDK tool states structurally: `output-error` → `error`,
|
|
@@ -2784,6 +2877,77 @@ import {
|
|
|
2784
2877
|
These structural, provider-agnostic types correspond to the component inputs above; map a vendor
|
|
2785
2878
|
payload onto them at the edge.
|
|
2786
2879
|
|
|
2880
|
+
### AG-UI reasoning, activity, and custom events
|
|
2881
|
+
|
|
2882
|
+
`AgUiLikeEvent` is the structural input shape; `push()` also accepts unknown input for guarded
|
|
2883
|
+
admission. Visible `REASONING_MESSAGE_*` events become reasoning parts. `ACTIVITY_SNAPSHOT`
|
|
2884
|
+
uses `messageId`, `activityType`, object `content`, and optional `replace`; `replace: false`
|
|
2885
|
+
keeps an existing message. `ACTIVITY_DELTA` uses `patch` against a prior snapshot with the same
|
|
2886
|
+
`messageId` and `activityType`. Activity content becomes a named data part and remains subject to
|
|
2887
|
+
the adapter's snapshot and buffered-content budgets.
|
|
2888
|
+
|
|
2889
|
+
`CUSTOM` requires `name` and `value` plus explicit host routing. Set
|
|
2890
|
+
`AgUiAdapterOptions.customEventTarget` to receive an `AgUiCustomEvent { name, value }` and return
|
|
2891
|
+
an `AgUiCustomEventTarget { messageId, partId }`, or `null` to ignore it. Repeated targets replace
|
|
2892
|
+
their data part. The callback owns those identities; the application registers named data renderers
|
|
2893
|
+
and controls which event names it accepts. An omitted callback ignores custom events. Named data values remain data,
|
|
2894
|
+
including values that resemble widgets or actions.
|
|
2895
|
+
|
|
2896
|
+
`AgUiAdapterLimits.maxBufferedMessages` bounds retained message identities, including activity
|
|
2897
|
+
patch baselines; its default is 512. `maxBufferedTools`, `maxToolArgumentBytes`,
|
|
2898
|
+
`maxTextDeltaCharacters`, and the inherited provider snapshot limits remain independently bounded.
|
|
2899
|
+
Run boundaries and `reset()` clear retained buffers. Compact chunks require upstream expansion;
|
|
2900
|
+
phase, encrypted, raw, step, subagent, deprecated thinking, and unknown events are ignored.
|
|
2901
|
+
See the [AG-UI adapter guide](https://github.com/aceshooting/lyra-ui/blob/main/docs/ag-ui-adapter.md)
|
|
2902
|
+
for event mappings, routing examples, error behavior, and the supported subset.
|
|
2903
|
+
|
|
2904
|
+
### Limited A2UI-like graph helper
|
|
2905
|
+
|
|
2906
|
+
`adaptA2UiSurface(surface, typeMap, limits?)` accepts one structural graph:
|
|
2907
|
+
`{ rootId, components: [{ id, type, props?, text?, children?: string[], action?: { id, payload? } }], data? }`.
|
|
2908
|
+
The host-owned `typeMap` maps those type names to allowlisted widget types. Unsupported native
|
|
2909
|
+
A2UI lifecycle messages are not accepted as graphs; the helper does not maintain surfaces,
|
|
2910
|
+
process native data-model updates, or provide native A2UI catalog compatibility.
|
|
2911
|
+
|
|
2912
|
+
The result is `A2UiAdapterResult | null`: a widget-compatible `{ version: '2', root }` plus
|
|
2913
|
+
`bindingState` when `surface.data` is present. Assign `bindingState` separately; the widget-v2
|
|
2914
|
+
document itself never supplies controlled state. Explicit `data: null` remains `bindingState: null`.
|
|
2915
|
+
The original `state` field remains an equal compatibility alias in the helper result; renderers
|
|
2916
|
+
do not read it. Input, props, action payloads and state are detached under the adapter budgets.
|
|
2917
|
+
|
|
2918
|
+
```ts
|
|
2919
|
+
import { adaptA2UiSurface } from "@aceshooting/lyra-ui/ai";
|
|
2920
|
+
import "@aceshooting/lyra-ui/components/lr-message-parts.js";
|
|
2921
|
+
import "@aceshooting/lyra-ui/components/lr-input.js";
|
|
2922
|
+
import { createWidgetTypeRegistry } from "@aceshooting/lyra-ui/components/lr-widget-renderer.js";
|
|
2923
|
+
|
|
2924
|
+
const registry = createWidgetTypeRegistry([["field", {
|
|
2925
|
+
tag: "lr-input", interaction: "control", props: { label: "string", value: "string" },
|
|
2926
|
+
bindings: { value: { event: "lr-input" } },
|
|
2927
|
+
}]]);
|
|
2928
|
+
const adapted = adaptA2UiSurface({
|
|
2929
|
+
rootId: "name-field",
|
|
2930
|
+
components: [{ id: "name-field", type: "Field", props: {
|
|
2931
|
+
label: "Name", value: { $bind: "/name" },
|
|
2932
|
+
} }],
|
|
2933
|
+
data: { name: "Ada" },
|
|
2934
|
+
}, { Field: "field" });
|
|
2935
|
+
const message = document.querySelector("lr-message-parts")!;
|
|
2936
|
+
if (adapted) {
|
|
2937
|
+
message.widgetRegistry = registry;
|
|
2938
|
+
message.widgetBindingState = adapted.bindingState;
|
|
2939
|
+
message.parts = [{ id: "name-form", type: "data", widget: adapted.root }];
|
|
2940
|
+
}
|
|
2941
|
+
message.addEventListener("lr-widget-state-change", (event) => {
|
|
2942
|
+
if (event.detail.path === "/name") message.widgetBindingState = { name: event.detail.value };
|
|
2943
|
+
});
|
|
2944
|
+
```
|
|
2945
|
+
|
|
2946
|
+
For host-specific content, keep using `renderPart(part, index)`: return `undefined` to delegate
|
|
2947
|
+
one part, or return a template to replace it and own its interaction. No extra part registry is
|
|
2948
|
+
required. Widget type registries control the existing widget renderer's allowed component types,
|
|
2949
|
+
separately from the message-part rendering hook.
|
|
2950
|
+
|
|
2787
2951
|
### Interrupting and resuming a streamed run
|
|
2788
2952
|
|
|
2789
2953
|
`stream-interrupt` and `stream-resume` are reducer events for the host-owned transport lifecycle;
|
|
@@ -2824,6 +2988,17 @@ state = reduceAgentStream(state, {
|
|
|
2824
2988
|
- **Build voice sessions:** `lr-realtime-session`; it composes the existing audio visualizer,
|
|
2825
2989
|
push-to-talk control, and transcript feed while leaving transport ownership with the host.
|
|
2826
2990
|
|
|
2991
|
+
For catalog-bound generated views, use the independently versioned `@aceshooting/lyra-gen`
|
|
2992
|
+
companion; its format differs from widget-v2. Read its
|
|
2993
|
+
[integration guide](https://github.com/aceshooting/lyra-ui/blob/main/packages/lyra-gen/README.md)
|
|
2994
|
+
and installed explicit `exports` map before importing runtime modules. The
|
|
2995
|
+
[compatibility guide](https://github.com/aceshooting/lyra-ui/blob/main/packages/lyra-gen/docs/compatibility.md)
|
|
2996
|
+
defines its 1.x contract and qualification limits; only the A2UI candidate entry is separately
|
|
2997
|
+
experimental. Its
|
|
2998
|
+
[guided demo](https://github.com/aceshooting/lyra-ui/blob/main/packages/lyra-gen/docs/guided-demo.md)
|
|
2999
|
+
is shipped application source with simulated data and scripted en/fr/ar replies, not an exported
|
|
3000
|
+
runtime entry or a model service. Core locale catalogs do not translate that example-owned copy.
|
|
3001
|
+
|
|
2827
3002
|
Family registration entry points are additive: importing
|
|
2828
3003
|
`@aceshooting/lyra-ui/components/conversation`, `/agent-tools`, or `/retrieval` registers and
|
|
2829
3004
|
exports that complete family. Granular component entry points remain the smallest bundles and are
|
|
@@ -4319,11 +4494,18 @@ These named interfaces and helper signatures are available to typed integrations
|
|
|
4319
4494
|
components: A2UiLikeComponent[];
|
|
4320
4495
|
data?: unknown;
|
|
4321
4496
|
}`
|
|
4322
|
-
`
|
|
4497
|
+
`A2UiAdapterResult {
|
|
4498
|
+
readonly version: '2';
|
|
4499
|
+
readonly root: LyraWidgetNode;
|
|
4500
|
+
readonly bindingState?: unknown;
|
|
4501
|
+
readonly state?: unknown;
|
|
4502
|
+
}`
|
|
4503
|
+
`adaptA2UiSurface(surface: unknown, typeMap: unknown, limits: Partial<A2UiAdapterLimits> = {}): A2UiAdapterResult | null`
|
|
4323
4504
|
|
|
4324
4505
|
- **`ai-adapters-ag-ui-contracts`** — AI adapter and runtime contracts.
|
|
4325
4506
|
`AgUiAdapterLimits {
|
|
4326
4507
|
maxBufferedTools: number;
|
|
4508
|
+
maxBufferedMessages: number;
|
|
4327
4509
|
maxToolArgumentBytes: number;
|
|
4328
4510
|
maxTextDeltaCharacters: number;
|
|
4329
4511
|
maxDepth: number;
|
|
@@ -4345,6 +4527,23 @@ These named interfaces and helper signatures are available to typed integrations
|
|
|
4345
4527
|
code?: string;
|
|
4346
4528
|
snapshot?: unknown;
|
|
4347
4529
|
messages?: unknown[];
|
|
4530
|
+
name?: string;
|
|
4531
|
+
value?: unknown;
|
|
4532
|
+
activityType?: string;
|
|
4533
|
+
content?: unknown;
|
|
4534
|
+
replace?: boolean;
|
|
4535
|
+
patch?: unknown[];
|
|
4536
|
+
}`
|
|
4537
|
+
`AgUiCustomEvent {
|
|
4538
|
+
name: string;
|
|
4539
|
+
value: unknown;
|
|
4540
|
+
}`
|
|
4541
|
+
`AgUiCustomEventTarget {
|
|
4542
|
+
messageId: string;
|
|
4543
|
+
partId: string;
|
|
4544
|
+
}`
|
|
4545
|
+
`AgUiAdapterOptions {
|
|
4546
|
+
customEventTarget?: (event: AgUiCustomEvent) => AgUiCustomEventTarget | null;
|
|
4348
4547
|
}`
|
|
4349
4548
|
|
|
4350
4549
|
- **`ai-adapters-ai-sdk-contracts`** — AI adapter and runtime contracts.
|