@aceshooting/lyra-ui 31.0.0 → 31.2.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 (131) hide show
  1. package/CHANGELOG.md +149 -0
  2. package/dist/autoloader-cdn.js +1 -1
  3. package/dist/components/agent-tools/budget-meter/budget-meter.class.d.ts +12 -1
  4. package/dist/components/agent-tools/budget-meter/budget-meter.class.js +4 -4
  5. package/dist/components/charts/chart/lite-chart.class.js +1 -1
  6. package/dist/components/conversation/chat-composer/chat-composer.class.d.ts +18 -8
  7. package/dist/components/conversation/chat-composer/chat-composer.class.js +11 -9
  8. package/dist/components/conversation/chat-composer/chat-composer.styles.js +1 -1
  9. package/dist/components/conversation/message-feedback/message-feedback.class.d.ts +11 -3
  10. package/dist/components/conversation/message-feedback/message-feedback.class.js +12 -6
  11. package/dist/components/conversation/message-feedback/message-feedback.styles.js +1 -1
  12. package/dist/components/conversation/prompt-input/prompt-input.class.d.ts +6 -3
  13. package/dist/components/conversation/prompt-input/prompt-input.class.js +3 -2
  14. package/dist/components/conversation/push-to-talk/push-to-talk.class.js +1 -1
  15. package/dist/components/conversation/thread-list/thread-list.class.d.ts +1 -1
  16. package/dist/components/conversation/thread-list/thread-list.class.js +2 -2
  17. package/dist/components/data/document-library/document-library-cursor.js +1 -0
  18. package/dist/components/data/document-library/document-library-types.d.ts +20 -0
  19. package/dist/components/data/document-library/document-library.class.d.ts +37 -26
  20. package/dist/components/data/document-library/document-library.class.js +20 -11
  21. package/dist/components/data/document-library/document-library.styles.js +1 -1
  22. package/dist/components/data/flow-canvas/flow-canvas.class.d.ts +1 -1
  23. package/dist/components/data/flow-canvas/flow-canvas.class.js +1 -1
  24. package/dist/components/data/timeline/timeline.class.js +1 -1
  25. package/dist/components/data/tree/tree-data-expansion.js +1 -0
  26. package/dist/components/data/tree/tree-item.class.d.ts +10 -4
  27. package/dist/components/data/tree/tree-item.class.js +5 -2
  28. package/dist/components/data/tree/tree-item.styles.js +1 -1
  29. package/dist/components/data/tree/tree-owner-controller.js +1 -1
  30. package/dist/components/data/tree/tree-pointer-reorder.js +1 -0
  31. package/dist/components/data/tree/tree-types.d.ts +5 -1
  32. package/dist/components/data/tree/tree.class.d.ts +27 -9
  33. package/dist/components/data/tree/tree.class.js +5 -3
  34. package/dist/components/data/tree/tree.styles.js +1 -1
  35. package/dist/components/forms/combobox/combobox.class.d.ts +20 -12
  36. package/dist/components/forms/combobox/combobox.class.js +2 -2
  37. package/dist/components/forms/select/select.class.js +1 -1
  38. package/dist/components/layout/dock-panel/dock-panel.class.d.ts +1 -1
  39. package/dist/components/layout/dock-panel/dock-panel.class.js +1 -1
  40. package/dist/components/layout/page/page.class.d.ts +3 -3
  41. package/dist/components/layout/page/page.class.js +1 -1
  42. package/dist/components/layout/segmented/segmented.class.d.ts +20 -7
  43. package/dist/components/layout/segmented/segmented.class.js +34 -24
  44. package/dist/components/layout/segmented/segmented.styles.js +1 -1
  45. package/dist/components/layout/stepper/stepper.styles.js +1 -1
  46. package/dist/components/layout/virtual-list/virtual-list.class.js +1 -1
  47. package/dist/components/media/map/map-anchor-controller.js +1 -1
  48. package/dist/components/media/map/map-canvas-target.js +1 -0
  49. package/dist/components/media/map/map.class.d.ts +10 -1
  50. package/dist/components/media/map/map.class.js +4 -4
  51. package/dist/components/media/map/map.styles.js +1 -1
  52. package/dist/components/media/sequence-playback/sequence-playback.class.d.ts +21 -9
  53. package/dist/components/media/sequence-playback/sequence-playback.class.js +7 -6
  54. package/dist/components/media/sequence-playback/sequence-playback.styles.js +1 -1
  55. package/dist/components/overlays/overlay/overlay.styles.js +1 -1
  56. package/dist/components/retrieval/graph/graph-spatial-controller.js +1 -1
  57. package/dist/components/retrieval/graph/graph.class.js +1 -1
  58. package/dist/components/retrieval/ingestion-queue/ingestion-queue-presentation.d.ts +11 -0
  59. package/dist/components/retrieval/ingestion-queue/ingestion-queue-presentation.js +1 -0
  60. package/dist/components/retrieval/ingestion-queue/ingestion-queue.class.d.ts +18 -7
  61. package/dist/components/retrieval/ingestion-queue/ingestion-queue.class.js +13 -26
  62. package/dist/components/retrieval/ingestion-queue/ingestion-queue.styles.js +1 -1
  63. package/dist/components/utility/diff-view/diff-view.class.d.ts +5 -5
  64. package/dist/components/utility/diff-view/diff-view.class.js +1 -1
  65. package/dist/components/utility/icon/icon.class.js +1 -1
  66. package/dist/components/viewers/archive-viewer/archive-viewer.class.js +1 -1
  67. package/dist/components/viewers/calendar-viewer/calendar-viewer.class.js +1 -1
  68. package/dist/components/viewers/contact-viewer/contact-viewer.class.js +1 -1
  69. package/dist/components/viewers/document-preview/document-preview.class.js +2 -2
  70. package/dist/components/viewers/docx-viewer/docx-viewer.class.d.ts +1 -1
  71. package/dist/components/viewers/docx-viewer/docx-viewer.class.js +1 -1
  72. package/dist/components/viewers/email-viewer/email-viewer.class.d.ts +1 -1
  73. package/dist/components/viewers/email-viewer/email-viewer.class.js +2 -2
  74. package/dist/components/viewers/html-viewer/html-viewer.class.js +1 -1
  75. package/dist/components/viewers/notebook-viewer/notebook-viewer.class.js +2 -2
  76. package/dist/components/viewers/pdf-viewer/pdf-viewer.class.d.ts +1 -1
  77. package/dist/components/viewers/pdf-viewer/pdf-viewer.class.js +1 -1
  78. package/dist/components/viewers/pptx-viewer/pptx-viewer.class.js +1 -1
  79. package/dist/components/viewers/svg-viewer/svg-viewer.class.js +1 -1
  80. package/dist/components/viewers/xml-viewer/xml-viewer.class.js +2 -2
  81. package/dist/data-sources.d.ts +10 -0
  82. package/dist/events.d.ts +18 -4
  83. package/dist/framework-types.d.ts +1 -1
  84. package/dist/internal/default-strings/conversation.generated.js +1 -1
  85. package/dist/internal/default-strings/data.generated.js +1 -1
  86. package/dist/internal/default-strings/retrieval.generated.js +1 -1
  87. package/dist/internal/localization-types.d.ts +1 -1
  88. package/dist/internal/localization.js +1 -1
  89. package/dist/internal/lyra-element.js +2 -2
  90. package/dist/internal/native-modal-context.js +1 -1
  91. package/dist/internal/overlay-manager.js +1 -1
  92. package/dist/internal/overlay-order.js +1 -1
  93. package/dist/internal/overlay-stack.js +1 -1
  94. package/dist/internal/package-metadata.js +1 -1
  95. package/dist/internal/runtime-diagnostics.js +1 -0
  96. package/dist/internal/sizes.styles.js +1 -1
  97. package/dist/internal/source-cursor-controller.js +1 -0
  98. package/dist/internal/source-cursor-projection.js +1 -0
  99. package/dist/internal/source-page-scope.js +1 -1
  100. package/dist/lyra.d.ts +1 -1
  101. package/dist/theme/theme-bootstrap.js +1 -1
  102. package/dist/theme/theme.js +1 -1
  103. package/dist/utilities/overlay-manager.d.ts +2 -0
  104. package/llms/components/lr-budget-meter.md +31 -0
  105. package/llms/components/lr-chat-composer.md +13 -2
  106. package/llms/components/lr-combobox.md +27 -1
  107. package/llms/components/lr-diff-view.md +6 -0
  108. package/llms/components/lr-document-library.md +90 -6
  109. package/llms/components/lr-graph.md +5 -0
  110. package/llms/components/lr-ingestion-queue.md +76 -8
  111. package/llms/components/lr-json-viewer.md +34 -0
  112. package/llms/components/lr-lite-chart.md +2 -1
  113. package/llms/components/lr-map.md +33 -0
  114. package/llms/components/lr-message-feedback.md +38 -3
  115. package/llms/components/lr-page.md +4 -2
  116. package/llms/components/lr-prompt-input.md +5 -2
  117. package/llms/components/lr-segmented.md +30 -10
  118. package/llms/components/lr-sequence-playback.md +47 -12
  119. package/llms/components/lr-tree-item.md +1 -1
  120. package/llms/components/lr-tree.md +59 -7
  121. package/llms/components/lr-virtual-list.md +3 -1
  122. package/llms/peers.md +2 -2
  123. package/llms/shared/ai-and-peers.md +10 -1
  124. package/llms/shared/events-and-types.md +61 -2
  125. package/llms/shared/forms-and-accessibility.md +25 -0
  126. package/llms/shared/imports-and-registration.md +154 -110
  127. package/llms/shared/testing-and-utilities.md +5 -1
  128. package/llms/shared.md +255 -114
  129. package/locales.json +1 -1
  130. package/package.json +9 -9
  131. package/registrations.json +1 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,154 @@
1
1
  # Changelog
2
2
 
