@aceshooting/lyra-ui 29.0.2 → 29.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (521) hide show
  1. package/CHANGELOG.md +37 -0
  2. package/README.md +19 -26
  3. package/design-tokens.json +1 -1
  4. package/dist/cli/migrate-wa.mjs +2 -0
  5. package/dist/components/agent-tools/activity-feed/activity-feed.class.d.ts +5 -3
  6. package/dist/components/agent-tools/activity-feed/activity-feed.class.js +4 -3
  7. package/dist/components/agent-tools/activity-feed/activity-feed.styles.js +1 -1
  8. package/dist/components/agent-tools/agent-trace/agent-trace.class.d.ts +21 -5
  9. package/dist/components/agent-tools/agent-trace/agent-trace.class.js +14 -11
  10. package/dist/components/agent-tools/agent-trace/agent-trace.styles.js +1 -1
  11. package/dist/components/agent-tools/confirm-bar/confirm-bar.class.js +2 -2
  12. package/dist/components/agent-tools/eval-dataset/eval-dataset.class.d.ts +34 -7
  13. package/dist/components/agent-tools/eval-dataset/eval-dataset.class.js +25 -11
  14. package/dist/components/agent-tools/eval-result/eval-result-source.js +1 -0
  15. package/dist/components/agent-tools/eval-result/eval-result.class.d.ts +31 -11
  16. package/dist/components/agent-tools/eval-result/eval-result.class.js +29 -15
  17. package/dist/components/agent-tools/eval-result/eval-result.styles.js +1 -1
  18. package/dist/components/agent-tools/eval-result/eval-run-result.d.ts +10 -0
  19. package/dist/components/agent-tools/span-waterfall/span-waterfall.class.d.ts +26 -5
  20. package/dist/components/agent-tools/span-waterfall/span-waterfall.class.js +16 -6
  21. package/dist/components/agent-tools/span-waterfall/span-waterfall.d.ts +1 -1
  22. package/dist/components/agent-tools/span-waterfall/span-waterfall.js +1 -1
  23. package/dist/components/agent-tools/span-waterfall/span-waterfall.styles.js +1 -1
  24. package/dist/components/agent-tools/task-list/task-list.class.d.ts +29 -6
  25. package/dist/components/agent-tools/task-list/task-list.class.js +13 -7
  26. package/dist/components/agent-tools/task-list/task-list.d.ts +1 -1
  27. package/dist/components/agent-tools/task-list/task-list.js +1 -1
  28. package/dist/components/agent-tools/task-list/task-list.styles.js +1 -1
  29. package/dist/components/agent-tools/terminal/terminal.class.d.ts +9 -5
  30. package/dist/components/agent-tools/terminal/terminal.class.js +8 -8
  31. package/dist/components/agent-tools/test-results/test-results.class.d.ts +16 -4
  32. package/dist/components/agent-tools/test-results/test-results.class.js +15 -6
  33. package/dist/components/agent-tools/test-results/test-results.d.ts +1 -0
  34. package/dist/components/agent-tools/test-results/test-results.js +1 -1
  35. package/dist/components/agent-tools/test-results/test-results.styles.js +1 -1
  36. package/dist/components/agent-tools/tool-timeline/tool-timeline.class.d.ts +7 -4
  37. package/dist/components/agent-tools/tool-timeline/tool-timeline.class.js +2 -1
  38. package/dist/components/agent-tools/trace-tree/span-projection.js +1 -0
  39. package/dist/components/agent-tools/trace-tree/span-shared.d.ts +29 -0
  40. package/dist/components/agent-tools/trace-tree/span-shared.js +1 -0
  41. package/dist/components/agent-tools/trace-tree/span.d.ts +5 -35
  42. package/dist/components/agent-tools/trace-tree/span.js +1 -1
  43. package/dist/components/agent-tools/trace-tree/trace-tree.class.d.ts +27 -5
  44. package/dist/components/agent-tools/trace-tree/trace-tree.class.js +19 -9
  45. package/dist/components/agent-tools/trace-tree/trace-tree.d.ts +1 -1
  46. package/dist/components/agent-tools/trace-tree/trace-tree.js +1 -1
  47. package/dist/components/agent-tools/trace-tree/trace-tree.styles.js +1 -1
  48. package/dist/components/charts/chart/bar-chart.class.d.ts +5 -1
  49. package/dist/components/charts/chart/box-plot.class.d.ts +2 -2
  50. package/dist/components/charts/chart/box-plot.class.js +3 -3
  51. package/dist/components/charts/chart/bubble-chart.class.d.ts +5 -1
  52. package/dist/components/charts/chart/chart-prepared-data.d.ts +9 -0
  53. package/dist/components/charts/chart/chart-prepared-data.js +1 -0
  54. package/dist/components/charts/chart/chart-spatial-data.js +2 -0
  55. package/dist/components/charts/chart/chart-sync.js +1 -1
  56. package/dist/components/charts/chart/chart-table-sampling.js +1 -1
  57. package/dist/components/charts/chart/chart.class.d.ts +56 -6
  58. package/dist/components/charts/chart/chart.class.js +18 -8
  59. package/dist/components/charts/chart/chart.styles.js +1 -1
  60. package/dist/components/charts/chart/doughnut-chart.class.d.ts +5 -1
  61. package/dist/components/charts/chart/histogram-buckets.d.ts +1 -1
  62. package/dist/components/charts/chart/histogram-buckets.js +1 -1
  63. package/dist/components/charts/chart/histogram.class.d.ts +19 -4
  64. package/dist/components/charts/chart/histogram.class.js +1 -1
  65. package/dist/components/charts/chart/line-chart.class.d.ts +5 -1
  66. package/dist/components/charts/chart/lite-chart.class.d.ts +51 -11
  67. package/dist/components/charts/chart/lite-chart.class.js +33 -27
  68. package/dist/components/charts/chart/lite-chart.styles.js +1 -1
  69. package/dist/components/charts/chart/pie-chart.class.d.ts +5 -1
  70. package/dist/components/charts/chart/polar-area-chart.class.d.ts +5 -1
  71. package/dist/components/charts/chart/radar-chart.class.d.ts +5 -1
  72. package/dist/components/charts/chart/scatter-chart.class.d.ts +5 -1
  73. package/dist/components/conversation/agent-workspace/agent-workspace.class.d.ts +6 -3
  74. package/dist/components/conversation/agent-workspace/agent-workspace.class.js +6 -5
  75. package/dist/components/conversation/agent-workspace/agent-workspace.styles.js +1 -1
  76. package/dist/components/conversation/chat-viewport/chat-viewport.class.d.ts +8 -0
  77. package/dist/components/conversation/chat-viewport/chat-viewport.class.js +1 -1
  78. package/dist/components/conversation/code-block/code-block-base.class.d.ts +5 -3
  79. package/dist/components/conversation/code-block/code-block-base.class.js +1 -1
  80. package/dist/components/conversation/code-block/code-block-core.class.d.ts +4 -1
  81. package/dist/components/conversation/code-block/code-block-core.class.js +1 -1
  82. package/dist/components/conversation/code-block/code-block-shared.d.ts +6 -4
  83. package/dist/components/conversation/code-block/code-block-shared.js +3 -2
  84. package/dist/components/conversation/code-block/code-block.class.d.ts +11 -4
  85. package/dist/components/conversation/code-block/code-block.class.js +1 -1
  86. package/dist/components/conversation/code-block/code-block.d.ts +1 -1
  87. package/dist/components/conversation/code-block/code-block.styles.js +1 -1
  88. package/dist/components/conversation/code-block/shiki-types.d.ts +2 -0
  89. package/dist/components/conversation/code-block/shiki-types.js +1 -1
  90. package/dist/components/conversation/markdown/markdown-base.class.d.ts +6 -4
  91. package/dist/components/conversation/markdown/markdown-base.class.js +1 -1
  92. package/dist/components/conversation/markdown/markdown-code-header.d.ts +2 -2
  93. package/dist/components/conversation/markdown/markdown-code-header.js +1 -1
  94. package/dist/components/conversation/markdown/markdown-core.class.d.ts +8 -3
  95. package/dist/components/conversation/markdown/markdown-progressive.js +2 -2
  96. package/dist/components/conversation/markdown/markdown-shared.d.ts +5 -10
  97. package/dist/components/conversation/markdown/markdown-shared.js +5 -5
  98. package/dist/components/conversation/markdown/markdown-streaming-tail.js +1 -1
  99. package/dist/components/conversation/markdown/markdown.class.d.ts +17 -10
  100. package/dist/components/conversation/markdown/markdown.class.js +1 -1
  101. package/dist/components/conversation/markdown/markdown.styles.js +1 -1
  102. package/dist/components/conversation/model-select/model-select.class.d.ts +4 -3
  103. package/dist/components/conversation/model-select/model-select.class.js +3 -2
  104. package/dist/components/conversation/model-select/model-select.styles.js +1 -1
  105. package/dist/components/conversation/model-settings-panel/model-settings-panel.class.d.ts +2 -1
  106. package/dist/components/conversation/model-settings-panel/model-settings-panel.class.js +2 -1
  107. package/dist/components/conversation/model-settings-panel/model-settings-panel.styles.js +1 -1
  108. package/dist/components/conversation/prompt-input/prompt-input.class.d.ts +3 -2
  109. package/dist/components/conversation/prompt-input/prompt-input.class.js +2 -1
  110. package/dist/components/conversation/prompt-input/prompt-input.styles.js +1 -1
  111. package/dist/components/conversation/prompt-queue/prompt-queue.class.d.ts +10 -2
  112. package/dist/components/conversation/prompt-queue/prompt-queue.class.js +15 -6
  113. package/dist/components/conversation/prompt-queue/prompt-queue.styles.js +1 -1
  114. package/dist/components/conversation/realtime-session/realtime-session.class.d.ts +3 -1
  115. package/dist/components/conversation/realtime-session/realtime-session.class.js +2 -1
  116. package/dist/components/conversation/realtime-session/realtime-session.styles.js +1 -1
  117. package/dist/components/conversation/streaming-text/markdown-detection.d.ts +2 -0
  118. package/dist/components/conversation/streaming-text/markdown-detection.js +4 -1
  119. package/dist/components/conversation/streaming-text/streaming-text-base.class.d.ts +6 -2
  120. package/dist/components/conversation/streaming-text/streaming-text-base.class.js +3 -3
  121. package/dist/components/conversation/streaming-text/streaming-text-core.class.js +1 -1
  122. package/dist/components/conversation/streaming-text/streaming-text.class.js +1 -0
  123. package/dist/components/conversation/thread-list/thread-list.class.d.ts +34 -4
  124. package/dist/components/conversation/thread-list/thread-list.class.js +22 -15
  125. package/dist/components/conversation/thread-list/thread-list.d.ts +1 -1
  126. package/dist/components/conversation/thread-list/thread-list.js +1 -1
  127. package/dist/components/conversation/thread-list/thread-list.styles.js +1 -1
  128. package/dist/components/conversation/transcript-feed/transcript-feed.class.d.ts +6 -2
  129. package/dist/components/conversation/transcript-feed/transcript-feed.class.js +3 -2
  130. package/dist/components/conversation/transcript-feed/transcript-feed.styles.js +1 -1
  131. package/dist/components/conversation/voice-picker/voice-picker.class.d.ts +3 -2
  132. package/dist/components/conversation/voice-picker/voice-picker.class.js +3 -2
  133. package/dist/components/conversation/voice-picker/voice-picker.styles.js +1 -1
  134. package/dist/components/data/calendar/calendar.class.d.ts +5 -2
  135. package/dist/components/data/calendar/calendar.class.js +1 -1
  136. package/dist/components/data/data-grid/data-grid-processing.js +2 -2
  137. package/dist/components/data/data-grid/data-grid.class.d.ts +22 -8
  138. package/dist/components/data/data-grid/data-grid.class.js +20 -19
  139. package/dist/components/data/data-grid/data-grid.styles.js +1 -1
  140. package/dist/components/data/document-library/document-library.class.d.ts +31 -4
  141. package/dist/components/data/document-library/document-library.class.js +25 -12
  142. package/dist/components/data/document-library/document-library.styles.js +1 -1
  143. package/dist/components/data/file-tree/file-tree.class.d.ts +30 -6
  144. package/dist/components/data/file-tree/file-tree.class.js +4 -3
  145. package/dist/components/data/file-tree/file-tree.d.ts +1 -0
  146. package/dist/components/data/file-tree/file-tree.js +1 -1
  147. package/dist/components/data/flow-canvas/flow-canvas.class.d.ts +31 -6
  148. package/dist/components/data/flow-canvas/flow-canvas.class.js +40 -19
  149. package/dist/components/data/flow-canvas/flow-canvas.styles.js +1 -1
  150. package/dist/components/data/flow-canvas/flow-model.js +1 -1
  151. package/dist/components/data/flow-canvas/flow-source.js +1 -0
  152. package/dist/components/data/flow-canvas/flow-types.d.ts +4 -2
  153. package/dist/components/data/flow-canvas/flow-viewport-index.js +1 -0
  154. package/dist/components/data/flow-minimap/flow-minimap.class.d.ts +9 -3
  155. package/dist/components/data/flow-minimap/flow-minimap.class.js +11 -2
  156. package/dist/components/data/flow-minimap/flow-minimap.styles.js +1 -1
  157. package/dist/components/data/funnel/funnel.class.d.ts +7 -3
  158. package/dist/components/data/funnel/funnel.class.js +2 -2
  159. package/dist/components/data/heatmap/calendar-grid.d.ts +1 -1
  160. package/dist/components/data/heatmap/calendar-grid.js +1 -1
  161. package/dist/components/data/heatmap/heatmap-grid-navigation.js +1 -1
  162. package/dist/components/data/heatmap/heatmap-limits.d.ts +1 -1
  163. package/dist/components/data/heatmap/heatmap-matrix-source-controller.js +1 -0
  164. package/dist/components/data/heatmap/heatmap-matrix-source.d.ts +5 -0
  165. package/dist/components/data/heatmap/heatmap-matrix-source.js +1 -0
  166. package/dist/components/data/heatmap/heatmap-scale.d.ts +0 -16
  167. package/dist/components/data/heatmap/heatmap-scale.js +1 -1
  168. package/dist/components/data/heatmap/heatmap.class.d.ts +40 -11
  169. package/dist/components/data/heatmap/heatmap.class.js +26 -6
  170. package/dist/components/data/heatmap/heatmap.styles.js +1 -1
  171. package/dist/components/data/pagination/pagination.class.js +1 -1
  172. package/dist/components/data/sequence-strip/sequence-strip-item.d.ts +17 -0
  173. package/dist/components/data/sequence-strip/sequence-strip-source-controller.js +1 -0
  174. package/dist/components/data/sequence-strip/sequence-strip-source.d.ts +5 -0
  175. package/dist/components/data/sequence-strip/sequence-strip-source.js +1 -0
  176. package/dist/components/data/sequence-strip/sequence-strip.class.d.ts +24 -19
  177. package/dist/components/data/sequence-strip/sequence-strip.class.js +23 -4
  178. package/dist/components/data/sequence-strip/sequence-strip.styles.js +1 -1
  179. package/dist/components/data/sparkline/sparkline.class.d.ts +17 -4
  180. package/dist/components/data/sparkline/sparkline.class.js +3 -3
  181. package/dist/components/data/sparkline/sparkline.styles.js +1 -1
  182. package/dist/components/data/table/table.class.d.ts +14 -10
  183. package/dist/components/data/table/table.class.js +17 -16
  184. package/dist/components/data/timeline/timeline.class.d.ts +5 -2
  185. package/dist/components/data/timeline/timeline.class.js +1 -1
  186. package/dist/components/data/tree/tree-item.class.js +1 -1
  187. package/dist/components/data/tree/tree-owner-controller.js +1 -1
  188. package/dist/components/data/tree/tree.class.d.ts +28 -6
  189. package/dist/components/data/tree/tree.class.js +3 -3
  190. package/dist/components/data/tree/tree.d.ts +1 -0
  191. package/dist/components/data/tree/tree.js +1 -1
  192. package/dist/components/data/word-cloud/word-cloud.class.d.ts +17 -7
  193. package/dist/components/data/word-cloud/word-cloud.class.js +6 -4
  194. package/dist/components/data/word-cloud/word-cloud.styles.js +1 -1
  195. package/dist/components/forms/catalog-picker-base.d.ts +1 -1
  196. package/dist/components/forms/catalog-picker-base.js +6 -6
  197. package/dist/components/forms/catalog-picker-base.styles.js +1 -1
  198. package/dist/components/forms/combobox/combobox.class.d.ts +7 -3
  199. package/dist/components/forms/combobox/combobox.class.js +1 -1
  200. package/dist/components/forms/combobox/option.class.d.ts +4 -2
  201. package/dist/components/forms/combobox/option.class.js +2 -2
  202. package/dist/components/forms/country-picker/country-picker.class.d.ts +3 -1
  203. package/dist/components/forms/country-picker/country-picker.class.js +1 -1
  204. package/dist/components/forms/currency-picker/currency-picker.class.d.ts +2 -0
  205. package/dist/components/forms/currency-picker/currency-picker.class.js +1 -1
  206. package/dist/components/forms/currency-picker/currency-presentation.js +1 -1
  207. package/dist/components/forms/emoji-picker/emoji-picker.class.d.ts +6 -2
  208. package/dist/components/forms/emoji-picker/emoji-picker.class.js +3 -2
  209. package/dist/components/forms/emoji-picker/emoji-picker.styles.js +1 -1
  210. package/dist/components/forms/locale-picker/locale-picker.class.d.ts +8 -2
  211. package/dist/components/forms/locale-picker/locale-picker.class.js +5 -4
  212. package/dist/components/forms/locale-picker/locale-picker.styles.js +1 -1
  213. package/dist/components/forms/select/select.class.d.ts +11 -3
  214. package/dist/components/forms/select/select.class.js +4 -4
  215. package/dist/components/forms/time-zone-picker/time-zone-picker.class.d.ts +2 -0
  216. package/dist/components/forms/time-zone-picker/time-zone-picker.class.js +1 -1
  217. package/dist/components/forms/token-input/token-input.class.d.ts +6 -1
  218. package/dist/components/forms/token-input/token-input.class.js +15 -13
  219. package/dist/components/forms/unit-picker/unit-picker.class.d.ts +2 -0
  220. package/dist/components/forms/unit-picker/unit-picker.class.js +1 -1
  221. package/dist/components/layout/app-rail/app-rail.class.d.ts +1 -1
  222. package/dist/components/layout/app-rail/app-rail.class.js +1 -1
  223. package/dist/components/layout/command-palette/command-palette.class.d.ts +5 -2
  224. package/dist/components/layout/command-palette/command-palette.class.js +2 -1
  225. package/dist/components/layout/command-palette/command-palette.styles.js +1 -1
  226. package/dist/components/layout/menu/menu-item.class.d.ts +2 -2
  227. package/dist/components/layout/menu/menu-item.class.js +2 -2
  228. package/dist/components/layout/menu/menu.class.d.ts +1 -1
  229. package/dist/components/layout/menu/menu.class.js +1 -1
  230. package/dist/components/layout/menubar/menubar.class.d.ts +1 -1
  231. package/dist/components/layout/menubar/menubar.class.js +1 -1
  232. package/dist/components/layout/reorder-list/reorder-item.class.d.ts +2 -2
  233. package/dist/components/layout/reorder-list/reorder-item.class.js +2 -2
  234. package/dist/components/layout/reorder-list/reorder-list.class.d.ts +1 -1
  235. package/dist/components/layout/reorder-list/reorder-list.class.js +1 -1
  236. package/dist/components/layout/virtual-list/virtual-list.class.d.ts +13 -9
  237. package/dist/components/layout/virtual-list/virtual-list.class.js +21 -17
  238. package/dist/components/media/av-player/av-cue-index.js +1 -0
  239. package/dist/components/media/av-player/av-cue-source.d.ts +13 -0
  240. package/dist/components/media/av-player/av-cue-source.js +1 -0
  241. package/dist/components/media/av-player/av-metadata.d.ts +2 -2
  242. package/dist/components/media/av-player/av-metadata.js +1 -1
  243. package/dist/components/media/av-player/av-player-cue-source-controller.js +1 -0
  244. package/dist/components/media/av-player/av-player.class.d.ts +34 -12
  245. package/dist/components/media/av-player/av-player.class.js +15 -10
  246. package/dist/components/media/flag/flag.class.js +1 -1
  247. package/dist/components/media/flag/language-map.js +1 -1
  248. package/dist/components/media/lightbox/lightbox-source.js +1 -0
  249. package/dist/components/media/lightbox/lightbox-types.d.ts +15 -0
  250. package/dist/components/media/lightbox/lightbox.class.d.ts +22 -21
  251. package/dist/components/media/lightbox/lightbox.class.js +6 -4
  252. package/dist/components/media/lightbox/lightbox.styles.js +1 -1
  253. package/dist/components/media/map/map-geojson-diff.d.ts +6 -6
  254. package/dist/components/media/map/map-geojson-diff.js +1 -1
  255. package/dist/components/media/map/map-loader.d.ts +5 -1
  256. package/dist/components/media/map/map.class.d.ts +24 -6
  257. package/dist/components/media/map/map.class.js +2 -2
  258. package/dist/components/media/map/map.styles.js +1 -1
  259. package/dist/components/media/video-playlist/video-playlist.class.d.ts +2 -1
  260. package/dist/components/media/video-playlist/video-playlist.class.js +1 -1
  261. package/dist/components/overlays/chip/chip.class.d.ts +1 -1
  262. package/dist/components/overlays/chip/chip.class.js +1 -1
  263. package/dist/components/retrieval/embedding-explorer/embedding-explorer.class.d.ts +30 -8
  264. package/dist/components/retrieval/embedding-explorer/embedding-explorer.class.js +22 -8
  265. package/dist/components/retrieval/embedding-explorer/embedding-explorer.styles.js +1 -1
  266. package/dist/components/retrieval/graph/graph-canvas.js +1 -1
  267. package/dist/components/retrieval/graph/graph-source-composition.js +1 -0
  268. package/dist/components/retrieval/graph/graph-source-controller.js +1 -0
  269. package/dist/components/retrieval/graph/graph-spatial-controller.js +2 -2
  270. package/dist/components/retrieval/graph/graph-spatial-model.js +1 -0
  271. package/dist/components/retrieval/graph/graph-spatial.js +1 -1
  272. package/dist/components/retrieval/graph/graph.class.d.ts +31 -6
  273. package/dist/components/retrieval/graph/graph.class.js +26 -5
  274. package/dist/components/retrieval/graph/graph.d.ts +1 -1
  275. package/dist/components/retrieval/graph/graph.js +1 -1
  276. package/dist/components/retrieval/graph/graph.styles.js +1 -1
  277. package/dist/components/retrieval/ingestion-queue/ingestion-queue.class.d.ts +33 -4
  278. package/dist/components/retrieval/ingestion-queue/ingestion-queue.class.js +27 -17
  279. package/dist/components/retrieval/ingestion-queue/ingestion-queue.d.ts +1 -1
  280. package/dist/components/retrieval/ingestion-queue/ingestion-queue.js +1 -1
  281. package/dist/components/retrieval/ingestion-queue/ingestion-queue.styles.js +1 -1
  282. package/dist/components/retrieval/knowledge-base/knowledge-base.class.d.ts +27 -4
  283. package/dist/components/retrieval/knowledge-base/knowledge-base.class.js +29 -14
  284. package/dist/components/retrieval/knowledge-base/knowledge-base.styles.js +1 -1
  285. package/dist/components/retrieval/knowledge-base-admin/knowledge-base-admin.class.d.ts +17 -3
  286. package/dist/components/retrieval/knowledge-base-admin/knowledge-base-admin.class.js +15 -10
  287. package/dist/components/retrieval/knowledge-base-admin/knowledge-base-admin.styles.js +1 -1
  288. package/dist/components/retrieval/knowledge-graph-explorer/knowledge-graph-explorer.class.d.ts +24 -5
  289. package/dist/components/retrieval/knowledge-graph-explorer/knowledge-graph-explorer.class.js +17 -10
  290. package/dist/components/retrieval/knowledge-graph-explorer/knowledge-graph-explorer.d.ts +1 -1
  291. package/dist/components/retrieval/knowledge-graph-explorer/knowledge-graph-explorer.js +1 -1
  292. package/dist/components/retrieval/knowledge-graph-explorer/knowledge-graph-explorer.styles.js +1 -1
  293. package/dist/components/retrieval/mind-map/mind-map-layout.js +1 -1
  294. package/dist/components/retrieval/mind-map/mind-map-model.js +1 -0
  295. package/dist/components/retrieval/mind-map/mind-map.class.d.ts +27 -4
  296. package/dist/components/retrieval/mind-map/mind-map.class.js +11 -7
  297. package/dist/components/retrieval/mind-map/mind-map.d.ts +1 -0
  298. package/dist/components/retrieval/mind-map/mind-map.js +1 -1
  299. package/dist/components/retrieval/mind-map/mind-map.styles.js +1 -1
  300. package/dist/components/retrieval/neighbor-list/neighbor-list.class.d.ts +24 -2
  301. package/dist/components/retrieval/neighbor-list/neighbor-list.class.js +17 -3
  302. package/dist/components/retrieval/neighbor-list/neighbor-list.d.ts +1 -1
  303. package/dist/components/retrieval/neighbor-list/neighbor-list.js +1 -1
  304. package/dist/components/retrieval/neighbor-list/neighbor-list.styles.js +1 -1
  305. package/dist/components/retrieval/rag-eval-dashboard/rag-eval-dashboard.class.d.ts +8 -4
  306. package/dist/components/retrieval/rag-eval-dashboard/rag-eval-dashboard.class.js +11 -7
  307. package/dist/components/retrieval/rag-eval-dashboard/rag-eval-dashboard.styles.js +1 -1
  308. package/dist/components/retrieval/retrieval-compare/retrieval-compare.class.d.ts +12 -6
  309. package/dist/components/retrieval/retrieval-compare/retrieval-compare.class.js +30 -17
  310. package/dist/components/retrieval/retrieval-compare/retrieval-compare.styles.js +1 -1
  311. package/dist/components/retrieval/retrieval-results/retrieval-results-model.js +1 -0
  312. package/dist/components/retrieval/retrieval-results/retrieval-results.class.d.ts +46 -5
  313. package/dist/components/retrieval/retrieval-results/retrieval-results.class.js +31 -9
  314. package/dist/components/retrieval/retrieval-results/retrieval-results.d.ts +1 -1
  315. package/dist/components/retrieval/retrieval-results/retrieval-results.js +1 -1
  316. package/dist/components/retrieval/retrieval-results/retrieval-results.styles.js +1 -1
  317. package/dist/components/utility/diff-view/diff-view.class.d.ts +16 -8
  318. package/dist/components/utility/diff-view/diff-view.class.js +3 -2
  319. package/dist/components/utility/diff-view/diff-view.styles.js +1 -1
  320. package/dist/components/utility/json-viewer/json-viewer.class.d.ts +31 -3
  321. package/dist/components/utility/json-viewer/json-viewer.class.js +13 -4
  322. package/dist/components/utility/json-viewer/json-viewer.d.ts +1 -0
  323. package/dist/components/utility/json-viewer/json-viewer.js +1 -1
  324. package/dist/components/utility/json-viewer/json-viewer.styles.js +1 -1
  325. package/dist/components/utility/mention-popover/mention-popover.class.d.ts +6 -4
  326. package/dist/components/utility/mention-popover/mention-popover.class.js +6 -5
  327. package/dist/components/viewers/csv-viewer/csv-viewer.class.d.ts +34 -7
  328. package/dist/components/viewers/csv-viewer/csv-viewer.class.js +9 -7
  329. package/dist/components/viewers/dataset-viewer/dataset-viewer.class.d.ts +28 -4
  330. package/dist/components/viewers/dataset-viewer/dataset-viewer.class.js +12 -11
  331. package/dist/components/viewers/geojson-view/geojson-viewer.class.d.ts +3 -1
  332. package/dist/components/viewers/geojson-view/geojson-viewer.class.js +17 -16
  333. package/dist/components/viewers/geojson-view/geojson-viewer.d.ts +1 -1
  334. package/dist/components/viewers/geojson-view/geojson-viewer.js +1 -1
  335. package/dist/components/viewers/spreadsheet-viewer/spreadsheet-viewer.class.d.ts +31 -5
  336. package/dist/components/viewers/spreadsheet-viewer/spreadsheet-viewer.class.js +11 -8
  337. package/dist/components/viewers/table-viewer-shared.js +19 -3
  338. package/dist/components/viewers/viewer-search-limits.js +1 -1
  339. package/dist/components/viewers/xml-viewer/xml-viewer.class.d.ts +35 -3
  340. package/dist/components/viewers/xml-viewer/xml-viewer.class.js +20 -5
  341. package/dist/components/viewers/xml-viewer/xml-viewer.d.ts +1 -1
  342. package/dist/components/viewers/xml-viewer/xml-viewer.js +1 -1
  343. package/dist/components/viewers/xml-viewer/xml-viewer.styles.js +1 -1
  344. package/dist/countries.js +1 -1
  345. package/dist/data-sources.d.ts +34 -0
  346. package/dist/data-sources.js +1 -0
  347. package/dist/events.d.ts +51 -7
  348. package/dist/framework-types.d.ts +1 -1
  349. package/dist/internal/accessibility-visibility.d.ts +4 -2
  350. package/dist/internal/accessibility-visibility.js +1 -1
  351. package/dist/internal/accessible-text-controller.js +1 -1
  352. package/dist/internal/anchor-target.js +2 -2
  353. package/dist/internal/catalog-picker.d.ts +1 -7
  354. package/dist/internal/catalog-picker.js +1 -1
  355. package/dist/internal/collection-snapshot.js +1 -1
  356. package/dist/internal/default-strings/agent-tools.generated.js +1 -1
  357. package/dist/internal/default-strings/charts.generated.js +1 -1
  358. package/dist/internal/default-strings/conversation.generated.js +1 -1
  359. package/dist/internal/default-strings/data.generated.js +1 -1
  360. package/dist/internal/default-strings/forms.generated.js +1 -1
  361. package/dist/internal/default-strings/layout.generated.js +1 -1
  362. package/dist/internal/default-strings/media.generated.js +1 -1
  363. package/dist/internal/default-strings/retrieval.generated.js +1 -1
  364. package/dist/internal/default-strings/shared.generated.js +1 -1
  365. package/dist/internal/default-strings/utility.generated.js +1 -1
  366. package/dist/internal/delimited-data.js +1 -1
  367. package/dist/internal/fixed-containing-block.js +1 -1
  368. package/dist/internal/flow-scene-envelope.js +1 -0
  369. package/dist/internal/graph-scene-controller.js +1 -0
  370. package/dist/internal/hierarchy-source-controller.js +1 -0
  371. package/dist/internal/hierarchy-source-view.js +29 -0
  372. package/dist/internal/hierarchy-source-view.styles.js +1 -0
  373. package/dist/internal/inherited-attribute-hub.d.ts +6 -0
  374. package/dist/internal/inherited-attribute-hub.js +1 -1
  375. package/dist/internal/intl-cache.js +1 -1
  376. package/dist/internal/keyed-index.js +1 -0
  377. package/dist/internal/localization-types.d.ts +1 -1
  378. package/dist/internal/localization.js +2 -2
  379. package/dist/internal/lyra-element.d.ts +2 -2
  380. package/dist/internal/lyra-element.js +3 -2
  381. package/dist/internal/native-modal-context.js +1 -1
  382. package/dist/internal/option-selection.js +1 -1
  383. package/dist/internal/package-metadata.js +1 -1
  384. package/dist/internal/positioner.js +1 -1
  385. package/dist/internal/resource-loader.d.ts +2 -0
  386. package/dist/internal/resource-loader.js +1 -1
  387. package/dist/internal/scoped-definitions.generated.js +1 -1
  388. package/dist/internal/search-haystack.js +1 -0
  389. package/dist/internal/selection-catalog.d.ts +5 -0
  390. package/dist/internal/selection-catalog.js +1 -1
  391. package/dist/internal/shiki-language-sources.js +1 -0
  392. package/dist/internal/source-page-controller.js +1 -0
  393. package/dist/internal/source-page-scope.js +1 -0
  394. package/dist/internal/source-request-controller.js +1 -0
  395. package/dist/internal/source-window-controller.js +1 -0
  396. package/dist/internal/spatial-source-controller.js +1 -0
  397. package/dist/internal/text-quote.d.ts +2 -6
  398. package/dist/internal/text-quote.js +1 -1
  399. package/dist/internal/theme-watcher.js +1 -1
  400. package/dist/internal/virtual-list-composition.js +1 -0
  401. package/dist/lyra.d.ts +1 -1
  402. package/dist/lyra.js +1 -1
  403. package/dist/testing/interaction-drivers.js +1 -1
  404. package/dist/testing/lyra-tag-event-map.js +1 -1
  405. package/dist/units.js +1 -1
  406. package/dist/utilities/data-preparation.d.ts +56 -0
  407. package/dist/utilities/data-preparation.js +1 -0
  408. package/dist/utilities/data-spatial.d.ts +26 -0
  409. package/dist/utilities/data-spatial.js +1 -0
  410. package/dist/utilities/index.d.ts +1 -1
  411. package/dist/utilities/index.js +1 -1
  412. package/llms/components/lr-activity-feed.md +7 -2
  413. package/llms/components/lr-agent-trace.md +49 -9
  414. package/llms/components/lr-agent-workspace.md +15 -8
  415. package/llms/components/lr-av-player.md +180 -10
  416. package/llms/components/lr-bar-chart.md +1 -1
  417. package/llms/components/lr-box-plot.md +8 -0
  418. package/llms/components/lr-bubble-chart.md +1 -1
  419. package/llms/components/lr-calendar.md +26 -3
  420. package/llms/components/lr-chart.md +310 -23
  421. package/llms/components/lr-chat-viewport.md +6 -0
  422. package/llms/components/lr-code-block-core.md +12 -7
  423. package/llms/components/lr-code-block.md +23 -9
  424. package/llms/components/lr-combobox.md +27 -15
  425. package/llms/components/lr-command-palette.md +16 -3
  426. package/llms/components/lr-country-picker.md +23 -6
  427. package/llms/components/lr-csv-viewer.md +95 -12
  428. package/llms/components/lr-currency-picker.md +23 -3
  429. package/llms/components/lr-data-grid.md +24 -6
  430. package/llms/components/lr-dataset-viewer.md +92 -11
  431. package/llms/components/lr-dialog.md +1 -1
  432. package/llms/components/lr-diff-view.md +19 -6
  433. package/llms/components/lr-document-library.md +60 -5
  434. package/llms/components/lr-doughnut-chart.md +1 -1
  435. package/llms/components/lr-embedding-explorer.md +89 -9
  436. package/llms/components/lr-emoji-picker.md +7 -2
  437. package/llms/components/lr-eval-dataset.md +56 -7
  438. package/llms/components/lr-eval-result.md +89 -4
  439. package/llms/components/lr-export-button.md +1 -1
  440. package/llms/components/lr-file-tree.md +60 -6
  441. package/llms/components/lr-flag.md +5 -2
  442. package/llms/components/lr-flow-canvas.md +152 -14
  443. package/llms/components/lr-flow-minimap.md +32 -4
  444. package/llms/components/lr-funnel.md +14 -0
  445. package/llms/components/lr-geojson-viewer.md +27 -10
  446. package/llms/components/lr-graph.md +43 -7
  447. package/llms/components/lr-heatmap.md +161 -5
  448. package/llms/components/lr-histogram.md +55 -9
  449. package/llms/components/lr-ingestion-queue.md +54 -3
  450. package/llms/components/lr-json-viewer.md +87 -7
  451. package/llms/components/lr-knowledge-base-admin.md +60 -4
  452. package/llms/components/lr-knowledge-base.md +121 -9
  453. package/llms/components/lr-knowledge-graph-explorer.md +106 -11
  454. package/llms/components/lr-lightbox.md +42 -6
  455. package/llms/components/lr-line-chart.md +28 -5
  456. package/llms/components/lr-lite-chart.md +96 -31
  457. package/llms/components/lr-locale-picker.md +6 -4
  458. package/llms/components/lr-map.md +67 -8
  459. package/llms/components/lr-markdown-core.md +10 -5
  460. package/llms/components/lr-markdown.md +23 -6
  461. package/llms/components/lr-mention-popover.md +11 -6
  462. package/llms/components/lr-mind-map.md +91 -10
  463. package/llms/components/lr-model-select.md +8 -4
  464. package/llms/components/lr-model-settings-panel.md +10 -2
  465. package/llms/components/lr-navigation-menu.md +1 -1
  466. package/llms/components/lr-neighbor-list.md +69 -2
  467. package/llms/components/lr-pie-chart.md +1 -1
  468. package/llms/components/lr-polar-area-chart.md +1 -1
  469. package/llms/components/lr-prompt-input.md +9 -2
  470. package/llms/components/lr-prompt-queue.md +11 -3
  471. package/llms/components/lr-radar-chart.md +1 -1
  472. package/llms/components/lr-rag-eval-dashboard.md +9 -2
  473. package/llms/components/lr-realtime-session.md +6 -2
  474. package/llms/components/lr-reorder-list.md +4 -0
  475. package/llms/components/lr-retrieval-compare.md +9 -4
  476. package/llms/components/lr-retrieval-results.md +104 -6
  477. package/llms/components/lr-scatter-chart.md +1 -1
  478. package/llms/components/lr-select.md +20 -10
  479. package/llms/components/lr-sequence-strip.md +92 -2
  480. package/llms/components/lr-span-waterfall.md +78 -8
  481. package/llms/components/lr-sparkline.md +42 -11
  482. package/llms/components/lr-spreadsheet-viewer.md +109 -14
  483. package/llms/components/lr-streaming-text-core.md +4 -2
  484. package/llms/components/lr-streaming-text.md +5 -1
  485. package/llms/components/lr-table.md +96 -115
  486. package/llms/components/lr-task-list.md +93 -9
  487. package/llms/components/lr-terminal.md +9 -0
  488. package/llms/components/lr-test-results.md +77 -3
  489. package/llms/components/lr-thread-list.md +86 -1
  490. package/llms/components/lr-time-zone-picker.md +8 -3
  491. package/llms/components/lr-timeline.md +5 -0
  492. package/llms/components/lr-token-input.md +7 -2
  493. package/llms/components/lr-tool-timeline.md +13 -4
  494. package/llms/components/lr-trace-tree.md +96 -10
  495. package/llms/components/lr-transcript-feed.md +9 -2
  496. package/llms/components/lr-tree.md +87 -15
  497. package/llms/components/lr-unit-picker.md +8 -3
  498. package/llms/components/lr-video-playlist.md +2 -0
  499. package/llms/components/lr-virtual-list.md +17 -8
  500. package/llms/components/lr-voice-picker.md +8 -3
  501. package/llms/components/lr-word-cloud.md +128 -12
  502. package/llms/components/lr-xml-viewer.md +106 -9
  503. package/llms/index.md +1 -1
  504. package/llms/peers.md +1 -1
  505. package/llms/shared/events-and-types.md +725 -264
  506. package/llms/shared/forms-and-accessibility.md +3 -17
  507. package/llms/shared/imports-and-registration.md +3 -17
  508. package/llms/shared/localization-and-rtl.md +0 -2
  509. package/llms/shared/styles-and-tokens.md +27 -36
  510. package/llms/shared/testing-and-utilities.md +4 -5
  511. package/llms/shared.md +770 -349
  512. package/llms.txt +1 -2
  513. package/locales.json +139 -139
  514. package/package.json +13 -4
  515. package/registrations.json +1 -1
  516. package/skills/compose-lyra-interfaces/SKILL.md +6 -8
  517. package/skills/lyra-ui/SKILL.md +20 -51
  518. package/skills/lyra-ui/commands/review.md +16 -33
  519. package/skills/lyra-ui/commands/update.md +6 -5
  520. package/skills/lyra-ui/online-api.md +15 -0
  521. package/skills/lyra-ui/reporting.md +2 -1
