@fusion.dev/helix 0.145.0 → 0.147.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 (291) hide show
  1. package/custom-elements.json +13218 -3717
  2. package/dist/accordion/item/accordion-item.css.js +4 -92
  3. package/dist/accordion/item/accordion-item.d.ts +8 -0
  4. package/dist/accordion/root/accordion-root.css.js +2 -28
  5. package/dist/announcement/root/announcement-root.css.js +10 -154
  6. package/dist/announcement/root/announcement-root.d.ts +3 -0
  7. package/dist/app-header/root/app-header-root.css.js +2 -118
  8. package/dist/area-chart/root/area-chart-root.css.js +4 -94
  9. package/dist/area-chart/root/area-chart-root.d.ts +1 -0
  10. package/dist/aura/root/aura-root.css.js +2 -54
  11. package/dist/aura/root/aura-root.d.ts +21 -9
  12. package/dist/aura/root/aura-root.js +23 -12
  13. package/dist/avatar/group/avatar-group.css.js +5 -36
  14. package/dist/avatar/group/avatar-group.d.ts +3 -0
  15. package/dist/avatar/root/avatar-root.css.js +1 -53
  16. package/dist/avatar/root/avatar-root.d.ts +2 -0
  17. package/dist/badge/root/badge-root.css.js +17 -142
  18. package/dist/badge/root/badge-root.d.ts +20 -0
  19. package/dist/badge/root/badge-root.js +6 -0
  20. package/dist/bar-chart/root/bar-chart-root.css.js +8 -292
  21. package/dist/blockquote/root/blockquote-root.css.js +1 -43
  22. package/dist/blockquote/root/blockquote-root.d.ts +2 -0
  23. package/dist/breadcrumbs/breadcrumb/breadcrumb.css.js +13 -98
  24. package/dist/breadcrumbs/root/breadcrumbs-root.css.js +7 -21
  25. package/dist/breadcrumbs/root/breadcrumbs-root.d.ts +18 -0
  26. package/dist/breadcrumbs/root/breadcrumbs-root.js +4 -0
  27. package/dist/button/root/button-root.css.js +16 -196
  28. package/dist/button/root/button-root.d.ts +3 -0
  29. package/dist/button-group/root/button-group-root.css.js +2 -52
  30. package/dist/callout/root/callout-root.css.js +5 -137
  31. package/dist/callout/root/callout-root.d.ts +8 -2
  32. package/dist/canvas/node/canvas-node.css.js +10 -367
  33. package/dist/canvas/root/canvas-root.css.js +7 -270
  34. package/dist/card/root/card-root.css.js +5 -134
  35. package/dist/card/root/card-root.d.ts +6 -0
  36. package/dist/carousel/root/carousel-root.css.js +20 -386
  37. package/dist/chat/composer/chat-composer.css.js +4 -105
  38. package/dist/chat/message/chat-message.css.js +5 -301
  39. package/dist/chat/message/chat-message.d.ts +5 -0
  40. package/dist/chat/message/chat-message.js +2 -1
  41. package/dist/chat/root/chat-root.css.js +5 -155
  42. package/dist/chat/root/chat-root.d.ts +2 -0
  43. package/dist/chat/root/chat-root.js +2 -1
  44. package/dist/chat/typing.css.d.ts +1 -0
  45. package/dist/chat/typing.css.js +25 -0
  46. package/dist/checkbox/root/checkbox-root.css.js +12 -162
  47. package/dist/checkbox/root/checkbox-root.d.ts +2 -1
  48. package/dist/checkbox-group/root/checkbox-group-root.css.js +1 -27
  49. package/dist/code/root/code-root.css.js +3 -25
  50. package/dist/code/root/code-root.d.ts +2 -0
  51. package/dist/code-block/root/code-block-root.css.js +9 -250
  52. package/dist/code-block/root/code-block-root.d.ts +2 -1
  53. package/dist/color-input/root/color-input-root.css.js +5 -104
  54. package/dist/color-picker/root/color-picker-root.css.js +39 -329
  55. package/dist/color-picker/root/color-picker-root.d.ts +3 -0
  56. package/dist/combobox/root/combobox-root.css.js +8 -147
  57. package/dist/command/root/command-root.css.js +3 -74
  58. package/dist/copy-button/root/copy-button-root.css.js +5 -36
  59. package/dist/copy-button/root/copy-button-root.d.ts +7 -0
  60. package/dist/data-table/root/data-table-root.css.js +24 -241
  61. package/dist/data-table/root/data-table-root.d.ts +12 -0
  62. package/dist/date-input/root/date-input-root.css.js +8 -93
  63. package/dist/date-picker/root/date-picker-root.css.js +16 -278
  64. package/dist/date-picker/root/date-picker-root.d.ts +1 -0
  65. package/dist/description-list/item/description-list-item.css.js +1 -41
  66. package/dist/description-list/item/description-list-item.d.ts +7 -0
  67. package/dist/description-list/root/description-list-root.css.js +1 -34
  68. package/dist/description-list/root/description-list-root.d.ts +1 -0
  69. package/dist/dialog/root/dialog-root.css.js +7 -221
  70. package/dist/dialog/root/dialog-root.d.ts +3 -0
  71. package/dist/divider/root/divider-root.css.js +6 -81
  72. package/dist/donut-chart/root/donut-chart-root.css.js +7 -174
  73. package/dist/donut-chart/root/donut-chart-root.d.ts +3 -0
  74. package/dist/drawer/root/drawer-root.css.js +14 -193
  75. package/dist/drawer/root/drawer-root.d.ts +5 -0
  76. package/dist/drilldown/item/drilldown-item.css.js +4 -51
  77. package/dist/drilldown/item/drilldown-item.d.ts +7 -0
  78. package/dist/drilldown/root/drilldown-root.css.js +8 -109
  79. package/dist/drilldown/root/drilldown-root.d.ts +10 -0
  80. package/dist/element-events.generated.js +19 -6
  81. package/dist/empty/root/empty-root.css.js +2 -42
  82. package/dist/file-input/root/file-input-root.css.js +7 -172
  83. package/dist/file-input/root/file-input-root.d.ts +15 -0
  84. package/dist/filter-input/chip/filter-chip.css.js +2 -84
  85. package/dist/filter-input/field/filter-field.css.js +1 -3
  86. package/dist/filter-input/menu/filter-menu.css.js +1 -3
  87. package/dist/filter-input/operator/filter-operator.css.js +1 -3
  88. package/dist/filter-input/root/filter-input-root.css.js +6 -112
  89. package/dist/filter-input/root/filter-input-root.d.ts +5 -0
  90. package/dist/flex/root/flex-root.css.js +4 -198
  91. package/dist/flex/root/flex-root.d.ts +19 -8
  92. package/dist/format-date/root/format-date-root.css.js +1 -13
  93. package/dist/graph/root/graph-root.css.js +12 -444
  94. package/dist/graph/root/graph-root.d.ts +8 -0
  95. package/dist/grid/root/grid-root.css.js +1 -171
  96. package/dist/grid/root/grid-root.d.ts +4 -1
  97. package/dist/heatmap/root/heatmap-root.css.js +8 -155
  98. package/dist/heatmap/root/heatmap-root.d.ts +2 -0
  99. package/dist/icon/index.d.ts +1 -1
  100. package/dist/icon/root/icon-root.css.js +1 -18
  101. package/dist/icon/root/index.d.ts +1 -1
  102. package/dist/icon-button/root/icon-button-root.css.js +63 -186
  103. package/dist/icon-button/root/icon-button-root.d.ts +5 -0
  104. package/dist/image/root/image-root.css.js +7 -65
  105. package/dist/image/root/image-root.d.ts +3 -0
  106. package/dist/input/root/input-root.css.js +6 -79
  107. package/dist/kbd/root/kbd-root.css.js +2 -44
  108. package/dist/kbd/root/kbd-root.d.ts +9 -0
  109. package/dist/legend/root/legend-root.css.js +9 -106
  110. package/dist/legend/root/legend-root.d.ts +2 -0
  111. package/dist/lightbox/item/lightbox-item.css.js +1 -33
  112. package/dist/lightbox/root/lightbox-root.css.js +40 -144
  113. package/dist/line-chart/root/line-chart-root.css.js +4 -154
  114. package/dist/line-chart/root/line-chart-root.d.ts +3 -0
  115. package/dist/list/item/list-item.css.js +2 -94
  116. package/dist/list/root/list-root.css.js +4 -88
  117. package/dist/listbox/root/listbox-root.css.js +4 -102
  118. package/dist/listbox/root/listbox-root.d.ts +1 -0
  119. package/dist/loader/root/loader-root.css.js +5 -171
  120. package/dist/loader/root/loader-root.d.ts +2 -0
  121. package/dist/map/area/map-area.css.js +1 -23
  122. package/dist/map/buildings/map-buildings.css.js +1 -26
  123. package/dist/map/contours/map-contours.css.js +2 -5
  124. package/dist/map/landcover/map-landcover.css.js +1 -4
  125. package/dist/map/marker/map-marker.css.js +14 -327
  126. package/dist/map/points/map-points.css.js +1 -86
  127. package/dist/map/position/map-position.css.js +8 -227
  128. package/dist/map/raster/map-raster.css.js +1 -3
  129. package/dist/map/root/map-root.css.js +10 -352
  130. package/dist/map/route/map-route.css.js +1 -24
  131. package/dist/map/terrain/map-terrain.css.js +3 -7
  132. package/dist/megamenu/root/megamenu-root.css.js +15 -163
  133. package/dist/megamenu/root/megamenu-root.d.ts +19 -0
  134. package/dist/menu/item/menu-item.css.js +9 -111
  135. package/dist/menu/item/menu-item.d.ts +1 -0
  136. package/dist/menu/root/menu-root.css.js +1 -110
  137. package/dist/menu/section/menu-section.css.js +1 -13
  138. package/dist/meter/root/meter-root.css.js +20 -207
  139. package/dist/meter/root/meter-root.d.ts +4 -0
  140. package/dist/navigation/root/navigation-root.css.js +2 -54
  141. package/dist/navigation/root/navigation-root.d.ts +7 -0
  142. package/dist/notifications/group/notification-group.css.js +1 -61
  143. package/dist/notifications/notification/notification.css.js +17 -264
  144. package/dist/notifications/root/notifications-root.css.js +7 -119
  145. package/dist/notifications/root/notifications-root.d.ts +3 -1
  146. package/dist/number-input/root/number-input-root.css.js +10 -100
  147. package/dist/number-input/root/number-input-root.d.ts +8 -0
  148. package/dist/object-inspector/root/object-inspector-root.css.js +11 -166
  149. package/dist/option/group/option-group.css.js +1 -22
  150. package/dist/option/index.d.ts +1 -0
  151. package/dist/option/index.js +1 -0
  152. package/dist/option/root/option-root.css.js +3 -85
  153. package/dist/option/separator/option-separator.css.d.ts +1 -0
  154. package/dist/option/separator/option-separator.css.js +3 -0
  155. package/dist/option/separator/option-separator.d.ts +26 -0
  156. package/dist/option/separator/option-separator.js +16 -0
  157. package/dist/orb/root/orb-root.css.js +1 -41
  158. package/dist/orb/root/orb-root.d.ts +14 -6
  159. package/dist/orb/root/orb-root.js +16 -27
  160. package/dist/outline/root/outline-root.css.js +24 -122
  161. package/dist/outline/root/outline-root.d.ts +17 -4
  162. package/dist/pagination/root/pagination-root.css.js +9 -105
  163. package/dist/pagination/size/pagination-size.css.js +1 -22
  164. package/dist/pagination/summary/pagination-summary.css.js +1 -7
  165. package/dist/pin-input/root/pin-input-root.css.js +2 -73
  166. package/dist/pin-input/root/pin-input-root.d.ts +12 -2
  167. package/dist/popover/root/popover-root.css.js +6 -127
  168. package/dist/progress/root/progress-root.css.js +7 -228
  169. package/dist/progress/root/progress-root.d.ts +5 -0
  170. package/dist/qr-code/root/qr-code-root.css.js +1 -57
  171. package/dist/quote/root/quote-root.css.js +1 -17
  172. package/dist/quote/root/quote-root.d.ts +2 -0
  173. package/dist/radio/group/radio-group.css.js +1 -21
  174. package/dist/radio/root/radio-root.css.js +5 -192
  175. package/dist/radio/root/radio-root.d.ts +2 -1
  176. package/dist/rating/root/rating-root.css.js +4 -117
  177. package/dist/sandbox/frame.d.ts +5 -3
  178. package/dist/sandbox/frame.js +20 -6
  179. package/dist/sandbox/index.d.ts +1 -0
  180. package/dist/sandbox/preview/sandbox-preview.css.js +1 -12
  181. package/dist/sandbox/preview/sandbox-preview.d.ts +19 -3
  182. package/dist/sandbox/preview/sandbox-preview.js +17 -11
  183. package/dist/sandbox/root/sandbox-root.css.js +3 -70
  184. package/dist/sandbox/root/sandbox-root.d.ts +16 -4
  185. package/dist/sandbox/root/sandbox-root.js +29 -50
  186. package/dist/sandbox/source/sandbox-source.css.js +3 -25
  187. package/dist/sandbox/source/sandbox-source.d.ts +40 -0
  188. package/dist/sandbox/source/sandbox-source.js +22 -0
  189. package/dist/sandbox/status-bar/sandbox-status-bar.css.js +1 -21
  190. package/dist/sandbox/terminal/sandbox-terminal.css.js +5 -106
  191. package/dist/sandbox/terminal/sandbox-terminal.d.ts +14 -2
  192. package/dist/sandbox/terminal/sandbox-terminal.js +20 -6
  193. package/dist/sandbox/tokens.d.ts +39 -0
  194. package/dist/sandbox/tokens.js +9 -0
  195. package/dist/sandbox/toolbar/sandbox-toolbar.css.js +1 -36
  196. package/dist/scatter-chart/root/scatter-chart-root.css.js +11 -137
  197. package/dist/scatter-chart/root/scatter-chart-root.d.ts +3 -0
  198. package/dist/scroll-area/root/scroll-area-root.css.js +14 -181
  199. package/dist/select/root/select-root.css.js +4 -124
  200. package/dist/shared/chart/series.css.js +1 -36
  201. package/dist/shared/chart/terminus.css.js +1 -47
  202. package/dist/shared/chart/tooltip.css.js +1 -68
  203. package/dist/shared/collection/state.css.js +1 -9
  204. package/dist/shared/field/field-frame.css.js +3 -33
  205. package/dist/shared/field/field-inline.css.js +1 -4
  206. package/dist/shared/field/field-segments.css.js +1 -39
  207. package/dist/shared/field/field-stacked.css.js +1 -5
  208. package/dist/shared/field/field.css.js +3 -57
  209. package/dist/shared/floating/entrance.css.js +3 -34
  210. package/dist/shared/floating/panel.css.js +2 -17
  211. package/dist/shared/glyph/glyph.css.js +1 -5
  212. package/dist/shared/live/live.css.js +1 -8
  213. package/dist/shared/tags/tags.css.js +1 -39
  214. package/dist/shared/viewport/viewport.css.js +8 -135
  215. package/dist/skeleton/root/skeleton-root.css.js +12 -120
  216. package/dist/skeleton/root/skeleton-root.d.ts +1 -0
  217. package/dist/skip-link/root/skip-link-root.css.js +2 -35
  218. package/dist/skip-link/root/skip-link-root.d.ts +3 -3
  219. package/dist/slider/root/slider-root.css.js +35 -320
  220. package/dist/slider/root/slider-root.d.ts +2 -0
  221. package/dist/sparkline/root/sparkline-root.css.js +10 -96
  222. package/dist/sparkline/root/sparkline-root.d.ts +8 -0
  223. package/dist/sparkline/root/sparkline-root.js +2 -1
  224. package/dist/speed-dial/item/speed-dial-item.css.js +6 -74
  225. package/dist/speed-dial/item/speed-dial-item.d.ts +3 -0
  226. package/dist/speed-dial/root/speed-dial-root.css.js +3 -144
  227. package/dist/speed-dial/root/speed-dial-root.d.ts +7 -1
  228. package/dist/speed-dial/root/speed-dial-root.js +0 -1
  229. package/dist/splitter/root/splitter-root.css.js +11 -176
  230. package/dist/stat/group/stat-group.css.js +1 -36
  231. package/dist/stat/root/stat-root.css.js +3 -58
  232. package/dist/steps/root/steps-root.css.js +13 -70
  233. package/dist/steps/root/steps-root.d.ts +5 -0
  234. package/dist/steps/step/step.css.js +5 -156
  235. package/dist/switch/root/switch-root.css.js +2 -110
  236. package/dist/table/cell/table-cell.css.js +1 -33
  237. package/dist/table/column/table-column.css.js +7 -105
  238. package/dist/table/root/table-root.css.js +1 -43
  239. package/dist/table/row/table-row.css.js +6 -18
  240. package/dist/table/row/table-row.d.ts +2 -0
  241. package/dist/tabs/panel/tab-panel.css.js +2 -17
  242. package/dist/tabs/root/tabs-root.css.js +6 -177
  243. package/dist/tabs/root/tabs-root.d.ts +4 -0
  244. package/dist/tabs/tab/tab.css.js +10 -51
  245. package/dist/tabs/tab/tab.d.ts +7 -0
  246. package/dist/tag/group/tag-group.css.js +1 -5
  247. package/dist/tag/root/tag-root.css.js +1 -166
  248. package/dist/tag/root/tag-root.d.ts +2 -0
  249. package/dist/text/clamp.d.ts +5 -2
  250. package/dist/text/clamp.js +3 -1
  251. package/dist/text/root/text-root.css.js +11 -206
  252. package/dist/text/root/text-root.d.ts +2 -1
  253. package/dist/textarea/root/textarea-root.css.js +3 -44
  254. package/dist/time-input/root/time-input-root.css.js +7 -106
  255. package/dist/time-picker/root/time-picker-root.css.js +10 -134
  256. package/dist/time-picker/root/time-picker-root.d.ts +1 -0
  257. package/dist/timeline/group/timeline-group.css.js +1 -31
  258. package/dist/timeline/item/timeline-item.css.js +3 -134
  259. package/dist/timeline/root/timeline-root.css.js +1 -66
  260. package/dist/toast/item/toast-item.css.js +8 -240
  261. package/dist/toast/root/toast-root.css.js +1 -85
  262. package/dist/toast/root/toast-root.d.ts +1 -0
  263. package/dist/toast/root/toast-root.js +3 -1
  264. package/dist/toggle/group/toggle-group.css.js +9 -125
  265. package/dist/toggle/group/toggle-group.d.ts +6 -1
  266. package/dist/toggle/root/toggle-root.css.js +1 -23
  267. package/dist/toggle/root/toggle-root.d.ts +6 -0
  268. package/dist/toolbar/root/toolbar-root.css.js +1 -35
  269. package/dist/toolbar/root/toolbar-root.d.ts +4 -0
  270. package/dist/tooltip/root/tooltip-root.css.js +5 -101
  271. package/dist/tooltip/root/tooltip-root.d.ts +6 -0
  272. package/dist/tour/root/tour-root.css.js +2 -28
  273. package/dist/tour/stop/tour-stop.css.js +2 -109
  274. package/dist/tree/item/tree-item.css.js +14 -230
  275. package/dist/tree/item/tree-item.d.ts +9 -0
  276. package/dist/tree/root/tree-root.css.js +1 -40
  277. package/dist/trend/root/trend-root.css.js +5 -55
  278. package/dist/trend/root/trend-root.d.ts +2 -2
  279. package/dist/video/root/video-root.css.js +16 -398
  280. package/dist/video-playlist/item/video-playlist-item.css.js +12 -86
  281. package/dist/video-playlist/item/video-playlist-item.d.ts +12 -0
  282. package/dist/video-playlist/menu/video-playlist-menu.css.js +1 -41
  283. package/dist/video-playlist/root/video-playlist-root.css.js +1 -19
  284. package/dist/video-playlist/root/video-playlist-root.d.ts +2 -0
  285. package/dist/virtual-list/root/virtual-list-root.css.js +5 -28
  286. package/dist/virtual-list/root/virtual-list-root.d.ts +7 -1
  287. package/lint.json +1 -1
  288. package/package.json +9 -9
  289. package/types/jsx.d.ts +6997 -1154
  290. package/types/svelte.d.ts +1 -0
  291. package/types/vue.d.ts +2081 -271