3
+ ## 31.2.0
4
+
5
+ The quick Chromium comparison of the feature candidate with 31.1.1 flagged five of 150 timing metrics as slower. For 1,000 chart points, total p95 rose from 93.7 to 114.8 ms; for 5,000 ingestion items, paint median rose from 23.2 to 27.9 ms; for sorting 10,000 table rows, settle p95 rose from 8.0 to 9.3 ms. A fixed A-B-B-A follow-up used 15 samples per workload per run. No metric was flagged in both candidate-versus-baseline pairs, and repeated runs of the same version also produced flags. The affected component implementations and dependencies were unchanged; their shared code differed only in package metadata and an unused size constant. Together, these observations point to timing variation without demonstrating a sustained slowdown.
6
+
7
+ ### Minor Changes
8
+
9
+ - fe6ba7d: Set initial branch expansion with `LyraTreeNodeData.expanded`. The tree remembers expansion by stable ID across data updates and collapsed ancestor remounts. Use `lr-bulk-toggle` to read which branches changed, including branches currently out of view.
10
+ - fe6ba7d: Enable `pointer-reorderable` to request a move before or after a visible tree row. Listen for `lr-pointer-reorder` to apply the move. Use `allow-cross-parent-reorder` to permit cross-parent moves and `canDrop` to validate drop candidates.
11
+
12
+ The tree additions and shared size/keyboard fixes increase the measured full registration bundle to 1,506,118 gzip bytes and the data bundle to 445,961 bytes. Only the ten exceeded entry limits advance to their next 64-byte boundary. Passing limits, initial-route budgets, optional-peer exclusions and the existing headroom policy remain unchanged.
13
+ - fe6ba7d: Set `size` on data and declarative trees to choose a row density. Use `--lr-tree-row-height` and `--lr-tree-toggle-size` to size rows and controls independently while preserving minimum pointer targets.
14
+
15
+ ### Patch Changes
16
+
17
+ - Keep lazy tree loading and its accessible busy state in one render, including after reconnect.
18
+ - fe6ba7d: Include document editor translations in full locale imports and expose a `docx-editor` family for applications that load editor messages separately.
19
+ - fe6ba7d: Consume printable select typeahead keys so choosing an option in WebKit cannot also replace a retained text selection in an editor.
20
+ - Updated dependencies [fe6ba7d]
21
+ - @aceshooting/lyra-translations@31.2.0
22
+
23
+ ## 31.1.1
24
+
25
+ ### Patch Changes
26
+
27
+ Map canvas allocation, minimum-query suggestions and sequence playback presentation add runtime code, types and consumer guidance to the package. The page breakpoint, dock focus and tooltip fixes add 554–592 gzip bytes to five aggregate bundles. The affected bundle, packed core and unpacked delivery ceilings round their measurements up to the next 64-byte boundary.
28
+
29
+ - Update page navigation when a font-relative or viewport-relative breakpoint changes at a fixed page width. Content that only increases the page height no longer repeats breakpoint measurements.
30
+ - Keep focus on the dock panel when a rail icon expands it. Keep tooltips anchored as they open in narrow columns.
31
+ - Restore the shared `label-display` accessibility reference. Document the JSON viewer's 20rem intrinsic sizing introduced in 31.0.0, including constrained parent grid tracks for narrow panels.
32
+ - Make the network monitoring example's history keyboard reachable, with a localized accessible name and visible focus ring.
33
+ - Add sequence playback position formatting and an optional visible readout. Restart completed standalone non-looping playback from the first item, preserve listener-owned actions, and document which navigation methods pause playback.
34
+ - Add opt-in combobox `min-query-length` to keep short queries closed and out of asynchronous sources. Preserve typed text and selection while canceling obsolete searches; the default remains unrestricted.
35
+ - Add map `canvasTarget` for painting behind application chrome while controls, fitting and visible bounds use the host's usable area. Track layout changes, support axis-aligned transforms, and retire geometry work when the map or its document changes.
36
+ - 03eaaf1: Preserve valid accessible names for category labels when no glyph fits their measured chart lane. Retire the temporary role and name when a label becomes intentionally blank, and restore native text semantics when the lane widens.
37
+
38
+ The semantic repair increases five measured aggregate bundles by 41–44 gzip bytes. Only their exceeded ceilings advance to the next 64-byte boundary; individual-entry limits, passing ceilings, measurement inputs and optional-peer exclusions stay unchanged.
39
+
40
+ The generated-view chat composition measures 1,035,535 raw and 293,712 gzip bytes of lazy JavaScript. Only these exceeded lazy limits advance to the next 64-byte boundary, preserving eager-loading limits and external dependency inventories.
41
+ - @aceshooting/lyra-translations@31.1.1
42
+
43
+ ## 31.1.0
44
+
45
+ ### Minor Changes
46
+
47
+ - Add opt-in visible field labels and hints to `lr-segmented`, with shared form styling, label and hint slots, and accessible group naming. Label display remains hidden by default.
48
+ - 6dd5f5a: Add explicit custom ingestion-stage presentation and bounded replacement row actions. Hosts can gate built-in Retry/Cancel or request their own actions while stale and disabled controls remain inert.
49
+ - 6dd5f5a: Add optional single-reason selection and native UTF-16 comment limits to message feedback detail configuration. Oversized drafts remain intact and receive a localized error before submission.
50
+ - 32cbf4c: Add `toolbar-placement="actions"` to chat composer and prompt input. With `actions-layout="below"`, caller toolbar controls sit between start and end below the textarea while attachments remain above it. The default upper toolbar stays unchanged. Live placement changes preserve the editor, draft, selection and focused controls; narrow and RTL layouts keep the toolbar bounded and retain native Tab order. Prompt input's independent model, voice and source controls keep their existing position.
51
+
52
+ The stable toolbar layout, viewer request lifecycle fixes, thread excerpt observation and contained stepper focus ring increase eight measured bundles. Reviewed gzip sizes are 303,920 bytes for the largest component, 1,489,754 for all components, 1,715,239 for the CDN autoloader, 1,715,085 for the local autoloader, 452,193 for the conversation barrel, 389,655 for the layout barrel, 463,509 for the viewers barrel and 1,736,802 for the SSR aggregate. Only these exceeded ceilings advance to the next 64-byte boundary; passing ceilings, measurement options and optional-peer exclusions are unchanged.
53
+ - 6dd5f5a: Add document-library cursor sources for collections without a known total. Provide bounded Previous, Next, Retry, and Start over navigation, immutable query details, and shared cursor-source types. Retire stale requests and rendered rows when queries or providers change, preserving the existing array and indexed-source routes when cursor mode is unset.
54
+ - 6dd5f5a: Add an optional budget meter quantity formatter with locale context, coherent visible and accessible text, and numeric fallback for invalid results.
55
+
56
+ ### Patch Changes
57
+
58
+ - Keep category labels within narrow chart lanes when even an ellipsis cannot fit, preserve their full accessible names, and restore Unicode text when space grows.
59
+
60
+ Final release artifacts include versioned changelogs and metadata alongside the thread-navigation focus and shared ingestion presentation fixes. Only exceeded delivery ceilings advance to the smallest reviewed boundaries; passing limits, measurement options, optional-peer exclusions, the UI download limit, file-count ceilings, scaffold reserves and the historical reduction policy remain unchanged.
61
+
62
+ - 6dd5f5a: Update thirteen measured bundle ceilings for bounded cursor navigation, ingestion actions, feedback detail policies, quantity formatting, and lifecycle recovery. Each ceiling rounds its reviewed gzip measurement to a 64-byte boundary; passing limits, optional-peer exclusions, and initial-route budgets remain unchanged.
63
+
64
+ The final ownership guard adds 65 unpacked bytes, and all.js measures 1,498,947 gzip bytes. Only its exceeded ceiling advances by 64 bytes to 1,499,008 bytes; all other reviewed limits stay unchanged.
65
+ - 32cbf4c: Report active DOCX and PPTX transport failures even when they use an AbortError, while keeping canceled requests silent. Resume pending transport after same-task DOM moves without restarting active document conversions or presentation renderers, and discard late responses from retired requests.
66
+ - cb780e1: Remove redundant environment and RGB channel checks from CDN autoloading and theme startup while preserving document-less imports, input validation, and color calculations.
67
+ - 6dd5f5a: Retire obsolete diff-view search and anchor scrolling when synchronous search listeners replace results, compared text changes, or the viewer disconnects. Clear virtual-list sticky scroll insets when no groups remain.
68
+ - 6dd5f5a: Prevent graph activation from proposing obsolete selections when an activation listener changes controlled selection or replaces the graph's data, presentation, or connection.
69
+ - 6dd5f5a: Suppress movement and settled-view notifications when a native camera or bounds read disconnects or replaces the map, preventing retired camera data from being published after ownership changes.
70
+ - 6dd5f5a: Recover to the built-in graph renderer when a companion fit or camera operation fails, and release failed companions even when their final position snapshot throws. Keep fallback controls usable and ignore callbacks from retired engines.
71
+ - 63e863b: Reuse a frozen empty presentation for ingestion rows without optional metadata, preserving descriptor validation, cancellation guards and row ownership. A 5,000-row diagnostic reduced returned presentation objects from 5,000 to one while retaining all 10,000 validity checks.
72
+
73
+ The initial seven-sample comparison against 31.0.0 observed ingestion update median/p95 increases of 26.6/29.6 to 33.8/48.7 ms and total p95 of 60.4 to 77.3 ms. Chart total p95 increased from 95.8 to 111.9 ms, no-op paint median/p95 from 21.2/25.9 to 24.9/32.7 ms, and no-op total from 22.3/27.0 to 26.0/33.9 ms. Chart production source was unchanged; the elapsed metrics include animation-frame waits.
74
+
75
+ The fixed-order, 21-sample before/after ingestion comparisons showed mixed timing results: update medians of 32.5 to 28.9 ms and 30.2 to 30.3 ms, with one comparison observing a 3.9 ms paint-wait increase. The refactor establishes reduced allocation, not a sustained wall-time improvement. The final matched 21-sample comparison against 31.0.0 did not flag ingestion or chart metrics. Its only material increase was evaluation-dataset selection update p95, from 2.1 to 3.3 ms, while median improved from 1.8 to 1.5 ms. This unchanged component's tail timing remains observational. All original samples are retained, and benchmark thresholds are unchanged.
76
+ - 3a0f6aa: Update eight measured bundle budget pairs for document-library API compatibility and flow-canvas and virtual-list fixes. Only exceeded ceilings advance to the next 64-byte boundary; passing limits, including all.js at its existing cap, optional-peer exclusions and initial-route budgets remain unchanged.
77
+
78
+ The same fixes add 437 unpacked bytes across eight existing package files. The actual archive is 22,736,831 bytes; npm dry-run metadata produces a 22,737,453-byte estimate. Only the exceeded unpacked estimate ceiling advances to 22,737,472 bytes, with 19 bytes of allowance.
79
+
80
+ The same source changes add 372 raw bytes to the complete packed core graph, bringing it to 5,734,530 bytes across the same 65 files. Its raw ceiling advances to 5,734,592 bytes, with 62 bytes of allowance. All optional packed bundle limits and gzip limits remain unchanged.
81
+ - 6dd5f5a: Update the UI unpacked ceiling and the translation and IDE byte ceilings for cursor navigation, ingestion actions, feedback policies, quantity formatting, localized labels and generated API data. The final ownership guard adds 65 unpacked UI bytes; each exceeded ceiling advances only to the next 64-byte boundary, preserving download limits, file-count reserves and the historical 25% reduction requirement.
82
+ - 6dd5f5a: Respect cancellation, stopping, or removal during push-to-talk state notifications: avoid requesting microphone permission for a retired request and suppress obsolete recording-start effects for a take already stopping or disconnected.
83
+ - 6d20578: Keep icon-library changes made during a mutator from being overwritten by its retired load. Show a localized error when an active icon request aborts unexpectedly, while keeping replaced and disconnected requests silent.
84
+
85
+ The corrected shared icon load path changes bundle compression. Measured media aggregate and popup/export-button marginal gzip sizes exceed their previous canaries by 4, 4, and 2 bytes; only those ceilings move to the next 64-byte boundary.
86
+ - 15a78de: Report active PDF and archive transport failures even when they use an AbortError, while keeping canceled requests silent. Resume pending transport after same-task DOM moves, preserve active PDF parsing tasks, and discard late responses from retired requests.
87
+
88
+ PDF transport ownership adds 82 gzip bytes to its standalone entry, while archive ownership reduces its entry by 13 bytes. The reviewed all-components, autoloader, viewer-family, PDF and SSR bundle ceilings advance only where exceeded, to the next 64-byte boundary. Together with the bootstrap simplifications, the package measures 22,639,805 unpacked bytes in the actual archive and 22,640,427 in the npm dry-run inventory across the same 3,290 files; its unpacked ceiling becomes 22,640,448 bytes. Download, file-count, companion and passing bundle limits remain unchanged.
89
+
90
+ The installed core bundle measures 5,693,092 raw bytes across 65 files, a 642-byte increase. Its raw ceiling advances to 5,693,120 bytes; gzip limits, optional-peer exclusions and the separate exact binary requirement remain unchanged.
91
+ - 3a0f6aa: Stop a virtual list's pending notification sequence when a range-change or load-more listener disconnects or moves it to a new document. A removed list no longer requests more data from the retired update, and normal demand resumes after reconnect.
92
+ - 7daef56: Warn once per document when multiple active UI runtimes are detected, including copies with the
93
+ same package version. Document application-owned whole-package resolution for components,
94
+ utilities and lazy chunks. The diagnostic identifies unsupported split-runtime use without
95
+ merging overlay ownership or interrupting component operation.
96
+
97
+ The shared document-runtime diagnostic increases a standalone button registration from 36,507
98
+ to 37,120 gzip bytes (+613 bytes). Reviewed bundle measurements advance only the 21 exceeded
99
+ entry, aggregate and component-maximum ceilings to their smallest 64-byte boundary, leaving
100
+ 0–63 bytes of allowance; the button canary has none. The eight passing measurement/ceiling
101
+ pairs, measurement options and optional-peer exclusions remain unchanged.
102
+
103
+ The runtime diagnostic, its overlay declaration and resolution/testing guides add 5,752 unpacked
104
+ package bytes. The actual archive measures 22,654,271 bytes and the npm dry-run estimate measures
105
+ 22,654,893 across 3,291 files. Only the exceeded unpacked ceiling advances to 22,654,912 bytes,
106
+ the next 64-byte boundary with 19 bytes of allowance. All other byte limits, file-count ceilings
107
+ and the historical reduction policy remain unchanged.
108
+
109
+ The shared document-runtime diagnostic increases the complete installed core graph by 2,022 raw
110
+ bytes to 5,699,985 bytes across 65 files. The immutable package comparison identifies only six
111
+ runtime module payload changes, with no dependency changes. Only the exceeded core raw ceiling
112
+ advances to 5,700,032 bytes, the next 64-byte boundary with 47 bytes of allowance. Gzip limits,
113
+ optional-peer exclusions and exact binary requirements remain unchanged.
114
+
115
+ With the runtime diagnostic and lifecycle fixes included, the optional MapLibre v6 map bundle
116
+ measures 2,528,040 raw bytes across 52 files, up 335 bytes from 2,527,705. The optional graph
117
+ bundle measures 463,780 raw bytes across 14 files, up 922 bytes from 462,858. These are complete
118
+ emitted bundle measurements. Only their exceeded raw ceilings advance to the next 64-byte
119
+ boundaries: 2,528,064 bytes with 24 bytes of allowance for map, and 463,808 bytes with 28 bytes
120
+ for graph. The MapLibre v5 bundle remains below its existing ceiling. Gzip limits and peer-graph
121
+ checks remain unchanged.
122
+
123
+ Cursor-backed documents, custom ingestion presentation and actions, feedback detail limits,
124
+ quantity formatting and lifecycle fixes increase the complete installed core graph by 34,173 raw
125
+ bytes to 5,734,158 bytes across 65 files. Only the exceeded raw ceiling advances to 5,734,208
126
+ bytes, the next 64-byte boundary with 50 bytes of allowance. Gzip limits, optional-peer
127
+ exclusions and exact binary requirements remain unchanged.
128
+ - 3a0f6aa: Preserve the current scene's selection when a flow node or edge activation listener replaces the scene. The original action now retires before applying selection to the replacement, while later actions continue normally.
129
+ - 32cbf4c: Report active document preview, notebook, and email transport failures with localized feedback even when named AbortError. Resume pending requests after same-task DOM moves, discard retired responses, and preserve email parsing already in progress.
130
+ - a7eeb1d: Preserve outside focus when pending virtual thread navigation finishes rendering its destination.
131
+
132
+ The temporary focus-ownership listener and lifecycle cleanup add 103–120 gzip bytes to the affected registration, autoloader, conversation and SSR aggregate bundles. Only the five exceeded ceilings and their exact reviewed measurements advance, using the next 64-byte boundary; passing limits and optional-peer exclusions remain unchanged.
133
+
134
+ The focus fix adds 649 emitted runtime bytes and 26 declaration bytes. The ordinary npm inventory also includes 622 more manifest bytes than the published archive. The unpacked package ceiling advances to the next 64-byte boundary above the larger measured inventory; the download limit and file-count allowance stay unchanged.
135
+ - 6dd5f5a: Keep time-scaled timeline positions in sync with timestamp changes when timeline items register after their parent has rendered.
136
+ - 86ab216: Resume pending contact, calendar, HTML, SVG, and XML document loads after a same-task DOM move while preserving already-loaded content. Report unexpected failures named AbortError with localized feedback, and keep requests cancelled by replacement or disconnect silent.
137
+
138
+ Request ownership and pending-load recovery add 149–194 gzip bytes to the five exceeded viewer-containing bundles. Their ceilings advance only to the next 64-byte boundary: all components 1,488,704 bytes, CDN autoloader 1,714,176 bytes, autoloader 1,713,984 bytes, viewers barrel 463,168 bytes, and SSR all components 1,735,744 bytes. The npm dry-run estimate measures 22,639,711 unpacked bytes across 3,290 files; only the exceeded unpacked ceiling advances to 22,639,744 bytes. Passing limits and measurement inputs remain unchanged.
139
+
140
+ The complete packed core graph measures 5,692,450 raw bytes across 65 files: 800 bytes from these viewer fixes and 26 bytes from the preceding icon ownership fix above the prior reviewed measurement. Its exceeded raw ceiling advances to 5,692,480 bytes, leaving 30 bytes of headroom. Gzip limits, optional-peer exclusions and binary requirements are unchanged.
141
+ - 32cbf4c: Keep horizontal stepper keyboard focus outlines inside the scrolling track, and remove empty thread-list excerpt template spacing while preserving nontext excerpt content and reconnect updates.
142
+ - 8deb78a: Update measured delivery budgets for viewer transport recovery, composer toolbar placement and its declarations, thread excerpt layout, and stepper focus containment. The actual UI archive measures 22,648,519 unpacked bytes and the npm dry-run estimate measures 22,649,141 across the same 3,290 files; only the exceeded unpacked ceiling advances to 22,649,152 bytes. The generated composer editor API data measures 1,741,853 packed and 10,755,183 unpacked IDE archive bytes across eight files, bounded at 1,741,888 and 10,755,200 bytes.
143
+
144
+ The complete installed core graph measures 5,697,963 raw bytes across 65 files, an increase of 4,871 bytes. Its exceeded raw ceiling advances to 5,697,984 bytes with 21 bytes of headroom. Passing byte limits, the UI download ceiling, file-count ceilings, measurement options, optional-peer exclusions, and exact binary requirements remain unchanged.
145
+
146
+ Review the generated-chat composition after shared component runtime and ownership fixes. Lazy JavaScript measures 1,033,397 bytes; its raw ceiling is 1,033,408 bytes, the next 64-byte boundary with 11 bytes of headroom. Its eager JavaScript, gzip, CSS and asset limits, external-import inventory and pinned measurement toolchain remain unchanged.
147
+ - Updated dependencies [a7eeb1d]
148
+ - Updated dependencies [9c67698]
149
+ - @aceshooting/lyra-map@1.5.2
150
+ - @aceshooting/lyra-translations@31.1.0
151
+
3
152
  ## 31.0.0
4
153
 
5
154
  ### Major Changes
@@ -1 +1 @@
1
- import{start}from"./autoloader.js";function loaderScript(){if(typeof document>"u")return;const moduleUrl=new URL(import.meta.url).href,scripts=[...document.scripts],exact=scripts.find(script=>{try{return new URL(script.src,document.baseURI).href===moduleUrl}catch{return!1}});if(exact)return exact;for(let index=scripts.length-1;index>=0;index-=1){const script=scripts[index];if(script.hasAttribute("data-lyra-autoloader"))return script}}function optionalPeers(script){const value=script?.dataset.lyraOptionalPeers?.trim();if(value)return value==="all"?"all":value.split(",").map(peer=>peer.trim()).filter(Boolean)}if(typeof document<"u"){const script=loaderScript();start(document,{optionalPeers:optionalPeers(script),events:script?.hasAttribute("data-lyra-autoload-events")===!0}).catch(error=>{console.error("[lr-autoloader] Unable to load a discovered component.",error)})}
1
+ import{start}from"./autoloader.js";function loaderScript(){const moduleUrl=new URL(import.meta.url).href,scripts=[...document.scripts],exact=scripts.find(script=>{try{return new URL(script.src,document.baseURI).href===moduleUrl}catch{return!1}});if(exact)return exact;for(let index=scripts.length-1;index>=0;index-=1){const script=scripts[index];if(script.hasAttribute("data-lyra-autoloader"))return script}}function optionalPeers(script){const value=script?.dataset.lyraOptionalPeers?.trim();if(value)return value==="all"?"all":value.split(",").map(peer=>peer.trim()).filter(Boolean)}if(typeof document<"u"){const script=loaderScript();start(document,{optionalPeers:optionalPeers(script),events:script?.hasAttribute("data-lyra-autoload-events")===!0}).catch(error=>{console.error("[lr-autoloader] Unable to load a discovered component.",error)})}
@@ -1,4 +1,8 @@
1
1
  import{type TemplateResult}from'lit';import{LyraElement}from'../../../internal/lyra-element.js';import{type LyraHeadingLevel}from'../../../internal/heading-level.js';
2
+ /** Locale supplied to a budget quantity display formatter.*/
3
+ export interface BudgetMeterFormatContext{readonly locale:string;}
4
+ /** Synchronous display hook; numeric meter semantics always use the original quantities.*/
5
+ export type BudgetMeterValueFormatter=(value:number,context:BudgetMeterFormatContext)=>string;
2
6
  /**
3
7
  * `<lr-budget-meter>` — a presentation-only view of a host-supplied quantity and limit. Its visual
4
8
  * fill clamps at the limit while the localized value text retains the actual quantities. It does
@@ -27,4 +31,11 @@ unit?:string;
27
31
  /** Level of the visible title: `'1'`-`'6'`, or `'none'` for no heading semantics.*/
28
32
  headingLevel:LyraHeadingLevel;
29
33
  /** Accessible group name and visible label.*/
