@aceshooting/lyra-ui 8.0.0 → 8.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.
Files changed (45) hide show
  1. package/CHANGELOG.md +188 -17
  2. package/custom-elements.json +1 -1
  3. package/dist/components/agent-tools/mcp-app/mcp-app.class.js +1 -1
  4. package/dist/components/agent-tools/terminal/terminal.class.js +2 -2
  5. package/dist/components/conversation/selection-toolbar/selection-toolbar.class.d.ts +5 -0
  6. package/dist/components/conversation/selection-toolbar/selection-toolbar.class.js +1 -1
  7. package/dist/components/conversation/widget-renderer/widget-renderer.class.js +1 -1
  8. package/dist/components/data/data-grid/data-grid.class.js +1 -1
  9. package/dist/components/data/flow-minimap/flow-minimap.class.js +1 -1
  10. package/dist/components/data/query-builder/query-builder.class.js +2 -2
  11. package/dist/components/data/table/table.class.js +2 -2
  12. package/dist/components/data/table/table.styles.js +8 -3
  13. package/dist/components/data/tree/tree-item.styles.js +11 -3
  14. package/dist/components/data/tree/tree.class.d.ts +11 -0
  15. package/dist/components/data/tree/tree.class.js +1 -1
  16. package/dist/components/forms/icon-button/icon-button.class.js +1 -1
  17. package/dist/components/forms/locale-picker/locale-picker.class.d.ts +3 -0
  18. package/dist/components/forms/locale-picker/locale-picker.class.js +4 -3
  19. package/dist/components/forms/locale-picker/locale-picker.styles.js +4 -0
  20. package/dist/components/forms/switch/switch.styles.js +9 -0
  21. package/dist/components/media/attachment-chip/attachment-chip.class.js +2 -2
  22. package/dist/components/media/avatar/avatar.class.js +2 -2
  23. package/dist/components/media/flag/flag.class.js +2 -2
  24. package/dist/components/retrieval/entity-card/entity-card.class.js +1 -1
  25. package/dist/components/retrieval/knowledge-graph-explorer/knowledge-graph-explorer.class.js +1 -1
  26. package/dist/components/utility/icon/icon.class.js +1 -1
  27. package/dist/components/viewers/archive-viewer/archive-viewer.class.js +1 -1
  28. package/dist/components/viewers/ebook-viewer/ebook-viewer.class.js +1 -1
  29. package/dist/components/viewers/notebook-viewer/notebook-viewer.class.js +3 -2
  30. package/dist/components/viewers/page-rail/page-rail.class.js +2 -0
  31. package/dist/components/viewers/spreadsheet-viewer/spreadsheet-viewer.class.js +1 -1
  32. package/dist/internal/anchor-target.js +1 -1
  33. package/dist/internal/package-metadata.d.ts +1 -1
  34. package/dist/internal/package-metadata.js +1 -1
  35. package/dist/internal/safe-svg.d.ts +13 -0
  36. package/dist/internal/safe-svg.js +1 -0
  37. package/dist/testing/happy-dom-shims.d.ts +4 -0
  38. package/dist/testing/happy-dom-shims.js +1 -1
  39. package/llms/components/lr-attachment-chip.md +18 -10
  40. package/llms/components/lr-locale-picker.md +6 -4
  41. package/llms/peers.md +3 -3
  42. package/llms-full.txt +23 -13
  43. package/package.json +8 -7
  44. package/vscode-html-data.json +7 -7
  45. package/web-types.json +8 -8
package/CHANGELOG.md CHANGED
@@ -1,5 +1,174 @@
1
1
  # Changelog
2
2
 