@@ -1,4 +1,4 @@
1
- import{__decorate}from"tslib";import{html,nothing}from"lit";import{property,state}from"lit/decorators.js";import{styleMap}from"lit/directives/style-map.js";import{unsafeHTML}from"lit/directives/unsafe-html.js";import{LyraElement}from"../../../internal/lyra-element.js";import{srOnly}from"../../../internal/a11y.js";import{acquireAnnouncementSink,Announcer}from"../../../internal/announcer.js";import{advanceViewerSearchIndex,announceSearchResult,viewerSearchDetail}from"../../../internal/viewer-search.js";import{getNumberFormat}from"../../../internal/intl-cache.js";import{finiteCount}from"../../../internal/numbers.js";import{literalSetConverter}from"../../../internal/converters.js";import{sanitizeCssLength}from"../../../internal/safe-css.js";import{prefersReducedMotion}from"../../../internal/motion.js";import{getOwnDataDescriptor,MISSING_OWN_DATA_DESCRIPTOR,UNSAFE_OWN_DATA_DESCRIPTOR}from"../../../internal/data-descriptors.js";import{writeClipboardText}from"../../../internal/clipboard.js";import{DocumentAnchorTarget,prioritizedHighlightCandidates}from"../../../internal/anchor-target.js";import{boundedViewerSearchQuery,ViewerSearchWorkBudget}from"../../viewers/viewer-search-limits.js";import{ViewerAnnouncementController}from"../../viewers/viewer-announcements.js";import{commonAffix,computeLineDiff,pairOpsForSplit}from"./diff-line-diff.js";import{loadShikiHighlighterCore,SHIKI_THEMES}from"../../conversation/code-block/code-loader.js";import{styles}from"./diff-view.styles.js";import{COPY_FEEDBACK_MS}from"../../../internal/copy-feedback.js";import{LYRA_DEFAULT_anchorJumped,LYRA_DEFAULT_anchorJumpedToPage,LYRA_DEFAULT_anchorNotFound,LYRA_DEFAULT_collapse,LYRA_DEFAULT_copied,LYRA_DEFAULT_copy,LYRA_DEFAULT_copyFailed,LYRA_DEFAULT_date,LYRA_DEFAULT_details,LYRA_DEFAULT_highlightOfTotal,LYRA_DEFAULT_highlightWithLabel,LYRA_DEFAULT_loading,LYRA_DEFAULT_map,LYRA_DEFAULT_navigation,LYRA_DEFAULT_open,LYRA_DEFAULT_remove,LYRA_DEFAULT_search,LYRA_DEFAULT_select,LYRA_DEFAULT_viewerSearchActiveMatch,LYRA_DEFAULT_viewerSearchMatchCount,LYRA_DEFAULT_viewerSearchNoMatches}from"../../../internal/default-strings/shared.generated.js";import{LYRA_DEFAULT_copyDiff,LYRA_DEFAULT_diffViewHiddenLines,LYRA_DEFAULT_diffViewNewLabel,LYRA_DEFAULT_diffViewOldLabel,LYRA_DEFAULT_diffViewTooLarge}from"../../../internal/default-strings/utility.generated.js";const COPY_CONFIRM_MS=COPY_FEEDBACK_MS,splitLines=text=>text===""?[]:text.split(/\r\n|\r|\n/),MAX_DIFF_CHARACTERS=1e6,MAX_DIFF_COMPARISONS=4e6,MAX_DIFF_LANGUAGES=1e4,MAX_DIFF_LANGUAGE_INSPECTIONS=MAX_DIFF_LANGUAGES*2,MAX_SEARCH_MATCHES=1e4,MAX_PAINTED_HIGHLIGHTS=100;function projectLanguages(value){if(!(value===null||typeof value!="object"))try{if(Array.isArray(value))return;const projected=Object.create(null),keys=Object.getOwnPropertyNames(value);let inspected=0,admitted=0;for(const key of keys){if(inspected>=MAX_DIFF_LANGUAGE_INSPECTIONS||admitted>=MAX_DIFF_LANGUAGES)break;inspected+=1;const descriptor=getOwnDataDescriptor(value,key);descriptor===MISSING_OWN_DATA_DESCRIPTOR||descriptor===UNSAFE_OWN_DATA_DESCRIPTOR||!descriptor.enumerable||(Object.defineProperty(projected,key,{value:descriptor.value,enumerable:!0,configurable:!1,writable:!1}),admitted+=1)}return Object.freeze(projected)}catch{return}}const DIFF_VIEW_LAYOUT=literalSetConverter(["unified","split"],"unified");class LyraDiffViewBase extends LyraElement{}class LyraDiffView extends DocumentAnchorTarget(LyraDiffViewBase){constructor(){super(...arguments),this.oldText="",this.newText="",this.copyable=!1,this.maxHeight="",this._layout="unified",this.language="",this.maxLines=5e3,this.anchorKinds=["line-range"],this.copyStatus="rest",this.diffTooLarge=!1,this.searchMatches=[],this.searchMatchCountExact=!0,this.searchActiveIndex=-1,this.searchQuery="",this.lastSearchLocale="",this.pendingSearchResetEvent=!1,this.forcedVisibleOps=new Set,this.searchAnnouncements=new ViewerAnnouncementController(this),this.searchAnnouncer=new Announcer({onFlush:text=>this.searchAnnouncements.announcePolite(text)}),this.highlightedOldLines=null,this.highlightedNewLines=null,this.highlightToken=0,this.loadHighlighterCore=loadShikiHighlighterCore,this.copyGeneration=0,this.oldTextSnapshot="",this.newTextSnapshot="",this.languageSnapshot="",this.diffOps=[],this.opIndexMap=new Map,this.onCopyClick=()=>{this.copy()}}static{this.defaultStrings={...super.defaultStrings,anchorJumped:LYRA_DEFAULT_anchorJumped,anchorJumpedToPage:LYRA_DEFAULT_anchorJumpedToPage,anchorNotFound:LYRA_DEFAULT_anchorNotFound,collapse:LYRA_DEFAULT_collapse,copied:LYRA_DEFAULT_copied,copy:LYRA_DEFAULT_copy,copyDiff:LYRA_DEFAULT_copyDiff,copyFailed:LYRA_DEFAULT_copyFailed,date:LYRA_DEFAULT_date,details:LYRA_DEFAULT_details,diffViewHiddenLines:LYRA_DEFAULT_diffViewHiddenLines,diffViewNewLabel:LYRA_DEFAULT_diffViewNewLabel,diffViewOldLabel:LYRA_DEFAULT_diffViewOldLabel,diffViewTooLarge:LYRA_DEFAULT_diffViewTooLarge,highlightOfTotal:LYRA_DEFAULT_highlightOfTotal,highlightWithLabel:LYRA_DEFAULT_highlightWithLabel,loading:LYRA_DEFAULT_loading,map:LYRA_DEFAULT_map,navigation:LYRA_DEFAULT_navigation,open:LYRA_DEFAULT_open,remove:LYRA_DEFAULT_remove,search:LYRA_DEFAULT_search,select:LYRA_DEFAULT_select,viewerSearchActiveMatch:LYRA_DEFAULT_viewerSearchActiveMatch,viewerSearchMatchCount:LYRA_DEFAULT_viewerSearchMatchCount,viewerSearchNoMatches:LYRA_DEFAULT_viewerSearchNoMatches}}static{this.styles=[LyraElement.styles,styles,srOnly]}get layout(){return this._layout}set layout(next){const normalized=DIFF_VIEW_LAYOUT.normalizeReflected(this,"layout",next),old=this._layout;old!==normalized&&(this._layout=normalized,this.requestUpdate("layout",old))}willUpdate(changed){if(super.willUpdate(changed),!this.hasUpdated||changed.has("oldText")||changed.has("newText")){const oldText=this.oldText,newText=this.newText;this.oldTextSnapshot=typeof oldText=="string"?oldText:"",this.newTextSnapshot=typeof newText=="string"?newText:""}if(!this.hasUpdated||changed.has("language")||changed.has("languages")){const language=this.language;this.languageSnapshot=typeof language=="string"?language:"",this.languagesSnapshot=projectLanguages(this.languages)}if(this.hasUpdated&&(changed.has("oldText")||changed.has("newText")||changed.has("copyable")||changed.has("maxLines"))&&this.resetCopyFeedback(),changed.has("oldText")||changed.has("newText")||changed.has("maxLines")){const oldLines=splitLines(this.oldTextSnapshot),newLines=splitLines(this.newTextSnapshot),maxLines=this.maxLines===Number.POSITIVE_INFINITY?Number.POSITIVE_INFINITY:finiteCount(this.maxLines,5e3),characterCount=this.oldTextSnapshot.length+this.newTextSnapshot.length,[head,tail]=commonAffix(oldLines,newLines),comparisons=(oldLines.length-head-tail)*(newLines.length-head-tail);this.diffTooLarge=oldLines.length>maxLines||newLines.length>maxLines||characterCount>MAX_DIFF_CHARACTERS||comparisons>MAX_DIFF_COMPARISONS,this.diffOps=this.diffTooLarge?[]:computeLineDiff(oldLines,newLines),this.opIndexMap=new Map(this.diffOps.map((op,index)=>[op,index])),this.pendingSearchResetEvent||=this.hasSearchState(),this.forcedVisibleOps=new Set,this.searchQuery="",this.searchMatches=[],this.searchMatchCountExact=!0,this.searchActiveIndex=-1}(changed.has("oldText")||changed.has("newText")||changed.has("language")||changed.has("languages")||changed.has("maxLines"))&&this.syncHighlight()}updated(changed){super.updated(changed),this.pendingSearchResetEvent&&(this.pendingSearchResetEvent=!1,this.emitSearchChange());const locale=this.effectiveLocale;if(locale!==this.lastSearchLocale){const shouldRecompute=!!this.searchQuery;this.lastSearchLocale=locale,shouldRecompute&&this.scheduleAfterUpdate(()=>{this.search(this.searchQuery)},"search")}}hasSearchState(){return this.searchQuery!==""||this.searchMatches.length>0||!this.searchMatchCountExact||this.searchActiveIndex!==-1}connectedCallback(){super.connectedCallback(),this.copyAnnouncementSink??=acquireAnnouncementSink("polite",{document:this.ownerDocument,source:this}),this.searchAnnouncements.connect();const ownerWindow=this.ownerDocument.defaultView;ownerWindow&&this.searchAnnouncer.setTimerHost(ownerWindow)}disconnectedCallback(){super.disconnectedCallback(),this.resetCopyFeedback(),this.copyAnnouncementSink?.release(),this.copyAnnouncementSink=void 0,this.searchAnnouncer.cancel(),this.searchAnnouncements.disconnect()}adoptedCallback(){super.adoptedCallback(),this.resetCopyFeedback(),this.copyAnnouncementSink?.release(),this.copyAnnouncementSink=void 0,this.searchAnnouncements.adopted();const ownerWindow=this.ownerDocument.defaultView;ownerWindow&&this.searchAnnouncer.setTimerHost(ownerWindow)}cancelCopyTimer(){const timer=this.copyTimer;this.copyTimer=void 0,timer&&timer.owner.clearTimeout(timer.handle)}resetCopyFeedback(){this.copyGeneration+=1,this.cancelCopyTimer(),this.copyStatus="rest"}syncHighlight(){const token=++this.highlightToken;if(this.diffTooLarge){this.highlightedOldLines=null,this.highlightedNewLines=null;return}const lang=this.languageSnapshot,languages=this.languagesSnapshot;if(!lang||!languages||!Object.hasOwn(languages,lang)){this.highlightedOldLines=null,this.highlightedNewLines=null;return}let loading;try{loading=this.loadHighlighterCore(languages)}catch{this.highlightedOldLines=null,this.highlightedNewLines=null;return}loading.then(hl=>{if(token===this.highlightToken){if(!hl){this.highlightedOldLines=null,this.highlightedNewLines=null;return}this.highlightedOldLines=this.tokenizeLines(hl,this.oldTextSnapshot,lang),this.highlightedNewLines=this.tokenizeLines(hl,this.newTextSnapshot,lang)}},()=>{token===this.highlightToken&&(this.highlightedOldLines=null,this.highlightedNewLines=null)})}tokenizeLines(hl,text,lang){try{const html2=hl.codeToHtml(text,{lang,themes:SHIKI_THEMES}),DOMParserCtor=this.ownerDocument.defaultView?.DOMParser;if(!DOMParserCtor)return null;const doc=new DOMParserCtor().parseFromString(html2,"text/html"),lines=Array.from(doc.querySelectorAll("code > .line")).map(line=>line.innerHTML),expected=splitLines(text).length;for(;lines.length>expected;)lines.pop();for(;lines.length<expected;)lines.push("");return lines}catch{return null}}computeFolds(){const ops=this.diffOps,visible=new Set(ops),foldBefore=new Map;let trailingFold=0;const ctx=this.contextLines==null||!Number.isFinite(this.contextLines)||this.contextLines<0?void 0:finiteCount(this.contextLines);if(ctx===void 0)return{visible,foldBefore,trailingFold};let i=0;for(;i<ops.length;){if(ops[i].type!=="equal"){i++;continue}let j=i;for(;j<ops.length&&ops[j].type==="equal";)j++;const runLength=j-i,isLeading=i===0,isTrailing=j===ops.length;let runHasForcedReveal=!1;if(this.forcedVisibleOps.size>0){for(let k=i;k<j;k++)if(this.forcedVisibleOps.has(ops[k])){runHasForcedReveal=!0;break}}if(!(isLeading&&isTrailing)){if(!runHasForcedReveal){if(isLeading){const hidden=Math.max(0,runLength-ctx);if(hidden>0){for(let k=i;k<i+hidden;k++)visible.delete(ops[k]);foldBefore.set(ops[i+hidden],hidden)}}else if(isTrailing){const shown=Math.min(ctx,runLength),hidden=runLength-shown;if(hidden>0){for(let k=i+shown;k<j;k++)visible.delete(ops[k]);trailingFold=hidden}}else if(runLength>ctx*2){const hiddenStart=i+ctx,hiddenEnd=j-ctx;for(let k=hiddenStart;k<hiddenEnd;k++)visible.delete(ops[k]);foldBefore.set(ops[hiddenStart],hiddenEnd-hiddenStart)}}}i=j}return{visible,foldBefore,trailingFold}}foldMarker(count){const text=this.localize("diffViewHiddenLines",void 0,{count:getNumberFormat(this.effectiveLocale).format(count),pluralCount:count});return html`<div part="line" data-type="fold">${text}</div>`}async revealOp(op){if(!this.forcedVisibleOps.has(op)){const next=new Set(this.forcedVisibleOps);next.add(op),this.forcedVisibleOps=next}await this.updateComplete}lineElementForOpIndex(index){return this.renderRoot.querySelector(`[data-op-index="${index}"]`)}async scrollOpIndexIntoView(index){const op=this.diffOps[index];if(!op)return!1;await this.revealOp(op);const target=this.lineElementForOpIndex(index);return target?(target.scrollIntoView({behavior:prefersReducedMotion(this)?"auto":"smooth",block:"nearest"}),!0):!1}async applyAnchor(anchor){if(anchor.kind!=="line-range")return!1;const index=anchor.start;return!Number.isInteger(index)||index<0||index>=this.diffOps.length?!1:this.scrollOpIndexIntoView(index)}resolvedHighlightOps(){const perOp=new Map,owners=new Map,order=new Map,ops=this.diffOps;if(ops.length===0)return{perOp,owners,order,total:0};const seen=new Set;for(const highlight of prioritizedHighlightCandidates(this.highlights,this.activeHighlightId)){if(order.size>=MAX_PAINTED_HIGHLIGHTS)break;if(seen.has(highlight.id)||(seen.add(highlight.id),highlight.anchor.kind!=="line-range"))continue;const start=Math.max(0,Math.min(highlight.anchor.start,ops.length-1)),end=Math.max(start,Math.min(highlight.anchor.end??highlight.anchor.start,ops.length-1));let resolvedAny=!1;for(let index=start;index<=end;index++){const op=ops[index];resolvedAny=!0,!perOp.has(op)&&(perOp.set(op,highlight),owners.has(highlight)||owners.set(highlight,op))}resolvedAny&&order.set(highlight,order.size)}return{perOp,owners,order,total:order.size}}highlightActionLabel(highlight,index,total){if(highlight.label)return this.localize("highlightWithLabel",void 0,{label:highlight.label});const numberFormat=getNumberFormat(this.effectiveLocale);return this.localize("highlightOfTotal",void 0,{index:numberFormat.format(index+1),total:numberFormat.format(total)})}activateHighlight(highlight){this.emit("lr-highlight-activate",{highlightId:highlight.id})}emitSearchChange(){this.emit("lr-search-change",viewerSearchDetail(this.searchQuery,this.searchMatches.length,this.searchMatchCountExact,this.searchActiveIndex)),announceSearchResult((key,fallback,values)=>this.localize(key,fallback,values),this.searchAnnouncer,this.effectiveLocale,this.searchMatches.length,this.searchActiveIndex)}recomputeSearchMatches(){this.lastSearchLocale=this.effectiveLocale;const boundedQuery=boundedViewerSearchQuery(this.searchQuery,this.effectiveLocale),needle=boundedQuery.needle,matches=[];let matchCountExact=boundedQuery.accepted;if(boundedQuery.accepted&&needle){const budget=new ViewerSearchWorkBudget;for(let index=0;index<this.diffOps.length;index++){if(budget.includes(this.diffOps[index].text,needle,this.effectiveLocale)){if(matches.length===MAX_SEARCH_MATCHES){matchCountExact=!1;break}matches.push({opIndex:index})}if(!budget.complete){matchCountExact=!1;break}}}this.searchMatches=matches,this.searchMatchCountExact=matchCountExact}async search(query){this.searchQuery=query,this.recomputeSearchMatches(),this.searchActiveIndex=this.searchMatches.length>0?0:-1,this.emitSearchChange();const active=this.searchMatches[this.searchActiveIndex];return active&&await this.scrollOpIndexIntoView(active.opIndex),this.searchMatches.length}async searchNext(){return this.searchMatches.length?(this.searchActiveIndex=advanceViewerSearchIndex(this.searchActiveIndex,this.searchMatches.length,1),this.emitSearchChange(),await this.scrollOpIndexIntoView(this.searchMatches[this.searchActiveIndex].opIndex),!0):!1}async searchPrevious(){return this.searchMatches.length?(this.searchActiveIndex=advanceViewerSearchIndex(this.searchActiveIndex,this.searchMatches.length,-1),this.emitSearchChange(),await this.scrollOpIndexIntoView(this.searchMatches[this.searchActiveIndex].opIndex),!0):!1}clearSearch(){this.searchQuery="",this.searchMatches=[],this.searchMatchCountExact=!0,this.searchActiveIndex=-1,this.emitSearchChange()}get unifiedText(){return this.diffOps.map(op=>`${op.type==="add"?"+":op.type==="remove"?"-":" "} ${op.text}`).join(`
1
+ import{__decorate}from"tslib";import{combineShikiLanguageSources}from"../../../internal/shiki-language-sources.js";import{html,nothing}from"lit";import{property,state}from"lit/decorators.js";import{styleMap}from"lit/directives/style-map.js";import{unsafeHTML}from"lit/directives/unsafe-html.js";import{LyraElement}from"../../../internal/lyra-element.js";import{srOnly}from"../../../internal/a11y.js";import{acquireAnnouncementSink,Announcer}from"../../../internal/announcer.js";import{advanceViewerSearchIndex,announceSearchResult,viewerSearchDetail}from"../../../internal/viewer-search.js";import{getNumberFormat}from"../../../internal/intl-cache.js";import{finiteCount}from"../../../internal/numbers.js";import{literalSetConverter}from"../../../internal/converters.js";import{sanitizeCssLength}from"../../../internal/safe-css.js";import{prefersReducedMotion}from"../../../internal/motion.js";import{getOwnDataDescriptor,MISSING_OWN_DATA_DESCRIPTOR,UNSAFE_OWN_DATA_DESCRIPTOR}from"../../../internal/data-descriptors.js";import{writeClipboardText}from"../../../internal/clipboard.js";import{DocumentAnchorTarget,prioritizedHighlightCandidates}from"../../../internal/anchor-target.js";import{boundedViewerSearchQuery,ViewerSearchWorkBudget}from"../../viewers/viewer-search-limits.js";import{ViewerAnnouncementController}from"../../viewers/viewer-announcements.js";import{commonAffix,computeLineDiff,pairOpsForSplit}from"./diff-line-diff.js";import{loadShikiHighlighterCore,SHIKI_THEMES,SHIKI_SOURCE_MAX_CODE_UNITS,resolvedShikiLanguages,ensureShikiLanguageLoaded}from"../../conversation/code-block/shiki-types.js";import{styles}from"./diff-view.styles.js";import{COPY_FEEDBACK_MS}from"../../../internal/copy-feedback.js";import{LYRA_DEFAULT_anchorJumped,LYRA_DEFAULT_anchorJumpedToPage,LYRA_DEFAULT_anchorNotFound,LYRA_DEFAULT_collapse,LYRA_DEFAULT_copied,LYRA_DEFAULT_copy,LYRA_DEFAULT_copyFailed,LYRA_DEFAULT_date,LYRA_DEFAULT_details,LYRA_DEFAULT_highlightOfTotal,LYRA_DEFAULT_highlightWithLabel,LYRA_DEFAULT_loading,LYRA_DEFAULT_map,LYRA_DEFAULT_navigation,LYRA_DEFAULT_open,LYRA_DEFAULT_remove,LYRA_DEFAULT_search,LYRA_DEFAULT_select,LYRA_DEFAULT_viewerSearchActiveMatch,LYRA_DEFAULT_viewerSearchMatchCount,LYRA_DEFAULT_viewerSearchNoMatches}from"../../../internal/default-strings/shared.generated.js";import{LYRA_DEFAULT_copyDiff,LYRA_DEFAULT_diffViewHiddenLines,LYRA_DEFAULT_diffViewHighlightLimit,LYRA_DEFAULT_diffViewNewLabel,LYRA_DEFAULT_diffViewOldLabel,LYRA_DEFAULT_diffViewTooLarge}from"../../../internal/default-strings/utility.generated.js";const COPY_CONFIRM_MS=COPY_FEEDBACK_MS,splitLines=text=>text===""?[]:text.split(/\r\n|\r|\n/),MAX_DIFF_RENDERED_LINES=1e4,MAX_DIFF_CHARACTERS=1e6,MAX_DIFF_COMPARISONS=4e6,MAX_DIFF_LANGUAGES=1e4,MAX_DIFF_LANGUAGE_INSPECTIONS=MAX_DIFF_LANGUAGES*2,MAX_SEARCH_MATCHES=1e4,MAX_PAINTED_HIGHLIGHTS=100;function projectLanguages(value){if(!(value===null||typeof value!="object"))try{if(Array.isArray(value))return;const projected=Object.create(null),keys=Object.getOwnPropertyNames(value);let inspected=0,admitted=0;for(const key of keys){if(inspected>=MAX_DIFF_LANGUAGE_INSPECTIONS||admitted>=MAX_DIFF_LANGUAGES)break;inspected+=1;const descriptor=getOwnDataDescriptor(value,key);descriptor===MISSING_OWN_DATA_DESCRIPTOR||descriptor===UNSAFE_OWN_DATA_DESCRIPTOR||!descriptor.enumerable||(Object.defineProperty(projected,key,{value:descriptor.value,enumerable:!0,configurable:!1,writable:!1}),admitted+=1)}return Object.freeze(projected)}catch{return}}const DIFF_VIEW_LAYOUT=literalSetConverter(["unified","split"],"unified");class LyraDiffViewBase extends LyraElement{}class LyraDiffView extends DocumentAnchorTarget(LyraDiffViewBase){constructor(){super(...arguments),this.oldText="",this.newText="",this.copyable=!1,this.maxHeight="",this._layout="unified",this.language="",this.maxLines=5e3,this.anchorKinds=["line-range"],this.copyStatus="rest",this.diffTooLarge=!1,this.searchMatches=[],this.searchMatchCountExact=!0,this.searchActiveIndex=-1,this.searchQuery="",this.lastSearchLocale="",this.pendingSearchResetEvent=!1,this.forcedVisibleOps=new Set,this.searchAnnouncements=new ViewerAnnouncementController(this),this.searchAnnouncer=new Announcer({onFlush:text=>this.searchAnnouncements.announcePolite(text)}),this.highlightedOldLines=null,this.highlightedNewLines=null,this.highlightToken=0,this.loadHighlighterCore=loadShikiHighlighterCore,this.copyGeneration=0,this.oldTextSnapshot="",this.newTextSnapshot="",this.languageSnapshot="",this.diffOps=[],this.opIndexMap=new Map,this.onCopyClick=()=>{this.copy()}}static{this.defaultStrings={...super.defaultStrings,anchorJumped:LYRA_DEFAULT_anchorJumped,anchorJumpedToPage:LYRA_DEFAULT_anchorJumpedToPage,anchorNotFound:LYRA_DEFAULT_anchorNotFound,collapse:LYRA_DEFAULT_collapse,copied:LYRA_DEFAULT_copied,copy:LYRA_DEFAULT_copy,copyDiff:LYRA_DEFAULT_copyDiff,copyFailed:LYRA_DEFAULT_copyFailed,date:LYRA_DEFAULT_date,details:LYRA_DEFAULT_details,diffViewHiddenLines:LYRA_DEFAULT_diffViewHiddenLines,diffViewHighlightLimit:LYRA_DEFAULT_diffViewHighlightLimit,diffViewNewLabel:LYRA_DEFAULT_diffViewNewLabel,diffViewOldLabel:LYRA_DEFAULT_diffViewOldLabel,diffViewTooLarge:LYRA_DEFAULT_diffViewTooLarge,highlightOfTotal:LYRA_DEFAULT_highlightOfTotal,highlightWithLabel:LYRA_DEFAULT_highlightWithLabel,loading:LYRA_DEFAULT_loading,map:LYRA_DEFAULT_map,navigation:LYRA_DEFAULT_navigation,open:LYRA_DEFAULT_open,remove:LYRA_DEFAULT_remove,search:LYRA_DEFAULT_search,select:LYRA_DEFAULT_select,viewerSearchActiveMatch:LYRA_DEFAULT_viewerSearchActiveMatch,viewerSearchMatchCount:LYRA_DEFAULT_viewerSearchMatchCount,viewerSearchNoMatches:LYRA_DEFAULT_viewerSearchNoMatches}}static{this.styles=[LyraElement.styles,styles,srOnly]}get layout(){return this._layout}set layout(next){const normalized=DIFF_VIEW_LAYOUT.normalizeReflected(this,"layout",next),old=this._layout;old!==normalized&&(this._layout=normalized,this.requestUpdate("layout",old))}willUpdate(changed){if(super.willUpdate(changed),!this.hasUpdated||changed.has("oldText")||changed.has("newText")){const oldText=this.oldText,newText=this.newText;this.oldTextSnapshot=typeof oldText=="string"?oldText:"",this.newTextSnapshot=typeof newText=="string"?newText:""}if(!this.hasUpdated||changed.has("language")||changed.has("languages")||changed.has("languageLoaders")){const language=this.language;this.languageSnapshot=typeof language=="string"?language:"";const languages=projectLanguages(this.languages);if(this.languageLoaders===void 0)this.languagesSnapshot=languages;else{const loaders=projectLanguages(this.languageLoaders);this.languagesSnapshot=projectLanguages(combineShikiLanguageSources(languages,loaders))}}if(this.hasUpdated&&(changed.has("oldText")||changed.has("newText")||changed.has("copyable")||changed.has("maxLines"))&&this.resetCopyFeedback(),changed.has("oldText")||changed.has("newText")||changed.has("maxLines")){const oldLines=splitLines(this.oldTextSnapshot),newLines=splitLines(this.newTextSnapshot),maxLines=this.maxLines===Number.POSITIVE_INFINITY?Number.POSITIVE_INFINITY:finiteCount(this.maxLines,5e3),characterCount=this.oldTextSnapshot.length+this.newTextSnapshot.length,[head,tail]=commonAffix(oldLines,newLines),comparisons=(oldLines.length-head-tail)*(newLines.length-head-tail);this.diffTooLarge=oldLines.length>maxLines||newLines.length>maxLines||characterCount>MAX_DIFF_CHARACTERS||comparisons>MAX_DIFF_COMPARISONS,this.diffOps=this.diffTooLarge?[]:computeLineDiff(oldLines,newLines),this.diffOps.length>MAX_DIFF_RENDERED_LINES&&(this.diffTooLarge=!0,this.diffOps=[]),this.opIndexMap=new Map(this.diffOps.map((op,index)=>[op,index])),this.pendingSearchResetEvent||=this.hasSearchState(),this.forcedVisibleOps=new Set,this.searchQuery="",this.searchMatches=[],this.searchMatchCountExact=!0,this.searchActiveIndex=-1}(changed.has("oldText")||changed.has("newText")||changed.has("language")||changed.has("languages")||changed.has("languageLoaders")||changed.has("maxLines"))&&this.syncHighlight()}updated(changed){super.updated(changed),this.pendingSearchResetEvent&&(this.pendingSearchResetEvent=!1,this.emitSearchChange());const locale=this.effectiveLocale;if(locale!==this.lastSearchLocale){const shouldRecompute=!!this.searchQuery;this.lastSearchLocale=locale,shouldRecompute&&this.scheduleAfterUpdate(()=>{this.search(this.searchQuery)},"search")}}hasSearchState(){return this.searchQuery!==""||this.searchMatches.length>0||!this.searchMatchCountExact||this.searchActiveIndex!==-1}connectedCallback(){super.connectedCallback(),this.hasUpdated&&this.syncHighlight(),this.copyAnnouncementSink??=acquireAnnouncementSink("polite",{document:this.ownerDocument,source:this}),this.searchAnnouncements.connect();const ownerWindow=this.ownerDocument.defaultView;ownerWindow&&this.searchAnnouncer.setTimerHost(ownerWindow)}disconnectedCallback(){this.highlightToken++,super.disconnectedCallback(),this.resetCopyFeedback(),this.copyAnnouncementSink?.release(),this.copyAnnouncementSink=void 0,this.searchAnnouncer.cancel(),this.searchAnnouncements.disconnect()}adoptedCallback(){this.highlightToken++,super.adoptedCallback(),this.resetCopyFeedback(),this.copyAnnouncementSink?.release(),this.copyAnnouncementSink=void 0,this.searchAnnouncements.adopted();const ownerWindow=this.ownerDocument.defaultView;ownerWindow&&this.searchAnnouncer.setTimerHost(ownerWindow)}cancelCopyTimer(){const timer=this.copyTimer;this.copyTimer=void 0,timer&&timer.owner.clearTimeout(timer.handle)}resetCopyFeedback(){this.copyGeneration+=1,this.cancelCopyTimer(),this.copyStatus="rest"}get highlightLimited(){return this.oldTextSnapshot.length>SHIKI_SOURCE_MAX_CODE_UNITS||this.newTextSnapshot.length>SHIKI_SOURCE_MAX_CODE_UNITS}syncHighlight(){const token=++this.highlightToken;if(this.diffTooLarge||this.highlightLimited){this.highlightedOldLines=null,this.highlightedNewLines=null;return}const lang=this.languageSnapshot,languages=this.languagesSnapshot;if(!lang||!languages||!Object.hasOwn(languages,lang)){this.highlightedOldLines=null,this.highlightedNewLines=null;return}this.highlightedOldLines=null,this.highlightedNewLines=null;let loading;try{loading=this.loadHighlighterCore(resolvedShikiLanguages(languages))}catch{this.highlightedOldLines=null,this.highlightedNewLines=null;return}loading.then(async hl=>{if(token!==this.highlightToken||!this.isConnected)return;if(!hl){this.highlightedOldLines=null,this.highlightedNewLines=null;return}const loaded=await ensureShikiLanguageLoaded(hl,lang,languages[lang]);if(!(token!==this.highlightToken||!this.isConnected)){if(!loaded){this.highlightedOldLines=null,this.highlightedNewLines=null;return}this.highlightedOldLines=this.tokenizeLines(hl,this.oldTextSnapshot,lang),this.highlightedNewLines=this.tokenizeLines(hl,this.newTextSnapshot,lang)}},()=>{token===this.highlightToken&&(this.highlightedOldLines=null,this.highlightedNewLines=null)})}tokenizeLines(hl,text,lang){if(text.length>SHIKI_SOURCE_MAX_CODE_UNITS)return null;try{const html2=hl.codeToHtml(text,{lang,themes:SHIKI_THEMES}),DOMParserCtor=this.ownerDocument.defaultView?.DOMParser;if(!DOMParserCtor)return null;const doc=new DOMParserCtor().parseFromString(html2,"text/html"),lines=Array.from(doc.querySelectorAll("code > .line")).map(line=>line.innerHTML),expected=splitLines(text).length;for(;lines.length>expected;)lines.pop();for(;lines.length<expected;)lines.push("");return lines}catch{return null}}computeFolds(){const ops=this.diffOps,visible=new Set(ops),foldBefore=new Map;let trailingFold=0;const ctx=this.contextLines==null||!Number.isFinite(this.contextLines)||this.contextLines<0?void 0:finiteCount(this.contextLines);if(ctx===void 0)return{visible,foldBefore,trailingFold};let i=0;for(;i<ops.length;){if(ops[i].type!=="equal"){i++;continue}let j=i;for(;j<ops.length&&ops[j].type==="equal";)j++;const runLength=j-i,isLeading=i===0,isTrailing=j===ops.length;let runHasForcedReveal=!1;if(this.forcedVisibleOps.size>0){for(let k=i;k<j;k++)if(this.forcedVisibleOps.has(ops[k])){runHasForcedReveal=!0;break}}if(!(isLeading&&isTrailing)){if(!runHasForcedReveal){if(isLeading){const hidden=Math.max(0,runLength-ctx);if(hidden>0){for(let k=i;k<i+hidden;k++)visible.delete(ops[k]);foldBefore.set(ops[i+hidden],hidden)}}else if(isTrailing){const shown=Math.min(ctx,runLength),hidden=runLength-shown;if(hidden>0){for(let k=i+shown;k<j;k++)visible.delete(ops[k]);trailingFold=hidden}}else if(runLength>ctx*2){const hiddenStart=i+ctx,hiddenEnd=j-ctx;for(let k=hiddenStart;k<hiddenEnd;k++)visible.delete(ops[k]);foldBefore.set(ops[hiddenStart],hiddenEnd-hiddenStart)}}}i=j}return{visible,foldBefore,trailingFold}}foldMarker(count){const text=this.localize("diffViewHiddenLines",void 0,{count:getNumberFormat(this.effectiveLocale).format(count),pluralCount:count});return html`<div part="line" data-type="fold">${text}</div>`}async revealOp(op){if(!this.forcedVisibleOps.has(op)){const next=new Set(this.forcedVisibleOps);next.add(op),this.forcedVisibleOps=next}await this.updateComplete}lineElementForOpIndex(index){return this.renderRoot.querySelector(`[data-op-index="${index}"]`)}async scrollOpIndexIntoView(index){const op=this.diffOps[index];if(!op)return!1;await this.revealOp(op);const target=this.lineElementForOpIndex(index);return target?(target.scrollIntoView({behavior:prefersReducedMotion(this)?"auto":"smooth",block:"nearest"}),!0):!1}async applyAnchor(anchor){if(anchor.kind!=="line-range")return!1;const index=anchor.start;return!Number.isInteger(index)||index<0||index>=this.diffOps.length?!1:this.scrollOpIndexIntoView(index)}resolvedHighlightOps(){const perOp=new Map,owners=new Map,order=new Map,ops=this.diffOps;if(ops.length===0)return{perOp,owners,order,total:0};const seen=new Set;for(const highlight of prioritizedHighlightCandidates(this.highlights,this.activeHighlightId)){if(order.size>=MAX_PAINTED_HIGHLIGHTS)break;if(seen.has(highlight.id)||(seen.add(highlight.id),highlight.anchor.kind!=="line-range"))continue;const start=Math.max(0,Math.min(highlight.anchor.start,ops.length-1)),end=Math.max(start,Math.min(highlight.anchor.end??highlight.anchor.start,ops.length-1));let resolvedAny=!1;for(let index=start;index<=end;index++){const op=ops[index];resolvedAny=!0,!perOp.has(op)&&(perOp.set(op,highlight),owners.has(highlight)||owners.set(highlight,op))}resolvedAny&&order.set(highlight,order.size)}return{perOp,owners,order,total:order.size}}highlightActionLabel(highlight,index,total){if(highlight.label)return this.localize("highlightWithLabel",void 0,{label:highlight.label});const numberFormat=getNumberFormat(this.effectiveLocale);return this.localize("highlightOfTotal",void 0,{index:numberFormat.format(index+1),total:numberFormat.format(total)})}activateHighlight(highlight){this.emit("lr-highlight-activate",{highlightId:highlight.id})}emitSearchChange(){this.emit("lr-search-change",viewerSearchDetail(this.searchQuery,this.searchMatches.length,this.searchMatchCountExact,this.searchActiveIndex)),announceSearchResult((key,fallback,values)=>this.localize(key,fallback,values),this.searchAnnouncer,this.effectiveLocale,this.searchMatches.length,this.searchActiveIndex)}recomputeSearchMatches(){this.lastSearchLocale=this.effectiveLocale;const boundedQuery=boundedViewerSearchQuery(this.searchQuery,this.effectiveLocale),needle=boundedQuery.needle,matches=[];let matchCountExact=boundedQuery.accepted;if(boundedQuery.accepted&&needle){const budget=new ViewerSearchWorkBudget;for(let index=0;index<this.diffOps.length;index++){if(budget.includes(this.diffOps[index].text,needle,this.effectiveLocale)){if(matches.length===MAX_SEARCH_MATCHES){matchCountExact=!1;break}matches.push({opIndex:index})}if(!budget.complete){matchCountExact=!1;break}}}this.searchMatches=matches,this.searchMatchCountExact=matchCountExact}async search(query){this.searchQuery=query,this.recomputeSearchMatches(),this.searchActiveIndex=this.searchMatches.length>0?0:-1,this.emitSearchChange();const active=this.searchMatches[this.searchActiveIndex];return active&&await this.scrollOpIndexIntoView(active.opIndex),this.searchMatches.length}async searchNext(){return this.searchMatches.length?(this.searchActiveIndex=advanceViewerSearchIndex(this.searchActiveIndex,this.searchMatches.length,1),this.emitSearchChange(),await this.scrollOpIndexIntoView(this.searchMatches[this.searchActiveIndex].opIndex),!0):!1}async searchPrevious(){return this.searchMatches.length?(this.searchActiveIndex=advanceViewerSearchIndex(this.searchActiveIndex,this.searchMatches.length,-1),this.emitSearchChange(),await this.scrollOpIndexIntoView(this.searchMatches[this.searchActiveIndex].opIndex),!0):!1}clearSearch(){this.searchQuery="",this.searchMatches=[],this.searchMatchCountExact=!0,this.searchActiveIndex=-1,this.emitSearchChange()}get unifiedText(){return this.diffOps.map(op=>`${op.type==="add"?"+":op.type==="remove"?"-":" "} ${op.text}`).join(`
2
2
  `)}isCurrentCopy(generation,owner){return this.isConnected&&this.copyable&&!this.diffTooLarge&&generation===this.copyGeneration&&this.ownerDocument.defaultView===owner}showCopyStatus(status,generation){const owner=this.ownerDocument.defaultView;if(!owner||!this.isCurrentCopy(generation,owner))return;this.copyStatus=status,this.copyAnnouncementSink?.announce(status==="success"?this.localize("copied"):this.localize("copyFailed")),this.cancelCopyTimer();let handle=0;handle=owner.setTimeout(()=>{const timer=this.copyTimer;timer?.owner!==owner||timer.handle!==handle||timer.generation!==generation||!this.isCurrentCopy(generation,owner)||(this.copyTimer=void 0,this.copyStatus="rest")},COPY_CONFIRM_MS),this.copyTimer={owner,handle,generation}}async copy(){if(!this.copyable||this.diffTooLarge)return;const generation=++this.copyGeneration;this.cancelCopyTimer(),this.copyStatus="rest";const text=this.unifiedText,owner=this.isConnected?this.ownerDocument.defaultView:null;if(!owner)return;const outcome=await writeClipboardText(owner,text);if(this.isCurrentCopy(generation,owner)){if(!outcome.ok){this.showCopyStatus("error",generation),this.emit("lr-error"),this.emit("lr-copy-error",outcome);return}this.showCopyStatus("success",generation),this.emit("lr-copy",outcome)}}lineRenderContext(){const{perOp,owners,order,total}=this.resolvedHighlightOps();return{perOp,owners,order,total,matchedOpIndexes:new Set(this.searchMatches.map(match=>match.opIndex)),activeMatchOpIndex:this.searchMatches[this.searchActiveIndex]?.opIndex??-1}}renderDiffLine(op,marker,content,context){const index=this.opIndexMap.get(op),isMatch=index!==void 0&&context.matchedOpIndexes.has(index),isActiveMatch=index!==void 0&&index===context.activeMatchOpIndex,highlight=context.perOp.get(op),owner=highlight&&context.owners.get(highlight)===op?highlight:void 0,ownerLabel=owner?this.highlightActionLabel(owner,context.order.get(owner)??0,context.total):"",text=html`${marker} ${content}`;return html`<div
3
3
  part="line"
4
4
  data-type=${op.type}
@@ -35,7 +35,8 @@ import{__decorate}from"tslib";import{html,nothing}from"lit";import{property,stat
35
35
  >
36
36
  ${this.copyStatus==="success"?this.localize("copied"):this.copyStatus==="error"?this.localize("copyFailed"):this.localize("copy")}
37
37
  </button>`:nothing}
38
+ ${this.highlightLimited&&this.languageSnapshot?html`<div part="limit" role="note">${this.localize("diffViewHighlightLimit")}</div>`:nothing}
38
39
  ${this.layout==="split"?this.renderSplit():this.renderUnified()}
39
40
  </div>
40
41
  ${this.renderAnchorLiveRegion()}
41
- `}}__decorate([property({attribute:!1})],LyraDiffView.prototype,"oldText",void 0),__decorate([property({attribute:!1})],LyraDiffView.prototype,"newText",void 0),__decorate([property({type:Boolean})],LyraDiffView.prototype,"copyable",void 0),__decorate([property({attribute:"max-height"})],LyraDiffView.prototype,"maxHeight",void 0),__decorate([property({reflect:!0,converter:DIFF_VIEW_LAYOUT})],LyraDiffView.prototype,"layout",null),__decorate([property()],LyraDiffView.prototype,"language",void 0),__decorate([property({attribute:!1})],LyraDiffView.prototype,"languages",void 0),__decorate([property({type:Number,attribute:"context-lines"})],LyraDiffView.prototype,"contextLines",void 0),__decorate([property({type:Number,attribute:"max-lines"})],LyraDiffView.prototype,"maxLines",void 0),__decorate([state()],LyraDiffView.prototype,"copyStatus",void 0),__decorate([state()],LyraDiffView.prototype,"diffTooLarge",void 0),__decorate([state()],LyraDiffView.prototype,"searchMatches",void 0),__decorate([state()],LyraDiffView.prototype,"searchActiveIndex",void 0),__decorate([state()],LyraDiffView.prototype,"forcedVisibleOps",void 0),__decorate([state()],LyraDiffView.prototype,"highlightedOldLines",void 0),__decorate([state()],LyraDiffView.prototype,"highlightedNewLines",void 0);export{LyraDiffView};
42
+ `}}__decorate([property({attribute:!1})],LyraDiffView.prototype,"oldText",void 0),__decorate([property({attribute:!1})],LyraDiffView.prototype,"newText",void 0),__decorate([property({type:Boolean})],LyraDiffView.prototype,"copyable",void 0),__decorate([property({attribute:"max-height"})],LyraDiffView.prototype,"maxHeight",void 0),__decorate([property({reflect:!0,converter:DIFF_VIEW_LAYOUT})],LyraDiffView.prototype,"layout",null),__decorate([property()],LyraDiffView.prototype,"language",void 0),__decorate([property({attribute:!1})],LyraDiffView.prototype,"languages",void 0),__decorate([property({attribute:!1})],LyraDiffView.prototype,"languageLoaders",void 0),__decorate([property({type:Number,attribute:"context-lines"})],LyraDiffView.prototype,"contextLines",void 0),__decorate([property({type:Number,attribute:"max-lines"})],LyraDiffView.prototype,"maxLines",void 0),__decorate([state()],LyraDiffView.prototype,"copyStatus",void 0),__decorate([state()],LyraDiffView.prototype,"diffTooLarge",void 0),__decorate([state()],LyraDiffView.prototype,"searchMatches",void 0),__decorate([state()],LyraDiffView.prototype,"searchActiveIndex",void 0),__decorate([state()],LyraDiffView.prototype,"forcedVisibleOps",void 0),__decorate([state()],LyraDiffView.prototype,"highlightedOldLines",void 0),__decorate([state()],LyraDiffView.prototype,"highlightedNewLines",void 0);export{LyraDiffView};
@@ -1 +1 @@
1
- import{iconHitTarget,focusRing}from"../../../internal/interactive-control.styles.js";import{css}from"lit";const styles=css` :host { display: block; --_lr-diff-view-max-height: none; --_lr-diff-view-font: var(--lr-font-mono); --_lr-diff-view-add-background: var(--lr-color-success-quiet); --_lr-diff-view-add-color: var(--lr-color-success); --_lr-diff-view-remove-background: var(--lr-color-danger-quiet); --_lr-diff-view-remove-color: var(--lr-color-danger); --_lr-diff-view-fold-background: var(--lr-color-surface-raised); --_lr-diff-view-fold-color: var(--lr-color-text-quiet); } [part="base"] { position: relative; max-block-size: var(--lr-diff-view-max-height, var(--_lr-diff-view-max-height)); border: var(--lr-border-width-thin) solid var(--lr-color-border-subtle); border-radius: var(--lr-radius); background: var(--lr-color-surface); overflow: auto; } pre { margin: 0; padding: var(--lr-space-s); } [part="limit"] { padding: var(--lr-space-m); color: var(--lr-color-text-quiet); overflow-wrap: anywhere; } .split-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--lr-space-s); align-items: start; padding: var(--lr-space-s); } [part="side"] { overflow-x: auto; overflow-y: hidden; min-inline-size: 0; } [part="line"] { font-family: var(--lr-diff-view-font, var(--_lr-diff-view-font)); font-size: var(--lr-font-size-sm); line-height: var(--lr-line-height-snug); white-space: pre-wrap; box-sizing: border-box; inline-size: max-content; min-inline-size: 100%; } ins, del { text-decoration: none; } [part="line"]:not([data-type="fold"]) { direction: ltr; unicode-bidi: isolate; } [part="line"][data-type="add"] { background: var( --lr-diff-view-add-bg, var(--_lr-diff-view-add-background) ); color: var(--lr-diff-view-add-color, var(--_lr-diff-view-add-color)); } [part="line"][data-type="remove"] { background: var( --lr-diff-view-remove-bg, var(--_lr-diff-view-remove-background) ); color: var(--lr-diff-view-remove-color, var(--_lr-diff-view-remove-color)); } [part="line"][data-type="fold"] { color: var(--lr-diff-view-fold-color, var(--_lr-diff-view-fold-color)); background: var( --lr-diff-view-fold-bg, var(--_lr-diff-view-fold-background) ); text-align: center; } [part="line"][data-match] { outline: var(--lr-border-width-thin) dashed var(--lr-diff-view-match-color, var(--lr-color-warning)); } [part="line"][data-active-match] { outline: var(--lr-border-width-medium) solid var(--lr-diff-view-active-match-color, var(--lr-color-warning)); } [part="line"][data-highlight] { --_lr-diff-view-highlight-background: var( --lr-diff-view-highlight-accent-bg, var(--lr-color-brand-quiet) ); background: var(--_lr-diff-view-highlight-background); } [part="line"][data-highlight="success"] { --_lr-diff-view-highlight-background: var( --lr-diff-view-highlight-success-bg, var(--lr-color-success-quiet) ); } [part="line"][data-highlight="warning"] { --_lr-diff-view-highlight-background: var( --lr-diff-view-highlight-warning-bg, var(--lr-color-warning-quiet) ); } [part="line"][data-highlight="danger"] { --_lr-diff-view-highlight-background: var( --lr-diff-view-highlight-danger-bg, var(--lr-color-danger-quiet) ); } [part="line"][data-highlight="neutral"] { --_lr-diff-view-highlight-background: var( --lr-diff-view-highlight-neutral-bg, var(--lr-color-surface-raised) ); } [part="line"][data-active-highlight] { outline: var(--lr-border-width-medium) solid var(--lr-diff-view-highlight-active-outline, var(--lr-color-brand)); outline-offset: var(--lr-focus-ring-offset); } [part="line-highlight-action"] { display: inline-block; margin-inline-start: var(--lr-space-xs); ${iconHitTarget} border: var(--lr-border-width-thin) solid var(--lr-color-border); border-radius: var(--lr-radius); background: var(--lr-color-surface); color: var(--lr-color-text); cursor: pointer; font: inherit; font-size: var(--lr-font-size-xs); padding: var(--lr-size-0-125rem) var(--lr-space-xs); transition: var(--lr-transition-interactive); } [part="line-highlight-action"]:hover { background: var(--_lr-diff-view-highlight-background); } [part="line-highlight-action"]:active { background: color-mix(in oklab, var(--_lr-diff-view-highlight-background), var(--lr-color-mix-partner) var(--lr-color-mix-active)); } [part="line-highlight-action"]:focus-visible { outline: var(--lr-focus-ring); outline-offset: var(--lr-focus-ring-offset); } [part="copy-button"] { position: sticky; inset-block-start: var(--lr-space-xs); z-index: var(--lr-layer-content); display: block; margin: var(--lr-space-xs); margin-inline-start: auto; border: var(--lr-border-width-thin) solid var(--lr-color-border); border-radius: var(--lr-radius); background: var(--lr-color-surface); color: var(--lr-color-text); font: inherit; font-size: var(--lr-font-size-xs); padding: var(--lr-size-0-125rem) var(--lr-space-s); ${iconHitTarget} cursor: pointer; transition: var(--lr-transition-interactive); } [part="copy-button"]:hover { border-color: var(--lr-color-brand); } [part="copy-button"]:active { border-color: var(--lr-color-brand); background: color-mix( in oklab, var(--lr-color-surface), var(--lr-color-mix-partner) var(--lr-color-mix-active) ); } [part="copy-button"]:focus-visible { ${focusRing} } `;export{styles};
1
+ import{iconHitTarget,focusRing}from"../../../internal/interactive-control.styles.js";import{css}from"lit";const styles=css` :host { display: block; --_lr-diff-view-max-height: none; --_lr-diff-view-font: var(--lr-font-mono); --_lr-diff-view-add-background: var(--lr-color-success-quiet); --_lr-diff-view-add-color: var(--lr-color-success); --_lr-diff-view-remove-background: var(--lr-color-danger-quiet); --_lr-diff-view-remove-color: var(--lr-color-danger); --_lr-diff-view-fold-background: var(--lr-color-surface-raised); --_lr-diff-view-fold-color: var(--lr-color-text-quiet); } [part="base"] { position: relative; max-block-size: var(--lr-diff-view-max-height, var(--_lr-diff-view-max-height)); border: var(--lr-border-width-thin) solid var(--lr-color-border-subtle); border-radius: var(--lr-radius); background: var(--lr-color-surface); overflow: auto; } pre { margin: 0; padding: var(--lr-space-s); } [part="limit"] { padding: var(--lr-space-m); color: var(--lr-color-text-quiet); overflow-wrap: anywhere; } .split-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--lr-space-s); align-items: start; padding: var(--lr-space-s); } [part="side"] { overflow-x: auto; overflow-y: hidden; min-inline-size: 0; } [part="line"] { content-visibility: auto; contain-intrinsic-block-size: auto calc(var(--lr-font-size-sm) * var(--lr-line-height-snug)); font-family: var(--lr-diff-view-font, var(--_lr-diff-view-font)); font-size: var(--lr-font-size-sm); line-height: var(--lr-line-height-snug); white-space: pre-wrap; box-sizing: border-box; inline-size: max-content; min-inline-size: 100%; } ins, del { text-decoration: none; } [part="line"]:not([data-type="fold"]) { direction: ltr; unicode-bidi: isolate; } [part="line"][data-type="add"] { background: var( --lr-diff-view-add-bg, var(--_lr-diff-view-add-background) ); color: var(--lr-diff-view-add-color, var(--_lr-diff-view-add-color)); } [part="line"][data-type="remove"] { background: var( --lr-diff-view-remove-bg, var(--_lr-diff-view-remove-background) ); color: var(--lr-diff-view-remove-color, var(--_lr-diff-view-remove-color)); } [part="line"][data-type="fold"] { color: var(--lr-diff-view-fold-color, var(--_lr-diff-view-fold-color)); background: var( --lr-diff-view-fold-bg, var(--_lr-diff-view-fold-background) ); text-align: center; } [part="line"][data-match] { outline: var(--lr-border-width-thin) dashed var(--lr-diff-view-match-color, var(--lr-color-warning)); } [part="line"][data-active-match] { outline: var(--lr-border-width-medium) solid var(--lr-diff-view-active-match-color, var(--lr-color-warning)); } [part="line"][data-highlight] { --_lr-diff-view-highlight-background: var( --lr-diff-view-highlight-accent-bg, var(--lr-color-brand-quiet) ); background: var(--_lr-diff-view-highlight-background); } [part="line"][data-highlight="success"] { --_lr-diff-view-highlight-background: var( --lr-diff-view-highlight-success-bg, var(--lr-color-success-quiet) ); } [part="line"][data-highlight="warning"] { --_lr-diff-view-highlight-background: var( --lr-diff-view-highlight-warning-bg, var(--lr-color-warning-quiet) ); } [part="line"][data-highlight="danger"] { --_lr-diff-view-highlight-background: var( --lr-diff-view-highlight-danger-bg, var(--lr-color-danger-quiet) ); } [part="line"][data-highlight="neutral"] { --_lr-diff-view-highlight-background: var( --lr-diff-view-highlight-neutral-bg, var(--lr-color-surface-raised) ); } [part="line"][data-active-highlight] { outline: var(--lr-border-width-medium) solid var(--lr-diff-view-highlight-active-outline, var(--lr-color-brand)); outline-offset: var(--lr-focus-ring-offset); } [part="line-highlight-action"] { display: inline-block; margin-inline-start: var(--lr-space-xs); ${iconHitTarget} border: var(--lr-border-width-thin) solid var(--lr-color-border); border-radius: var(--lr-radius); background: var(--lr-color-surface); color: var(--lr-color-text); cursor: pointer; font: inherit; font-size: var(--lr-font-size-xs); padding: var(--lr-size-0-125rem) var(--lr-space-xs); transition: var(--lr-transition-interactive); } [part="line-highlight-action"]:hover { background: var(--_lr-diff-view-highlight-background); } [part="line-highlight-action"]:active { background: color-mix(in oklab, var(--_lr-diff-view-highlight-background), var(--lr-color-mix-partner) var(--lr-color-mix-active)); } [part="line-highlight-action"]:focus-visible { outline: var(--lr-focus-ring); outline-offset: var(--lr-focus-ring-offset); } [part="copy-button"] { position: sticky; inset-block-start: var(--lr-space-xs); z-index: var(--lr-layer-content); display: block; margin: var(--lr-space-xs); margin-inline-start: auto; border: var(--lr-border-width-thin) solid var(--lr-color-border); border-radius: var(--lr-radius); background: var(--lr-color-surface); color: var(--lr-color-text); font: inherit; font-size: var(--lr-font-size-xs); padding: var(--lr-size-0-125rem) var(--lr-space-s); ${iconHitTarget} cursor: pointer; transition: var(--lr-transition-interactive); } [part="copy-button"]:hover { border-color: var(--lr-color-brand); } [part="copy-button"]:active { border-color: var(--lr-color-brand); background: color-mix( in oklab, var(--lr-color-surface), var(--lr-color-mix-partner) var(--lr-color-mix-active) ); } [part="copy-button"]:focus-visible { ${focusRing} } `;export{styles};
@@ -1,4 +1,4 @@
1
- import{type TemplateResult,type PropertyValues}from'lit';import{LyraElement}from'../../../internal/lyra-element.js';import type{LyraSearchChangeDetail}from'../../../internal/text-viewer-target.js';import{type LyraClipboardWriteFailure,type LyraClipboardWriteSuccess}from'../../../internal/clipboard.js';export interface LyraJsonViewerEventMap{'lr-copy':CustomEvent<LyraClipboardWriteSuccess>;'lr-error':CustomEvent<null>;'lr-copy-error':CustomEvent<LyraClipboardWriteFailure>;'lr-search-change':CustomEvent<LyraSearchChangeDetail>;}
1
+ import{type TemplateResult,type PropertyValues}from'lit';import{LyraElement}from'../../../internal/lyra-element.js';import type{LyraSearchChangeDetail}from'../../../internal/text-viewer-target.js';import type{LyraHierarchySource,LyraHierarchyQuery,LyraInspectionNode}from'../../../data-sources.js';export type JsonViewerTreeSource=LyraHierarchySource<LyraInspectionNode,LyraHierarchyQuery>;import{type LyraClipboardWriteFailure,type LyraClipboardWriteSuccess}from'../../../internal/clipboard.js';export interface LyraJsonViewerEventMap{'lr-copy':CustomEvent<LyraClipboardWriteSuccess>;'lr-error':CustomEvent<null>;'lr-copy-error':CustomEvent<LyraClipboardWriteFailure>;'lr-search-change':CustomEvent<LyraSearchChangeDetail>;}
2
2
  /**
3
3
  * `<lr-json-viewer>` — a collapsible, copyable tree view for an arbitrary
4
4
  * JSON-serializable value (object/array/string/number/boolean/null/
@@ -13,6 +13,15 @@ import{type TemplateResult,type PropertyValues}from'lit';import{LyraElement}from
13
13
  * initial/reconnect state and changes while the host is accessibility-hidden are silent, and the
14
14
  * shadow tree retains only an `aria-hidden` text mirror.
15
15
  *
16
+ * Property-only treeSource displays a complete provider hierarchy without admitting data. Source
17
+ * rows use own-descriptor closed inspection records (65,536 units per field); the shared cache,
18
+ * staging, focused row and projection state share a 2,000,000-unit envelope. Over-budget records
19
+ * fail closed. Source search counts global nodes, not separate key/value occurrences, and retains
20
+ * at most 10,000 hits regardless of maxNodes. Partial or unavailable search is never exact.
21
+ * Provider copy returns a complete node/subtree/document within 25 MiB UTF-8; mounted rows are
22
+ * never serialized as a substitute. maxHeight constrains the source scroller; source expansion is
23
+ * provider-owned. Removing treeSource restores the current data value.
24
+ *
16
25
  * @customElement lr-json-viewer
17
26
  * @event lr-copy - Clipboard writing from the top-level or per-node action fulfilled. The frozen
18
27
  * shared outcome detail is `{ ok: true, text }`.
@@ -32,6 +41,13 @@ import{type TemplateResult,type PropertyValues}from'lit';import{LyraElement}from
32
41
  * @csspart bracket - A `{`, `}`, `[`, or `]` delimiter.
33
42
  * @csspart toggle - A container node's expand/collapse button (hidden, but present for row alignment, on leaf/empty nodes).
34
43
  * @csspart copy-button - A copy-to-clipboard button -- the top-level one (in `toolbar`, labelled "Copy JSON to clipboard") or a per-node one (only rendered when `copyable`; labelled with its own key/type, e.g. "Copy age", so assistive tech can tell rows apart).
44
+ * @csspart source-list - Source-only bounded virtual scroller.
45
+ * @csspart source-row - Source-only flat tree item with logical hierarchy metadata.
46
+ * @csspart source-toggle - Source-only expand/collapse or retry action.
47
+ * @csspart source-label - Source-only inspection content with key/value/copy-button parts.
48
+ * @csspart source-status - Source-only loading, empty, and full-source count status.
49
+ * @csspart source-error - Source-only projection or row admission failure.
50
+ * @csspart search-status - Unavailable or partial global source search status.
35
51
  * @csspart limit - Localized notice shown when the depth/node traversal budget truncates rendering or search.
36
52
  * @cssprop [--lr-json-viewer-max-height=none] - Cap on `[part="base"]`'s block size, past which the
37
53
  * viewer scrolls internally. The `maxHeight` property sets this token inline on `[part="base"]`.
@@ -50,7 +66,17 @@ import{type TemplateResult,type PropertyValues}from'lit';import{LyraElement}from
50
66
  * @status stable
51
67
  * @since 4.0.0
52
68
  */
53
- export declare class LyraJsonViewer extends LyraElement<LyraJsonViewerEventMap>{static styles:import("lit").CSSResultGroup[];
69
+ export declare class LyraJsonViewer extends LyraElement<LyraJsonViewerEventMap>{static styles:import("lit").CSSResultGroup[];private _treeSource?;private sourceMode;private sourceSearchDirty;private sourceSearchIntent;private sourceCopyIntent;private sourceNavigationIntent;private sourceSearchTask;private sourceHits?;private sourceHitKeys;private sourceSearchExact;private sourceSearchUnavailable;private sourceBinding?;private sourceAnnouncement?;private readonly hierarchy;
70
+ /** Whole-source inspection provider. Takes display precedence over data; maxNodes and expandDepth
71
+ * apply only to legacy data. Reassign, including the same identity, or requestUpdate() to refresh.
72
+ * Source search returns at most 10,000 global node hits, independent of maxNodes.
73
+ * @default undefined */
74
+ get treeSource():JsonViewerTreeSource|undefined;set treeSource(value:JsonViewerTreeSource|undefined);
75
+ /** Reveals and focuses an exact provider key; compact keys can address arbitrarily deep nodes.
76
+ * Resolves false when absent, superseded, or no provider is active. */
77
+ revealSourceKey(key:string):Promise<boolean>;private syncSource;private normalizeSourceNode;private invalidateSourceSearch;private searchSource;private stepSourceSearch;private sourceSummary;private hasSourceCopy;private copySource;private sourceCopyButton;private renderSourceNode;private renderSource;
78
+ /** Maximum admitted, searched and rendered nodes, from 1 to 50,000; invalid values use 5,000. */
79
+ maxNodes:number;private get effectiveMaxNodes();
54
80
  /** The value to render. Any JSON-serializable value, plus `undefined`. */
55
81
  data:unknown;
56
82
  /** Nodes at or beyond this nesting depth (root = 0) start collapsed, so only the levels above it
@@ -62,11 +88,13 @@ maxHeight:string;
62
88
  /** Shows copy-to-clipboard affordances: one for the whole value, plus one per node. */
63
89
  copyable:boolean;
64
90
  /** Removing the attribute clears search without changing its null readback. Case-insensitive substring match against keys/values; matches are highlighted and their ancestors auto-expanded. See also `runSearch()`/`searchNext()`/`searchPrevious()`/`clearSearch()` for imperative, cursor-navigable search built on top of this property. */
65
- query:string;private expandedOverrides;private activeSearchIndex;private searchState;private searchLocale;private dataSnapshot;private dataSnapshotTruncated;private searchAnnouncementSink?;private searchAnnouncementsArmed;private searchAnnouncementGeneration;private copyFeedback;private copyFeedbackTimer?;connectedCallback():void;disconnectedCallback():void;private get safeExpandDepth();private previewText;private isExpanded;private toggleNode;private reportCopyFailure;private clearCopyFeedback;private showCopyFeedback;private copyLabel;private copy;private stringifyForClipboard;private computeSearch;private renderCopyButton;private renderNode;protected willUpdate(changed:PropertyValues):void;protected updated(changed:PropertyValues):void;private emitSearchChange;private revealActiveMatch;private activeSearchAnnouncement;
91
+ query:string;private expandedOverrides;private activeSearchIndex;private searchState;private searchLocale;private dataSnapshot;private dataSnapshotTruncated;private explicitRefresh;private treeMemo?;private readonly matchElements;private activeMatchElement?;requestUpdate(...args:Parameters<LyraElement['requestUpdate']>):void;private syncActiveMatch;private searchAnnouncementSink?;private searchAnnouncementsArmed;private searchAnnouncementGeneration;private copyFeedback;private copyFeedbackTimer?;connectedCallback():void;disconnectedCallback():void;adoptedCallback():void;private get safeExpandDepth();private previewText;private isExpanded;private toggleNode;private reportCopyFailure;private clearCopyFeedback;private showCopyFeedback;private copyLabel;private copy;private stringifyForClipboard;private computeSearch;private renderCopyButton;private renderNode;protected willUpdate(changed:PropertyValues):void;protected updated(changed:PropertyValues):void;private emitSearchChange;private revealActiveMatch;private activeSearchAnnouncement;
66
92
  /**
67
93
  * Sets the declarative `query` property and awaits the recompute -- the resolved count is the
68
94
  * number of matches (also `searchState.orderedMatches.length` / rendered `[data-match]` spans).
69
95
  *
96
+ * Source mode accepts at most 4,096 query units and returns the retained global node-hit count,
97
+ * up to 10,000 independently of maxNodes. Its cursor remains -1 until navigation.
70
98
  * The method form awaits the render update and returns the resulting match count; `query` also
71
99
  * supports declarative bindings that do not need a return value.
72
100
  */
@@ -1,4 +1,11 @@
1
- import{__decorate}from"tslib";import{html,nothing}from"lit";import{property,state}from"lit/decorators.js";import{repeat}from"lit/directives/repeat.js";import{styleMap}from"lit/directives/style-map.js";import{acquireAnnouncementSink}from"../../../internal/announcer.js";import{LyraElement}from"../../../internal/lyra-element.js";import{hostAriaLabel,srOnly}from"../../../internal/a11y.js";import{chevronIcon}from"../../../internal/icons.js";import{getNumberFormat}from"../../../internal/intl-cache.js";import{prefersReducedMotion}from"../../../internal/motion.js";import{finiteCount}from"../../../internal/numbers.js";import{viewerSearchDetail}from"../../../internal/viewer-search.js";import{getOwnDataDescriptor,MISSING_OWN_DATA_DESCRIPTOR,UNSAFE_OWN_DATA_DESCRIPTOR}from"../../../internal/data-descriptors.js";import{styles}from"./json-viewer.styles.js";import{sanitizeCssLength}from"../../../internal/safe-css.js";import{writeClipboardText}from"../../../internal/clipboard.js";import{COPY_FEEDBACK_MS}from"../../../internal/copy-feedback.js";import{LYRA_DEFAULT_copied,LYRA_DEFAULT_copy,LYRA_DEFAULT_copyFailed,LYRA_DEFAULT_viewerSearchActiveMatch,LYRA_DEFAULT_viewerSearchMatchCount,LYRA_DEFAULT_viewerSearchNoMatches}from"../../../internal/default-strings/shared.generated.js";import{LYRA_DEFAULT_circularReference,LYRA_DEFAULT_copyJson,LYRA_DEFAULT_jsonArray,LYRA_DEFAULT_jsonCollapseLabel,LYRA_DEFAULT_jsonCopyLabel,LYRA_DEFAULT_jsonExpandLabel,LYRA_DEFAULT_jsonItemCount,LYRA_DEFAULT_jsonKeyCount,LYRA_DEFAULT_jsonObject,LYRA_DEFAULT_jsonValue,LYRA_DEFAULT_jsonViewerLimit}from"../../../internal/default-strings/utility.generated.js";const COPY_CONFIRM_MS=COPY_FEEDBACK_MS,MAX_JSON_NODES=5e3,MAX_JSON_DEPTH=100,MAX_JSON_SNAPSHOT_INSPECTIONS=MAX_JSON_NODES*2,OMIT_JSON_SNAPSHOT=Symbol("omit-json-viewer-snapshot"),EMPTY_SEARCH={keyMatches:new Set,valueMatches:new Set,forceExpand:new Set,paths:new Set,orderedMatches:[],truncated:!1};function isArrayContainer(value){try{return Array.isArray(value)}catch{return!1}}function isSnapshotArray(value){return Array.isArray(value)}function snapshotJsonData(value){const budget={remainingNodes:MAX_JSON_NODES,remainingInspections:MAX_JSON_SNAPSHOT_INSPECTIONS,truncated:!1},projected=snapshotJsonValue(value,budget,new WeakMap,0);return Object.freeze({value:projected===OMIT_JSON_SNAPSHOT?void 0:projected,truncated:budget.truncated||projected===OMIT_JSON_SNAPSHOT})}function snapshotJsonValue(value,budget,copies,depth){if(budget.remainingNodes<=0)return budget.truncated=!0,OMIT_JSON_SNAPSHOT;if(budget.remainingNodes-=1,value==null||typeof value=="string"||typeof value=="number"||typeof value=="boolean"||typeof value=="bigint")return value;if(typeof value!="object")return budget.truncated=!0,OMIT_JSON_SNAPSHOT;const source=value,existing=copies.get(source);if(existing)return existing;const array=isArrayContainer(source);if(depth>=MAX_JSON_DEPTH){budget.truncated=!0;const shell=array?[]:Object.create(null);return copies.set(source,shell),Object.freeze(shell)}return array?snapshotJsonArray(source,budget,copies,depth):snapshotJsonObject(source,budget,copies,depth)}function snapshotJsonArray(source,budget,copies,depth){const length=getOwnDataDescriptor(source,"length");if(length===MISSING_OWN_DATA_DESCRIPTOR||length===UNSAFE_OWN_DATA_DESCRIPTOR||typeof length.value!="number"||!Number.isSafeInteger(length.value)||length.value<0)return budget.truncated=!0,OMIT_JSON_SNAPSHOT;const projected=[];copies.set(source,projected);let retainedLength=0;const count=Math.min(length.value,budget.remainingInspections);count<length.value&&(budget.truncated=!0);for(let index=0;index<count;index+=1){if(budget.remainingNodes<=0||budget.remainingInspections<=0){budget.truncated=!0;break}budget.remainingInspections-=1,retainedLength=index+1;const descriptor=getOwnDataDescriptor(source,String(index));if(descriptor===MISSING_OWN_DATA_DESCRIPTOR)continue;if(descriptor===UNSAFE_OWN_DATA_DESCRIPTOR){budget.truncated=!0;continue}const child=snapshotJsonValue(descriptor.value,budget,copies,depth+1);if(child===OMIT_JSON_SNAPSHOT){budget.truncated=!0;continue}projected[index]=child}projected.length=retainedLength;try{return Object.freeze(projected)}catch{return copies.delete(source),budget.truncated=!0,OMIT_JSON_SNAPSHOT}}function snapshotJsonObject(source,budget,copies,depth){const projected=Object.create(null);copies.set(source,projected);let keys;try{keys=Object.getOwnPropertyNames(source)}catch{return copies.delete(source),budget.truncated=!0,OMIT_JSON_SNAPSHOT}try{for(const key of keys){if(budget.remainingInspections<=0){budget.truncated=!0;break}budget.remainingInspections-=1;const descriptor=getOwnDataDescriptor(source,key);if(descriptor===MISSING_OWN_DATA_DESCRIPTOR)continue;if(descriptor===UNSAFE_OWN_DATA_DESCRIPTOR||!descriptor.enumerable){descriptor===UNSAFE_OWN_DATA_DESCRIPTOR&&(budget.truncated=!0);continue}if(budget.remainingNodes<=0){budget.truncated=!0;break}const child=snapshotJsonValue(descriptor.value,budget,copies,depth+1);if(child===OMIT_JSON_SNAPSHOT){budget.truncated=!0;continue}Object.defineProperty(projected,key,{value:child,enumerable:!0,configurable:!1,writable:!1})}return Object.freeze(projected)}catch{return copies.delete(source),budget.truncated=!0,OMIT_JSON_SNAPSHOT}}function entriesOf(value,limit){const entries=[];if(isSnapshotArray(value)){const total=value.length,count=Math.min(total,limit);for(let index=0;index<count;index+=1)entries.push([index,Object.hasOwn(value,index)?value[index]:void 0]);return{entries,truncated:total>count,total,exact:!0}}if(typeof value=="object"&&value!==null){let total=0;for(const key in value)total+=1,entries.length<limit&&entries.push([key,value[key]]);return{entries,truncated:total>entries.length,total,exact:!0}}return{entries,truncated:!1,total:0,exact:!0}}function valueType(value){if(value===null)return"null";if(value===void 0)return"undefined";if(isSnapshotArray(value))return"array";const t=typeof value;return t==="string"||t==="number"||t==="boolean"?t:t==="object"?"object":"string"}function formatPrimitive(value,type){return type==="string"&&typeof value=="string"?JSON.stringify(value):String(value)}class LyraJsonViewer extends LyraElement{constructor(){super(...arguments),this.maxHeight="",this.copyable=!1,this.query="",this.expandedOverrides=new Map,this.activeSearchIndex=-1,this.searchState=EMPTY_SEARCH,this.searchLocale="",this.dataSnapshot=void 0,this.dataSnapshotTruncated=!1,this.searchAnnouncementsArmed=!1,this.searchAnnouncementGeneration=0,this.copyFeedback=null}static{this.defaultStrings={...super.defaultStrings,circularReference:LYRA_DEFAULT_circularReference,copied:LYRA_DEFAULT_copied,copy:LYRA_DEFAULT_copy,copyFailed:LYRA_DEFAULT_copyFailed,copyJson:LYRA_DEFAULT_copyJson,jsonArray:LYRA_DEFAULT_jsonArray,jsonCollapseLabel:LYRA_DEFAULT_jsonCollapseLabel,jsonCopyLabel:LYRA_DEFAULT_jsonCopyLabel,jsonExpandLabel:LYRA_DEFAULT_jsonExpandLabel,jsonItemCount:LYRA_DEFAULT_jsonItemCount,jsonKeyCount:LYRA_DEFAULT_jsonKeyCount,jsonObject:LYRA_DEFAULT_jsonObject,jsonValue:LYRA_DEFAULT_jsonValue,jsonViewerLimit:LYRA_DEFAULT_jsonViewerLimit,viewerSearchActiveMatch:LYRA_DEFAULT_viewerSearchActiveMatch,viewerSearchMatchCount:LYRA_DEFAULT_viewerSearchMatchCount,viewerSearchNoMatches:LYRA_DEFAULT_viewerSearchNoMatches}}static{this.styles=[LyraElement.styles,styles,srOnly]}connectedCallback(){super.connectedCallback(),this.searchAnnouncementSink??=acquireAnnouncementSink("polite",{document:this.ownerDocument,source:this}),this.searchAnnouncementsArmed=!1;const generation=++this.searchAnnouncementGeneration;this.updateComplete.then(()=>{this.isConnected&&generation===this.searchAnnouncementGeneration&&(this.searchAnnouncementsArmed=!0)})}disconnectedCallback(){this.clearCopyFeedback(),this.searchAnnouncementGeneration+=1,this.searchAnnouncementSink?.release(),this.searchAnnouncementSink=void 0,this.searchAnnouncementsArmed=!1,super.disconnectedCallback()}get safeExpandDepth(){return this.expandDepth===void 0?void 0:finiteCount(this.expandDepth)}previewText(type,count,exact=!0){const formattedCount=getNumberFormat(this.effectiveLocale).format(count),localizedCount=exact?formattedCount:`≥${formattedCount}`;return type==="array"?this.localize("jsonItemCount",void 0,{count:localizedCount,pluralCount:count}):this.localize("jsonKeyCount",void 0,{count:localizedCount,pluralCount:count})}isExpanded(pathKey,depth,forceExpand){const override=this.expandedOverrides.get(pathKey);if(override!==void 0)return override;if(forceExpand.has(pathKey))return!0;const expandDepth=this.safeExpandDepth;return!(expandDepth!==void 0&&depth>=expandDepth)}toggleNode(pathKey,currentlyExpanded){const next=new Map(this.expandedOverrides);next.set(pathKey,!currentlyExpanded),this.expandedOverrides=next}reportCopyFailure(outcome){this.searchAnnouncementSink?.announce(this.localize("copyFailed")),this.emit("lr-error"),this.emit("lr-copy-error",outcome)}clearCopyFeedback(){const timer=this.copyFeedbackTimer;timer&&timer.owner.clearTimeout(timer.handle),this.copyFeedbackTimer=void 0,this.copyFeedback=null}showCopyFeedback(key,ok){const owner=this.ownerDocument.defaultView;owner&&(this.clearCopyFeedback(),this.copyFeedback={key,ok},this.copyFeedbackTimer={owner,handle:owner.setTimeout(()=>this.clearCopyFeedback(),COPY_CONFIRM_MS)})}copyLabel(key,rest){const feedback=this.copyFeedback;return feedback?.key===key?this.localize(feedback.ok?"copied":"copyFailed"):rest}async copy(value,key){this.clearCopyFeedback();let text="";try{text=value===void 0?"undefined":this.stringifyForClipboard(value)}catch(error){this.isConnected&&(this.showCopyFeedback(key,!1),this.reportCopyFailure(Object.freeze({ok:!1,text,reason:"failed",error})));return}const owner=this.isConnected?this.ownerDocument.defaultView:null,outcome=await writeClipboardText(owner,text);if(!(!this.isConnected||this.ownerDocument.defaultView!==owner)){if(this.showCopyFeedback(key,outcome.ok),!outcome.ok){this.reportCopyFailure(outcome);return}this.searchAnnouncementSink?.announce(this.localize("copied")),this.emit("lr-copy",outcome)}}stringifyForClipboard(value){const circularMarker=this.localize("circularReference"),stack=[],serialized=JSON.stringify(value,function(_key,v){if(typeof v=="bigint")return v.toString();if(typeof v!="object"||v===null)return v;const holderIndex=stack.indexOf(this);return stack.length=holderIndex+1,stack.includes(v)?circularMarker:(stack.push(v),v)},2);if(serialized!==void 0)return serialized;try{return formatPrimitive(value,valueType(value))}catch{return""}}computeSearch(){const locale=this.effectiveLocale,query=(this.query??"").trim().toLocaleLowerCase(locale),keyMatches=new Set,valueMatches=new Set,forceExpand=new Set,paths=new Set,orderedMatches=[],ancestors=new WeakSet;let truncated=this.dataSnapshotTruncated;const markAncestors=path=>{for(let i=path.length-1;i>=0;i--)forceExpand.add(JSON.stringify(path.slice(0,i)))},stack=[{kind:"visit",value:this.dataSnapshot,path:[]}];let visited=0;for(;stack.length>0;){const frame=stack.pop();if(frame.kind==="leave"){ancestors.delete(frame.value);continue}if(visited>=MAX_JSON_NODES){truncated=!0;break}visited+=1;const{value,path,keyLabel}=frame,pathKey=JSON.stringify(path);paths.add(pathKey);const type=valueType(value);if(query){let hit=!1;keyLabel!==void 0&&keyLabel.toLocaleLowerCase(locale).includes(query)&&(keyMatches.add(pathKey),orderedMatches.push({pathKey,kind:"key"}),hit=!0),type!=="object"&&type!=="array"&&formatPrimitive(value,type).toLocaleLowerCase(locale).includes(query)&&(valueMatches.add(pathKey),orderedMatches.push({pathKey,kind:"value"}),hit=!0),hit&&markAncestors(path)}if((type==="object"||type==="array")&&!ancestors.has(value)){const available=Math.max(0,MAX_JSON_NODES-visited),{entries,truncated:entriesTruncated}=entriesOf(value,available);if(entriesTruncated&&(truncated=!0),path.length>=MAX_JSON_DEPTH){entries.length>0&&(truncated=!0);continue}ancestors.add(value),stack.push({kind:"leave",value});for(let index=entries.length-1;index>=0;index-=1){const[key,child]=entries[index];stack.push({kind:"visit",value:child,path:[...path,key],keyLabel:String(key)})}}}return{keyMatches,valueMatches,forceExpand,paths,orderedMatches,truncated}}renderCopyButton(value,label,pathKey){if(!this.copyable)return nothing;const resolvedLabel=label??this.localize("jsonValue");return html`
1
+ import{__decorate}from"tslib";import{html,nothing}from"lit";import{property,state}from"lit/decorators.js";import{repeat}from"lit/directives/repeat.js";import{ref}from"lit/directives/ref.js";import{lyraLocaleCatalogVersion}from"../../../internal/localization-runtime.js";import{styleMap}from"lit/directives/style-map.js";import{acquireAnnouncementSink}from"../../../internal/announcer.js";import{LyraElement}from"../../../internal/lyra-element.js";import{hostAriaLabel,srOnly}from"../../../internal/a11y.js";import{chevronIcon}from"../../../internal/icons.js";import{getNumberFormat}from"../../../internal/intl-cache.js";import{prefersReducedMotion}from"../../../internal/motion.js";import{finiteCount}from"../../../internal/numbers.js";import{viewerSearchDetail}from"../../../internal/viewer-search.js";import{getOwnDataDescriptor,MISSING_OWN_DATA_DESCRIPTOR,UNSAFE_OWN_DATA_DESCRIPTOR}from"../../../internal/data-descriptors.js";import{styles}from"./json-viewer.styles.js";import{HierarchySourceController,hierarchyField}from"../../../internal/hierarchy-source-controller.js";import{hierarchySourceView}from"../../../internal/hierarchy-source-view.js";import{hierarchySourceStyles}from"../../../internal/hierarchy-source-view.styles.js";const INSPECTION_KINDS=new Set(["object","array","scalar","element","attribute","text","comment","processing-instruction"]);import{sanitizeCssLength}from"../../../internal/safe-css.js";import{writeClipboardText,clipboardFailureReason}from"../../../internal/clipboard.js";import{COPY_FEEDBACK_MS}from"../../../internal/copy-feedback.js";import{LYRA_DEFAULT_collapse,LYRA_DEFAULT_copied,LYRA_DEFAULT_copy,LYRA_DEFAULT_copyFailed,LYRA_DEFAULT_expand,LYRA_DEFAULT_loading,LYRA_DEFAULT_noData,LYRA_DEFAULT_retry,LYRA_DEFAULT_sourceSearchUnavailable,LYRA_DEFAULT_treeSourceError,LYRA_DEFAULT_treeSourceSummary,LYRA_DEFAULT_viewerSearchActiveMatch,LYRA_DEFAULT_viewerSearchMatchCount,LYRA_DEFAULT_viewerSearchNoMatches}from"../../../internal/default-strings/shared.generated.js";import{LYRA_DEFAULT_circularReference,LYRA_DEFAULT_copyJson,LYRA_DEFAULT_jsonArray,LYRA_DEFAULT_jsonCollapseLabel,LYRA_DEFAULT_jsonCopyLabel,LYRA_DEFAULT_jsonExpandLabel,LYRA_DEFAULT_jsonItemCount,LYRA_DEFAULT_jsonKeyCount,LYRA_DEFAULT_jsonObject,LYRA_DEFAULT_jsonValue,LYRA_DEFAULT_jsonViewerLimit}from"../../../internal/default-strings/utility.generated.js";const COPY_CONFIRM_MS=COPY_FEEDBACK_MS,MAX_JSON_NODES=5e3,MAX_JSON_DEPTH=100,OMIT_JSON_SNAPSHOT=Symbol("omit-json-viewer-snapshot"),EMPTY_SEARCH={keyMatches:new Set,valueMatches:new Set,forceExpand:new Set,paths:new Set,orderedMatches:[],truncated:!1};function isArrayContainer(value){try{return Array.isArray(value)}catch{return!1}}function isSnapshotArray(value){return Array.isArray(value)}function snapshotJsonData(value,maxNodes){const budget={remainingNodes:maxNodes,remainingInspections:maxNodes*2,truncated:!1},projected=snapshotJsonValue(value,budget,new WeakMap,0);return Object.freeze({value:projected===OMIT_JSON_SNAPSHOT?void 0:projected,truncated:budget.truncated||projected===OMIT_JSON_SNAPSHOT})}function snapshotJsonValue(value,budget,copies,depth){if(budget.remainingNodes<=0)return budget.truncated=!0,OMIT_JSON_SNAPSHOT;if(budget.remainingNodes-=1,value==null||typeof value=="string"||typeof value=="number"||typeof value=="boolean"||typeof value=="bigint")return value;if(typeof value!="object")return budget.truncated=!0,OMIT_JSON_SNAPSHOT;const source=value,existing=copies.get(source);if(existing)return existing;const array=isArrayContainer(source);if(depth>=MAX_JSON_DEPTH){budget.truncated=!0;const shell=array?[]:Object.create(null);return copies.set(source,shell),Object.freeze(shell)}return array?snapshotJsonArray(source,budget,copies,depth):snapshotJsonObject(source,budget,copies,depth)}function snapshotJsonArray(source,budget,copies,depth){const length=getOwnDataDescriptor(source,"length");if(length===MISSING_OWN_DATA_DESCRIPTOR||length===UNSAFE_OWN_DATA_DESCRIPTOR||typeof length.value!="number"||!Number.isSafeInteger(length.value)||length.value<0)return budget.truncated=!0,OMIT_JSON_SNAPSHOT;const projected=[];copies.set(source,projected);let retainedLength=0;const count=Math.min(length.value,budget.remainingInspections);count<length.value&&(budget.truncated=!0);for(let index=0;index<count;index+=1){if(budget.remainingNodes<=0||budget.remainingInspections<=0){budget.truncated=!0;break}budget.remainingInspections-=1,retainedLength=index+1;const descriptor=getOwnDataDescriptor(source,String(index));if(descriptor===MISSING_OWN_DATA_DESCRIPTOR)continue;if(descriptor===UNSAFE_OWN_DATA_DESCRIPTOR){budget.truncated=!0;continue}const child=snapshotJsonValue(descriptor.value,budget,copies,depth+1);if(child===OMIT_JSON_SNAPSHOT){budget.truncated=!0;continue}projected[index]=child}projected.length=retainedLength;try{return Object.freeze(projected)}catch{return copies.delete(source),budget.truncated=!0,OMIT_JSON_SNAPSHOT}}function snapshotJsonObject(source,budget,copies,depth){const projected=Object.create(null);copies.set(source,projected);let keys;try{keys=Object.getOwnPropertyNames(source)}catch{return copies.delete(source),budget.truncated=!0,OMIT_JSON_SNAPSHOT}try{for(const key of keys){if(budget.remainingInspections<=0){budget.truncated=!0;break}budget.remainingInspections-=1;const descriptor=getOwnDataDescriptor(source,key);if(descriptor===MISSING_OWN_DATA_DESCRIPTOR)continue;if(descriptor===UNSAFE_OWN_DATA_DESCRIPTOR||!descriptor.enumerable){descriptor===UNSAFE_OWN_DATA_DESCRIPTOR&&(budget.truncated=!0);continue}if(budget.remainingNodes<=0){budget.truncated=!0;break}const child=snapshotJsonValue(descriptor.value,budget,copies,depth+1);if(child===OMIT_JSON_SNAPSHOT){budget.truncated=!0;continue}Object.defineProperty(projected,key,{value:child,enumerable:!0,configurable:!1,writable:!1})}return Object.freeze(projected)}catch{return copies.delete(source),budget.truncated=!0,OMIT_JSON_SNAPSHOT}}function entriesOf(value,limit){const entries=[];if(isSnapshotArray(value)){const total=value.length,count=Math.min(total,limit);for(let index=0;index<count;index+=1)entries.push([index,Object.hasOwn(value,index)?value[index]:void 0]);return{entries,truncated:total>count,total,exact:!0}}if(typeof value=="object"&&value!==null){let total=0;for(const key in value)total+=1,entries.length<limit&&entries.push([key,value[key]]);return{entries,truncated:total>entries.length,total,exact:!0}}return{entries,truncated:!1,total:0,exact:!0}}function valueType(value){if(value===null)return"null";if(value===void 0)return"undefined";if(isSnapshotArray(value))return"array";const t=typeof value;return t==="string"||t==="number"||t==="boolean"?t:t==="object"?"object":"string"}function formatPrimitive(value,type){return type==="string"&&typeof value=="string"?JSON.stringify(value):String(value)}class LyraJsonViewer extends LyraElement{constructor(){super(...arguments),this.sourceMode=!1,this.sourceSearchDirty=!0,this.sourceSearchIntent=0,this.sourceCopyIntent=0,this.sourceNavigationIntent=0,this.sourceSearchTask=Promise.resolve(0),this.sourceHitKeys=new Set,this.sourceSearchExact=!0,this.sourceSearchUnavailable=!1,this.hierarchy=new HierarchySourceController(this,{normalize:(value,key)=>this.normalizeSourceNode(value,key),onChange:()=>this.requestUpdate("sourceState",null),accepted:()=>{},payload:{maxUnits:2e6,maxRowUnits:327702,unitsOf:node=>node.name.length+node.path.length+(node.value?.length??0)+node.kind.length}}),this.maxNodes=5e3,this.maxHeight="",this.copyable=!1,this.query="",this.expandedOverrides=new Map,this.activeSearchIndex=-1,this.searchState=EMPTY_SEARCH,this.searchLocale="",this.dataSnapshot=void 0,this.dataSnapshotTruncated=!1,this.explicitRefresh=0,this.matchElements=new Map,this.searchAnnouncementsArmed=!1,this.searchAnnouncementGeneration=0,this.copyFeedback=null}static{this.defaultStrings={...super.defaultStrings,circularReference:LYRA_DEFAULT_circularReference,collapse:LYRA_DEFAULT_collapse,copied:LYRA_DEFAULT_copied,copy:LYRA_DEFAULT_copy,copyFailed:LYRA_DEFAULT_copyFailed,copyJson:LYRA_DEFAULT_copyJson,expand:LYRA_DEFAULT_expand,jsonArray:LYRA_DEFAULT_jsonArray,jsonCollapseLabel:LYRA_DEFAULT_jsonCollapseLabel,jsonCopyLabel:LYRA_DEFAULT_jsonCopyLabel,jsonExpandLabel:LYRA_DEFAULT_jsonExpandLabel,jsonItemCount:LYRA_DEFAULT_jsonItemCount,jsonKeyCount:LYRA_DEFAULT_jsonKeyCount,jsonObject:LYRA_DEFAULT_jsonObject,jsonValue:LYRA_DEFAULT_jsonValue,jsonViewerLimit:LYRA_DEFAULT_jsonViewerLimit,loading:LYRA_DEFAULT_loading,noData:LYRA_DEFAULT_noData,retry:LYRA_DEFAULT_retry,sourceSearchUnavailable:LYRA_DEFAULT_sourceSearchUnavailable,treeSourceError:LYRA_DEFAULT_treeSourceError,treeSourceSummary:LYRA_DEFAULT_treeSourceSummary,viewerSearchActiveMatch:LYRA_DEFAULT_viewerSearchActiveMatch,viewerSearchMatchCount:LYRA_DEFAULT_viewerSearchMatchCount,viewerSearchNoMatches:LYRA_DEFAULT_viewerSearchNoMatches}}static{this.styles=[LyraElement.styles,hierarchySourceStyles,styles,srOnly]}get treeSource(){return this._treeSource}set treeSource(value){const previous=this._treeSource;this._treeSource=value,this.invalidateSourceSearch(),this.syncSource(!0),this.requestUpdate("treeSource",previous)}revealSourceKey(key){return this.sourceNavigationIntent++,this.treeSource===void 0?Promise.resolve(!1):this.hierarchy.reveal(key)}syncSource(force=!1){if(!this.hierarchy)return;const source=this.treeSource,query=this.query??"",locale=this.effectiveLocale,binding=this.sourceBinding;source===void 0&&!this.sourceMode&&binding?.source===void 0||!force&&binding&&binding.source===source&&binding.query===query&&binding.locale===locale||(this.invalidateSourceSearch(),this.hierarchy.update(source,locale,force,{search:query,hiddenKinds:[]}),source===this.treeSource&&query===(this.query??"")&&locale===this.effectiveLocale&&(this.sourceBinding={source,query,locale}))}normalizeSourceNode(value,key){const name=hierarchyField(value,"name"),path=hierarchyField(value,"path"),kind=hierarchyField(value,"kind"),text=hierarchyField(value,"value");if(typeof name!="string"||name.length>65536||typeof path!="string"||path.length>65536||path!==key||typeof kind!="string"||!INSPECTION_KINDS.has(kind)||text!==void 0&&(typeof text!="string"||text.length>65536))throw new TypeError("Invalid inspection node");return Object.freeze({name,path,kind,...text===void 0?{}:{value:text}})}invalidateSourceSearch(){this.sourceSearchIntent=(this.sourceSearchIntent??0)+1,this.sourceCopyIntent=(this.sourceCopyIntent??0)+1,this.sourceNavigationIntent=(this.sourceNavigationIntent??0)+1,this.sourceHits=void 0,this.sourceHitKeys?.clear(),this.sourceSearchExact=!0,this.sourceSearchUnavailable=!1,this.sourceSearchDirty=!0,this.activeSearchIndex!==void 0&&(this._treeSource!==void 0||this.sourceMode)&&(this.activeSearchIndex=-1),this.copyFeedback!==void 0&&this.clearCopyFeedback()}async searchSource(){this.sourceSearchDirty=!1;const intent=this.sourceSearchIntent,provider=this.treeSource;if(!(this.query??""))return this.hierarchy.cancelSearch(),this.hasUpdated&&this.emitSearchChange(),0;const result=await this.hierarchy.search();return intent!==this.sourceSearchIntent||provider!==this.treeSource||!this.isConnected||result.status==="stale"||result.status==="ready"&&!result.isCurrent()?0:(this.sourceHits=result.status==="ready"?result:void 0,this.sourceHitKeys=new Set(this.sourceHits?.value.hits.map(hit=>hit.key)??[]),this.sourceSearchExact=result.status==="ready"&&result.value.exhaustive,this.sourceSearchUnavailable=result.status!=="ready",this.requestUpdate("sourceSearchResult",null),this.emitSearchChange(),await this.updateComplete,intent===this.sourceSearchIntent?this.sourceHitKeys.size:0)}async stepSourceSearch(direction){const navigation=++this.sourceNavigationIntent,hits=this.sourceHits;if(!hits?.isCurrent()||!hits.value.hits.length)return!1;const size=hits.value.hits.length;this.activeSearchIndex=this.activeSearchIndex<0?direction===1?0:size-1:(this.activeSearchIndex+direction+size)%size;const found=await this.hierarchy.reveal(hits.value.hits[this.activeSearchIndex].key);return!found||navigation!==this.sourceNavigationIntent||!hits.isCurrent()||this.sourceHits!==hits?!1:(this.emitSearchChange(),found)}sourceSummary(){const projection=this.hierarchy.projection;return projection?this.localize("treeSourceSummary",void 0,{visible:getNumberFormat(this.effectiveLocale).format(projection.rows.count),total:getNumberFormat(this.effectiveLocale).format(projection.total)}):""}hasSourceCopy(){const source=this.treeSource;try{const available=typeof source?.copy=="function";return source===this.treeSource&&available}catch{return!1}}async copySource(key,scope){const source=this.treeSource,epoch=this.hierarchy.epoch,owner=this.ownerDocument,intent=++this.sourceCopyIntent,current=()=>this.treeSource===source&&this.hierarchy.epoch===epoch&&this.ownerDocument===owner&&this.isConnected&&intent===this.sourceCopyIntent;this.clearCopyFeedback();const result=await this.hierarchy.copy(key,scope,25*1024*1024);if(!current()||result.status==="stale")return;const feedback=key??"toolbar";if(result.status!=="ready"){this.showCopyFeedback(feedback,!1);const message=this.localize("copyFailed");current()&&this.searchAnnouncementSink?.announce(message);return}const accepted=()=>current()&&result.isCurrent();if(!accepted())return;let outcome;try{const clipboard=owner.defaultView?.navigator.clipboard,write=clipboard?.writeText;if(!accepted())return;typeof write!="function"?outcome=Object.freeze({ok:!1,text:result.value,reason:"unsupported",error:new Error("Clipboard is unavailable")}):(await write.call(clipboard,result.value),outcome=Object.freeze({ok:!0,text:result.value}))}catch(error){outcome=Object.freeze({ok:!1,text:result.value,reason:clipboardFailureReason(error),error})}if(accepted())if(this.showCopyFeedback(feedback,outcome.ok),outcome.ok){const message=this.localize("copied");if(!accepted())return;this.searchAnnouncementSink?.announce(message),accepted()&&this.emit("lr-copy",outcome)}else{const message=this.localize("copyFailed");if(!accepted()||(this.searchAnnouncementSink?.announce(message),!accepted()))return;this.emit("lr-error"),accepted()&&this.emit("lr-copy-error",outcome)}}sourceCopyButton(node){if(!this.copyable||!this.hasSourceCopy())return nothing;const source=this.treeSource,epoch=this.hierarchy.epoch,key=node?.path??null,projection=this.hierarchy.projection,label=node?this.localize("jsonCopyLabel",void 0,{label:node.name}):this.localize("copyJson");return html`<button part="copy-button" type="button" aria-label=${this.copyLabel(key??"toolbar",label)}
2
+ @keydown=${event=>event.stopPropagation()}
3
+ @click=${event=>{event.stopPropagation();const button=event.currentTarget;button.isConnected&&button.getRootNode()===this.renderRoot&&!this.hierarchy.loading&&projection===this.hierarchy.projection&&source===this.treeSource&&epoch===this.hierarchy.epoch&&this.copySource(key,node?node.kind==="object"||node.kind==="array"||node.kind==="element"?"subtree":"node":"document")}}>${this.copyLabel(key??"toolbar",this.localize("copy"))}</button>`}renderSourceNode(node){const match=this.sourceHits?.isCurrent()&&this.sourceHitKeys.has(node.path),active=this.sourceHits?.value.hits[this.activeSearchIndex]?.key===node.path;return html`<span part="key" ?data-match=${match} ?data-active=${active}>${node.name}</span><span aria-hidden="true">:</span><span
4
+ part="value" data-type=${node.kind==="scalar"?"string":node.kind} ?data-match=${match} ?data-active=${active}>${node.value??node.kind}</span>${this.sourceCopyButton(node)}`}renderSource(){const partial=!this.sourceSearchExact&&!!this.query,count=this.sourceHitKeys.size;return html`<div class="source-shell" style=${styleMap({"--lr-json-viewer-max-height":sanitizeCssLength(this.maxHeight)??"var(--lr-size-20rem)"})}>
5
+ ${this.copyable&&this.hasSourceCopy()?html`<div part="toolbar">${this.sourceCopyButton()}</div>`:nothing}
6
+ ${hierarchySourceView(this.hierarchy,{label:hostAriaLabel(this)??this.localize("jsonValue"),rtl:this.effectiveDirection==="rtl",multiple:!1,loading:this.localize("loading"),error:this.localize("treeSourceError"),empty:this.localize("noData"),retry:this.localize("retry"),expand:this.localize("expand"),collapse:this.localize("collapse"),summary:this.sourceSummary(),name:node=>node.name,content:node=>this.renderSourceNode(node),select:()=>{}})}
7
+ ${partial?html`<div part="search-status">${this.sourceSearchUnavailable?this.localize("sourceSearchUnavailable"):this.localize("viewerSearchMatchCount",void 0,{count:`≥${getNumberFormat(this.effectiveLocale).format(count)}`,pluralCount:count})}</div>`:nothing}
8
+ </div>`}get effectiveMaxNodes(){return Math.max(1,finiteCount(this.maxNodes,MAX_JSON_NODES,5e4))}requestUpdate(...args){args[0]===void 0&&(this.explicitRefresh=(this.explicitRefresh??0)+1),this._treeSource!==void 0&&(args[0]===void 0||args[0]==="query")&&(this.invalidateSourceSearch(),this.syncSource(args[0]===void 0)),super.requestUpdate(...args)}syncActiveMatch(){const match=this.searchState.orderedMatches[this.activeSearchIndex],next=match?this.matchElements.get(`${match.kind}:${match.pathKey}`):void 0;this.activeMatchElement!==next&&(this.activeMatchElement?.removeAttribute("data-active"),this.activeMatchElement?.setAttribute("aria-current","false")),next?.setAttribute("data-active",""),next?.setAttribute("aria-current","true"),this.activeMatchElement=next}connectedCallback(){super.connectedCallback(),this.sourceBinding=void 0,this.requestUpdate("sourceReconnect",null),this.searchAnnouncementSink??=acquireAnnouncementSink("polite",{document:this.ownerDocument,source:this}),this.searchAnnouncementsArmed=!1;const generation=++this.searchAnnouncementGeneration;this.updateComplete.then(()=>{this.isConnected&&generation===this.searchAnnouncementGeneration&&(this.searchAnnouncementsArmed=!0)})}disconnectedCallback(){this.invalidateSourceSearch(),this.sourceBinding=void 0,this.clearCopyFeedback(),this.searchAnnouncementGeneration+=1,this.searchAnnouncementSink?.release(),this.searchAnnouncementSink=void 0,this.searchAnnouncementsArmed=!1,super.disconnectedCallback()}adoptedCallback(){this.invalidateSourceSearch(),this.sourceBinding=void 0,this.hierarchy.adopted(),this.searchAnnouncementSink?.release(),this.searchAnnouncementSink=void 0,this.isConnected&&(this.searchAnnouncementSink=acquireAnnouncementSink("polite",{document:this.ownerDocument,source:this})),this.sourceAnnouncement=void 0,super.adoptedCallback()}get safeExpandDepth(){return this.expandDepth===void 0?void 0:finiteCount(this.expandDepth)}previewText(type,count,exact=!0){const formattedCount=getNumberFormat(this.effectiveLocale).format(count),localizedCount=exact?formattedCount:`≥${formattedCount}`;return type==="array"?this.localize("jsonItemCount",void 0,{count:localizedCount,pluralCount:count}):this.localize("jsonKeyCount",void 0,{count:localizedCount,pluralCount:count})}isExpanded(pathKey,depth,forceExpand){const override=this.expandedOverrides.get(pathKey);if(override!==void 0)return override;if(forceExpand.has(pathKey))return!0;const expandDepth=this.safeExpandDepth;return!(expandDepth!==void 0&&depth>=expandDepth)}toggleNode(pathKey,currentlyExpanded){const next=new Map(this.expandedOverrides);next.set(pathKey,!currentlyExpanded),this.expandedOverrides=next}reportCopyFailure(outcome,current=()=>!0){this.searchAnnouncementSink?.announce(this.localize("copyFailed")),current()&&this.emit("lr-error"),current()&&this.emit("lr-copy-error",outcome)}clearCopyFeedback(){const timer=this.copyFeedbackTimer;timer&&timer.owner.clearTimeout(timer.handle),this.copyFeedbackTimer=void 0,this.copyFeedback=null}showCopyFeedback(key,ok){const owner=this.ownerDocument.defaultView;owner&&(this.clearCopyFeedback(),this.copyFeedback={key,ok},this.copyFeedbackTimer={owner,handle:owner.setTimeout(()=>this.clearCopyFeedback(),COPY_CONFIRM_MS)})}copyLabel(key,rest){const feedback=this.copyFeedback;return feedback?.key===key?this.localize(feedback.ok?"copied":"copyFailed"):rest}async copy(value,key){if(this.treeSource!==void 0)return;const sourceIntent=this.sourceCopyIntent,current=()=>this.treeSource===void 0&&sourceIntent===this.sourceCopyIntent;this.clearCopyFeedback();let text="";try{text=value===void 0?"undefined":this.stringifyForClipboard(value)}catch(error){this.isConnected&&current()&&(this.showCopyFeedback(key,!1),this.reportCopyFailure(Object.freeze({ok:!1,text,reason:"failed",error}),current));return}if(!current())return;const owner=this.isConnected?this.ownerDocument.defaultView:null,outcome=await writeClipboardText(owner,text);if(!(!current()||!this.isConnected||this.ownerDocument.defaultView!==owner)){if(this.showCopyFeedback(key,outcome.ok),!outcome.ok){this.reportCopyFailure(outcome,current);return}this.searchAnnouncementSink?.announce(this.localize("copied")),this.emit("lr-copy",outcome)}}stringifyForClipboard(value){const circularMarker=this.localize("circularReference"),stack=[],serialized=JSON.stringify(value,function(_key,v){if(typeof v=="bigint")return v.toString();if(typeof v!="object"||v===null)return v;const holderIndex=stack.indexOf(this);return stack.length=holderIndex+1,stack.includes(v)?circularMarker:(stack.push(v),v)},2);if(serialized!==void 0)return serialized;try{return formatPrimitive(value,valueType(value))}catch{return""}}computeSearch(){const locale=this.effectiveLocale,query=(this.query??"").trim().toLocaleLowerCase(locale),keyMatches=new Set,valueMatches=new Set,forceExpand=new Set,paths=new Set,orderedMatches=[],ancestors=new WeakSet;let truncated=this.dataSnapshotTruncated;const markAncestors=path=>{for(let i=path.length-1;i>=0;i--)forceExpand.add(JSON.stringify(path.slice(0,i)))},stack=[{kind:"visit",value:this.dataSnapshot,path:[]}];let visited=0;for(;stack.length>0;){const frame=stack.pop();if(frame.kind==="leave"){ancestors.delete(frame.value);continue}if(visited>=this.effectiveMaxNodes){truncated=!0;break}visited+=1;const{value,path,keyLabel}=frame,pathKey=JSON.stringify(path);paths.add(pathKey);const type=valueType(value);if(query){let hit=!1;keyLabel!==void 0&&keyLabel.toLocaleLowerCase(locale).includes(query)&&(keyMatches.add(pathKey),orderedMatches.push({pathKey,kind:"key"}),hit=!0),type!=="object"&&type!=="array"&&formatPrimitive(value,type).toLocaleLowerCase(locale).includes(query)&&(valueMatches.add(pathKey),orderedMatches.push({pathKey,kind:"value"}),hit=!0),hit&&markAncestors(path)}if((type==="object"||type==="array")&&!ancestors.has(value)){const available=Math.max(0,this.effectiveMaxNodes-visited),{entries,truncated:entriesTruncated}=entriesOf(value,available);if(entriesTruncated&&(truncated=!0),path.length>=MAX_JSON_DEPTH){entries.length>0&&(truncated=!0);continue}ancestors.add(value),stack.push({kind:"leave",value});for(let index=entries.length-1;index>=0;index-=1){const[key,child]=entries[index];stack.push({kind:"visit",value:child,path:[...path,key],keyLabel:String(key)})}}}return{keyMatches,valueMatches,forceExpand,paths,orderedMatches,truncated}}renderCopyButton(value,label,pathKey){if(!this.copyable)return nothing;const resolvedLabel=label??this.localize("jsonValue");return html`
2
9
  <button
3
10
  part="copy-button"
4
11
  type="button"
@@ -23,6 +30,7 @@ import{__decorate}from"tslib";import{html,nothing}from"lit";import{property,stat
23
30
  </button>
24
31
  ${keyLabel!==void 0?html`<span
25
32
  part="key"
33
+ ${ref(element=>{element&&this.matchElements.set(`key:${pathKey}`,element)})}
26
34
  ?data-match=${search.keyMatches.has(pathKey)}
27
35
  ?data-active=${!!activeMatch&&activeMatch.pathKey===pathKey&&activeMatch.kind==="key"}
28
36
  aria-current=${activeMatch&&activeMatch.pathKey===pathKey&&activeMatch.kind==="key"?"true":"false"}
@@ -38,6 +46,7 @@ import{__decorate}from"tslib";import{html,nothing}from"lit";import{property,stat
38
46
  ${expanded?nothing:html`<span part="bracket">${closeBracket}</span>`}
39
47
  `:html`<span
40
48
  part="value"
49
+ ${ref(element=>{element&&this.matchElements.set(`value:${pathKey}`,element)})}
41
50
  data-type=${type}
42
51
  ?data-match=${search.valueMatches.has(pathKey)}
43
52
  ?data-active=${!!activeMatch&&activeMatch.pathKey===pathKey&&activeMatch.kind==="value"}
@@ -59,7 +68,7 @@ import{__decorate}from"tslib";import{html,nothing}from"lit";import{property,stat
59
68
  </div>
60
69
  `:nothing}
61
70
  </div>
62
- `}willUpdate(changed){if(super.willUpdate(changed),!this.hasUpdated||changed.has("data")){const snapshot=snapshotJsonData(this.data);this.dataSnapshot=snapshot.value,this.dataSnapshotTruncated=snapshot.truncated}const locale=this.effectiveLocale;if(!this.hasUpdated||changed.has("data")||changed.has("query")||locale!==this.searchLocale){this.searchLocale=locale;const next=this.computeSearch();if(!this.hasUpdated||changed.has("data")){let pruned=null;for(const key of this.expandedOverrides.keys())next.paths.has(key)||(pruned??=new Map(this.expandedOverrides),pruned.delete(key));pruned&&(this.expandedOverrides=pruned)}this.searchState=next,this.hasUpdated&&(this.activeSearchIndex=-1,this.emitSearchChange())}}updated(changed){super.updated(changed),this.searchAnnouncementsArmed&&changed.has("activeSearchIndex")&&this.searchAnnouncementSink?.announce(this.activeSearchAnnouncement())}emitSearchChange(){this.emit("lr-search-change",viewerSearchDetail(this.query,this.searchState.orderedMatches.length,!this.searchState.truncated,this.activeSearchIndex))}revealActiveMatch(){const match=this.searchState.orderedMatches[this.activeSearchIndex];if(!match)return;let path;try{path=JSON.parse(match.pathKey)}catch{return}if(!Array.isArray(path))return;let next=null;for(let depth=0;depth<path.length;depth++){const ancestorKey=JSON.stringify(path.slice(0,depth));this.expandedOverrides.get(ancestorKey)!==!0&&(next??=new Map(this.expandedOverrides),next.set(ancestorKey,!0))}next&&(this.expandedOverrides=next)}activeSearchAnnouncement(){const total=this.searchState.orderedMatches.length;if(this.activeSearchIndex<0||total===0)return"";const numberFormat=getNumberFormat(this.effectiveLocale);return this.localize("viewerSearchActiveMatch",void 0,{current:numberFormat.format(this.activeSearchIndex+1),total:this.searchState.truncated?`≥${numberFormat.format(total)}`:numberFormat.format(total)})}async runSearch(query){return this.query=query,await this.updateComplete,this.searchState.orderedMatches.length}async searchNext(){const total=this.searchState.orderedMatches.length;return total===0?!1:(this.activeSearchIndex=(this.activeSearchIndex+1)%total,this.revealActiveMatch(),this.emitSearchChange(),await this.scrollActiveMatchIntoView(),!0)}async searchPrevious(){const total=this.searchState.orderedMatches.length;return total===0?!1:(this.activeSearchIndex=this.activeSearchIndex<0?total-1:(this.activeSearchIndex-1+total)%total,this.revealActiveMatch(),this.emitSearchChange(),await this.scrollActiveMatchIntoView(),!0)}clearSearch(){this.query=""}async scrollActiveMatchIntoView(){await this.updateComplete,this.renderRoot.querySelector("[data-active]")?.scrollIntoView({behavior:prefersReducedMotion(this)?"auto":"smooth",block:"nearest"})}render(){const budget={remaining:MAX_JSON_NODES,truncated:!1},tree=this.renderNode(this.dataSnapshot,[],void 0,0,this.searchState,new WeakSet,budget),limited=budget.truncated||this.searchState.truncated||this.dataSnapshotTruncated;return html`
71
+ `}willUpdate(changed){super.willUpdate(changed);const wasSource=this.sourceMode;if(this.syncSource(),this.treeSource!==void 0){this.sourceMode||(this.sourceMode=!0,this.dataSnapshot=void 0,this.dataSnapshotTruncated=!1,this.searchState=EMPTY_SEARCH,this.treeMemo=void 0,this.matchElements.clear(),this.expandedOverrides.clear()),this.sourceSearchDirty&&(this.sourceSearchTask=this.searchSource());return}if(this.sourceMode=!1,wasSource&&(this.sourceAnnouncement=void 0,this.invalidateSourceSearch()),wasSource||!this.hasUpdated||changed.has("data")||changed.has("maxNodes")){const snapshot=snapshotJsonData(this.data,this.effectiveMaxNodes);this.dataSnapshot=snapshot.value,this.dataSnapshotTruncated=snapshot.truncated}const locale=this.effectiveLocale;if(wasSource||!this.hasUpdated||changed.has("data")||changed.has("query")||changed.has("maxNodes")||locale!==this.searchLocale){this.searchLocale=locale;const next=this.computeSearch();if(!this.hasUpdated||changed.has("data")||changed.has("maxNodes")){let pruned=null;for(const key of this.expandedOverrides.keys())next.paths.has(key)||(pruned??=new Map(this.expandedOverrides),pruned.delete(key));pruned&&(this.expandedOverrides=pruned)}this.searchState=next,this.hasUpdated&&(this.activeSearchIndex=-1,this.emitSearchChange())}}updated(changed){if(super.updated(changed),this.treeSource!==void 0){const message=this.hierarchy.error||this.hierarchy.rowError?this.localize("treeSourceError"):this.hierarchy.loading?this.localize("loading"):this.sourceSummary();this.sourceAnnouncement!==void 0&&this.sourceAnnouncement!==message&&this.searchAnnouncementSink?.announce(message),this.sourceAnnouncement=message;return}this.syncActiveMatch(),this.searchAnnouncementsArmed&&changed.has("activeSearchIndex")&&this.searchAnnouncementSink?.announce(this.activeSearchAnnouncement())}emitSearchChange(){this.emit("lr-search-change",viewerSearchDetail(this.query,this.treeSource!==void 0?this.sourceHitKeys.size:this.searchState.orderedMatches.length,this.treeSource!==void 0?this.sourceSearchExact:!this.searchState.truncated,this.activeSearchIndex))}revealActiveMatch(){const match=this.searchState.orderedMatches[this.activeSearchIndex];if(!match)return;let path;try{path=JSON.parse(match.pathKey)}catch{return}if(!Array.isArray(path))return;let next=null;for(let depth=0;depth<path.length;depth++){const ancestorKey=JSON.stringify(path.slice(0,depth));this.isExpanded(ancestorKey,depth,this.searchState.forceExpand)||(next??=new Map(this.expandedOverrides),next.set(ancestorKey,!0))}next&&(this.expandedOverrides=next)}activeSearchAnnouncement(){const total=this.searchState.orderedMatches.length;if(this.activeSearchIndex<0||total===0)return"";const numberFormat=getNumberFormat(this.effectiveLocale);return this.localize("viewerSearchActiveMatch",void 0,{current:numberFormat.format(this.activeSearchIndex+1),total:this.searchState.truncated?`≥${numberFormat.format(total)}`:numberFormat.format(total)})}async runSearch(query){if(this.treeSource!==void 0){const intent=this.sourceSearchIntent;this.query=query,intent===this.sourceSearchIntent&&this.invalidateSourceSearch();const currentIntent=this.sourceSearchIntent;return this.requestUpdate("sourceSearchIntent",null),await this.updateComplete,currentIntent===this.sourceSearchIntent?this.sourceSearchTask:0}return this.query=query,await this.updateComplete,this.searchState.orderedMatches.length}async searchNext(){if(this.treeSource!==void 0)return this.stepSourceSearch(1);const total=this.searchState.orderedMatches.length;return total===0?!1:(this.activeSearchIndex=(this.activeSearchIndex+1)%total,this.revealActiveMatch(),this.emitSearchChange(),await this.scrollActiveMatchIntoView(),!0)}async searchPrevious(){if(this.treeSource!==void 0)return this.stepSourceSearch(-1);const total=this.searchState.orderedMatches.length;return total===0?!1:(this.activeSearchIndex=this.activeSearchIndex<0?total-1:(this.activeSearchIndex-1+total)%total,this.revealActiveMatch(),this.emitSearchChange(),await this.scrollActiveMatchIntoView(),!0)}clearSearch(){this.treeSource!==void 0&&(this.hierarchy.cancelSearch(),this.invalidateSourceSearch(),this.requestUpdate("sourceSearchIntent",null)),this.query=""}async scrollActiveMatchIntoView(){await this.updateComplete,this.renderRoot.querySelector("[data-active]")?.scrollIntoView({behavior:prefersReducedMotion(this)?"auto":"smooth",block:"nearest"})}render(){if(this.treeSource!==void 0)return this.renderSource();const deps=[this.dataSnapshot,this.searchState,this.expandedOverrides,this.expandDepth,this.copyable,this.copyFeedback,this.strings,this.effectiveLocale,lyraLocaleCatalogVersion(this.effectiveLocale),this.explicitRefresh,this.effectiveMaxNodes];let memo=this.treeMemo;if(!memo||deps.some((value,index)=>value!==memo.deps[index])){const budget={remaining:this.effectiveMaxNodes,truncated:!1};this.matchElements.clear();const tree2=this.renderNode(this.dataSnapshot,[],void 0,0,this.searchState,new WeakSet,budget);memo={deps,tree:tree2,limited:budget.truncated||this.searchState.truncated||this.dataSnapshotTruncated},this.treeMemo=memo}const{tree,limited}=memo;return html`
63
72
  <div
64
73
  part="base"
65
74
  style=${sanitizeCssLength(this.maxHeight)?styleMap({"--lr-json-viewer-max-height":sanitizeCssLength(this.maxHeight)}):nothing}
@@ -75,7 +84,7 @@ import{__decorate}from"tslib";import{html,nothing}from"lit";import{property,stat
75
84
  </button>
76
85
  </div>`:nothing}
77
86
  <div part="tree" role="list" aria-label=${hostAriaLabel(this)??nothing}>${tree}</div>
78
- ${limited?html`<p part="limit">${this.localize("jsonViewerLimit",void 0,{count:getNumberFormat(this.effectiveLocale).format(MAX_JSON_NODES),depth:getNumberFormat(this.effectiveLocale).format(MAX_JSON_DEPTH)})}</p>`:nothing}
87
+ ${limited?html`<p part="limit">${this.localize("jsonViewerLimit",void 0,{count:getNumberFormat(this.effectiveLocale).format(this.effectiveMaxNodes),depth:getNumberFormat(this.effectiveLocale).format(MAX_JSON_DEPTH)})}</p>`:nothing}
79
88
  <span class="sr-only" aria-hidden="true">${this.activeSearchAnnouncement()}</span>
80
89
  </div>
81
- `}}__decorate([property({attribute:!1})],LyraJsonViewer.prototype,"data",void 0),__decorate([property({type:Number,attribute:"expand-depth"})],LyraJsonViewer.prototype,"expandDepth",void 0),__decorate([property({attribute:"max-height"})],LyraJsonViewer.prototype,"maxHeight",void 0),__decorate([property({type:Boolean,reflect:!0})],LyraJsonViewer.prototype,"copyable",void 0),__decorate([property()],LyraJsonViewer.prototype,"query",void 0),__decorate([state()],LyraJsonViewer.prototype,"expandedOverrides",void 0),__decorate([state()],LyraJsonViewer.prototype,"activeSearchIndex",void 0),__decorate([state()],LyraJsonViewer.prototype,"copyFeedback",void 0);export{LyraJsonViewer};
90
+ `}}__decorate([property({attribute:!1})],LyraJsonViewer.prototype,"treeSource",null),__decorate([property({type:Number,attribute:"max-nodes"})],LyraJsonViewer.prototype,"maxNodes",void 0),__decorate([property({attribute:!1})],LyraJsonViewer.prototype,"data",void 0),__decorate([property({type:Number,attribute:"expand-depth"})],LyraJsonViewer.prototype,"expandDepth",void 0),__decorate([property({attribute:"max-height"})],LyraJsonViewer.prototype,"maxHeight",void 0),__decorate([property({type:Boolean,reflect:!0})],LyraJsonViewer.prototype,"copyable",void 0),__decorate([property()],LyraJsonViewer.prototype,"query",void 0),__decorate([state()],LyraJsonViewer.prototype,"expandedOverrides",void 0),__decorate([state()],LyraJsonViewer.prototype,"activeSearchIndex",void 0),__decorate([state()],LyraJsonViewer.prototype,"copyFeedback",void 0);export{LyraJsonViewer};
@@ -1,2 +1,3 @@
1
+ import'../../layout/virtual-list/virtual-list.js';
1
2
  /** @deprecated Import @aceshooting/lyra-ui/components/lr-json-viewer.js to register this component. */
2
3
  export*from'./json-viewer.class.js';
@@ -1 +1 @@
1
- export*from"./json-viewer.class.js";import{LyraJsonViewer}from"./json-viewer.class.js";import{defineElement}from"../../../internal/prefix.js";defineElement("json-viewer",LyraJsonViewer);
1
+ import"../../layout/virtual-list/virtual-list.js";export*from"./json-viewer.class.js";import{LyraJsonViewer}from"./json-viewer.class.js";import{defineElement}from"../../../internal/prefix.js";defineElement("json-viewer",LyraJsonViewer);
@@ -1 +1 @@
1
- import{iconHitTarget,focusRing}from"../../../internal/interactive-control.styles.js";import{css}from"lit";const styles=css` :host { display: block; --_lr-json-viewer-max-height: none; --_lr-json-viewer-font: var(--lr-font-mono); --_lr-json-viewer-active-outline: var(--lr-focus-ring-color); --_lr-json-viewer-string-color: var(--lr-color-success); --_lr-json-viewer-number-color: var(--lr-color-brand); --_lr-json-viewer-boolean-color: var(--lr-color-warning); --_lr-json-viewer-null-color: var(--lr-color-text-quiet); font-family: var(--lr-json-viewer-font, var(--_lr-json-viewer-font)); font-size: var(--lr-font-size-sm); line-height: var(--lr-line-height-loose); white-space: normal; } [part="base"] { display: block; max-block-size: var( --lr-json-viewer-max-height, var(--_lr-json-viewer-max-height) ); overflow: auto; border: var(--lr-border-width-thin) solid var(--lr-color-border-subtle); border-radius: var(--lr-radius); background: var(--lr-color-surface); } [part="toolbar"] { position: sticky; inset-block-start: 0; z-index: var(--lr-layer-content); display: flex; justify-content: flex-end; padding: var(--lr-space-xs) var(--lr-space-s); border-block-end: var(--lr-border-width-thin) solid var(--lr-color-border-subtle); background: var(--lr-color-surface); } [part="tree"] { padding: var(--lr-space-s); direction: ltr; } .row { display: flex; align-items: flex-start; gap: var(--lr-space-xs); min-inline-size: 0; border-radius: var(--lr-radius); } .row:hover { background: var(--lr-json-viewer-row-hover-bg, var(--lr-color-brand-quiet)); } .row:hover [part="copy-button"], .row:focus-within [part="copy-button"] { opacity: 1; } [part="toggle"] { inline-size: var(--lr-size-1-25rem); block-size: var(--lr-size-1-25rem); ${iconHitTarget} margin-block-start: var(--lr-size-0-1875rem); flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center; padding: 0; border: none; background: none; color: var(--lr-color-text-quiet); border-radius: var(--lr-radius); cursor: pointer; transition: var(--lr-transition-interactive); font: inherit; } [part="toggle"][hidden] { visibility: hidden; } [part="toggle"] .chevron { display: inline-flex; transform: rotate(0deg); transition: transform var(--lr-transition-fast); } [part="toggle"][aria-expanded="true"] .chevron { transform: rotate(90deg); } :where([part="toggle"]):hover:where(:not([hidden])) { background: var(--lr-color-brand-quiet); color: var(--lr-color-brand); } :where([part="toggle"]):active:where(:not([hidden])) { background: color-mix( in oklab, var(--lr-color-brand-quiet), var(--lr-color-mix-partner) var(--lr-color-mix-active) ); color: var(--lr-color-brand); } [part="toggle"]:focus-visible, [part="copy-button"]:focus-visible { ${focusRing} } .toggle-space { inline-size: var(--lr-icon-button-size); flex: 0 0 auto; } [part="key"] { flex: 0 1 auto; min-inline-size: 0; overflow-wrap: anywhere; font-weight: var(--lr-font-weight-semibold); color: var(--lr-color-text); } .colon { flex: 0 0 auto; color: var(--lr-color-text-quiet); margin-inline-end: var(--lr-space-xs); } [part="bracket"] { flex: 0 0 auto; color: var(--lr-color-text-quiet); } [part="key"][data-match], [part="value"][data-match] { background: var(--lr-json-viewer-match-bg, var(--lr-color-warning-quiet)); border-radius: var(--lr-size-0-1875rem); box-shadow: 0 0 0 var(--lr-size-0-125rem) var(--lr-json-viewer-match-bg, var(--lr-color-warning-quiet)); } [part="value"] { min-inline-size: 0; overflow-wrap: anywhere; word-break: break-word; white-space: pre-wrap; } [part="value"][data-type="string"] { color: var( --lr-json-viewer-string-color, var(--_lr-json-viewer-string-color) ); } [part="value"][data-type="number"] { color: var( --lr-json-viewer-number-color, var(--_lr-json-viewer-number-color) ); } [part="value"][data-type="boolean"] { color: var( --lr-json-viewer-boolean-color, var(--_lr-json-viewer-boolean-color) ); } [part="value"][data-type="null"], [part="value"][data-type="undefined"], [part="value"][data-type="circular"] { color: var(--lr-json-viewer-null-color, var(--_lr-json-viewer-null-color)); font-style: italic; } [part="key"][data-active], [part="value"][data-active] { outline: var(--lr-focus-ring-width) solid var( --lr-json-viewer-active-outline, var(--_lr-json-viewer-active-outline) ); outline-offset: var(--lr-focus-ring-offset); } .preview { flex: 0 0 auto; color: var(--lr-color-text-quiet); font-style: italic; margin-inline: var(--lr-space-xs); } [part="copy-button"] { flex: 0 0 auto; margin-inline-start: auto; border: none; background: none; color: var(--lr-color-text-quiet); font: inherit; font-size: var(--lr-font-size-xs); line-height: var(--lr-line-height-none); ${iconHitTarget} padding: var(--lr-size-0-125rem) var(--lr-space-xs); border-radius: var(--lr-radius); cursor: pointer; transition: var(--lr-transition-interactive); } [part="copy-button"]:hover { background: var(--lr-color-brand-quiet); color: var(--lr-color-brand); } [part="copy-button"]:active { background: color-mix( in oklab, var(--lr-color-brand-quiet), var(--lr-color-mix-partner) var(--lr-color-mix-active) ); color: var(--lr-color-brand); } .row [part="copy-button"] { opacity: 0; } .row [part="copy-button"]:focus-visible { opacity: 1; } @media (hover: none), (pointer: coarse) { .row [part="copy-button"] { opacity: 1; } } @media (prefers-reduced-motion: reduce) { [part="toggle"], [part="copy-button"], [part="toggle"] .chevron { 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; --_lr-json-viewer-max-height: none; --_lr-json-viewer-font: var(--lr-font-mono); --_lr-json-viewer-active-outline: var(--lr-focus-ring-color); --_lr-json-viewer-string-color: var(--lr-color-success); --_lr-json-viewer-number-color: var(--lr-color-brand); --_lr-json-viewer-boolean-color: var(--lr-color-warning); --_lr-json-viewer-null-color: var(--lr-color-text-quiet); font-family: var(--lr-json-viewer-font, var(--_lr-json-viewer-font)); font-size: var(--lr-font-size-sm); line-height: var(--lr-line-height-loose); white-space: normal; } .source-shell { min-inline-size: 0; } .source-shell .source-tree { block-size: var(--lr-json-viewer-max-height, var(--lr-size-20rem)); max-block-size: var(--lr-json-viewer-max-height, var(--lr-size-20rem)); } .source-shell [part~='source-list'] { block-size: 100%; } [part='search-status'] { padding: var(--lr-space-xs); color: var(--lr-color-text-quiet); } [part="base"] { display: block; max-block-size: var( --lr-json-viewer-max-height, var(--_lr-json-viewer-max-height) ); overflow: auto; border: var(--lr-border-width-thin) solid var(--lr-color-border-subtle); border-radius: var(--lr-radius); background: var(--lr-color-surface); } [part="toolbar"] { position: sticky; inset-block-start: 0; z-index: var(--lr-layer-content); display: flex; justify-content: flex-end; padding: var(--lr-space-xs) var(--lr-space-s); border-block-end: var(--lr-border-width-thin) solid var(--lr-color-border-subtle); background: var(--lr-color-surface); } [part="tree"] { padding: var(--lr-space-s); direction: ltr; } .row { display: flex; align-items: flex-start; gap: var(--lr-space-xs); min-inline-size: 0; border-radius: var(--lr-radius); } .row:hover { background: var(--lr-json-viewer-row-hover-bg, var(--lr-color-brand-quiet)); } .row:hover [part="copy-button"], .row:focus-within [part="copy-button"] { opacity: 1; } [part="toggle"] { inline-size: var(--lr-size-1-25rem); block-size: var(--lr-size-1-25rem); ${iconHitTarget} margin-block-start: var(--lr-size-0-1875rem); flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center; padding: 0; border: none; background: none; color: var(--lr-color-text-quiet); border-radius: var(--lr-radius); cursor: pointer; transition: var(--lr-transition-interactive); font: inherit; } [part="toggle"][hidden] { visibility: hidden; } [part="toggle"] .chevron { display: inline-flex; transform: rotate(0deg); transition: transform var(--lr-transition-fast); } [part="toggle"][aria-expanded="true"] .chevron { transform: rotate(90deg); } :where([part="toggle"]):hover:where(:not([hidden])) { background: var(--lr-color-brand-quiet); color: var(--lr-color-brand); } :where([part="toggle"]):active:where(:not([hidden])) { background: color-mix( in oklab, var(--lr-color-brand-quiet), var(--lr-color-mix-partner) var(--lr-color-mix-active) ); color: var(--lr-color-brand); } [part="toggle"]:focus-visible, [part="copy-button"]:focus-visible { ${focusRing} } .toggle-space { inline-size: var(--lr-icon-button-size); flex: 0 0 auto; } [part="key"] { flex: 0 1 auto; min-inline-size: 0; overflow-wrap: anywhere; font-weight: var(--lr-font-weight-semibold); color: var(--lr-color-text); } .colon { flex: 0 0 auto; color: var(--lr-color-text-quiet); margin-inline-end: var(--lr-space-xs); } [part="bracket"] { flex: 0 0 auto; color: var(--lr-color-text-quiet); } [part="key"][data-match], [part="value"][data-match] { background: var(--lr-json-viewer-match-bg, var(--lr-color-warning-quiet)); border-radius: var(--lr-size-0-1875rem); box-shadow: 0 0 0 var(--lr-size-0-125rem) var(--lr-json-viewer-match-bg, var(--lr-color-warning-quiet)); } [part="value"] { min-inline-size: 0; overflow-wrap: anywhere; word-break: break-word; white-space: pre-wrap; } [part="value"][data-type="string"] { color: var( --lr-json-viewer-string-color, var(--_lr-json-viewer-string-color) ); } [part="value"][data-type="number"] { color: var( --lr-json-viewer-number-color, var(--_lr-json-viewer-number-color) ); } [part="value"][data-type="boolean"] { color: var( --lr-json-viewer-boolean-color, var(--_lr-json-viewer-boolean-color) ); } [part="value"][data-type="null"], [part="value"][data-type="undefined"], [part="value"][data-type="circular"] { color: var(--lr-json-viewer-null-color, var(--_lr-json-viewer-null-color)); font-style: italic; } [part="key"][data-active], [part="value"][data-active] { outline: var(--lr-focus-ring-width) solid var( --lr-json-viewer-active-outline, var(--_lr-json-viewer-active-outline) ); outline-offset: var(--lr-focus-ring-offset); } .preview { flex: 0 0 auto; color: var(--lr-color-text-quiet); font-style: italic; margin-inline: var(--lr-space-xs); } [part="copy-button"] { flex: 0 0 auto; margin-inline-start: auto; border: none; background: none; color: var(--lr-color-text-quiet); font: inherit; font-size: var(--lr-font-size-xs); line-height: var(--lr-line-height-none); ${iconHitTarget} padding: var(--lr-size-0-125rem) var(--lr-space-xs); border-radius: var(--lr-radius); cursor: pointer; transition: var(--lr-transition-interactive); } [part="copy-button"]:hover { background: var(--lr-color-brand-quiet); color: var(--lr-color-brand); } [part="copy-button"]:active { background: color-mix( in oklab, var(--lr-color-brand-quiet), var(--lr-color-mix-partner) var(--lr-color-mix-active) ); color: var(--lr-color-brand); } .row [part="copy-button"] { opacity: 0; } .row [part="copy-button"]:focus-visible { opacity: 1; } @media (hover: none), (pointer: coarse) { .row [part="copy-button"] { opacity: 1; } } @media (prefers-reduced-motion: reduce) { [part="toggle"], [part="copy-button"], [part="toggle"] .chevron { transition: none !important; } } `;export{styles};
@@ -136,6 +136,7 @@ readonly ownsFocus?:()=>boolean;}export interface LyraMentionPopoverEventMap{'lr
136
136
  * transitioning to `false` by any other means (a direct host assignment included). Never fires
137
137
  * for a close that followed a `lr-mention-select` commit.
138
138
  * @csspart listbox - The popover's root element (`role="listbox"`).
139
+ * @csspart limit - Candidate admission limit notice.
139
140
  * @csspart option - A candidate row (`role="option"`). Carries `aria-disabled="true"` while that
140
141
  * row's `disabled` is set.
141
142
  * @csspart option-icon - A row's leading icon glyph, when `icon` is set.
@@ -169,8 +170,9 @@ export declare class LyraMentionPopover extends LyraElement<LyraMentionPopoverEv
169
170
  * `<textarea>`/single-line text `<input>`, positioning is caret-precise
170
171
  * (see the class doc); any other element anchors the whole popup under
171
172
  * that element's own box, the same as `<lr-combobox>`'s trigger. */
172
- anchor?:HTMLElement;private _items;
173
- /** The full candidate set, pre-`query`-filtering. Assignment takes a shallow frozen snapshot;
173
+ anchor?:HTMLElement;private itemPositions;private _items;
174
+ /** The candidate set, pre-`query`-filtering. Admits the first 10,000 array positions and
175
+ * displays a localized limit notice when additional candidates are omitted. Assignment takes a shallow frozen snapshot;
174
176
  * malformed rows without a string `label` remain in that snapshot but are omitted from every
175
177
  * filtered/rendered projection. */
176
178
  get items():readonly Readonly<LyraMentionItem>[];set items(next:readonly LyraMentionItem[]);
@@ -190,7 +192,7 @@ emptyText?:string;
190
192
  * a plain `aria-label` attribute on `<lr-mention-popover>` itself, which takes precedence over
191
193
  * this property when present -- matches `<lr-combobox>`'s/`<lr-table>`'s identical host
192
194
  * `aria-label` fallback. */
193
- label?:string;private activeIndex;private listboxHidden;private listboxHideToken;private readonly _listId;private cleanup?;private virtualAnchor;private _isFirstUpdate;private _silentClose;private _ownsFocus;private filteredMemo?;private visibleMemo?;private _focusOwnerPredicate?;private _focusTransferGeneration;private anchorRelationship?;private readonly announcements;private announcedResultCount?;private announcedResultPosition?;connectedCallback():void;protected willUpdate(changed:PropertyValues):void;protected updated(changed:PropertyValues):void;disconnectedCallback():void;adoptedCallback():void;private resetResultAnnouncements;private announceResultState;private snapshotAttribute;private restoreAttribute;private captureAnchorCaret;private restoreRelationshipFocus;private restoreAnchorFocus;private attachAnchorRelationship;private detachAnchorRelationship;private syncAnchorRelationship;
195
+ label?:string;private activeIndex;private listboxHidden;private listboxHideToken;private readonly _listId;private cleanup?;private virtualAnchor;private _isFirstUpdate;private _silentClose;private _ownsFocus;private filteredMemo?;private visibleMemo?;private _focusOwnerPredicate?;private _focusTransferGeneration;private anchorRelationship?;private readonly announcements;private announcedResultCount?;private announcedResultPosition?;connectedCallback():void;protected willUpdate(changed:PropertyValues):void;private limitMounted;protected updated(changed:PropertyValues):void;disconnectedCallback():void;adoptedCallback():void;private resetResultAnnouncements;private announceResultState;private snapshotAttribute;private restoreAttribute;private captureAnchorCaret;private restoreRelationshipFocus;private restoreAnchorFocus;private attachAnchorRelationship;private detachAnchorRelationship;private syncAnchorRelationship;private readonly labelKeys;private readonly descriptionKeys;
194
196
  /** The current candidate set: runtime rows without a non-blank string `label` are omitted (a
195
197
  * blank/whitespace-only label would otherwise render a focusable `role="option"` with no
196
198
  * accessible name), then the remaining `items` are filtered by `query` via `filter` (or the
@@ -229,4 +231,4 @@ get listboxId():string;
229
231
  * to act on, so e.g. the host's own textarea still moves its caret a line
230
232
  * normally rather than having the keystroke silently eaten.
231
233
  */
232
- handleKeyDown(e:KeyboardEvent):boolean;private clampedIndex;private stepEnabledIndex;private rowId;private commit;private reposition;private settleListboxHidden;private resolveAnchorElement;private onListboxMouseDown;private onListboxClick;private onListboxKeyDown;private get effectiveEmptyText();private get effectiveLabel();private renderRow;render():TemplateResult;}declare global{interface HTMLElementTagNameMap{'lr-mention-popover':LyraMentionPopover;}}
234
+ handleKeyDown(e:KeyboardEvent):boolean;private clampedIndex;private stepEnabledIndex;private rowId;private commit;private reposition;private settleListboxHidden;private resolveAnchorElement;private onListboxMouseDown;private onListboxClick;private onListboxKeyDown;private get effectiveEmptyText();private get effectiveLabel();private renderRow;private inputLimited;render():TemplateResult;}declare global{interface HTMLElementTagNameMap{'lr-mention-popover':LyraMentionPopover;}}