30
- label?:string;private get safeUsed();private get safeLimit();private formatValue;private valueText;render():TemplateResult;}declare global{interface HTMLElementTagNameMap{'lr-budget-meter':LyraBudgetMeter;}}
34
+ label?:string;
35
+ /**
36
+ * Optional synchronous, side-effect-free quantity formatter. Receives each normalized quantity
37
+ * and the effective locale. Return nonblank plain text of at most 65,536 UTF-16 code units;
38
+ * invalid results or throws restore numeric formatting for both quantities. The localized
39
+ * value sentence and optional unit still apply. Mutating the meter invalidates the custom pair.
40
+ */
41
+ valueFormatter?:BudgetMeterValueFormatter;private formatGeneration;private formatting;private suppressFormatter;requestUpdate(...args:Parameters<LyraElement['requestUpdate']>):void;private get safeUsed();private get safeLimit();private valueProjection;render():TemplateResult;}declare global{interface HTMLElementTagNameMap{'lr-budget-meter':LyraBudgetMeter;}}
@@ -1,4 +1,4 @@
1
- import{__decorate}from"tslib";import{hostAriaLabel}from"../../../internal/a11y.js";import{finiteNumber,finiteRatio}from"../../../internal/numbers.js";import{getNumberFormat}from"../../../internal/intl-cache.js";import{html,nothing}from"lit";import{property}from"lit/decorators.js";import{styleMap}from"lit/directives/style-map.js";import{LyraElement}from"../../../internal/lyra-element.js";import{styles}from"./budget-meter.styles.js";import{resolveHeadingLevel}from"../../../internal/heading-level.js";import{LYRA_DEFAULT_budgetMeterExceeded,LYRA_DEFAULT_budgetMeterLabel,LYRA_DEFAULT_budgetMeterPercent,LYRA_DEFAULT_budgetMeterUnavailable,LYRA_DEFAULT_budgetMeterValue}from"../../../internal/default-strings/agent-tools.generated.js";class LyraBudgetMeter extends LyraElement{constructor(){super(...arguments),this.used=0,this.limit=0,this.headingLevel="2"}static{this.defaultStrings={...super.defaultStrings,budgetMeterExceeded:LYRA_DEFAULT_budgetMeterExceeded,budgetMeterLabel:LYRA_DEFAULT_budgetMeterLabel,budgetMeterPercent:LYRA_DEFAULT_budgetMeterPercent,budgetMeterUnavailable:LYRA_DEFAULT_budgetMeterUnavailable,budgetMeterValue:LYRA_DEFAULT_budgetMeterValue}}static{this.styles=[LyraElement.styles,styles]}get safeUsed(){return Math.max(0,finiteNumber(this.used,0))}get safeLimit(){return Math.max(0,finiteNumber(this.limit,0))}formatValue(value){return getNumberFormat(this.effectiveLocale,{maximumFractionDigits:2}).format(value)}valueText(){return this.localize("budgetMeterValue",void 0,{used:this.formatValue(this.safeUsed),limit:this.formatValue(this.safeLimit),unit:this.unit??""}).trim()}render(){const visibleLabel=this.label==null?this.localize("budgetMeterLabel"):this.label,hostLabel=hostAriaLabel(this),used=this.safeUsed,limit=this.safeLimit,available=limit>0,ratio=available?finiteRatio(used,0,limit):0,percentage=available?getNumberFormat(this.effectiveLocale,{style:"percent",maximumFractionDigits:0}).format(ratio):"",ariaValueNow=Math.min(used,limit),level=resolveHeadingLevel(this.headingLevel??"2");return html`
1
+ import{__decorate}from"tslib";import{hostAriaLabel}from"../../../internal/a11y.js";import{finiteNumber,finiteRatio}from"../../../internal/numbers.js";import{getNumberFormat}from"../../../internal/intl-cache.js";import{html,nothing}from"lit";import{property}from"lit/decorators.js";import{styleMap}from"lit/directives/style-map.js";import{LyraElement}from"../../../internal/lyra-element.js";import{styles}from"./budget-meter.styles.js";import{resolveHeadingLevel}from"../../../internal/heading-level.js";import{LYRA_DEFAULT_budgetMeterExceeded,LYRA_DEFAULT_budgetMeterLabel,LYRA_DEFAULT_budgetMeterPercent,LYRA_DEFAULT_budgetMeterUnavailable,LYRA_DEFAULT_budgetMeterValue}from"../../../internal/default-strings/agent-tools.generated.js";class LyraBudgetMeter extends LyraElement{constructor(){super(...arguments),this.used=0,this.limit=0,this.headingLevel="2",this.formatGeneration=0,this.formatting=!1,this.suppressFormatter=!1}static{this.defaultStrings={...super.defaultStrings,budgetMeterExceeded:LYRA_DEFAULT_budgetMeterExceeded,budgetMeterLabel:LYRA_DEFAULT_budgetMeterLabel,budgetMeterPercent:LYRA_DEFAULT_budgetMeterPercent,budgetMeterUnavailable:LYRA_DEFAULT_budgetMeterUnavailable,budgetMeterValue:LYRA_DEFAULT_budgetMeterValue}}static{this.styles=[LyraElement.styles,styles]}requestUpdate(...args){this.formatGeneration=(this.formatGeneration??0)+1,this.suppressFormatter=this.formatting===!0,super.requestUpdate(...args)}get safeUsed(){return Math.max(0,finiteNumber(this.used,0))}get safeLimit(){return Math.max(0,finiteNumber(this.limit,0))}valueProjection(){const formatter=this.valueFormatter,usedInput=this.used,limitInput=this.limit,unit=this.unit,locale=this.effectiveLocale,document=this.ownerDocument,connected=this.isConnected,generation=this.formatGeneration,used=this.safeUsed,limit=this.safeLimit,current=()=>generation===this.formatGeneration&&formatter===this.valueFormatter&&Object.is(usedInput,this.used)&&Object.is(limitInput,this.limit)&&unit===this.unit&&locale===this.effectiveLocale&&document===this.ownerDocument&&connected===this.isConnected,valid=value=>typeof value=="string"&&value.length<=65536&&value.trim().length>0;let formattedUsed,formattedLimit;if(typeof formatter=="function"&&!this.suppressFormatter){const context=Object.freeze({locale});this.formatting=!0;try{formattedUsed=formatter(used,context),current()&&valid(formattedUsed)&&(formattedLimit=formatter(limit,context))}catch{}finally{this.formatting=!1}current()||(this.suppressFormatter=!0)}const coherent=current(),finalUsed=coherent?used:this.safeUsed,finalLimit=coherent?limit:this.safeLimit,numberFormat=getNumberFormat(this.effectiveLocale,{maximumFractionDigits:2});let usedText=numberFormat.format(finalUsed),limitText=numberFormat.format(finalLimit);return coherent&&valid(formattedUsed)&&valid(formattedLimit)&&(usedText=formattedUsed,limitText=formattedLimit),{used:finalUsed,limit:finalLimit,text:this.localize("budgetMeterValue",void 0,{used:usedText,limit:limitText,unit:this.unit??""}).trim()}}render(){const{used,limit,text}=this.valueProjection(),visibleLabel=this.label==null?this.localize("budgetMeterLabel"):this.label,hostLabel=hostAriaLabel(this),available=limit>0,ratio=available?finiteRatio(used,0,limit):0,percentage=available?getNumberFormat(this.effectiveLocale,{style:"percent",maximumFractionDigits:0}).format(ratio):"",ariaValueNow=Math.min(used,limit),level=resolveHeadingLevel(this.headingLevel??"2");return html`
2
2
  <section part="base" role="group" aria-label=${hostLabel===null?nothing:hostLabel}>
3
3
  ${visibleLabel===""?nothing:html`<div part="label" role=${level?"heading":nothing} aria-level=${level??nothing}>${visibleLabel}</div>`}
4
4
  ${available?html`
@@ -9,13 +9,13 @@ import{__decorate}from"tslib";import{hostAriaLabel}from"../../../internal/a11y.j
9
9
  aria-valuemin="0"
10
10
  aria-valuemax=${String(limit)}
11
11
  aria-valuenow=${String(ariaValueNow)}
12
- aria-valuetext=${this.valueText()}
12
+ aria-valuetext=${text}
13
13
  >
14
14
  <span part="track"><span part="fill" style=${styleMap({inlineSize:`${ratio*100}%`})}></span></span>
15
15
  </div>
16
16
  <span part="percent">${this.localize("budgetMeterPercent",void 0,{percent:percentage})}</span>
17
17
  `:html`<p part="unavailable">${this.localize("budgetMeterUnavailable")}</p>`}
18
- <p part="value">${this.valueText()}</p>
18
+ <p part="value">${text}</p>
19
19
  ${available&&used>limit?html`<p part="exceeded">${this.localize("budgetMeterExceeded")}</p>`:nothing}
20
20
  </section>
21
- `}}__decorate([property({type:Number})],LyraBudgetMeter.prototype,"used",void 0),__decorate([property({type:Number})],LyraBudgetMeter.prototype,"limit",void 0),__decorate([property()],LyraBudgetMeter.prototype,"unit",void 0),__decorate([property({attribute:"heading-level"})],LyraBudgetMeter.prototype,"headingLevel",void 0),__decorate([property()],LyraBudgetMeter.prototype,"label",void 0);export{LyraBudgetMeter};
21
+ `}}__decorate([property({type:Number})],LyraBudgetMeter.prototype,"used",void 0),__decorate([property({type:Number})],LyraBudgetMeter.prototype,"limit",void 0),__decorate([property()],LyraBudgetMeter.prototype,"unit",void 0),__decorate([property({attribute:"heading-level"})],LyraBudgetMeter.prototype,"headingLevel",void 0),__decorate([property()],LyraBudgetMeter.prototype,"label",void 0),__decorate([property({attribute:!1})],LyraBudgetMeter.prototype,"valueFormatter",void 0);export{LyraBudgetMeter};
@@ -1,6 +1,6 @@
1
1
  import{__decorate}from"tslib";import{SourceRequestController}from"../../../internal/source-request-controller.js";import{prepareChartModel,revealPreparedSourcePoint}from"./chart-prepared-data.js";import{ThemeWatcher}from"../../../internal/theme-watcher.js";import{CollectionSourceTracker}from"../../../internal/collection-source-tracker.js";import{LazyChartSyncController}from"./chart-sync-lazy.js";import{chartDataTableVisible,hasSlottedChartDataTable,hasArraySeriesData}from"./chart-data-table.js";import{collectionSupport,snapshotPublicCollection,publicCollectionTruncation}from"../../../internal/collection-snapshot.js";import{boundChartSeriesValues,chartSeriesValueLimit}from"./chart-series-bounds.js";import{nativeSvgTitle}from"../../../internal/svg-title.js";import{html,svg,nothing}from"lit";import{property,state,query}from"lit/decorators.js";import{styleMap}from"lit/directives/style-map.js";import{LyraElement}from"../../../internal/lyra-element.js";import{specialistTokens}from"../../../internal/specialist-host-tokens.styles.js";import{nextId,srOnly}from"../../../internal/a11y.js";import{getListFormat,getNumberFormat}from"../../../internal/intl-cache.js";import{formatChartValue}from"./chart-number-format.js";import{decimalPlaces,finiteAdd,finiteCount,finiteNumber,finiteRange}from"../../../internal/numbers.js";import{escapeCsvField}from"../../utility/export-button/csv.js";import"../../utility/live-region/live-region.class.js";import{styles}from"./lite-chart.styles.js";import{bidiStyles,isolateHtml,isolatedMessage}from"./chart-bidi.js";import{forcedColorEncoding,forcedColorsActive}from"./chart-forced-colors.js";import{literalSetConverter}from"../../../internal/converters.js";import{sanitizeCssColor,sanitizeCssLength}from"../../../internal/safe-css.js";import{shadowFocusTarget}from"../../../internal/active-element.js";import{AnnouncementSinkController}from"../../../internal/announcer.js";import{MAX_RENDERED_CHART_RECORDS,sampleChartTableIndexes,normalizeChartRecordLimit}from"./chart-table-sampling.js";import{chartChromeLegendPlacement,normalizeChartChromeLegendPosition}from"./chart-chrome.js";import{categoryLabelGrowth,hasCategoryLabelText,sparseCategoryLabelExtent,visibleCategoryLabelIndexes,widestEstimatedCategoryLabel}from"./lite-chart-axis-layout.js";import{LYRA_DEFAULT_chartCategory,LYRA_DEFAULT_chartData,LYRA_DEFAULT_chartDataSampled,LYRA_DEFAULT_chartInputLimit,LYRA_DEFAULT_chartPlotSampled,LYRA_DEFAULT_chartPointCoordinates,LYRA_DEFAULT_chartSeriesLabel,LYRA_DEFAULT_chartTotal,LYRA_DEFAULT_liteChartBarLabel,LYRA_DEFAULT_liteChartCustomMarkSummary,LYRA_DEFAULT_liteChartMarkSummary}from"../../../internal/default-strings/charts.generated.js";import{LYRA_DEFAULT_chart,LYRA_DEFAULT_chartPreparedSummary,LYRA_DEFAULT_chartPreparedUnavailable,LYRA_DEFAULT_chartSummary,LYRA_DEFAULT_chartSummarySeparator,LYRA_DEFAULT_chartTrendDecreasing,LYRA_DEFAULT_chartTrendFlat,LYRA_DEFAULT_chartTrendIncreasing,LYRA_DEFAULT_loading}from"../../../internal/default-strings/shared.generated.js";function isLiteChartSeries(value){return hasArraySeriesData(value)}function normalizeLiteChartSeries(value){try{return Object.freeze(Array.isArray(value)?value.filter(isLiteChartSeries):[])}catch{return Object.freeze([])}}function normalizeLiteChartType(value){return value==="line"||value==="bar"?value:"bar"}const LITE_CHART_LAYOUT=literalSetConverter(["fit","scroll"],"fit"),autoNumberConverter={fromAttribute:value=>{if(value===null)return;const trimmed=value.trim();return trimmed.toLowerCase()==="auto"?"auto":Number(trimmed)}},DEFAULT_PALETTE=["var(--lr-chart-color-1, var(--lr-color-chart-1))","var(--lr-chart-color-2, var(--lr-color-chart-2))","var(--lr-chart-color-3, var(--lr-color-chart-3))","var(--lr-chart-color-4, var(--lr-color-chart-4))","var(--lr-chart-color-5, var(--lr-color-chart-5))","var(--lr-chart-color-6, var(--lr-color-chart-6))","var(--lr-chart-color-7, var(--lr-color-chart-7))","var(--lr-chart-color-8, var(--lr-color-chart-8))"],PAD_LEFT=36,PAD_RIGHT=8,PAD_TOP=8,PAD_BOTTOM=30,CATEGORY_LABEL_OFFSET=24,AXIS_TITLE_SPACE=14,TICK_COUNT=4,BAR_GROUP_GAP=.2,BAR_GAP=.08,BAR_CORNER_RADIUS=4,APPROX_LABEL_CHARACTER_WIDTH=7,AUTO_CATEGORY_LABEL_INSET=10,VALUE_AXIS_TICK_OFFSET=6,AUTO_VALUE_AXIS_SAFETY_INSET=8,MAX_AUTO_VALUE_AXIS_GUTTER=240,MAX_AUTO_VALUE_AXIS_GUTTER_FRACTION=.4,MAX_SCROLL_CONTENT_WIDTH=1e6,CATEGORY_LABEL_SELECTION_BOUNDS=Object.freeze({characterWidth:APPROX_LABEL_CHARACTER_WIDTH,laneInset:AUTO_CATEGORY_LABEL_INSET,maxContentWidth:MAX_SCROLL_CONTENT_WIDTH,maxRenderedRecords:MAX_RENDERED_CHART_RECORDS});function niceStep(span,count){const rough=span/Math.max(1,count),magnitude=10**Math.floor(Math.log10(rough)),residual=rough/magnitude;return(residual<1.5?1:residual<3?2:residual<7?5:10)*magnitude}function logDomainFraction(value,lo,hi){const top=Math.max(hi,0);if(!Number.isFinite(top)||top<=0)return domainFraction(value,lo,hi);const bottom=lo>0?lo:top/10;if(!Number.isFinite(bottom)||bottom<=0||bottom>=top)return domainFraction(value,lo,hi);if(!Number.isFinite(value)||value<=bottom)return 0;if(value>=top)return 1;const relativeSpan=(top-bottom)/bottom,fraction=relativeSpan<=1?Math.log1p((value-bottom)/bottom)/Math.log1p(relativeSpan):(Math.log10(value)-Math.log10(bottom))/(Math.log10(top)-Math.log10(bottom));return Number.isFinite(fraction)?Math.min(1,Math.max(0,fraction)):0}function domainFraction(value,lo,hi){const span=hi-lo;if(Number.isFinite(span)&&span>0)return Math.min(1,Math.max(0,(value-lo)/span));const scale=Math.max(Math.abs(value),Math.abs(lo),Math.abs(hi),1),scaledSpan=hi/scale-lo/scale;if(!Number.isFinite(scaledSpan)||scaledSpan<=0)return 0;const fraction=(value/scale-lo/scale)/scaledSpan;return Number.isFinite(fraction)?Math.min(1,Math.max(0,fraction)):0}function snapToStep(value,step){const places=decimalPlaces(step);return Number.isFinite(step)&&step>0&&places<=100?Number(value.toFixed(places)):value}function safeDomainTicks(lo,hi,count){return Array.from({length:Math.max(1,count)+1},(_,index)=>{if(index===0)return lo;if(index===count)return hi;const ratio=index/count;return Number((lo*(1-ratio)+hi*ratio).toPrecision(15))}).filter(Number.isFinite)}function logarithmicTicks(lo,hi,count){if(!(lo>0&&hi>lo)||!Number.isFinite(lo)||!Number.isFinite(hi))return;const start=Math.log10(lo),end=Math.log10(hi),span=end-start;if(!(span>0))return;const decades=span>=1,step=decades?Math.ceil(span/count):niceStep(hi-lo,count);if(!Number.isFinite(step)||step<=0)return[...new Set(safeDomainTicks(lo,hi,count))];const ticks=[lo],minimumGap=decades?step/2:span/(count*2),first=Math.ceil((decades?start:lo)/step);for(let index=0;index<=count+1;index++){const value=decades?10**((first+index)*step):snapToStep((first+index)*step,step);if(!Number.isFinite(value)||value>=hi)break;if(value<=ticks.at(-1))continue;const logarithm=Math.log10(value);logarithm-Math.log10(ticks.at(-1))>=minimumGap&&end-logarithm>=minimumGap&&ticks.push(value)}return ticks.push(hi),ticks}function niceDomain(dataLo,dataHi,beginAtZero,count){let lo=beginAtZero?Math.min(0,dataLo):dataLo,hi=beginAtZero?Math.max(0,dataHi):dataHi;lo===hi&&(Math.abs(lo)>Number.MAX_VALUE/2?(lo=lo>0?lo/2:lo,hi=hi<0?hi/2:hi):(lo-=1,hi+=1));const span=hi-lo;if(!Number.isFinite(span))return{lo,hi,ticks:safeDomainTicks(lo,hi,count)};const step=niceStep(span,count);if(!Number.isFinite(step)||step<=0)return{lo,hi,ticks:safeDomainTicks(lo,hi,count)};const snap=value=>snapToStep(value,step),roundedLo=snap(Math.floor(lo/step)*step),roundedHi=snap(Math.ceil(hi/step)*step);Number.isFinite(roundedLo)&&(lo=Math.min(lo,roundedLo)),Number.isFinite(roundedHi)&&(hi=Math.max(hi,roundedHi));const slots=Math.floor((hi-lo)/step);if(!Number.isFinite(slots)||slots<0||slots>100)return{lo,hi,ticks:safeDomainTicks(lo,hi,count)};const ticks=[];for(let index=0;index<=slots;index++){const value=snap(lo+index*step);Number.isFinite(value)&&ticks.push(value)}return ticks.at(-1)!==hi&&ticks.push(hi),{lo,hi,ticks}}class LyraLiteChart extends LyraElement{constructor(){super(...arguments),this.type="bar",this._preparedData=null,this.preparedDirty=!0,this.preparedActive=!1,this.preparedChanged=!1,this.preparedInvalid=!1,this.preparedPending=!1,this.preparedRequestFailed=!1,this.announcedPreparedInvalid=!1,this.preparedRequests=new SourceRequestController(this,{channels:["point"],onReset:()=>{this.preparedPending=!1}}),this.labels=[],this.maxRecords=1e3,this._datasets=Object.freeze([]),this.datasetsTruncated=!1,this.datasetsSources=new CollectionSourceTracker,this.withLegend=!1,this.legendPosition="bottom",this.height="280px",this.xLabel="",this.yLabel="",this.withoutZeroBaseline=!1,this.stacked=!1,this.tableTotals=!1,this.withDataTable=!1,this.dataTableToggle=!1,this.dataTableExpandedOverride=null,this.dataTableId=nextId("lite-chart-data-table"),this._layout="fit",this.barWidth=32,this.roundedBars=!1,this.skipZero=!1,this.scale="linear",this.withoutValueAxis=!1,this.selectedIndices=[],this.hostAccessibleLabel=null,this.label=null,this.description=null,this.forcedColorPatternId=nextId("lite-chart-pattern"),this.descriptionId=nextId("lite-chart-description"),this.plotWidth=0,this.plotHeight=0,this.fitMeasurementAvailable=!1,this._activeMarkIndex=0,this.syncPlot={y:0,height:0},this.syncCategoryPositions=new Map,this.resizeObserverGeneration=0,this.axisTitleTargets=new Set,this.axisTitleFits=new WeakMap,this.themeWatcher=new ThemeWatcher(this,()=>this.requestUpdate()),this.refocusMarkAfterUpdate=!1,this.refocusChartAfterUpdate=!1,this.announcements=new AnnouncementSinkController(this,{eager:["polite"]}),this.lastDataTruncationAnnouncement="",this.isMounting=!0,this.syncGroup="",this.chartSync=new LazyChartSyncController(this,(label,index)=>this.syncPresentation(label,index),void 0,target=>target.nodeType===1&&target.hasAttribute("data-mark-index"),()=>this.requestUpdate()),this.deferredTableGeneration=0,this.streamingTableUpdate=!1}static{this.defaultStrings={...super.defaultStrings,chart:LYRA_DEFAULT_chart,chartCategory:LYRA_DEFAULT_chartCategory,chartData:LYRA_DEFAULT_chartData,chartDataSampled:LYRA_DEFAULT_chartDataSampled,chartInputLimit:LYRA_DEFAULT_chartInputLimit,chartPlotSampled:LYRA_DEFAULT_chartPlotSampled,chartPointCoordinates:LYRA_DEFAULT_chartPointCoordinates,chartPreparedSummary:LYRA_DEFAULT_chartPreparedSummary,chartPreparedUnavailable:LYRA_DEFAULT_chartPreparedUnavailable,chartSeriesLabel:LYRA_DEFAULT_chartSeriesLabel,chartSummary:LYRA_DEFAULT_chartSummary,chartSummarySeparator:LYRA_DEFAULT_chartSummarySeparator,chartTotal:LYRA_DEFAULT_chartTotal,chartTrendDecreasing:LYRA_DEFAULT_chartTrendDecreasing,chartTrendFlat:LYRA_DEFAULT_chartTrendFlat,chartTrendIncreasing:LYRA_DEFAULT_chartTrendIncreasing,liteChartBarLabel:LYRA_DEFAULT_liteChartBarLabel,liteChartCustomMarkSummary:LYRA_DEFAULT_liteChartCustomMarkSummary,liteChartMarkSummary:LYRA_DEFAULT_liteChartMarkSummary,loading:LYRA_DEFAULT_loading}}static{this.collectionSupport=collectionSupport}static{this.ownedCollectionProperties=Object.freeze(["labels","selectedIndices"])}static{this.styles=[LyraElement.styles,specialistTokens,styles,srOnly,bidiStyles]}get preparedData(){return this._preparedData}set preparedData(value){const previous=this._preparedData;this._preparedData=value,this.requestUpdate("preparedData",previous),value===previous&&this.requestUpdate()}refreshPreparedModel(){if(!this.preparedDirty)return;this.preparedDirty=!1,this.preparedChanged=!0,this.preparedInvalid=!1,this.preparedRequestFailed=!1,this.preparedBaseModel=this.preparedModel=void 0,this.preparedEffective=void 0;const input=this._preparedData;this.preparedActive=input!==null;try{if(input!==null){const model=prepareChartModel(input,this.effectiveType,normalizeChartRecordLimit(this.maxRecords));if(model.kind==="series"&&this.stacked)throw new TypeError("Ordered series cannot be stacked");this.preparedBaseModel=this.preparedModel=model,this.preparedRequests.setSource(input,model.revision)}else this.preparedRequests.setSource(void 0,void 0)}catch{this.preparedInvalid=!0,this.preparedRequests.setSource(void 0,void 0)}}async revealSourcePoint(ref){if(!this.isConnected||!ref||typeof ref.seriesId!="string")return!1;ref=Object.freeze({seriesId:ref.seriesId,sourceIndex:ref.sourceIndex}),this.preparedDirty&&await this.updateComplete;const model=this.preparedBaseModel;if(!model||model.kind!=="series")return!1;const series=model.series.find(series2=>series2.id===ref.seriesId);if(!series||!Number.isSafeInteger(ref.sourceIndex)||ref.sourceIndex<0||ref.sourceIndex>=series.counts.sourceCount)return!1;const lease=this.preparedRequests.begin("point",this.effectiveLocale);if(!lease)return!1;this.preparedPending=!0,this.preparedRequestFailed=!1,this.requestUpdate("preparedView",null);const signal=lease.context.signal;try{const result=await revealPreparedSourcePoint(model,ref,signal,()=>lease.isCurrent()&&this.preparedBaseModel===model);return result.status!=="ready"||!lease.isCurrent()||this.preparedBaseModel!==model||model.source.revision!==model.revision?!1:(this.preparedModel=result.model,this.preparedChanged=!0,this.preparedEffective=void 0,this.recordSampleMemo=void 0,this.marksMemo=void 0,this.dataTableRows=void 0,!0)}catch{return lease.isCurrent()&&(this.preparedRequestFailed=!0,this.announcements.announceAssertive(this.localize("chartPreparedUnavailable"))),!1}finally{lease.isCurrent()&&(this.preparedPending=!1,this.requestUpdate("preparedView",null))}}get displayDatasets(){if(!this.preparedActive)return this.datasets;const model=this.preparedModel;if(!model)return[];if(this.preparedEffective?.model===model)return this.preparedEffective.datasets;const datasets=model.series.map(series=>Object.freeze({label:series.label,data:model.kind==="series"?Object.freeze(series.samples.map(point=>point?.y??null)):series.values}));return this.preparedEffective={model,datasets},datasets}get displayLabels(){return this.preparedActive?this.preparedModel?.labels??[]:this.labels}datumLabel(datasetIndex,index){const point=this.preparedModel?.kind==="series"?this.preparedModel.series[datasetIndex]?.samples[index]:void 0;return point?`${point.sourceIndex}: ${this.localize("chartPointCoordinates",void 0,{x:formatChartValue(point.x,this.effectiveLocale),y:point.y===null?"":formatChartValue(point.y,this.effectiveLocale)})}`:this.displayLabels[index]??""}preparedX(datasetIndex,index,plotX,plotW){const model=this.preparedModel,point=model?.series[datasetIndex]?.samples[index];if(!model||!point)return plotX;let lo=1/0,hi=-1/0;for(const series of model.series)series.xDomain&&(lo=Math.min(lo,series.xDomain.min),hi=Math.max(hi,series.xDomain.max));const fraction=lo===hi?.5:domainFraction(point.x,lo,hi);return plotX+(this.effectiveDirection==="rtl"?1-fraction:fraction)*plotW}preparedDescription(){const model=this.preparedModel;if(!model)return this.description??"";const summary=this.localize("chartPreparedSummary",void 0,{validCount:formatChartValue(model.validCount,this.effectiveLocale),invalidCount:formatChartValue(model.invalidCount,this.effectiveLocale),displayedCount:formatChartValue(model.displayedCount,this.effectiveLocale)}),domains=(this.preparedBaseModel??model).series.flatMap(series=>{if(!series.yDomain)return[];const first=series.samples[0]?.y??0,last=series.samples.at(-1)?.y??0;return[this.localize("chartSummary",void 0,{label:series.label,count:formatChartValue(series.counts.validCount,this.effectiveLocale),min:formatChartValue(series.yDomain.min,this.effectiveLocale),max:formatChartValue(series.yDomain.max,this.effectiveLocale),trend:this.localize(last>first?"chartTrendIncreasing":last<first?"chartTrendDecreasing":"chartTrendFlat")})]});return[this.description,...domains,summary].filter(Boolean).join(this.localize("chartSummarySeparator"))}get datasets(){return this._datasets}set datasets(value){if(this.datasetsSources.isRebind("datasets",value,this._datasets))return;const previous=this._datasets,bounded=boundChartSeriesValues(value);this.datasetsTruncated=bounded!==void 0,this._datasets=normalizeLiteChartSeries(snapshotPublicCollection(bounded??value,this.ownerDocument?.defaultView,{onResult:result=>{this.datasetsTruncated||=result.truncated}})),this.requestUpdate("datasets",previous)}get dataTableVisible(){return chartDataTableVisible(this.withDataTable,this.dataTableToggle,this.dataTableExpandedOverride)}toggleDataTable(){this.dataTableExpandedOverride=!this.dataTableVisible}get layout(){return this._layout}set layout(next){const normalized=LITE_CHART_LAYOUT.normalizeReflected(this,"layout",next),old=this._layout;old!==normalized&&(this._layout=normalized,this.requestUpdate("layout",old))}get activeMarkIndex(){return this._activeMarkIndex}set activeMarkIndex(index){index!==this._activeMarkIndex&&(this.renderRoot?.querySelector(`[data-mark-index="${this._activeMarkIndex}"]`)?.setAttribute("tabindex","-1"),this._activeMarkIndex=index,this.renderRoot?.querySelector(`[data-mark-index="${index}"]`)?.setAttribute("tabindex","0"))}appendData(label,values,maxPoints=0){if(this._preparedData===null){this.deferStreamedTable(),this.streamingTableUpdate=!0;try{const bound=chartSeriesValueLimit(this.datasets.length),requested=Math.max(0,finiteCount(maxPoints,0)),limit=requested>0?Math.min(requested,bound):bound;let domainLength=this.labels.length;for(const series of this.datasets)domainLength=Math.max(domainLength,series.data.length);const retained=Math.min(domainLength+1,limit),start=domainLength+1-retained,labels=new Array(retained);for(let i=0;i<retained-1;i++)labels[i]=this.labels[start+i]??"";labels[retained-1]=label,this.labels=labels;const previous=this._datasets;this._datasets=Object.freeze(previous.map((series,index)=>{const data=new Array(retained);for(let i=0;i<retained-1;i++)data[i]=start+i<series.data.length?series.data[start+i]:null;return data[retained-1]=snapshotPublicCollection(values[index]??null,this.ownerDocument?.defaultView),Object.freeze({...series,data:Object.freeze(data)})})),this.datasetsSources.isRebind("datasets",this._datasets,previous),this.datasetsTruncated=!1,this.requestUpdate("datasets",previous)}finally{this.streamingTableUpdate=!1}}}exportData(format){if(format==="svg"){const XMLSerializerCtor=this.ownerDocument.defaultView?.XMLSerializer;return!this.svgEl||typeof XMLSerializerCtor!="function"?"":new XMLSerializerCtor().serializeToString(this.svgEl)}const header=["label",...this.displayDatasets.map(series=>series.label)].map(escapeCsvField).join(",");if(this.preparedModel?.kind==="series"){const rows2=[];return this.preparedModel.series.forEach((entry,datasetIndex)=>entry.samples.forEach((point,index)=>{if(!point||point.y===null)return;const label=this.datumLabel(datasetIndex,index),value=this.formatter?.({value:point.y,surface:"export",datasetIndex,index,label,seriesLabel:entry.label,axis:"y"})??point.y;rows2.push([label,...this.displayDatasets.map((_series,position)=>position===datasetIndex?value:"")].map(escapeCsvField).join(","))})),[header,...rows2].join(`\r
2
2
  `)}const rows=Array.from({length:this.recordCount()},(_,index)=>{const label=this.displayLabels[index]??"";return[label,...this.displayDatasets.map((series,datasetIndex)=>{const value=series.data[index];return typeof value=="number"&&Number.isFinite(value)?this.formatter?.({value,surface:"export",datasetIndex,index,label,seriesLabel:series.label,axis:"y"})??value:""})].map(escapeCsvField).join(",")});return[header,...rows].join(`\r
3
- `)}attributeChangedCallback(name,oldValue,value){super.attributeChangedCallback(name,oldValue,value),oldValue!==value&&(name==="style"||name==="class")&&(this.fitAxisTitles(),this.fitCategoryLabels())}connectedCallback(){super.connectedCallback(),this.requestUpdate(),this.armResizeObserver()}armResizeObserver(){const target=this.svgEl,ownerDocument=this.ownerDocument;if(!this.isConnected||!target||this.resizeObserver&&this.resizeObserverDocument===ownerDocument&&this.resizeObserverTarget===target)return;this.resetResizeObserver();const ResizeObserverCtor=ownerDocument.defaultView?.ResizeObserver;if(!ResizeObserverCtor)return;const generation=this.resizeObserverGeneration,observer=new ResizeObserverCtor(entries=>{if(this.resizeObserver!==observer||this.resizeObserverGeneration!==generation||!this.isConnected||this.ownerDocument!==ownerDocument||this.resizeObserverTarget!==target)return;const svgEntry=entries.find(entry=>entry.target===target);if(svgEntry){const box=svgEntry.contentBoxSize?.[0];if(box)this.plotWidth=box.inlineSize,this.plotHeight=box.blockSize;else{const rect=target.getBoundingClientRect();this.plotWidth=rect.width,this.plotHeight=rect.height}}entries.some(entry=>this.axisTitleTargets.has(entry.target))&&this.queueAxisTitleFit()});this.resizeObserver=observer,this.resizeObserverDocument=ownerDocument,this.resizeObserverTarget=target,target&&observer.observe(target),this.syncAxisTitleTargets()}disconnectedCallback(){this.preparedRequests.refresh(),this.preparedModel=this.preparedBaseModel=void 0,this.preparedEffective=void 0,this.preparedDirty=!0,this.clearDeferredTable(),this.chartSync.disconnect(),super.disconnectedCallback(),this.lastDataTruncationAnnouncement="",this.isMounting=!0,this.resetResizeObserver()}adoptedCallback(){this.preparedRequests.adopted(),this.clearDeferredTable(),this.chartSync.disconnect(),super.adoptedCallback(),this.requestUpdate(),this.resetResizeObserver(),this.announcements.adopted(),this.isConnected?this.themeWatcher.hostConnected():this.themeWatcher.hostDisconnected(),this.refreshFitMeasurementAvailability()}resetResizeObserver(){this.axisTitleFrame!==void 0&&(this.resizeObserverDocument?.defaultView?.cancelAnimationFrame(this.axisTitleFrame),this.axisTitleFrame=void 0),this.axisTitleTargets.clear(),this.resizeObserverGeneration+=1,this.resizeObserver?.disconnect(),this.resizeObserver=void 0,this.resizeObserverDocument=void 0,this.resizeObserverTarget=void 0}firstUpdated(changed){super.firstUpdated(changed),this.armResizeObserver()}willUpdate(changed){super.willUpdate(changed),this.refreshPreparedModel();const shouldSync=this.preparedModel?.kind!=="series"&&this.isConnected&&typeof this.syncGroup=="string"&&this.syncGroup.trim()!=="";if(this.chartSync.enabled!==shouldSync&&this.chartSync.update(this.syncGroup,shouldSync),this.seedFirstRenderState(()=>{this.refreshFitMeasurementAvailability()}),!(this.preparedChanged||["type","labels","datasets","skipZero","maxRecords","plotWidth","layout"].some(name=>changed.has(name))))return;const active=shadowFocusTarget(this)??null,hadFocusedMark=active?.matches('[part="bar"], [part="point"]')??!1,priorPosition=Number(active?.getAttribute("data-mark-index")??this.activeMarkIndex),datasetAttribute=active?.getAttribute("data-dataset-index"),indexAttribute=active?.getAttribute("data-index"),datasetIndex=Number(datasetAttribute),index=Number(indexAttribute),marks=this.interactiveMarks(),sameIdentity=datasetAttribute!=null&&indexAttribute!==null&&indexAttribute!==void 0?marks.findIndex(mark=>mark.datasetIndex===datasetIndex&&mark.index===index):-1;this.activeMarkIndex=marks.length?sameIdentity>=0?sameIdentity:Math.min(Math.max(priorPosition,0),marks.length-1):0,this.refocusMarkAfterUpdate=hadFocusedMark&&marks.length>0,this.refocusChartAfterUpdate=hadFocusedMark&&marks.length===0}updated(changed){super.updated(changed);const wasMounting=this.isMounting;if(this.preparedChanged=!1,this.setAttribute("aria-busy",String(this.preparedPending)),!wasMounting&&this.preparedInvalid&&!this.announcedPreparedInvalid&&this.announcements.announceAssertive(this.localize("chartPreparedUnavailable")),this.announcedPreparedInvalid=this.preparedInvalid,this.isMounting=!1,changed.has("height")){const height=sanitizeCssLength(this.height,"height");height?this.style.setProperty("--_lr-chart-height",height):this.style.removeProperty("--_lr-chart-height")}const inputLimit=this.inputLimitMessage(),sampling=this.dataTruncationMessage(),dataTruncation=inputLimit&&sampling?[inputLimit,sampling].join(this.localize("chartSummarySeparator")):inputLimit||sampling;wasMounting?this.lastDataTruncationAnnouncement=dataTruncation:dataTruncation!==this.lastDataTruncationAnnouncement&&(this.lastDataTruncationAnnouncement=dataTruncation,dataTruncation&&this.announcements.announcePolite(dataTruncation)),this.refocusMarkAfterUpdate&&(this.refocusMarkAfterUpdate=!1,this.renderRoot.querySelectorAll('[part="bar"], [part="point"]')[this.normalizedMarkIndex()]?.focus()),this.refocusChartAfterUpdate&&(this.refocusChartAfterUpdate=!1,this.svgEl?.focus()),(changed.size===0||[...changed.keys()].some(name=>!["selectedIndices","dataTableExpandedOverride","dataTable","dataTableToggle","description","label"].includes(String(name))))&&(this.fitAxisTitles(),this.fitCategoryLabels()),this.syncAxisTitleTargets();const dataChanged=["datasets","labels","type","skipZero","layout","maxRecords","maxSeries"].some(name=>changed.has(name));this.chartSync.update(this.syncGroup,this.preparedModel?.kind!=="series",dataChanged)}fitAxisTitles(){if(!(!this.ownerDocument?.defaultView||!this.isConnected||!this.svgEl?.getClientRects().length))for(const title of this.svgEl.querySelectorAll('[part="axis-title"]')){const text=Array.from(title.childNodes).find(node=>node.nodeType===3);if(!text)continue;const source=title.getAttribute("aria-label")??"",extent=finiteRange(Number(title.getAttribute("data-title-extent")),0,0,MAX_SCROLL_CONTENT_WIDTH),previous=this.axisTitleFits.get(title);if(!(previous?.source===source&&previous.extent===extent&&previous.display===text.data&&previous.width===title.getComputedTextLength())){if(title.style.removeProperty("opacity"),text.data=source,title.getComputedTextLength()>extent)if(text.data="…",title.getComputedTextLength()>extent)title.style.opacity="0";else{let lower=0,upper=source.length;for(;lower<upper;){const middle=Math.ceil((lower+upper)/2);text.data=`${source.slice(0,middle)}…`,title.getComputedTextLength()<=extent?lower=middle:upper=middle-1}const last=source.charCodeAt(lower-1);last>=55296&&last<=56319&&(lower-=1),text.data=`${source.slice(0,lower)}…`}this.axisTitleFits.set(title,{source,extent,display:text.data,width:title.getComputedTextLength()})}}}fitOneCategoryLabel(tick,x,anchor,extent){const width=this.fitCategoryBatch([{tick,extent}])[0]??0;return anchor==="start"?x+width:anchor==="end"?x-width:x}fitCategoryBatch(items){const candidates=items.map(({tick,extent})=>{const text=Array.from(tick.childNodes).find(node=>node.nodeType===3),source=tick.getAttribute("data-full-label")??"",bounded=finiteRange(extent,0,0,MAX_SCROLL_CONTENT_WIDTH);return tick.setAttribute("data-label-extent",String(bounded)),text&&(text.data=source),{tick,text,source,bounded,lower:0,upper:source.length,middle:0,overflow:!1}}),fullWidths=candidates.map(item=>item.tick.getComputedTextLength());candidates.forEach((item,index)=>{item.overflow=!!item.text&&fullWidths[index]>item.bounded});let searching=candidates.filter(item=>item.overflow&&item.source.length>1);for(;searching.length;){for(const item of searching)item.middle=Math.ceil((item.lower+item.upper)/2),item.text.data=`${item.source.slice(0,item.middle)}…`;const widths2=searching.map(item=>item.tick.getComputedTextLength());searching.forEach((item,index)=>{widths2[index]<=item.bounded?item.lower=item.middle:item.upper=item.middle-1}),searching=searching.filter(item=>item.lower<item.upper)}for(const item of candidates)if(item.text){if(item.overflow){const last=item.source.charCodeAt(item.lower-1);last>=55296&&last<=56319&&item.lower--,item.text.data=item.source.length?`${item.source.slice(0,item.lower)}…`:""}item.text.data===item.source?item.tick.removeAttribute("aria-label"):item.tick.setAttribute("aria-label",item.source)}return candidates.map(item=>item.tick.getComputedTextLength())}fitCategoryLabels(){if(!this.ownerDocument?.defaultView||!this.isConnected||!this.svgEl?.getClientRects().length)return;const ticks=[...this.svgEl.querySelectorAll('[part="axis-label"][data-full-label]')].filter(tick=>hasCategoryLabelText(tick.getAttribute("data-full-label"))).sort((a,b)=>Number(a.getAttribute("x"))-Number(b.getAttribute("x"))),count=ticks.length;if(count===0)return;const MARGIN=BAR_CORNER_RADIUS,positionOf=tick=>Number(tick.getAttribute("x"))||0,anchorOf=tick=>tick.getAttribute("text-anchor")??"middle",first=ticks[0],last=ticks[count-1],firstIsBoundary=count>1&&anchorOf(first)!=="middle",lastIsBoundary=count>1&&anchorOf(last)!=="middle";let firstRightEdge=positionOf(first),lastLeftEdge=positionOf(last);if(firstIsBoundary&&lastIsBoundary&&count===2){const half=Math.max(0,(positionOf(last)-positionOf(first))/2-MARGIN);firstRightEdge=this.fitOneCategoryLabel(first,positionOf(first),anchorOf(first),half),lastLeftEdge=this.fitOneCategoryLabel(last,positionOf(last),anchorOf(last),half)}else{if(firstIsBoundary){const gap=positionOf(ticks[1])-positionOf(first);firstRightEdge=this.fitOneCategoryLabel(first,positionOf(first),anchorOf(first),gap-MARGIN)}if(lastIsBoundary){const gap=positionOf(last)-positionOf(ticks[count-2]);lastLeftEdge=this.fitOneCategoryLabel(last,positionOf(last),anchorOf(last),gap-MARGIN)}}const interiors=[];for(let index=0;index<count;index++){if(index===0&&firstIsBoundary||index===count-1&&lastIsBoundary)continue;const tick=ticks[index],x=positionOf(tick),leftAvailable=index===0?MAX_SCROLL_CONTENT_WIDTH:index===1&&firstIsBoundary?x-firstRightEdge:(x-positionOf(ticks[index-1]))/2,rightAvailable=index===count-1?MAX_SCROLL_CONTENT_WIDTH:index===count-2&&lastIsBoundary?lastLeftEdge-x:(positionOf(ticks[index+1])-x)/2,extent=2*Math.min(leftAvailable,rightAvailable)-MARGIN;interiors.push({tick,extent})}this.fitCategoryBatch(interiors)}syncAxisTitleTargets(){if(!this.resizeObserver||!this.svgEl)return;const current=new Set(this.svgEl.querySelectorAll('[part="axis-title"]'));for(const title of this.axisTitleTargets)current.has(title)||this.resizeObserver.unobserve(title);for(const title of current)this.axisTitleTargets.has(title)||this.resizeObserver.observe(title);this.axisTitleTargets=current}queueAxisTitleFit(){const document=this.resizeObserverDocument,window=document?.defaultView;if(!window||this.axisTitleFrame!==void 0)return;const generation=this.resizeObserverGeneration,frame=window.requestAnimationFrame(()=>{this.axisTitleFrame!==frame||this.resizeObserverGeneration!==generation||!this.isConnected||this.ownerDocument!==document||(this.axisTitleFrame=void 0,this.fitAxisTitles())});this.axisTitleFrame=frame}colorFor(index,series){return sanitizeCssColor(series.color)??DEFAULT_PALETTE[index%DEFAULT_PALETTE.length]}get effectiveType(){return normalizeLiteChartType(this.type)}forcedColors(){return this.forcedColorsMemo??=forcedColorsActive(this.ownerDocument?.defaultView)}markPaint(index,series){const color=this.colorFor(index,series);return this.effectiveType==="bar"&&this.forcedColors()?`url(#${this.forcedColorPatternId}-${index})`:color}legendEncoding(index){return this.forcedColors()?forcedColorEncoding(index).name:nothing}markDash(index){if(!this.forcedColors())return nothing;const dash=forcedColorEncoding(index).dash;return dash.length?dash.join(" "):"none"}renderForcedColorPatterns(){if(this.effectiveType!=="bar"||!this.forcedColors())return nothing;const size=8,half=size/2,texture="var(--lr-color-surface)";return svg`<defs>
3
+ `)}attributeChangedCallback(name,oldValue,value){super.attributeChangedCallback(name,oldValue,value),oldValue!==value&&(name==="style"||name==="class")&&(this.fitAxisTitles(),this.fitCategoryLabels())}connectedCallback(){super.connectedCallback(),this.requestUpdate(),this.armResizeObserver()}armResizeObserver(){const target=this.svgEl,ownerDocument=this.ownerDocument;if(!this.isConnected||!target||this.resizeObserver&&this.resizeObserverDocument===ownerDocument&&this.resizeObserverTarget===target)return;this.resetResizeObserver();const ResizeObserverCtor=ownerDocument.defaultView?.ResizeObserver;if(!ResizeObserverCtor)return;const generation=this.resizeObserverGeneration,observer=new ResizeObserverCtor(entries=>{if(this.resizeObserver!==observer||this.resizeObserverGeneration!==generation||!this.isConnected||this.ownerDocument!==ownerDocument||this.resizeObserverTarget!==target)return;const svgEntry=entries.find(entry=>entry.target===target);if(svgEntry){const box=svgEntry.contentBoxSize?.[0];if(box)this.plotWidth=box.inlineSize,this.plotHeight=box.blockSize;else{const rect=target.getBoundingClientRect();this.plotWidth=rect.width,this.plotHeight=rect.height}}entries.some(entry=>this.axisTitleTargets.has(entry.target))&&this.queueAxisTitleFit()});this.resizeObserver=observer,this.resizeObserverDocument=ownerDocument,this.resizeObserverTarget=target,target&&observer.observe(target),this.syncAxisTitleTargets()}disconnectedCallback(){this.preparedRequests.refresh(),this.preparedModel=this.preparedBaseModel=void 0,this.preparedEffective=void 0,this.preparedDirty=!0,this.clearDeferredTable(),this.chartSync.disconnect(),super.disconnectedCallback(),this.lastDataTruncationAnnouncement="",this.isMounting=!0,this.resetResizeObserver()}adoptedCallback(){this.preparedRequests.adopted(),this.clearDeferredTable(),this.chartSync.disconnect(),super.adoptedCallback(),this.requestUpdate(),this.resetResizeObserver(),this.announcements.adopted(),this.isConnected?this.themeWatcher.hostConnected():this.themeWatcher.hostDisconnected(),this.refreshFitMeasurementAvailability()}resetResizeObserver(){this.axisTitleFrame!==void 0&&(this.resizeObserverDocument?.defaultView?.cancelAnimationFrame(this.axisTitleFrame),this.axisTitleFrame=void 0),this.axisTitleTargets.clear(),this.resizeObserverGeneration+=1,this.resizeObserver?.disconnect(),this.resizeObserver=void 0,this.resizeObserverDocument=void 0,this.resizeObserverTarget=void 0}firstUpdated(changed){super.firstUpdated(changed),this.armResizeObserver()}willUpdate(changed){super.willUpdate(changed),this.refreshPreparedModel();const shouldSync=this.preparedModel?.kind!=="series"&&this.isConnected&&typeof this.syncGroup=="string"&&this.syncGroup.trim()!=="";if(this.chartSync.enabled!==shouldSync&&this.chartSync.update(this.syncGroup,shouldSync),this.seedFirstRenderState(()=>{this.refreshFitMeasurementAvailability()}),!(this.preparedChanged||["type","labels","datasets","skipZero","maxRecords","plotWidth","layout"].some(name=>changed.has(name))))return;const active=shadowFocusTarget(this)??null,hadFocusedMark=active?.matches('[part="bar"], [part="point"]')??!1,priorPosition=Number(active?.getAttribute("data-mark-index")??this.activeMarkIndex),datasetAttribute=active?.getAttribute("data-dataset-index"),indexAttribute=active?.getAttribute("data-index"),datasetIndex=Number(datasetAttribute),index=Number(indexAttribute),marks=this.interactiveMarks(),sameIdentity=datasetAttribute!=null&&indexAttribute!==null&&indexAttribute!==void 0?marks.findIndex(mark=>mark.datasetIndex===datasetIndex&&mark.index===index):-1;this.activeMarkIndex=marks.length?sameIdentity>=0?sameIdentity:Math.min(Math.max(priorPosition,0),marks.length-1):0,this.refocusMarkAfterUpdate=hadFocusedMark&&marks.length>0,this.refocusChartAfterUpdate=hadFocusedMark&&marks.length===0}updated(changed){super.updated(changed);const wasMounting=this.isMounting;if(this.preparedChanged=!1,this.setAttribute("aria-busy",String(this.preparedPending)),!wasMounting&&this.preparedInvalid&&!this.announcedPreparedInvalid&&this.announcements.announceAssertive(this.localize("chartPreparedUnavailable")),this.announcedPreparedInvalid=this.preparedInvalid,this.isMounting=!1,changed.has("height")){const height=sanitizeCssLength(this.height,"height");height?this.style.setProperty("--_lr-chart-height",height):this.style.removeProperty("--_lr-chart-height")}const inputLimit=this.inputLimitMessage(),sampling=this.dataTruncationMessage(),dataTruncation=inputLimit&&sampling?[inputLimit,sampling].join(this.localize("chartSummarySeparator")):inputLimit||sampling;wasMounting?this.lastDataTruncationAnnouncement=dataTruncation:dataTruncation!==this.lastDataTruncationAnnouncement&&(this.lastDataTruncationAnnouncement=dataTruncation,dataTruncation&&this.announcements.announcePolite(dataTruncation)),this.refocusMarkAfterUpdate&&(this.refocusMarkAfterUpdate=!1,this.renderRoot.querySelectorAll('[part="bar"], [part="point"]')[this.normalizedMarkIndex()]?.focus()),this.refocusChartAfterUpdate&&(this.refocusChartAfterUpdate=!1,this.svgEl?.focus()),(changed.size===0||[...changed.keys()].some(name=>!["selectedIndices","dataTableExpandedOverride","dataTable","dataTableToggle","description","label"].includes(String(name))))&&(this.fitAxisTitles(),this.fitCategoryLabels()),this.syncAxisTitleTargets();const dataChanged=["datasets","labels","type","skipZero","layout","maxRecords","maxSeries"].some(name=>changed.has(name));this.chartSync.update(this.syncGroup,this.preparedModel?.kind!=="series",dataChanged)}fitAxisTitles(){if(!(!this.ownerDocument?.defaultView||!this.isConnected||!this.svgEl?.getClientRects().length))for(const title of this.svgEl.querySelectorAll('[part="axis-title"]')){const text=Array.from(title.childNodes).find(node=>node.nodeType===3);if(!text)continue;const source=title.getAttribute("aria-label")??"",extent=finiteRange(Number(title.getAttribute("data-title-extent")),0,0,MAX_SCROLL_CONTENT_WIDTH),previous=this.axisTitleFits.get(title);if(!(previous?.source===source&&previous.extent===extent&&previous.display===text.data&&previous.width===title.getComputedTextLength())){if(title.style.removeProperty("opacity"),text.data=source,title.getComputedTextLength()>extent)if(text.data="…",title.getComputedTextLength()>extent)title.style.opacity="0";else{let lower=0,upper=source.length;for(;lower<upper;){const middle=Math.ceil((lower+upper)/2);text.data=`${source.slice(0,middle)}…`,title.getComputedTextLength()<=extent?lower=middle:upper=middle-1}const last=source.charCodeAt(lower-1);last>=55296&&last<=56319&&(lower-=1),text.data=`${source.slice(0,lower)}…`}this.axisTitleFits.set(title,{source,extent,display:text.data,width:title.getComputedTextLength()})}}}fitOneCategoryLabel(tick,x,anchor,extent){const width=this.fitCategoryBatch([{tick,extent}])[0]??0;return anchor==="start"?x+width:anchor==="end"?x-width:x}fitCategoryBatch(items){const candidates=items.map(({tick,extent})=>{const text=Array.from(tick.childNodes).find(node=>node.nodeType===3),source=tick.getAttribute("data-full-label")??"",bounded=finiteRange(extent,0,0,MAX_SCROLL_CONTENT_WIDTH);return tick.setAttribute("data-label-extent",String(bounded)),text&&(text.data=source),{tick,text,source,bounded,lower:0,upper:source.length,middle:0,overflow:!1}}),fullWidths=candidates.map(item=>item.tick.getComputedTextLength());candidates.forEach((item,index)=>{item.overflow=!!item.text&&fullWidths[index]>item.bounded});let searching=candidates.filter(item=>item.overflow&&item.source.length>1);for(;searching.length;){for(const item of searching)item.middle=Math.ceil((item.lower+item.upper)/2),item.text.data=`${item.source.slice(0,item.middle)}…`;const widths2=searching.map(item=>item.tick.getComputedTextLength());searching.forEach((item,index)=>{widths2[index]<=item.bounded?item.lower=item.middle:item.upper=item.middle-1}),searching=searching.filter(item=>item.lower<item.upper)}for(const item of candidates)if(item.text&&item.overflow){const last=item.source.charCodeAt(item.lower-1);last>=55296&&last<=56319&&item.lower--,item.text.data=item.source.length?`${item.source.slice(0,item.lower)}…`:""}const widths=candidates.map(item=>item.tick.getComputedTextLength());return candidates.forEach((item,index)=>{item.text&&(item.overflow&&widths[index]>item.bounded&&(item.text.data="",widths[index]=0),item.text.data===""&&item.source.length>0?item.tick.setAttribute("role","img"):item.tick.removeAttribute("role"),item.text.data===item.source?item.tick.removeAttribute("aria-label"):item.tick.setAttribute("aria-label",item.source))}),widths}fitCategoryLabels(){if(!this.ownerDocument?.defaultView||!this.isConnected||!this.svgEl?.getClientRects().length)return;const ticks=[...this.svgEl.querySelectorAll('[part="axis-label"][data-full-label]')].filter(tick=>{const hasText=hasCategoryLabelText(tick.getAttribute("data-full-label"));return hasText||(tick.removeAttribute("role"),tick.removeAttribute("aria-label")),hasText}).sort((a,b)=>Number(a.getAttribute("x"))-Number(b.getAttribute("x"))),count=ticks.length;if(count===0)return;const MARGIN=BAR_CORNER_RADIUS,positionOf=tick=>Number(tick.getAttribute("x"))||0,anchorOf=tick=>tick.getAttribute("text-anchor")??"middle",first=ticks[0],last=ticks[count-1],firstIsBoundary=count>1&&anchorOf(first)!=="middle",lastIsBoundary=count>1&&anchorOf(last)!=="middle";let firstRightEdge=positionOf(first),lastLeftEdge=positionOf(last);if(firstIsBoundary&&lastIsBoundary&&count===2){const half=Math.max(0,(positionOf(last)-positionOf(first))/2-MARGIN);firstRightEdge=this.fitOneCategoryLabel(first,positionOf(first),anchorOf(first),half),lastLeftEdge=this.fitOneCategoryLabel(last,positionOf(last),anchorOf(last),half)}else{if(firstIsBoundary){const gap=positionOf(ticks[1])-positionOf(first);firstRightEdge=this.fitOneCategoryLabel(first,positionOf(first),anchorOf(first),gap-MARGIN)}if(lastIsBoundary){const gap=positionOf(last)-positionOf(ticks[count-2]);lastLeftEdge=this.fitOneCategoryLabel(last,positionOf(last),anchorOf(last),gap-MARGIN)}}const interiors=[];for(let index=0;index<count;index++){if(index===0&&firstIsBoundary||index===count-1&&lastIsBoundary)continue;const tick=ticks[index],x=positionOf(tick),leftAvailable=index===0?MAX_SCROLL_CONTENT_WIDTH:index===1&&firstIsBoundary?x-firstRightEdge:(x-positionOf(ticks[index-1]))/2,rightAvailable=index===count-1?MAX_SCROLL_CONTENT_WIDTH:index===count-2&&lastIsBoundary?lastLeftEdge-x:(positionOf(ticks[index+1])-x)/2,extent=2*Math.min(leftAvailable,rightAvailable)-MARGIN;interiors.push({tick,extent})}this.fitCategoryBatch(interiors)}syncAxisTitleTargets(){if(!this.resizeObserver||!this.svgEl)return;const current=new Set(this.svgEl.querySelectorAll('[part="axis-title"]'));for(const title of this.axisTitleTargets)current.has(title)||this.resizeObserver.unobserve(title);for(const title of current)this.axisTitleTargets.has(title)||this.resizeObserver.observe(title);this.axisTitleTargets=current}queueAxisTitleFit(){const document=this.resizeObserverDocument,window=document?.defaultView;if(!window||this.axisTitleFrame!==void 0)return;const generation=this.resizeObserverGeneration,frame=window.requestAnimationFrame(()=>{this.axisTitleFrame!==frame||this.resizeObserverGeneration!==generation||!this.isConnected||this.ownerDocument!==document||(this.axisTitleFrame=void 0,this.fitAxisTitles())});this.axisTitleFrame=frame}colorFor(index,series){return sanitizeCssColor(series.color)??DEFAULT_PALETTE[index%DEFAULT_PALETTE.length]}get effectiveType(){return normalizeLiteChartType(this.type)}forcedColors(){return this.forcedColorsMemo??=forcedColorsActive(this.ownerDocument?.defaultView)}markPaint(index,series){const color=this.colorFor(index,series);return this.effectiveType==="bar"&&this.forcedColors()?`url(#${this.forcedColorPatternId}-${index})`:color}legendEncoding(index){return this.forcedColors()?forcedColorEncoding(index).name:nothing}markDash(index){if(!this.forcedColors())return nothing;const dash=forcedColorEncoding(index).dash;return dash.length?dash.join(" "):"none"}renderForcedColorPatterns(){if(this.effectiveType!=="bar"||!this.forcedColors())return nothing;const size=8,half=size/2,texture="var(--lr-color-surface)";return svg`<defs>
4
4
  ${this.recordSample().seriesIndexes.map(index=>{const series=this.displayDatasets[index],encoding=forcedColorEncoding(index).name,shapes=(()=>{switch(encoding){case"horizontal":return svg`<rect y=${half} width=${size} height="1" fill=${texture}></rect>`;case"vertical":return svg`<rect x=${half} width="1" height=${size} fill=${texture}></rect>`;case"diagonal":return svg`<path
5
5
  d=${`M${-half},${size} L${half},0 M${half},${size} L${size+half},0`}
6
6
  stroke=${texture}
@@ -11,7 +11,9 @@ export type ChatComposerSelectionDirection=LyraSelectionDirection;
11
11
  /** Arrangement of the `start`/`end` action slots relative to the textarea. `'inline'` is today's
12
12
  * single flex row; `'stacked'` arranges them as a compact rail beside a multi-row textarea;
13
13
  * `'below'` gives the textarea its own full-width line with `start` and `end` on one row under it. */
14
- export type ChatComposerActionsLayout='inline'|'stacked'|'below';export interface LyraChatComposerEventMap{input:InputEvent;change:Event;'lr-invalid':CustomEvent<null>;'lr-input':CustomEvent<{value:string;}>;'lr-change':CustomEvent<{value:string;}>;'lr-stop':CustomEvent<null>;'lr-submit':CustomEvent<{value:string;}>;blur:FocusEvent;focus:FocusEvent;}declare class LyraChatComposerBase extends LyraElement<LyraChatComposerEventMap>{}declare const LyraChatComposer_base:typeof LyraChatComposerBase&(new(...args:any[])=>import("../../../lyra.js").FormAssociatedInterface<string> &import("../../../internal/form-associated.js").FormAssociatedSubclassInterface<string>);
14
+ export type ChatComposerActionsLayout='inline'|'stacked'|'below';
15
+ /** Placement of caller-supplied toolbar controls inside the composer frame.*/
16
+ export type ChatComposerToolbarPlacement='above'|'actions';export interface LyraChatComposerEventMap{input:InputEvent;change:Event;'lr-invalid':CustomEvent<null>;'lr-input':CustomEvent<{value:string;}>;'lr-change':CustomEvent<{value:string;}>;'lr-stop':CustomEvent<null>;'lr-submit':CustomEvent<{value:string;}>;blur:FocusEvent;focus:FocusEvent;}declare class LyraChatComposerBase extends LyraElement<LyraChatComposerEventMap>{}declare const LyraChatComposer_base:typeof LyraChatComposerBase&(new(...args:any[])=>import("../../../lyra.js").FormAssociatedInterface<string> &import("../../../internal/form-associated.js").FormAssociatedSubclassInterface<string>);
15
17
  /**
16
18
  * `<lr-chat-composer>` — the message input for a chat/agent conversation
17
19
  * surface: an auto-resizing textarea plus a send/stop button. Form-
@@ -59,8 +61,9 @@ export type ChatComposerActionsLayout='inline'|'stacked'|'below';export interfac
59
61
  *
60
62
  * @customElement lr-chat-composer
61
63
  * @slot toolbar - Auxiliary controls (e.g. a model or provider picker) rendered inside the frame,
62
- * above the chips tray and input row, sharing `[part="base"]`'s `:focus-within` affordance.
63
- * @slot start - Content rendered before the textarea (e.g. an attach-file trigger button).
64
+ * above the chips tray and input row by default, or between start and end below the textarea
65
+ * with toolbar-placement="actions" and actions-layout="below", sharing `[part="base"]`'s `:focus-within` affordance.
66
+ * @slot start - Content at the logical start of the input/action layout (e.g. an attach-file trigger).
64
67
  * @slot chips - An attachment tray rendered above the input row (e.g. files queued for this message).
65
68
  * @slot end - Overrides the built-in send/stop button entirely when it has assigned content.
66
69
  * @event input - One realm-correct native `InputEvent` relayed from the textarea for each user edit.
@@ -76,10 +79,11 @@ export type ChatComposerActionsLayout='inline'|'stacked'|'below';export interfac
76
79
  * @csspart base - The bordered root container. Drops its card chrome (border, background, padding,
77
80
  * radius) under `frame="plain"`, where the focus affordance becomes an underline on this same
78
81
  * part instead of the border-color shift.
79
- * @csspart toolbar - The wrapper around the `toolbar` slot. Hidden entirely when empty, matching
80
- * `start`/`chips`.
82
+ * @csspart toolbar - The toolbar wrapper, above attachments by default or in the bottom action row
83
+ * with toolbar-placement="actions" and actions-layout="below". Hidden entirely when empty.
81
84
  * @csspart chips - The wrapper around the `chips` slot. Hidden entirely when the slot is empty.
82
- * @csspart row - The row holding the start slot, textarea, and end slot/button.
85
+ * @csspart row - The input/action layout holding the textarea, start and end, plus the toolbar
86
+ * when toolbar-placement="actions" and actions-layout="below".
83
87
  * @csspart start - The wrapper around the `start` slot. Hidden entirely when empty.
84
88
  * @csspart textarea - The auto-resizing `<textarea>` itself.
85
89
  * @csspart end - The wrapper around the `end` slot and the built-in `action-button`.
@@ -128,7 +132,13 @@ frame:ChatComposerFrame;private actionsLayoutValue;
128
132
  * `max-rows` growth and inner scrolling are unchanged. Layout only; slot content, empty-slot
129
133
  * hiding and the built-in button are unchanged. Invalid direct or attribute values normalize and
130
134
  * reflect as `'inline'`. */
131
- get actionsLayout():ChatComposerActionsLayout;set actionsLayout(next:ChatComposerActionsLayout);
135
+ get actionsLayout():ChatComposerActionsLayout;set actionsLayout(next:ChatComposerActionsLayout);private toolbarPlacementValue;
136
+ /** Toolbar position. `'above'` keeps controls above attachments. `'actions'` places them between
137
+ * start and end below the textarea only with `actionsLayout='below'`; other layouts retain the
138
+ * upper toolbar. Invalid or removed values normalize to `'above'`.
139
+ * @default 'above'
140
+ */
141
+ get toolbarPlacement():ChatComposerToolbarPlacement;set toolbarPlacement(next:ChatComposerToolbarPlacement);private get toolbarInActions();private renderedToolbarInActions;private placementFocusRepair;
132
142
  /** Turns off Enter-to-send: plain Enter inserts a newline, as Shift+Enter always does.*/
133
143
  withoutEnterSubmit:boolean;
134
144
  /** Consumer-controlled validation gate for submission. While idle, disables the built-in Send
@@ -158,4 +168,4 @@ wrap:ChatComposerWrap;autocomplete:string;inputMode:string;enterKeyHint:string;p
158
168
  /** The internal native textarea for integrations that require direct DOM access.*/
159
169
  get input():HTMLTextAreaElement|null;get selectionStart():number|null;set selectionStart(value:number|null);get selectionEnd():number|null;set selectionEnd(value:number|null);get selectionDirection():ChatComposerSelectionDirection|null;set selectionDirection(value:ChatComposerSelectionDirection|null);focus(options?:FocusOptions):void;blur():void;
160
170
  /** Focuses the primary textarea, matching activation of the wrapped native control.*/
161
- click():void;select():void;setSelectionRange(start:number|null,end:number|null,direction?:ChatComposerSelectionDirection):void;setRangeText(replacement:string):void;setRangeText(replacement:string,start:number,end:number,selectMode?:SelectionMode):void;protected willUpdate(changed:PropertyValues):void;protected firstUpdated(changed:PropertyValues):void;connectedCallback():void;disconnectedCallback():void;adoptedCallback():void;protected updated(changed:PropertyValues):void;protected updateValidity():void;formResetCallback():void;private hasSlotted;private resizeTextarea;private armTextareaResizeObserver;private resetTextareaResizeWork;private onTextareaInput;private onTextareaChange;private onTextareaKeyDown;private onActionClick;private submit;private syncToolbarSlot;private syncStartSlot;private onChipsSlotChange;private syncEndSlot;private onTextareaBlur;private onTextareaFocus;private renderActionButton;render():TemplateResult;}declare global{interface HTMLElementTagNameMap{'lr-chat-composer':LyraChatComposer;}}
171
+ click():void;select():void;setSelectionRange(start:number|null,end:number|null,direction?:ChatComposerSelectionDirection):void;setRangeText(replacement:string):void;setRangeText(replacement:string,start:number,end:number,selectMode?:SelectionMode):void;protected willUpdate(changed:PropertyValues):void;protected firstUpdated(changed:PropertyValues):void;connectedCallback():void;disconnectedCallback():void;adoptedCallback():void;protected updated(changed:PropertyValues):void;protected updateValidity():void;formResetCallback():void;private hasSlotted;private resizeTextarea;private armTextareaResizeObserver;private resetTextareaResizeWork;private onTextareaInput;private onTextareaChange;private onTextareaKeyDown;private onActionClick;private submit;private syncToolbarSlot;private syncStartSlot;private onChipsSlotChange;private syncEndSlot;private onTextareaBlur;private onTextareaFocus;private renderActionButton;private renderToolbar;private renderStart;render():TemplateResult;}declare global{interface HTMLElementTagNameMap{'lr-chat-composer':LyraChatComposer;}}
@@ -1,4 +1,4 @@
1
- import{__decorate}from"tslib";import{setNativeRangeText,nativeAutocorrectAttribute}from"../../../internal/native-text-control.js";import{html,nothing}from"lit";import{property,state,query}from"lit/decorators.js";import{LyraElement}from"../../../internal/lyra-element.js";import{sendIcon,stopIcon}from"../../../internal/icons.js";import{FormAssociated,isBarredFromValidation}from"../../../internal/form-associated.js";import{SET_ANCHORED_VALIDITY}from"../../../internal/anchored-validity.js";import{lengthLimitConverter,lengthViolations,normalizeLengthLimit}from"../../../internal/length-constraints.js";import{finiteInteger}from"../../../internal/numbers.js";import{styles}from"./chat-composer.styles.js";import{normalizeChatComposerStatus}from"./chat-composer-status.js";import{CHAT_COMPOSER_STATUSES,normalizeChatComposerStatus as normalizeChatComposerStatus2}from"./chat-composer-status.js";import{autocorrectConverter,literalSetConverter,normalizeAutocorrect,trueDefaultBooleanConverter}from"../../../internal/converters.js";import{relayNativeEvent}from"../../../internal/native-event-relay.js";import{acquireResolvedAriaRelationship}from"../../../internal/aria-controls.js";import{LYRA_DEFAULT_composerLabel,LYRA_DEFAULT_sendMessage,LYRA_DEFAULT_stopGenerating}from"../../../internal/default-strings/conversation.generated.js";import{LYRA_DEFAULT_fieldRequired,LYRA_DEFAULT_valueInvalid}from"../../../internal/default-strings/shared.generated.js";const CHAT_COMPOSER_ACTIONS_LAYOUT=literalSetConverter(["inline","stacked","below"],"inline");class LyraChatComposerBase extends LyraElement{}class LyraChatComposer extends FormAssociated(LyraChatComposerBase){static{this.defaultStrings={...super.defaultStrings,composerLabel:LYRA_DEFAULT_composerLabel,fieldRequired:LYRA_DEFAULT_fieldRequired,sendMessage:LYRA_DEFAULT_sendMessage,stopGenerating:LYRA_DEFAULT_stopGenerating,valueInvalid:LYRA_DEFAULT_valueInvalid}}static{this.styles=[LyraElement.styles,styles]}get status(){return this.statusValue}set status(value){const previous=this.statusValue,normalized=normalizeChatComposerStatus(value);this.statusValue=normalized,typeof value=="string"&&value!==normalized&&this.getAttribute("status")!==normalized&&this.setAttribute("status",normalized),this.requestUpdate("status",previous,{reflect:!0,hasChanged:()=>!0})}get actionsLayout(){return this.actionsLayoutValue}set actionsLayout(next){const normalized=CHAT_COMPOSER_ACTIONS_LAYOUT.normalizeReflected(this,"actions-layout",next),previous=this.actionsLayoutValue;previous!==normalized&&(this.actionsLayoutValue=normalized,this.requestUpdate("actionsLayout",previous))}get autocorrect(){return this.autocorrectValue}set autocorrect(next){this.autocorrectValue=normalizeAutocorrect(next),this.requestUpdate()}get effectiveMinRows(){return finiteInteger(this.minRows,1,1)}get effectiveMaxRows(){return Math.max(this.effectiveMinRows,finiteInteger(this.maxRows,this.effectiveMinRows,1))}constructor(){super(),this.placeholder="",this.minRows=1,this.maxRows=8,this.statusValue="idle",this.frame="card",this.actionsLayoutValue="inline",this.withoutEnterSubmit=!1,this.submitDisabled=!1,this.withoutStop=!1,this.readOnly=!1,this.accessibleLabel=null,this.spellcheck=!0,this.autocapitalize="",this.autocorrectValue=!0,this.wrap="soft",this.autocomplete="",this.inputMode="",this.enterKeyHint="",this.hasToolbarSlot=!1,this.hasStartSlot=!1,this.hasChipsSlot=!1,this.hasEndSlot=!1,this.touched=!1,this.textareaResizeGeneration=0,this.onTextareaInput=event=>{if(this.effectiveDisabled||this.readOnly){event.stopPropagation();return}this.value=event.target.value,this.resizeTextarea(),relayNativeEvent(this,event),this.emit("lr-input",{value:this.value})},this.onTextareaChange=event=>{if(this.effectiveDisabled||this.readOnly){event.stopPropagation();return}this.value=event.target.value,relayNativeEvent(this,event),this.emit("lr-change",{value:this.value})},this.onTextareaKeyDown=e=>{e.defaultPrevented||e.key==="Enter"&&(e.shiftKey||this.withoutEnterSubmit||e.isComposing||e.keyCode===229||this.status==="idle"&&(e.preventDefault(),this.submit()))},this.onActionClick=()=>{this.effectiveDisabled||(this.status==="idle"?this.submit():this.withoutStop||this.emit("lr-stop",null))},this.syncToolbarSlot=()=>{this.hasToolbarSlot=this.hasSlotted("toolbar")},this.syncStartSlot=()=>{this.hasStartSlot=this.hasSlotted("start")},this.onChipsSlotChange=e=>{this.hasChipsSlot=e.target.assignedElements({flatten:!0}).length>0},this.syncEndSlot=()=>{this.hasEndSlot=this.hasSlotted("end")},this.onTextareaBlur=event=>{this.effectiveDisabled||(this.touched=!0),relayNativeEvent(this,event)},this.onTextareaFocus=event=>{if(this.effectiveDisabled){event.stopPropagation();return}relayNativeEvent(this,event)},this.addEventListener("invalid",()=>{this.touched=!0})}get input(){return this.textareaEl??null}get selectionStart(){return this.textareaEl?.selectionStart??null}set selectionStart(value){this.textareaEl&&(this.textareaEl.selectionStart=value??0)}get selectionEnd(){return this.textareaEl?.selectionEnd??null}set selectionEnd(value){this.textareaEl&&(this.textareaEl.selectionEnd=value??0)}get selectionDirection(){return this.textareaEl?.selectionDirection}set selectionDirection(value){this.textareaEl&&(this.textareaEl.selectionDirection=value??"none")}focus(options){this.textareaEl?.focus(options)}blur(){this.textareaEl?.blur()}click(){this.effectiveDisabled||this.textareaEl?.focus()}select(){this.textareaEl?.select()}setSelectionRange(start,end,direction){this.textareaEl?.setSelectionRange(start,end,direction)}setRangeText(replacement,start,end,selectMode){const textarea=this.textareaEl;textarea&&(setNativeRangeText(textarea,replacement,start,end,selectMode),this.value=textarea.value,this.resizeTextarea())}willUpdate(changed){super.willUpdate(changed),this.seedFirstRenderState(()=>{this.syncToolbarSlot(),this.syncStartSlot(),this.hasChipsSlot=this.hasSlotted("chips"),this.syncEndSlot()})}firstUpdated(changed){super.firstUpdated(changed),this.resizeTextarea(),this.armTextareaResizeObserver(),this.isConnected&&(this.descriptionLease??=acquireResolvedAriaRelationship(this,this.input,"aria-describedby"))}connectedCallback(){super.connectedCallback(),this.hasUpdated&&(this.armTextareaResizeObserver(),this.resizeTextarea(),this.descriptionLease??=acquireResolvedAriaRelationship(this,this.input,"aria-describedby"))}disconnectedCallback(){super.disconnectedCallback(),this.resetTextareaResizeWork(),this.descriptionLease?.release(),this.descriptionLease=void 0}adoptedCallback(){super.adoptedCallback(),this.resetTextareaResizeWork()}updated(changed){super.updated(changed),(changed.has("value")||changed.has("minRows")||changed.has("maxRows"))&&this.resizeTextarea(),(changed.has("minLength")||changed.has("maxLength")||changed.has("readOnly"))&&this.updateValidity()}updateValidity(){if(isBarredFromValidation({effectiveDisabled:this.effectiveDisabled,readonly:this.readOnly},this.internals)){this[SET_ANCHORED_VALIDITY]({});return}if(this.required&&this.value===""){this[SET_ANCHORED_VALIDITY]({valueMissing:!0},this.localize("fieldRequired"));return}const textarea=this.textareaEl;textarea&&textarea.value!==this.value&&(textarea.value=this.value);const own=lengthViolations(this.value,this.minLength,this.maxLength),tooShort=!!textarea?.validity.tooShort||own.tooShort,tooLong=!!textarea?.validity.tooLong||own.tooLong;if(!tooShort&&!tooLong){this[SET_ANCHORED_VALIDITY]({});return}this[SET_ANCHORED_VALIDITY]({tooShort,tooLong},textarea?.validationMessage||this.localize("valueInvalid"))}formResetCallback(){super.formResetCallback(),this.touched=!1}hasSlotted(name){return Array.from(this.children).some(el=>el.getAttribute("slot")===name)}resizeTextarea(){const ta=this.textareaEl;if(!ta)return;const cs=this.ownerDocument.defaultView?.getComputedStyle(ta)??ta.style,lineHeight=parseFloat(cs.lineHeight)||parseFloat(cs.fontSize)*1.2,paddingBlock=parseFloat(cs.paddingTop)+parseFloat(cs.paddingBottom),borderBlock=parseFloat(cs.borderTopWidth)+parseFloat(cs.borderBottomWidth),minRows=this.effectiveMinRows,maxRows=this.effectiveMaxRows,minHeight=lineHeight*minRows+paddingBlock+borderBlock,maxHeight=lineHeight*maxRows+paddingBlock+borderBlock;ta.style.height="auto";const contentHeight=ta.scrollHeight+borderBlock,next=Math.min(Math.max(contentHeight,minHeight),maxHeight);ta.style.height=`${next}px`,ta.style.overflowY=contentHeight>maxHeight?"auto":"hidden"}armTextareaResizeObserver(){const ta=this.textareaEl,ownerDocument=this.ownerDocument,ownerWindow=ownerDocument.defaultView;if(!ta||!this.isConnected||!ownerWindow?.ResizeObserver||this.textareaResizeObserver&&this.textareaResizeObserverDocument===ownerDocument&&this.textareaResizeObserverTarget===ta)return;this.resetTextareaResizeWork();const generation=this.textareaResizeGeneration;let lastWidth=ta.getBoundingClientRect().width;const observer=new ownerWindow.ResizeObserver(entries=>{if(this.textareaResizeObserver!==observer||this.textareaResizeObserverDocument!==ownerDocument||this.textareaResizeObserverTarget!==ta||this.textareaResizeGeneration!==generation||!this.isConnected||this.ownerDocument!==ownerDocument)return;const box=entries[0]?.contentBoxSize?.[0],width=box?box.inlineSize:entries[0]?.contentRect.width??lastWidth;if(Math.abs(width-lastWidth)<.5)return;lastWidth=width,this.textareaResizeRaf!==void 0&&this.textareaResizeRafOwner?.cancelAnimationFrame(this.textareaResizeRaf);const handle=ownerWindow.requestAnimationFrame(()=>{this.textareaResizeRaf!==handle||this.textareaResizeRafOwner!==ownerWindow||this.textareaResizeRafDocument!==ownerDocument||this.textareaResizeGeneration!==generation||!this.isConnected||this.ownerDocument!==ownerDocument||this.textareaResizeObserverTarget!==ta||(this.textareaResizeRaf=void 0,this.textareaResizeRafOwner=void 0,this.textareaResizeRafDocument=void 0,this.resizeTextarea())});this.textareaResizeRaf=handle,this.textareaResizeRafOwner=ownerWindow,this.textareaResizeRafDocument=ownerDocument});this.textareaResizeObserver=observer,this.textareaResizeObserverDocument=ownerDocument,this.textareaResizeObserverTarget=ta,observer.observe(ta)}resetTextareaResizeWork(){this.textareaResizeGeneration+=1,this.textareaResizeObserver?.disconnect(),this.textareaResizeObserver=void 0,this.textareaResizeObserverDocument=void 0,this.textareaResizeObserverTarget=void 0,this.textareaResizeRaf!==void 0&&this.textareaResizeRafOwner?.cancelAnimationFrame(this.textareaResizeRaf),this.textareaResizeRaf=void 0,this.textareaResizeRafOwner=void 0,this.textareaResizeRafDocument=void 0}submit(){this.submitDisabled||this.effectiveDisabled||this.status!=="idle"||this.emit("lr-submit",{value:this.value})}renderActionButton(){const busy=this.status!=="idle",showStop=busy&&!this.withoutStop;return html`
1
+ import{__decorate}from"tslib";import{setNativeRangeText,nativeAutocorrectAttribute}from"../../../internal/native-text-control.js";import{html,nothing}from"lit";import{property,state,query}from"lit/decorators.js";import{LyraElement}from"../../../internal/lyra-element.js";import{sendIcon,stopIcon}from"../../../internal/icons.js";import{FormAssociated,isBarredFromValidation}from"../../../internal/form-associated.js";import{SET_ANCHORED_VALIDITY}from"../../../internal/anchored-validity.js";import{lengthLimitConverter,lengthViolations,normalizeLengthLimit}from"../../../internal/length-constraints.js";import{finiteInteger}from"../../../internal/numbers.js";import{styles}from"./chat-composer.styles.js";import{normalizeChatComposerStatus}from"./chat-composer-status.js";import{CHAT_COMPOSER_STATUSES,normalizeChatComposerStatus as normalizeChatComposerStatus2}from"./chat-composer-status.js";import{autocorrectConverter,literalSetConverter,normalizeAutocorrect,trueDefaultBooleanConverter}from"../../../internal/converters.js";import{deepActiveElementIn}from"../../../internal/active-element.js";import{isHtmlElement}from"../../../internal/dom-guards.js";import{captureComposedFocusRepair,applyComposedFocusRepair}from"../../../internal/focus-navigation.js";import{relayNativeEvent}from"../../../internal/native-event-relay.js";import{acquireResolvedAriaRelationship}from"../../../internal/aria-controls.js";import{LYRA_DEFAULT_composerLabel,LYRA_DEFAULT_sendMessage,LYRA_DEFAULT_stopGenerating}from"../../../internal/default-strings/conversation.generated.js";import{LYRA_DEFAULT_fieldRequired,LYRA_DEFAULT_valueInvalid}from"../../../internal/default-strings/shared.generated.js";const CHAT_COMPOSER_ACTIONS_LAYOUT=literalSetConverter(["inline","stacked","below"],"inline"),CHAT_COMPOSER_TOOLBAR_PLACEMENT=literalSetConverter(["above","actions"],"above");class LyraChatComposerBase extends LyraElement{}class LyraChatComposer extends FormAssociated(LyraChatComposerBase){static{this.defaultStrings={...super.defaultStrings,composerLabel:LYRA_DEFAULT_composerLabel,fieldRequired:LYRA_DEFAULT_fieldRequired,sendMessage:LYRA_DEFAULT_sendMessage,stopGenerating:LYRA_DEFAULT_stopGenerating,valueInvalid:LYRA_DEFAULT_valueInvalid}}static{this.styles=[LyraElement.styles,styles]}get status(){return this.statusValue}set status(value){const previous=this.statusValue,normalized=normalizeChatComposerStatus(value);this.statusValue=normalized,typeof value=="string"&&value!==normalized&&this.getAttribute("status")!==normalized&&this.setAttribute("status",normalized),this.requestUpdate("status",previous,{reflect:!0,hasChanged:()=>!0})}get actionsLayout(){return this.actionsLayoutValue}set actionsLayout(next){const normalized=CHAT_COMPOSER_ACTIONS_LAYOUT.normalizeReflected(this,"actions-layout",next),previous=this.actionsLayoutValue;previous!==normalized&&(this.actionsLayoutValue=normalized,this.requestUpdate("actionsLayout",previous))}get toolbarPlacement(){return this.toolbarPlacementValue}set toolbarPlacement(next){const normalized=CHAT_COMPOSER_TOOLBAR_PLACEMENT.normalizeReflected(this,"toolbar-placement",next);this.hasUpdated&&!this.hasAttribute("toolbar-placement")&&this.setAttribute("toolbar-placement",normalized);const previous=this.toolbarPlacementValue;previous!==normalized&&(this.toolbarPlacementValue=normalized,this.requestUpdate("toolbarPlacement",previous))}get toolbarInActions(){return this.actionsLayout==="below"&&this.toolbarPlacement==="actions"}get autocorrect(){return this.autocorrectValue}set autocorrect(next){this.autocorrectValue=normalizeAutocorrect(next),this.requestUpdate()}get effectiveMinRows(){return finiteInteger(this.minRows,1,1)}get effectiveMaxRows(){return Math.max(this.effectiveMinRows,finiteInteger(this.maxRows,this.effectiveMinRows,1))}constructor(){super(),this.placeholder="",this.minRows=1,this.maxRows=8,this.statusValue="idle",this.frame="card",this.actionsLayoutValue="inline",this.toolbarPlacementValue="above",this.renderedToolbarInActions=!1,this.placementFocusRepair=null,this.withoutEnterSubmit=!1,this.submitDisabled=!1,this.withoutStop=!1,this.readOnly=!1,this.accessibleLabel=null,this.spellcheck=!0,this.autocapitalize="",this.autocorrectValue=!0,this.wrap="soft",this.autocomplete="",this.inputMode="",this.enterKeyHint="",this.hasToolbarSlot=!1,this.hasStartSlot=!1,this.hasChipsSlot=!1,this.hasEndSlot=!1,this.touched=!1,this.textareaResizeGeneration=0,this.onTextareaInput=event=>{if(this.effectiveDisabled||this.readOnly){event.stopPropagation();return}this.value=event.target.value,this.resizeTextarea(),relayNativeEvent(this,event),this.emit("lr-input",{value:this.value})},this.onTextareaChange=event=>{if(this.effectiveDisabled||this.readOnly){event.stopPropagation();return}this.value=event.target.value,relayNativeEvent(this,event),this.emit("lr-change",{value:this.value})},this.onTextareaKeyDown=e=>{e.defaultPrevented||e.key==="Enter"&&(e.shiftKey||this.withoutEnterSubmit||e.isComposing||e.keyCode===229||this.status==="idle"&&(e.preventDefault(),this.submit()))},this.onActionClick=()=>{this.effectiveDisabled||(this.status==="idle"?this.submit():this.withoutStop||this.emit("lr-stop",null))},this.syncToolbarSlot=()=>{this.hasToolbarSlot=this.hasSlotted("toolbar")},this.syncStartSlot=()=>{this.hasStartSlot=this.hasSlotted("start")},this.onChipsSlotChange=e=>{this.hasChipsSlot=e.target.assignedElements({flatten:!0}).length>0},this.syncEndSlot=()=>{this.hasEndSlot=this.hasSlotted("end")},this.onTextareaBlur=event=>{this.effectiveDisabled||(this.touched=!0),relayNativeEvent(this,event)},this.onTextareaFocus=event=>{if(this.effectiveDisabled){event.stopPropagation();return}relayNativeEvent(this,event)},this.requestUpdate("toolbarPlacement",void 0),this.addEventListener("invalid",()=>{this.touched=!0})}get input(){return this.textareaEl??null}get selectionStart(){return this.textareaEl?.selectionStart??null}set selectionStart(value){this.textareaEl&&(this.textareaEl.selectionStart=value??0)}get selectionEnd(){return this.textareaEl?.selectionEnd??null}set selectionEnd(value){this.textareaEl&&(this.textareaEl.selectionEnd=value??0)}get selectionDirection(){return this.textareaEl?.selectionDirection}set selectionDirection(value){this.textareaEl&&(this.textareaEl.selectionDirection=value??"none")}focus(options){this.textareaEl?.focus(options)}blur(){this.textareaEl?.blur()}click(){this.effectiveDisabled||this.textareaEl?.focus()}select(){this.textareaEl?.select()}setSelectionRange(start,end,direction){this.textareaEl?.setSelectionRange(start,end,direction)}setRangeText(replacement,start,end,selectMode){const textarea=this.textareaEl;textarea&&(setNativeRangeText(textarea,replacement,start,end,selectMode),this.value=textarea.value,this.resizeTextarea())}willUpdate(changed){if(super.willUpdate(changed),this.hasUpdated&&this.toolbarInActions!==this.renderedToolbarInActions){const active=deepActiveElementIn(this.ownerDocument);if(isHtmlElement(active)){for(const wrapper of this.renderRoot.querySelectorAll('[part="start"], [part="toolbar"]'))if(this.placementFocusRepair=captureComposedFocusRepair(wrapper,active),this.placementFocusRepair)break}}this.seedFirstRenderState(()=>{this.syncToolbarSlot(),this.syncStartSlot(),this.hasChipsSlot=this.hasSlotted("chips"),this.syncEndSlot()})}firstUpdated(changed){super.firstUpdated(changed),this.resizeTextarea(),this.armTextareaResizeObserver(),this.isConnected&&(this.descriptionLease??=acquireResolvedAriaRelationship(this,this.input,"aria-describedby"))}connectedCallback(){super.connectedCallback(),this.hasUpdated&&(this.armTextareaResizeObserver(),this.resizeTextarea(),this.descriptionLease??=acquireResolvedAriaRelationship(this,this.input,"aria-describedby"))}disconnectedCallback(){super.disconnectedCallback(),this.resetTextareaResizeWork(),this.placementFocusRepair=null,this.descriptionLease?.release(),this.descriptionLease=void 0}adoptedCallback(){super.adoptedCallback(),this.resetTextareaResizeWork()}updated(changed){super.updated(changed),this.renderedToolbarInActions=this.toolbarInActions;const repair=this.placementFocusRepair;this.placementFocusRepair=null,repair&&this.isConnected&&applyComposedFocusRepair(repair),(changed.has("value")||changed.has("minRows")||changed.has("maxRows"))&&this.resizeTextarea(),(changed.has("minLength")||changed.has("maxLength")||changed.has("readOnly"))&&this.updateValidity()}updateValidity(){if(isBarredFromValidation({effectiveDisabled:this.effectiveDisabled,readonly:this.readOnly},this.internals)){this[SET_ANCHORED_VALIDITY]({});return}if(this.required&&this.value===""){this[SET_ANCHORED_VALIDITY]({valueMissing:!0},this.localize("fieldRequired"));return}const textarea=this.textareaEl;textarea&&textarea.value!==this.value&&(textarea.value=this.value);const own=lengthViolations(this.value,this.minLength,this.maxLength),tooShort=!!textarea?.validity.tooShort||own.tooShort,tooLong=!!textarea?.validity.tooLong||own.tooLong;if(!tooShort&&!tooLong){this[SET_ANCHORED_VALIDITY]({});return}this[SET_ANCHORED_VALIDITY]({tooShort,tooLong},textarea?.validationMessage||this.localize("valueInvalid"))}formResetCallback(){super.formResetCallback(),this.touched=!1}hasSlotted(name){return Array.from(this.children).some(el=>el.getAttribute("slot")===name)}resizeTextarea(){const ta=this.textareaEl;if(!ta)return;const cs=this.ownerDocument.defaultView?.getComputedStyle(ta)??ta.style,lineHeight=parseFloat(cs.lineHeight)||parseFloat(cs.fontSize)*1.2,paddingBlock=parseFloat(cs.paddingTop)+parseFloat(cs.paddingBottom),borderBlock=parseFloat(cs.borderTopWidth)+parseFloat(cs.borderBottomWidth),minRows=this.effectiveMinRows,maxRows=this.effectiveMaxRows,minHeight=lineHeight*minRows+paddingBlock+borderBlock,maxHeight=lineHeight*maxRows+paddingBlock+borderBlock;ta.style.height="auto";const contentHeight=ta.scrollHeight+borderBlock,next=Math.min(Math.max(contentHeight,minHeight),maxHeight);ta.style.height=`${next}px`,ta.style.overflowY=contentHeight>maxHeight?"auto":"hidden"}armTextareaResizeObserver(){const ta=this.textareaEl,ownerDocument=this.ownerDocument,ownerWindow=ownerDocument.defaultView;if(!ta||!this.isConnected||!ownerWindow?.ResizeObserver||this.textareaResizeObserver&&this.textareaResizeObserverDocument===ownerDocument&&this.textareaResizeObserverTarget===ta)return;this.resetTextareaResizeWork();const generation=this.textareaResizeGeneration;let lastWidth=ta.getBoundingClientRect().width;const observer=new ownerWindow.ResizeObserver(entries=>{if(this.textareaResizeObserver!==observer||this.textareaResizeObserverDocument!==ownerDocument||this.textareaResizeObserverTarget!==ta||this.textareaResizeGeneration!==generation||!this.isConnected||this.ownerDocument!==ownerDocument)return;const box=entries[0]?.contentBoxSize?.[0],width=box?box.inlineSize:entries[0]?.contentRect.width??lastWidth;if(Math.abs(width-lastWidth)<.5)return;lastWidth=width,this.textareaResizeRaf!==void 0&&this.textareaResizeRafOwner?.cancelAnimationFrame(this.textareaResizeRaf);const handle=ownerWindow.requestAnimationFrame(()=>{this.textareaResizeRaf!==handle||this.textareaResizeRafOwner!==ownerWindow||this.textareaResizeRafDocument!==ownerDocument||this.textareaResizeGeneration!==generation||!this.isConnected||this.ownerDocument!==ownerDocument||this.textareaResizeObserverTarget!==ta||(this.textareaResizeRaf=void 0,this.textareaResizeRafOwner=void 0,this.textareaResizeRafDocument=void 0,this.resizeTextarea())});this.textareaResizeRaf=handle,this.textareaResizeRafOwner=ownerWindow,this.textareaResizeRafDocument=ownerDocument});this.textareaResizeObserver=observer,this.textareaResizeObserverDocument=ownerDocument,this.textareaResizeObserverTarget=ta,observer.observe(ta)}resetTextareaResizeWork(){this.textareaResizeGeneration+=1,this.textareaResizeObserver?.disconnect(),this.textareaResizeObserver=void 0,this.textareaResizeObserverDocument=void 0,this.textareaResizeObserverTarget=void 0,this.textareaResizeRaf!==void 0&&this.textareaResizeRafOwner?.cancelAnimationFrame(this.textareaResizeRaf),this.textareaResizeRaf=void 0,this.textareaResizeRafOwner=void 0,this.textareaResizeRafDocument=void 0}submit(){this.submitDisabled||this.effectiveDisabled||this.status!=="idle"||this.emit("lr-submit",{value:this.value})}renderActionButton(){const busy=this.status!=="idle",showStop=busy&&!this.withoutStop;return html`
2
2
  <button
3
3
  part="action-button"
4
4
  type="button"
@@ -10,18 +10,18 @@ import{__decorate}from"tslib";import{setNativeRangeText,nativeAutocorrectAttribu
10
10
  ${showStop?stopIcon():sendIcon()}
11
11
  </span>
12
12
  </button>
13
- `}render(){return html`
13
+ `}renderToolbar(){return html`<div part="toolbar" ?hidden=${!this.hasToolbarSlot}>
14
+ <slot name="toolbar" @slotchange=${this.syncToolbarSlot}></slot>
15
+ </div>`}renderStart(){return html`<span part="start" ?hidden=${!this.hasStartSlot}>
16
+ <slot name="start" @slotchange=${this.syncStartSlot}></slot>
17
+ </span>`}render(){return html`
14
18
  <div part="base">
15
- <div part="toolbar" ?hidden=${!this.hasToolbarSlot}>
16
- <slot name="toolbar" @slotchange=${this.syncToolbarSlot}></slot>
17
- </div>
19
+ ${this.toolbarInActions?nothing:this.renderToolbar()}
18
20
  <div part="chips" ?hidden=${!this.hasChipsSlot}>
19
21
  <slot name="chips" @slotchange=${this.onChipsSlotChange}></slot>
20
22
  </div>
21
23
  <div part="row">
22
- <span part="start" ?hidden=${!this.hasStartSlot}>
23
- <slot name="start" @slotchange=${this.syncStartSlot}></slot>
24
- </span>
24
+ ${this.toolbarInActions?nothing:this.renderStart()}
25
25
  <textarea
26
26
  part="textarea"
27
27
  aria-label=${this.accessibleLabel??(this.placeholder||this.localize("composerLabel"))}
@@ -48,10 +48,12 @@ import{__decorate}from"tslib";import{setNativeRangeText,nativeAutocorrectAttribu
48
48
  @focus=${this.onTextareaFocus}
49
49
  @blur=${this.onTextareaBlur}
50
50
  ></textarea>
51
+ ${this.toolbarInActions?this.renderStart():nothing}
52
+ ${this.toolbarInActions?this.renderToolbar():nothing}
51
53
  <span part="end">
52
54
  <slot name="end" @slotchange=${this.syncEndSlot}></slot>
53
55
  ${this.hasEndSlot?nothing:this.renderActionButton()}
54
56
  </span>
55
57
  </div>
56
58
  </div>
57
- `}}__decorate([property()],LyraChatComposer.prototype,"placeholder",void 0),__decorate([property({type:Number,attribute:"min-rows"})],LyraChatComposer.prototype,"minRows",void 0),__decorate([property({type:Number,attribute:"max-rows"})],LyraChatComposer.prototype,"maxRows",void 0),__decorate([property({reflect:!0})],LyraChatComposer.prototype,"status",null),__decorate([property({reflect:!0})],LyraChatComposer.prototype,"frame",void 0),__decorate([property({reflect:!0,attribute:"actions-layout",converter:CHAT_COMPOSER_ACTIONS_LAYOUT})],LyraChatComposer.prototype,"actionsLayout",null),__decorate([property({type:Boolean,reflect:!0,attribute:"without-enter-submit"})],LyraChatComposer.prototype,"withoutEnterSubmit",void 0),__decorate([property({type:Boolean,reflect:!0,attribute:"submit-disabled"})],LyraChatComposer.prototype,"submitDisabled",void 0),__decorate([property({type:Boolean,reflect:!0,attribute:"without-stop"})],LyraChatComposer.prototype,"withoutStop",void 0),__decorate([property({type:Boolean,reflect:!0,attribute:"readonly"})],LyraChatComposer.prototype,"readOnly",void 0),__decorate([property({converter:lengthLimitConverter,attribute:"minlength"})],LyraChatComposer.prototype,"minLength",void 0),__decorate([property({converter:lengthLimitConverter,attribute:"maxlength"})],LyraChatComposer.prototype,"maxLength",void 0),__decorate([property({attribute:"aria-label"})],LyraChatComposer.prototype,"accessibleLabel",void 0),__decorate([property({converter:trueDefaultBooleanConverter})],LyraChatComposer.prototype,"spellcheck",void 0),__decorate([property()],LyraChatComposer.prototype,"autocapitalize",void 0),__decorate([property({converter:autocorrectConverter})],LyraChatComposer.prototype,"autocorrect",null),__decorate([property()],LyraChatComposer.prototype,"wrap",void 0),__decorate([property()],LyraChatComposer.prototype,"autocomplete",void 0),__decorate([property({attribute:"inputmode"})],LyraChatComposer.prototype,"inputMode",void 0),__decorate([property({attribute:"enterkeyhint"})],LyraChatComposer.prototype,"enterKeyHint",void 0),__decorate([state()],LyraChatComposer.prototype,"hasToolbarSlot",void 0),__decorate([state()],LyraChatComposer.prototype,"hasStartSlot",void 0),__decorate([state()],LyraChatComposer.prototype,"hasChipsSlot",void 0),__decorate([state()],LyraChatComposer.prototype,"hasEndSlot",void 0),__decorate([state()],LyraChatComposer.prototype,"touched",void 0),__decorate([query("textarea")],LyraChatComposer.prototype,"textareaEl",void 0);export{CHAT_COMPOSER_STATUSES,LyraChatComposer,normalizeChatComposerStatus2 as normalizeChatComposerStatus};
59
+ `}}__decorate([property()],LyraChatComposer.prototype,"placeholder",void 0),__decorate([property({type:Number,attribute:"min-rows"})],LyraChatComposer.prototype,"minRows",void 0),__decorate([property({type:Number,attribute:"max-rows"})],LyraChatComposer.prototype,"maxRows",void 0),__decorate([property({reflect:!0})],LyraChatComposer.prototype,"status",null),__decorate([property({reflect:!0})],LyraChatComposer.prototype,"frame",void 0),__decorate([property({reflect:!0,attribute:"actions-layout",converter:CHAT_COMPOSER_ACTIONS_LAYOUT})],LyraChatComposer.prototype,"actionsLayout",null),__decorate([property({reflect:!0,attribute:"toolbar-placement",converter:CHAT_COMPOSER_TOOLBAR_PLACEMENT})],LyraChatComposer.prototype,"toolbarPlacement",null),__decorate([property({type:Boolean,reflect:!0,attribute:"without-enter-submit"})],LyraChatComposer.prototype,"withoutEnterSubmit",void 0),__decorate([property({type:Boolean,reflect:!0,attribute:"submit-disabled"})],LyraChatComposer.prototype,"submitDisabled",void 0),__decorate([property({type:Boolean,reflect:!0,attribute:"without-stop"})],LyraChatComposer.prototype,"withoutStop",void 0),__decorate([property({type:Boolean,reflect:!0,attribute:"readonly"})],LyraChatComposer.prototype,"readOnly",void 0),__decorate([property({converter:lengthLimitConverter,attribute:"minlength"})],LyraChatComposer.prototype,"minLength",void 0),__decorate([property({converter:lengthLimitConverter,attribute:"maxlength"})],LyraChatComposer.prototype,"maxLength",void 0),__decorate([property({attribute:"aria-label"})],LyraChatComposer.prototype,"accessibleLabel",void 0),__decorate([property({converter:trueDefaultBooleanConverter})],LyraChatComposer.prototype,"spellcheck",void 0),__decorate([property()],LyraChatComposer.prototype,"autocapitalize",void 0),__decorate([property({converter:autocorrectConverter})],LyraChatComposer.prototype,"autocorrect",null),__decorate([property()],LyraChatComposer.prototype,"wrap",void 0),__decorate([property()],LyraChatComposer.prototype,"autocomplete",void 0),__decorate([property({attribute:"inputmode"})],LyraChatComposer.prototype,"inputMode",void 0),__decorate([property({attribute:"enterkeyhint"})],LyraChatComposer.prototype,"enterKeyHint",void 0),__decorate([state()],LyraChatComposer.prototype,"hasToolbarSlot",void 0),__decorate([state()],LyraChatComposer.prototype,"hasStartSlot",void 0),__decorate([state()],LyraChatComposer.prototype,"hasChipsSlot",void 0),__decorate([state()],LyraChatComposer.prototype,"hasEndSlot",void 0),__decorate([state()],LyraChatComposer.prototype,"touched",void 0),__decorate([query("textarea")],LyraChatComposer.prototype,"textareaEl",void 0);export{CHAT_COMPOSER_STATUSES,LyraChatComposer,normalizeChatComposerStatus2 as normalizeChatComposerStatus};
@@ -1 +1 @@
1
- import{iconHitTarget,focusRing}from"../../../internal/interactive-control.styles.js";import{css}from"lit";const styles=css` :host { display: block; } [part='base'] { display: flex; flex-direction: column; gap: var(--lr-chat-composer-gap, var(--lr-space-xs)); box-sizing: border-box; border: var(--lr-border-width-thin) solid var(--lr-chat-composer-border-color, var(--lr-color-border)); border-radius: var(--lr-chat-composer-radius, var(--lr-radius)); background: var(--lr-chat-composer-bg, var(--lr-color-surface)); padding: var(--lr-chat-composer-padding, var(--lr-space-s)); transition: border-color var(--lr-transition-fast); } [part='base']:focus-within { border-color: var(--lr-color-brand); } :host([frame='plain']) [part='base'] { padding: 0; border: 0; border-radius: 0; background: transparent; } :host([frame='plain']) [part='base']:focus-within { box-shadow: var( --lr-chat-composer-focus-shadow, inset 0 calc(-1 * var(--lr-focus-ring-width)) 0 0 var(--lr-focus-ring-color) ); } :host(:disabled) [part='base'] { opacity: var(--lr-opacity-disabled); cursor: not-allowed; } [part='toolbar'] { display: flex; flex-wrap: wrap; align-items: center; gap: var(--lr-space-xs); } [part='toolbar'][hidden] { display: none; } [part='chips'] { display: flex; flex-wrap: wrap; gap: var(--lr-space-xs); } [part='chips'][hidden] { display: none; } [part='row'] { display: flex; align-items: flex-end; gap: var(--lr-space-s); } [part='start'] { display: flex; flex: 0 0 auto; align-items: center; padding-block-end: var(--lr-space-xs); } [part='start'][hidden] { display: none; } [part='textarea'] { flex: 1 1 auto; min-inline-size: 0; box-sizing: border-box; resize: none; border: none; outline: none; background: transparent; color: inherit; font: inherit; line-height: var(--lr-line-height-normal); padding-block: var(--lr-space-xs); overflow-x: hidden; overflow-y: hidden; } [part='textarea'][wrap='off'] { overflow-x: auto; } [part='textarea']::placeholder { color: var(--lr-color-text-quiet); } [part='textarea']:disabled { cursor: not-allowed; } [part='end'] { display: flex; flex: 0 0 auto; align-items: center; gap: var(--lr-space-xs); } :host([actions-layout='stacked']) [part='row'] { display: grid; grid-template-columns: auto minmax(0, 1fr); grid-template-rows: auto auto; align-items: stretch; } :host([actions-layout='stacked']) [part='start'] { grid-column: 1; grid-row: 1; padding-block-end: 0; } :host([actions-layout='stacked']) [part='textarea'] { grid-column: 2; grid-row: 1 / span 2; } :host([actions-layout='stacked']) [part='end'] { grid-column: 1; grid-row: 2; } :host([actions-layout='below']) [part='row'] { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-rows: auto auto; align-items: center; } :host([actions-layout='below']) [part='textarea'] { grid-column: 1 / -1; grid-row: 1; } :host([actions-layout='below']) [part='start'] { grid-column: 1; grid-row: 2; justify-self: start; padding-block-end: 0; } :host([actions-layout='below']) [part='end'] { grid-column: 2; grid-row: 2; } [part='action-button'] { display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto; box-sizing: border-box; ${iconHitTarget} border: none; border-radius: var(--lr-radius); background: var(--lr-color-brand); color: var(--lr-color-on-brand); font-size: var(--lr-font-size-lg); line-height: var(--lr-line-height-none); cursor: pointer; transition: background-color var(--lr-transition-fast); } :where([part='action-button']):hover:where(:not(:disabled)) { background: color-mix(in oklab, var(--lr-color-brand), var(--lr-color-mix-partner) var(--lr-color-mix-hover)); } :where([part='action-button']):active:where(:not(:disabled)) { background: color-mix(in oklab, var(--lr-color-brand), var(--lr-color-mix-partner) var(--lr-color-mix-active)); } [part='action-button']:focus-visible { ${focusRing} } [part='action-button']:disabled { cursor: not-allowed; opacity: var(--lr-opacity-disabled); } [part='send-glyph'], [part='stop-glyph'] { display: inline-flex; } :host(:dir(rtl)) [part='send-glyph'] { transform: scaleX(-1); } :host([status='sending']) [part='action-button'], :host([status='streaming']) [part='action-button'] { background: var(--lr-chat-composer-busy-bg, var(--lr-color-text-quiet)); } :host([status='sending']) :where([part='action-button']):hover:where(:not(:disabled)), :host([status='streaming']) :where([part='action-button']):hover:where(:not(:disabled)) { background: color-mix( in oklab, var(--lr-chat-composer-busy-bg, var(--lr-color-text-quiet)), var(--lr-color-mix-partner) var(--lr-color-mix-hover) ); } :host([status='sending']) :where([part='action-button']):active:where(:not(:disabled)), :host([status='streaming']) :where([part='action-button']):active:where(:not(:disabled)) { background: color-mix( in oklab, var(--lr-chat-composer-busy-bg, var(--lr-color-text-quiet)), var(--lr-color-mix-partner) var(--lr-color-mix-active) ); } @media (prefers-reduced-motion: reduce) { [part='base'], [part='action-button'] { transition: none !important; } } `;export{styles};
1
+ import{iconHitTarget,focusRing}from"../../../internal/interactive-control.styles.js";import{css}from"lit";const styles=css` :host { display: block; } [part='base'] { display: flex; flex-direction: column; gap: var(--lr-chat-composer-gap, var(--lr-space-xs)); box-sizing: border-box; border: var(--lr-border-width-thin) solid var(--lr-chat-composer-border-color, var(--lr-color-border)); border-radius: var(--lr-chat-composer-radius, var(--lr-radius)); background: var(--lr-chat-composer-bg, var(--lr-color-surface)); padding: var(--lr-chat-composer-padding, var(--lr-space-s)); transition: border-color var(--lr-transition-fast); } [part='base']:focus-within { border-color: var(--lr-color-brand); } :host([frame='plain']) [part='base'] { padding: 0; border: 0; border-radius: 0; background: transparent; } :host([frame='plain']) [part='base']:focus-within { box-shadow: var( --lr-chat-composer-focus-shadow, inset 0 calc(-1 * var(--lr-focus-ring-width)) 0 0 var(--lr-focus-ring-color) ); } :host(:disabled) [part='base'] { opacity: var(--lr-opacity-disabled); cursor: not-allowed; } [part='toolbar'] { display: flex; flex-wrap: wrap; align-items: center; gap: var(--lr-space-xs); } [part='toolbar'][hidden] { display: none; } [part='chips'] { display: flex; flex-wrap: wrap; gap: var(--lr-space-xs); } [part='chips'][hidden] { display: none; } [part='row'] { display: flex; align-items: flex-end; gap: var(--lr-space-s); } [part='start'] { display: flex; flex: 0 0 auto; align-items: center; padding-block-end: var(--lr-space-xs); } [part='start'][hidden] { display: none; } [part='textarea'] { flex: 1 1 auto; min-inline-size: 0; box-sizing: border-box; resize: none; border: none; outline: none; background: transparent; color: inherit; font: inherit; line-height: var(--lr-line-height-normal); padding-block: var(--lr-space-xs); overflow-x: hidden; overflow-y: hidden; } [part='textarea'][wrap='off'] { overflow-x: auto; } [part='textarea']::placeholder { color: var(--lr-color-text-quiet); } [part='textarea']:disabled { cursor: not-allowed; } [part='end'] { display: flex; flex: 0 0 auto; align-items: center; gap: var(--lr-space-xs); } :host([actions-layout='stacked']) [part='row'] { display: grid; grid-template-columns: auto minmax(0, 1fr); grid-template-rows: auto auto; align-items: stretch; } :host([actions-layout='stacked']) [part='start'] { grid-column: 1; grid-row: 1; padding-block-end: 0; } :host([actions-layout='stacked']) [part='textarea'] { grid-column: 2; grid-row: 1 / span 2; } :host([actions-layout='stacked']) [part='end'] { grid-column: 1; grid-row: 2; } :host([actions-layout='below']) [part='row'] { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-rows: auto auto; align-items: center; } :host([actions-layout='below']) [part='textarea'] { grid-column: 1 / -1; grid-row: 1; } :host([actions-layout='below']) [part='start'] { grid-column: 1; grid-row: 2; justify-self: start; padding-block-end: 0; } :host([actions-layout='below']) [part='end'] { grid-column: 2; grid-row: 2; } :host([actions-layout='below'][toolbar-placement='actions']) [part='row'] { grid-template-columns: auto minmax(0, 1fr) auto; column-gap: 0; } :host([actions-layout='below'][toolbar-placement='actions']) [part='start'], :host([actions-layout='below'][toolbar-placement='actions']) [part='toolbar'] { margin-inline-end: var(--lr-space-s); } :host([actions-layout='below'][toolbar-placement='actions']) [part='toolbar'] { grid-column: 2; grid-row: 2; min-inline-size: 0; max-inline-size: 100%; overflow: auto; } :host([actions-layout='below'][toolbar-placement='actions']) [part='end'] { grid-column: 3; } [part='action-button'] { display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto; box-sizing: border-box; ${iconHitTarget} border: none; border-radius: var(--lr-radius); background: var(--lr-color-brand); color: var(--lr-color-on-brand); font-size: var(--lr-font-size-lg); line-height: var(--lr-line-height-none); cursor: pointer; transition: background-color var(--lr-transition-fast); } :where([part='action-button']):hover:where(:not(:disabled)) { background: color-mix(in oklab, var(--lr-color-brand), var(--lr-color-mix-partner) var(--lr-color-mix-hover)); } :where([part='action-button']):active:where(:not(:disabled)) { background: color-mix(in oklab, var(--lr-color-brand), var(--lr-color-mix-partner) var(--lr-color-mix-active)); } [part='action-button']:focus-visible { ${focusRing} } [part='action-button']:disabled { cursor: not-allowed; opacity: var(--lr-opacity-disabled); } [part='send-glyph'], [part='stop-glyph'] { display: inline-flex; } :host(:dir(rtl)) [part='send-glyph'] { transform: scaleX(-1); } :host([status='sending']) [part='action-button'], :host([status='streaming']) [part='action-button'] { background: var(--lr-chat-composer-busy-bg, var(--lr-color-text-quiet)); } :host([status='sending']) :where([part='action-button']):hover:where(:not(:disabled)), :host([status='streaming']) :where([part='action-button']):hover:where(:not(:disabled)) { background: color-mix( in oklab, var(--lr-chat-composer-busy-bg, var(--lr-color-text-quiet)), var(--lr-color-mix-partner) var(--lr-color-mix-hover) ); } :host([status='sending']) :where([part='action-button']):active:where(:not(:disabled)), :host([status='streaming']) :where([part='action-button']):active:where(:not(:disabled)) { background: color-mix( in oklab, var(--lr-chat-composer-busy-bg, var(--lr-color-text-quiet)), var(--lr-color-mix-partner) var(--lr-color-mix-active) ); } @media (prefers-reduced-motion: reduce) { [part='base'], [part='action-button'] { transition: none !important; } } `;export{styles};