@@ -1,26 +1,4 @@
1
1
  import { createSheet } from '@fusion.dev/helix-core';
2
- export const styles = createSheet(`:host {
3
- display: block;
4
- block-size: 100%;
5
- }
6
-
7
- [part="source"] {
8
- background-color: var(--sandbox-source-background-color, var(--helix-color-background));
9
- block-size: 100%;
10
- border: none;
11
- color: var(--helix-color-foreground-muted);
12
- display: block;
13
- font-family: var(--helix-font-mono);
14
- font-size: var(--helix-text-xs);
15
- inline-size: 100%;
16
- line-height: var(--helix-leading-normal);
17
- min-block-size: var(--sandbox-source-min-block-size, 12rem);
18
- padding: var(--helix-space-sm);
19
- resize: none;
20
- tab-size: 2;
21
- }
22
-
23
- [part="source"]:focus-visible {
24
- background-color: var(--helix-color-surface);
25
- outline: none;
26
- }`);
2
+ export const styles = createSheet(`:host {display: block;block-size: 100%;}[part="highlight"],
3
+ [part="source"] {border: none;color: var(--helix-color-foreground-muted);font-family: var(--helix-font-mono);font-size: var(--helix-text-xs);inline-size: 100%;line-height: var(--helix-leading-normal);min-block-size: var(--sandbox-source-min-block-size, 12rem);padding: var(--helix-space-sm);tab-size: 2;}[part="source"] {background-color: var(--sandbox-source-background-color, var(--helix-color-background));block-size: 100%;display: block;resize: none;}[part="source"]:focus-visible {background-color: var(--helix-color-surface);outline: none;}[part="field"] {background-color: var(--sandbox-source-background-color, var(--helix-color-background));block-size: 100%;display: grid;grid-template-rows: minmax(max-content, auto);overflow: auto;}[part="field"]:focus-within {background-color: var(--helix-color-surface);}[part="field"] > [part] {grid-area: 1 / 1;letter-spacing: normal;margin: 0;overflow-wrap: break-word;white-space: pre-wrap;}[part="field"] > [part="source"],
4
+ [part="field"] > [part="source"]:focus-visible {-webkit-text-fill-color: transparent;align-self: stretch;background-color: transparent;block-size: auto;caret-color: var(--helix-color-foreground);color: transparent;overflow: hidden;}[data-kind="callable"] {color: var(--sandbox-source-callable-color, var(--helix-color-syntax-callable));}[data-kind="comment"] {color: var(--sandbox-source-comment-color, var(--helix-color-syntax-comment));}[data-kind="constant"] {color: var(--sandbox-source-constant-color, var(--helix-color-syntax-constant));}[data-kind="invalid"] {color: var(--sandbox-source-invalid-color, var(--helix-color-syntax-invalid));}[data-kind="keyword"] {color: var(--sandbox-source-keyword-color, var(--helix-color-syntax-keyword));}[data-kind="name"] {color: var(--sandbox-source-name-color, var(--helix-color-syntax-name));}[data-kind="string"] {color: var(--sandbox-source-string-color, var(--helix-color-syntax-string));}[data-kind="tag"] {color: var(--sandbox-source-tag-color, var(--helix-color-syntax-tag));}`);
@@ -1,5 +1,6 @@
1
1
  import { HelixElement } from '@fusion.dev/helix-core';
