@weasel-js/ui 1.5.2 → 1.6.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 (466) hide show
  1. package/dist/chunks/ActionBar-CYvfmEz0.js +57 -0
  2. package/dist/chunks/ActionBar-CYvfmEz0.js.map +1 -0
  3. package/dist/chunks/{Badge-CW9pBPFl.js → Badge-DZ0lFs14.js} +755 -738
  4. package/dist/chunks/Badge-DZ0lFs14.js.map +1 -0
  5. package/dist/chunks/{BandEditor-jY-PFKY6.js → BandEditor-D-nVrVO4.js} +34 -34
  6. package/dist/chunks/{BandEditor-jY-PFKY6.js.map → BandEditor-D-nVrVO4.js.map} +1 -1
  7. package/dist/chunks/Button-Dyp31jMt.js +111 -0
  8. package/dist/chunks/Button-Dyp31jMt.js.map +1 -0
  9. package/dist/chunks/ButtonBar-smZzFuEo.js +46 -0
  10. package/dist/chunks/ButtonBar-smZzFuEo.js.map +1 -0
  11. package/dist/chunks/Callout-xLjnx7Mp.js +119 -0
  12. package/dist/chunks/Callout-xLjnx7Mp.js.map +1 -0
  13. package/dist/chunks/{Checkbox-BOsDAY2F.js → Checkbox-ChZz30Ds.js} +1 -1
  14. package/dist/chunks/{Checkbox-BOsDAY2F.js.map → Checkbox-ChZz30Ds.js.map} +1 -1
  15. package/dist/chunks/Code-v4tDWuuN.js +24 -0
  16. package/dist/chunks/Code-v4tDWuuN.js.map +1 -0
  17. package/dist/chunks/{ColorField-BYzgZM9o.js → ColorField-DJSCuSJv.js} +15 -15
  18. package/dist/chunks/ColorField-DJSCuSJv.js.map +1 -0
  19. package/dist/chunks/ColorModeControl-JOEiqtE0.js +47 -0
  20. package/dist/chunks/ColorModeControl-JOEiqtE0.js.map +1 -0
  21. package/dist/chunks/{ComboBox-Cz3f0Y_8.js → ComboBox-C1JgIpML.js} +2 -2
  22. package/dist/chunks/{ComboBox-Cz3f0Y_8.js.map → ComboBox-C1JgIpML.js.map} +1 -1
  23. package/dist/chunks/{CurveEditor-DXwSP-iA.js → CurveEditor-f1R4kSbD.js} +2 -2
  24. package/dist/chunks/{CurveEditor-DXwSP-iA.js.map → CurveEditor-f1R4kSbD.js.map} +1 -1
  25. package/dist/chunks/DataGrid-CZPrB_3a.js +152 -0
  26. package/dist/chunks/DataGrid-CZPrB_3a.js.map +1 -0
  27. package/dist/chunks/DetailList-DHaXX4TG.js +43 -0
  28. package/dist/chunks/DetailList-DHaXX4TG.js.map +1 -0
  29. package/dist/chunks/{DetentSlider-CAubVX0J.js → DetentSlider-BYyaZha6.js} +2 -2
  30. package/dist/chunks/{DetentSlider-CAubVX0J.js.map → DetentSlider-BYyaZha6.js.map} +1 -1
  31. package/dist/chunks/Dialog-GIvjoDQj.js +66 -0
  32. package/dist/chunks/Dialog-GIvjoDQj.js.map +1 -0
  33. package/dist/chunks/Disclosure-D79jhmh2.js +58 -0
  34. package/dist/chunks/Disclosure-D79jhmh2.js.map +1 -0
  35. package/dist/chunks/DragGhost-DcU7cOwy.js +30 -0
  36. package/dist/chunks/DragGhost-DcU7cOwy.js.map +1 -0
  37. package/dist/chunks/{DragHandleGlyph-CppAz4_8.js → DragHandleGlyph-BtBxHjZS.js} +1 -1
  38. package/dist/chunks/{DragHandleGlyph-CppAz4_8.js.map → DragHandleGlyph-BtBxHjZS.js.map} +1 -1
  39. package/dist/chunks/{Field-DWnV8WZY.js → Field-xbqRmjsI.js} +1 -1
  40. package/dist/chunks/{Field-DWnV8WZY.js.map → Field-xbqRmjsI.js.map} +1 -1
  41. package/dist/chunks/FillStrokeSwatch-BViKXIPx.js +111 -0
  42. package/dist/chunks/FillStrokeSwatch-BViKXIPx.js.map +1 -0
  43. package/dist/chunks/{FontFamilySelect-DxfgTC3G.js → FontFamilySelect-r9TV_xIH.js} +2 -2
  44. package/dist/chunks/{FontFamilySelect-DxfgTC3G.js.map → FontFamilySelect-r9TV_xIH.js.map} +1 -1
  45. package/dist/chunks/GradientEditor-BRTxHG-W.js +333 -0
  46. package/dist/chunks/{GradientEditor-rRBmf3G0.js.map → GradientEditor-BRTxHG-W.js.map} +1 -1
  47. package/dist/chunks/{Icon-DT0x6HaQ.js → Icon-BW0qv_U7.js} +28 -20
  48. package/dist/chunks/Icon-BW0qv_U7.js.map +1 -0
  49. package/dist/chunks/InlineRange-BwGFDhpT.js +29 -0
  50. package/dist/chunks/InlineRange-BwGFDhpT.js.map +1 -0
  51. package/dist/chunks/{Input-DbMKpkXy.js → Input-Bx2cuUbS.js} +24 -19
  52. package/dist/chunks/Input-Bx2cuUbS.js.map +1 -0
  53. package/dist/chunks/ItemList-DzJ2lK0R.js +175 -0
  54. package/dist/chunks/ItemList-DzJ2lK0R.js.map +1 -0
  55. package/dist/chunks/ItemList.module-DDUXfuZL.js +14 -0
  56. package/dist/chunks/ItemList.module-DDUXfuZL.js.map +1 -0
  57. package/dist/chunks/{Jog-DkkTlL3_.js → Jog-LPoac9s4.js} +6 -6
  58. package/dist/chunks/{Jog-DkkTlL3_.js.map → Jog-LPoac9s4.js.map} +1 -1
  59. package/dist/chunks/{Keycaps-DunVpejA.js → Keycaps-CKiKOJnJ.js} +71 -65
  60. package/dist/chunks/Keycaps-CKiKOJnJ.js.map +1 -0
  61. package/dist/chunks/LayerList-BeGrkLb9.js +427 -0
  62. package/dist/chunks/LayerList-BeGrkLb9.js.map +1 -0
  63. package/dist/chunks/ListEditor-C6zLzCsJ.js +74 -0
  64. package/dist/chunks/ListEditor-C6zLzCsJ.js.map +1 -0
  65. package/dist/chunks/MenuButton-BcdhrNGh.js +70 -0
  66. package/dist/chunks/MenuButton-BcdhrNGh.js.map +1 -0
  67. package/dist/chunks/MeshEditor-BOOIFWnz.js +87 -0
  68. package/dist/chunks/MeshEditor-BOOIFWnz.js.map +1 -0
  69. package/dist/chunks/{NumberField-CCjEDZCg.js → NumberField-C1Y7zP-a.js} +27 -22
  70. package/dist/chunks/NumberField-C1Y7zP-a.js.map +1 -0
  71. package/dist/chunks/{OptionsBar-DeQ-vUeZ.js → OptionsBar-DlcagPYK.js} +3 -3
  72. package/dist/chunks/{OptionsBar-DeQ-vUeZ.js.map → OptionsBar-DlcagPYK.js.map} +1 -1
  73. package/dist/chunks/{PaintField-jBOJ32rL.js → PaintField-B2mLRZa4.js} +20 -20
  74. package/dist/chunks/PaintField-B2mLRZa4.js.map +1 -0
  75. package/dist/chunks/{PaintInput-Qs7Rul5R.js → PaintInput-BFKhd83I.js} +24 -24
  76. package/dist/chunks/{PaintInput-Qs7Rul5R.js.map → PaintInput-BFKhd83I.js.map} +1 -1
  77. package/dist/chunks/{PatternPicker-BMpXWboq.js → PatternPicker-DdfpxoQy.js} +2 -2
  78. package/dist/chunks/{PatternPicker-BMpXWboq.js.map → PatternPicker-DdfpxoQy.js.map} +1 -1
  79. package/dist/chunks/{Plot2D-CXf_f7QD.js → Plot2D-lyO7waPQ.js} +1 -1
  80. package/dist/chunks/{Plot2D-CXf_f7QD.js.map → Plot2D-lyO7waPQ.js.map} +1 -1
  81. package/dist/chunks/{PointPlotter-S_gz7VYt.js → PointPlotter-DGs9i5P-.js} +2 -2
  82. package/dist/chunks/{PointPlotter-S_gz7VYt.js.map → PointPlotter-DGs9i5P-.js.map} +1 -1
  83. package/dist/chunks/{Powerline-Ak5AWUlK.js → Powerline-DBEPceLE.js} +4 -2
  84. package/dist/chunks/Powerline-DBEPceLE.js.map +1 -0
  85. package/dist/chunks/Prefs-Ctu0H4-b.js +475 -0
  86. package/dist/chunks/Prefs-Ctu0H4-b.js.map +1 -0
  87. package/dist/chunks/Properties-Bbneh1ws.js +281 -0
  88. package/dist/chunks/Properties-Bbneh1ws.js.map +1 -0
  89. package/dist/chunks/PropertyField-CDb19d3F.js +756 -0
  90. package/dist/chunks/PropertyField-CDb19d3F.js.map +1 -0
  91. package/dist/chunks/{RadioGroup-CsVp3SEu.js → RadioGroup-BK2mD6Q0.js} +2 -2
  92. package/dist/chunks/{RadioGroup-CsVp3SEu.js.map → RadioGroup-BK2mD6Q0.js.map} +1 -1
  93. package/dist/chunks/{RangeSlider-DNr-pJpZ.js → RangeSlider-BiRAOsTh.js} +1 -1
  94. package/dist/chunks/{RangeSlider-DNr-pJpZ.js.map → RangeSlider-BiRAOsTh.js.map} +1 -1
  95. package/dist/chunks/{ResizeHandle-RXFf5fXr.js → ResizeHandle-Cc6EOehs.js} +9 -9
  96. package/dist/chunks/{ResizeHandle-RXFf5fXr.js.map → ResizeHandle-Cc6EOehs.js.map} +1 -1
  97. package/dist/chunks/Select-DVValBe1.js +225 -0
  98. package/dist/chunks/Select-DVValBe1.js.map +1 -0
  99. package/dist/chunks/{SelectionPanel-CEbLS-0D.js → SelectionPanel-C5LmZA7b.js} +21 -20
  100. package/dist/chunks/{SelectionPanel-CEbLS-0D.js.map → SelectionPanel-C5LmZA7b.js.map} +1 -1
  101. package/dist/chunks/{Sidebar-qn_oSCNX.js → Sidebar-DKKd4R-x.js} +1 -1
  102. package/dist/chunks/{Sidebar-qn_oSCNX.js.map → Sidebar-DKKd4R-x.js.map} +1 -1
  103. package/dist/chunks/{SidebarPanel-Bs6V21hg.js → SidebarPanel-u5NsuAZY.js} +15 -19
  104. package/dist/chunks/SidebarPanel-u5NsuAZY.js.map +1 -0
  105. package/dist/chunks/{Slider-CIIrqiFS.js → Slider-BwRrWHFW.js} +42 -42
  106. package/dist/chunks/{Slider-CIIrqiFS.js.map → Slider-BwRrWHFW.js.map} +1 -1
  107. package/dist/chunks/{StatusBar-B4L15DSm.js → StatusBar-CdPdmmda.js} +1 -1
  108. package/dist/chunks/{StatusBar-B4L15DSm.js.map → StatusBar-CdPdmmda.js.map} +1 -1
  109. package/dist/chunks/SwatchGrid-C-Zx2Exd.js +73 -0
  110. package/dist/chunks/SwatchGrid-C-Zx2Exd.js.map +1 -0
  111. package/dist/chunks/{Switch-DH5POG0T.js → Switch-DxF7TsEu.js} +1 -1
  112. package/dist/chunks/{Switch-DH5POG0T.js.map → Switch-DxF7TsEu.js.map} +1 -1
  113. package/dist/chunks/{Tabs-BFHikpml.js → Tabs-GXEfoe3o.js} +1 -1
  114. package/dist/chunks/{Tabs-BFHikpml.js.map → Tabs-GXEfoe3o.js.map} +1 -1
  115. package/dist/chunks/{Timeline-DNKY_yiK.js → Timeline-SgmpQtUV.js} +128 -132
  116. package/dist/chunks/Timeline-SgmpQtUV.js.map +1 -0
  117. package/dist/chunks/{Toast-CI1UDuK6.js → Toast-BfcljZz6.js} +1 -1
  118. package/dist/chunks/{Toast-CI1UDuK6.js.map → Toast-BfcljZz6.js.map} +1 -1
  119. package/dist/chunks/ToggleBar-Btnl5r7F.js +80 -0
  120. package/dist/chunks/{ToggleBar-CClus5Cd.js.map → ToggleBar-Btnl5r7F.js.map} +1 -1
  121. package/dist/chunks/{TokenPanel-BPHq24dc.js → TokenPanel-5ajHEHha.js} +40 -40
  122. package/dist/chunks/{TokenPanel-BPHq24dc.js.map → TokenPanel-5ajHEHha.js.map} +1 -1
  123. package/dist/chunks/{ToolButton-9QzJCmuM.js → ToolButton-rzqlFlAc.js} +4 -4
  124. package/dist/chunks/{ToolButton-9QzJCmuM.js.map → ToolButton-rzqlFlAc.js.map} +1 -1
  125. package/dist/chunks/{ToolGroup-BJiDrH_i.js → ToolGroup-4bUBV5k6.js} +1 -1
  126. package/dist/chunks/{ToolGroup-BJiDrH_i.js.map → ToolGroup-4bUBV5k6.js.map} +1 -1
  127. package/dist/chunks/{ToolOptionsBar-CAM6RcUH.js → ToolOptionsBar-BF3TNXA3.js} +2 -2
  128. package/dist/chunks/{ToolOptionsBar-CAM6RcUH.js.map → ToolOptionsBar-BF3TNXA3.js.map} +1 -1
  129. package/dist/chunks/ToolPalette-Uw4PvWwa.js +83 -0
  130. package/dist/chunks/ToolPalette-Uw4PvWwa.js.map +1 -0
  131. package/dist/chunks/{Tooltip-C4YBczLq.js → Tooltip-9XiJF937.js} +13 -13
  132. package/dist/chunks/Tooltip-9XiJF937.js.map +1 -0
  133. package/dist/chunks/Tree-BGt6P8tI.js +203 -0
  134. package/dist/chunks/Tree-BGt6P8tI.js.map +1 -0
  135. package/dist/chunks/{createKeyframeLayer-DKtO0Sw_.js → createKeyframeLayer-BzDRCrrh.js} +71 -71
  136. package/dist/chunks/{createKeyframeLayer-DKtO0Sw_.js.map → createKeyframeLayer-BzDRCrrh.js.map} +1 -1
  137. package/dist/chunks/formatShortcut-BoGqUoWi.js +15 -0
  138. package/dist/chunks/formatShortcut-BoGqUoWi.js.map +1 -0
  139. package/dist/chunks/icons-DbScMMqX.js +179 -0
  140. package/dist/chunks/icons-DbScMMqX.js.map +1 -0
  141. package/dist/chunks/interactiveTarget-C7QUBaJN.js +24 -0
  142. package/dist/chunks/interactiveTarget-C7QUBaJN.js.map +1 -0
  143. package/dist/chunks/{keyGlyph-Bp0wnLHn.js → keyGlyph-CLvUHU8c.js} +1 -1
  144. package/dist/chunks/{keyGlyph-Bp0wnLHn.js.map → keyGlyph-CLvUHU8c.js.map} +1 -1
  145. package/dist/chunks/model-BQMvTLnW.js +360 -0
  146. package/dist/chunks/model-BQMvTLnW.js.map +1 -0
  147. package/dist/chunks/{number-BHz66zQO.js → number-6S8IzXVt.js} +3 -3
  148. package/dist/chunks/number-6S8IzXVt.js.map +1 -0
  149. package/dist/chunks/paintPreview-DPtZS4yU.js +42 -0
  150. package/dist/chunks/paintPreview-DPtZS4yU.js.map +1 -0
  151. package/dist/chunks/paintValue-Bz6AVuh3.js +18 -0
  152. package/dist/chunks/paintValue-Bz6AVuh3.js.map +1 -0
  153. package/dist/chunks/prefField-CLkhrvYl.js +197 -0
  154. package/dist/chunks/prefField-CLkhrvYl.js.map +1 -0
  155. package/dist/chunks/segmentTooltip-CAkZlW-t.js +29 -0
  156. package/dist/chunks/segmentTooltip-CAkZlW-t.js.map +1 -0
  157. package/dist/chunks/segmentedControl.module-D2nw68Yo.js +11 -0
  158. package/dist/chunks/segmentedControl.module-D2nw68Yo.js.map +1 -0
  159. package/dist/chunks/{snap-CEjuWOhN.js → snap-DC4Km8xG.js} +1 -1
  160. package/dist/chunks/{snap-CEjuWOhN.js.map → snap-DC4Km8xG.js.map} +1 -1
  161. package/dist/chunks/stance-CarrcbbP.js +17 -0
  162. package/dist/chunks/stance-CarrcbbP.js.map +1 -0
  163. package/dist/chunks/useReorderDragList-Dcezzgix.js +131 -0
  164. package/dist/chunks/useReorderDragList-Dcezzgix.js.map +1 -0
  165. package/dist/chunks/{useRovingTabIndex-Dkpf_KhN.js → useRovingTabIndex-B4uJqiKP.js} +1 -1
  166. package/dist/chunks/useRovingTabIndex-B4uJqiKP.js.map +1 -0
  167. package/dist/color/ramp.d.ts +38 -0
  168. package/dist/color/ramp.d.ts.map +1 -0
  169. package/dist/components/ActionBar/ActionBar.d.ts +6 -4
  170. package/dist/components/ActionBar/ActionBar.d.ts.map +1 -1
  171. package/dist/components/ActionBar/index.js +1 -1
  172. package/dist/components/Badge/Badge.d.ts +21 -7
  173. package/dist/components/Badge/Badge.d.ts.map +1 -1
  174. package/dist/components/Badge/effects/Aqua.d.ts +1 -1
  175. package/dist/components/Badge/effects/Aqua.d.ts.map +1 -1
  176. package/dist/components/Badge/index.d.ts +1 -1
  177. package/dist/components/Badge/index.d.ts.map +1 -1
  178. package/dist/components/Badge/index.js +1 -1
  179. package/dist/components/Badge/types.d.ts +6 -5
  180. package/dist/components/Badge/types.d.ts.map +1 -1
  181. package/dist/components/BandEditor/index.js +1 -1
  182. package/dist/components/Button/Button.d.ts +17 -3
  183. package/dist/components/Button/Button.d.ts.map +1 -1
  184. package/dist/components/Button/index.d.ts +1 -1
  185. package/dist/components/Button/index.d.ts.map +1 -1
  186. package/dist/components/Button/index.js +1 -1
  187. package/dist/components/ButtonBar/ButtonBar.d.ts +36 -0
  188. package/dist/components/ButtonBar/ButtonBar.d.ts.map +1 -0
  189. package/dist/components/ButtonBar/index.d.ts +3 -0
  190. package/dist/components/ButtonBar/index.d.ts.map +1 -0
  191. package/dist/components/ButtonBar/index.js +2 -0
  192. package/dist/components/Callout/Callout.d.ts +2 -5
  193. package/dist/components/Callout/Callout.d.ts.map +1 -1
  194. package/dist/components/Callout/index.d.ts +1 -1
  195. package/dist/components/Callout/index.d.ts.map +1 -1
  196. package/dist/components/Callout/index.js +1 -1
  197. package/dist/components/Checkbox/index.js +1 -1
  198. package/dist/components/Code/Code.d.ts +28 -0
  199. package/dist/components/Code/Code.d.ts.map +1 -0
  200. package/dist/components/Code/index.d.ts +3 -0
  201. package/dist/components/Code/index.d.ts.map +1 -0
  202. package/dist/components/Code/index.js +2 -0
  203. package/dist/components/ColorField/index.js +1 -1
  204. package/dist/components/ColorModeControl/ColorModeControl.d.ts +21 -0
  205. package/dist/components/ColorModeControl/ColorModeControl.d.ts.map +1 -0
  206. package/dist/components/ColorModeControl/index.d.ts +3 -0
  207. package/dist/components/ColorModeControl/index.d.ts.map +1 -0
  208. package/dist/components/ColorModeControl/index.js +2 -0
  209. package/dist/components/ComboBox/index.js +1 -1
  210. package/dist/components/CurveEditor/index.js +3 -3
  211. package/dist/components/DataGrid/DataGrid.d.ts +22 -0
  212. package/dist/components/DataGrid/DataGrid.d.ts.map +1 -1
  213. package/dist/components/DataGrid/index.js +1 -1
  214. package/dist/components/DetailList/DetailList.d.ts +36 -0
  215. package/dist/components/DetailList/DetailList.d.ts.map +1 -0
  216. package/dist/components/DetailList/index.d.ts +3 -0
  217. package/dist/components/DetailList/index.d.ts.map +1 -0
  218. package/dist/components/DetailList/index.js +2 -0
  219. package/dist/components/DetentSlider/index.js +1 -1
  220. package/dist/components/Dialog/Dialog.d.ts +8 -2
  221. package/dist/components/Dialog/Dialog.d.ts.map +1 -1
  222. package/dist/components/Dialog/index.js +1 -1
  223. package/dist/components/Disclosure/Disclosure.d.ts +25 -17
  224. package/dist/components/Disclosure/Disclosure.d.ts.map +1 -1
  225. package/dist/components/Disclosure/index.d.ts +2 -2
  226. package/dist/components/Disclosure/index.d.ts.map +1 -1
  227. package/dist/components/Disclosure/index.js +2 -2
  228. package/dist/components/DragGhost/DragGhost.d.ts +21 -0
  229. package/dist/components/DragGhost/DragGhost.d.ts.map +1 -0
  230. package/dist/components/DragGhost/index.d.ts +3 -0
  231. package/dist/components/DragGhost/index.d.ts.map +1 -0
  232. package/dist/components/DragGhost/index.js +2 -0
  233. package/dist/components/DragHandleGlyph/index.js +1 -1
  234. package/dist/components/Field/index.js +1 -1
  235. package/dist/components/FillStrokeSwatch/FillStrokeSwatch.d.ts +45 -0
  236. package/dist/components/FillStrokeSwatch/FillStrokeSwatch.d.ts.map +1 -0
  237. package/dist/components/FillStrokeSwatch/index.d.ts +3 -0
  238. package/dist/components/FillStrokeSwatch/index.d.ts.map +1 -0
  239. package/dist/components/FillStrokeSwatch/index.js +2 -0
  240. package/dist/components/FontFamilySelect/index.js +1 -1
  241. package/dist/components/GradientEditor/SceneGradientHandles.d.ts.map +1 -1
  242. package/dist/components/GradientEditor/index.js +1 -1
  243. package/dist/components/InlineRange/InlineRange.d.ts +6 -2
  244. package/dist/components/InlineRange/InlineRange.d.ts.map +1 -1
  245. package/dist/components/InlineRange/index.js +1 -1
  246. package/dist/components/Input/Input.d.ts +13 -0
  247. package/dist/components/Input/Input.d.ts.map +1 -1
  248. package/dist/components/Input/index.js +1 -1
  249. package/dist/components/ItemList/ItemList.d.ts +70 -10
  250. package/dist/components/ItemList/ItemList.d.ts.map +1 -1
  251. package/dist/components/ItemList/index.js +1 -1
  252. package/dist/components/Jog/index.js +1 -1
  253. package/dist/components/Keycaps/index.d.ts +1 -0
  254. package/dist/components/Keycaps/index.d.ts.map +1 -1
  255. package/dist/components/Keycaps/index.js +3 -3
  256. package/dist/components/Keycaps/keySpecsFromMods.d.ts +2 -0
  257. package/dist/components/Keycaps/keySpecsFromMods.d.ts.map +1 -1
  258. package/dist/components/Keycaps/keySpecsFromShortcut.d.ts +16 -0
  259. package/dist/components/Keycaps/keySpecsFromShortcut.d.ts.map +1 -0
  260. package/dist/components/LayerList/LayerList.d.ts +79 -0
  261. package/dist/components/LayerList/LayerList.d.ts.map +1 -0
  262. package/dist/components/LayerList/index.d.ts +3 -0
  263. package/dist/components/LayerList/index.d.ts.map +1 -0
  264. package/dist/components/LayerList/index.js +2 -0
  265. package/dist/components/LayerList/useSceneLayerList.d.ts +20 -0
  266. package/dist/components/LayerList/useSceneLayerList.d.ts.map +1 -0
  267. package/dist/components/ListEditor/ListEditor.d.ts +23 -0
  268. package/dist/components/ListEditor/ListEditor.d.ts.map +1 -0
  269. package/dist/components/ListEditor/index.d.ts +3 -0
  270. package/dist/components/ListEditor/index.d.ts.map +1 -0
  271. package/dist/components/ListEditor/index.js +2 -0
  272. package/dist/components/MenuButton/MenuButton.d.ts +6 -2
  273. package/dist/components/MenuButton/MenuButton.d.ts.map +1 -1
  274. package/dist/components/MenuButton/index.js +1 -1
  275. package/dist/components/MeshEditor/index.js +1 -1
  276. package/dist/components/NumberField/NumberField.d.ts +13 -0
  277. package/dist/components/NumberField/NumberField.d.ts.map +1 -1
  278. package/dist/components/NumberField/index.js +1 -1
  279. package/dist/components/OptionsBar/index.js +1 -1
  280. package/dist/components/PaintField/index.js +1 -1
  281. package/dist/components/PaintInput/index.js +1 -1
  282. package/dist/components/PatternPicker/index.js +1 -1
  283. package/dist/components/Plot2D/index.js +1 -1
  284. package/dist/components/PointPlotter/index.js +1 -1
  285. package/dist/components/Powerline/Powerline.d.ts +4 -3
  286. package/dist/components/Powerline/Powerline.d.ts.map +1 -1
  287. package/dist/components/Powerline/index.js +2 -2
  288. package/dist/components/Prefs/PrefsDialog.d.ts +10 -2
  289. package/dist/components/Prefs/PrefsDialog.d.ts.map +1 -1
  290. package/dist/components/Prefs/PrefsForm.d.ts +26 -25
  291. package/dist/components/Prefs/PrefsForm.d.ts.map +1 -1
  292. package/dist/components/Prefs/PrefsPane.d.ts +24 -0
  293. package/dist/components/Prefs/PrefsPane.d.ts.map +1 -0
  294. package/dist/components/Prefs/PrefsRail.d.ts +32 -0
  295. package/dist/components/Prefs/PrefsRail.d.ts.map +1 -0
  296. package/dist/components/Prefs/PrefsRow.d.ts +32 -0
  297. package/dist/components/Prefs/PrefsRow.d.ts.map +1 -0
  298. package/dist/components/Prefs/index.d.ts +5 -2
  299. package/dist/components/Prefs/index.d.ts.map +1 -1
  300. package/dist/components/Prefs/index.js +3 -3
  301. package/dist/components/Prefs/prefField.d.ts +36 -0
  302. package/dist/components/Prefs/prefField.d.ts.map +1 -0
  303. package/dist/components/Prefs/schema.d.ts +30 -0
  304. package/dist/components/Prefs/schema.d.ts.map +1 -1
  305. package/dist/components/Properties/DialogRow.d.ts +33 -0
  306. package/dist/components/Properties/DialogRow.d.ts.map +1 -0
  307. package/dist/components/Properties/PropertyField.d.ts +238 -0
  308. package/dist/components/Properties/PropertyField.d.ts.map +1 -0
  309. package/dist/components/Properties/PropertyGroup.d.ts +12 -3
  310. package/dist/components/Properties/PropertyGroup.d.ts.map +1 -1
  311. package/dist/components/Properties/PropertyPanel.d.ts +32 -236
  312. package/dist/components/Properties/PropertyPanel.d.ts.map +1 -1
  313. package/dist/components/Properties/Subpanel.d.ts +14 -0
  314. package/dist/components/Properties/Subpanel.d.ts.map +1 -0
  315. package/dist/components/Properties/index.d.ts +8 -4
  316. package/dist/components/Properties/index.d.ts.map +1 -1
  317. package/dist/components/Properties/index.js +3 -2
  318. package/dist/components/Properties/storyLayouts.d.ts.map +1 -1
  319. package/dist/components/RadioGroup/index.js +1 -1
  320. package/dist/components/RangeSlider/index.js +1 -1
  321. package/dist/components/ResizeHandle/index.js +1 -1
  322. package/dist/components/Select/Select.d.ts +38 -5
  323. package/dist/components/Select/Select.d.ts.map +1 -1
  324. package/dist/components/Select/index.d.ts +2 -2
  325. package/dist/components/Select/index.d.ts.map +1 -1
  326. package/dist/components/Select/index.js +2 -2
  327. package/dist/components/SelectionPanel/index.js +2 -2
  328. package/dist/components/SelectionPanel/renderLeaf.d.ts +14 -8
  329. package/dist/components/SelectionPanel/renderLeaf.d.ts.map +1 -1
  330. package/dist/components/Sidebar/index.js +1 -1
  331. package/dist/components/SidebarPanel/SidebarPanel.d.ts +2 -2
  332. package/dist/components/SidebarPanel/SidebarPanel.d.ts.map +1 -1
  333. package/dist/components/SidebarPanel/index.js +1 -1
  334. package/dist/components/Slider/index.js +1 -1
  335. package/dist/components/StatusBar/index.js +1 -1
  336. package/dist/components/SwatchGrid/SwatchGrid.d.ts +34 -0
  337. package/dist/components/SwatchGrid/SwatchGrid.d.ts.map +1 -0
  338. package/dist/components/SwatchGrid/index.d.ts +3 -0
  339. package/dist/components/SwatchGrid/index.d.ts.map +1 -0
  340. package/dist/components/SwatchGrid/index.js +2 -0
  341. package/dist/components/Switch/index.js +1 -1
  342. package/dist/components/Tabs/index.js +1 -1
  343. package/dist/components/Timeline/Lane.d.ts.map +1 -1
  344. package/dist/components/Timeline/index.js +1 -1
  345. package/dist/components/Toast/index.js +1 -1
  346. package/dist/components/ToggleBar/ToggleBar.d.ts +2 -1
  347. package/dist/components/ToggleBar/ToggleBar.d.ts.map +1 -1
  348. package/dist/components/ToggleBar/index.js +1 -1
  349. package/dist/components/TokenPanel/index.js +1 -1
  350. package/dist/components/ToolButton/index.js +1 -1
  351. package/dist/components/ToolGroup/index.js +1 -1
  352. package/dist/components/ToolOptionsBar/index.js +1 -1
  353. package/dist/components/ToolPalette/index.d.ts +1 -0
  354. package/dist/components/ToolPalette/index.d.ts.map +1 -1
  355. package/dist/components/ToolPalette/index.js +3 -2
  356. package/dist/components/Tooltip/Tooltip.d.ts +6 -2
  357. package/dist/components/Tooltip/Tooltip.d.ts.map +1 -1
  358. package/dist/components/Tooltip/index.d.ts +1 -1
  359. package/dist/components/Tooltip/index.d.ts.map +1 -1
  360. package/dist/components/Tooltip/index.js +2 -2
  361. package/dist/components/Tree/Tree.d.ts +84 -0
  362. package/dist/components/Tree/Tree.d.ts.map +1 -0
  363. package/dist/components/Tree/index.d.ts +3 -0
  364. package/dist/components/Tree/index.d.ts.map +1 -0
  365. package/dist/components/Tree/index.js +2 -0
  366. package/dist/components/segmentTooltip.d.ts +30 -0
  367. package/dist/components/segmentTooltip.d.ts.map +1 -0
  368. package/dist/components/stance.d.ts +30 -0
  369. package/dist/components/stance.d.ts.map +1 -0
  370. package/dist/components/stanceCss.d.ts +31 -0
  371. package/dist/components/stanceCss.d.ts.map +1 -0
  372. package/dist/components/stanceSurfaces.d.ts +4 -0
  373. package/dist/components/stanceSurfaces.d.ts.map +1 -0
  374. package/dist/format/number.d.ts +3 -2
  375. package/dist/format/number.d.ts.map +1 -1
  376. package/dist/icons/Icon.d.ts.map +1 -1
  377. package/dist/icons/ShapeKindIcon.d.ts +10 -0
  378. package/dist/icons/ShapeKindIcon.d.ts.map +1 -0
  379. package/dist/icons/index.d.ts +5 -3
  380. package/dist/icons/index.d.ts.map +1 -1
  381. package/dist/icons/paths.d.ts +2 -0
  382. package/dist/icons/paths.d.ts.map +1 -1
  383. package/dist/index.d.ts +16 -3
  384. package/dist/index.d.ts.map +1 -1
  385. package/dist/index.js +110 -78
  386. package/dist/index.js.map +1 -1
  387. package/dist/interactiveTarget.d.ts +9 -0
  388. package/dist/interactiveTarget.d.ts.map +1 -0
  389. package/dist/style.css +1 -1
  390. package/dist/useReorderDragList.d.ts +36 -7
  391. package/dist/useReorderDragList.d.ts.map +1 -1
  392. package/dist/useRovingTabIndex.d.ts +1 -1
  393. package/dist/useScrollSpy.d.ts +48 -0
  394. package/dist/useScrollSpy.d.ts.map +1 -0
  395. package/package.json +8 -8
  396. package/dist/chunks/ActionBar-CLwiY3Jg.js +0 -62
  397. package/dist/chunks/ActionBar-CLwiY3Jg.js.map +0 -1
  398. package/dist/chunks/ActionsBar-D84a4eGy.js +0 -41
  399. package/dist/chunks/ActionsBar-D84a4eGy.js.map +0 -1
  400. package/dist/chunks/Badge-CW9pBPFl.js.map +0 -1
  401. package/dist/chunks/Button-DRSApvnK.js +0 -90
  402. package/dist/chunks/Button-DRSApvnK.js.map +0 -1
  403. package/dist/chunks/Callout-DrNu-9Qr.js +0 -122
  404. package/dist/chunks/Callout-DrNu-9Qr.js.map +0 -1
  405. package/dist/chunks/ColorField-BYzgZM9o.js.map +0 -1
  406. package/dist/chunks/DataGrid-C8KrYtw7.js +0 -104
  407. package/dist/chunks/DataGrid-C8KrYtw7.js.map +0 -1
  408. package/dist/chunks/Dialog-fGqqQ6o_.js +0 -61
  409. package/dist/chunks/Dialog-fGqqQ6o_.js.map +0 -1
  410. package/dist/chunks/Disclosure-CILDfWsU.js +0 -47
  411. package/dist/chunks/Disclosure-CILDfWsU.js.map +0 -1
  412. package/dist/chunks/GradientEditor-rRBmf3G0.js +0 -333
  413. package/dist/chunks/Icon-DT0x6HaQ.js.map +0 -1
  414. package/dist/chunks/InlineRange-DdIlfGqG.js +0 -29
  415. package/dist/chunks/InlineRange-DdIlfGqG.js.map +0 -1
  416. package/dist/chunks/Input-DbMKpkXy.js.map +0 -1
  417. package/dist/chunks/ItemList-B9zYb0GE.js +0 -42
  418. package/dist/chunks/ItemList-B9zYb0GE.js.map +0 -1
  419. package/dist/chunks/Keycaps-DunVpejA.js.map +0 -1
  420. package/dist/chunks/LayerStack-CfQ6GsRz.js +0 -142
  421. package/dist/chunks/LayerStack-CfQ6GsRz.js.map +0 -1
  422. package/dist/chunks/MenuButton-C_4nox39.js +0 -60
  423. package/dist/chunks/MenuButton-C_4nox39.js.map +0 -1
  424. package/dist/chunks/MeshEditor-Bipz-Ocl.js +0 -123
  425. package/dist/chunks/MeshEditor-Bipz-Ocl.js.map +0 -1
  426. package/dist/chunks/NumberField-CCjEDZCg.js.map +0 -1
  427. package/dist/chunks/PaintField-jBOJ32rL.js.map +0 -1
  428. package/dist/chunks/Powerline-Ak5AWUlK.js.map +0 -1
  429. package/dist/chunks/Prefs-CNC8tzyN.js +0 -308
  430. package/dist/chunks/Prefs-CNC8tzyN.js.map +0 -1
  431. package/dist/chunks/Properties-Rnb6TAbN.js +0 -891
  432. package/dist/chunks/Properties-Rnb6TAbN.js.map +0 -1
  433. package/dist/chunks/Select-BEope086.js +0 -190
  434. package/dist/chunks/Select-BEope086.js.map +0 -1
  435. package/dist/chunks/SidebarPanel-Bs6V21hg.js.map +0 -1
  436. package/dist/chunks/Timeline-DNKY_yiK.js.map +0 -1
  437. package/dist/chunks/ToggleBar-CClus5Cd.js +0 -75
  438. package/dist/chunks/ToolPalette-DGkKwE7D.js +0 -97
  439. package/dist/chunks/ToolPalette-DGkKwE7D.js.map +0 -1
  440. package/dist/chunks/Tooltip-C4YBczLq.js.map +0 -1
  441. package/dist/chunks/icons-DFLytcui.js +0 -165
  442. package/dist/chunks/icons-DFLytcui.js.map +0 -1
  443. package/dist/chunks/model-13kZ_-mE.js +0 -483
  444. package/dist/chunks/model-13kZ_-mE.js.map +0 -1
  445. package/dist/chunks/number-BHz66zQO.js.map +0 -1
  446. package/dist/chunks/range.module-DSsOIq1R.js +0 -8
  447. package/dist/chunks/range.module-DSsOIq1R.js.map +0 -1
  448. package/dist/chunks/schema-Dft4Cu2p.js +0 -47
  449. package/dist/chunks/schema-Dft4Cu2p.js.map +0 -1
  450. package/dist/chunks/segmentedControl.module-DS72X1ns.js +0 -11
  451. package/dist/chunks/segmentedControl.module-DS72X1ns.js.map +0 -1
  452. package/dist/chunks/useReorderDragList-CSQGd7zQ.js +0 -102
  453. package/dist/chunks/useReorderDragList-CSQGd7zQ.js.map +0 -1
  454. package/dist/chunks/useRovingTabIndex-Dkpf_KhN.js.map +0 -1
  455. package/dist/components/ActionsBar/ActionsBar.d.ts +0 -35
  456. package/dist/components/ActionsBar/ActionsBar.d.ts.map +0 -1
  457. package/dist/components/ActionsBar/index.d.ts +0 -3
  458. package/dist/components/ActionsBar/index.d.ts.map +0 -1
  459. package/dist/components/ActionsBar/index.js +0 -2
  460. package/dist/components/LayerStack/LayerStack.d.ts +0 -62
  461. package/dist/components/LayerStack/LayerStack.d.ts.map +0 -1
  462. package/dist/components/LayerStack/index.d.ts +0 -2
  463. package/dist/components/LayerStack/index.d.ts.map +0 -1
  464. package/dist/components/LayerStack/index.js +0 -2
  465. package/dist/components/Properties/EffectCard.d.ts +0 -69
  466. package/dist/components/Properties/EffectCard.d.ts.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"PatternPicker-BMpXWboq.js","names":[],"sources":["../../src/components/PatternPicker/PatternPicker.module.css","../../src/components/PatternPicker/PatternPicker.tsx"],"sourcesContent":["/* Tile grid over the size switch. */\n.root {\n display: flex;\n flex-direction: column;\n gap: var(--wzl-space-3);\n min-inline-size: 0;\n}\n\n.grid {\n display: grid;\n grid-template-columns: repeat(auto-fill, minmax(var(--wzl-swatch-size, 28px), 1fr));\n gap: 0;\n}\n\n/* The swatch's whole face is its own tile, so it must not carry a flat\n background — and the tile repeats at its own scale, not the swatch's. */\n.swatch {\n width: 100%;\n aspect-ratio: 1 / 1;\n min-width: 0;\n padding: 0;\n border: 0.5px solid var(--wzl-border);\n border-radius: 0;\n cursor: pointer;\n background-color: var(--wzl-surface-sunken);\n background-image: var(--tile-preview);\n background-repeat: repeat;\n background-size: 16px 16px;\n background-clip: padding-box;\n}\n\n.swatch:hover {\n border-color: var(--wzl-fg-muted);\n}\n\n.swatchActive {\n border-color: var(--wzl-accent);\n box-shadow: 0 0 0 1px var(--wzl-accent);\n}\n","import type { ReactElement } from 'react';\nimport type { CSSProperties } from 'react';\nimport type { FillStyle, TilePatternSpec } from '@weasel-js/core';\nimport { tilePreviewCssUrl } from '@weasel-js/svg';\nimport { ToggleBar } from '../ToggleBar';\nimport s from './PatternPicker.module.css';\n\n/** The `pattern` member of the paint union. */\nexport type PatternFill = Extract<FillStyle, { fill: 'pattern' }>;\n\nconst TILES: readonly TilePatternSpec['tile'][] = ['hatch', 'crosshatch', 'dots', 'chunks'];\n\n/** Tile sizes the picker offers, coarse enough that each reads as a\n * distinct texture rather than a nudge. */\nconst TILE_SIZES: readonly { value: number; label: string }[] = [\n { value: 4, label: 'S' },\n { value: 8, label: 'M' },\n { value: 16, label: 'L' },\n { value: 32, label: 'XL' },\n];\n\nconst DEFAULT_TILE_SIZE = 8;\n\n/** Every swatch previews at one size so the grid compares tiles, not scales. */\nconst PREVIEW_SIZE = 16;\n\n/** The spec a pattern paint carries, if it carries one. A consumer-built\n * `TextureHandle` has no spec, so the picker shows no tile selected and\n * replaces it wholesale on the next click. */\nfunction specOf(fill: PatternFill): TilePatternSpec | null {\n return 'tile' in fill.pattern ? fill.pattern : null;\n}\n\n/**\n * A pattern seeded from a color. `units: 'bounds'` anchors the tile to the\n * node's box, so the texture travels with the shape.\n */\nexport function seedPattern(\n tile: TilePatternSpec['tile'],\n from: string,\n size: number = DEFAULT_TILE_SIZE,\n): PatternFill {\n const spec: TilePatternSpec = { tile, color: from, size };\n // `chunks` is a scatter over a ground rather than a line texture; without a\n // background it reads as loose specks on whatever sits beneath.\n if (tile === 'chunks') spec.bg = '#00000000';\n return { fill: 'pattern', pattern: spec, units: 'bounds' };\n}\n\n/** Props for {@link PatternPicker}. */\nexport interface PatternPickerProps {\n /** The pattern paint being edited. */\n value: PatternFill;\n /** The color new tiles are seeded with — the paint's own, normally. */\n color: string;\n /** Committed value: one call per click. A tile pick and a size change are\n * each a complete gesture, so there is no `onInput`. */\n onChange: (next: PatternFill) => void;\n className?: string;\n}\n\n/**\n * Grid of tile swatches over a size switch, each swatch previewing the real\n * tile at the current color.\n *\n * The preview shares its shape mapper with what the renderer paints, so a\n * swatch cannot drift from the texture it selects.\n */\nexport function PatternPicker(props: PatternPickerProps): ReactElement {\n const { value, color, onChange, className } = props;\n const spec = specOf(value);\n const size = spec?.size ?? DEFAULT_TILE_SIZE;\n\n const pick = (tile: TilePatternSpec['tile']): void => {\n onChange(seedPattern(tile, color, size));\n };\n\n const resize = (nextSize: number): void => {\n if (!spec) return;\n onChange({ ...value, pattern: { ...spec, size: nextSize } });\n };\n\n return (\n <div className={[s.root, className].filter(Boolean).join(' ')}>\n <div className={s.grid}>\n {TILES.map((tile) => {\n const preview: TilePatternSpec = { tile, color, size: PREVIEW_SIZE };\n if (tile === 'chunks') preview.bg = '#00000000';\n const selected = spec?.tile === tile;\n return (\n <button\n key={tile}\n type=\"button\"\n className={[s.swatch, selected && s.swatchActive].filter(Boolean).join(' ')}\n style={{ ['--tile-preview' as string]: tilePreviewCssUrl(preview) } as CSSProperties}\n title={tile}\n aria-label={tile}\n aria-pressed={selected}\n onClick={() => pick(tile)}\n />\n );\n })}\n </div>\n <ToggleBar<number>\n items={TILE_SIZES}\n value={size}\n size=\"sm\"\n ariaLabel=\"Tile size\"\n onChange={(v) => v != null && resize(v)}\n />\n </div>\n );\n}\n"],"mappings":";;;;;;;;GCUM,IAA4C;CAAC;CAAS;CAAc;CAAQ;CAAS,EAIrF,IAA0D;CAC9D;EAAE,OAAO;EAAG,OAAO;EAAK;CACxB;EAAE,OAAO;EAAG,OAAO;EAAK;CACxB;EAAE,OAAO;EAAI,OAAO;EAAK;CACzB;EAAE,OAAO;EAAI,OAAO;EAAM;CAC3B,EAEK,IAAoB,GAGpB,IAAe;AAKrB,SAAS,EAAO,GAA2C;AACzD,QAAO,UAAU,EAAK,UAAU,EAAK,UAAU;;AAOjD,SAAgB,EACd,GACA,GACA,IAAe,GACF;CACb,IAAM,IAAwB;EAAE;EAAM,OAAO;EAAM;EAAM;AAIzD,QADI,MAAS,aAAU,EAAK,KAAK,cAC1B;EAAE,MAAM;EAAW,SAAS;EAAM,OAAO;EAAU;;AAsB5D,SAAgB,EAAc,GAAyC;CACrE,IAAM,EAAE,UAAO,UAAO,aAAU,iBAAc,GACxC,IAAO,EAAO,EAAM,EACpB,IAAO,GAAM,QAAQ,GAErB,KAAQ,MAAwC;AACpD,IAAS,EAAY,GAAM,GAAO,EAAK,CAAC;IAGpC,KAAU,MAA2B;AACpC,OACL,EAAS;GAAE,GAAG;GAAO,SAAS;IAAE,GAAG;IAAM,MAAM;IAAU;GAAE,CAAC;;AAG9D,QACE,kBAAC,OAAD;EAAK,WAAW,CAAC,EAAE,MAAM,EAAU,CAAC,OAAO,QAAQ,CAAC,KAAK,IAAI;YAA7D,CACE,kBAAC,OAAD;GAAK,WAAW,EAAE;aACf,EAAM,KAAK,MAAS;IACnB,IAAM,IAA2B;KAAE;KAAM;KAAO,MAAM;KAAc;AACpE,IAAI,MAAS,aAAU,EAAQ,KAAK;IACpC,IAAM,IAAW,GAAM,SAAS;AAChC,WACE,kBAAC,UAAD;KAEE,MAAK;KACL,WAAW,CAAC,EAAE,QAAQ,KAAY,EAAE,aAAa,CAAC,OAAO,QAAQ,CAAC,KAAK,IAAI;KAC3E,OAAO,EAAG,kBAA6B,EAAkB,EAAQ,EAAE;KACnE,OAAO;KACP,cAAY;KACZ,gBAAc;KACd,eAAe,EAAK,EAAK;KACzB,EARK,EAQL;KAEJ;GACE,CAAA,EACN,kBAAC,GAAD;GACE,OAAO;GACP,OAAO;GACP,MAAK;GACL,WAAU;GACV,WAAW,MAAM,KAAK,QAAQ,EAAO,EAAE;GACvC,CAAA,CACE"}