3
+ ## 8.1.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 968d39c: Fix `<lr-locale-picker>`'s trigger button never rendering a flag for the currently selected
8
+ locale — `showFlags` only ever affected the open listbox's rows, so a consumer relying on the
9
+ default `show-flags` still saw a text-only trigger (e.g. "English") with no flag until the
10
+ dropdown was opened. The trigger now renders the same `<lr-flag>` (new `trigger-flag` part,
11
+ honoring a `country` catalog override exactly like the row does) that the matching row shows.
12
+
13
+ ### Patch Changes
14
+
15
+ - b8028f8: Fix `DocumentAnchorTarget` (the shared mixin behind every viewer's `.scrollToAnchor()`) so a
16
+ throwing `applyAnchor()` reliably degrades to a resolved `false` and still emits
17
+ `lr-anchor-result:{found:false}`, instead of leaving the promise rejected and the documented
18
+ "always reports a definite result" contract broken. A previous attempt at this (a blanket
19
+ try/catch) was reverted because it made `lr-ebook-viewer`'s own override's localized
20
+ rendition-failure alert unreachable; `scrollToAnchor()` is now split into a thin public wrapper
21
+ carrying the safety net and a `performScrollToAnchor()` the mixin's own subclasses (currently only
22
+ `lr-ebook-viewer`) can call directly to bypass it and keep full control of their own catch.
23
+ - a260188: `lr-archive-viewer` no longer binds an untrusted ZIP entry name as a DOM `id` (`renderEntry()` set
24
+ `id=${entry.name}`, a classic DOM-clobbering primitive — a crafted archive entry named e.g.
25
+ `"body"` or `"documentElement"` could shadow a global DOM property lookup for code elsewhere in the
26
+ page). Fragment-anchor resolution (`scrollToAnchor()`'s `'fragment'` kind) now matches the target
27
+ row by its rendered `textContent` instead of by `id`, and no longer delegates to the shared
28
+ `TextViewerTarget` base's generic `id`-based fragment resolution for this component.
29
+ - 21ff77f: Harden three more components against untrusted values reaching a CSS sink unvalidated (same class
30
+ of fix as the earlier ANSI-color/`align`/`open-link` hardening):
31
+
32
+ - `lr-selection-toolbar` computed its floating position directly from a caller-supplied `rect`
33
+ (`DOMRectReadOnly | null`, but nothing enforces that shape at runtime) into a `styleMap()`-bound
34
+ custom property. A non-finite or non-numeric `left`/`top`/`width`/`bottom` could produce `NaNpx`
35
+ or, since `styleMap()`'s first commit serializes the whole `style` value as one string, break out
36
+ of the declaration. Both `coordinates()` and `updateToolbarPosition()` now coerce `rect` through a
37
+ shared `safeRect()` helper before use.
38
+ - `lr-data-grid`'s `columnStyle()` wrote a column's `width` into a `--column-authored-width` custom
39
+ property with no numeric guard, unlike the sibling `gridTemplate` getter's own `Number.isFinite`
40
+ check for the same field — inconsistent, and reachable by the same first-commit `styleMap()`
41
+ string-injection class of bug above.
42
+ - `lr-entity-card`'s data-driven type-badge color only rejected `;`/`{`/`}` structural characters,
43
+ not `url(...)`, unlike every other color sink in this library. Now routed through the shared
44
+ `sanitizeCssColor()` helper.
45
+
46
+ - 38d4511: Fix `<lr-flow-minimap>` not respecting a paired `<lr-flow-canvas>`'s `locked` state. Click-to-center,
47
+ wheel-zoom, viewport-rectangle drag, and the viewport rectangle's keyboard controls now check the
48
+ linked canvas's `locked` property before calling `setViewport()`/`zoomIn()`/`zoomOut()`/`fit()`,
49
+ mirroring the same guard `<lr-flow-canvas>` already applies to each of its own gesture handlers.
50
+ Previously the minimap relied entirely on the paired canvas separately gating those calls itself;
51
+ a locked canvas now stays locked even if a `FlowCanvasLike` companion does not also guard its own
52
+ methods. The `FlowCanvasLike` structural interface gained a read-only `locked` accessor to support
53
+ this.
54
+ - fbcf0ef: Fix `installHappyDomFormAssociatedShims()`'s stub `ElementInternals` missing a `states`
55
+ (`CustomStateSet`) property. Any form-associated component that calls
56
+ `this.internals.states.add()`/`.delete()`/`.has()` (added in 8.0's custom-state work, e.g.
57
+ `lr-input`'s `blank` state) threw on its very first update under the documented happy-dom test
58
+ setup.
59
+ - 867f68c: `lr-icon` and `lr-icon-button` clone slotted custom SVG content into a real SVG namespace so it
60
+ paints reliably (Chromium doesn't reliably paint slotted SVG geometry). That clone copied every
61
+ source attribute verbatim, including event handlers (`onload`, `onclick`, ...) and `href`/
62
+ `xlink:href`, with no sanitizer in the loop — unlike a fetched `src` document, which is already
63
+ sanitized through DOMPurify. Both clone paths now drop event-handler and `href`/`xlink:href`
64
+ attributes (a new shared `isUnsafeSvgCloneAttribute()` helper); every other presentational
65
+ attribute (`d`, `fill`, `stroke`, `viewBox`, `transform`, gradient stops, ...) is unaffected.
66
+ - 21e6f07: Fix `<lr-knowledge-graph-explorer>`'s `[part="search-empty"]` "no matches" message rendering as a
67
+ direct child of the `role="list"` `[part="search-results"]` container without `role="listitem"` --
68
+ invalid ARIA, since every child of a list role must itself be `listitem` (or one of a small allowed
69
+ set), unlike the real `[part="search-result"]` match rows which already carry it. It now carries
70
+ `role="listitem"` too.
71
+ - 2e0d525: Fix `custom-elements.json` under-reporting `cssParts` for components that extend another
72
+ component's class (e.g. `<lr-number-input>` extending `<lr-input>`, `<lr-dropdown>` extending
73
+ `<lr-popover>`). The manifest-compaction step pruned any inherited-and-resolvable entry — including
74
+ CSS parts — off a subclass's own declaration, on the assumption that a consumer would walk the JS
75
+ `extends` chain to see the full contract, the same way it does for members/attributes. Unlike those,
76
+ `::part()` has no such chain for its consumers (docs generators, editor tooling, `::part()` usage
77
+ checks), which read a tag's `cssParts` list directly, per tag — exactly how `cssStates` already
78
+ behaved. `<lr-number-input>` now declares `form-control`, `form-control-label`, `input-wrapper`, and
79
+ `input` (inherited from `<lr-input>`) in addition to its own parts, and `<lr-dropdown>` now declares
80
+ `trigger`, `popup`, `dialog`, `popup__popup`, `content`, `body`, `arrow`, and `popup__arrow`
81
+ (inherited from `<lr-popover>`). 15 other components with the same inheritance shape (the icon
82
+ charts, `<lr-native-time-input>`, `<lr-radio-button>`, `<lr-accordion-item>`, `<lr-dropdown-item>`,
83
+ `<lr-tag>`, `<lr-drawer>`) gained the same correction. Generated docs (`llms/components/*.md`) and
84
+ other manifest consumers were already unaffected, since they already read parts through
85
+ `expandManifestInheritance()`; only the checked-in compact manifest itself was missing them.
86
+ - 6313c1b: `lr-avatar`'s `image`, `lr-attachment-chip`'s `thumbnail-src` and file-object preview URL, and
87
+ `lr-flag`'s pre-resolved `src` are now validated through the shared `safeMediaSrc()` helper before
88
+ reaching an `<img src>` sink, rejecting `javascript:`/other unsafe schemes. Each falls back to its
89
+ existing placeholder state (initials, the generic file glyph, or an empty render) instead of
90
+ rendering an unsafe URL.
91
+ - ad5a464: Fix partial child-event stopping in three components whose nested `<lr-virtual-list>`/child
92
+ controls only had some of their bubbling events stopped at the host boundary:
93
+
94
+ - `<lr-notebook-viewer>` and `<lr-page-rail>` each already stopped the nested `<lr-virtual-list>`'s
95
+ `lr-visible-range-changed` event from leaking past the host, but left its `lr-scroll` event (and,
96
+ for `<lr-page-rail>`, its `lr-load-more` event too) undocumented and free to bubble straight
97
+ through. Both are now stopped the same way, mirroring the existing `lr-visible-range-changed`
98
+ handling.
99
+ - `<lr-query-builder>`'s add/remove condition buttons called `addCondition()`/`removeCondition()`
100
+ directly from their `@click` handlers, bypassing the `consumeChildEvent()` helper every other
101
+ handler in the component consistently uses to stop the raw composed child event before emitting
102
+ the component's own wrapper event. The two buttons now route through `consumeChildEvent()` like
103
+ the rest of the file.
104
+
105
+ `retrieval-results.class.ts` and `tool-select-dialog.class.ts` were also audited for the same
106
+ inconsistent-stopping pattern; both already stop every child event consistently, so neither needed
107
+ a change.
108
+
109
+ - d53cec6: `lr-spreadsheet-viewer` now validates that the optional `xlsx` peer's parsed `workbook.SheetNames`
110
+ is actually an array of strings before using it, instead of trusting an unchecked type assertion.
111
+ A malformed shape (a real risk here, since the workbook is parsed from consumer-supplied,
112
+ untrusted `src` content) now surfaces the standard localized load-failure state instead of silently
113
+ producing corrupted sheet tabs.
114
+ - d84fca9: Harden three components against untrusted values reaching CSS/URL sinks unvalidated:
115
+
116
+ - `lr-terminal` and `lr-notebook-viewer`'s shared ANSI-segment styling (`segmentStyle()`) wrote a
117
+ parsed stream's `fg`/`bg` color tokens directly into an inline `style` declaration; a
118
+ crafted ANSI color escape could inject CSS syntax. Both now validate through
119
+ `sanitizeCssColor()` before the value reaches `styleMap()`.
120
+ - `lr-widget-renderer`'s agent-authored widget tree wrote an arbitrary `align` prop string
121
+ directly into `align-items` with no allowlist. Now normalized through a bounded value map;
122
+ an unrecognized value renders as unset rather than reaching the declaration list.
123
+ - `lr-mcp-app`'s `open-link` message handler forwarded a `postMessage`-supplied `href` to
124
+ consumers verbatim as long as it was a string, with no scheme validation. Now validated through
125
+ `safeLinkHref()` (rejects `javascript:`/other unsafe schemes) before the `lr-mcp-open-link`
126
+ event fires.
127
+
128
+ - 0e6d53e: Fix `lr-switch`'s thumb miscentering when a consumer styles the `track` part with a `border`.
129
+ `box-sizing: border-box` (the library-wide default) let an added border eat into the padding box
130
+ the thumb is absolutely positioned against, while the thumb's own size/travel math stayed derived
131
+ from the track's declared (border-box) dimensions -- breaking symmetric clearance on the far edge
132
+ in both the unchecked and checked states. The track part now uses `box-sizing: content-box`, so an
133
+ added border grows the track's outer footprint instead of shrinking the space the thumb positions
134
+ within, keeping clearance symmetric regardless of border width.
135
+ - 7f37a42: `<lr-table>`'s `TableColumn.cellStyle` hook now sanitizes every property/value pair before it
136
+ reaches `styleMap()`: the property name must match a safe CSS-identifier shape, the value must
137
+ contain no `;`/`{`/`}` structural characters or a `url(...)` function, and the browser must accept
138
+ the property/value pair via `CSS.supports()` (falling back to a permissive regex where
139
+ `CSS.supports` is unavailable). A custom property (`--foo`) is exempted from the `CSS.supports`
140
+ check, since arbitrary custom-property values are always valid CSS.
141
+ - 7987719: Fix `lr-table` rows and `lr-tree-item` where hovering an already-selected row/item had no visible
142
+ effect. The `:hover` rule and the selected-state resting rule both resolved to the same
143
+ `--lr-color-brand-quiet` fallback at equal CSS specificity (and, for `lr-tree-item`, the
144
+ `:host([aria-selected='true'])`-scoped selected rule outranked a bare `[part='row']:hover`
145
+ outright), so the selected rule always won and hovering produced no change. Mirrors the fix already
146
+ applied to these same files' `:active`-while-selected rules: the hover rule now also matches through
147
+ the same specificity-matching selector arm (source order deciding the tie), and its resting fill is
148
+ a distinct `color-mix()` step (using `--lr-color-mix-hover`) instead of the plain `brand-quiet`
149
+ fallback, so hovering a selected row/item is visually distinguishable from its resting state.
150
+ - 4392216: Fix `<lr-tree>`'s `expandAll()` bypassing lazy-loading. It used to set `expanded = true` directly
151
+ on every node, skipping `<lr-tree-item>`'s own `expand()` -- the only code path that emits
152
+ `lr-lazy-load` and calls `beginLazyLoad()` for a `lazy` node whose children have not been fetched
153
+ yet. A tree containing lazy nodes would render them visually expanded but empty after
154
+ `expandAll()`, with their content never actually requested. `expandAll()` now calls each node's
155
+ `expand()` directly, so a lazy node triggers the same load request whether it was expanded by a
156
+ click or by `expandAll()`.
157
+
158
+ ## 8.0.1
159
+
160
+ ### Patch Changes
161
+
162
+ - Fix three bugs surfaced by the full Chromium/Firefox/WebKit browser-engine suite:
163
+
164
+ - `lr-page-rail`: a `thumbWidth` change scheduled its thumbnail-state invalidation from a
165
+ post-render hook, forcing an extra Lit update cycle instead of reflecting the new width in the
166
+ same pass.
167
+ - `lr-graph`: a pointer-capture call on canvas pointerdown was unguarded against browsers
168
+ rejecting capture for a synthetic (non-driver) pointer id, unlike its sibling release call.
169
+ - `lr-map`: a GeoJSON-view WebGL2 load-failure flag could stay set across a re-entrant load
170
+ triggered while the real availability check was still racing a test override.
171
+
3
172
  ## 8.0.0
4
173
 
5
174
  ### Major Changes
@@ -69,13 +238,13 @@
69
238
  surfaces register from these exact paths:
70
239
 
71
240
  ```js
72
- import '@aceshooting/lyra-ui/components/lr-page.js';
73
- import '@aceshooting/lyra-ui/components/lr-video.js';
74
- import '@aceshooting/lyra-ui/components/lr-video-playlist.js';
75
- import '@aceshooting/lyra-ui/components/lr-native-time-input.js';
76
- import '@aceshooting/lyra-ui/components/lr-pan-zoom.js';
77
- import '@aceshooting/lyra-ui/components/lr-split-panel.js';
78
- import '@aceshooting/lyra-ui/components/lr-alert.js';
241
+ import "@aceshooting/lyra-ui/components/lr-page.js";
242
+ import "@aceshooting/lyra-ui/components/lr-video.js";
243
+ import "@aceshooting/lyra-ui/components/lr-video-playlist.js";
244
+ import "@aceshooting/lyra-ui/components/lr-native-time-input.js";
245
+ import "@aceshooting/lyra-ui/components/lr-pan-zoom.js";
246
+ import "@aceshooting/lyra-ui/components/lr-split-panel.js";
247
+ import "@aceshooting/lyra-ui/components/lr-alert.js";
79
248
  ```
80
249
 
81
250
  The component-family references contain the exact surface and the 7.x migration notes for
@@ -150,16 +319,18 @@
150
319
 
151
320
  Every one of these is a find-and-replace. Where the default flips, the behaviour is the upstream one.
152
321
 
153
- | 7.x | 8.0.0 | Note |
154
- | --------------------------------- | ------------------- | ------------------------------------------------------------------------------------------- |
155
- | `no-light-dismiss` | `light-dismiss` | polarity un-inverted; default flips to off |
156
- | `hide-summary` | `with-summary` | polarity un-inverted; default flips to off |
157
- | `total-items` | `total` | |
158
- | `<lr-avatar src>` | `<lr-avatar image>` | |
159
- | `<lr-drawer>` default `placement` | `start` → `end` | matches the upstream default |
160
- | `<lr-tabs>` | `<lr-tab-group>` | plus `lr-tabs-change` → `lr-tab-show`/`lr-tab-hide`, and `--lr-tabs-*` → `--lr-tab-group-*` |
161
- | `<lr-tree-node>` | `<lr-tree-item>` | |
162
- | `<lr-slider>` `fill` part | `indicator` part | |
322
+ | 7.x | 8.0.0 | Note |
323
+ | -------------------------------------------------------------- | ----------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
324
+ | `no-light-dismiss` | `light-dismiss` | polarity un-inverted; default flips to off |
325
+ | `hide-summary` | `with-summary` | polarity un-inverted; default flips to off |
326
+ | `total-items` | `total` | |
327
+ | `<lr-avatar src>` | `<lr-avatar image>` | |
328
+ | `<lr-drawer>` default `placement` | `start` → `end` | matches the upstream default |
329
+ | `<lr-tabs>` | `<lr-tab-group>` | plus `lr-tabs-change` → `lr-tab-show`/`lr-tab-hide`, and `--lr-tabs-*` → `--lr-tab-group-*` |
330
+ | `<lr-tree-node>` | `<lr-tree-item>` | |
331
+ | `<lr-slider>` `fill` part | `indicator` part | |
332
+ | `<lr-callout variant="danger">` `[part="base"]` `role="alert"` | shared live-region sink | announcements now flow through the shared light-DOM live-region sink instead; `[part="base"]` carries `role="group"` (only when the host has an accessible label) or no role at all |
333
+ | `<lr-spinner>` `part="base"` | `part="base spinner"` | an exact-match `[part="base"]` attribute selector no longer matches; `::part(base)` is unaffected. Also gained `role="progressbar"` |
163
334
 
164
335
  The JavaScript-only string property `.autoCorrect` on `lr-input`, `lr-textarea`, and
165
336
  `lr-combobox` is now the upstream-compatible `.autocorrect` IDL, which always reads as boolean.