2
2
  import type { CSSResultGroup, TemplateResult } from 'lit';
3
+ import { type SandboxTokenizer } from '../tokens.js';
3
4
  /**
4
5
  * @summary An editable source pane for a sandbox preview.
5
6
  *
@@ -11,6 +12,18 @@ import type { CSSResultGroup, TemplateResult } from 'lit';
11
12
  * field, press Escape and then Tab. Shift+Tab moves focus back as it does
12
13
  * anywhere else. The field's description says so to a screen reader.
13
14
  *
15
+ * **`tokenize` colors the source** with a highlighter you bring, such as one
16
+ * built on Lezer, Prism or Shiki. It is a function from the source to runs of
17
+ * text, each with an optional kind, and the pane draws the runs under a
18
+ * transparent field, so typing, selection and undo stay the textarea's. The
19
+ * kinds are `callable`, `comment`, `constant`, `invalid`, `keyword`, `name`,
20
+ * `string` and `tag`, each colored by the `--helix-color-syntax-*` token of
21
+ * its name and a hook of its own, such as `--sandbox-source-keyword-color`.
22
+ * A run of any other kind is drawn in the field's own color. Every run with a
23
+ * kind is a `token` part, and carries its kind as `data-kind`. A `tokenize`
24
+ * that throws leaves the source drawn plain and the field editable, and the
25
+ * error is reported to the page as an uncaught one.
26
+ *
14
27
  * @since 0.1.0
15
28
  * @status stable
16
29
  * @aliases Editor, Code pane
@@ -20,10 +33,21 @@ import type { CSSResultGroup, TemplateResult } from 'lit';
20
33
  * @event {HelixCaretEvent} helix-caret - Fired when the cursor moves.
21
34
  * @event {HelixEditEvent} helix-edit - Fired after the source was edited, with the new source.
22
35
  *
36
+ * @csspart field - The box that scrolls the field and its colors together, under `tokenize`.
37
+ * @csspart highlight - The colored copy of the source drawn under the field, under `tokenize`.
23
38
  * @csspart source - The editable region.
39
+ * @csspart token - One run of the source that has a kind, under `tokenize`.
24
40
  *
25
41
  * @cssproperty --sandbox-source-background-color - Fill behind the source.
42
+ * @cssproperty --sandbox-source-callable-color - Color of a `callable` run, under `tokenize`. Defaults to `--helix-color-syntax-callable`.
43
+ * @cssproperty --sandbox-source-comment-color - Color of a `comment` run, under `tokenize`. Defaults to `--helix-color-syntax-comment`.
44
+ * @cssproperty --sandbox-source-constant-color - Color of a `constant` run, under `tokenize`. Defaults to `--helix-color-syntax-constant`.
45
+ * @cssproperty --sandbox-source-invalid-color - Color of an `invalid` run, under `tokenize`. Defaults to `--helix-color-syntax-invalid`.
46
+ * @cssproperty --sandbox-source-keyword-color - Color of a `keyword` run, under `tokenize`. Defaults to `--helix-color-syntax-keyword`.
26
47
  * @cssproperty --sandbox-source-min-block-size - Minimum height of the pane.
48
+ * @cssproperty --sandbox-source-name-color - Color of a `name` run, under `tokenize`. Defaults to `--helix-color-syntax-name`.
49
+ * @cssproperty --sandbox-source-string-color - Color of a `string` run, under `tokenize`. Defaults to `--helix-color-syntax-string`.
50
+ * @cssproperty --sandbox-source-tag-color - Color of a `tag` run, under `tokenize`. Defaults to `--helix-color-syntax-tag`.
27
51
  */
