@aceshooting/lyra-ui 24.2.0 → 25.1.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 +38 -26
- package/README.md +21 -18
- package/custom-elements.json +1 -1
- package/design-tokens.json +1 -1
- package/dist/components/agent-tools/activity-feed/activity-feed.styles.js +1 -1
- package/dist/components/agent-tools/task-list/task-list.styles.js +1 -1
- package/dist/components/agent-tools/thinking-panel/thinking-panel.styles.js +1 -1
- package/dist/components/conversation/chat-viewport/chat-viewport.class.js +1 -1
- package/dist/components/conversation/code-block/code-block.styles.js +1 -1
- package/dist/components/conversation/code-block/shiki-dark-theme.js +1 -1
- package/dist/components/conversation/markdown/markdown.styles.js +1 -1
- package/dist/components/conversation/model-select/model-select.class.js +2 -1
- package/dist/components/conversation/model-select/model-select.styles.js +1 -1
- package/dist/components/conversation/selection-toolbar/selection-toolbar.styles.js +1 -1
- package/dist/components/conversation/voice-picker/voice-picker.class.js +2 -1
- package/dist/components/conversation/voice-picker/voice-picker.styles.js +1 -1
- package/dist/components/data/data-grid/data-grid.class.d.ts +7 -1
- package/dist/components/data/data-grid/data-grid.class.js +1 -1
- package/dist/components/data/document-library/document-library.class.js +1 -1
- package/dist/components/data/table/table.styles.js +1 -1
- package/dist/components/forms/color-picker/color-picker.class.js +2 -1
- package/dist/components/forms/color-picker/color-picker.styles.js +1 -1
- package/dist/components/forms/combobox/combobox.class.d.ts +5 -2
- package/dist/components/forms/combobox/combobox.class.js +2 -1
- package/dist/components/forms/combobox/combobox.styles.js +1 -1
- package/dist/components/forms/date-picker/date-input.class.d.ts +3 -0
- package/dist/components/forms/date-picker/date-input.class.js +2 -1
- package/dist/components/forms/date-picker/date-input.styles.js +1 -1
- package/dist/components/forms/input/time-input.class.js +2 -1
- package/dist/components/forms/input/time-input.styles.js +1 -1
- package/dist/components/forms/locale-picker/locale-picker.class.d.ts +2 -1
- package/dist/components/forms/locale-picker/locale-picker.class.js +2 -1
- package/dist/components/forms/locale-picker/locale-picker.styles.js +1 -1
- package/dist/components/forms/otp-input/otp-input.class.js +1 -1
- package/dist/components/forms/select/select.class.js +2 -1
- package/dist/components/forms/select/select.styles.js +1 -1
- package/dist/components/forms/swatch-picker/swatch-picker.class.d.ts +6 -1
- package/dist/components/forms/swatch-picker/swatch-picker.class.js +1 -1
- package/dist/components/layout/app-rail/app-rail.styles.js +1 -1
- package/dist/components/layout/menu/menu.styles.js +1 -1
- package/dist/components/layout/menubar/menubar.styles.js +1 -1
- package/dist/components/layout/navigation-menu-item/navigation-menu-item.class.js +2 -2
- package/dist/components/layout/navigation-menu-item/navigation-menu-item.styles.js +1 -1
- package/dist/components/layout/scroller/scroller.styles.js +1 -1
- package/dist/components/layout/virtual-list/virtual-list.class.d.ts +5 -0
- package/dist/components/layout/virtual-list/virtual-list.class.js +1 -1
- package/dist/components/media/av-player/av-player.styles.js +1 -1
- package/dist/components/media/image-viewer/image-viewer.styles.js +1 -1
- package/dist/components/media/map/map.class.d.ts +5 -2
- package/dist/components/media/map/map.class.js +4 -3
- package/dist/components/media/map/map.styles.js +1 -1
- package/dist/components/overlays/dialog/dialog.class.d.ts +1 -1
- package/dist/components/overlays/dialog/dialog.class.js +2 -1
- package/dist/components/overlays/dialog/dialog.styles.js +1 -1
- package/dist/components/overlays/overlay/overlay.styles.d.ts +1 -1
- package/dist/components/overlays/overlay/overlay.styles.js +1 -1
- package/dist/components/overlays/overlay/popover-glass.styles.d.ts +1 -0
- package/dist/components/overlays/overlay/popover-glass.styles.js +1 -0
- package/dist/components/overlays/overlay/popover.class.js +1 -1
- package/dist/components/retrieval/knowledge-base/knowledge-base.class.js +1 -1
- package/dist/components/retrieval/source-list/source-list.styles.js +1 -1
- package/dist/components/utility/export-button/export-button.class.d.ts +1 -1
- package/dist/components/utility/export-button/export-button.class.js +2 -1
- package/dist/components/utility/export-button/export-button.styles.js +1 -1
- package/dist/components/utility/mention-popover/mention-popover.class.d.ts +1 -1
- package/dist/components/utility/mention-popover/mention-popover.class.js +2 -1
- package/dist/components/utility/mention-popover/mention-popover.styles.js +1 -1
- package/dist/components/utility/tour/tour.class.d.ts +6 -4
- package/dist/components/utility/tour/tour.class.js +1 -1
- package/dist/components/viewers/document-compare/document-compare.styles.js +1 -1
- package/dist/components/viewers/document-preview/document-preview.class.js +1 -1
- package/dist/framework-types.d.ts +1 -1
- package/dist/internal/glass-independent-root.styles.d.ts +2 -0
- package/dist/internal/glass-independent-root.styles.js +1 -0
- package/dist/internal/glass-scroll-layer.d.ts +1 -1
- package/dist/internal/glass-scroll-layer.js +1 -1
- package/dist/internal/glass-scroll-layer.styles.d.ts +2 -0
- package/dist/internal/glass-scroll-layer.styles.js +1 -0
- package/dist/internal/glass-surface.styles.d.ts +0 -2
- package/dist/internal/glass-surface.styles.js +1 -1
- package/dist/internal/native-modal-carrier.js +2 -2
- package/dist/internal/package-metadata.d.ts +1 -1
- package/dist/internal/package-metadata.js +1 -1
- package/dist/internal/sizes.styles.js +1 -1
- package/dist/internal/specialist-tokens.styles.js +1 -1
- package/dist/internal/theme-token-types.d.ts +16 -0
- package/dist/internal/tokens/palette.styles.js +1 -1
- package/dist/internal/tokens.styles.js +1 -1
- package/dist/looks/material.css +1 -1
- package/dist/styles/design-tokens.css +1 -1
- package/dist/styles/tokens-root.css +1 -1
- package/dist/surfaces/glass.css +1 -1
- package/dist/theme/gemstones.d.ts +7 -0
- package/dist/theme/gemstones.js +1 -1
- package/dist/theme/looks/material.d.ts +1 -1
- package/dist/theme/looks/material.js +1 -1
- package/dist/theme/startup-resolution.d.ts +1 -0
- package/dist/theme/startup-resolution.js +1 -0
- package/dist/theme/style-ownership.js +1 -1
- package/dist/theme/theme-bootstrap.js +1 -1
- package/dist/theme/theme.d.ts +6 -21
- package/dist/theme/theme.js +1 -1
- package/dist/theme.css +1 -1
- package/llms/components/lr-combobox.md +3 -2
- package/llms/components/lr-date-input.md +1 -1
- package/llms/components/lr-date-picker.md +6 -0
- package/llms/components/lr-dialog.md +3 -0
- package/llms/components/lr-export-button.md +2 -0
- package/llms/components/lr-icon.md +1 -1
- package/llms/components/lr-locale-picker.md +7 -1
- package/llms/components/lr-map.md +7 -0
- package/llms/components/lr-mention-popover.md +3 -0
- package/llms/components/lr-model-select.md +3 -0
- package/llms/components/lr-navigation-menu.md +3 -0
- package/llms/components/lr-otp-input.md +3 -1
- package/llms/components/lr-select.md +3 -0
- package/llms/components/lr-swatch-picker.md +17 -5
- package/llms/components/lr-tour.md +4 -2
- package/llms/components/lr-voice-picker.md +3 -0
- package/llms/shared/native-styles-and-utilities.md +40 -0
- package/llms/shared/styles-and-tokens.md +193 -93
- package/llms/shared.md +232 -93
- package/llms/tokens.md +82 -82
- package/package.json +1 -1
- package/vscode-css-data.json +1 -1
- package/web-types.json +1 -1
- package/dist/components/agent-tools/run-events.js +0 -1
- package/dist/components/agent-tools/tool-param-form/tool-param-types.js +0 -1
- package/dist/components/forms/emoji-picker/emoji-types.js +0 -1
- package/dist/components/layout/dashboard-grid/layout-types.js +0 -1
- package/dist/components/layout/details/accordion-types.js +0 -1
- package/dist/components/viewers/viewer-diagnostics.js +0 -1
- package/dist/internal/localization-types.js +0 -1
- package/dist/internal/node-type-style.js +0 -1
- package/dist/internal/picker-value.js +0 -1
- package/dist/internal/shared-unions.js +0 -1
- package/dist/internal/stream-phase.js +0 -1
|
@@ -261,3 +261,43 @@ and opacity tokens first. These additional hooks customize only the light-DOM bu
|
|
|
261
261
|
| `--lr-native-legend-padding` | `--lr-space-xs`; legend inline padding |
|
|
262
262
|
| `--lr-native-table-cell-padding` | `--lr-space-s`; caption and table-cell padding |
|
|
263
263
|
| `--lr-native-rule-space` | `--lr-space-l`; horizontal-rule block margin |
|
|
264
|
+
|
|
265
|
+
|
|
266
|
+
### Native navigation and floating chrome
|
|
267
|
+
|
|
268
|
+
The opt-in `.lr-surface-chrome` class uses the same protected Glass material as Lyra navigation,
|
|
269
|
+
menus and modal panels. It is shipped by `theme.css` for the built-in profile and by the separate
|
|
270
|
+
`surfaces/glass.css` asset for applications composing their own stylesheet set:
|
|
271
|
+
|
|
272
|
+
```css
|
|
273
|
+
@import "@aceshooting/lyra-ui/theme.css";
|
|
274
|
+
@import "@aceshooting/lyra-ui/tokens-root.css";
|
|
275
|
+
```
|
|
276
|
+
|
|
277
|
+
```html
|
|
278
|
+
<nav class="lr-surface-chrome" aria-label="Primary navigation">…</nav>
|
|
279
|
+
<section class="lr-surface-chrome" aria-labelledby="settings-title">
|
|
280
|
+
<h2 id="settings-title">Settings</h2>
|
|
281
|
+
<div class="settings-scrollport">…</div>
|
|
282
|
+
</section>
|
|
283
|
+
```
|
|
284
|
+
|
|
285
|
+
Localize the example's names. Keep the material wrapper non-scrolling and put overflow on an inner
|
|
286
|
+
scrollport. The decorative pseudo-element filters the backdrop without changing fixed descendant
|
|
287
|
+
coordinates. The wrapper reserves `::before` and supplies a low-specificity `position: relative`;
|
|
288
|
+
application fixed, sticky or absolute positioning still wins. Avoid an extra opaque wrapper inside
|
|
289
|
+
an already treated Lyra popup.
|
|
290
|
+
|
|
291
|
+
`--lr-surface-background` optionally supplies this native wrapper's base fill. It falls back to the
|
|
292
|
+
local high container surface, then the overlay surface, and resolves on the painted wrapper, so nearer
|
|
293
|
+
theme inputs work.
|
|
294
|
+
The existing `--lr-theme-surface-opacity`, `--lr-theme-surface-blur`,
|
|
295
|
+
`--lr-theme-surface-saturation` and `--lr-theme-surface-highlight` controls apply. Glass uses 70%
|
|
296
|
+
opacity by default, 12px blur with a 16px ceiling, and qualified text, edges and focus.
|
|
297
|
+
The public opacity input accepts 0–1; lower custom opacity may expose backdrops that need
|
|
298
|
+
stronger foreground contrast. Solid and accessibility preferences still force opaque fills.
|
|
299
|
+
Explicit `data-lr-surface="solid"`, unsupported backdrop filtering, reduced transparency, increased
|
|
300
|
+
contrast and forced colors retain opaque fills. Load `preferences.css` for explicit inherited
|
|
301
|
+
contrast/motion choices. Nested chrome suppresses repeated blur; independently presented top-layer
|
|
302
|
+
surfaces begin their own material root. Keep cards, data tables, charts, map layers and editing
|
|
303
|
+
fields outside the automatic chrome class.
|
|
@@ -75,43 +75,35 @@ hooks, layer 3, which do inherit through wrappers).
|
|
|
75
75
|
|
|
76
76
|
### Lyra signature starter
|
|
77
77
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
78
|
+
Lyra's built-in profile is Shadcn, Glass, Emerald, System mode and comfortable density. Plain
|
|
79
|
+
component imports receive these defaults and a host-level Solid opt-out; `theme.css` provides the
|
|
80
|
+
full look/accent/mode resolver and the same profile for document scopes, including native chrome.
|
|
81
|
+
Explicit saved choices remain independent and win over missing or invalid fields. Use the existing style API to opt into Solid, the Lyra look, another accent or
|
|
82
|
+
mode; `accent: null` explicitly clears the accent, while `resetLyraStyle()` restores Emerald.
|
|
81
83
|
|
|
82
84
|
```css
|
|
85
|
+
@layer lr-base, lr-theme, lr-theme-preset, lr-utilities, lr-overrides;
|
|
86
|
+
@layer lr-theme-preset.look, lr-theme-preset.density, lr-theme-preset.surface, lr-theme-preset.accent, lr-theme-preset.mode;
|
|
83
87
|
@import "@aceshooting/lyra-ui/theme.css";
|
|
84
88
|
@import "@aceshooting/lyra-ui/tokens-root.css";
|
|
85
|
-
@import "@aceshooting/lyra-ui/looks/shadcn.css";
|
|
86
|
-
@import "@aceshooting/lyra-ui/surfaces/glass.css";
|
|
87
|
-
@import "@aceshooting/lyra-ui/accents.css";
|
|
88
89
|
```
|
|
89
90
|
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
`
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
For first paint, run the synchronous `lyraThemeBootstrap`, then apply the application's unsaved-axis
|
|
107
|
-
fallback attributes, then load the blocking stylesheets. Use the documented CSP-safe embedding or
|
|
108
|
-
classic-script asset. With empty storage, the bootstrap writes Lyra's library defaults and would
|
|
109
|
-
overwrite earlier Shadcn/glass/Emerald attributes; it has no application-defaults option. With
|
|
110
|
-
denied storage, still apply the application fallbacks after it. Retain valid restored axes and
|
|
111
|
-
record which fallbacks were used, then apply those same choices through `setLyraStyle()` during
|
|
112
|
-
runtime initialization. A later module assignment alone cannot prevent a color flash. Test fresh,
|
|
113
|
-
malformed, partial, legacy, and storage-denied records before modules load and after hydration,
|
|
114
|
-
alongside valid saved choices. Do not copy Lyra's bootstrap, normalizer, or ownership internals.
|
|
91
|
+
Keep both layer-order statements before these imports. Bundlers can hoist statements from imported
|
|
92
|
+
stylesheets; the declarations preserve the order when imports are flattened. See
|
|
93
|
+
[Cascade layers](#cascade-layers). Separate Shadcn, Glass and Emerald imports remain compatible,
|
|
94
|
+
but are unnecessary for this profile. Import other optional looks, accents and densities when
|
|
95
|
+
exposing those choices.
|
|
96
|
+
|
|
97
|
+
For first paint, run the synchronous `lyraThemeBootstrap` before blocking stylesheets, using the
|
|
98
|
+
[CSP-safe embedding or classic-script asset](#style-runtime--aceshootinglyra-uithemejs). It restores
|
|
99
|
+
valid saved axes and fills missing or invalid choices with the built-in profile. Keep the
|
|
100
|
+
application's legacy-key precedence in an application adapter, and retain saved Solid, Lyra,
|
|
101
|
+
custom accents, runtime looks, overrides and historical records. Do not reconstruct a saved record
|
|
102
|
+
from the normalized `parseLyraStyleRecord()` snapshot: it is not a lossless persistence format.
|
|
103
|
+
`getLyraStyle()` reads the same choices at runtime; user changes use `setLyraStyle()`. An application
|
|
104
|
+
Reset can call `resetLyraStyle()` and restore any separate application preferences. Selectable
|
|
105
|
+
alternate looks and an explicitly cleared accent require `theme.css`; the intrinsic component
|
|
106
|
+
profile does not replace that scope resolver.
|
|
115
107
|
|
|
116
108
|
Keep spotlights in application CSS, independent of the chosen control look. The public root-token
|
|
117
109
|
stylesheet makes this static recipe follow both light/dark mode and the current accent:
|
|
@@ -134,6 +126,12 @@ html[data-lr-contrast='more'] body::before { background: var(--lr-color-surface)
|
|
|
134
126
|
@media (forced-colors: active) { body::before { background: Canvas; } }
|
|
135
127
|
```
|
|
136
128
|
|
|
129
|
+
Keep an existing application's multicolor spotlight palette when adopting a control look. For
|
|
130
|
+
example, an accent/violet/pink canvas should retain all three gradient colors across Lyra, Shadcn,
|
|
131
|
+
and Material; changing `look` must not replace those colors with the same-accent starter above.
|
|
132
|
+
Keep application background rules outside look selectors, while letting mode and accent update
|
|
133
|
+
their own inputs.
|
|
134
|
+
|
|
137
135
|
These are decorative application backgrounds, not an `accentBackground` value: that style field
|
|
138
136
|
accepts absolute colors used as contrast reference surfaces, not gradients or image URLs. Use
|
|
139
137
|
semantic surface/text pairings for content and keep the decorative layer behind it.
|
|
@@ -144,12 +142,27 @@ with its localized caption, nine canonical gemstones, and shared selected-glyph
|
|
|
144
142
|
`30rem`, hit size `1.5rem` and gap `.125rem` (28/4px and 24/2px at a 16px root). Leave its fill size
|
|
145
143
|
unset. Bound the palette to the viewport and provide horizontal overflow for unusually narrow
|
|
146
144
|
allocations or enlarged text; keyboard focus must bring every swatch into view. Do not shrink
|
|
147
|
-
below the component's 24px floor or replace its Arrow/Home/End and RTL behavior.
|
|
145
|
+
below the component's 24px floor or replace its Arrow/Home/End and RTL behavior. For an independent
|
|
146
|
+
Shine preference, set `--lr-gemstone-selected-animation: none` on the scope shared by the trigger
|
|
147
|
+
and picker; remove that declaration for Shine ON. OFF preserves the halo and selected accent.
|
|
148
|
+
Application and OS reduced motion still take precedence; persist Shine independently from motion.
|
|
149
|
+
See the composition guide for the controlled picker and preference wiring.
|
|
148
150
|
|
|
149
151
|
The four separate topbar controls—gemstone, mode, design, language—stay square `2.75rem` targets
|
|
150
152
|
(44px at a 16px root), with localized names and tooltips. Use gemstone, sun/moon and horizontal-slider
|
|
151
153
|
icons, and a country flag for language. Dense gemstone options do not reduce
|
|
152
|
-
those launcher targets.
|
|
154
|
+
those launcher targets. Size icon launchers directly and keep their slotted glyphs bounded:
|
|
155
|
+
|
|
156
|
+
```css
|
|
157
|
+
.appearance-launcher { --lr-icon-button-size: 2.75rem; }
|
|
158
|
+
.appearance-launcher::part(button) { inline-size: 2.75rem; block-size: 2.75rem; }
|
|
159
|
+
.appearance-launcher > svg,
|
|
160
|
+
.appearance-launcher > lr-icon { inline-size: 1.125rem; block-size: 1.125rem; }
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
Apply `appearance-launcher` to each `lr-icon-button`, including buttons slotted through a popover.
|
|
164
|
+
Keep the mode action separate from the design fields. Set the locale picker's
|
|
165
|
+
`--lr-locale-picker-trigger-height: 2.75rem` and
|
|
153
166
|
use its public flag-only trigger with readable menu entries:
|
|
154
167
|
|
|
155
168
|
```ts
|
|
@@ -170,6 +183,83 @@ never the only accessible names, and preserve a valid saved locale in the contro
|
|
|
170
183
|
Use the component's flag resolver rather than emoji, invented flag SVGs, or guessed display APIs.
|
|
171
184
|
Verify 320px and desktop, light/dark, RTL, enlarged text, keyboard focus, and saved preferences.
|
|
172
185
|
|
|
186
|
+
#### Two-column design panel
|
|
187
|
+
|
|
188
|
+
Compose a settings form inside `lr-popover`; use its dialog behavior rather than assigning menu or
|
|
189
|
+
ARIA grid roles to form fields. Import the existing native utility stylesheet and granular controls:
|
|
190
|
+
|
|
191
|
+
```css
|
|
192
|
+
@import "@aceshooting/lyra-ui/utilities.css";
|
|
193
|
+
|
|
194
|
+
.design-popover { --lr-overlay-max-inline-size: min(29rem, calc(100dvw - 1rem)); }
|
|
195
|
+
.design-popover::part(content) { padding: 0; }
|
|
196
|
+
.design-panel {
|
|
197
|
+
box-sizing: border-box;
|
|
198
|
+
inline-size: 29rem;
|
|
199
|
+
max-inline-size: calc(100dvw - 1rem);
|
|
200
|
+
padding: var(--lr-space-l);
|
|
201
|
+
max-block-size: min(75dvh, 40rem);
|
|
202
|
+
overflow: auto;
|
|
203
|
+
overflow-wrap: anywhere;
|
|
204
|
+
}
|
|
205
|
+
.design-fields { --lr-grid-min-inline-size: 12rem; }
|
|
206
|
+
.design-fields > * { min-inline-size: 0; max-inline-size: 100%; }
|
|
207
|
+
.design-reset { inline-size: 100%; margin-block-start: var(--lr-space-l); }
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
```ts
|
|
211
|
+
import '@aceshooting/lyra-ui/components/lr-popover.js';
|
|
212
|
+
import '@aceshooting/lyra-ui/components/lr-icon-button.js';
|
|
213
|
+
import '@aceshooting/lyra-ui/components/lr-select.js';
|
|
214
|
+
import '@aceshooting/lyra-ui/components/lr-option.js';
|
|
215
|
+
import '@aceshooting/lyra-ui/components/lr-button.js';
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
```html
|
|
219
|
+
<lr-popover class="design-popover" top-layer placement="bottom-end" aria-label="Design settings">
|
|
220
|
+
<lr-icon-button slot="trigger" class="appearance-launcher" label="Design settings">
|
|
221
|
+
<!-- Application's decorative horizontal-slider glyph -->
|
|
222
|
+
</lr-icon-button>
|
|
223
|
+
<section class="design-panel">
|
|
224
|
+
<div class="design-fields lr-grid-auto lr-gap-s">
|
|
225
|
+
<lr-select label="Look" value="shadcn">
|
|
226
|
+
<lr-option value="shadcn">Shadcn</lr-option>
|
|
227
|
+
<lr-option value="lyra">Lyra</lr-option>
|
|
228
|
+
<lr-option value="material">Material</lr-option>
|
|
229
|
+
</lr-select>
|
|
230
|
+
<lr-select label="Surface" value="glass">
|
|
231
|
+
<lr-option value="glass">Glass</lr-option>
|
|
232
|
+
<lr-option value="solid">Solid</lr-option>
|
|
233
|
+
</lr-select>
|
|
234
|
+
<lr-select label="Density" value="comfortable">
|
|
235
|
+
<lr-option value="compact">Compact</lr-option>
|
|
236
|
+
<lr-option value="comfortable">Comfortable</lr-option>
|
|
237
|
+
<lr-option value="touch">Touch</lr-option>
|
|
238
|
+
</lr-select>
|
|
239
|
+
<!-- Further independent settings in their reading order -->
|
|
240
|
+
</div>
|
|
241
|
+
<lr-button class="design-reset" type="button">Reset appearance</lr-button>
|
|
242
|
+
</section>
|
|
243
|
+
</lr-popover>
|
|
244
|
+
```
|
|
245
|
+
|
|
246
|
+
Localize the example's labels and options, bind values to the current application state, and handle
|
|
247
|
+
each select's `lr-change` through the relevant public style or preference API. Reset restores the
|
|
248
|
+
application profile and any separate application preferences.
|
|
249
|
+
|
|
250
|
+
`lr-grid-auto` already uses `auto-fit` with a `min(100%, minimum)` track floor. A bounded `29rem`
|
|
251
|
+
panel and `12rem` minimum give two columns when both fit, then one in narrow allocations; a third
|
|
252
|
+
column would need at least `36rem` before gaps. Keep those bounds together when customizing the
|
|
253
|
+
recipe. The existing `lr-gap-s` supplies the gap; no extra grid component or layout controller is
|
|
254
|
+
needed. The minimum is measured in rem, so enlarged text can also reduce the column count.
|
|
255
|
+
|
|
256
|
+
Keep every field in one row-major source list. Default grid placement and native Tab order then
|
|
257
|
+
agree: first row, second row, and so on; inherited RTL starts each row on the right. Do not split
|
|
258
|
+
fields into separate column wrappers, reorder with CSS, or add positive tabindex values. Leave the
|
|
259
|
+
full-width Reset action outside the field grid. Verify two columns at desktop allocation, one at
|
|
260
|
+
320px and enlarged text, long translated labels, RTL reading order, and Escape/focus return to the
|
|
261
|
+
design launcher. Keep these layout rules shared across application headers and administrative views.
|
|
262
|
+
|
|
173
263
|
### Reading the resolved tokens from your own components — `tokens-root.css`
|
|
174
264
|
|
|
175
265
|
The paragraph above is a real problem for any application that has custom elements of its own: they
|
|
@@ -725,7 +815,7 @@ resetLyraStyle(["look"]); // reset only the look axis
|
|
|
725
815
|
setLyraStyle({ mode: "unset", accent: null, accentBackground: null, overrides: null });
|
|
726
816
|
~~~
|
|
727
817
|
|
|
728
|
-
setLyraStyle() accepts independent choices for look, surface, density, mode, accent, accentBackground, and overrides. Omitted axes keep their current selection; null resets
|
|
818
|
+
setLyraStyle() accepts independent choices for look, surface, density, mode, accent, accentBackground, and overrides. Omitted axes keep their current selection. Null restores the built-in value for look, surface, density and mode; `accent: null` explicitly clears the accent, and null clears accentBackground or overrides. `resetLyraStyle()` restores Shadcn/Glass/Emerald/System/comfortable; a field list resets only those fields. The returned LyraStyle snapshot includes the selected values, a resolved mode when the choice is system, and lookForm to distinguish a stylesheet look from a runtime look.
|
|
729
819
|
|
|
730
820
|
mode is light, dark, system, or unset. Explicit modes set both data-lr-theme and data-theme; system follows the operating system and updates both attributes when it changes; unset removes Lyra's mode attributes. The lr-style-change event carries { style, changed }, where changed lists the affected fields. Applications can listen to this one event for document style changes.
|
|
731
821
|
|
|
@@ -799,10 +889,8 @@ The complete native CSS and utility contract is in the [native styles guide](./n
|
|
|
799
889
|
|
|
800
890
|
### Composing looks, surfaces and density
|
|
801
891
|
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
shadcn with glass and compact density is valid. Selecting another look replaces that scope's look;
|
|
805
|
-
it does not stack two competing look definitions.
|
|
892
|
+
`@aceshooting/lyra-ui/theme.js` exports the API. Each scope selects one look, surface, density,
|
|
893
|
+
mode and accent; the axes compose independently.
|
|
806
894
|
|
|
807
895
|
```js
|
|
808
896
|
import '@aceshooting/lyra-ui/theme.css';
|
|
@@ -814,60 +902,48 @@ import '@aceshooting/lyra-ui/accents.css';
|
|
|
814
902
|
import { setLyraStyle, resetLyraStyle, applyLyraStyleScope } from '@aceshooting/lyra-ui/theme.js';
|
|
815
903
|
|
|
816
904
|
setLyraStyle({ look: 'shadcn', mode: 'system', accent: 'sapphire' });
|
|
817
|
-
setLyraStyle({ surface: 'glass' }); // keeps
|
|
818
|
-
applyLyraStyleScope(tableRegion, { density: 'compact' }); //
|
|
905
|
+
setLyraStyle({ surface: 'glass' }); // keeps others
|
|
906
|
+
applyLyraStyleScope(tableRegion, { density: 'compact' }); // others inherit
|
|
819
907
|
applyLyraStyleScope(previewRegion, { look: 'material', mode: 'dark' });
|
|
820
|
-
resetLyraStyle(['look']); //
|
|
821
|
-
applyLyraStyleScope(tableRegion, null); // restores
|
|
908
|
+
resetLyraStyle(['look']); // resets look only
|
|
909
|
+
applyLyraStyleScope(tableRegion, null); // restores authored values
|
|
822
910
|
```
|
|
823
911
|
|
|
824
|
-
`setLyraStyle()`
|
|
825
|
-
`applyLyraStyleScope()` replaces
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
`
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
`
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
Exported look CSS comes from `lyraLookCss()` and requires `theme.css`, the selected optional sheets
|
|
861
|
-
and axis attributes. It is not an export of every axis or preference. Use the complete runtime
|
|
862
|
-
recipe for custom accent derivation, or the separate style/preference files to retain those choices.
|
|
863
|
-
Server-rendered attributes use `lyraStyleAttributes()` and `lyraPreferenceAttributes()`; system mode
|
|
864
|
-
is not falsely resolved on the server. Install the required CSS in each application-owned shadow
|
|
865
|
-
root that contains a local style boundary.
|
|
866
|
-
|
|
867
|
-
Diagnostics describe measured specimen colors and states, not universal accessibility
|
|
868
|
-
certification. Unknown/dynamic backgrounds remain unmeasured. Chart series keep text and non-color
|
|
869
|
-
cues; color-vision simulation does not replace them. Font availability, physical blur and native
|
|
870
|
-
platform accessibility settings still require evidence on the relevant platform.
|
|
912
|
+
`setLyraStyle()` persists supplied fields and retains omitted ones; null resets profile axes, while
|
|
913
|
+
`accent: null` clears it. `applyLyraStyleScope()` replaces an element's selection (omitted fields
|
|
914
|
+
inherit), without persistence or global events; clearing preserves later author changes. `getLyraStyle()`
|
|
915
|
+
reports requested axes and resolved mode.
|
|
916
|
+
|
|
917
|
+
Set `data-lr-look`, `data-lr-surface`, `data-lr-density`, `data-lr-mode` and `data-lr-accent`
|
|
918
|
+
directly if needed. Stylesheet look ids need their sheet; arbitrary ids neither load nor register.
|
|
919
|
+
`defineLyraLook({ id, tokens })` defines a validated immutable runtime look;
|
|
920
|
+
`lyraLookCss()` from `theme/look-css.js` creates CSS without DOM access. In app-owned shadow roots
|
|
921
|
+
with local boundaries, install `theme.css` and selected sheets; selectors stop at roots, inheritance
|
|
922
|
+
crosses.
|
|
923
|
+
|
|
924
|
+
`@aceshooting/lyra-ui/design-tokens.json` exports `$extensions['com.aceshooting.lyra.looks']`
|
|
925
|
+
(schemaVersion 1, base `lyra`), definitions `lyra`, `material`, `shadcn`, `data`, `terminal`,
|
|
926
|
+
`high-contrast`, and `defaultStyle`: Shadcn/Glass/Emerald/System/comfortable. The original token tree remains
|
|
927
|
+
authoritative; empty `lyra` restores it. Runtime CSS/editor/preview project the default separately.
|
|
928
|
+
Portable `{ id, tokens }` works with `defineLyraLook()`; sparse/null branches stay sparse. Load its
|
|
929
|
+
resolver to apply a look.
|
|
930
|
+
|
|
931
|
+
The [theme builder](https://www.lyra-ui.com/docs/?path=/story/theming-theme-builder--editor) previews
|
|
932
|
+
modes and edits contrast/motion, fonts, shape, elevation and chart palettes. It is documentation only,
|
|
933
|
+
not an entry point or element; component imports do not load it.
|
|
934
|
+
|
|
935
|
+
Import/export uses `LyraLook`, `LyraThemeTokens`, version-2 saved-style records and separate
|
|
936
|
+
`LyraPreferences`. Preserve runtime look tokens; `getLyraStyle()` snapshots omit them. Imports are
|
|
937
|
+
atomic (256 KiB max), reject network-bearing/executable CSS and preserve the last preview on error.
|
|
938
|
+
Group reset removes its writes; resetting a token to its look value removes it from every group.
|
|
939
|
+
|
|
940
|
+
`lyraLookCss()` exports only look CSS (requires `theme.css`, selected sheets and axis attributes).
|
|
941
|
+
Use the runtime recipe for custom accent derivation or separate style/preference files. SSR helpers
|
|
942
|
+
`lyraStyleAttributes()` and `lyraPreferenceAttributes()` leave system mode unresolved. Install CSS
|
|
943
|
+
in every app-owned shadow root with a local boundary.
|
|
944
|
+
|
|
945
|
+
Diagnostics measure specimens, not certify accessibility; dynamic backgrounds are unmeasured. Keep
|
|
946
|
+
chart text/non-color cues. See [contrast guidance](#scoped-contrast-and-motion-preferences).
|
|
871
947
|
|
|
872
948
|
### Optional shape, typography and elevation presets
|
|
873
949
|
|
|
@@ -1034,18 +1110,42 @@ lyraStyleAttributes() provide DOM-free server-rendering helpers; render the retu
|
|
|
1034
1110
|
through the framework's normal HTML escaping.
|
|
1035
1111
|
|
|
1036
1112
|
Glass is a treatment for eligible navigation and floating chrome. It does not make content panels,
|
|
1037
|
-
|
|
1113
|
+
editing controls, charts or base map layers translucent. Dialog and drawer panels, menus and
|
|
1114
|
+
control-owned listboxes share the chrome treatment; their input interiors stay opaque. Unsupported blur, reduced transparency, increased contrast and
|
|
1038
1115
|
forced colors retain solid fills. Solid surfaces use `backdrop-filter: none`; forced colours paint
|
|
1039
1116
|
`Canvas`. Offer a solid choice wherever the application offers glass, since reduced-transparency
|
|
1040
1117
|
media-query support varies between browsers.
|
|
1041
1118
|
|
|
1042
|
-
Regular glass defaults to
|
|
1119
|
+
Regular glass defaults to 70% opacity with a 12px blur clamped to 16px.
|
|
1120
|
+
The public `--lr-theme-surface-opacity` input accepts 0 through 1. Lower opacity exposes more
|
|
1121
|
+
of the backdrop; the default foreground qualification covers 70%, while a custom lower setting
|
|
1122
|
+
cannot guarantee contrast against every backdrop. Solid and accessibility preferences retain
|
|
1123
|
+
opaque fills regardless of this input.
|
|
1043
1124
|
Quiet text, necessary control edges, focus indicators and transparent actions gain a local
|
|
1044
1125
|
contrast-qualified foreground; opaque accent fills retain their own on-colours. Supported chrome
|
|
1045
1126
|
includes app rails, navigation menus, menubars, menus and their context-menu composition, popovers,
|
|
1046
1127
|
selection toolbars, toast items and the owned playback-rate toolbar of `lr-av-player`. Nested glass
|
|
1047
|
-
chrome is opaque, preventing repeated blur.
|
|
1048
|
-
|
|
1128
|
+
chrome is opaque, preventing repeated blur. Independently promoted menus and modal panels start a
|
|
1129
|
+
new material root. Content cards and editing fields remain opaque.
|
|
1130
|
+
A design panel can offer a Glass opacity range from 0–100%, shown when the selected surface is
|
|
1131
|
+
Glass. Start and reset it at 70%; convert the displayed percentage to the public token's 0–1 range.
|
|
1132
|
+
Apply this CSS input independently of look overrides: `setLyraStyle()` does not accept surface
|
|
1133
|
+
inputs in its `overrides` allowlist. Persist the percentage in the application's own settings and
|
|
1134
|
+
apply it before first paint, including after restoring those settings. Reset the app setting to 70
|
|
1135
|
+
and reapply it. Native `.lr-surface-chrome` wrappers and eligible component chrome consume the
|
|
1136
|
+
same input:
|
|
1137
|
+
|
|
1138
|
+
```js
|
|
1139
|
+
function applyGlassOpacity(percent) {
|
|
1140
|
+
if (!Number.isFinite(percent)) return;
|
|
1141
|
+
const opacity = Math.min(100, Math.max(0, percent)) / 100;
|
|
1142
|
+
document.documentElement.style.setProperty('--lr-theme-surface-opacity', String(opacity));
|
|
1143
|
+
}
|
|
1144
|
+
|
|
1145
|
+
applyGlassOpacity(70); // Default and reset value; apply saved app settings before first paint.
|
|
1146
|
+
```
|
|
1147
|
+
|
|
1148
|
+
Scrolling rail, popup, modal-panel and selection-toolbar surfaces keep a stationary decorative blur layer;
|
|
1049
1149
|
the public surface continues to own scrolling, focus and author overflow hooks.
|
|
1050
1150
|
|
|
1051
1151
|
`lr-av-player` additionally offers `controls-surface="clear"`, restricted to its owned toolbar and
|