1
+ {"version":3,"file":"PatternPicker-DdfpxoQy.js","names":[],"sources":["../../src/components/PatternPicker/PatternPicker.module.css","../../src/components/PatternPicker/PatternPicker.tsx"],"sourcesContent":["/* Tile grid over the size switch. */\n.root {\n display: flex;\n flex-direction: column;\n gap: var(--wzl-space-3);\n min-inline-size: 0;\n}\n\n.grid {\n display: grid;\n grid-template-columns: repeat(auto-fill, minmax(var(--wzl-swatch-size, 28px), 1fr));\n gap: 0;\n}\n\n/* The swatch's whole face is its own tile, so it must not carry a flat\n background — and the tile repeats at its own scale, not the swatch's. */\n.swatch {\n width: 100%;\n aspect-ratio: 1 / 1;\n min-width: 0;\n padding: 0;\n border: 0.5px solid var(--wzl-border);\n border-radius: 0;\n cursor: pointer;\n background-color: var(--wzl-surface-sunken);\n background-image: var(--tile-preview);\n background-repeat: repeat;\n background-size: 16px 16px;\n background-clip: padding-box;\n}\n\n.swatch:hover {\n border-color: var(--wzl-fg-muted);\n}\n\n.swatchActive {\n border-color: var(--wzl-accent);\n box-shadow: 0 0 0 1px var(--wzl-accent);\n}\n","import type { ReactElement } from 'react';\nimport type { CSSProperties } from 'react';\nimport type { FillStyle, TilePatternSpec } from '@weasel-js/core';\nimport { tilePreviewCssUrl } from '@weasel-js/svg';\nimport { ToggleBar } from '../ToggleBar';\nimport s from './PatternPicker.module.css';\n\n/** The `pattern` member of the paint union. */\nexport type PatternFill = Extract<FillStyle, { fill: 'pattern' }>;\n\nconst TILES: readonly TilePatternSpec['tile'][] = ['hatch', 'crosshatch', 'dots', 'chunks'];\n\n/** Tile sizes the picker offers, coarse enough that each reads as a\n * distinct texture rather than a nudge. */\nconst TILE_SIZES: readonly { value: number; label: string }[] = [\n { value: 4, label: 'S' },\n { value: 8, label: 'M' },\n { value: 16, label: 'L' },\n { value: 32, label: 'XL' },\n];\n\nconst DEFAULT_TILE_SIZE = 8;\n\n/** Every swatch previews at one size so the grid compares tiles, not scales. */\nconst PREVIEW_SIZE = 16;\n\n/** The spec a pattern paint carries, if it carries one. A consumer-built\n * `TextureHandle` has no spec, so the picker shows no tile selected and\n * replaces it wholesale on the next click. */\nfunction specOf(fill: PatternFill): TilePatternSpec | null {\n return 'tile' in fill.pattern ? fill.pattern : null;\n}\n\n/**\n * A pattern seeded from a color. `units: 'bounds'` anchors the tile to the\n * node's box, so the texture travels with the shape.\n */\nexport function seedPattern(\n tile: TilePatternSpec['tile'],\n from: string,\n size: number = DEFAULT_TILE_SIZE,\n): PatternFill {\n const spec: TilePatternSpec = { tile, color: from, size };\n // `chunks` is a scatter over a ground rather than a line texture; without a\n // background it reads as loose specks on whatever sits beneath.\n if (tile === 'chunks') spec.bg = '#00000000';\n return { fill: 'pattern', pattern: spec, units: 'bounds' };\n}\n\n/** Props for {@link PatternPicker}. */\nexport interface PatternPickerProps {\n /** The pattern paint being edited. */\n value: PatternFill;\n /** The color new tiles are seeded with — the paint's own, normally. */\n color: string;\n /** Committed value: one call per click. A tile pick and a size change are\n * each a complete gesture, so there is no `onInput`. */\n onChange: (next: PatternFill) => void;\n className?: string;\n}\n\n/**\n * Grid of tile swatches over a size switch, each swatch previewing the real\n * tile at the current color.\n *\n * The preview shares its shape mapper with what the renderer paints, so a\n * swatch cannot drift from the texture it selects.\n */\nexport function PatternPicker(props: PatternPickerProps): ReactElement {\n const { value, color, onChange, className } = props;\n const spec = specOf(value);\n const size = spec?.size ?? DEFAULT_TILE_SIZE;\n\n const pick = (tile: TilePatternSpec['tile']): void => {\n onChange(seedPattern(tile, color, size));\n };\n\n const resize = (nextSize: number): void => {\n if (!spec) return;\n onChange({ ...value, pattern: { ...spec, size: nextSize } });\n };\n\n return (\n <div className={[s.root, className].filter(Boolean).join(' ')}>\n <div className={s.grid}>\n {TILES.map((tile) => {\n const preview: TilePatternSpec = { tile, color, size: PREVIEW_SIZE };\n if (tile === 'chunks') preview.bg = '#00000000';\n const selected = spec?.tile === tile;\n return (\n <button\n key={tile}\n type=\"button\"\n className={[s.swatch, selected && s.swatchActive].filter(Boolean).join(' ')}\n style={{ ['--tile-preview' as string]: tilePreviewCssUrl(preview) } as CSSProperties}\n title={tile}\n aria-label={tile}\n aria-pressed={selected}\n onClick={() => pick(tile)}\n />\n );\n })}\n </div>\n <ToggleBar<number>\n items={TILE_SIZES}\n value={size}\n size=\"sm\"\n ariaLabel=\"Tile size\"\n onChange={(v) => v != null && resize(v)}\n />\n </div>\n );\n}\n"],"mappings":";;;;;;;;GCUM,IAA4C;CAAC;CAAS;CAAc;CAAQ;CAAS,EAIrF,IAA0D;CAC9D;EAAE,OAAO;EAAG,OAAO;EAAK;CACxB;EAAE,OAAO;EAAG,OAAO;EAAK;CACxB;EAAE,OAAO;EAAI,OAAO;EAAK;CACzB;EAAE,OAAO;EAAI,OAAO;EAAM;CAC3B,EAEK,IAAoB,GAGpB,IAAe;AAKrB,SAAS,EAAO,GAA2C;AACzD,QAAO,UAAU,EAAK,UAAU,EAAK,UAAU;;AAOjD,SAAgB,EACd,GACA,GACA,IAAe,GACF;CACb,IAAM,IAAwB;EAAE;EAAM,OAAO;EAAM;EAAM;AAIzD,QADI,MAAS,aAAU,EAAK,KAAK,cAC1B;EAAE,MAAM;EAAW,SAAS;EAAM,OAAO;EAAU;;AAsB5D,SAAgB,EAAc,GAAyC;CACrE,IAAM,EAAE,UAAO,UAAO,aAAU,iBAAc,GACxC,IAAO,EAAO,EAAM,EACpB,IAAO,GAAM,QAAQ,GAErB,KAAQ,MAAwC;AACpD,IAAS,EAAY,GAAM,GAAO,EAAK,CAAC;IAGpC,KAAU,MAA2B;AACpC,OACL,EAAS;GAAE,GAAG;GAAO,SAAS;IAAE,GAAG;IAAM,MAAM;IAAU;GAAE,CAAC;;AAG9D,QACE,kBAAC,OAAD;EAAK,WAAW,CAAC,EAAE,MAAM,EAAU,CAAC,OAAO,QAAQ,CAAC,KAAK,IAAI;YAA7D,CACE,kBAAC,OAAD;GAAK,WAAW,EAAE;aACf,EAAM,KAAK,MAAS;IACnB,IAAM,IAA2B;KAAE;KAAM;KAAO,MAAM;KAAc;AACpE,IAAI,MAAS,aAAU,EAAQ,KAAK;IACpC,IAAM,IAAW,GAAM,SAAS;AAChC,WACE,kBAAC,UAAD;KAEE,MAAK;KACL,WAAW,CAAC,EAAE,QAAQ,KAAY,EAAE,aAAa,CAAC,OAAO,QAAQ,CAAC,KAAK,IAAI;KAC3E,OAAO,EAAG,kBAA6B,EAAkB,EAAQ,EAAE;KACnE,OAAO;KACP,cAAY;KACZ,gBAAc;KACd,eAAe,EAAK,EAAK;KACzB,EARK,EAQL;KAEJ;GACE,CAAA,EACN,kBAAC,GAAD;GACE,OAAO;GACP,OAAO;GACP,MAAK;GACL,WAAU;GACV,WAAW,MAAM,KAAK,QAAQ,EAAO,EAAE;GACvC,CAAA,CACE"}
@@ -289,4 +289,4 @@ var w = r(function(r, p) {
289
289
  //#endregion
290
290
  export { h as a, f as c, _ as i, v as n, g as o, m as r, d as s, w as t };
291
291
 
292
- //# sourceMappingURL=Plot2D-CXf_f7QD.js.map
292
+ //# sourceMappingURL=Plot2D-lyO7waPQ.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Plot2D-CXf_f7QD.js","names":[],"sources":["../../src/components/Plot2D/geometry.ts","../../src/components/Plot2D/ticks.ts","../../src/components/Plot2D/Plot2D.module.css","../../src/components/Plot2D/Plot2D.tsx"],"sourcesContent":["/**\n * Coordinate transforms (model ↔ plot) for Plot2D. Pure / deterministic —\n * no DOM, no React, no state.\n *\n * Model space: caller-defined xRange × yRange. Y axis goes UP.\n * Plot space: 0..width × 0..height in CSS pixels. Y axis goes DOWN (SVG).\n */\n\nexport interface Point {\n x: number;\n y: number;\n}\n\n/**\n * The caller-defined extent of model space, the coordinate system a plot's\n * data lives in.\n */\nexport interface ModelRange {\n xMin: number;\n xMax: number;\n yMin: number;\n yMax: number;\n}\n\n/** The plot's drawing area in CSS pixels. */\nexport interface PlotSize {\n width: number;\n height: number;\n}\n\n/**\n * Maps a model-space point into plot space, flipping the y axis so model y\n * grows upward while SVG y grows downward.\n */\nexport function modelToPlot(p: Point, m: ModelRange, plot: PlotSize): Point {\n const xFrac = (p.x - m.xMin) / (m.xMax - m.xMin);\n const yFrac = (p.y - m.yMin) / (m.yMax - m.yMin);\n return {\n x: xFrac * plot.width,\n // Invert y so model y=0 sits at plot bottom (SVG y grows downward).\n y: (1 - yFrac) * plot.height,\n };\n}\n\n/** The inverse of {@link modelToPlot}. */\nexport function plotToModel(p: Point, m: ModelRange, plot: PlotSize): Point {\n const xFrac = p.x / plot.width;\n const yFrac = 1 - p.y / plot.height;\n return {\n x: m.xMin + xFrac * (m.xMax - m.xMin),\n y: m.yMin + yFrac * (m.yMax - m.yMin),\n };\n}\n","/**\n * Tick placement for a numeric axis. Pure — no DOM, no React.\n */\n\n/** What a tick label formatter knows about the column it is part of. */\nexport interface TickFormatCtx {\n /** Places after the point that every label in the column shares. */\n decimals: number;\n /** Distance between neighboring ticks, or 0 when the ticks were given\n * explicitly and are not evenly spaced. */\n step: number;\n}\n\n/** Turns a tick value into its label. */\nexport type TickFormatter = (value: number, ctx: TickFormatCtx) => string;\n\n/** A column of ticks and the facts its labels share. */\nexport interface TickSet {\n values: number[];\n step: number;\n decimals: number;\n}\n\n/** Options for {@link niceTicks}. */\nexport interface NiceTickOptions {\n /** Smallest gap between neighboring ticks, in px. */\n minSpacing: number;\n /** Ticks closer than this to either end of the axis are dropped, in px.\n * Default 0. */\n inset?: number;\n}\n\nconst MAX_DECIMALS = 20;\n\n/** The smallest of 1, 2 or 5 times a power of ten that is at least `rough`. */\nexport function niceStep(rough: number): number {\n const mag = Math.pow(10, Math.floor(Math.log10(rough)));\n const norm = rough / mag;\n const step = norm <= 1 ? 1 : norm <= 2 ? 2 : norm <= 5 ? 5 : 10;\n return step * mag;\n}\n\n/** Places after the point a multiple of `step` needs, for a 1/2/5 step. */\nexport function stepDecimals(step: number): number {\n if (!(step > 0) || !Number.isFinite(step)) return 0;\n return Math.min(MAX_DECIMALS, Math.max(0, -Math.floor(Math.log10(step) + 1e-9)));\n}\n\n/** The most places after the point any of `values` needs. */\nexport function tickDecimals(values: readonly number[]): number {\n let most = 0;\n for (const v of values) {\n if (!Number.isFinite(v)) continue;\n let d = 0;\n while (d < MAX_DECIMALS && Math.abs(Number(v.toFixed(d)) - v) > 1e-9 * Math.max(1, Math.abs(v))) d++;\n most = Math.max(most, d);\n }\n return most;\n}\n\n/**\n * Ticks at round values across `range`, drawn `pixels` long: the finest\n * 1/2/5 step that keeps neighbors `minSpacing` px apart, so a taller plot\n * gets more of them.\n */\nexport function niceTicks(\n range: readonly [number, number],\n pixels: number,\n options: NiceTickOptions,\n): TickSet {\n const none: TickSet = { values: [], step: 0, decimals: 0 };\n const lo = Math.min(range[0], range[1]);\n const hi = Math.max(range[0], range[1]);\n const span = hi - lo;\n const { minSpacing, inset = 0 } = options;\n if (!(span > 0) || !Number.isFinite(span) || !(pixels > 0) || !(minSpacing > 0)) return none;\n\n const unitsPerPx = span / pixels;\n const step = niceStep(minSpacing * unitsPerPx);\n const decimals = stepDecimals(step);\n const from = lo + inset * unitsPerPx;\n const to = hi - inset * unitsPerPx;\n // A tolerance in step units, so a tick sitting exactly on a bound survives\n // the float error in `from / step`.\n const first = Math.ceil(from / step - 1e-9);\n const last = Math.floor(to / step + 1e-9);\n const values: number[] = [];\n for (let i = first; i <= last; i++) values.push(Number((i * step).toFixed(decimals)) + 0);\n return { values, step, decimals };\n}\n\n/** The default label: `value` fixed to the column's shared decimals, with\n * no negative zero. */\nexport function formatTick(value: number, ctx: TickFormatCtx): string {\n const text = value.toFixed(ctx.decimals);\n return /^-0(\\.0*)?$/.test(text) ? text.slice(1) : text;\n}\n",".root {\n /* Component-local vars layered over theme tokens. Consumers override\n * either the plot-* var (component scope) or the wzl-* token (app\n * scope). */\n --plot-bg: var(--wzl-surface-sunken);\n --plot-grid: var(--wzl-line);\n /* Axes get full foreground contrast — they're the plot frame, the\n * most prominent structural element after caller-rendered content. */\n --plot-axis: var(--wzl-fg);\n --plot-tick: var(--wzl-line-subtle);\n --plot-tick-label: var(--wzl-fg-muted);\n /* Knocks the tick line out from behind an inside label. */\n --plot-tick-label-halo: var(--plot-bg);\n\n display: block;\n /* Caller-rendered marks at the very edge (e.g. CurveEditor anchors)\n * extend past the SVG box by their radius — let them paint over the\n * host page instead of being half-clipped. */\n overflow: visible;\n background: var(--plot-bg);\n user-select: none;\n touch-action: none;\n outline: none;\n}\n\n/* Keyboard-only focus ring. Caller opts in via `tabIndex`. */\n.root:focus-visible {\n outline: 2px solid var(--wzl-focus-ring);\n outline-offset: 2px;\n}\n\n.grid {\n stroke: var(--plot-grid);\n stroke-width: 1;\n fill: none;\n}\n\n.axis {\n stroke: var(--plot-axis);\n stroke-width: var(--wzl-line-width);\n fill: none;\n}\n\n.tick {\n stroke: var(--plot-tick);\n stroke-width: 1;\n fill: none;\n}\n\n.tickLabels { pointer-events: none; }\n\n.tickLabel {\n fill: var(--plot-tick-label);\n font-size: var(--wzl-font-size-xs);\n font-variant-numeric: tabular-nums;\n}\n\n.tickLabel[data-placement='inside'] {\n stroke: var(--plot-tick-label-halo);\n stroke-width: 3px;\n stroke-linejoin: round;\n paint-order: stroke;\n}\n","import {\n forwardRef, useCallback, useEffect, useImperativeHandle, useLayoutEffect, useMemo, useRef, useState,\n type CSSProperties,\n type KeyboardEvent as ReactKeyboardEvent,\n type PointerEvent as ReactPointerEvent,\n type ReactNode,\n} from 'react';\nimport {\n modelToPlot, plotToModel,\n type ModelRange, type Point,\n} from './geometry';\nimport {\n formatTick, niceTicks, tickDecimals,\n type TickFormatCtx, type TickFormatter,\n} from './ticks';\nimport s from './Plot2D.module.css';\nimport { dlog } from '../../dlog';\n\n/** Background grid configuration for a {@link Plot2D}. */\nexport interface GridSettings {\n /** Number of evenly-spaced internal grid lines per axis (excluding\n * the edges). Applied to both x and y. Default 3. */\n divisions?: number;\n /** Stroke color override. When omitted, uses `var(--plot-grid)`. */\n color?: string;\n}\n\n/** Axis-line configuration for a {@link Plot2D}. */\nexport interface AxesSettings {\n /** Stroke color override. When omitted, uses `var(--plot-axis)`. */\n color?: string;\n}\n\n/**\n * Ticks along one axis of a {@link Plot2D}: a line across the plot at each\n * tick value, and a label naming it. Every label in a column is formatted\n * to the same number of decimal places.\n */\nexport interface TickSettings {\n /** Tick values in model space; any outside the range are skipped.\n * Omitted = round 1/2/5 steps, as many as `minSpacing` allows at the\n * plot's current size. */\n values?: readonly number[];\n /** Smallest gap between generated ticks, in px. Default 24 on y, 64 on x. */\n minSpacing?: number;\n /** A generated tick nearer either end of the axis than this is dropped,\n * so its label stays on the plot, in px. Default 4 on y, 16 on x. */\n inset?: number;\n /** Draw a line across the plot at each tick. Default true. */\n lines?: boolean;\n /** Where labels sit: `'inside'` the plot along its left (y) or bottom (x)\n * edge, `'outside'` it past that edge in space the caller leaves free,\n * or `false` for none. Default `'inside'`. */\n labels?: 'inside' | 'outside' | false;\n /** Space between a label and the plot edge it sits against, in px.\n * Default 4. */\n gap?: number;\n /** Label text for a tick. Default {@link formatTick}. */\n format?: TickFormatter;\n}\n\n/** A pointer position given in both of the plot's coordinate systems. */\nexport interface Plot2DCoords {\n plot: Point;\n model: Point;\n}\n\n/** Props for {@link Plot2D}. */\nexport interface Plot2DProps {\n width: number;\n height: number;\n /** Model-space x range. Default [0, 1]. */\n xRange?: readonly [number, number];\n /** Model-space y range. Default [0, 1]. */\n yRange?: readonly [number, number];\n /** Background grid. `false` / `null` / omitted = no grid. Pass `{}`\n * for default (3 divisions per axis) or populated GridSettings. */\n grid?: GridSettings | false | null;\n /** Axis lines. `false` / `null` = no axes. Omitted = default-styled\n * axes (on). Pass AxesSettings to customize. */\n axes?: AxesSettings | false | null;\n /** Ticks at x values. `false` / `null` / omitted = none; `{}` = defaults. */\n xTicks?: TickSettings | false | null;\n /** Ticks at y values. `false` / `null` / omitted = none; `{}` = defaults. */\n yTicks?: TickSettings | false | null;\n /** Forwarded to the underlying svg. Consumer opts into focus this way. */\n tabIndex?: number;\n /** Default `'img'`. A plot holding focusable marks must not be an image,\n * whose children are presentational to assistive technology. */\n role?: string;\n 'aria-label'?: string;\n className?: string;\n style?: CSSProperties;\n /** Pointer down on the SVG. Receives both plot- and model-space coords\n * pre-computed so consumers don't repeat the rect/transform dance. */\n onPointerDown?: (e: ReactPointerEvent<SVGSVGElement>, coords: Plot2DCoords) => void;\n onKeyDown?: (e: ReactKeyboardEvent<SVGSVGElement>) => void;\n children?: ReactNode;\n}\n\n/**\n * Imperative handle on a {@link Plot2D}: the SVG element, its size, and the\n * coordinate conversions, including ones that start from a raw DOM event so a\n * drag tracked on `window` can still map back into the plot.\n */\nexport interface Plot2DHandle {\n readonly svg: SVGSVGElement | null;\n plotToModel(pt: Point): Point;\n modelToPlot(pt: Point): Point;\n /** Convert a DOM event's clientX/clientY (e.g. from a window-attached\n * pointermove during drag) to plot-space. */\n clientToPlot(e: { clientX: number; clientY: number }): Point;\n /** Convenience: clientToPlot → plotToModel. */\n clientToModel(e: { clientX: number; clientY: number }): Point;\n readonly width: number;\n readonly height: number;\n}\n\ntype Axis = 'x' | 'y';\n\nconst TICK_SPACING_PX: Record<Axis, number> = { x: 64, y: 24 };\nconst TICK_INSET_PX: Record<Axis, number> = { x: 16, y: 4 };\nconst LABEL_GAP_PX = 4;\n\ninterface ResolvedTick {\n value: number;\n /** Plot-space position along the axis. */\n at: number;\n label: string;\n}\n\nfunction resolveTicks(\n settings: TickSettings,\n axis: Axis,\n range: readonly [number, number],\n pixels: number,\n toPlot: (v: number) => number,\n): ResolvedTick[] {\n let values: number[];\n let ctx: TickFormatCtx;\n if (settings.values) {\n const lo = Math.min(range[0], range[1]);\n const hi = Math.max(range[0], range[1]);\n const eps = (hi - lo) * 1e-9;\n values = settings.values.filter((v) => v >= lo - eps && v <= hi + eps);\n const gaps = values.slice(1).map((v, i) => v - values[i]);\n const even = gaps.length > 0 && gaps.every((g) => Math.abs(g - gaps[0]) <= Math.abs(gaps[0]) * 1e-9);\n ctx = { decimals: tickDecimals(values), step: even ? gaps[0] : 0 };\n } else {\n const set = niceTicks(range, pixels, {\n minSpacing: settings.minSpacing ?? TICK_SPACING_PX[axis],\n inset: settings.inset ?? TICK_INSET_PX[axis],\n });\n values = set.values;\n ctx = { decimals: set.decimals, step: set.step };\n }\n const format = settings.format ?? formatTick;\n return values.map((value) => ({ value, at: toPlot(value), label: format(value, ctx) }));\n}\n\n/**\n * An SVG plotting surface with an optional grid, axes and ticks. It draws the\n * frame and owns the model-space to plot-space mapping; the plotted content is\n * whatever children are passed, positioned in plot space.\n */\nexport const Plot2D = forwardRef<Plot2DHandle, Plot2DProps>(function Plot2D(props, ref) {\n const {\n width, height,\n xRange = [0, 1],\n yRange = [0, 1],\n grid,\n axes,\n xTicks,\n yTicks,\n tabIndex,\n role = 'img',\n className,\n style,\n onPointerDown,\n onKeyDown,\n children,\n } = props;\n\n const svgRef = useRef<SVGSVGElement | null>(null);\n\n const modelRange: ModelRange = useMemo(\n () => ({ xMin: xRange[0], xMax: xRange[1], yMin: yRange[0], yMax: yRange[1] }),\n [xRange, yRange],\n );\n\n const plotSize = useMemo(() => ({ width, height }), [width, height]);\n\n const clientToPlot = useCallback((e: { clientX: number; clientY: number }): Point => {\n const rect = svgRef.current?.getBoundingClientRect();\n const left = rect?.left ?? 0;\n const top = rect?.top ?? 0;\n return { x: e.clientX - left, y: e.clientY - top };\n }, []);\n\n useEffect(() => {\n dlog('plot2d', 'mount', { width, height });\n return () => dlog('plot2d', 'unmount');\n // Mount/unmount trace: re-running on a resize would log a spurious mount.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n useImperativeHandle(ref, () => ({\n get svg() { return svgRef.current; },\n plotToModel: (pt: Point) => plotToModel(pt, modelRange, plotSize),\n modelToPlot: (pt: Point) => modelToPlot(pt, modelRange, plotSize),\n clientToPlot,\n clientToModel: (e) => plotToModel(clientToPlot(e), modelRange, plotSize),\n get width() { return plotSize.width; },\n get height() { return plotSize.height; },\n }), [modelRange, plotSize, clientToPlot]);\n\n const handlePointerDown = useCallback((e: ReactPointerEvent<SVGSVGElement>) => {\n if (!onPointerDown) return;\n const plot = clientToPlot(e);\n const model = plotToModel(plot, modelRange, plotSize);\n onPointerDown(e, { plot, model });\n }, [onPointerDown, clientToPlot, modelRange, plotSize]);\n\n const xTickList = xTicks\n ? resolveTicks(xTicks, 'x', xRange, width, (v) => modelToPlot({ x: v, y: yRange[0] }, modelRange, plotSize).x)\n : [];\n const yTickList = yTicks\n ? resolveTicks(yTicks, 'y', yRange, height, (v) => modelToPlot({ x: xRange[0], y: v }, modelRange, plotSize).y)\n : [];\n\n // An inside y column is right-aligned against its widest label, which only\n // the rendered text can say.\n const yInside = !!yTicks && (yTicks.labels ?? 'inside') === 'inside';\n const yLabelsRef = useRef<SVGGElement | null>(null);\n const [yLabelWidth, setYLabelWidth] = useState(0);\n const yLabelKey = yInside ? yTickList.map((t) => t.label).join('\\n') : '';\n useLayoutEffect(() => {\n if (!yInside) return;\n const measure = (): void => {\n let widest = 0;\n for (const el of yLabelsRef.current?.querySelectorAll('text') ?? []) {\n if (typeof el.getComputedTextLength === 'function') widest = Math.max(widest, el.getComputedTextLength());\n }\n setYLabelWidth((prev) => (prev === widest ? prev : widest));\n };\n measure();\n let live = true;\n // A web font landing after the first measure changes every width.\n document.fonts?.ready.then(() => { if (live) measure(); });\n return () => { live = false; };\n }, [yInside, yLabelKey]);\n\n const cls = [s.root, className].filter(Boolean).join(' ');\n\n const renderTickLines = (axis: Axis, list: ResolvedTick[], settings: TickSettings | false | null | undefined) => {\n if (!settings || settings.lines === false || list.length === 0) return null;\n return (\n <g>\n {list.map((t) => (\n <line\n key={`t${axis}-${t.value}`}\n data-plot-element=\"tick\"\n data-axis={axis}\n className={s.tick}\n {...(axis === 'x'\n ? { x1: t.at, x2: t.at, y1: 0, y2: height }\n : { x1: 0, x2: width, y1: t.at, y2: t.at })}\n />\n ))}\n </g>\n );\n };\n\n const renderTickLabels = (axis: Axis, list: ResolvedTick[], settings: TickSettings | false | null | undefined) => {\n if (!settings || list.length === 0) return null;\n const placement = settings.labels ?? 'inside';\n if (placement === false) return null;\n const outside = placement === 'outside';\n const gap = settings.gap ?? LABEL_GAP_PX;\n let place: { x?: number; y?: number; textAnchor: 'start' | 'middle' | 'end'; dominantBaseline?: 'central' | 'hanging' };\n if (axis === 'y') {\n place = outside\n ? { x: -gap, textAnchor: 'end', dominantBaseline: 'central' }\n : yLabelWidth > 0\n ? { x: gap + yLabelWidth, textAnchor: 'end', dominantBaseline: 'central' }\n : { x: gap, textAnchor: 'start', dominantBaseline: 'central' };\n } else {\n place = outside\n ? { y: height + gap, textAnchor: 'middle', dominantBaseline: 'hanging' }\n : { y: height - gap, textAnchor: 'middle' };\n }\n return (\n <g ref={axis === 'y' ? yLabelsRef : undefined} className={s.tickLabels} aria-hidden=\"true\">\n {list.map((t) => (\n <text\n key={`l${axis}-${t.value}`}\n data-plot-element=\"tick-label\"\n data-axis={axis}\n data-placement={placement}\n className={s.tickLabel}\n x={axis === 'x' ? t.at : place.x}\n y={axis === 'y' ? t.at : place.y}\n textAnchor={place.textAnchor}\n dominantBaseline={place.dominantBaseline}\n >\n {t.label}\n </text>\n ))}\n </g>\n );\n };\n\n return (\n <svg\n ref={svgRef}\n className={cls}\n style={style}\n width={width}\n height={height}\n viewBox={`0 0 ${width} ${height}`}\n role={role}\n aria-label={props['aria-label']}\n tabIndex={tabIndex}\n onPointerDown={onPointerDown ? handlePointerDown : undefined}\n onKeyDown={onKeyDown}\n >\n {grid && (() => {\n const divisions = grid.divisions ?? 3;\n const stroke = grid.color;\n // Evenly-spaced internal divisions, excluding the edges (which\n // belong to the axes). For divisions=3, fractions are 1/4, 2/4, 3/4.\n const fractions: number[] = [];\n for (let i = 1; i <= divisions; i++) fractions.push(i / (divisions + 1));\n return (\n <g>\n {fractions.map((f) => (\n <line\n key={`gx-${f}`}\n data-plot-element=\"grid\"\n className={s.grid}\n stroke={stroke}\n x1={f * width} x2={f * width}\n y1={0} y2={height}\n />\n ))}\n {fractions.map((f) => (\n <line\n key={`gy-${f}`}\n data-plot-element=\"grid\"\n className={s.grid}\n stroke={stroke}\n x1={0} x2={width}\n y1={f * height} y2={f * height}\n />\n ))}\n </g>\n );\n })()}\n {renderTickLines('x', xTickList, xTicks)}\n {renderTickLines('y', yTickList, yTicks)}\n {axes !== false && axes !== null && (() => {\n const stroke = axes?.color;\n return (\n <g>\n <line\n data-plot-element=\"axis\"\n className={s.axis}\n stroke={stroke}\n x1={0} x2={width}\n y1={height} y2={height}\n />\n <line\n data-plot-element=\"axis\"\n className={s.axis}\n stroke={stroke}\n x1={0} x2={0}\n y1={0} y2={height}\n />\n </g>\n );\n })()}\n {renderTickLabels('x', xTickList, xTicks)}\n {renderTickLabels('y', yTickList, yTicks)}\n {children}\n </svg>\n );\n});\n"],"mappings":";;;;AAkCA,SAAgB,EAAY,GAAU,GAAe,GAAuB;CAC1E,IAAM,KAAS,EAAE,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,OACrC,KAAS,EAAE,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE;AAC3C,QAAO;EACL,GAAG,IAAQ,EAAK;EAEhB,IAAI,IAAI,KAAS,EAAK;EACvB;;AAIH,SAAgB,EAAY,GAAU,GAAe,GAAuB;CAC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EAAO;GACxC,EAAiB,KAAK,GAAW,EAAO;GACxC;GACG;;EAER"}
1
+ {"version":3,"file":"Plot2D-lyO7waPQ.js","names":[],"sources":["../../src/components/Plot2D/geometry.ts","../../src/components/Plot2D/ticks.ts","../../src/components/Plot2D/Plot2D.module.css","../../src/components/Plot2D/Plot2D.tsx"],"sourcesContent":["/**\n * Coordinate transforms (model ↔ plot) for Plot2D. Pure / deterministic —\n * no DOM, no React, no state.\n *\n * Model space: caller-defined xRange × yRange. Y axis goes UP.\n * Plot space: 0..width × 0..height in CSS pixels. Y axis goes DOWN (SVG).\n */\n\nexport interface Point {\n x: number;\n y: number;\n}\n\n/**\n * The caller-defined extent of model space, the coordinate system a plot's\n * data lives in.\n */\nexport interface ModelRange {\n xMin: number;\n xMax: number;\n yMin: number;\n yMax: number;\n}\n\n/** The plot's drawing area in CSS pixels. */\nexport interface PlotSize {\n width: number;\n height: number;\n}\n\n/**\n * Maps a model-space point into plot space, flipping the y axis so model y\n * grows upward while SVG y grows downward.\n */\nexport function modelToPlot(p: Point, m: ModelRange, plot: PlotSize): Point {\n const xFrac = (p.x - m.xMin) / (m.xMax - m.xMin);\n const yFrac = (p.y - m.yMin) / (m.yMax - m.yMin);\n return {\n x: xFrac * plot.width,\n // Invert y so model y=0 sits at plot bottom (SVG y grows downward).\n y: (1 - yFrac) * plot.height,\n };\n}\n\n/** The inverse of {@link modelToPlot}. */\nexport function plotToModel(p: Point, m: ModelRange, plot: PlotSize): Point {\n const xFrac = p.x / plot.width;\n const yFrac = 1 - p.y / plot.height;\n return {\n x: m.xMin + xFrac * (m.xMax - m.xMin),\n y: m.yMin + yFrac * (m.yMax - m.yMin),\n };\n}\n","/**\n * Tick placement for a numeric axis. Pure — no DOM, no React.\n */\n\n/** What a tick label formatter knows about the column it is part of. */\nexport interface TickFormatCtx {\n /** Places after the point that every label in the column shares. */\n decimals: number;\n /** Distance between neighboring ticks, or 0 when the ticks were given\n * explicitly and are not evenly spaced. */\n step: number;\n}\n\n/** Turns a tick value into its label. */\nexport type TickFormatter = (value: number, ctx: TickFormatCtx) => string;\n\n/** A column of ticks and the facts its labels share. */\nexport interface TickSet {\n values: number[];\n step: number;\n decimals: number;\n}\n\n/** Options for {@link niceTicks}. */\nexport interface NiceTickOptions {\n /** Smallest gap between neighboring ticks, in px. */\n minSpacing: number;\n /** Ticks closer than this to either end of the axis are dropped, in px.\n * Default 0. */\n inset?: number;\n}\n\nconst MAX_DECIMALS = 20;\n\n/** The smallest of 1, 2 or 5 times a power of ten that is at least `rough`. */\nexport function niceStep(rough: number): number {\n const mag = Math.pow(10, Math.floor(Math.log10(rough)));\n const norm = rough / mag;\n const step = norm <= 1 ? 1 : norm <= 2 ? 2 : norm <= 5 ? 5 : 10;\n return step * mag;\n}\n\n/** Places after the point a multiple of `step` needs, for a 1/2/5 step. */\nexport function stepDecimals(step: number): number {\n if (!(step > 0) || !Number.isFinite(step)) return 0;\n return Math.min(MAX_DECIMALS, Math.max(0, -Math.floor(Math.log10(step) + 1e-9)));\n}\n\n/** The most places after the point any of `values` needs. */\nexport function tickDecimals(values: readonly number[]): number {\n let most = 0;\n for (const v of values) {\n if (!Number.isFinite(v)) continue;\n let d = 0;\n while (d < MAX_DECIMALS && Math.abs(Number(v.toFixed(d)) - v) > 1e-9 * Math.max(1, Math.abs(v))) d++;\n most = Math.max(most, d);\n }\n return most;\n}\n\n/**\n * Ticks at round values across `range`, drawn `pixels` long: the finest\n * 1/2/5 step that keeps neighbors `minSpacing` px apart, so a taller plot\n * gets more of them.\n */\nexport function niceTicks(\n range: readonly [number, number],\n pixels: number,\n options: NiceTickOptions,\n): TickSet {\n const none: TickSet = { values: [], step: 0, decimals: 0 };\n const lo = Math.min(range[0], range[1]);\n const hi = Math.max(range[0], range[1]);\n const span = hi - lo;\n const { minSpacing, inset = 0 } = options;\n if (!(span > 0) || !Number.isFinite(span) || !(pixels > 0) || !(minSpacing > 0)) return none;\n\n const unitsPerPx = span / pixels;\n const step = niceStep(minSpacing * unitsPerPx);\n const decimals = stepDecimals(step);\n const from = lo + inset * unitsPerPx;\n const to = hi - inset * unitsPerPx;\n // A tolerance in step units, so a tick sitting exactly on a bound survives\n // the float error in `from / step`.\n const first = Math.ceil(from / step - 1e-9);\n const last = Math.floor(to / step + 1e-9);\n const values: number[] = [];\n for (let i = first; i <= last; i++) values.push(Number((i * step).toFixed(decimals)) + 0);\n return { values, step, decimals };\n}\n\n/** The default label: `value` fixed to the column's shared decimals, with\n * no negative zero. */\nexport function formatTick(value: number, ctx: TickFormatCtx): string {\n const text = value.toFixed(ctx.decimals);\n return /^-0(\\.0*)?$/.test(text) ? text.slice(1) : text;\n}\n",".root {\n /* Component-local vars layered over theme tokens. Consumers override\n * either the plot-* var (component scope) or the wzl-* token (app\n * scope). */\n --plot-bg: var(--wzl-surface-sunken);\n --plot-grid: var(--wzl-line);\n /* Axes get full foreground contrast — they're the plot frame, the\n * most prominent structural element after caller-rendered content. */\n --plot-axis: var(--wzl-fg);\n --plot-tick: var(--wzl-line-subtle);\n --plot-tick-label: var(--wzl-fg-muted);\n /* Knocks the tick line out from behind an inside label. */\n --plot-tick-label-halo: var(--plot-bg);\n\n display: block;\n /* Caller-rendered marks at the very edge (e.g. CurveEditor anchors)\n * extend past the SVG box by their radius — let them paint over the\n * host page instead of being half-clipped. */\n overflow: visible;\n background: var(--plot-bg);\n user-select: none;\n touch-action: none;\n outline: none;\n}\n\n/* Keyboard-only focus ring. Caller opts in via `tabIndex`. */\n.root:focus-visible {\n outline: 2px solid var(--wzl-focus-ring);\n outline-offset: 2px;\n}\n\n.grid {\n stroke: var(--plot-grid);\n stroke-width: 1;\n fill: none;\n}\n\n.axis {\n stroke: var(--plot-axis);\n stroke-width: var(--wzl-line-width);\n fill: none;\n}\n\n.tick {\n stroke: var(--plot-tick);\n stroke-width: 1;\n fill: none;\n}\n\n.tickLabels { pointer-events: none; }\n\n.tickLabel {\n fill: var(--plot-tick-label);\n font-size: var(--wzl-font-size-xs);\n font-variant-numeric: tabular-nums;\n}\n\n.tickLabel[data-placement='inside'] {\n stroke: var(--plot-tick-label-halo);\n stroke-width: 3px;\n stroke-linejoin: round;\n paint-order: stroke;\n}\n","import {\n forwardRef, useCallback, useEffect, useImperativeHandle, useLayoutEffect, useMemo, useRef, useState,\n type CSSProperties,\n type KeyboardEvent as ReactKeyboardEvent,\n type PointerEvent as ReactPointerEvent,\n type ReactNode,\n} from 'react';\nimport {\n modelToPlot, plotToModel,\n type ModelRange, type Point,\n} from './geometry';\nimport {\n formatTick, niceTicks, tickDecimals,\n type TickFormatCtx, type TickFormatter,\n} from './ticks';\nimport s from './Plot2D.module.css';\nimport { dlog } from '../../dlog';\n\n/** Background grid configuration for a {@link Plot2D}. */\nexport interface GridSettings {\n /** Number of evenly-spaced internal grid lines per axis (excluding\n * the edges). Applied to both x and y. Default 3. */\n divisions?: number;\n /** Stroke color override. When omitted, uses `var(--plot-grid)`. */\n color?: string;\n}\n\n/** Axis-line configuration for a {@link Plot2D}. */\nexport interface AxesSettings {\n /** Stroke color override. When omitted, uses `var(--plot-axis)`. */\n color?: string;\n}\n\n/**\n * Ticks along one axis of a {@link Plot2D}: a line across the plot at each\n * tick value, and a label naming it. Every label in a column is formatted\n * to the same number of decimal places.\n */\nexport interface TickSettings {\n /** Tick values in model space; any outside the range are skipped.\n * Omitted = round 1/2/5 steps, as many as `minSpacing` allows at the\n * plot's current size. */\n values?: readonly number[];\n /** Smallest gap between generated ticks, in px. Default 24 on y, 64 on x. */\n minSpacing?: number;\n /** A generated tick nearer either end of the axis than this is dropped,\n * so its label stays on the plot, in px. Default 4 on y, 16 on x. */\n inset?: number;\n /** Draw a line across the plot at each tick. Default true. */\n lines?: boolean;\n /** Where labels sit: `'inside'` the plot along its left (y) or bottom (x)\n * edge, `'outside'` it past that edge in space the caller leaves free,\n * or `false` for none. Default `'inside'`. */\n labels?: 'inside' | 'outside' | false;\n /** Space between a label and the plot edge it sits against, in px.\n * Default 4. */\n gap?: number;\n /** Label text for a tick. Default {@link formatTick}. */\n format?: TickFormatter;\n}\n\n/** A pointer position given in both of the plot's coordinate systems. */\nexport interface Plot2DCoords {\n plot: Point;\n model: Point;\n}\n\n/** Props for {@link Plot2D}. */\nexport interface Plot2DProps {\n width: number;\n height: number;\n /** Model-space x range. Default [0, 1]. */\n xRange?: readonly [number, number];\n /** Model-space y range. Default [0, 1]. */\n yRange?: readonly [number, number];\n /** Background grid. `false` / `null` / omitted = no grid. Pass `{}`\n * for default (3 divisions per axis) or populated GridSettings. */\n grid?: GridSettings | false | null;\n /** Axis lines. `false` / `null` = no axes. Omitted = default-styled\n * axes (on). Pass AxesSettings to customize. */\n axes?: AxesSettings | false | null;\n /** Ticks at x values. `false` / `null` / omitted = none; `{}` = defaults. */\n xTicks?: TickSettings | false | null;\n /** Ticks at y values. `false` / `null` / omitted = none; `{}` = defaults. */\n yTicks?: TickSettings | false | null;\n /** Forwarded to the underlying svg. Consumer opts into focus this way. */\n tabIndex?: number;\n /** Default `'img'`. A plot holding focusable marks must not be an image,\n * whose children are presentational to assistive technology. */\n role?: string;\n 'aria-label'?: string;\n className?: string;\n style?: CSSProperties;\n /** Pointer down on the SVG. Receives both plot- and model-space coords\n * pre-computed so consumers don't repeat the rect/transform dance. */\n onPointerDown?: (e: ReactPointerEvent<SVGSVGElement>, coords: Plot2DCoords) => void;\n onKeyDown?: (e: ReactKeyboardEvent<SVGSVGElement>) => void;\n children?: ReactNode;\n}\n\n/**\n * Imperative handle on a {@link Plot2D}: the SVG element, its size, and the\n * coordinate conversions, including ones that start from a raw DOM event so a\n * drag tracked on `window` can still map back into the plot.\n */\nexport interface Plot2DHandle {\n readonly svg: SVGSVGElement | null;\n plotToModel(pt: Point): Point;\n modelToPlot(pt: Point): Point;\n /** Convert a DOM event's clientX/clientY (e.g. from a window-attached\n * pointermove during drag) to plot-space. */\n clientToPlot(e: { clientX: number; clientY: number }): Point;\n /** Convenience: clientToPlot → plotToModel. */\n clientToModel(e: { clientX: number; clientY: number }): Point;\n readonly width: number;\n readonly height: number;\n}\n\ntype Axis = 'x' | 'y';\n\nconst TICK_SPACING_PX: Record<Axis, number> = { x: 64, y: 24 };\nconst TICK_INSET_PX: Record<Axis, number> = { x: 16, y: 4 };\nconst LABEL_GAP_PX = 4;\n\ninterface ResolvedTick {\n value: number;\n /** Plot-space position along the axis. */\n at: number;\n label: string;\n}\n\nfunction resolveTicks(\n settings: TickSettings,\n axis: Axis,\n range: readonly [number, number],\n pixels: number,\n toPlot: (v: number) => number,\n): ResolvedTick[] {\n let values: number[];\n let ctx: TickFormatCtx;\n if (settings.values) {\n const lo = Math.min(range[0], range[1]);\n const hi = Math.max(range[0], range[1]);\n const eps = (hi - lo) * 1e-9;\n values = settings.values.filter((v) => v >= lo - eps && v <= hi + eps);\n const gaps = values.slice(1).map((v, i) => v - values[i]);\n const even = gaps.length > 0 && gaps.every((g) => Math.abs(g - gaps[0]) <= Math.abs(gaps[0]) * 1e-9);\n ctx = { decimals: tickDecimals(values), step: even ? gaps[0] : 0 };\n } else {\n const set = niceTicks(range, pixels, {\n minSpacing: settings.minSpacing ?? TICK_SPACING_PX[axis],\n inset: settings.inset ?? TICK_INSET_PX[axis],\n });\n values = set.values;\n ctx = { decimals: set.decimals, step: set.step };\n }\n const format = settings.format ?? formatTick;\n return values.map((value) => ({ value, at: toPlot(value), label: format(value, ctx) }));\n}\n\n/**\n * An SVG plotting surface with an optional grid, axes and ticks. It draws the\n * frame and owns the model-space to plot-space mapping; the plotted content is\n * whatever children are passed, positioned in plot space.\n */\nexport const Plot2D = forwardRef<Plot2DHandle, Plot2DProps>(function Plot2D(props, ref) {\n const {\n width, height,\n xRange = [0, 1],\n yRange = [0, 1],\n grid,\n axes,\n xTicks,\n yTicks,\n tabIndex,\n role = 'img',\n className,\n style,\n onPointerDown,\n onKeyDown,\n children,\n } = props;\n\n const svgRef = useRef<SVGSVGElement | null>(null);\n\n const modelRange: ModelRange = useMemo(\n () => ({ xMin: xRange[0], xMax: xRange[1], yMin: yRange[0], yMax: yRange[1] }),\n [xRange, yRange],\n );\n\n const plotSize = useMemo(() => ({ width, height }), [width, height]);\n\n const clientToPlot = useCallback((e: { clientX: number; clientY: number }): Point => {\n const rect = svgRef.current?.getBoundingClientRect();\n const left = rect?.left ?? 0;\n const top = rect?.top ?? 0;\n return { x: e.clientX - left, y: e.clientY - top };\n }, []);\n\n useEffect(() => {\n dlog('plot2d', 'mount', { width, height });\n return () => dlog('plot2d', 'unmount');\n // Mount/unmount trace: re-running on a resize would log a spurious mount.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n useImperativeHandle(ref, () => ({\n get svg() { return svgRef.current; },\n plotToModel: (pt: Point) => plotToModel(pt, modelRange, plotSize),\n modelToPlot: (pt: Point) => modelToPlot(pt, modelRange, plotSize),\n clientToPlot,\n clientToModel: (e) => plotToModel(clientToPlot(e), modelRange, plotSize),\n get width() { return plotSize.width; },\n get height() { return plotSize.height; },\n }), [modelRange, plotSize, clientToPlot]);\n\n const handlePointerDown = useCallback((e: ReactPointerEvent<SVGSVGElement>) => {\n if (!onPointerDown) return;\n const plot = clientToPlot(e);\n const model = plotToModel(plot, modelRange, plotSize);\n onPointerDown(e, { plot, model });\n }, [onPointerDown, clientToPlot, modelRange, plotSize]);\n\n const xTickList = xTicks\n ? resolveTicks(xTicks, 'x', xRange, width, (v) => modelToPlot({ x: v, y: yRange[0] }, modelRange, plotSize).x)\n : [];\n const yTickList = yTicks\n ? resolveTicks(yTicks, 'y', yRange, height, (v) => modelToPlot({ x: xRange[0], y: v }, modelRange, plotSize).y)\n : [];\n\n // An inside y column is right-aligned against its widest label, which only\n // the rendered text can say.\n const yInside = !!yTicks && (yTicks.labels ?? 'inside') === 'inside';\n const yLabelsRef = useRef<SVGGElement | null>(null);\n const [yLabelWidth, setYLabelWidth] = useState(0);\n const yLabelKey = yInside ? yTickList.map((t) => t.label).join('\\n') : '';\n useLayoutEffect(() => {\n if (!yInside) return;\n const measure = (): void => {\n let widest = 0;\n for (const el of yLabelsRef.current?.querySelectorAll('text') ?? []) {\n if (typeof el.getComputedTextLength === 'function') widest = Math.max(widest, el.getComputedTextLength());\n }\n setYLabelWidth((prev) => (prev === widest ? prev : widest));\n };\n measure();\n let live = true;\n // A web font landing after the first measure changes every width.\n document.fonts?.ready.then(() => { if (live) measure(); });\n return () => { live = false; };\n }, [yInside, yLabelKey]);\n\n const cls = [s.root, className].filter(Boolean).join(' ');\n\n const renderTickLines = (axis: Axis, list: ResolvedTick[], settings: TickSettings | false | null | undefined) => {\n if (!settings || settings.lines === false || list.length === 0) return null;\n return (\n <g>\n {list.map((t) => (\n <line\n key={`t${axis}-${t.value}`}\n data-plot-element=\"tick\"\n data-axis={axis}\n className={s.tick}\n {...(axis === 'x'\n ? { x1: t.at, x2: t.at, y1: 0, y2: height }\n : { x1: 0, x2: width, y1: t.at, y2: t.at })}\n />\n ))}\n </g>\n );\n };\n\n const renderTickLabels = (axis: Axis, list: ResolvedTick[], settings: TickSettings | false | null | undefined) => {\n if (!settings || list.length === 0) return null;\n const placement = settings.labels ?? 'inside';\n if (placement === false) return null;\n const outside = placement === 'outside';\n const gap = settings.gap ?? LABEL_GAP_PX;\n let place: { x?: number; y?: number; textAnchor: 'start' | 'middle' | 'end'; dominantBaseline?: 'central' | 'hanging' };\n if (axis === 'y') {\n place = outside\n ? { x: -gap, textAnchor: 'end', dominantBaseline: 'central' }\n : yLabelWidth > 0\n ? { x: gap + yLabelWidth, textAnchor: 'end', dominantBaseline: 'central' }\n : { x: gap, textAnchor: 'start', dominantBaseline: 'central' };\n } else {\n place = outside\n ? { y: height + gap, textAnchor: 'middle', dominantBaseline: 'hanging' }\n : { y: height - gap, textAnchor: 'middle' };\n }\n return (\n <g ref={axis === 'y' ? yLabelsRef : undefined} className={s.tickLabels} aria-hidden=\"true\">\n {list.map((t) => (\n <text\n key={`l${axis}-${t.value}`}\n data-plot-element=\"tick-label\"\n data-axis={axis}\n data-placement={placement}\n className={s.tickLabel}\n x={axis === 'x' ? t.at : place.x}\n y={axis === 'y' ? t.at : place.y}\n textAnchor={place.textAnchor}\n dominantBaseline={place.dominantBaseline}\n >\n {t.label}\n </text>\n ))}\n </g>\n );\n };\n\n return (\n <svg\n ref={svgRef}\n className={cls}\n style={style}\n width={width}\n height={height}\n viewBox={`0 0 ${width} ${height}`}\n role={role}\n aria-label={props['aria-label']}\n tabIndex={tabIndex}\n onPointerDown={onPointerDown ? handlePointerDown : undefined}\n onKeyDown={onKeyDown}\n >\n {grid && (() => {\n const divisions = grid.divisions ?? 3;\n const stroke = grid.color;\n // Evenly-spaced internal divisions, excluding the edges (which\n // belong to the axes). For divisions=3, fractions are 1/4, 2/4, 3/4.\n const fractions: number[] = [];\n for (let i = 1; i <= divisions; i++) fractions.push(i / (divisions + 1));\n return (\n <g>\n {fractions.map((f) => (\n <line\n key={`gx-${f}`}\n data-plot-element=\"grid\"\n className={s.grid}\n stroke={stroke}\n x1={f * width} x2={f * width}\n y1={0} y2={height}\n />\n ))}\n {fractions.map((f) => (\n <line\n key={`gy-${f}`}\n data-plot-element=\"grid\"\n className={s.grid}\n stroke={stroke}\n x1={0} x2={width}\n y1={f * height} y2={f * height}\n />\n ))}\n </g>\n );\n })()}\n {renderTickLines('x', xTickList, xTicks)}\n {renderTickLines('y', yTickList, yTicks)}\n {axes !== false && axes !== null && (() => {\n const stroke = axes?.color;\n return (\n <g>\n <line\n data-plot-element=\"axis\"\n className={s.axis}\n stroke={stroke}\n x1={0} x2={width}\n y1={height} y2={height}\n />\n <line\n data-plot-element=\"axis\"\n className={s.axis}\n stroke={stroke}\n x1={0} x2={0}\n y1={0} y2={height}\n />\n </g>\n );\n })()}\n {renderTickLabels('x', xTickList, xTicks)}\n {renderTickLabels('y', yTickList, yTicks)}\n {children}\n </svg>\n );\n});\n"],"mappings":";;;;AAkCA,SAAgB,EAAY,GAAU,GAAe,GAAuB;CAC1E,IAAM,KAAS,EAAE,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,OACrC,KAAS,EAAE,IAAI,EA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AAD;KACE,qBAAkB;KAClB,WAAW,EAAE;KACL;KACR,IAAI;KAAG,IAAI;KACX,IAAI;KAAG,IAAI;KACX,CAAA,CACA,EAAA,CAAA;OAEJ;GACH,EAAiB,KAAK,GAAW,EAAO;GACxC,EAAiB,KAAK,GAAW,EAAO;GACxC;GACG;;EAER"}
@@ -1,4 +1,4 @@
1
- import { n as e } from "./CurveEditor-DXwSP-iA.js";
1
+ import { n as e } from "./CurveEditor-f1R4kSbD.js";
2
2
  import { jsx as t } from "react/jsx-runtime";
3
3
  //#region src/components/PointPlotter/PointPlotter.tsx
4
4
  function n(n) {
@@ -13,4 +13,4 @@ function n(n) {
13
13
  //#endregion
14
14
  export { n as t };
15
15
 
16
- //# sourceMappingURL=PointPlotter-S_gz7VYt.js.map
16
+ //# sourceMappingURL=PointPlotter-DGs9i5P-.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"PointPlotter-S_gz7VYt.js","names":[],"sources":["../../src/components/PointPlotter/PointPlotter.tsx"],"sourcesContent":["import type { CSSProperties, ReactNode } from 'react';\nimport {\n CurveEditor,\n type AnchorRenderProps,\n type ControlPoint,\n type CurveEditorProps,\n} from '../CurveEditor';\nimport type { GridSettings, AxesSettings, TickSettings } from '../Plot2D';\n\n/** Props for {@link PointPlotter}. */\nexport interface PointPlotterProps {\n /** Plotted points; caller-owned. */\n value: readonly ControlPoint[];\n /** Fires every frame during drag with the live in-flight value. */\n onInput: (next: ControlPoint[]) => void;\n /** Fires once per discrete user action (drag-end, add, delete) with\n * the new value and the value at gesture start. Wire history here. */\n onChange?: (next: ControlPoint[], prev: readonly ControlPoint[]) => void;\n /** Model-space x range. Default [0, 1]. */\n xRange?: readonly [number, number];\n /** Model-space y range. Default [0, 1]. */\n yRange?: readonly [number, number];\n width: number;\n height: number;\n grid?: GridSettings | false | null;\n axes?: AxesSettings | false | null;\n xTicks?: TickSettings | false | null;\n yTicks?: TickSettings | false | null;\n /** Minimum allowed point count. User-initiated deletion is refused\n * while `value.length <= minPoints`. */\n minPoints?: number;\n /** Maximum allowed point count. User-initiated insertion is refused\n * while `value.length >= maxPoints`. */\n maxPoints?: number;\n /** How new points are added. Default `'click-empty'`. Set to `'never'`\n * to disable insertion entirely. */\n addPointMode?: 'click-empty' | 'never';\n /** Built-in undo/redo via keyboard when the component has focus.\n * Default `true`. See `CurveEditor.history` for details. */\n history?: boolean;\n /** Custom per-anchor renderer. See `CurveEditor.renderAnchor`. */\n renderAnchor?: (info: AnchorRenderProps) => ReactNode;\n /** Extra SVG content beneath the anchors. See `CurveEditor.decorations`. */\n decorations?: ReactNode;\n className?: string;\n style?: CSSProperties;\n}\n\n/**\n * 2D point plotter — a CurveEditor with the curve hidden. Anchors,\n * drag, shift+click delete, right-click delete, and click-empty insert\n * are inherited from CurveEditor verbatim, so the two components share\n * gesture semantics and stay in sync as CurveEditor evolves.\n *\n * Differences from CurveEditor: no curve `<path>` drawn, no fill, no\n * endpoint pinning, no interpolation, default `addPointMode` is\n * `'click-empty'` (CurveEditor defaults to `'click-curve'`, which\n * doesn't make sense without a curve to hit-test against).\n */\nexport function PointPlotter(props: PointPlotterProps) {\n const curveProps: CurveEditorProps = {\n ...props,\n addPointMode: props.addPointMode ?? 'click-empty',\n curve: false,\n fill: false,\n endpoints: 'free',\n };\n return <CurveEditor {...curveProps} />;\n}\n"],"mappings":";;;AA2DA,SAAgB,EAAa,GAA0B;AAQrD,QAAO,kBAAC,GAAD;EANL,GAAG;EACH,cAAc,EAAM,gBAAgB;EACpC,OAAO;EACP,MAAM;EACN,WAAW;EAEyB,CAAA"}
1
+ {"version":3,"file":"PointPlotter-DGs9i5P-.js","names":[],"sources":["../../src/components/PointPlotter/PointPlotter.tsx"],"sourcesContent":["import type { CSSProperties, ReactNode } from 'react';\nimport {\n CurveEditor,\n type AnchorRenderProps,\n type ControlPoint,\n type CurveEditorProps,\n} from '../CurveEditor';\nimport type { GridSettings, AxesSettings, TickSettings } from '../Plot2D';\n\n/** Props for {@link PointPlotter}. */\nexport interface PointPlotterProps {\n /** Plotted points; caller-owned. */\n value: readonly ControlPoint[];\n /** Fires every frame during drag with the live in-flight value. */\n onInput: (next: ControlPoint[]) => void;\n /** Fires once per discrete user action (drag-end, add, delete) with\n * the new value and the value at gesture start. Wire history here. */\n onChange?: (next: ControlPoint[], prev: readonly ControlPoint[]) => void;\n /** Model-space x range. Default [0, 1]. */\n xRange?: readonly [number, number];\n /** Model-space y range. Default [0, 1]. */\n yRange?: readonly [number, number];\n width: number;\n height: number;\n grid?: GridSettings | false | null;\n axes?: AxesSettings | false | null;\n xTicks?: TickSettings | false | null;\n yTicks?: TickSettings | false | null;\n /** Minimum allowed point count. User-initiated deletion is refused\n * while `value.length <= minPoints`. */\n minPoints?: number;\n /** Maximum allowed point count. User-initiated insertion is refused\n * while `value.length >= maxPoints`. */\n maxPoints?: number;\n /** How new points are added. Default `'click-empty'`. Set to `'never'`\n * to disable insertion entirely. */\n addPointMode?: 'click-empty' | 'never';\n /** Built-in undo/redo via keyboard when the component has focus.\n * Default `true`. See `CurveEditor.history` for details. */\n history?: boolean;\n /** Custom per-anchor renderer. See `CurveEditor.renderAnchor`. */\n renderAnchor?: (info: AnchorRenderProps) => ReactNode;\n /** Extra SVG content beneath the anchors. See `CurveEditor.decorations`. */\n decorations?: ReactNode;\n className?: string;\n style?: CSSProperties;\n}\n\n/**\n * 2D point plotter — a CurveEditor with the curve hidden. Anchors,\n * drag, shift+click delete, right-click delete, and click-empty insert\n * are inherited from CurveEditor verbatim, so the two components share\n * gesture semantics and stay in sync as CurveEditor evolves.\n *\n * Differences from CurveEditor: no curve `<path>` drawn, no fill, no\n * endpoint pinning, no interpolation, default `addPointMode` is\n * `'click-empty'` (CurveEditor defaults to `'click-curve'`, which\n * doesn't make sense without a curve to hit-test against).\n */\nexport function PointPlotter(props: PointPlotterProps) {\n const curveProps: CurveEditorProps = {\n ...props,\n addPointMode: props.addPointMode ?? 'click-empty',\n curve: false,\n fill: false,\n endpoints: 'free',\n };\n return <CurveEditor {...curveProps} />;\n}\n"],"mappings":";;;AA2DA,SAAgB,EAAa,GAA0B;AAQrD,QAAO,kBAAC,GAAD;EANL,GAAG;EACH,cAAc,EAAM,gBAAgB;EACpC,OAAO;EACP,MAAM;EACN,WAAW;EAEyB,CAAA"}
@@ -1,4 +1,4 @@
1
- import { t as e } from "./Badge-CW9pBPFl.js";
1
+ import { t as e } from "./Badge-DZ0lFs14.js";
2
2
  import { jsx as t } from "react/jsx-runtime";
3
3
  var n = {
4
4
  row: "_row_1a09e_1",
@@ -19,6 +19,8 @@ function r({ segments: r, startCap: i = "flat", size: a, variant: o, depth: s, g
19
19
  rightEdge: c.endCap ?? "flat",
20
20
  ...s !== void 0 && { depth: s }
21
21
  },
22
+ status: c.status,
23
+ stance: c.stance,
22
24
  tone: c.tone,
23
25
  variant: c.variant ?? o,
24
26
  size: c.size ?? a,
@@ -33,4 +35,4 @@ function r({ segments: r, startCap: i = "flat", size: a, variant: o, depth: s, g
33
35
  //#endregion
34
36
  export { r as t };
35
37
 
36
- //# sourceMappingURL=Powerline-Ak5AWUlK.js.map
38
+ //# sourceMappingURL=Powerline-DBEPceLE.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Powerline-DBEPceLE.js","names":[],"sources":["../../src/components/Powerline/Powerline.module.css","../../src/components/Powerline/Powerline.tsx"],"sourcesContent":[".row {\n display: inline-flex;\n align-items: stretch;\n gap: var(--powerline-gap, 0.2em);\n}\n\n.matrix {\n display: grid;\n gap: var(--wzl-space-6);\n}\n\n/* Reset Badge's opinionated text defaults — Powerline segments should pick up\n * the surrounding text style instead of forcing uppercase / 10px / extra\n * tracking. Consumers can still override via className on Powerline. */\n.segment {\n font-size: inherit;\n text-transform: none;\n letter-spacing: normal;\n}\n","import type { CSSProperties, ReactNode } from 'react';\nimport { Badge } from '../Badge/Badge';\nimport type { BadgeSize, BadgeStatus, BadgeVariant } from '../Badge/types';\nimport type { StanceProps } from '../stance';\nimport type { EdgeCap } from '../Badge/bases/edgeProfiles';\nimport s from './Powerline.module.css';\n\n/**\n * One segment of a {@link Powerline}. Giving it `onClick` or `href` makes it\n * interactive, the same way it does on a `Badge`.\n */\nexport interface PowerlineSegment extends StanceProps {\n text: ReactNode;\n /** Cap on this segment's right edge. Next segment's left edge adopts the same profile. */\n endCap?: EdgeCap;\n status?: BadgeStatus;\n variant?: BadgeVariant;\n size?: BadgeSize;\n onClick?: () => void;\n href?: string;\n 'aria-label'?: string;\n}\n\n/** Props for {@link Powerline}. */\nexport interface PowerlineProps {\n segments: PowerlineSegment[];\n /** Left edge of the first segment. Defaults to 'flat'. */\n startCap?: EdgeCap;\n /** Default size for every segment (per-segment `size` wins). */\n size?: BadgeSize;\n /** Default variant for every segment (per-segment `variant` wins). */\n variant?: BadgeVariant;\n /** Protrusion depth in CSS px, passed through to every segment's base. */\n depth?: number;\n /** Visible gap between adjacent segments. Number → px; string → literal CSS length.\n * Default: `0.2em` (scales with the row's font size). Pass `0` for flush. */\n gap?: number | string;\n className?: string;\n 'aria-label'?: string;\n}\n\n/**\n * A row of chevron-linked badge segments, in the style of a shell powerline\n * prompt. Each segment's `endCap` shapes both its own right edge and the next\n * segment's left edge, so the run reads as one continuous chain.\n *\n * Built for showing a path through a sequence of steps — the inspector uses\n * it to display how input routes from tool to gesture to action to target.\n */\nexport function Powerline({\n segments,\n startCap = 'flat',\n size,\n variant,\n depth,\n gap,\n className,\n ...rest\n}: PowerlineProps) {\n const cls = [s.row, className].filter(Boolean).join(' ');\n const style: CSSProperties | undefined = gap !== undefined\n ? { ['--powerline-gap' as never]: typeof gap === 'number' ? `${gap}px` : gap }\n : undefined;\n return (\n <span className={cls} style={style} aria-label={rest['aria-label']}>\n {segments.map((seg, i) => {\n const leftEdge: EdgeCap = i === 0 ? startCap : (segments[i - 1].endCap ?? 'flat');\n const rightEdge: EdgeCap = seg.endCap ?? 'flat';\n return (\n <Badge\n key={i}\n base=\"powerline\"\n baseParams={{ leftEdge, rightEdge, ...(depth !== undefined && { depth }) }}\n status={seg.status}\n stance={seg.stance}\n tone={seg.tone}\n variant={seg.variant ?? variant}\n size={seg.size ?? size}\n onClick={seg.onClick}\n href={seg.href}\n aria-label={seg['aria-label']}\n className={s.segment}\n >\n {seg.text}\n </Badge>\n );\n })}\n </span>\n );\n}\n"],"mappings":";;;;;;;;;ACiDA,SAAgB,EAAU,EACxB,aACA,cAAW,QACX,SACA,YACA,UACA,QACA,cACA,GAAG,KACc;AAKjB,QACE,kBAAC,QAAD;EAAM,WALI,CAAC,EAAE,KAAK,EAAU,CAAC,OAAO,QAAQ,CAAC,KAAK,IAKjC;EAAY,OAJU,MAAQ,KAAA,IAE7C,KAAA,IADA,EAAG,mBAA6B,OAAO,KAAQ,WAAW,GAAG,EAAI,MAAM,GAAK;EAG1C,cAAY,EAAK;YAClD,EAAS,KAAK,GAAK,MAIhB,kBAAC,GAAD;GAEE,MAAK;GACL,YAAY;IAAE,UANQ,MAAM,IAAI,IAAY,EAAS,IAAI,GAAG,UAAU;IAM9C,WALD,EAAI,UAAU;IAKF,GAAI,MAAU,KAAA,KAAa,EAAE,UAAO;IAAG;GAC1E,QAAQ,EAAI;GACZ,QAAQ,EAAI;GACZ,MAAM,EAAI;GACV,SAAS,EAAI,WAAW;GACxB,MAAM,EAAI,QAAQ;GAClB,SAAS,EAAI;GACb,MAAM,EAAI;GACV,cAAY,EAAI;GAChB,WAAW,EAAE;aAEZ,EAAI;GACC,EAdD,EAcC,CAEV;EACG,CAAA"}