28
52
  export declare class HelixSandboxSource extends HelixElement {
29
53
  /**
@@ -47,6 +71,20 @@ export declare class HelixSandboxSource extends HelixElement {
47
71
  * Whether Tab indents the source. When it is off, Tab moves focus.
48
72
  */
49
73
  tabIndents: boolean;
74
+ /**
75
+ * Colors the source: a function from the source and the pane's `name` to
76
+ * runs of text, each with an optional kind, such as
77
+ * `[{ text: '<' }, { kind: 'tag', text: 'p' }, { text: '>' }]`.
78
+ *
79
+ * Absent, the pane is a plain field. Runs whose text does not add up to the
80
+ * source are drawn as the source, uncolored, so the colors never drift from
81
+ * the caret, and so is the source when the function throws. Set it as a
82
+ * property.
83
+ *
84
+ * Named for what it returns, runs of text, where Code Block's `highlight`
85
+ * returns markup.
86
+ */
87
+ tokenize?: SandboxTokenizer;
50
88
  /**
51
89
  * The source being edited.
52
90
  */
@@ -91,6 +129,8 @@ export declare class HelixSandboxSource extends HelixElement {
91
129
  private edit;
92
130
  private readonly handleKeydown;
93
131
  protected render(): TemplateResult;
132
+ /** The field itself and its description, which is the whole pane without `tokenize`. */
133
+ private renderField;
94
134
  static styles: CSSResultGroup;
95
135
  }
96
136
  declare global {
@@ -7,6 +7,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
7
7
  import { customElement, HelixBeforeEditEvent, HelixCaretEvent, HelixEditEvent, HelixElement, onUnlessFalse, restoreValue, } from '@fusion.dev/helix-core';
8
8
  import { html, nothing } from 'lit';
9
9
  import { property } from 'lit/decorators.js';
10
+ import { drawnRuns } from '../tokens.js';
10
11
  import { styles } from './sandbox-source.css.js';
11
12
  const MODIFIERS = new Set(['Alt', 'AltGraph', 'Control', 'Meta', 'Shift']);
12
13
  let HelixSandboxSource = class HelixSandboxSource extends HelixElement {
@@ -65,6 +66,24 @@ let HelixSandboxSource = class HelixSandboxSource extends HelixElement {
65
66
  }
66
67
  }
67
68
  render() {
69
+ const field = this.renderField();
70
+ if (!this.tokenize) {
71
+ return field;
72
+ }
73
+ let given = [];
74
+ try {
75
+ given = this.tokenize(this.value, this.name);
76
+ }
77
+ catch (error) {
78
+ globalThis.reportError?.(error);
79
+ }
80
+ const runs = drawnRuns(this.value, given);
81
+ return html `<div part="field">
82
+ <pre part="highlight" aria-hidden="true">${runs.map(({ kind, text }) => kind ? html `<span part="token" data-kind=${kind}>${text}</span>` : text)}${'\n'}</pre>
83
+ ${field}
84
+ </div>`;
85
+ }
86
+ renderField() {
68
87
  return html `<textarea
69
88
  part="source"
70
89
  aria-label=${this.fieldLabel}
@@ -93,6 +112,9 @@ __decorate([
93
112
  __decorate([
94
113
  property({ attribute: 'tab-indents', converter: onUnlessFalse })
95
114
  ], HelixSandboxSource.prototype, "tabIndents", void 0);
115
+ __decorate([
116
+ property({ attribute: false })
117
+ ], HelixSandboxSource.prototype, "tokenize", void 0);
96
118
  __decorate([
97
119
  property()
98
120
  ], HelixSandboxSource.prototype, "value", void 0);
@@ -1,22 +1,2 @@
1
1
  import { createSheet } from '@fusion.dev/helix-core';
2
- export const styles = createSheet(`:host {
3
- align-items: center;
4
- background-color: var(--helix-color-background);
5
- border-block-start: var(--helix-border-thin) solid var(--helix-color-border);
6
- color: var(--sandbox-status-bar-color, var(--helix-color-foreground-subtle));
7
- display: flex;
8
- font-size: var(--helix-text-xs);
9
- gap: var(--helix-space-sm);
10
- line-height: var(--helix-leading-tight);
11
- padding: var(--helix-space-2xs) var(--helix-space-sm);
12
-
13
- user-select: none;
14
- }
15
-
16
- slot:not([name]) + * {
17
- margin-inline-start: auto;
18
- }
19
-
20
- [part="caret"] {
21
- font-variant-numeric: tabular-nums;
22
- }`);
2
+ export const styles = createSheet(`:host {align-items: center;background-color: var(--helix-color-background);border-block-start: var(--helix-border-thin) solid var(--helix-color-border);color: var(--sandbox-status-bar-color, var(--helix-color-foreground-subtle));display: flex;font-size: var(--helix-text-xs);gap: var(--helix-space-sm);line-height: var(--helix-leading-tight);padding: var(--helix-space-2xs) var(--helix-space-sm);user-select: none;}slot:not([name]) + * {margin-inline-start: auto;}[part="caret"] {font-variant-numeric: tabular-nums;}`);
@@ -1,107 +1,6 @@
1
1
  import { createSheet } from '@fusion.dev/helix-core';
2
- export const styles = createSheet(`:host {
3
-
4
- block-size: var(--sandbox-terminal-size, 100%);
5
- display: grid;
6
- grid-template-rows: minmax(0, 1fr);
7
- min-block-size: 0;
8
- }
9
-
10
- :host([controls]) {
11
- grid-template-rows: auto minmax(0, 1fr);
12
- }
13
-
14
- [part="controls"] {
15
- align-items: center;
16
- border-block-end: var(--helix-border-thin) solid var(--helix-color-border);
17
- display: flex;
18
- font-family: var(--helix-font-sans);
19
- font-size: var(--helix-text-xs);
20
- gap: var(--helix-space-xs);
21
- justify-content: space-between;
22
- padding: var(--helix-space-2xs) var(--helix-space-sm);
23
- }
24
-
25
- [part="filter"],
26
- [part="clear"] {
27
- background-color: transparent;
28
- border: var(--helix-border-thin) solid var(--helix-color-border);
29
- border-radius: var(--helix-radii-sm);
30
- color: var(--helix-color-foreground);
31
- font: inherit;
32
- padding: var(--helix-space-2xs) var(--helix-space-xs);
33
- }
34
-
35
- [part="clear"] {
36
- cursor: pointer;
37
- }
38
-
39
- [part="clear"]:hover {
40
- background-color: var(--helix-color-surface-sunken);
41
- }
42
-
43
- [part="filter"]:focus-visible,
44
- [part="clear"]:focus-visible {
45
- outline: var(--helix-size-focus-ring) solid var(--helix-color-focus-ring);
46
- outline-offset: var(--helix-size-focus-offset);
47
- }
48
-
49
- [part="log"] {
50
- font-family: var(--helix-font-mono);
51
- font-size: var(--helix-text-xs);
52
- line-height: var(--helix-leading-normal);
53
- overflow: auto;
54
- padding: var(--helix-space-xs) var(--helix-space-sm);
55
- }
56
-
57
- [part="log"]:focus-visible {
58
- outline: var(--helix-size-focus-ring) solid var(--helix-color-focus-ring);
59
- outline-offset: calc(var(--helix-size-focus-offset) * -1);
60
- }
61
-
62
- [part="empty"] {
63
- color: var(--helix-color-foreground-subtle);
64
- margin: var(--helix-space-none);
65
- }
66
-
67
- [part="entry"] {
68
- align-items: baseline;
69
- color: var(--helix-color-foreground-muted);
70
- display: grid;
71
- gap: var(--helix-space-xs);
72
- grid-template-columns: 3.5rem minmax(0, 1fr) auto;
73
- padding-block: var(--helix-space-2xs);
74
- }
75
-
76
- [part="level"] {
77
- color: var(--helix-color-foreground-subtle);
78
- text-transform: uppercase;
79
- }
80
-
81
- [part="message"] {
82
- white-space: pre-wrap;
83
- word-break: break-word;
84
- }
85
-
86
- [part="count"] {
87
- background-color: var(--helix-color-surface-sunken);
88
- border-radius: var(--helix-radii-full);
89
- color: var(--helix-color-foreground-subtle);
90
- padding-inline: var(--helix-space-2xs);
91
- }
92
-
93
- [part="entry"][data-level="warn"] {
94
- color: var(--helix-color-warning);
95
- }
96
-
97
- [part="entry"][data-level="warn"] [part="level"] {
98
- color: var(--helix-color-warning);
99
- }
100
-
101
- [part="entry"][data-level="error"] {
102
- color: var(--helix-color-danger);
103
- }
104
-
105
- [part="entry"][data-level="error"] [part="level"] {
106
- color: var(--helix-color-danger);
107
- }`);
2
+ export const styles = createSheet(`:host {block-size: var(--sandbox-terminal-size, 100%);display: grid;grid-template-rows: minmax(0, 1fr);min-block-size: 0;}:host([controls]) {grid-template-rows: auto minmax(0, 1fr);}[part="controls"] {align-items: center;border-block-end: var(--helix-border-thin) solid var(--helix-color-border);display: flex;font-family: var(--helix-font-sans);font-size: var(--helix-text-xs);gap: var(--helix-space-xs);justify-content: space-between;padding: var(--helix-space-2xs) var(--helix-space-sm);}[part="filter"],
3
+ [part="clear"] {background-color: transparent;border: var(--helix-border-thin) solid var(--helix-color-border);border-radius: var(--helix-radii-sm);color: var(--helix-color-foreground);font: inherit;padding: var(--helix-space-2xs) var(--helix-space-xs);}[part="clear"] {cursor: pointer;}[part="clear"]:hover {background-color: var(--helix-color-surface-sunken);}[part="filter"]:focus-visible,
4
+ [part="clear"]:focus-visible {outline: var(--helix-size-focus-ring) solid var(--helix-color-focus-ring);outline-offset: var(--helix-size-focus-offset);}[part="log"] {font-family: var(--helix-font-mono);font-size: var(--helix-text-xs);line-height: var(--helix-leading-normal);overflow: auto;padding: var(--helix-space-xs) var(--helix-space-sm);}[part="log"]:focus-visible {outline: var(--helix-size-focus-ring) solid var(--helix-color-focus-ring);outline-offset: calc(var(--helix-size-focus-offset) * -1);}[part="empty"] {color: var(--helix-color-foreground-subtle);margin: var(--helix-space-none);}[part="entry"] {align-items: baseline;color: var(--helix-color-foreground-muted);display: grid;gap: var(--helix-space-xs);grid-template-columns: 3.5rem minmax(0, 1fr) auto;padding-block: var(--helix-space-2xs);}[part="level"] {color: var(--helix-color-foreground-subtle);text-transform: uppercase;}[part="message"] {white-space: pre-wrap;word-break: break-word;}[part="count"] {background-color: var(--helix-color-surface-sunken);border-radius: var(--helix-radii-full);color: var(--helix-color-foreground-subtle);padding-inline: var(--helix-space-2xs);}[data-level="warn"],
5
+ [data-level="warn"] [part="level"] {color: var(--helix-color-warning);}[data-level="error"],
6
+ [data-level="error"] [part="level"] {color: var(--helix-color-danger);}`);
@@ -27,6 +27,9 @@ import { type ConsoleLevel } from '../levels.js';
27
27
  * @aliases Console, Output
28
28
  * @documentation https://fusion.dev/helix/components/sandbox
29
29
  *
30
+ * @event {Event} change - Fired after the reader chose another level in the filter. `level` holds it.
31
+ * @event {HelixBeforeChangeEvent} helix-before-change - Fired before the level filter changes, with the level chosen, `log` for every level. Cancelable: cancel it to keep the current level.
32
+ *
30
33
  * @csspart clear - The button that empties the log, under `controls`.
31
34
  * @csspart controls - The row holding the clear button and the level filter, under `controls`.
32
35
  * @csspart count - How many times a repeated line was written.
@@ -74,7 +77,8 @@ export declare class HelixSandboxTerminal extends HelixElement {
74
77
  /**
75
78
  * What each choice of the level filter reads, for a page in another
76
79
  * language, keyed by level, such as `{ warn: '…' }`. A level left out keeps
77
- * its English words. As an attribute it is that object as JSON.
80
+ * its English words. As an attribute it is that object as JSON, and JSON
81
+ * that does not parse is no words.
78
82
  */
79
83
  levelWords: Partial<Record<ConsoleLevel, string>>;
80
84
  private entries;
@@ -98,7 +102,15 @@ export declare class HelixSandboxTerminal extends HelixElement {
98
102
  /** Empties the log. */
99
103
  clear(): void;
100
104
  protected updated(): void;
101
- /** Takes the level the reader chose in the filter. */
105
+ /**
106
+ * Takes the level the reader chose in the filter, unless a listener
107
+ * refused it, and then says so with the select's own `change`, which stops
108
+ * at the shadow root otherwise. A refusal puts the select back.
109
+ *
110
+ * The select's `input` is stopped where it starts, as Pagination's is. It is
111
+ * composed and comes first, so it left this element before
112
+ * `helix-before-change` and still left it when the change was refused.
113
+ */
102
114
  private readonly handleLevel;
103
115
  /** The clear button and the level filter, under `controls`. */
104
116
  private renderControls;
@@ -4,7 +4,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
4
4
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
5
  return c > 3 && r && Object.defineProperty(target, key, r), r;
6
6
  };
7
- import { customElement, HelixElement } from '@fusion.dev/helix-core';
7
+ import { customElement, HelixBeforeChangeEvent, HelixElement, requestChange, wordsConverter, } from '@fusion.dev/helix-core';
8
8
  import { html, nothing } from 'lit';
9
9
  import { property, state } from 'lit/decorators.js';
10
10
  import { LEVELS, shows } from '../levels.js';
@@ -16,6 +16,7 @@ const LEVEL_WORDS = {
16
16
  warn: 'Warnings and errors',
17
17
  };
18
18
  const LIMIT = 200;
19
+ const stop = (event) => event.stopPropagation();
19
20
  let HelixSandboxTerminal = class HelixSandboxTerminal extends HelixElement {
20
21
  constructor() {
21
22
  super(...arguments);
@@ -28,8 +29,21 @@ let HelixSandboxTerminal = class HelixSandboxTerminal extends HelixElement {
28
29
  this.entries = [];
29
30
  this.following = true;
30
31
  this.handleLevel = (event) => {
31
- const chosen = event.target.value;
32
- this.level = chosen === 'log' ? undefined : chosen;
32
+ const field = event.target;
33
+ const taken = requestChange({
34
+ apply: (next) => {
35
+ this.level = next === 'log' ? undefined : next;
36
+ },
37
+ event: (next) => new HelixBeforeChangeEvent({ value: next }),
38
+ host: this,
39
+ next: field.value,
40
+ });
41
+ if (taken) {
42
+ this.relayNativeEvent(event);
43
+ }
44
+ else {
45
+ field.value = this.level ?? 'log';
46
+ }
33
47
  };
34
48
  }
35
49
  get log() {
@@ -64,9 +78,9 @@ let HelixSandboxTerminal = class HelixSandboxTerminal extends HelixElement {
64
78
  return nothing;
65
79
  }
66
80
  return html `<div part="controls">
67
- <select part="filter" aria-label=${this.levelLabel} @change=${this.handleLevel}>
81
+ <select part="filter" aria-label=${this.levelLabel} @change=${this.handleLevel} @input=${stop}>
68
82
  ${LEVELS.map((one) => html `<option value=${one} ?selected=${(this.level ?? 'log') === one}>
69
- ${this.levelWords[one] ?? LEVEL_WORDS[one]}
83
+ ${this.levelWords?.[one] ?? LEVEL_WORDS[one]}
70
84
  </option>`)}
71
85
  </select>
72
86
  <button part="clear" type="button" @click=${() => this.clear()}>${this.clearLabel}</button>
@@ -111,7 +125,7 @@ __decorate([
111
125
  property({ attribute: 'level-label' })
112
126
  ], HelixSandboxTerminal.prototype, "levelLabel", void 0);
113
127
  __decorate([
114
- property({ attribute: 'level-words', type: Object })
128
+ property({ attribute: 'level-words', converter: wordsConverter })
115
129
  ], HelixSandboxTerminal.prototype, "levelWords", void 0);
116
130
  __decorate([
117
131
  state()
@@ -0,0 +1,39 @@
1
+ /** One run of source text, and the kind of token it is. */
2
+ export interface SandboxToken {
3
+ /**
4
+ * What the run is: `callable`, `comment`, `constant`, `invalid`, `keyword`,
5
+ * `name`, `string` or `tag`, which each have a color. Absent for text that is
6
+ * not a token, such as spaces and punctuation.
7
+ */
8
+ kind?: string | undefined;
9
+ /** The text of the run, exactly as the source has it. */
10
+ text: string;
11
+ }
12
+ /**
13
+ * Splits a pane's source into runs, for `SandboxSource.tokenize`.
14
+ *
15
+ * Takes the source and the pane's `name`, such as `html` or `css`, so one
16
+ * function can serve every pane.
17
+ */
18
+ export type SandboxTokenizer = (source: string, name: string) => readonly SandboxToken[];
19
+ /** A run as the pane draws it: its text, and its kind as an attribute holds it. */
20
+ export interface DrawnRun {
21
+ /** The kind, in lowercase letters, digits and hyphens, or `undefined` for plain text. */
22
+ kind: string | undefined;
23
+ /** The text of the run. */
24
+ text: string;
25
+ }
26
+ /**
27
+ * The runs a highlighter gave, made safe to draw over the field.
28
+ *
29
+ * **Drawn under the text the reader types, so the two must match exactly.** The
30
+ * runs are laid out behind a transparent field, and one character dropped or
31
+ * added moves every line after it away from the caret. So runs whose text does
32
+ * not add up to the source are not drawn as given: the source is drawn as one
33
+ * plain run instead, which loses the colors and keeps the caret honest.
34
+ *
35
+ * A kind is lowercased and anything but letters, digits and hyphens in it is
36
+ * a hyphen, so the stylesheet's eight kinds match however a highlighter
37
+ * spells them, and nothing else it writes reaches an attribute.
38
+ */
39
+ export declare const drawnRuns: (source: string, runs: readonly SandboxToken[]) => DrawnRun[];
@@ -0,0 +1,9 @@
1
+ export const drawnRuns = (source, runs) => {
2
+ if (runs.map((run) => run.text).join('') !== source) {
3
+ return [{ kind: undefined, text: source }];
4
+ }
5
+ return runs.map((run) => ({
6
+ kind: run.kind ? run.kind.toLowerCase().replace(/[^a-z0-9-]/g, '-') : undefined,
7
+ text: run.text,
8
+ }));
9
+ };
@@ -1,37 +1,2 @@
1
1
  import { createSheet } from '@fusion.dev/helix-core';
2
- export const styles = createSheet(`:host {
3
-
4
- --helix-size-checkbox: var(--helix-size-checkbox-sm);
5
- --helix-size-checkbox-loose: calc(var(--helix-size-checkbox) * 1.2);
6
- --helix-size-checkbox-tight: calc(var(--helix-size-checkbox) * 0.8);
7
- --helix-size-icon: var(--helix-size-icon-sm);
8
- --helix-size-icon-loose: calc(var(--helix-size-icon) * 1.2);
9
- --helix-size-icon-tight: calc(var(--helix-size-icon) * 0.8);
10
- --helix-size-control: var(--helix-size-control-sm);
11
- --helix-size-control-loose: calc(var(--helix-size-control) * 1.2);
12
- --helix-size-control-tight: calc(var(--helix-size-control) * 0.8);
13
- --helix-size-tag: var(--helix-size-tag-sm);
14
-
15
- align-items: center;
16
- background-color: var(--helix-color-background);
17
-
18
- block-size: var(--sandbox-toolbar-size, var(--helix-size-control-lg));
19
-
20
- border-block-end: var(--helix-border-thin) solid var(--helix-color-border);
21
- display: flex;
22
- min-block-size: 0;
23
- padding-block: var(--helix-space-none);
24
-
25
- padding-inline: var(--helix-space-md);
26
- }
27
-
28
- slot {
29
- align-items: center;
30
- display: flex;
31
- gap: var(--sandbox-toolbar-gap, var(--helix-space-sm));
32
- min-inline-size: 0;
33
- }
34
-
35
- slot[name="end"] {
36
- margin-inline-start: auto;
37
- }`);
2
+ export const styles = createSheet(`:host {--helix-size-checkbox: var(--helix-size-checkbox-sm);--helix-size-checkbox-loose: calc(var(--helix-size-checkbox) * 1.2);--helix-size-checkbox-tight: calc(var(--helix-size-checkbox) * 0.8);--helix-size-icon: var(--helix-size-icon-sm);--helix-size-icon-loose: calc(var(--helix-size-icon) * 1.2);--helix-size-icon-tight: calc(var(--helix-size-icon) * 0.8);--helix-size-control: var(--helix-size-control-sm);--helix-size-control-loose: calc(var(--helix-size-control) * 1.2);--helix-size-control-tight: calc(var(--helix-size-control) * 0.8);--helix-size-tag: var(--helix-size-tag-sm);align-items: center;background-color: var(--helix-color-background);block-size: var(--sandbox-toolbar-size, var(--helix-size-control-lg));border-block-end: var(--helix-border-thin) solid var(--helix-color-border);display: flex;min-block-size: 0;padding-block: var(--helix-space-none);padding-inline: var(--helix-space-md);}slot {align-items: center;display: flex;gap: var(--sandbox-toolbar-gap, var(--helix-space-sm));min-inline-size: 0;}slot[name="end"] {margin-inline-start: auto;}`);
@@ -1,143 +1,17 @@
1
1
  import { createSheet } from '@fusion.dev/helix-core';
2
- export const styles = createSheet(`:host {
3
- container-type: inline-size;
4
- display: block;
5
- position: relative;
6
- }
7
-
8
- [part="plane"] {
9
- column-gap: var(--scatter-chart-gap, var(--helix-space-xs));
10
- display: grid;
11
- grid-template-areas:
2
+ export const styles = createSheet(`:host {container-type: inline-size;display: block;position: relative;}[part="plane"] {column-gap: var(--scatter-chart-gap, var(--helix-space-xs));display: grid;grid-template-areas:
12
3
  "y-name y-name"
13
4
  "y-axis plot"
14
5
  ". x-axis"
15
- ". x-name";
16
- grid-template-columns: auto minmax(0, 1fr);
17
- row-gap: var(--scatter-chart-gap, var(--helix-space-xs));
18
- }
19
-
20
- [part="plot"] {
21
- block-size: var(--scatter-chart-block-size, 14em);
22
- cursor: crosshair;
23
- grid-area: plot;
24
- position: relative;
25
- }
26
-
27
- [part="plot"] svg {
28
- block-size: 100%;
29
- inline-size: 100%;
30
- overflow: visible;
31
- }
32
-
33
- [part="gridline"] {
34
- stroke: var(--scatter-chart-gridline-color, var(--helix-color-border));
35
- stroke-width: var(--helix-border-thin);
36
- vector-effect: non-scaling-stroke;
37
- }
38
-
39
- [part~="point"] {
40
- background-color: var(--chart-series);
41
- block-size: var(--scatter-chart-point-size, 8px);
42
- border-radius: var(--helix-radii-full);
43
- box-shadow: 0 0 0 var(--helix-border-thin)
44
- var(--scatter-chart-point-ring-color, var(--helix-color-background));
45
- inline-size: var(--scatter-chart-point-size, 8px);
46
- inset-block-start: var(--chart-point-y);
47
- inset-inline-start: var(--chart-point-x);
48
- opacity: var(--scatter-chart-point-opacity, 0.8);
49
- pointer-events: none;
50
- position: absolute;
51
- transition:
6
+ ". x-name";grid-template-columns: auto minmax(0, 1fr);row-gap: var(--scatter-chart-gap, var(--helix-space-xs));}[part="plot"] {block-size: var(--scatter-chart-block-size, 14em);cursor: crosshair;grid-area: plot;position: relative;}[part="plot"] svg {block-size: 100%;inline-size: 100%;overflow: visible;}[part="trend"] {fill: none;stroke: var(--chart-series);stroke-dasharray: var(--scatter-chart-trend-dash, 4 3);stroke-linecap: round;stroke-width: var(--scatter-chart-trend-width, 1.5px);vector-effect: non-scaling-stroke;}[part="gridline"] {stroke: var(--scatter-chart-gridline-color, var(--helix-color-border));stroke-width: var(--helix-border-thin);vector-effect: non-scaling-stroke;}[part~="point"] {--_scatter-chart-diameter: calc(
7
+ var(--scatter-chart-point-size, 8px) +
8
+ var(--chart-point-weight, 0) *
9
+ (var(--scatter-chart-bubble-size, 40px) - var(--scatter-chart-point-size, 8px))
10
+ );background-color: var(--chart-series);block-size: var(--_scatter-chart-diameter);border-radius: var(--helix-radii-full);box-shadow: 0 0 0 var(--helix-border-thin)
11
+ var(--scatter-chart-point-ring-color, var(--helix-color-background));inline-size: var(--_scatter-chart-diameter);inset-block-start: var(--chart-point-y);inset-inline-start: var(--chart-point-x);opacity: var(--scatter-chart-point-opacity, 0.8);pointer-events: none;position: absolute;transition:
52
12
  inset-block-start var(--helix-duration-normal) var(--helix-easing-decelerate),
53
13
  inset-inline-start var(--helix-duration-normal) var(--helix-easing-decelerate),
54
- scale var(--helix-duration-fast) var(--helix-easing-decelerate);
55
- translate: -50% -50%;
56
- }
57
-
58
- [part~="point"][data-active] {
59
- opacity: 1;
60
- scale: 1.5;
61
- }
62
-
63
- [part="x-axis"],
64
- [part="y-axis"] {
65
- display: grid;
66
- }
67
-
68
- [part="x-axis"] {
69
- grid-area: x-axis;
70
- }
71
-
72
- [part="y-axis"] {
73
- grid-area: y-axis;
74
- }
75
-
76
- [part="x-tick"],
77
- [part="y-tick"] {
78
- color: var(--helix-color-foreground-muted);
79
- font-size: var(--helix-text-xs);
80
- font-variant-numeric: tabular-nums;
81
- grid-area: 1 / 1;
82
- line-height: 1;
83
- position: relative;
84
- white-space: nowrap;
85
- }
86
-
87
- [part="x-tick"] {
88
- inset-inline-start: var(--chart-tick);
89
- justify-self: start;
90
- translate: -50% 0;
91
- }
92
-
93
- [part="y-tick"] {
94
- align-self: start;
95
- inset-block-start: var(--chart-tick);
96
- justify-self: end;
97
- translate: 0 -50%;
98
- }
99
-
100
- @container (inline-size < 30rem) {
101
- [part="x-tick"]:nth-last-child(even) {
102
- visibility: hidden;
103
- }
104
- }
105
-
106
- [part="x-name"],
107
- [part="y-name"] {
108
- color: var(--helix-color-foreground-muted);
109
- font-size: var(--helix-text-xs);
110
- font-weight: var(--helix-weight-medium);
111
- }
112
-
113
- [part="x-name"] {
114
- grid-area: x-name;
115
- justify-self: end;
116
- }
117
-
118
- [part="y-name"] {
119
- grid-area: y-name;
120
- justify-self: start;
121
- }
122
-
123
- [part="summary"] {
124
- block-size: 1px;
125
- clip-path: inset(50%);
126
- inline-size: 1px;
127
- margin: var(--helix-space-none);
128
- overflow: hidden;
129
- position: absolute;
130
- white-space: nowrap;
131
- }
132
-
133
- @starting-style {
134
- [part~="point"] {
135
- opacity: 0;
136
- }
137
- }
138
-
139
- @media print {
140
- :host {
141
- print-color-adjust: exact;
142
- }
143
- }`);
14
+ scale var(--helix-duration-fast) var(--helix-easing-decelerate);translate: -50% -50%;}[part~="point"][data-active] {opacity: 1;scale: 1.5;}[part="x-axis"],
15
+ [part="y-axis"] {display: grid;}[part="x-axis"] {grid-area: x-axis;}[part="y-axis"] {grid-area: y-axis;}[part="x-tick"],
16
+ [part="y-tick"] {color: var(--helix-color-foreground-muted);font-size: var(--helix-text-xs);font-variant-numeric: tabular-nums;grid-area: 1 / 1;line-height: 1;position: relative;white-space: nowrap;}[part="x-tick"] {inset-inline-start: var(--chart-tick);justify-self: start;translate: -50% 0;}[part="y-tick"] {align-self: start;inset-block-start: var(--chart-tick);justify-self: end;translate: 0 -50%;}@container (inline-size < 30rem) {[part="x-tick"]:nth-last-child(even) {visibility: hidden;}}[part="x-name"],
17
+ [part="y-name"] {color: var(--helix-color-foreground-muted);font-size: var(--helix-text-xs);font-weight: var(--helix-weight-medium);}[part="x-name"] {grid-area: x-name;justify-self: end;}[part="y-name"] {grid-area: y-name;justify-self: start;}[part="summary"] {block-size: 1px;clip-path: inset(50%);inline-size: 1px;margin: var(--helix-space-none);overflow: hidden;position: absolute;white-space: nowrap;}@starting-style {[part~="point"] {opacity: 0;}}@media print {:host {print-color-adjust: exact;}}`);
@@ -33,11 +33,14 @@ import '../../tooltip/index.js';
33
33
  * @documentation https://fusion.dev/helix/components/scatter-chart
34
34
  *
35
35
  * @cssproperty --scatter-chart-block-size - Height of the drawing.
36
+ * @cssproperty --scatter-chart-bubble-size - Diameter of the largest point under `size-by`. The smallest is `--scatter-chart-point-size`.
36
37
  * @cssproperty --scatter-chart-gap - Space between the drawing and its axes.
37
38
  * @cssproperty --scatter-chart-gridline-color - Color of the gridlines across the plot, drawn when `gridlines` is set.
38
39
  * @cssproperty --scatter-chart-point-opacity - Opacity of a point, so a cluster looks darker where it is denser.
39
40
  * @cssproperty --scatter-chart-point-ring-color - Color of the ring around each point. It matches the page, so change it when the chart sits on another surface.
40
41
  * @cssproperty --scatter-chart-point-size - Diameter of a point.
42
+ * @cssproperty --scatter-chart-trend-dash - The dash pattern of a line of best fit, under `trend`, as `stroke-dasharray` takes it. `none` draws it solid.
43
+ * @cssproperty --scatter-chart-trend-width - The thickness of a line of best fit, under `trend`.
41
44
  */
42
45
  export declare class HelixScatterChart extends HelixHeadlessScatterChart {
43
46
  /** The styled tier, so the tooltip this renders is the styled one. */