@weasel-js/ui 1.6.0 → 1.7.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 (530) hide show
  1. package/dist/chunks/{ActionBar-CYvfmEz0.js → ActionBar-DCq16yFA.js} +9 -9
  2. package/dist/chunks/ActionBar-DCq16yFA.js.map +1 -0
  3. package/dist/chunks/Badge-CTc9Lkwn.js +14 -0
  4. package/dist/chunks/Badge-CTc9Lkwn.js.map +1 -0
  5. package/dist/chunks/{Badge-DZ0lFs14.js → Badge-D2aD7xVL.js} +418 -369
  6. package/dist/chunks/Badge-D2aD7xVL.js.map +1 -0
  7. package/dist/chunks/BandEditor-Dd0egAgE.js +292 -0
  8. package/dist/chunks/BandEditor-Dd0egAgE.js.map +1 -0
  9. package/dist/chunks/{Button-Dyp31jMt.js → Button-BIdXHQOx.js} +3 -3
  10. package/dist/chunks/Button-BIdXHQOx.js.map +1 -0
  11. package/dist/chunks/{ButtonBar-smZzFuEo.js → ButtonBar-DIQTe5GQ.js} +4 -4
  12. package/dist/chunks/ButtonBar-DIQTe5GQ.js.map +1 -0
  13. package/dist/chunks/Callout-ndW5_Bqx.js +116 -0
  14. package/dist/chunks/Callout-ndW5_Bqx.js.map +1 -0
  15. package/dist/chunks/{Checkbox-ChZz30Ds.js → Checkbox-DHXTUHO9.js} +1 -1
  16. package/dist/chunks/Checkbox-DHXTUHO9.js.map +1 -0
  17. package/dist/chunks/CloseButton-C2J7wVfo.js +26 -0
  18. package/dist/chunks/CloseButton-C2J7wVfo.js.map +1 -0
  19. package/dist/chunks/{Code-v4tDWuuN.js → Code-AsKpgnv6.js} +3 -3
  20. package/dist/chunks/Code-AsKpgnv6.js.map +1 -0
  21. package/dist/chunks/ColorField-Yz_BkcCT.js +69 -0
  22. package/dist/chunks/ColorField-Yz_BkcCT.js.map +1 -0
  23. package/dist/chunks/{ColorModeControl-JOEiqtE0.js → ColorModeControl-BewxA0rX.js} +3 -3
  24. package/dist/chunks/ColorModeControl-BewxA0rX.js.map +1 -0
  25. package/dist/chunks/{ComboBox-C1JgIpML.js → ComboBox-B34H76CW.js} +14 -14
  26. package/dist/chunks/ComboBox-B34H76CW.js.map +1 -0
  27. package/dist/chunks/{CurveEditor-f1R4kSbD.js → CurveEditor-DUVjd25R.js} +35 -35
  28. package/dist/chunks/CurveEditor-DUVjd25R.js.map +1 -0
  29. package/dist/chunks/{DataGrid-CZPrB_3a.js → DataGrid-LZ2JgY2Y.js} +27 -27
  30. package/dist/chunks/DataGrid-LZ2JgY2Y.js.map +1 -0
  31. package/dist/chunks/DetailList-BKomDzg5.js +52 -0
  32. package/dist/chunks/DetailList-BKomDzg5.js.map +1 -0
  33. package/dist/chunks/{DetentSlider-BYyaZha6.js → DetentSlider-5uQPFucv.js} +2 -2
  34. package/dist/chunks/DetentSlider-5uQPFucv.js.map +1 -0
  35. package/dist/chunks/Dialog-DGFutQ--.js +63 -0
  36. package/dist/chunks/Dialog-DGFutQ--.js.map +1 -0
  37. package/dist/chunks/{Disclosure-D79jhmh2.js → Disclosure-Ch2KxYuB.js} +7 -7
  38. package/dist/chunks/Disclosure-Ch2KxYuB.js.map +1 -0
  39. package/dist/chunks/{DragGhost-DcU7cOwy.js → DragGhost-B5_hb9W9.js} +2 -2
  40. package/dist/chunks/DragGhost-B5_hb9W9.js.map +1 -0
  41. package/dist/chunks/{DragHandleGlyph-BtBxHjZS.js → DragGrip-AoIZXfZb.js} +2 -2
  42. package/dist/chunks/DragGrip-AoIZXfZb.js.map +1 -0
  43. package/dist/chunks/FallthroughDiagram-BEHiM5IS.js +284 -0
  44. package/dist/chunks/FallthroughDiagram-BEHiM5IS.js.map +1 -0
  45. package/dist/chunks/{Field-xbqRmjsI.js → Field--onYxXTF.js} +7 -6
  46. package/dist/chunks/Field--onYxXTF.js.map +1 -0
  47. package/dist/chunks/{FillStrokeSwatch-BViKXIPx.js → FillStrokeSwatch-DNb0KXPk.js} +11 -11
  48. package/dist/chunks/FillStrokeSwatch-DNb0KXPk.js.map +1 -0
  49. package/dist/chunks/{FontFamilySelect-r9TV_xIH.js → FontFamilySelect-DkRgNtag.js} +2 -2
  50. package/dist/chunks/FontFamilySelect-DkRgNtag.js.map +1 -0
  51. package/dist/chunks/GestureRoute-C_YGl7bJ.js +82 -0
  52. package/dist/chunks/GestureRoute-C_YGl7bJ.js.map +1 -0
  53. package/dist/chunks/GradientEditor-b7v4Ph3i.js +363 -0
  54. package/dist/chunks/GradientEditor-b7v4Ph3i.js.map +1 -0
  55. package/dist/chunks/{Icon-BW0qv_U7.js → Icon-CcVjdq2C.js} +32 -2
  56. package/dist/chunks/Icon-CcVjdq2C.js.map +1 -0
  57. package/dist/chunks/{InlineRange-BwGFDhpT.js → InlineRange-P01ABSzo.js} +3 -3
  58. package/dist/chunks/InlineRange-P01ABSzo.js.map +1 -0
  59. package/dist/chunks/{Input-Bx2cuUbS.js → Input-CHmkfYaD.js} +2 -2
  60. package/dist/chunks/Input-CHmkfYaD.js.map +1 -0
  61. package/dist/chunks/{ItemList-DzJ2lK0R.js → ItemList-Cm-HUWCi.js} +6 -7
  62. package/dist/chunks/ItemList-Cm-HUWCi.js.map +1 -0
  63. package/dist/chunks/{ItemList.module-DDUXfuZL.js → ItemList.module-BSpCSxan.js} +1 -1
  64. package/dist/chunks/ItemList.module-BSpCSxan.js.map +1 -0
  65. package/dist/chunks/{Jog-LPoac9s4.js → Jog-DRmfrkCg.js} +4 -4
  66. package/dist/chunks/Jog-DRmfrkCg.js.map +1 -0
  67. package/dist/chunks/{Keycaps-CKiKOJnJ.js → Keycaps-C-FJyG8k.js} +15 -15
  68. package/dist/chunks/Keycaps-C-FJyG8k.js.map +1 -0
  69. package/dist/chunks/{LayerList-BeGrkLb9.js → LayerList-wCI1EueM.js} +150 -154
  70. package/dist/chunks/LayerList-wCI1EueM.js.map +1 -0
  71. package/dist/chunks/ListEditor-BeA60TAA.js +71 -0
  72. package/dist/chunks/ListEditor-BeA60TAA.js.map +1 -0
  73. package/dist/chunks/{MenuButton-BcdhrNGh.js → MenuButton-BSqEChJE.js} +9 -9
  74. package/dist/chunks/MenuButton-BSqEChJE.js.map +1 -0
  75. package/dist/chunks/{MeshEditor-BOOIFWnz.js → MeshEditor-D1HLZcAh.js} +4 -4
  76. package/dist/chunks/MeshEditor-D1HLZcAh.js.map +1 -0
  77. package/dist/chunks/NumberField-BnJxcazc.js +206 -0
  78. package/dist/chunks/NumberField-BnJxcazc.js.map +1 -0
  79. package/dist/chunks/{OptionsBar-DlcagPYK.js → OptionsBar-ujxYidhj.js} +3 -3
  80. package/dist/chunks/OptionsBar-ujxYidhj.js.map +1 -0
  81. package/dist/chunks/{PaintField-B2mLRZa4.js → PaintField-DadOELMg.js} +4 -4
  82. package/dist/chunks/PaintField-DadOELMg.js.map +1 -0
  83. package/dist/chunks/PaintInput-v8Y7MDbH.js +121 -0
  84. package/dist/chunks/PaintInput-v8Y7MDbH.js.map +1 -0
  85. package/dist/chunks/{PatternPicker-DdfpxoQy.js → PatternPicker-R_EQtw2Q.js} +2 -2
  86. package/dist/chunks/PatternPicker-R_EQtw2Q.js.map +1 -0
  87. package/dist/chunks/{Plot2D-lyO7waPQ.js → Plot2D-CTXHkL5p.js} +13 -13
  88. package/dist/chunks/Plot2D-CTXHkL5p.js.map +1 -0
  89. package/dist/chunks/{PointPlotter-DGs9i5P-.js → PointPlotter-ldI4RrU1.js} +5 -4
  90. package/dist/chunks/PointPlotter-ldI4RrU1.js.map +1 -0
  91. package/dist/chunks/Powerline-DNyH885r.js +42 -0
  92. package/dist/chunks/Powerline-DNyH885r.js.map +1 -0
  93. package/dist/chunks/{Prefs-Ctu0H4-b.js → Prefs-ByA-x51i.js} +60 -47
  94. package/dist/chunks/Prefs-ByA-x51i.js.map +1 -0
  95. package/dist/chunks/{Properties-Bbneh1ws.js → Properties-DmAeQ3mk.js} +43 -36
  96. package/dist/chunks/Properties-DmAeQ3mk.js.map +1 -0
  97. package/dist/chunks/PropertyField-DfIJJ5GS.js +673 -0
  98. package/dist/chunks/PropertyField-DfIJJ5GS.js.map +1 -0
  99. package/dist/chunks/{RadioGroup-BK2mD6Q0.js → RadioGroup-Bh4-12e-.js} +2 -2
  100. package/dist/chunks/RadioGroup-Bh4-12e-.js.map +1 -0
  101. package/dist/chunks/{RangeSlider-BiRAOsTh.js → RangeSlider-SEGE-7VF.js} +8 -8
  102. package/dist/chunks/RangeSlider-SEGE-7VF.js.map +1 -0
  103. package/dist/chunks/{ResizeHandle-Cc6EOehs.js → ResizeHandle-rKVWyeTG.js} +9 -9
  104. package/dist/chunks/ResizeHandle-rKVWyeTG.js.map +1 -0
  105. package/dist/chunks/Select-ClmKtyWg.js +229 -0
  106. package/dist/chunks/Select-ClmKtyWg.js.map +1 -0
  107. package/dist/chunks/SelectionPanel-BaQnX4Bs.js +106 -0
  108. package/dist/chunks/SelectionPanel-BaQnX4Bs.js.map +1 -0
  109. package/dist/chunks/{Sidebar-DKKd4R-x.js → Sidebar-BZ0m4afn.js} +8 -8
  110. package/dist/chunks/Sidebar-BZ0m4afn.js.map +1 -0
  111. package/dist/chunks/SidebarPanel-BblDEz4G.js +53 -0
  112. package/dist/chunks/SidebarPanel-BblDEz4G.js.map +1 -0
  113. package/dist/chunks/Slider-YofwGOI4.js +389 -0
  114. package/dist/chunks/Slider-YofwGOI4.js.map +1 -0
  115. package/dist/chunks/{StatusBar-CdPdmmda.js → StatusBar-Ca9Dvhhq.js} +13 -13
  116. package/dist/chunks/StatusBar-Ca9Dvhhq.js.map +1 -0
  117. package/dist/chunks/{SwatchGrid-C-Zx2Exd.js → SwatchGrid-BYvA8Bmh.js} +3 -3
  118. package/dist/chunks/{SwatchGrid-C-Zx2Exd.js.map → SwatchGrid-BYvA8Bmh.js.map} +1 -1
  119. package/dist/chunks/{Switch-DxF7TsEu.js → Switch-CSYmcM8y.js} +1 -1
  120. package/dist/chunks/Switch-CSYmcM8y.js.map +1 -0
  121. package/dist/chunks/{Tabs-GXEfoe3o.js → Tabs-BbpzLLdY.js} +1 -1
  122. package/dist/chunks/Tabs-BbpzLLdY.js.map +1 -0
  123. package/dist/chunks/ThemeSwitcher-BlsInAmR.js +38 -0
  124. package/dist/chunks/ThemeSwitcher-BlsInAmR.js.map +1 -0
  125. package/dist/chunks/{Timeline-SgmpQtUV.js → Timeline-B39cwfMB.js} +213 -209
  126. package/dist/chunks/Timeline-B39cwfMB.js.map +1 -0
  127. package/dist/chunks/{Toast-BfcljZz6.js → Toast-BF9GE0HC.js} +25 -27
  128. package/dist/chunks/Toast-BF9GE0HC.js.map +1 -0
  129. package/dist/chunks/{ToggleBar-Btnl5r7F.js → ToggleBar-BTYkBXU9.js} +20 -18
  130. package/dist/chunks/ToggleBar-BTYkBXU9.js.map +1 -0
  131. package/dist/chunks/{TokenPanel-5ajHEHha.js → TokenPanel-CMDAOfYH.js} +21 -18
  132. package/dist/chunks/TokenPanel-CMDAOfYH.js.map +1 -0
  133. package/dist/chunks/{ToolButton-rzqlFlAc.js → ToolButton-CAHBa08P.js} +7 -7
  134. package/dist/chunks/ToolButton-CAHBa08P.js.map +1 -0
  135. package/dist/chunks/{ToolGroup-4bUBV5k6.js → ToolGroup-Dpg1LN0l.js} +7 -7
  136. package/dist/chunks/ToolGroup-Dpg1LN0l.js.map +1 -0
  137. package/dist/chunks/{ToolOptionsBar-BF3TNXA3.js → ToolOptionsBar-D_GCrBAN.js} +12 -10
  138. package/dist/chunks/ToolOptionsBar-D_GCrBAN.js.map +1 -0
  139. package/dist/chunks/{ToolPalette-Uw4PvWwa.js → ToolPalette-OOWN51Xx.js} +7 -7
  140. package/dist/chunks/ToolPalette-OOWN51Xx.js.map +1 -0
  141. package/dist/chunks/{Tooltip-9XiJF937.js → Tooltip-Clg2mhSt.js} +2 -2
  142. package/dist/chunks/Tooltip-Clg2mhSt.js.map +1 -0
  143. package/dist/chunks/{Tree-BGt6P8tI.js → Tree-Cc8lIzgM.js} +3 -3
  144. package/dist/chunks/Tree-Cc8lIzgM.js.map +1 -0
  145. package/dist/chunks/{createKeyframeLayer-BzDRCrrh.js → createKeyframeLayer-DVl321_l.js} +46 -47
  146. package/dist/chunks/createKeyframeLayer-DVl321_l.js.map +1 -0
  147. package/dist/chunks/{dlog-CMYiRF3Q.js → dlog-F0I8KsIW.js} +2 -2
  148. package/dist/chunks/dlog-F0I8KsIW.js.map +1 -0
  149. package/dist/chunks/{formatShortcut-BoGqUoWi.js → formatShortcut-DRQrVThu.js} +2 -2
  150. package/dist/chunks/formatShortcut-DRQrVThu.js.map +1 -0
  151. package/dist/chunks/icons-BhcR1l64.js +162 -0
  152. package/dist/chunks/icons-BhcR1l64.js.map +1 -0
  153. package/dist/chunks/{interactiveTarget-C7QUBaJN.js → interactiveTarget-BNZmTow2.js} +1 -1
  154. package/dist/chunks/{interactiveTarget-C7QUBaJN.js.map → interactiveTarget-BNZmTow2.js.map} +1 -1
  155. package/dist/chunks/{keyGlyph-CLvUHU8c.js → keyGlyph-C0qTakG-.js} +1 -1
  156. package/dist/chunks/keyGlyph-C0qTakG-.js.map +1 -0
  157. package/dist/chunks/{model-BQMvTLnW.js → model-BaF65rnX.js} +95 -90
  158. package/dist/chunks/model-BaF65rnX.js.map +1 -0
  159. package/dist/chunks/{paintPreview-DPtZS4yU.js → paintPreview-CuSZiHpR.js} +1 -1
  160. package/dist/chunks/paintPreview-CuSZiHpR.js.map +1 -0
  161. package/dist/chunks/{paintValue-Bz6AVuh3.js → paintValue-BpaGPjV3.js} +3 -3
  162. package/dist/chunks/paintValue-BpaGPjV3.js.map +1 -0
  163. package/dist/chunks/{portalHost-CjpCnuGU.js → portalHost-yTOVuCej.js} +1 -1
  164. package/dist/chunks/portalHost-yTOVuCej.js.map +1 -0
  165. package/dist/chunks/{prefField-CLkhrvYl.js → prefField-BopW9bjx.js} +18 -14
  166. package/dist/chunks/prefField-BopW9bjx.js.map +1 -0
  167. package/dist/chunks/{segmentTooltip-CAkZlW-t.js → segmentTooltip-CStYHKzd.js} +2 -2
  168. package/dist/chunks/segmentTooltip-CStYHKzd.js.map +1 -0
  169. package/dist/chunks/segmentedControl.module-D6SzYJD7.js +11 -0
  170. package/dist/chunks/segmentedControl.module-D6SzYJD7.js.map +1 -0
  171. package/dist/chunks/{snap-DC4Km8xG.js → snap-DRjbOiG9.js} +1 -1
  172. package/dist/chunks/snap-DRjbOiG9.js.map +1 -0
  173. package/dist/chunks/{stance-CarrcbbP.js → stance-BFQpS_fL.js} +1 -1
  174. package/dist/chunks/stance-BFQpS_fL.js.map +1 -0
  175. package/dist/chunks/{useReorderDragList-Dcezzgix.js → useReorderDragList-FCMoFIzH.js} +3 -3
  176. package/dist/chunks/useReorderDragList-FCMoFIzH.js.map +1 -0
  177. package/dist/chunks/{useRovingTabIndex-B4uJqiKP.js → useRovingTabIndex-Bp_hYm_h.js} +1 -1
  178. package/dist/chunks/useRovingTabIndex-Bp_hYm_h.js.map +1 -0
  179. package/dist/components/ActionBar/ActionBar.d.ts +1 -1
  180. package/dist/components/ActionBar/ActionBar.d.ts.map +1 -1
  181. package/dist/components/ActionBar/index.js +1 -1
  182. package/dist/components/Badge/bases/Powerline.d.ts.map +1 -1
  183. package/dist/components/Badge/bases/edgeProfiles.d.ts +31 -4
  184. package/dist/components/Badge/bases/edgeProfiles.d.ts.map +1 -1
  185. package/dist/components/Badge/index.d.ts +1 -0
  186. package/dist/components/Badge/index.d.ts.map +1 -1
  187. package/dist/components/Badge/index.js +3 -2
  188. package/dist/components/Badge/statusIcons.d.ts +5 -0
  189. package/dist/components/Badge/statusIcons.d.ts.map +1 -0
  190. package/dist/components/BandEditor/BandEditor.d.ts +16 -7
  191. package/dist/components/BandEditor/BandEditor.d.ts.map +1 -1
  192. package/dist/components/BandEditor/bands.d.ts +5 -2
  193. package/dist/components/BandEditor/bands.d.ts.map +1 -1
  194. package/dist/components/BandEditor/index.js +1 -1
  195. package/dist/components/Button/index.js +1 -1
  196. package/dist/components/ButtonBar/index.js +1 -1
  197. package/dist/components/Callout/Callout.d.ts +3 -3
  198. package/dist/components/Callout/Callout.d.ts.map +1 -1
  199. package/dist/components/Callout/index.js +1 -1
  200. package/dist/components/Checkbox/index.js +1 -1
  201. package/dist/components/CloseButton/CloseButton.d.ts +21 -0
  202. package/dist/components/CloseButton/CloseButton.d.ts.map +1 -0
  203. package/dist/components/CloseButton/index.d.ts +3 -0
  204. package/dist/components/CloseButton/index.d.ts.map +1 -0
  205. package/dist/components/CloseButton/index.js +2 -0
  206. package/dist/components/Code/Code.d.ts +1 -1
  207. package/dist/components/Code/Code.d.ts.map +1 -1
  208. package/dist/components/Code/index.js +1 -1
  209. package/dist/components/ColorField/ColorField.d.ts +6 -2
  210. package/dist/components/ColorField/ColorField.d.ts.map +1 -1
  211. package/dist/components/ColorField/index.js +1 -1
  212. package/dist/components/ColorModeControl/index.js +1 -1
  213. package/dist/components/ComboBox/ComboBox.d.ts +2 -2
  214. package/dist/components/ComboBox/ComboBox.d.ts.map +1 -1
  215. package/dist/components/ComboBox/index.js +1 -1
  216. package/dist/components/CurveEditor/CurveEditor.d.ts +1 -1
  217. package/dist/components/CurveEditor/CurveEditor.d.ts.map +1 -1
  218. package/dist/components/CurveEditor/LayeredCurveEditor.d.ts +1 -1
  219. package/dist/components/CurveEditor/LayeredCurveEditor.d.ts.map +1 -1
  220. package/dist/components/CurveEditor/index.js +3 -3
  221. package/dist/components/DataGrid/DataGrid.d.ts +1 -1
  222. package/dist/components/DataGrid/DataGrid.d.ts.map +1 -1
  223. package/dist/components/DataGrid/index.js +1 -1
  224. package/dist/components/DetailList/DetailList.d.ts +31 -5
  225. package/dist/components/DetailList/DetailList.d.ts.map +1 -1
  226. package/dist/components/DetailList/index.d.ts +1 -1
  227. package/dist/components/DetailList/index.d.ts.map +1 -1
  228. package/dist/components/DetailList/index.js +1 -1
  229. package/dist/components/DetentSlider/index.js +1 -1
  230. package/dist/components/Dialog/Dialog.d.ts +1 -1
  231. package/dist/components/Dialog/Dialog.d.ts.map +1 -1
  232. package/dist/components/Dialog/index.js +1 -1
  233. package/dist/components/Disclosure/Disclosure.d.ts +4 -4
  234. package/dist/components/Disclosure/Disclosure.d.ts.map +1 -1
  235. package/dist/components/Disclosure/index.js +1 -1
  236. package/dist/components/DragGhost/index.js +1 -1
  237. package/dist/components/{DragHandleGlyph/DragHandleGlyph.d.ts → DragGrip/DragGrip.d.ts} +4 -4
  238. package/dist/components/DragGrip/DragGrip.d.ts.map +1 -0
  239. package/dist/components/DragGrip/index.d.ts +3 -0
  240. package/dist/components/DragGrip/index.d.ts.map +1 -0
  241. package/dist/components/DragGrip/index.js +2 -0
  242. package/dist/components/FallthroughDiagram/FallthroughDiagram.d.ts +14 -0
  243. package/dist/components/FallthroughDiagram/FallthroughDiagram.d.ts.map +1 -0
  244. package/dist/components/FallthroughDiagram/fixtures.d.ts +17 -0
  245. package/dist/components/FallthroughDiagram/fixtures.d.ts.map +1 -0
  246. package/dist/components/FallthroughDiagram/index.d.ts +3 -0
  247. package/dist/components/FallthroughDiagram/index.d.ts.map +1 -0
  248. package/dist/components/FallthroughDiagram/index.js +2 -0
  249. package/dist/components/Field/Field.d.ts +1 -1
  250. package/dist/components/Field/Field.d.ts.map +1 -1
  251. package/dist/components/Field/index.js +1 -1
  252. package/dist/components/FillStrokeSwatch/index.js +1 -1
  253. package/dist/components/FontFamilySelect/FontFamilySelect.d.ts +1 -1
  254. package/dist/components/FontFamilySelect/FontFamilySelect.d.ts.map +1 -1
  255. package/dist/components/FontFamilySelect/index.js +1 -1
  256. package/dist/components/GestureRoute/GestureRoute.d.ts +19 -0
  257. package/dist/components/GestureRoute/GestureRoute.d.ts.map +1 -0
  258. package/dist/components/GestureRoute/index.d.ts +3 -0
  259. package/dist/components/GestureRoute/index.d.ts.map +1 -0
  260. package/dist/components/GestureRoute/index.js +2 -0
  261. package/dist/components/GradientEditor/GradientEditor.d.ts +22 -8
  262. package/dist/components/GradientEditor/GradientEditor.d.ts.map +1 -1
  263. package/dist/components/GradientEditor/index.js +1 -1
  264. package/dist/components/InlineRange/index.js +1 -1
  265. package/dist/components/Input/index.js +1 -1
  266. package/dist/components/ItemList/index.js +1 -1
  267. package/dist/components/Jog/Jog.d.ts +1 -1
  268. package/dist/components/Jog/Jog.d.ts.map +1 -1
  269. package/dist/components/Jog/index.js +1 -1
  270. package/dist/components/Keycaps/Keycap.d.ts +1 -1
  271. package/dist/components/Keycaps/Keycap.d.ts.map +1 -1
  272. package/dist/components/Keycaps/Keycaps.d.ts +11 -5
  273. package/dist/components/Keycaps/Keycaps.d.ts.map +1 -1
  274. package/dist/components/Keycaps/index.d.ts +1 -1
  275. package/dist/components/Keycaps/index.d.ts.map +1 -1
  276. package/dist/components/Keycaps/index.js +2 -2
  277. package/dist/components/LayerList/LayerList.d.ts +2 -2
  278. package/dist/components/LayerList/LayerList.d.ts.map +1 -1
  279. package/dist/components/LayerList/index.js +1 -1
  280. package/dist/components/ListEditor/ListEditor.d.ts +1 -1
  281. package/dist/components/ListEditor/ListEditor.d.ts.map +1 -1
  282. package/dist/components/ListEditor/index.js +1 -1
  283. package/dist/components/MenuButton/MenuButton.d.ts +1 -1
  284. package/dist/components/MenuButton/MenuButton.d.ts.map +1 -1
  285. package/dist/components/MenuButton/index.js +1 -1
  286. package/dist/components/MeshEditor/index.js +1 -1
  287. package/dist/components/NumberField/UnitField.d.ts +20 -7
  288. package/dist/components/NumberField/UnitField.d.ts.map +1 -1
  289. package/dist/components/NumberField/index.js +1 -1
  290. package/dist/components/OptionsBar/index.js +1 -1
  291. package/dist/components/PaintField/index.js +1 -1
  292. package/dist/components/PaintInput/PaintInput.d.ts.map +1 -1
  293. package/dist/components/PaintInput/index.js +1 -1
  294. package/dist/components/PatternPicker/index.js +1 -1
  295. package/dist/components/Plot2D/index.js +1 -1
  296. package/dist/components/PointPlotter/PointPlotter.d.ts +1 -1
  297. package/dist/components/PointPlotter/PointPlotter.d.ts.map +1 -1
  298. package/dist/components/PointPlotter/index.js +1 -1
  299. package/dist/components/Powerline/Powerline.d.ts +1 -1
  300. package/dist/components/Powerline/Powerline.d.ts.map +1 -1
  301. package/dist/components/Powerline/index.d.ts +1 -1
  302. package/dist/components/Powerline/index.d.ts.map +1 -1
  303. package/dist/components/Powerline/index.js +2 -2
  304. package/dist/components/Prefs/PrefsDialog.d.ts +1 -1
  305. package/dist/components/Prefs/PrefsDialog.d.ts.map +1 -1
  306. package/dist/components/Prefs/PrefsForm.d.ts +1 -1
  307. package/dist/components/Prefs/PrefsForm.d.ts.map +1 -1
  308. package/dist/components/Prefs/PrefsPane.d.ts +1 -1
  309. package/dist/components/Prefs/PrefsPane.d.ts.map +1 -1
  310. package/dist/components/Prefs/PrefsRail.d.ts +1 -1
  311. package/dist/components/Prefs/PrefsRail.d.ts.map +1 -1
  312. package/dist/components/Prefs/PrefsRow.d.ts +1 -1
  313. package/dist/components/Prefs/PrefsRow.d.ts.map +1 -1
  314. package/dist/components/Prefs/index.d.ts +1 -1
  315. package/dist/components/Prefs/index.d.ts.map +1 -1
  316. package/dist/components/Prefs/index.js +2 -2
  317. package/dist/components/Prefs/prefField.d.ts.map +1 -1
  318. package/dist/components/Prefs/schema.d.ts +2 -2
  319. package/dist/components/Prefs/schema.d.ts.map +1 -1
  320. package/dist/components/Properties/CurveField.d.ts +1 -1
  321. package/dist/components/Properties/CurveField.d.ts.map +1 -1
  322. package/dist/components/Properties/DialogRow.d.ts +1 -1
  323. package/dist/components/Properties/DialogRow.d.ts.map +1 -1
  324. package/dist/components/Properties/PropertyField.d.ts +24 -32
  325. package/dist/components/Properties/PropertyField.d.ts.map +1 -1
  326. package/dist/components/Properties/PropertyGroup.d.ts +1 -1
  327. package/dist/components/Properties/PropertyGroup.d.ts.map +1 -1
  328. package/dist/components/Properties/PropertyPanel.d.ts +4 -11
  329. package/dist/components/Properties/PropertyPanel.d.ts.map +1 -1
  330. package/dist/components/Properties/Subpanel.d.ts +1 -1
  331. package/dist/components/Properties/Subpanel.d.ts.map +1 -1
  332. package/dist/components/Properties/index.d.ts +1 -1
  333. package/dist/components/Properties/index.d.ts.map +1 -1
  334. package/dist/components/Properties/index.js +2 -2
  335. package/dist/components/Properties/storyLayouts.d.ts +1 -1
  336. package/dist/components/Properties/storyLayouts.d.ts.map +1 -1
  337. package/dist/components/RadioGroup/RadioGroup.d.ts +2 -2
  338. package/dist/components/RadioGroup/RadioGroup.d.ts.map +1 -1
  339. package/dist/components/RadioGroup/index.js +1 -1
  340. package/dist/components/RangeSlider/RangeSlider.d.ts +1 -1
  341. package/dist/components/RangeSlider/RangeSlider.d.ts.map +1 -1
  342. package/dist/components/RangeSlider/index.js +1 -1
  343. package/dist/components/ResizeHandle/ResizeHandle.d.ts +1 -1
  344. package/dist/components/ResizeHandle/ResizeHandle.d.ts.map +1 -1
  345. package/dist/components/ResizeHandle/index.js +1 -1
  346. package/dist/components/Select/Select.d.ts +3 -3
  347. package/dist/components/Select/Select.d.ts.map +1 -1
  348. package/dist/components/Select/index.js +1 -1
  349. package/dist/components/SelectionPanel/SelectionPanel.d.ts +1 -1
  350. package/dist/components/SelectionPanel/SelectionPanel.d.ts.map +1 -1
  351. package/dist/components/SelectionPanel/index.js +2 -2
  352. package/dist/components/SelectionPanel/renderLeaf.d.ts +7 -0
  353. package/dist/components/SelectionPanel/renderLeaf.d.ts.map +1 -1
  354. package/dist/components/Sidebar/Sidebar.d.ts +1 -1
  355. package/dist/components/Sidebar/Sidebar.d.ts.map +1 -1
  356. package/dist/components/Sidebar/index.js +1 -1
  357. package/dist/components/SidebarPanel/SidebarPanel.d.ts +2 -2
  358. package/dist/components/SidebarPanel/SidebarPanel.d.ts.map +1 -1
  359. package/dist/components/SidebarPanel/index.js +1 -1
  360. package/dist/components/Slider/Slider.d.ts +21 -3
  361. package/dist/components/Slider/Slider.d.ts.map +1 -1
  362. package/dist/components/Slider/index.js +1 -1
  363. package/dist/components/StatusBar/StatusBar.d.ts +3 -3
  364. package/dist/components/StatusBar/StatusBar.d.ts.map +1 -1
  365. package/dist/components/StatusBar/index.js +1 -1
  366. package/dist/components/SwatchGrid/index.js +1 -1
  367. package/dist/components/Switch/index.js +1 -1
  368. package/dist/components/Tabs/Tabs.d.ts +4 -4
  369. package/dist/components/Tabs/Tabs.d.ts.map +1 -1
  370. package/dist/components/Tabs/index.js +1 -1
  371. package/dist/components/ThemeSwitcher/ThemeSwitcher.d.ts +38 -0
  372. package/dist/components/ThemeSwitcher/ThemeSwitcher.d.ts.map +1 -0
  373. package/dist/components/ThemeSwitcher/index.d.ts +3 -0
  374. package/dist/components/ThemeSwitcher/index.d.ts.map +1 -0
  375. package/dist/components/ThemeSwitcher/index.js +2 -0
  376. package/dist/components/Timeline/Transport.d.ts.map +1 -1
  377. package/dist/components/Timeline/index.js +1 -1
  378. package/dist/components/Toast/Toast.d.ts +1 -1
  379. package/dist/components/Toast/Toast.d.ts.map +1 -1
  380. package/dist/components/Toast/index.js +1 -1
  381. package/dist/components/ToggleBar/index.js +1 -1
  382. package/dist/components/TokenPanel/TokenPanel.d.ts +1 -1
  383. package/dist/components/TokenPanel/TokenPanel.d.ts.map +1 -1
  384. package/dist/components/TokenPanel/index.js +1 -1
  385. package/dist/components/ToolButton/ToolButton.d.ts +1 -1
  386. package/dist/components/ToolButton/ToolButton.d.ts.map +1 -1
  387. package/dist/components/ToolButton/index.js +1 -1
  388. package/dist/components/ToolGroup/ToolGroup.d.ts +1 -1
  389. package/dist/components/ToolGroup/ToolGroup.d.ts.map +1 -1
  390. package/dist/components/ToolGroup/index.js +1 -1
  391. package/dist/components/ToolOptionsBar/ToolOptionsBar.d.ts +1 -1
  392. package/dist/components/ToolOptionsBar/ToolOptionsBar.d.ts.map +1 -1
  393. package/dist/components/ToolOptionsBar/index.js +1 -1
  394. package/dist/components/ToolPalette/ToolPalette.d.ts +3 -2
  395. package/dist/components/ToolPalette/ToolPalette.d.ts.map +1 -1
  396. package/dist/components/ToolPalette/index.js +2 -2
  397. package/dist/components/Tooltip/Tooltip.d.ts +2 -2
  398. package/dist/components/Tooltip/Tooltip.d.ts.map +1 -1
  399. package/dist/components/Tooltip/index.js +1 -1
  400. package/dist/components/Tree/index.js +1 -1
  401. package/dist/components/spin.d.ts +16 -0
  402. package/dist/components/spin.d.ts.map +1 -0
  403. package/dist/components/stanceSurfaces.d.ts.map +1 -1
  404. package/dist/icons/Icon.d.ts +1 -1
  405. package/dist/icons/Icon.d.ts.map +1 -1
  406. package/dist/icons/index.d.ts +52 -54
  407. package/dist/icons/index.d.ts.map +1 -1
  408. package/dist/icons/paths.d.ts +10 -0
  409. package/dist/icons/paths.d.ts.map +1 -1
  410. package/dist/index.d.ts +6 -2
  411. package/dist/index.d.ts.map +1 -1
  412. package/dist/index.js +86 -83
  413. package/dist/index.js.map +1 -1
  414. package/dist/overlays/portalHost.d.ts +1 -1
  415. package/dist/overlays/portalHost.d.ts.map +1 -1
  416. package/dist/paintGradientTrack.d.ts +5 -2
  417. package/dist/paintGradientTrack.d.ts.map +1 -1
  418. package/dist/style.css +1 -1
  419. package/dist/useReorderDragList.d.ts +1 -1
  420. package/dist/useReorderDragList.d.ts.map +1 -1
  421. package/package.json +9 -8
  422. package/dist/chunks/ActionBar-CYvfmEz0.js.map +0 -1
  423. package/dist/chunks/Badge-DZ0lFs14.js.map +0 -1
  424. package/dist/chunks/BandEditor-D-nVrVO4.js +0 -247
  425. package/dist/chunks/BandEditor-D-nVrVO4.js.map +0 -1
  426. package/dist/chunks/Button-Dyp31jMt.js.map +0 -1
  427. package/dist/chunks/ButtonBar-smZzFuEo.js.map +0 -1
  428. package/dist/chunks/Callout-xLjnx7Mp.js +0 -119
  429. package/dist/chunks/Callout-xLjnx7Mp.js.map +0 -1
  430. package/dist/chunks/Checkbox-ChZz30Ds.js.map +0 -1
  431. package/dist/chunks/Code-v4tDWuuN.js.map +0 -1
  432. package/dist/chunks/ColorField-DJSCuSJv.js +0 -60
  433. package/dist/chunks/ColorField-DJSCuSJv.js.map +0 -1
  434. package/dist/chunks/ColorModeControl-JOEiqtE0.js.map +0 -1
  435. package/dist/chunks/ComboBox-C1JgIpML.js.map +0 -1
  436. package/dist/chunks/CurveEditor-f1R4kSbD.js.map +0 -1
  437. package/dist/chunks/DataGrid-CZPrB_3a.js.map +0 -1
  438. package/dist/chunks/DetailList-DHaXX4TG.js +0 -43
  439. package/dist/chunks/DetailList-DHaXX4TG.js.map +0 -1
  440. package/dist/chunks/DetentSlider-BYyaZha6.js.map +0 -1
  441. package/dist/chunks/Dialog-GIvjoDQj.js +0 -66
  442. package/dist/chunks/Dialog-GIvjoDQj.js.map +0 -1
  443. package/dist/chunks/Disclosure-D79jhmh2.js.map +0 -1
  444. package/dist/chunks/DragGhost-DcU7cOwy.js.map +0 -1
  445. package/dist/chunks/DragHandleGlyph-BtBxHjZS.js.map +0 -1
  446. package/dist/chunks/Field-xbqRmjsI.js.map +0 -1
  447. package/dist/chunks/FillStrokeSwatch-BViKXIPx.js.map +0 -1
  448. package/dist/chunks/FontFamilySelect-r9TV_xIH.js.map +0 -1
  449. package/dist/chunks/GradientEditor-BRTxHG-W.js +0 -333
  450. package/dist/chunks/GradientEditor-BRTxHG-W.js.map +0 -1
  451. package/dist/chunks/Icon-BW0qv_U7.js.map +0 -1
  452. package/dist/chunks/InlineRange-BwGFDhpT.js.map +0 -1
  453. package/dist/chunks/Input-Bx2cuUbS.js.map +0 -1
  454. package/dist/chunks/ItemList-DzJ2lK0R.js.map +0 -1
  455. package/dist/chunks/ItemList.module-DDUXfuZL.js.map +0 -1
  456. package/dist/chunks/Jog-LPoac9s4.js.map +0 -1
  457. package/dist/chunks/Keycaps-CKiKOJnJ.js.map +0 -1
  458. package/dist/chunks/LayerList-BeGrkLb9.js.map +0 -1
  459. package/dist/chunks/ListEditor-C6zLzCsJ.js +0 -74
  460. package/dist/chunks/ListEditor-C6zLzCsJ.js.map +0 -1
  461. package/dist/chunks/MenuButton-BcdhrNGh.js.map +0 -1
  462. package/dist/chunks/MeshEditor-BOOIFWnz.js.map +0 -1
  463. package/dist/chunks/NumberField-C1Y7zP-a.js +0 -117
  464. package/dist/chunks/NumberField-C1Y7zP-a.js.map +0 -1
  465. package/dist/chunks/OptionsBar-DlcagPYK.js.map +0 -1
  466. package/dist/chunks/PaintField-B2mLRZa4.js.map +0 -1
  467. package/dist/chunks/PaintInput-BFKhd83I.js +0 -131
  468. package/dist/chunks/PaintInput-BFKhd83I.js.map +0 -1
  469. package/dist/chunks/PatternPicker-DdfpxoQy.js.map +0 -1
  470. package/dist/chunks/Plot2D-lyO7waPQ.js.map +0 -1
  471. package/dist/chunks/PointPlotter-DGs9i5P-.js.map +0 -1
  472. package/dist/chunks/Powerline-DBEPceLE.js +0 -38
  473. package/dist/chunks/Powerline-DBEPceLE.js.map +0 -1
  474. package/dist/chunks/Prefs-Ctu0H4-b.js.map +0 -1
  475. package/dist/chunks/Properties-Bbneh1ws.js.map +0 -1
  476. package/dist/chunks/PropertyField-CDb19d3F.js +0 -756
  477. package/dist/chunks/PropertyField-CDb19d3F.js.map +0 -1
  478. package/dist/chunks/RadioGroup-BK2mD6Q0.js.map +0 -1
  479. package/dist/chunks/RangeSlider-BiRAOsTh.js.map +0 -1
  480. package/dist/chunks/ResizeHandle-Cc6EOehs.js.map +0 -1
  481. package/dist/chunks/Select-DVValBe1.js +0 -225
  482. package/dist/chunks/Select-DVValBe1.js.map +0 -1
  483. package/dist/chunks/SelectionPanel-C5LmZA7b.js +0 -103
  484. package/dist/chunks/SelectionPanel-C5LmZA7b.js.map +0 -1
  485. package/dist/chunks/Sidebar-DKKd4R-x.js.map +0 -1
  486. package/dist/chunks/SidebarPanel-u5NsuAZY.js +0 -55
  487. package/dist/chunks/SidebarPanel-u5NsuAZY.js.map +0 -1
  488. package/dist/chunks/Slider-BwRrWHFW.js +0 -381
  489. package/dist/chunks/Slider-BwRrWHFW.js.map +0 -1
  490. package/dist/chunks/StatusBar-CdPdmmda.js.map +0 -1
  491. package/dist/chunks/Switch-DxF7TsEu.js.map +0 -1
  492. package/dist/chunks/Tabs-GXEfoe3o.js.map +0 -1
  493. package/dist/chunks/Timeline-SgmpQtUV.js.map +0 -1
  494. package/dist/chunks/Toast-BfcljZz6.js.map +0 -1
  495. package/dist/chunks/ToggleBar-Btnl5r7F.js.map +0 -1
  496. package/dist/chunks/TokenPanel-5ajHEHha.js.map +0 -1
  497. package/dist/chunks/ToolButton-rzqlFlAc.js.map +0 -1
  498. package/dist/chunks/ToolGroup-4bUBV5k6.js.map +0 -1
  499. package/dist/chunks/ToolOptionsBar-BF3TNXA3.js.map +0 -1
  500. package/dist/chunks/ToolPalette-Uw4PvWwa.js.map +0 -1
  501. package/dist/chunks/Tooltip-9XiJF937.js.map +0 -1
  502. package/dist/chunks/Tree-BGt6P8tI.js.map +0 -1
  503. package/dist/chunks/createKeyframeLayer-BzDRCrrh.js.map +0 -1
  504. package/dist/chunks/dlog-CMYiRF3Q.js.map +0 -1
  505. package/dist/chunks/formatShortcut-BoGqUoWi.js.map +0 -1
  506. package/dist/chunks/icons-DbScMMqX.js +0 -179
  507. package/dist/chunks/icons-DbScMMqX.js.map +0 -1
  508. package/dist/chunks/keyGlyph-CLvUHU8c.js.map +0 -1
  509. package/dist/chunks/model-BQMvTLnW.js.map +0 -1
  510. package/dist/chunks/number-6S8IzXVt.js +0 -89
  511. package/dist/chunks/number-6S8IzXVt.js.map +0 -1
  512. package/dist/chunks/paintPreview-DPtZS4yU.js.map +0 -1
  513. package/dist/chunks/paintValue-Bz6AVuh3.js.map +0 -1
  514. package/dist/chunks/portalHost-CjpCnuGU.js.map +0 -1
  515. package/dist/chunks/prefField-CLkhrvYl.js.map +0 -1
  516. package/dist/chunks/segmentTooltip-CAkZlW-t.js.map +0 -1
  517. package/dist/chunks/segmentedControl.module-D2nw68Yo.js +0 -11
  518. package/dist/chunks/segmentedControl.module-D2nw68Yo.js.map +0 -1
  519. package/dist/chunks/snap-DC4Km8xG.js.map +0 -1
  520. package/dist/chunks/stance-CarrcbbP.js.map +0 -1
  521. package/dist/chunks/useReorderDragList-Dcezzgix.js.map +0 -1
  522. package/dist/chunks/useRovingTabIndex-B4uJqiKP.js.map +0 -1
  523. package/dist/components/DragHandleGlyph/DragHandleGlyph.d.ts.map +0 -1
  524. package/dist/components/DragHandleGlyph/index.d.ts +0 -3
  525. package/dist/components/DragHandleGlyph/index.d.ts.map +0 -1
  526. package/dist/components/DragHandleGlyph/index.js +0 -2
  527. package/dist/format/number.d.ts +0 -56
  528. package/dist/format/number.d.ts.map +0 -1
  529. package/dist/icons/ShapeKindIcon.d.ts +0 -10
  530. package/dist/icons/ShapeKindIcon.d.ts.map +0 -1
@@ -1 +0,0 @@
1
- {"version":3,"file":"createKeyframeLayer-BzDRCrrh.js","names":[],"sources":["../../src/components/CurveEditor/hitTest.ts","../../src/handles.ts","../../src/components/CurveEditor/CurveEditor.module.css","../../src/components/CurveEditor/LayeredCurveEditor.tsx","../../src/components/CurveEditor/createKeyframeLayer.tsx"],"sourcesContent":["/**\n * Curve-specific hit tests. Generic coord transforms live in\n * `../Plot2D/geometry`; what's here is curve-only (anchor / polyline\n * proximity).\n */\nimport type { Point } from '../Plot2D/geometry';\n\n/**\n * Nearest-anchor hit test. Anchors are already in plot/screen coords.\n * Returns the index of the nearest anchor whose squared distance to\n * the pointer is ≤ radius². Null if no anchor is within radius.\n */\nexport function hitTestAnchor(\n anchors: readonly Point[],\n pointer: Point,\n radius: number,\n): { index: number } | null {\n const r2 = radius * radius;\n let best: { index: number; d2: number } | null = null;\n for (let i = 0; i < anchors.length; i++) {\n const a = anchors[i];\n const dx = a.x - pointer.x;\n const dy = a.y - pointer.y;\n const d2 = dx * dx + dy * dy;\n if (d2 > r2) continue;\n if (best === null || d2 < best.d2) best = { index: i, d2 };\n }\n return best ? { index: best.index } : null;\n}\n\n/**\n * Hit test against a per-segment sampled polyline. Each entry in\n * `segments` is the sample list for one segment (inclusive of\n * endpoints). Returns segment index + t (∈ [0, 1]) of the closest\n * point on the polyline within radius. Null if nothing is in range.\n *\n * Distance is measured to the line-segment chords between adjacent\n * samples, not just to the samples themselves — so sparse sampling\n * still produces accurate hits along the chord.\n */\nexport function hitTestCurve(\n segments: readonly (readonly Point[])[],\n pointer: Point,\n radius: number,\n): { segIdx: number; t: number } | null {\n const r2 = radius * radius;\n let best: { segIdx: number; t: number; d2: number } | null = null;\n for (let segIdx = 0; segIdx < segments.length; segIdx++) {\n const samples = segments[segIdx];\n if (samples.length < 2) continue;\n const last = samples.length - 1;\n for (let i = 0; i < last; i++) {\n const a = samples[i];\n const b = samples[i + 1];\n const abx = b.x - a.x;\n const aby = b.y - a.y;\n const apx = pointer.x - a.x;\n const apy = pointer.y - a.y;\n const ab2 = abx * abx + aby * aby;\n let u = ab2 > 0 ? (apx * abx + apy * aby) / ab2 : 0;\n if (u < 0) u = 0;\n else if (u > 1) u = 1;\n const cx = a.x + u * abx;\n const cy = a.y + u * aby;\n const dx = cx - pointer.x;\n const dy = cy - pointer.y;\n const d2 = dx * dx + dy * dy;\n if (d2 > r2) continue;\n const t = (i + u) / last;\n if (best === null || d2 < best.d2) best = { segIdx, t, d2 };\n }\n }\n return best ? { segIdx: best.segIdx, t: best.t } : null;\n}\n","import { tokenPx } from '@weasel-js/theme';\nimport type { ResolvedTheme } from '@weasel-js/theme';\n\n/**\n * The handle sizes the theme publishes: the default rank, the inert one a\n * locked or pinned point wears, and the emphasized one for a handle that is\n * its own category.\n */\nexport const HANDLE_SIZE_TOKENS = [\n '--wzl-handle-size', '--wzl-handle-size-sm', '--wzl-handle-size-lg',\n] as const;\n\n/** One of {@link HANDLE_SIZE_TOKENS}. */\nexport type HandleSizeToken = (typeof HANDLE_SIZE_TOKENS)[number];\n\n/**\n * A handle's edge in px, for code that draws a handle instead of styling one.\n *\n * CSS reaches `--wzl-handle-*` directly; SVG geometry attributes and canvas\n * cannot, so they come through here and the number stays written once, in the\n * theme definition.\n */\nexport function handleSize(token: HandleSizeToken, resolved?: ResolvedTheme): number {\n return tokenPx(token, resolved);\n}\n\n/** Half a handle's edge — what an SVG rect centered on a point offsets by. */\nexport function handleHalf(token: HandleSizeToken, resolved?: ResolvedTheme): number {\n return handleSize(token, resolved) / 2;\n}\n",".root {\n /* Component-local vars layered over the theme tokens. Each var resolves\n * to a semantic token from @weasel-js/theme; consumers override\n * either the curve-* var (component scope) or the wzl-* token (app\n * scope) without touching this file.\n *\n * Background / grid / axis tokens live on Plot2D now (this component\n * composes Plot2D, which paints the background and chrome). */\n --curve-line: var(--wzl-curve-color);\n --curve-line-width: var(--wzl-curve-width);\n --curve-fill: color-mix(in srgb, var(--curve-line) 30%, transparent);\n --curve-anchor-fill: var(--wzl-surface);\n --curve-anchor-stroke: var(--curve-line);\n --curve-anchor-active-fill: var(--curve-line);\n --curve-pinned-fill: var(--wzl-fg-subtle);\n}\n\n.fill {\n fill: var(--curve-fill);\n stroke: none;\n pointer-events: none;\n}\n\n.curve {\n stroke: var(--curve-line);\n stroke-width: var(--curve-line-width);\n fill: none;\n pointer-events: stroke;\n}\n\n.anchor {\n fill: var(--curve-anchor-fill);\n stroke: var(--curve-anchor-stroke);\n stroke-width: 1.5;\n cursor: grab;\n}\n\n.anchor:hover {\n fill: var(--curve-anchor-active-fill);\n}\n\n.anchor.active {\n fill: var(--curve-anchor-active-fill);\n cursor: grabbing;\n}\n\n.anchor.pinned {\n fill: var(--curve-pinned-fill);\n cursor: default;\n}\n\n/* Caller-set locked anchors share the gray pinned fill but signal\n * \"not interactive at all\" via the not-allowed cursor. */\n.anchor.locked {\n cursor: not-allowed;\n}\n\n/* Endpoint vertices render as diamonds (rotated squares) instead of\n * circles, so they read as a different category of handle. The shape\n * is enforced inline via SVG <rect transform>; this class only adds\n * the hover/active styling. */\n.endpoint {\n /* No fill / stroke overrides — endpoint visuals reuse .anchor /\n * .anchor.pinned / .anchor.active styling. The class exists as a\n * marker for future per-endpoint styling needs. */\n}\n\n/* When the consumer opts into hiding non-interactive handles, pinned\n * endpoints disappear entirely. */\n.hidden {\n display: none;\n}\n\n/* Focus is drawn on the mark itself: an outline on an SVG shape rings its\n bounding box, which the nearest scroll container clips. */\n.anchor:focus-visible {\n outline: none;\n stroke: var(--wzl-focus-ring);\n stroke-width: 2;\n}\n\n/* ── keyframe layer ─────────────────────────────────────────────────── */\n\n.keyframe {\n fill: var(--curve-key-fill, var(--wzl-fg-muted));\n cursor: grab;\n}\n\n.keyframe[aria-current='true'] { fill: var(--curve-selected, var(--wzl-accent-strong)); }\n.keyframe:focus-visible,\n.handle:focus-visible {\n outline: none;\n stroke: var(--wzl-focus-ring);\n stroke-width: 2;\n}\n\n.segmentTarget:focus-visible {\n outline: none;\n stroke: var(--wzl-focus-ring);\n stroke-opacity: 0.5;\n}\n\n/* The committed key holds while its ghost tracks the pointer, so a drag\n reads as a move from somewhere to somewhere. */\n.keyframe[data-dragging='true'] { opacity: 0.4; }\n\n.keyframeGhost {\n fill: var(--curve-selected-soft, var(--wzl-accent-soft));\n stroke: var(--curve-selected, var(--wzl-accent-strong));\n stroke-width: 1;\n stroke-dasharray: 2 2;\n pointer-events: none;\n}\n\n.segmentBand {\n fill: var(--curve-selected-soft, var(--wzl-accent-soft));\n pointer-events: none;\n}\n\n/* Carries focus and a name for each segment; hit testing is geometric. */\n.segmentTarget {\n fill: none;\n stroke: transparent;\n stroke-width: 8;\n pointer-events: none;\n}\n\n.handle {\n fill: var(--wzl-surface);\n stroke: var(--curve-selected, var(--wzl-accent-strong));\n stroke-width: 1;\n cursor: grab;\n}\n\n.handleStem {\n stroke: var(--curve-selected, var(--wzl-accent-strong));\n stroke-width: 1;\n pointer-events: none;\n}\n","import {\n useCallback, useEffect, useMemo, useRef, useState,\n type CSSProperties,\n type KeyboardEvent as ReactKeyboardEvent,\n type PointerEvent as ReactPointerEvent,\n type ReactNode,\n} from 'react';\nimport { openPointerSession, type PointerSession } from '@weasel-js/core';\nimport {\n Plot2D,\n type Plot2DHandle,\n type GridSettings,\n type AxesSettings,\n type TickSettings,\n} from '../Plot2D';\nimport {\n modelToPlot, plotToModel,\n type ModelRange,\n} from '../Plot2D/geometry';\nimport { dlog } from '../../dlog';\nimport s from './CurveEditor.module.css';\nimport type {\n CurveLayer, LayerCtx, LayerGesture, LayerModifiers, ModelPoint, PlotPoint,\n} from './layerTypes';\n\n/**\n * A layer paired with the state the consumer holds for it. The editor never\n * stores layer state itself.\n */\nexport interface LayerBinding<S = unknown> {\n layer: CurveLayer<S>;\n state: S;\n}\n\n/** Props for {@link LayeredCurveEditor}. */\nexport interface LayeredCurveEditorProps {\n /** Bottom-to-top render order: `layers[0]` paints first, `layers[N-1]`\n * paints on top. Hit-testing runs in reverse (topmost claim wins). */\n layers: ReadonlyArray<LayerBinding<unknown>>;\n\n /** Fires every frame during a gesture with the live in-flight state\n * for the layer that owns the gesture. */\n onLayerChange(id: string, next: unknown): void;\n\n /** Fires once per discrete user action (drag-end, one-shot insert,\n * delete) for the layer that produced the change. `prev` is the\n * layer's state at gesture start. */\n onLayerCommit?(id: string, next: unknown, prev: unknown): void;\n\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 grid?: GridSettings | false | null;\n axes?: AxesSettings | false | null;\n /** Ticks at x values. See `Plot2D.xTicks`. */\n xTicks?: TickSettings | false | null;\n /** Ticks at y values. See `Plot2D.yTicks`. */\n yTicks?: TickSettings | false | null;\n\n /** Built-in undo/redo via Cmd/Ctrl+Z (Shift+Z or Y for redo) on the\n * focused SVG. Snapshots every layer's state on each commit; undo\n * fires `onLayerChange(id, prevState)` for each layer whose state\n * changed. Default `true`. */\n history?: boolean;\n\n /** Accessible name for the plot, which is exposed as a group so the\n * focusable marks layers render inside it stay reachable. */\n 'aria-label'?: string;\n className?: string;\n style?: CSSProperties;\n\n /** Extra SVG content rendered behind all layers (under the lowest\n * layer but above grid/axes). Use this for static chrome that isn't\n * worth modeling as a layer. */\n children?: ReactNode;\n}\n\ninterface ActiveGesture {\n layerId: string;\n gesture: LayerGesture<unknown>;\n startStates: Map<string, unknown>;\n startSelfState: unknown;\n}\n\n/** A cancel carries no event, so a layer's `onCancel` sees no modifiers held. */\nconst NO_MODIFIERS: LayerModifiers = { shift: false, alt: false, meta: false, ctrl: false };\n\nfunction readModifiers(e: PointerEvent | ReactPointerEvent | KeyboardEvent | ReactKeyboardEvent): LayerModifiers {\n return {\n shift: e.shiftKey,\n alt: e.altKey,\n meta: e.metaKey,\n ctrl: e.ctrlKey,\n };\n}\n\n/**\n * A `Plot2D` that hosts a stack of composable curve layers. It owns the\n * pointer gestures and the coordinate mapping; each layer supplies its own\n * drawing, hit testing and gesture behavior.\n *\n * Layer state stays with the consumer: the editor reports changes through\n * `onLayerChange` during a gesture and `onLayerCommit` at its end, and reads\n * the state back from props each frame. That is what lets one layer's drag\n * update another layer's state mid-gesture.\n */\nexport function LayeredCurveEditor(props: LayeredCurveEditorProps) {\n const {\n layers, onLayerChange, onLayerCommit,\n width, height,\n xRange = [0, 1], yRange = [0, 1],\n grid, axes, xTicks, yTicks,\n className, style, children,\n } = props;\n\n const historyEnabled = props.history !== false;\n\n const modelRange: ModelRange = useMemo(\n () => ({ xMin: xRange[0], xMax: xRange[1], yMin: yRange[0], yMax: yRange[1] }),\n [xRange, yRange],\n );\n const plotSize = useMemo(() => ({ width, height }), [width, height]);\n\n // Refs that always hold the latest props — gesture handlers and\n // window listeners close over these refs, never over render-time\n // values, so mid-drag re-renders (including cross-layer state\n // updates) are visible to the next pointermove tick.\n const layersRef = useRef(layers);\n layersRef.current = layers;\n const modelRangeRef = useRef(modelRange);\n modelRangeRef.current = modelRange;\n const plotSizeRef = useRef(plotSize);\n plotSizeRef.current = plotSize;\n\n const plotRef = useRef<Plot2DHandle | null>(null);\n\n // ── Coord helpers ──────────────────────────────────────────────────\n const makeCtx = useCallback((modifiers: LayerModifiers): LayerCtx => {\n const mr = modelRangeRef.current;\n const ps = plotSizeRef.current;\n return {\n modelRange: mr,\n plotSize: ps,\n toPlot: (p) => modelToPlot(p, mr, ps),\n toModel: (p) => plotToModel(p, mr, ps),\n modifiers,\n };\n }, []);\n\n // ── Gesture routing ────────────────────────────────────────────────\n const activeRef = useRef(null as ActiveGesture | null);\n const [activeLayerId, setActiveLayerId] = useState<string | null>(null);\n\n // ── History (whole-state snapshots) ────────────────────────────────\n const pastRef = useRef<Map<string, unknown>[]>([]);\n const futureRef = useRef<Map<string, unknown>[]>([]);\n\n const snapshot = useCallback((): Map<string, unknown> => {\n const m = new Map<string, unknown>();\n for (const b of layersRef.current) m.set(b.layer.id, b.state);\n return m;\n }, []);\n\n const restore = useCallback((snap: Map<string, unknown>) => {\n const current = layersRef.current;\n for (const b of current) {\n const prev = snap.get(b.layer.id);\n if (prev !== undefined && prev !== b.state) {\n onLayerChange(b.layer.id, prev);\n }\n }\n }, [onLayerChange]);\n\n const undo = useCallback(() => {\n if (!historyEnabled) return;\n const past = pastRef.current;\n if (past.length === 0) return;\n const prev = past.pop()!;\n futureRef.current.push(snapshot());\n restore(prev);\n }, [historyEnabled, snapshot, restore]);\n\n const redo = useCallback(() => {\n if (!historyEnabled) return;\n const future = futureRef.current;\n if (future.length === 0) return;\n const next = future.pop()!;\n pastRef.current.push(snapshot());\n restore(next);\n }, [historyEnabled, snapshot, restore]);\n\n // ── Pointer routing during an active gesture ───────────────────────\n // The session's callbacks are fixed at gesture start, so they delegate\n // through refs holding the latest per-render impl — a mid-drag re-render\n // must reach the next pointermove tick.\n const onGestureMoveRef = useRef<(e: PointerEvent) => void>(() => {});\n const onGestureEndRef = useRef<(e: PointerEvent) => void>(() => {});\n const onGestureCancelRef = useRef<() => void>(() => {});\n\n const sessionRef = useRef<PointerSession | null>(null);\n\n const cleanupGesture = useCallback(() => {\n sessionRef.current = null;\n activeRef.current = null;\n setActiveLayerId(null);\n }, []);\n\n const findLayerState = useCallback((id: string): unknown | undefined => {\n for (const b of layersRef.current) if (b.layer.id === id) return b.state;\n return undefined;\n }, []);\n\n onGestureMoveRef.current = (e: PointerEvent) => {\n const a = activeRef.current;\n if (!a) return;\n const h = plotRef.current;\n if (!h) return;\n const model = h.clientToModel(e);\n const current = findLayerState(a.layerId);\n if (current === undefined) return;\n const ctx = makeCtx(readModifiers(e));\n const next = a.gesture.onMove(current, model, e, ctx);\n if (next !== current) onLayerChange(a.layerId, next);\n };\n\n onGestureEndRef.current = (e: PointerEvent) => {\n const a = activeRef.current;\n if (!a) return;\n const current = findLayerState(a.layerId);\n if (current === undefined) { cleanupGesture(); return; }\n const ctx = makeCtx(readModifiers(e));\n const finalState = a.gesture.onCommit ? a.gesture.onCommit(current, ctx) : current;\n if (finalState !== current) onLayerChange(a.layerId, finalState);\n if (historyEnabled) {\n pastRef.current.push(a.startStates);\n futureRef.current = [];\n }\n if (onLayerCommit) onLayerCommit(a.layerId, finalState, a.startSelfState);\n cleanupGesture();\n };\n\n onGestureCancelRef.current = () => {\n const a = activeRef.current;\n if (!a) return;\n const current = findLayerState(a.layerId);\n if (current === undefined) { cleanupGesture(); return; }\n const ctx = makeCtx(NO_MODIFIERS);\n const restored = a.gesture.onCancel ? a.gesture.onCancel(current, ctx) : a.startSelfState;\n if (restored !== current) onLayerChange(a.layerId, restored);\n cleanupGesture();\n };\n\n // No pointer capture: consumers render their own SVG chrome into the plot\n // through `children`, and capture would retarget pointerup away from it.\n const installGesture = useCallback((\n layerId: string,\n down: ReactPointerEvent<SVGSVGElement>,\n gesture: LayerGesture<unknown>,\n ) => {\n const startStates = snapshot();\n const startSelfState = startStates.get(layerId);\n activeRef.current = {\n layerId, gesture,\n startStates,\n startSelfState,\n };\n setActiveLayerId(layerId);\n sessionRef.current = openPointerSession(down.currentTarget, down, {\n onMove: (e) => onGestureMoveRef.current(e),\n onEnd: (e) => onGestureEndRef.current(e),\n onCancel: () => onGestureCancelRef.current(),\n }, { capture: false });\n }, [snapshot]);\n\n // ── pointerdown dispatch ───────────────────────────────────────────\n const onSvgPointerDown = useCallback((\n e: ReactPointerEvent<SVGSVGElement>,\n coords: { plot: PlotPoint; model: ModelPoint },\n ) => {\n if (activeRef.current) return; // ignore secondary touches mid-gesture\n const modifiers = readModifiers(e);\n const ctx = makeCtx(modifiers);\n const ls = layersRef.current;\n const nativeEvent = e.nativeEvent;\n\n dlog('layered-curve-editor', 'pointerdown', { plot: coords.plot, model: coords.model, layers: ls.length });\n\n // Capture the pre-event snapshot once; reuse for history if any\n // path produces a commit (gesture-start commit or one-shot).\n const preEventSnapshot = snapshot();\n\n // Top-to-bottom hit test.\n for (let i = ls.length - 1; i >= 0; i--) {\n const b = ls[i];\n const hit = b.layer.hitTest?.(b.state, coords.plot, ctx);\n if (!hit) continue;\n // Found a claim. onPointerDown may start a gesture, absorb the\n // click, or commit a one-shot edit via extra.commit.\n const prevState = b.state;\n let committed: unknown = undefined;\n const gesture = b.layer.onPointerDown?.(\n prevState, hit, nativeEvent, ctx,\n {\n plot: coords.plot,\n model: coords.model,\n commit(next) { committed = next; onLayerChange(b.layer.id, next); },\n },\n );\n e.stopPropagation();\n if (gesture) {\n installGesture(b.layer.id, e, gesture);\n return;\n }\n if (committed !== undefined) {\n if (historyEnabled) {\n pastRef.current.push(preEventSnapshot);\n futureRef.current = [];\n }\n onLayerCommit?.(b.layer.id, committed, prevState);\n }\n return;\n }\n\n // No hit — empty space dispatch, top-to-bottom.\n let pendingCommit: { id: string; next: unknown; prev: unknown } | null = null;\n for (let i = ls.length - 1; i >= 0; i--) {\n const b = ls[i];\n if (!b.layer.onEmptyPointerDown) continue;\n const prevState = b.state;\n let committed: unknown = undefined;\n const gesture = b.layer.onEmptyPointerDown(\n prevState, coords.model, nativeEvent, ctx,\n {\n plot: coords.plot,\n model: coords.model,\n commit(next) {\n committed = next;\n onLayerChange(b.layer.id, next);\n },\n },\n );\n if (gesture) {\n // If onEmptyPointerDown also published a commit (e.g. click-curve\n // insert publishes the new point then drags it), the gesture's\n // startStates already capture the post-insert state; the commit\n // for history is the *pre*-event snapshot, written when the\n // gesture eventually finishes via the gesture-commit path. We\n // override the gesture's startStates so undo restores correctly.\n installGesture(b.layer.id, e, gesture);\n if (committed !== undefined && activeRef.current !== null) {\n (activeRef.current as ActiveGesture).startStates = preEventSnapshot;\n (activeRef.current as ActiveGesture).startSelfState = preEventSnapshot.get(b.layer.id);\n }\n return;\n }\n if (committed !== undefined) {\n pendingCommit = { id: b.layer.id, next: committed, prev: prevState };\n break;\n }\n }\n if (pendingCommit) {\n if (historyEnabled) {\n pastRef.current.push(preEventSnapshot);\n futureRef.current = [];\n }\n onLayerCommit?.(pendingCommit.id, pendingCommit.next, pendingCommit.prev);\n }\n }, [makeCtx, installGesture, onLayerChange, onLayerCommit, historyEnabled, snapshot]);\n\n // ── keyboard ───────────────────────────────────────────────────────\n const onSvgKeyDown = useCallback((e: ReactKeyboardEvent<SVGSVGElement>) => {\n const modifiers = readModifiers(e);\n const ctx = makeCtx(modifiers);\n const ls = layersRef.current;\n // History first.\n if (historyEnabled && (e.metaKey || e.ctrlKey)) {\n const k = e.key.toLowerCase();\n if (k === 'z') {\n if (e.shiftKey) redo();\n else undo();\n e.preventDefault();\n return;\n }\n if (k === 'y') { redo(); e.preventDefault(); return; }\n }\n // Then layers (top-to-bottom).\n for (let i = ls.length - 1; i >= 0; i--) {\n const b = ls[i];\n if (!b.layer.onKeyDown) continue;\n const preEventSnapshot = snapshot();\n let committed: unknown = undefined;\n b.layer.onKeyDown(b.state, e.nativeEvent, ctx, {\n commit(next) { committed = next; onLayerChange(b.layer.id, next); },\n });\n if (committed !== undefined) {\n if (historyEnabled) {\n pastRef.current.push(preEventSnapshot);\n futureRef.current = [];\n }\n onLayerCommit?.(b.layer.id, committed, b.state);\n }\n // The layer prevents default on the native event, which the synthetic\n // event's `isDefaultPrevented` does not observe.\n if (e.nativeEvent.defaultPrevented) return;\n }\n }, [historyEnabled, undo, redo, makeCtx, snapshot, onLayerChange, onLayerCommit]);\n\n useEffect(() => () => { sessionRef.current?.cancel(); }, []);\n\n // ── render ─────────────────────────────────────────────────────────\n const renderCtxBase: Omit<LayerCtx, 'modifiers'> = useMemo(() => ({\n modelRange,\n plotSize,\n toPlot: (p) => modelToPlot(p, modelRange, plotSize),\n toModel: (p) => plotToModel(p, modelRange, plotSize),\n }), [modelRange, plotSize]);\n\n const cls = [s.root, className].filter(Boolean).join(' ');\n\n return (\n <Plot2D\n ref={plotRef}\n className={cls}\n style={style}\n width={width}\n height={height}\n xRange={xRange}\n yRange={yRange}\n grid={grid}\n axes={axes}\n xTicks={xTicks}\n yTicks={yTicks}\n tabIndex={historyEnabled ? 0 : undefined}\n role=\"group\"\n aria-label={props['aria-label']}\n onPointerDown={onSvgPointerDown}\n onKeyDown={onSvgKeyDown}\n >\n {children}\n {layers.map((b) => {\n const ctx = {\n ...renderCtxBase,\n modifiers: { shift: false, alt: false, meta: false, ctrl: false },\n isActive: activeLayerId === b.layer.id,\n };\n return (\n <g key={b.layer.id} data-layer-id={b.layer.id}>\n {b.layer.render(b.state, ctx)}\n </g>\n );\n })}\n </Plot2D>\n );\n}\n","/**\n * Keyframe layer for LayeredCurveEditor: a value-over-time curve whose shape\n * between two keys is the easing on the later one, with draggable keys and\n * draggable cubic-bezier handles on the selected segment.\n *\n * Distinct from `createFunctionLayer`, which interpolates a spline through\n * its anchors. Here the keys are exact and the easing approximates between\n * them, so the two do not share curve maths.\n */\nimport type { ReactNode } from 'react';\nimport { cubicBezierEasing, resolveEasing, type EasingFn, type Keyframe } from '@weasel-js/core';\nimport { hitTestAnchor, hitTestCurve } from './hitTest';\nimport { handleHalf } from '../../handles';\nimport { SNAP_RADIUS_PX, snapToNearest } from '../../snap';\nimport s from './CurveEditor.module.css';\nimport type {\n CurveLayer, EmptyDownArgs, KeyDownArgs, LayerCtx, LayerGesture, LayerHit, LayerRenderCtx, PlotPoint,\n} from './layerTypes';\n\ntype Bezier = readonly [number, number, number, number];\n\n/** A gesture in flight. The committed keys hold still underneath it. */\nexport type KeyframeDrag =\n | { kind: 'key'; index: number; t: number; value: number }\n | { kind: 'handle'; segment: number; bezier: Bezier };\n\n/**\n * The state a keyframe layer owns, held by the consumer and round-tripped\n * through `LayeredCurveEditor`'s `onLayerChange`.\n */\nexport interface KeyframeLayerState {\n /** Sorted ascending by `t`. */\n keys: readonly Keyframe<number>[];\n selectedKey: number | null;\n /** Index of the key the selected segment runs into. Its bezier handles show. */\n selectedSegment: number | null;\n drag: KeyframeDrag | null;\n}\n\n/** Configuration for {@link createKeyframeLayer}. */\nexport interface KeyframeLayerConfig {\n /** Layer id; default `'keyframes'`. */\n id?: string;\n /** Names the curve in each mark's accessible name. Default `'Curve'`. */\n label?: string;\n /** Formats a key time for accessible names. Default: rounded number. */\n formatX?: (x: number) => string;\n /** Times a dragged key snaps to. Holding alt defeats the snap. */\n snapX?: readonly number[];\n /** Snap reach, in plot pixels. Default 6. */\n snapRadiusPx?: number;\n /** Bounds for a key's time. Default: unbounded. */\n xClamp?: readonly [number, number];\n /** Bounds for a key's value. Default: unbounded. */\n yClamp?: readonly [number, number];\n /** One arrow-key step in model units; shift takes ten. Default: 1% of the\n * plot's range on that axis. */\n step?: { x?: number; y?: number };\n}\n\nconst SAMPLES_PER_SEGMENT = 16;\nconst KEY_HIT_PX = 8;\nconst HANDLE_HIT_PX = 8;\nconst CURVE_HIT_PX = 6;\nconst KEY_HALF = handleHalf('--wzl-handle-size');\nconst HANDLE_RADIUS = 3.5;\nconst SHIFT_MULTIPLIER = 10;\nconst HANDLE_STEP = 0.01;\n\n/** A keyframe layer state with nothing selected and no gesture in flight. */\nexport function keyframeLayerState(keys: readonly Keyframe<number>[]): KeyframeLayerState {\n return { keys, selectedKey: null, selectedSegment: null, drag: null };\n}\n\nfunction clampTo(v: number, range?: readonly [number, number]): number {\n return range ? Math.min(range[1], Math.max(range[0], v)) : v;\n}\n\nfunction bezierOf(key: Keyframe<number> | undefined): Bezier | null {\n const e = key?.easing;\n return typeof e === 'object' && e !== null && 'bezier' in e ? e.bezier : null;\n}\n\nfunction moveKeyTo(\n keys: readonly Keyframe<number>[], index: number, t: number, value: number,\n): { keys: Keyframe<number>[]; selectedKey: number } {\n const moved = { ...keys[index], t, value };\n const rest = keys.filter((_, i) => i !== index);\n const at = rest.findIndex((k) => k.t > t);\n const selectedKey = at === -1 ? rest.length : at;\n rest.splice(selectedKey, 0, moved);\n return { keys: rest, selectedKey };\n}\n\n/**\n * The keys a state's drag would leave behind: a dragged key re-sorted into\n * place, or a dragged handle's control points written onto the key its\n * segment runs into. `selectedKey` follows a moved key to its new index; a\n * key dropped where it started returns the same `keys` array.\n */\nexport function applyKeyframeDrag(\n state: KeyframeLayerState,\n): { keys: readonly Keyframe<number>[]; selectedKey: number | null } {\n const { drag, keys } = state;\n if (!drag) return { keys, selectedKey: state.selectedKey };\n if (drag.kind === 'key') {\n const k = keys[drag.index];\n if (k && k.t === drag.t && k.value === drag.value) return { keys, selectedKey: drag.index };\n return moveKeyTo(keys, drag.index, drag.t, drag.value);\n }\n const next = keys.slice();\n next[drag.segment] = { ...keys[drag.segment], easing: { bezier: drag.bezier } };\n return { keys: next, selectedKey: state.selectedKey };\n}\n\n/**\n * Builds a keyframe layer for `LayeredCurveEditor`. Model x is time and model\n * y is value; each segment is drawn through the easing on the key it runs\n * into. Every key, segment and handle is focusable and named, and the arrow\n * keys move whichever one has focus.\n */\nexport function createKeyframeLayer(cfg: KeyframeLayerConfig = {}): CurveLayer<KeyframeLayerState> {\n const id = cfg.id ?? 'keyframes';\n const label = cfg.label ?? 'Curve';\n const formatX = cfg.formatX ?? ((x: number) => String(Math.round(x)));\n const snapRadiusPx = cfg.snapRadiusPx ?? SNAP_RADIUS_PX;\n\n // A live handle drag is previewed straight from its control points: a\n // fresh spec per pointermove through `resolveEasing` would leave one\n // permanent cache entry per pixel of drag.\n function easingInto(state: KeyframeLayerState, keys: readonly Keyframe<number>[], seg: number): EasingFn {\n const d = state.drag;\n if (d?.kind === 'handle' && d.segment === seg) return cubicBezierEasing(...d.bezier);\n return resolveEasing(keys[seg].easing);\n }\n\n function segmentSamples(state: KeyframeLayerState, keys: readonly Keyframe<number>[], ctx: LayerCtx): PlotPoint[][] {\n const out: PlotPoint[][] = [];\n for (let i = 1; i < keys.length; i++) {\n const a = keys[i - 1];\n const b = keys[i];\n const ease = easingInto(state, keys, i);\n const pts: PlotPoint[] = [];\n for (let j = 0; j <= SAMPLES_PER_SEGMENT; j++) {\n const u = j / SAMPLES_PER_SEGMENT;\n pts.push(ctx.toPlot({ x: a.t + (b.t - a.t) * u, y: a.value + (b.value - a.value) * ease(u) }));\n }\n out.push(pts);\n }\n return out;\n }\n\n function activeBezier(state: KeyframeLayerState): Bezier | null {\n const seg = state.selectedSegment;\n if (seg === null || seg < 1 || seg >= state.keys.length) return null;\n const d = state.drag;\n if (d?.kind === 'handle' && d.segment === seg) return d.bezier;\n return bezierOf(state.keys[seg]);\n }\n\n function handlePoints(state: KeyframeLayerState, bezier: Bezier, ctx: LayerCtx): [PlotPoint, PlotPoint] {\n const a = state.keys[state.selectedSegment! - 1];\n const b = state.keys[state.selectedSegment!];\n const at = (xf: number, yf: number) =>\n ctx.toPlot({ x: a.t + xf * (b.t - a.t), y: a.value + yf * (b.value - a.value) });\n return [at(bezier[0], bezier[1]), at(bezier[2], bezier[3])];\n }\n\n const path = (pts: readonly PlotPoint[]): string =>\n pts.map((p, i) => `${i === 0 ? 'M' : 'L'}${p.x.toFixed(2)},${p.y.toFixed(2)}`).join('');\n\n // ── render ──────────────────────────────────────────────────────────\n function render(state: KeyframeLayerState, ctx: LayerRenderCtx): ReactNode {\n const shown = state.drag?.kind === 'key' ? applyKeyframeDrag(state).keys : state.keys;\n const segments = segmentSamples(state, shown, ctx);\n const curve = segments.flatMap((pts, i) => (i === 0 ? pts : pts.slice(1)));\n const seg = state.selectedSegment;\n const bezier = activeBezier(state);\n const dragIndex = state.drag?.kind === 'key' ? state.drag.index : null;\n\n return (\n <>\n {seg !== null && seg >= 1 && seg < shown.length ? (() => {\n const x0 = ctx.toPlot({ x: shown[seg - 1].t, y: 0 }).x;\n const x1 = ctx.toPlot({ x: shown[seg].t, y: 0 }).x;\n return (\n <rect\n className={s.segmentBand}\n x={Math.min(x0, x1)}\n y={0}\n width={Math.abs(x1 - x0)}\n height={ctx.plotSize.height}\n />\n );\n })() : null}\n {curve.length > 1 ? <path data-curve-element=\"curve\" className={s.curve} d={path(curve)} /> : null}\n {segments.map((pts, i) => (\n <path\n key={`seg-${i + 1}`}\n className={s.segmentTarget}\n d={path(pts)}\n role=\"button\"\n tabIndex={0}\n aria-label={`${label} segment into ${formatX(shown[i + 1].t)}`}\n aria-current={seg === i + 1 ? 'true' : undefined}\n data-segment-index={i + 1}\n />\n ))}\n {bezier ? (() => {\n const [h1, h2] = handlePoints(state, bezier, ctx);\n const a = ctx.toPlot({ x: state.keys[seg! - 1].t, y: state.keys[seg! - 1].value });\n const b = ctx.toPlot({ x: state.keys[seg!].t, y: state.keys[seg!].value });\n return (\n <>\n <line className={s.handleStem} x1={a.x} y1={a.y} x2={h1.x} y2={h1.y} />\n <line className={s.handleStem} x1={b.x} y1={b.y} x2={h2.x} y2={h2.y} />\n {[h1, h2].map((h, i) => (\n <circle\n key={`handle-${i}`}\n className={s.handle}\n cx={h.x}\n cy={h.y}\n r={HANDLE_RADIUS}\n role=\"button\"\n tabIndex={0}\n aria-label={`${label} bezier handle ${i + 1}`}\n data-handle-index={i}\n />\n ))}\n </>\n );\n })() : null}\n {state.keys.map((k, i) => {\n const p = ctx.toPlot({ x: k.t, y: k.value });\n return (\n <rect\n key={`key-${i}`}\n className={s.keyframe}\n x={p.x - KEY_HALF}\n y={p.y - KEY_HALF}\n width={KEY_HALF * 2}\n height={KEY_HALF * 2}\n transform={`rotate(45 ${p.x} ${p.y})`}\n role=\"button\"\n tabIndex={0}\n aria-label={`${label} key at ${formatX(k.t)}`}\n aria-current={state.selectedKey === i ? 'true' : undefined}\n data-keyframe-index={i}\n data-dragging={dragIndex === i ? 'true' : undefined}\n />\n );\n })}\n {state.drag?.kind === 'key' ? (() => {\n const p = ctx.toPlot({ x: state.drag.t, y: state.drag.value });\n return (\n <rect\n aria-hidden=\"true\"\n className={s.keyframeGhost}\n x={p.x - KEY_HALF}\n y={p.y - KEY_HALF}\n width={KEY_HALF * 2}\n height={KEY_HALF * 2}\n transform={`rotate(45 ${p.x} ${p.y})`}\n data-keyframe-ghost=\"\"\n />\n );\n })() : null}\n </>\n );\n }\n\n // ── hit test ────────────────────────────────────────────────────────\n function hitTest(state: KeyframeLayerState, plot: PlotPoint, ctx: LayerCtx): LayerHit | null {\n const bezier = activeBezier(state);\n if (bezier) {\n const h = hitTestAnchor(handlePoints(state, bezier, ctx), plot, HANDLE_HIT_PX);\n if (h) return { kind: 'handle', payload: { handle: h.index } };\n }\n const k = hitTestAnchor(state.keys.map((key) => ctx.toPlot({ x: key.t, y: key.value })), plot, KEY_HIT_PX);\n if (k) return { kind: 'key', payload: { index: k.index } };\n const c = hitTestCurve(segmentSamples(state, state.keys, ctx), plot, CURVE_HIT_PX);\n if (c) return { kind: 'segment', payload: { segment: c.segIdx + 1 } };\n return null;\n }\n\n // ── gestures ────────────────────────────────────────────────────────\n function keyGesture(index: number): LayerGesture<KeyframeLayerState> {\n return {\n onMove(state, model, e, ctx) {\n let t = clampTo(model.x, cfg.xClamp);\n if (cfg.snapX && !e.altKey) {\n const perPx = (ctx.modelRange.xMax - ctx.modelRange.xMin) / ctx.plotSize.width;\n t = clampTo(snapToNearest(t, cfg.snapX, Math.abs(perPx) * snapRadiusPx), cfg.xClamp);\n }\n return { ...state, drag: { kind: 'key', index, t, value: clampTo(model.y, cfg.yClamp) } };\n },\n onCommit(state) { return { ...state, ...applyKeyframeDrag(state), drag: null }; },\n onCancel(state) { return { ...state, drag: null }; },\n };\n }\n\n function handleGesture(segment: number, handle: 0 | 1): LayerGesture<KeyframeLayerState> {\n return {\n onMove(state, model) {\n const a = state.keys[segment - 1];\n const b = state.keys[segment];\n const d = state.drag;\n if (!a || !b || d?.kind !== 'handle') return state;\n const xf = b.t === a.t ? 0 : Math.min(1, Math.max(0, (model.x - a.t) / (b.t - a.t)));\n const yf = b.value === a.value ? 0 : (model.y - a.value) / (b.value - a.value);\n const bezier = [...d.bezier] as [number, number, number, number];\n bezier[handle * 2] = xf;\n bezier[handle * 2 + 1] = yf;\n return { ...state, drag: { kind: 'handle', segment, bezier } };\n },\n onCommit(state) { return { ...state, ...applyKeyframeDrag(state), drag: null }; },\n onCancel(state) { return { ...state, drag: null }; },\n };\n }\n\n function onPointerDown(\n state: KeyframeLayerState,\n hit: LayerHit,\n e: PointerEvent,\n _ctx: LayerCtx,\n extra: EmptyDownArgs<KeyframeLayerState>,\n ): LayerGesture<KeyframeLayerState> | void {\n if (e.button !== 0) return;\n if (hit.kind === 'handle') {\n const bezier = activeBezier(state);\n const segment = state.selectedSegment;\n if (!bezier || segment === null) return;\n const { handle } = hit.payload as { handle: 0 | 1 };\n extra.commit({ ...state, drag: { kind: 'handle', segment, bezier } });\n return handleGesture(segment, handle);\n }\n if (hit.kind === 'key') {\n const { index } = hit.payload as { index: number };\n const k = state.keys[index];\n extra.commit({ ...state, selectedKey: index, drag: { kind: 'key', index, t: k.t, value: k.value } });\n return keyGesture(index);\n }\n if (hit.kind === 'segment') {\n const { segment } = hit.payload as { segment: number };\n extra.commit({ ...state, selectedSegment: segment });\n }\n }\n\n // ── keyboard ────────────────────────────────────────────────────────\n function onKeyDown(\n state: KeyframeLayerState,\n e: KeyboardEvent,\n ctx: LayerCtx,\n extra: KeyDownArgs<KeyframeLayerState>,\n ): void {\n const target = e.target as Element | null;\n if (target?.closest?.('[data-layer-id]')?.getAttribute('data-layer-id') !== id) return;\n const activate = e.key === 'Enter' || e.key === ' ';\n const dx = e.key === 'ArrowRight' ? 1 : e.key === 'ArrowLeft' ? -1 : 0;\n const dy = e.key === 'ArrowUp' ? 1 : e.key === 'ArrowDown' ? -1 : 0;\n const mult = e.shiftKey ? SHIFT_MULTIPLIER : 1;\n\n const keyEl = target.closest('[data-keyframe-index]');\n if (keyEl) {\n const index = Number(keyEl.getAttribute('data-keyframe-index'));\n const k = state.keys[index];\n if (!k) return;\n if (activate) {\n e.preventDefault();\n extra.commit({ ...state, selectedKey: index });\n return;\n }\n if (dx === 0 && dy === 0) return;\n e.preventDefault();\n const m = ctx.modelRange;\n const stepX = (cfg.step?.x ?? Math.abs(m.xMax - m.xMin) / 100) * mult;\n const stepY = (cfg.step?.y ?? Math.abs(m.yMax - m.yMin) / 100) * mult;\n const t = clampTo(k.t + dx * stepX, cfg.xClamp);\n const value = clampTo(k.value + dy * stepY, cfg.yClamp);\n if (t === k.t && value === k.value) return;\n extra.commit({ ...state, ...moveKeyTo(state.keys, index, t, value), drag: null });\n return;\n }\n\n const segEl = target.closest('[data-segment-index]');\n if (segEl && activate) {\n e.preventDefault();\n extra.commit({ ...state, selectedSegment: Number(segEl.getAttribute('data-segment-index')) });\n return;\n }\n\n const handleEl = target.closest('[data-handle-index]');\n const bezier = activeBezier(state);\n if (handleEl && bezier && state.selectedSegment !== null && (dx !== 0 || dy !== 0)) {\n e.preventDefault();\n const h = Number(handleEl.getAttribute('data-handle-index'));\n const next = [...bezier] as [number, number, number, number];\n next[h * 2] = Math.min(1, Math.max(0, next[h * 2] + dx * HANDLE_STEP * mult));\n next[h * 2 + 1] += dy * HANDLE_STEP * mult;\n const drag: KeyframeDrag = { kind: 'handle', segment: state.selectedSegment, bezier: next };\n extra.commit({ ...state, ...applyKeyframeDrag({ ...state, drag }), drag: null });\n }\n }\n\n return { id, render, hitTest, onPointerDown, onKeyDown };\n}\n"],"mappings":";;;;;;;;AAYA,SAAgB,EACd,GACA,GACA,GAC0B;CAC1B,IAAM,IAAK,IAAS,GAChB,IAA6C;AACjD,MAAK,IAAI,IAAI,GAAG,IAAI,EAAQ,QAAQ,KAAK;EACvC,IAAM,IAAI,EAAQ,IACZ,IAAK,EAAE,IAAI,EAAQ,GACnB,IAAK,EAAE,IAAI,EAAQ,GACnB,IAAK,IAAK,IAAK,IAAK;AACtB,MAAK,MACL,MAAS,QAAQ,IAAK,EAAK,QAAI,IAAO;GAAE,OAAO;GAAG;GAAI;;AAE5D,QAAO,IAAO,EAAE,OAAO,EAAK,OAAO,GAAG;;AAaxC,SAAgB,EACd,GACA,GACA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-CMYiRF3Q.js","names":[],"sources":["../../src/dlog.ts"],"sourcesContent":["/**\n * Namespaced, opt-in console tracing. Off by default; production builds\n * may strip the calls entirely depending on the bundler.\n *\n * Enable in the browser:\n *\n * localStorage.setItem('weasel.debug', '*') // all namespaces\n * localStorage.setItem('weasel.debug', 'curve-editor') // just curve editor\n * localStorage.setItem('weasel.debug', 'curve-editor,layer-stack')\n *\n * Each component picks a stable namespace and calls `dlog(namespace, ...)`.\n * Useful for tracing pointer/event flows that are hard to capture\n * post-hoc (drag handlers, gesture sequences, selection mutations).\n *\n * The flag is read once and cached for the page session — reload to\n * pick up changes. Cheap hot-path checks (one nullish-coalesce + Set\n * lookup) so leaving calls in place is fine.\n *\n * Mirrors `src/debug/flag.ts` in the kit. Two impls live here because\n * weasel-ui doesn't depend on the kit, but both read the same\n * localStorage keys so behavior is uniform. See the kit copy for the\n * canonical list of kit-level namespaces.\n *\n * Known weasel-ui namespaces:\n * - plot2d — Plot2D mount / unmount\n * - curve-editor — CurveEditor pointer flow\n */\n\nconst KEYS = ['weasel.debug', 'weaseldraw.debug'] as const;\n\ninterface Cached {\n all: boolean;\n set: Set<string>;\n}\n\nlet cached: Cached | null = null;\n\nfunction read(): Cached {\n const empty: Cached = { all: false, set: new Set() };\n if (typeof localStorage === 'undefined') return empty;\n try {\n for (const k of KEYS) {\n const v = localStorage.getItem(k);\n if (v == null || v === '') continue;\n if (v === '1' || v === 'true' || v === '*') return { all: true, set: new Set() };\n return { all: false, set: new Set(v.split(/[\\s,]+/).filter(Boolean)) };\n }\n return empty;\n } catch {\n return empty;\n }\n}\n\nfunction get(): Cached {\n if (cached === null) cached = read();\n return cached;\n}\n\n/** True when `namespace` (or `*`) is enabled. */\nexport function isDebugEnabled(namespace: string): boolean {\n const c = get();\n return c.all || c.set.has(namespace);\n}\n\n/** Conditional `console.debug` — no-op unless `namespace` (or `*`) is enabled.\n * Each call is prefixed with `[namespace]` so the source is searchable. */\nexport function dlog(namespace: string, ...args: unknown[]): void {\n if (!isDebugEnabled(namespace)) return;\n // eslint-disable-next-line no-console\n console.debug(`[${namespace}]`, ...args);\n}\n"],"mappings":";AA4BA,IAAM,IAAO,CAAC,gBAAgB,mBAAmB,EAO7C,IAAwB;AAE5B,SAAS,IAAe;CACtB,IAAM,IAAgB;EAAE,KAAK;EAAO,qBAAK,IAAI,KAAK;EAAE;AACpD,KAAI,OAAO,eAAiB,IAAa,QAAO;AAChD,KAAI;AACF,OAAK,IAAM,KAAK,GAAM;GACpB,IAAM,IAAI,aAAa,QAAQ,EAAE;AAC7B,cAAK,QAAQ,MAAM,IAEvB,QADI,MAAM,OAAO,MAAM,UAAU,MAAM,MAAY;IAAE,KAAK;IAAM,qBAAK,IAAI,KAAK;IAAE,GACzE;IAAE,KAAK;IAAO,KAAK,IAAI,IAAI,EAAE,MAAM,SAAS,CAAC,OAAO,QAAQ,CAAC;IAAE;;AAExE,SAAO;SACD;AACN,SAAO;;;AAIX,SAAS,IAAc;AAErB,QADI,MAAW,SAAM,IAAS,GAAM,GAC7B;;AAIT,SAAgB,EAAe,GAA4B;CACzD,IAAM,IAAI,GAAK;AACf,QAAO,EAAE,OAAO,EAAE,IAAI,IAAI,EAAU;;AAKtC,SAAgB,EAAK,GAAmB,GAAG,GAAuB;AAC3D,GAAe,EAAU,IAE9B,QAAQ,MAAM,IAAI,EAAU,IAAI,GAAG,EAAK"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"formatShortcut-BoGqUoWi.js","names":[],"sources":["../../src/components/ToolPalette/formatShortcut.ts"],"sourcesContent":["import { keyGlyph } from '../Keycaps/keyGlyph';\n\nexport interface ShortcutInput {\n key: string | readonly string[];\n mod?: boolean;\n alt?: boolean;\n shift?: boolean | 'optional';\n}\n\n/** Format a shortcut as an array of display chips, one per key — modifier\n * icons (⌘, ↑, ⌥) followed by the key glyph. UIs that want a boxed\n * per-key look render each chip in its own element. `shift: 'optional'` is\n * treated as falsy. */\nexport function formatShortcutParts(b: ShortcutInput | undefined): readonly string[] | undefined {\n if (!b) return undefined;\n const rawKey = Array.isArray(b.key) ? b.key[0] : (b.key as string);\n const parts: string[] = [];\n if (b.mod) parts.push('⌘');\n if (b.shift === true) parts.push('⇧');\n if (b.alt) parts.push('⌥');\n parts.push(keyGlyph(rawKey));\n return parts;\n}\n\n/** Format a shortcut as a single display string. Order: mod, shift, alt,\n * key. Returns `undefined` for `undefined` input so callers can `??` a\n * fallback. When `key` is an array, the first element is used. `shift: 'optional'`\n * is treated as falsy. */\nexport function formatShortcut(b: ShortcutInput | undefined): string | undefined {\n const parts = formatShortcutParts(b);\n return parts ? parts.join('') : undefined;\n}\n"],"mappings":";;AAaA,SAAgB,EAAoB,GAA6D;AAC/F,KAAI,CAAC,EAAG;CACR,IAAM,IAAS,MAAM,QAAQ,EAAE,IAAI,GAAG,EAAE,IAAI,KAAM,EAAE,KAC9C,IAAkB,EAAE;AAK1B,QAJI,EAAE,OAAK,EAAM,KAAK,IAAI,EACtB,EAAE,UAAU,MAAM,EAAM,KAAK,IAAI,EACjC,EAAE,OAAK,EAAM,KAAK,IAAI,EAC1B,EAAM,KAAK,EAAS,EAAO,CAAC,EACrB;;AAOT,SAAgB,EAAe,GAAkD;CAC/E,IAAM,IAAQ,EAAoB,EAAE;AACpC,QAAO,IAAQ,EAAM,KAAK,GAAG,GAAG,KAAA"}
@@ -1,179 +0,0 @@
1
- import { t as e } from "./Icon-BW0qv_U7.js";
2
- import { AlignBottomIcon as t, AlignCenterXIcon as n, AlignCenterYIcon as ee, AlignLeftIcon as te, AlignRightIcon as ne, AlignTopIcon as r, ArrowIcon as i, BringForwardIcon as a, BringToFrontIcon as o, CopyIcon as s, CutIcon as c, DeleteIcon as l, DistributeHorizontalIcon as u, DistributeVerticalIcon as d, DuplicateIcon as f, EllipseIcon as p, EllipseIcon as m, EyedropperIcon as h, FlipXIcon as g, FlipYIcon as _, GroupIcon as v, HandIcon as y, ImageIcon as b, ImageIcon as x, LassoIcon as S, LassoIcon as C, LineIcon as w, LineIcon as T, PasteIcon as E, PenIcon as D, PenIcon as O, PencilIcon as k, PencilIcon as A, PolygonIcon as j, PolygonIcon as M, RectIcon as N, RectIcon as P, RedoIcon as F, SelectIcon as I, SendBackwardIcon as L, SendToBackIcon as R, StarIcon as z, StarIcon as B, TextIcon as V, TextIcon as H, UndoIcon as U, UngroupIcon as W, UnknownIcon as G, UnknownIcon as K } from "@weasel-js/core";
3
- import { jsx as q } from "react/jsx-runtime";
4
- //#region src/icons/ShapeKindIcon.tsx
5
- var J = {
6
- rect: N,
7
- ellipse: p,
8
- line: w,
9
- polygon: j,
10
- star: z,
11
- pen: D,
12
- pencil: k,
13
- lasso: S,
14
- text: V,
15
- image: b
16
- };
17
- function Y({ kind: e, ...t }) {
18
- return /* @__PURE__ */ q(J[e] ?? G, { ...t });
19
- }
20
- //#endregion
21
- //#region src/icons/index.tsx
22
- var X = (t) => /* @__PURE__ */ q(e, {
23
- name: "clone",
24
- ...t
25
- }), Z = (t) => /* @__PURE__ */ q(e, {
26
- name: "reset",
27
- ...t
28
- }), re = (t) => /* @__PURE__ */ q(e, {
29
- name: "close",
30
- ...t
31
- }), Q = (t) => /* @__PURE__ */ q(e, {
32
- name: "export",
33
- ...t
34
- }), ie = (t) => /* @__PURE__ */ q(e, {
35
- name: "zoomIn",
36
- ...t
37
- }), ae = (t) => /* @__PURE__ */ q(e, {
38
- name: "pan",
39
- ...t
40
- }), oe = (t) => /* @__PURE__ */ q(e, {
41
- name: "add",
42
- ...t
43
- }), se = (t) => /* @__PURE__ */ q(e, {
44
- name: "modeLight",
45
- ...t
46
- }), ce = (t) => /* @__PURE__ */ q(e, {
47
- name: "modeDark",
48
- ...t
49
- }), le = (t) => /* @__PURE__ */ q(e, {
50
- name: "modeAuto",
51
- ...t
52
- }), ue = (t) => /* @__PURE__ */ q(e, {
53
- name: "remove",
54
- ...t
55
- }), de = (t) => /* @__PURE__ */ q(e, {
56
- name: "sort",
57
- ...t
58
- }), fe = (t) => /* @__PURE__ */ q(e, {
59
- name: "zoomOut",
60
- ...t
61
- }), pe = (t) => /* @__PURE__ */ q(e, {
62
- name: "fit",
63
- ...t
64
- }), me = (t) => /* @__PURE__ */ q(e, {
65
- name: "snapshot",
66
- ...t
67
- }), he = (t) => /* @__PURE__ */ q(e, {
68
- name: "play",
69
- ...t
70
- }), ge = (t) => /* @__PURE__ */ q(e, {
71
- name: "pause",
72
- ...t
73
- }), _e = (t) => /* @__PURE__ */ q(e, {
74
- name: "stop",
75
- ...t
76
- }), ve = (t) => /* @__PURE__ */ q(e, {
77
- name: "stepBack",
78
- ...t
79
- }), $ = (t) => /* @__PURE__ */ q(e, {
80
- name: "stepForward",
81
- ...t
82
- }), ye = $, be = (t) => /* @__PURE__ */ q(e, {
83
- name: "crosshair",
84
- ...t
85
- }), xe = (t) => /* @__PURE__ */ q(e, {
86
- name: "fullscreen",
87
- ...t
88
- }), Se = (t) => /* @__PURE__ */ q(e, {
89
- name: "compare",
90
- ...t
91
- }), Ce = (t) => /* @__PURE__ */ q(e, {
92
- name: "filter",
93
- ...t
94
- }), we = (t) => /* @__PURE__ */ q(e, {
95
- name: "search",
96
- ...t
97
- }), Te = (t) => /* @__PURE__ */ q(e, {
98
- name: "loupe",
99
- ...t
100
- }), Ee = (t) => /* @__PURE__ */ q(e, {
101
- name: "layers",
102
- ...t
103
- }), De = (t) => /* @__PURE__ */ q(e, {
104
- name: "page",
105
- ...t
106
- }), Oe = (t) => /* @__PURE__ */ q(e, {
107
- name: "lock",
108
- ...t
109
- }), ke = (t) => /* @__PURE__ */ q(e, {
110
- name: "unlock",
111
- ...t
112
- }), Ae = (t) => /* @__PURE__ */ q(e, {
113
- name: "visible",
114
- ...t
115
- }), je = (t) => /* @__PURE__ */ q(e, {
116
- name: "hidden",
117
- ...t
118
- }), Me = (t) => /* @__PURE__ */ q(e, {
119
- name: "pin",
120
- ...t
121
- }), Ne = (t) => /* @__PURE__ */ q(e, {
122
- name: "link",
123
- ...t
124
- }), Pe = (t) => /* @__PURE__ */ q(e, {
125
- name: "collapse",
126
- ...t
127
- }), Fe = (t) => /* @__PURE__ */ q(e, {
128
- name: "expand",
129
- ...t
130
- }), Ie = (t) => /* @__PURE__ */ q(e, {
131
- name: "chevron",
132
- ...t
133
- }), Le = (t) => /* @__PURE__ */ q(e, {
134
- name: "tune",
135
- ...t
136
- }), Re = (t) => /* @__PURE__ */ q(e, {
137
- name: "grid",
138
- ...t
139
- }), ze = (t) => /* @__PURE__ */ q(e, {
140
- name: "snap",
141
- ...t
142
- }), Be = (t) => /* @__PURE__ */ q(e, {
143
- name: "measure",
144
- ...t
145
- }), Ve = (t) => /* @__PURE__ */ q(e, {
146
- name: "randomize",
147
- ...t
148
- }), He = (t) => /* @__PURE__ */ q(e, {
149
- name: "refresh",
150
- ...t
151
- }), Ue = (t) => /* @__PURE__ */ q(e, {
152
- name: "info",
153
- ...t
154
- }), We = (t) => /* @__PURE__ */ q(e, {
155
- name: "warning",
156
- ...t
157
- }), Ge = (t) => /* @__PURE__ */ q(e, {
158
- name: "error",
159
- ...t
160
- }), Ke = (t) => /* @__PURE__ */ q(e, {
161
- name: "busy",
162
- ...t
163
- }), qe = (t) => /* @__PURE__ */ q(e, {
164
- name: "check",
165
- ...t
166
- }), Je = (t) => /* @__PURE__ */ q(e, {
167
- name: "layoutRows",
168
- ...t
169
- }), Ye = (t) => /* @__PURE__ */ q(e, {
170
- name: "layoutColumns",
171
- ...t
172
- }), Xe = (t) => /* @__PURE__ */ q(e, {
173
- name: "layoutGrid",
174
- ...t
175
- });
176
- //#endregion
177
- export { se as $, Ce as A, W as At, Ue as B, d as C, ve as Ct, Fe as D, H as Dt, Ge as E, _e as Et, Re as F, ie as Ft, Je as G, Ee as H, v as I, fe as It, Oe as J, T as K, y as L, Y as Lt, g as M, ke as Mt, _ as N, Ae as Nt, Q as O, Le as Ot, xe as P, We as Pt, ce as Q, je as R, u as S, B as St, m as T, ye as Tt, Ye as U, C as V, Xe as W, Be as X, Te as Y, le as Z, Se as _, L as _t, te as a, A as at, c as b, me as bt, i as c, M as ct, Ke as d, F as dt, De as et, qe as f, He as ft, Pe as g, I as gt, re as h, we as ht, ee as i, O as it, pe as j, K as jt, h as k, U as kt, a as l, Ve as lt, X as m, Z as mt, t as n, E as nt, ne as o, Me as ot, Ie as p, ue as pt, Ne as q, n as r, ge as rt, r as s, he as st, oe as t, ae as tt, o as u, P as ut, s as v, R as vt, f as w, $ as wt, l as x, de as xt, be as y, ze as yt, x as z };
178
-
179
- //# sourceMappingURL=icons-DbScMMqX.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"icons-DbScMMqX.js","names":[],"sources":["../../src/icons/ShapeKindIcon.tsx","../../src/icons/index.tsx"],"sourcesContent":["import type { ComponentType } from 'react';\nimport {\n EllipseIcon, ImageIcon, LassoIcon, LineIcon, PenIcon, PencilIcon, PolygonIcon, RectIcon,\n StarIcon, TextIcon, UnknownIcon,\n type IconProps, type ShapeKind,\n} from '@weasel-js/core';\n\nconst BY_KIND = {\n rect: RectIcon,\n ellipse: EllipseIcon,\n line: LineIcon,\n polygon: PolygonIcon,\n star: StarIcon,\n pen: PenIcon,\n pencil: PencilIcon,\n lasso: LassoIcon,\n text: TextIcon,\n image: ImageIcon,\n} satisfies Record<ShapeKind, ComponentType<IconProps>>;\n\nexport interface ShapeKindIconProps extends IconProps {\n /** A built-in shape kind. Any other string draws `UnknownIcon`, so a\n * consumer-defined kind still gets a glyph. */\n kind: ShapeKind | (string & {});\n}\n\n/** The glyph for a shape kind — the same one its insertion tool shows, so a\n * row in a layer list or inspector matches the palette that made it. */\nexport function ShapeKindIcon({ kind, ...props }: ShapeKindIconProps) {\n const Glyph = (BY_KIND as Record<string, ComponentType<IconProps>>)[kind] ?? UnknownIcon;\n return <Glyph {...props} />;\n}\n","import { Icon, type IconProps } from './Icon';\n\nexport { Icon, isFillable } from './Icon';\nexport type { IconProps } from './Icon';\nexport { ICON_FILLS, ICON_GROUPS, ICON_PATHS } from './paths';\nexport { ShapeKindIcon } from './ShapeKindIcon';\nexport type { ShapeKindIconProps } from './ShapeKindIcon';\nexport type { FillableIconName, IconName } from './paths';\n\n// Tool glyphs live in @weasel-js/core because core needs them for\n// `Tool.presentation.icon` defaults and cannot depend on this package.\n// Re-exported here so consumers have one import site for the whole set.\nexport {\n SelectIcon, LassoIcon, RectIcon, EllipseIcon, ImageIcon, EyedropperIcon,\n LineIcon, ArrowIcon, PolygonIcon, StarIcon, PencilIcon, TextIcon, PenIcon, HandIcon,\n UnknownIcon,\n} from '@weasel-js/core';\n// The standard edit actions' glyphs live beside those actions in core, for the\n// same reason.\nexport {\n CutIcon, CopyIcon, PasteIcon, DuplicateIcon, GroupIcon, UngroupIcon,\n BringForwardIcon, BringToFrontIcon, SendBackwardIcon, SendToBackIcon, FlipXIcon, FlipYIcon,\n UndoIcon, RedoIcon, DeleteIcon,\n AlignLeftIcon, AlignCenterXIcon, AlignRightIcon, AlignTopIcon, AlignCenterYIcon, AlignBottomIcon,\n DistributeHorizontalIcon, DistributeVerticalIcon,\n} from '@weasel-js/core';\n\nexport const CloneIcon = (p: IconProps) => <Icon name=\"clone\" {...p} />;\nexport const ResetIcon = (p: IconProps) => <Icon name=\"reset\" {...p} />;\nexport const CloseIcon = (p: IconProps) => <Icon name=\"close\" {...p} />;\nexport const ExportIcon = (p: IconProps) => <Icon name=\"export\" {...p} />;\nexport const ZoomInIcon = (p: IconProps) => <Icon name=\"zoomIn\" {...p} />;\nexport const PanIcon = (p: IconProps) => <Icon name=\"pan\" {...p} />;\nexport const AddIcon = (p: IconProps) => <Icon name=\"add\" {...p} />;\nexport const ModeLightIcon = (p: IconProps) => <Icon name=\"modeLight\" {...p} />;\nexport const ModeDarkIcon = (p: IconProps) => <Icon name=\"modeDark\" {...p} />;\nexport const ModeAutoIcon = (p: IconProps) => <Icon name=\"modeAuto\" {...p} />;\nexport const RemoveIcon = (p: IconProps) => <Icon name=\"remove\" {...p} />;\nexport const SortIcon = (p: IconProps) => <Icon name=\"sort\" {...p} />;\nexport const ZoomOutIcon = (p: IconProps) => <Icon name=\"zoomOut\" {...p} />;\nexport const FitIcon = (p: IconProps) => <Icon name=\"fit\" {...p} />;\nexport const SnapshotIcon = (p: IconProps) => <Icon name=\"snapshot\" {...p} />;\nexport const PlayIcon = (p: IconProps) => <Icon name=\"play\" {...p} />;\nexport const PauseIcon = (p: IconProps) => <Icon name=\"pause\" {...p} />;\nexport const StopIcon = (p: IconProps) => <Icon name=\"stop\" {...p} />;\nexport const StepBackIcon = (p: IconProps) => <Icon name=\"stepBack\" {...p} />;\nexport const StepForwardIcon = (p: IconProps) => <Icon name=\"stepForward\" {...p} />;\n/** @deprecated Use {@link StepForwardIcon}; `step` alone stopped naming a direction. */\nexport const StepIcon = StepForwardIcon;\nexport const CrosshairIcon = (p: IconProps) => <Icon name=\"crosshair\" {...p} />;\nexport const FullscreenIcon = (p: IconProps) => <Icon name=\"fullscreen\" {...p} />;\nexport const CompareIcon = (p: IconProps) => <Icon name=\"compare\" {...p} />;\nexport const FilterIcon = (p: IconProps) => <Icon name=\"filter\" {...p} />;\nexport const SearchIcon = (p: IconProps) => <Icon name=\"search\" {...p} />;\nexport const LoupeIcon = (p: IconProps) => <Icon name=\"loupe\" {...p} />;\nexport const LayersIcon = (p: IconProps) => <Icon name=\"layers\" {...p} />;\nexport const PageIcon = (p: IconProps) => <Icon name=\"page\" {...p} />;\nexport const LockIcon = (p: IconProps) => <Icon name=\"lock\" {...p} />;\nexport const UnlockIcon = (p: IconProps) => <Icon name=\"unlock\" {...p} />;\nexport const VisibleIcon = (p: IconProps) => <Icon name=\"visible\" {...p} />;\nexport const HiddenIcon = (p: IconProps) => <Icon name=\"hidden\" {...p} />;\nexport const PinIcon = (p: IconProps) => <Icon name=\"pin\" {...p} />;\nexport const LinkIcon = (p: IconProps) => <Icon name=\"link\" {...p} />;\nexport const CollapseIcon = (p: IconProps) => <Icon name=\"collapse\" {...p} />;\nexport const ExpandIcon = (p: IconProps) => <Icon name=\"expand\" {...p} />;\nexport const ChevronIcon = (p: IconProps) => <Icon name=\"chevron\" {...p} />;\nexport const TuneIcon = (p: IconProps) => <Icon name=\"tune\" {...p} />;\nexport const GridIcon = (p: IconProps) => <Icon name=\"grid\" {...p} />;\nexport const SnapIcon = (p: IconProps) => <Icon name=\"snap\" {...p} />;\nexport const MeasureIcon = (p: IconProps) => <Icon name=\"measure\" {...p} />;\nexport const RandomizeIcon = (p: IconProps) => <Icon name=\"randomize\" {...p} />;\nexport const RefreshIcon = (p: IconProps) => <Icon name=\"refresh\" {...p} />;\nexport const InfoIcon = (p: IconProps) => <Icon name=\"info\" {...p} />;\nexport const WarningIcon = (p: IconProps) => <Icon name=\"warning\" {...p} />;\nexport const ErrorIcon = (p: IconProps) => <Icon name=\"error\" {...p} />;\nexport const BusyIcon = (p: IconProps) => <Icon name=\"busy\" {...p} />;\nexport const CheckIcon = (p: IconProps) => <Icon name=\"check\" {...p} />;\nexport const LayoutRowsIcon = (p: IconProps) => <Icon name=\"layoutRows\" {...p} />;\nexport const LayoutColumnsIcon = (p: IconProps) => <Icon name=\"layoutColumns\" {...p} />;\nexport const LayoutGridIcon = (p: IconProps) => <Icon name=\"layoutGrid\" {...p} />;\n"],"mappings":";;;;AAOA,IAAM,IAAU;CACd,MAAM;CACN,SAAS;CACT,MAAM;CACN,SAAS;CACT,MAAM;CACN,KAAK;CACL,QAAQ;CACR,OAAO;CACP,MAAM;CACN,OAAO;CACR;AAUD,SAAgB,EAAc,EAAE,SAAM,GAAG,KAA6B;AAEpE,QAAO,kBADQ,EAAqD,MAAS,GACtE,EAAO,GAAI,GAAS,CAAA;;;;ACH7B,IAAa,KAAa,MAAiB,kBAAC,GAAD;CAAM,MAAK;CAAQ,GAAI;CAAK,CAAA,EAC1D,KAAa,MAAiB,kBAAC,GAAD;CAAM,MAAK;CAAQ,GAAI;CAAK,CAAA,EAC1D,MAAa,MAAiB,kBAAC,GAAD;CAAM,MAAK;CAAQ,GAAI;CAAK,CAAA,EAC1D,KAAc,MAAiB,kBAAC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AAO,GAAI;CAAK,CAAA,EACxD,MAAY,MAAiB,kBAAC,GAAD;CAAM,MAAK;CAAO,GAAI;CAAK,CAAA,EACxD,MAAe,MAAiB,kBAAC,GAAD;CAAM,MAAK;CAAU,GAAI;CAAK,CAAA,EAC9D,MAAiB,MAAiB,kBAAC,GAAD;CAAM,MAAK;CAAY,GAAI;CAAK,CAAA,EAClE,MAAe,MAAiB,kBAAC,GAAD;CAAM,MAAK;CAAU,GAAI;CAAK,CAAA,EAC9D,MAAY,MAAiB,kBAAC,GAAD;CAAM,MAAK;CAAO,GAAI;CAAK,CAAA,EACxD,MAAe,MAAiB,kBAAC,GAAD;CAAM,MAAK;CAAU,GAAI;CAAK,CAAA,EAC9D,MAAa,MAAiB,kBAAC,GAAD;CAAM,MAAK;CAAQ,GAAI;CAAK,CAAA,EAC1D,MAAY,MAAiB,kBAAC,GAAD;CAAM,MAAK;CAAO,GAAI;CAAK,CAAA,EACxD,MAAa,MAAiB,kBAAC,GAAD;CAAM,MAAK;CAAQ,GAAI;CAAK,CAAA,EAC1D,MAAkB,MAAiB,kBAAC,GAAD;CAAM,MAAK;CAAa,GAAI;CAAK,CAAA,EACpE,MAAqB,MAAiB,kBAAC,GAAD;CAAM,MAAK;CAAgB,GAAI;CAAK,CAAA,EAC1E,MAAkB,MAAiB,kBAAC,GAAD;CAAM,MAAK;CAAa,GAAI;CAAK,CAAA"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"keyGlyph-CLvUHU8c.js","names":[],"sources":["../../src/components/Keycaps/keyGlyph.ts"],"sourcesContent":["/** Apple-style glyph for a DOM `KeyboardEvent.key` value. Covers escape,\n * delete/backspace, arrows, enter/return, tab, space. Unknown keys are\n * upper-cased (so `'a'` reads as `A` on a keycap) and returned unchanged\n * otherwise — making this safe to apply uniformly without a `has-glyph`\n * check at the call site. */\nexport function keyGlyph(rawKey: string): string {\n switch (rawKey) {\n case 'Escape': return '⎋';\n case 'Backspace': return '⌫';\n case 'Delete': return '⌦';\n case 'ArrowUp': return '↑';\n case 'ArrowDown': return '↓';\n case 'ArrowLeft': return '←';\n case 'ArrowRight': return '→';\n case 'Enter':\n case 'Return': return '↵';\n case 'Tab': return '⇥';\n case ' ':\n case 'Space': return '␣';\n default: return rawKey.toUpperCase();\n }\n}\n"],"mappings":";AAKA,SAAgB,EAAS,GAAwB;AAC/C,SAAQ,GAAR;EACE,KAAK,SAAU,QAAO;EACtB,KAAK,YAAa,QAAO;EACzB,KAAK,SAAU,QAAO;EACtB,KAAK,UAAW,QAAO;EACvB,KAAK,YAAa,QAAO;EACzB,KAAK,YAAa,QAAO;EACzB,KAAK,aAAc,QAAO;EAC1B,KAAK;EACL,KAAK,SAAU,QAAO;EACtB,KAAK,MAAO,QAAO;EACnB,KAAK;EACL,KAAK,QAAS,QAAO;EACrB,QAAS,QAAO,EAAO,aAAa"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"model-BQMvTLnW.js","names":[],"sources":["../../src/components/SelectionPanel/SelectionPanel.module.css","../../src/components/SelectionPanel/renderLeaf.tsx","../../src/components/SelectionPanel/model.ts"],"sourcesContent":[".root {\n display: flex;\n flex-direction: column;\n font-size: var(--wzl-font-size-sm);\n color: var(--wzl-fg);\n}\n\n.header {\n display: flex;\n align-items: baseline;\n gap: var(--wzl-space-4);\n padding: var(--wzl-space-4) 0;\n border-block-end: 1px solid var(--wzl-border);\n}\n\n.kind {\n font-weight: var(--wzl-font-weight-bold);\n font-size: var(--wzl-font-size);\n}\n\n.breakdown {\n font-size: var(--wzl-font-size-sm);\n opacity: 0.6;\n}\n\n.section {\n padding: var(--wzl-space-3) 0 var(--wzl-space-4);\n border-block-end: 1px solid var(--wzl-border);\n}\n\n.section:last-child {\n border-block-end: none;\n}\n\n.sectionTitle {\n margin: 0 0 var(--wzl-space-3);\n font-size: var(--wzl-font-size-xs);\n font-weight: var(--wzl-font-weight-bold);\n text-transform: uppercase;\n letter-spacing: 0.06em;\n opacity: 0.55;\n}\n\n.row {\n display: grid;\n grid-template-columns: 64px 1fr;\n gap: var(--wzl-space-3);\n align-items: center;\n margin-block-end: 5px;\n}\n\n.rowLabel {\n opacity: 0.75;\n}\n\n.rowControls {\n display: flex;\n flex-wrap: wrap;\n gap: var(--wzl-space-3);\n align-items: center;\n min-inline-size: 0;\n}\n\n/* Glyph plus its control, held together so the pair row wraps between\n fields rather than between a field and the icon naming it. */\n.namedField {\n display: flex;\n align-items: center;\n gap: var(--wzl-space-2);\n min-inline-size: 0;\n}\n\n.namedField > svg {\n flex: none;\n opacity: 0.75;\n}\n\n.blockRow {\n margin-block-end: 5px;\n}\n\n/* Fields paired into one row split it evenly, the way Position's x/y do. */\n.rowControls > .namedField {\n flex: 1 1 0;\n}\n\n/* Except around a segmented bar, which is sized by its segments: an equal\n share of the row is wider than the buttons want to be. */\n.rowControls > .namedField:has(> .toggle) {\n flex: 0 1 auto;\n}\n\n.rowControls > * {\n flex: 1;\n min-inline-size: 0;\n}\n\n/* Bars sharing a row split the leftover between them, so the gap stays fixed\n and the width lands on the segments. A bar with the row to itself is sized\n by its segments instead — a third of 240px is a plate, not a button. */\n.rowControls > .toggle {\n flex: 1 1 auto;\n}\n\n.rowControls > .toggle:only-child {\n flex: 0 1 auto;\n}\n\n/* A flag bar is sized by its glyphs rather than by a share of the row: an\n even split would fling one-letter segments to the margins. */\n.rowControls > .flagToggle {\n flex: 0 0 auto;\n}\n\n.number :global(input),\n.select {\n font-size: var(--wzl-font-size-sm);\n}\n\n.unrenderable {\n font-size: var(--wzl-font-size-sm);\n opacity: 0.5;\n font-style: italic;\n}\n\n/* A `block` leaf that renders its own rows — an object leaf's fields. */\n.objectLeaf {\n margin-block: var(--wzl-space-4) var(--wzl-space-2);\n}\n\n.objectLeaf .sectionTitle {\n margin-block: 7px 5px;\n}\n\n/* Fields under a heading inside an object read as belonging to it. */\n.objectGroup {\n padding-inline-start: var(--wzl-space-4);\n border-inline-start: 1px solid var(--wzl-border);\n margin-block-end: var(--wzl-space-2);\n}\n\n/* The slider's track; the row only says how it shares the space. */\n.slider {\n flex: 1;\n}\n","/**\n * A selection's leaves as cells: one `ToolPrefLeaf` and its aggregated value\n * in, one rendered cell out, plus the run logic that turns a row of paired\n * toggles into a single segmented bar and the rows of an object leaf.\n *\n * The control itself is `PropertyControl`'s, through `prefFieldProps`; what\n * is decided here is how a selection surface sizes and composes it.\n * `ToolOptionsBar` renders a tool's options through the same functions.\n */\nimport { Fragment, type ReactNode } from 'react';\nimport type {\n ToolPrefBoolean,\n ToolPrefGroup,\n ToolPrefLeaf,\n ToolPrefObject,\n} from '@weasel-js/core';\nimport { prefFieldProps } from '../Prefs/prefField';\nimport { PropertyControl } from '../Properties/PropertyField';\nimport { ToggleBar } from '../ToggleBar';\nimport { Icon } from '../../icons/Icon';\nimport { ICON_PATHS, type IconName } from '../../icons/paths';\nimport s from './SelectionPanel.module.css';\n\n\n/** What a {@link PropertyRenderer} is given for the property it is rendering. */\nexport interface PropertyRenderContext {\n /** Dotted node path of the leaf (`pose.x`, `data.fill`). */\n path: string;\n /** The schema leaf. App renderers narrow it to their own kind shape. */\n pref: ToolPrefLeaf;\n /** Aggregated value across the selection; `undefined` when mixed or unset. */\n value: unknown;\n /** True when selected nodes disagree at this path. */\n mixed: boolean;\n /**\n * True when the nodes agree and what they agree on is nothing — the field\n * is absent, and whatever paints comes from a fallback further down.\n *\n * Distinct from `mixed`, and both leave `value` undefined. A control must\n * not substitute its schema default here: doing so shows a value the node\n * does not hold, and the next edit writes that invention back.\n */\n unset: boolean;\n /**\n * The fields of the object this leaf is a field of — `undefined` for a\n * top-level leaf, and for a field of an object the node does not hold.\n *\n * What a control needs when its own field doesn't carry the whole answer:\n * a stroke's dash lengths are multiples of the stroke's width, so reading\n * the array as a style takes both.\n */\n siblings?: Record<string, unknown>;\n /** Commit a value — fans out to every selected node in one undo step. */\n setValue: (value: unknown) => void;\n /**\n * The aggregated value at another node path — what `value` and `mixed` are\n * for this leaf's own path, for any path.\n *\n * A control whose subject spans more than one field needs it: a font picker\n * reporting which variant will actually paint has to read the node's weight\n * and style. Reading it off `value` is impossible — a leaf is handed one\n * field.\n */\n valueAt: (path: string) => { value: unknown; mixed: boolean };\n /**\n * The ids of the nodes the values were read from, joined. It changes exactly\n * when the selection does, so a control holding scratch that belongs to one\n * selection can key on it and be remounted rather than carry it to the next.\n * Absent where the values come from no selection, as in a tool options bar.\n */\n selectionKey?: string;\n}\n\n/**\n * Renders the control for one property across the whole selection.\n * Returning `null` collapses the leaf.\n */\nexport type PropertyRenderer = (ctx: PropertyRenderContext) => ReactNode;\n\n\n/**\n * One leaf with its context built but nothing rendered yet.\n *\n * Deferring the render is what lets a run of sibling flags become one bar:\n * whether a leaf joins its neighbors is a fact about the run, which no leaf\n * rendering itself can see.\n */\nexport interface LeafCell {\n key: string;\n leaf: ToolPrefLeaf;\n ctx: PropertyRenderContext;\n /** The accessible name this leaf's control carries — qualified by the row's\n * pair where the row holds more than one leaf. */\n ariaLabel: string;\n /** Renders the leaf on its own, chrome and all. */\n render: () => ReactNode;\n}\n\n/** A cell's content, once the run it belongs to has been decided. */\nexport interface RenderedCell {\n key: string;\n /** The leaf that names the cell — the run's first, for a flag bar. */\n leaf: ToolPrefLeaf;\n block: boolean;\n content: ReactNode;\n}\n\n/**\n * True for a leaf that can join a flag bar: a paired toggle boolean the\n * consumer has not claimed with a renderer of its own.\n */\nexport function isFlagCell(cell: LeafCell, renderers?: Record<string, PropertyRenderer>): boolean {\n const { leaf } = cell;\n return (\n leaf.kind === 'boolean' &&\n (leaf as ToolPrefBoolean).control === 'toggle' &&\n leaf.pair !== undefined &&\n renderers?.[cell.ctx.path] === undefined &&\n renderers?.[leaf.kind] === undefined\n );\n}\n\n/**\n * Renders a row's cells, collapsing each run of adjacent same-`pair` toggle\n * booleans into one segmented bar — the idiom the enum toggle a row away\n * already uses, rather than one detached pill per flag.\n */\nexport function renderCells(\n cells: readonly LeafCell[],\n renderers?: Record<string, PropertyRenderer>,\n): RenderedCell[] {\n const out: RenderedCell[] = [];\n for (let i = 0; i < cells.length; ) {\n const cell = cells[i];\n if (!isFlagCell(cell, renderers)) {\n const content = cell.render();\n if (content != null) {\n out.push({ key: cell.key, leaf: cell.leaf, block: cell.leaf.block === true, content });\n }\n i += 1;\n continue;\n }\n let j = i + 1;\n while (\n j < cells.length &&\n isFlagCell(cells[j], renderers) &&\n cells[j].leaf.pair === cell.leaf.pair\n ) {\n j += 1;\n }\n const run = cells.slice(i, j);\n out.push({\n key: cell.key,\n leaf: cell.leaf,\n block: run.every((c) => c.leaf.block === true),\n content: <FlagBar run={run} ariaLabel={cell.leaf.pair as string} />,\n });\n i = j;\n }\n return out;\n}\n\n/**\n * A run of paired boolean flags as one multi-select bar — U / S / O, the way\n * every text editor draws them.\n */\nfunction FlagBar({ run, ariaLabel }: { run: readonly LeafCell[]; ariaLabel: string }): ReactNode {\n const on = run.filter((c) => c.ctx.value === true).map((c) => c.key);\n return (\n <ToggleBar<string>\n mode=\"multiple\"\n size=\"sm\"\n variant=\"flat\"\n className={s.flagToggle}\n ariaLabel={ariaLabel}\n items={run.map((c) => {\n const p = c.leaf as ToolPrefBoolean;\n return {\n value: c.key,\n label:\n p.icon && p.icon in ICON_PATHS ? (\n <Icon name={p.icon as IconName} size={14} />\n ) : (\n (p.short ?? p.name.slice(0, 1))\n ),\n ariaLabel: c.ariaLabel,\n };\n })}\n value={on}\n // Each flag owns its own path, so only the segment that moved is\n // written — committing the run would write two fields nobody touched,\n // and inside an object leaf would fabricate values for the other two.\n mixedValues={run.filter((c) => c.ctx.mixed).map((c) => c.key)}\n onChange={(next) => {\n for (const c of run) {\n const now = next.includes(c.key);\n if (now !== on.includes(c.key)) c.ctx.setValue(now);\n }\n }}\n />\n );\n}\n\nexport function renderBuiltin(\n ctx: PropertyRenderContext,\n ariaLabel: string,\n renderers?: Record<string, PropertyRenderer>,\n /** Identifies the current selection, so a control holding per-selection\n * scratch (the paint kind memory) is remounted rather than carried over. */\n selectionKey = '',\n /** True for a field of an object leaf. Such a field writes itself into its\n * parent, so it can only hold values its parent's type permits — which is\n * what rules \"none\" out for a nested paint. */\n nested = false,\n): ReactNode {\n const { pref, value, mixed, unset, setValue } = ctx;\n if (pref.kind === 'object') {\n // One value with fields hanging off it. Each child writes the parent\n // whole, so a field is never set on a half-built object.\n return <ObjectLeaf ctx={ctx} renderers={renderers} selectionKey={selectionKey} />;\n }\n const field = prefFieldProps(pref, {\n value,\n mixed,\n unset,\n siblings: ctx.siblings,\n setValue,\n // The substitution probe runs at the node's own weight and style, so the\n // picker names the variant that will actually paint. A mixed selection\n // has no single one; the probe falls back to 400/normal there.\n fontVariant: {\n weight: ctx.valueAt('data.style.fontWeight').value,\n style: ctx.valueAt('data.style.fontStyle').value,\n },\n });\n if (field === null) {\n return <span className={s.unrenderable}>({pref.kind}: no renderer)</span>;\n }\n switch (field.kind) {\n case 'boolean':\n // A panel's flag is a switch unless it asks otherwise.\n return (\n <PropertyControl\n {...field}\n {...framed(ariaLabel)}\n control={field.control ?? 'switch'}\n className={field.control === 'toggle' ? s.flagToggle : undefined}\n />\n );\n case 'number':\n return (\n <PropertyControl\n {...field}\n {...framed(ariaLabel)}\n className={field.control === 'slider' ? s.slider : s.number}\n steppers={false}\n />\n );\n case 'string':\n // Settled values only: a live write per keystroke would be one undo\n // step per character.\n return <PropertyControl {...field} {...framed(ariaLabel)} onInput={settledOnly} />;\n case 'enum':\n return (\n <PropertyControl\n {...field}\n {...framed(ariaLabel)}\n className={field.control === 'toggle' ? s.toggle : field.control === 'radio' ? undefined : s.select}\n />\n );\n case 'font-family':\n return <PropertyControl {...field} {...framed(ariaLabel)} className={s.select} />;\n case 'paint':\n return (\n <PropertyControl\n {...field}\n {...framed(ariaLabel)}\n // Per-kind switch memory is scratch for one selection; carrying it\n // across would recall the previous node's gradient.\n key={selectionKey}\n control=\"inline\"\n // A nested paint writes one field of its parent, and no kit paint\n // field is optional — `Stroke.paint` is required. Removing the\n // whole parent is a different edit than repainting it, so the\n // control must not offer one as the other.\n allowNone={!nested}\n />\n );\n default:\n return <PropertyControl {...field} {...framed(ariaLabel)} />;\n }\n}\n\nconst framed = (name: string) => ({ chrome: 'framed' as const, name });\n\nconst settledOnly = (): void => {};\n\n/**\n * Renders an object leaf: a titled block whose rows are the object's own\n * fields. A child's edit commits the parent object, never the child's path —\n * writing into a path whose value is not an object yet would corrupt it.\n */\n/** One labeled row inside an object leaf; `pair` merges adjacent fields into\n * it, exactly as the section rows merge theirs. */\ninterface ObjectRow {\n key: string;\n pair?: string;\n label: string;\n title?: string;\n /** Every field in the row brought its own chrome, so the row drops the\n * label column and spans the block. One unlabeled field in an otherwise\n * labeled pair would leave the row named after half of itself. */\n block: boolean;\n controls: ReactNode[];\n}\n\n/**\n * Renders an object leaf: the object's own fields, as rows. A child's edit\n * commits the parent object, never the child's path — writing into a path\n * whose value is not an object yet would corrupt it.\n */\nfunction ObjectLeaf({\n ctx,\n renderers,\n selectionKey = '',\n}: {\n ctx: PropertyRenderContext;\n renderers?: Record<string, PropertyRenderer>;\n selectionKey?: string;\n}): ReactNode {\n const pref = ctx.pref as ToolPrefObject;\n const held = typeof ctx.value === 'object' && ctx.value !== null\n ? (ctx.value as Record<string, unknown>)\n : undefined;\n\n // A value whose fields are entirely grouped is titled by those groups — its\n // own heading would stack onto the first one and name nothing new.\n const allGrouped = Object.values(pref.children).every((child) => !('kind' in child));\n\n // `indent` is false when nothing visible sits above these rows: depth is\n // drawn only where a label marks it.\n const rowsOf = (\n children: Record<string, ToolPrefLeaf | ToolPrefGroup>,\n indent: boolean,\n ): ReactNode[] => {\n const out: (ReactNode | ObjectRow)[] = [];\n const isRow = (v: ReactNode | ObjectRow): v is ObjectRow =>\n typeof v === 'object' && v !== null && 'controls' in v;\n\n // Cells accumulate unrendered so a run of adjacent same-`pair` flags can\n // be seen as a run before any of them draws; a group heading between two\n // fields ends the run, exactly as it ends a paired row.\n let pending: LeafCell[] = [];\n const flush = (): void => {\n for (const { key, leaf, block, content } of renderCells(pending, renderers)) {\n const prev = out[out.length - 1];\n if (leaf.pair !== undefined && isRow(prev) && prev.pair === leaf.pair) {\n prev.controls.push(<Fragment key={key}>{content}</Fragment>);\n prev.block &&= block;\n continue;\n }\n out.push({\n key,\n pair: leaf.pair,\n label: leaf.pair ?? leaf.name,\n title: leaf.description,\n block,\n controls: [<Fragment key={key}>{content}</Fragment>],\n });\n }\n pending = [];\n };\n\n for (const [key, child] of Object.entries(children)) {\n // A group among the children organises the fields under a heading\n // without contributing to the path — the rule group keys follow at the\n // top level.\n if (!('kind' in child)) {\n const labeled = child.name !== '';\n const inner = rowsOf(child.children, labeled);\n if (inner.length === 0) continue;\n flush();\n out.push(\n <div key={`group:${key}`} className={labeled && indent ? s.objectGroup : undefined}>\n {labeled && <h5 className={s.sectionTitle}>{child.name}</h5>}\n {inner}\n </div>,\n );\n continue;\n }\n const childPath = `${ctx.path}.${key}`;\n const childCtx: PropertyRenderContext = {\n path: childPath,\n pref: child,\n value: held?.[key],\n mixed: ctx.mixed,\n // A field of an object the node does not hold is unset, and so is one\n // the object omits — `data.stroke` absent leaves every stroke field\n // with nothing behind it, not with the schema's defaults.\n unset: !ctx.mixed && held?.[key] === undefined,\n siblings: held,\n valueAt: ctx.valueAt,\n selectionKey: ctx.selectionKey,\n setValue: (v) => {\n // The node holds no object yet, so writing one field has to\n // materialize the rest: the leaf's `default` is what a complete\n // value looks like. Starting from `{}` instead committed the one\n // field on its own — a `data.stroke` of `{ width: 2 }` with no\n // `paint`, which the type forbids and the painter threw on, taking\n // the whole frame and the visible document with it.\n const base = held\n ?? pref.fromScalar?.(ctx.value)\n ?? (typeof pref.default === 'object' && pref.default !== null\n ? { ...(pref.default as Record<string, unknown>) }\n : {});\n if (v === undefined) {\n // A field written as absent is absent — leaving the key holding\n // `undefined` says the object has a dash of nothing.\n const { [key]: _dropped, ...rest } = base;\n ctx.setValue(rest);\n return;\n }\n ctx.setValue({ ...base, [key]: v });\n },\n };\n pending.push({\n key: childPath,\n leaf: child,\n ctx: childCtx,\n ariaLabel: child.name,\n render: () => {\n const custom = renderers?.[childPath] ?? renderers?.[child.kind];\n const rendered = custom\n ? custom(childCtx)\n : renderBuiltin(childCtx, child.name, renderers, selectionKey, true);\n if (rendered == null) return null;\n // Neither a paired row nor a block one gives a field its own label\n // column, so the glyph is all that names it on screen. The control\n // already carries `name` as its accessible name, which leaves the\n // glyph decorative.\n const unlabeled = child.pair !== undefined || child.block === true;\n const glyph = unlabeled && child.icon && child.icon in ICON_PATHS;\n if (!glyph) return rendered;\n return (\n <span className={s.namedField}>\n <Icon name={child.icon as IconName} size={14} />\n {rendered}\n </span>\n );\n },\n });\n }\n flush();\n return out.map((entry) =>\n typeof entry === 'object' && entry !== null && 'controls' in entry ? (\n entry.block ? (\n <div key={entry.key} className={`${s.rowControls} ${s.blockRow}`} title={entry.title}>\n {entry.controls}\n </div>\n ) : (\n <div key={entry.key} className={s.row}>\n <span className={s.rowLabel} title={entry.title}>{entry.label}</span>\n <span className={s.rowControls}>{entry.controls}</span>\n </div>\n )\n ) : (\n entry\n ),\n );\n };\n\n const rows = rowsOf(pref.children, !allGrouped);\n if (rows.length === 0) return null;\n return (\n <div className={s.objectLeaf}>\n {!allGrouped && <h4 className={s.sectionTitle}>{pref.name}</h4>}\n {rows}\n </div>\n );\n}\n","// Pure selection→panel derivations for SelectionPanel. Kept free of\n// React so intersection/aggregation semantics are unit-testable.\n//\n// Path convention (see core `NodePropertiesEntry`): a leaf's OWN KEY in\n// the schema is its node path — a dotted path of any depth rooted at\n// `pose` or `data` (`pose.x`, `data.fill`, `data.style.fontSize`). Group\n// keys are organizational only.\n\nimport {\n MIXED,\n type Mixed,\n type NodePropertiesEntry,\n type NodeRoutingEntry,\n type SceneNode,\n type ToolPrefGroup,\n type ToolPrefLeaf,\n} from '@weasel-js/core';\n\n// Re-exported under its existing public name here: the kit-wide \"these\n// values disagree\" sentinel (`@weasel-js/core`'s `MIXED`) also covers\n// multi-node aggregation, so this panel doesn't get its own symbol.\nexport { MIXED };\nexport type { Mixed };\n\nexport type AnyNode = SceneNode<unknown, string, unknown>;\n\n/**\n * One editable property in a {@link SelectionPanel}, paired with the dotted\n * node path it reads and writes.\n */\nexport interface PanelLeaf {\n /** Dotted node path — the leaf's key in the schema. */\n path: string;\n leaf: ToolPrefLeaf;\n}\n\n/**\n * One labeled row of a panel section. Holds several leaves when the schema\n * paired them.\n */\nexport interface PanelRow {\n label: string;\n leaves: PanelLeaf[];\n}\n\n/**\n * A titled block of rows, derived from one top-level group of a properties\n * schema. `key` is that group's schema key.\n */\nexport interface PanelSection {\n key: string;\n name: string;\n rows: PanelRow[];\n}\n\n/** Derive a node's kind: containers are `'group'`; leaves classify their\n * `data` through the routing entries (first match wins, `'unknown'`\n * otherwise) — same semantics as core's `NodeRouting.classify`. */\nexport function classifyKind(\n node: AnyNode,\n routing: readonly NodeRoutingEntry[],\n): string {\n if (node.kind === 'container') return 'group';\n for (const entry of routing) {\n if (entry.matches(node.data)) return entry.name;\n }\n return 'unknown';\n}\n\nexport function isGroup(n: ToolPrefLeaf | ToolPrefGroup): n is ToolPrefGroup {\n return !('kind' in n);\n}\n\n/** Flatten a schema to sections of leaves. Nested groups fold into their\n * top-level section; top-level leaves get an untitled leading section. */\nfunction flatten(schema: ToolPrefGroup): PanelSection[] {\n const sections: PanelSection[] = [];\n const untitled: PanelLeaf[] = [];\n\n const collect = (group: ToolPrefGroup, into: PanelLeaf[]): void => {\n for (const [key, child] of Object.entries(group.children)) {\n if (isGroup(child)) collect(child, into);\n else into.push({ path: key, leaf: child });\n }\n };\n\n for (const [key, child] of Object.entries(schema.children)) {\n if (isGroup(child)) {\n const leaves: PanelLeaf[] = [];\n collect(child, leaves);\n sections.push({ key, name: child.name, rows: pairRows(leaves) });\n } else {\n untitled.push({ path: key, leaf: child });\n }\n }\n if (untitled.length > 0) {\n sections.unshift({ key: '', name: '', rows: pairRows(untitled) });\n }\n return sections;\n}\n\n/** Merge consecutive leaves sharing a `pair` id into one labeled row. */\nexport function pairRows(leaves: readonly PanelLeaf[]): PanelRow[] {\n const rows: PanelRow[] = [];\n for (const item of leaves) {\n const pair = item.leaf.pair;\n const prev = rows[rows.length - 1];\n if (pair !== undefined && prev !== undefined && prev.label === pair) {\n prev.leaves.push(item);\n } else {\n rows.push({ label: pair ?? item.leaf.name, leaves: [item] });\n }\n }\n return rows;\n}\n\n/**\n * The schema the panel shows for a set of kinds: one kind → its full\n * schema; several → the intersection by (path, leaf kind), shaped by the\n * first kind's section/row layout. Kinds without a registered schema\n * contribute nothing, so their presence collapses the intersection.\n */\nexport function effectiveSections(\n kinds: readonly string[],\n entries: readonly NodePropertiesEntry[],\n): PanelSection[] {\n const uniq = [...new Set(kinds)];\n if (uniq.length === 0) return [];\n const byName = new Map(entries.map((e) => [e.name, e]));\n const schemas = uniq.map((k) => byName.get(k)?.schema);\n if (schemas.some((s) => s === undefined)) return [];\n const [first, ...rest] = schemas as ToolPrefGroup[];\n\n const flatFirst = flatten(first);\n if (rest.length === 0) return flatFirst;\n\n // '\\0' delimiter: path and kind strings are unconstrained, so a\n // printable separator could collide with real content.\n const leafKey = (l: PanelLeaf): string => `${l.path}\\0${l.leaf.kind}`;\n const restKeys = rest.map(\n (schema) =>\n new Set(\n flatten(schema)\n .flatMap((s) => s.rows)\n .flatMap((r) => r.leaves)\n .map(leafKey),\n ),\n );\n const keep = (l: PanelLeaf): boolean =>\n restKeys.every((set) => set.has(leafKey(l)));\n\n return flatFirst\n .map((section) => ({\n ...section,\n rows: section.rows\n .map((row) => ({ ...row, leaves: row.leaves.filter(keep) }))\n .filter((row) => row.leaves.length > 0),\n }))\n .filter((section) => section.rows.length > 0);\n}\n\n/** Read a node value at a dotted path of any depth (`pose.x`,\n * `data.style.fontSize`, `data.style.fill.color`). Returns `undefined` if\n * the path is dotless (mirrors `commit`'s no-op on a malformed schema\n * key) or if any intermediate segment is missing or not an object. */\nexport function nodeValueAt(node: AnyNode, path: string): unknown {\n const segments = path.split('.');\n if (segments.length < 2) return undefined;\n const head = segments[0];\n let cursor: unknown = head === 'pose' ? node.pose : head === 'data' ? node.data : undefined;\n for (let i = 1; i < segments.length; i++) {\n if (cursor == null || typeof cursor !== 'object') return undefined;\n cursor = (cursor as Record<string, unknown>)[segments[i]];\n }\n return cursor;\n}\n\n/** Immutably set `value` at a dotted path within `root`, cloning each level\n * on the way down so React sees new object identities. Arrays stay arrays\n * (an array intermediate is shallow-copied, not flattened into `{0: ...}`)\n * — this is the write-side twin of `nodeValueAt`, so a schema author who\n * gets a working read gets a working write. */\nexport function setAtPath(root: object, segments: readonly string[], value: unknown): object {\n const [head, ...rest] = segments;\n if (rest.length === 0) {\n return Array.isArray(root)\n ? Object.assign([...root], { [head]: value })\n : { ...root, [head]: value };\n }\n const child = (root as Record<string, unknown>)[head];\n const childObj = Array.isArray(child)\n ? [...child]\n : child != null && typeof child === 'object'\n ? { ...child }\n : {};\n const nested = setAtPath(childObj, rest, value);\n return Array.isArray(root)\n ? Object.assign([...root], { [head]: nested })\n : { ...root, [head]: nested };\n}\n\n/** Aggregate a path across nodes: the shared value, or `MIXED`. */\nexport function aggregateValue(\n nodes: readonly AnyNode[],\n path: string,\n): unknown | Mixed {\n let value: unknown;\n let first = true;\n for (const node of nodes) {\n const v = nodeValueAt(node, path);\n if (first) {\n value = v;\n first = false;\n } else if (!Object.is(v, value)) {\n return MIXED;\n }\n }\n return value;\n}\n\n/** `'rect ×2 · text'` — kinds in first-seen order with counts. */\nexport function kindBreakdown(kinds: readonly string[]): string {\n const counts = new Map<string, number>();\n for (const k of kinds) counts.set(k, (counts.get(k) ?? 0) + 1);\n return [...counts.entries()]\n .map(([k, n]) => (n > 1 ? `${k} ×${n}` : k))\n .join(' · ');\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AC+GA,SAAgB,EAAW,GAAgB,GAAuD;CAChG,IAAM,EAAE,YAAS;AACjB,QACE,EAAK,SAAS,aACb,EAAyB,YAAY,YACtC,EAAK,SAAS,KAAA,KACd,IAAY,EAAK,IAAI,UAAU,K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AlC,IACE,EAAE,GAAG,GAAO,GACZ,EAAE,EAC2B,GAAM,EAAM;AAC/C,QAAO,MAAM,QAAQ,EAAK,GACtB,OAAO,OAAO,CAAC,GAAG,EAAK,EAAE,GAAG,IAAO,GAAQ,CAAC,GAC5C;EAAE,GAAG;GAAO,IAAO;EAAQ;;AAIjC,SAAgB,EACd,GACA,GACiB;CACjB,IAAI,GACA,IAAQ;AACZ,MAAK,IAAM,KAAQ,GAAO;EACxB,IAAM,IAAI,EAAY,GAAM,EAAK;AACjC,MAAI,EAEF,CADA,IAAQ,GACR,IAAQ;WACC,CAAC,OAAO,GAAG,GAAG,EAAM,CAC7B,QAAO;;AAGX,QAAO;;AAIT,SAAgB,EAAc,GAAkC;CAC9D,IAAM,oBAAS,IAAI,KAAqB;AACxC,MAAK,IAAM,KAAK,EAAO,GAAO,IAAI,IAAI,EAAO,IAAI,EAAE,IAAI,KAAK,EAAE;AAC9D,QAAO,CAAC,GAAG,EAAO,SAAS,CAAC,CACzB,KAAK,CAAC,GAAG,OAAQ,IAAI,IAAI,GAAG,EAAE,IAAI,MAAM,EAAG,CAC3C,KAAK,MAAM"}
@@ -1,89 +0,0 @@
1
- //#region src/format/number.ts
2
- var e = "−";
3
- function t(e, t) {
4
- return (Number.isFinite(e) ? e.toLocaleString(void 0, t) : String(e)).replace(/^-/, "−");
5
- }
6
- function n(e) {
7
- return Number(e.replace("−", "-"));
8
- }
9
- var r = {
10
- k: 3,
11
- m: 6,
12
- b: 9,
13
- t: 12
14
- };
15
- function i(e, n = 0) {
16
- if (!Number.isFinite(e)) return t(e);
17
- let r = Math.abs(e) < 1e3 ? {
18
- useGrouping: !1,
19
- minimumFractionDigits: n,
20
- maximumFractionDigits: n
21
- } : {
22
- notation: "compact",
23
- minimumSignificantDigits: 3,
24
- maximumSignificantDigits: 3
25
- };
26
- return e.toLocaleString("en-US", r).replace(/^-/, "−");
27
- }
28
- function a(e, t) {
29
- if (t) {
30
- let n = e.trim(), r = u(n, t);
31
- if (r !== void 0) {
32
- let e = c(n, t);
33
- if (e !== void 0 && e.length > 1) return l(e, n, t);
34
- let { factor: i, offset: u } = s(t[r]);
35
- return o(a(n.slice(0, -r.length)), i) + u;
36
- }
37
- }
38
- let n = e.trim().replace("−", "-"), i = r[n.slice(-1).toLowerCase()];
39
- return i !== void 0 && (n = n.slice(0, -1).trimEnd()), /^[-+]?\d{1,3}(,\d{3})+(\.\d*)?$/.test(n) && (n = n.replace(/,/g, "")), /\d/.test(n) ? Number(i === void 0 ? n : `${n}e${i}`) : NaN;
40
- }
41
- function o(e, t) {
42
- return t < 1 ? e / (1 / t) : e * t;
43
- }
44
- function s(e) {
45
- return typeof e == "number" ? {
46
- factor: e,
47
- offset: 0
48
- } : {
49
- factor: e.factor,
50
- offset: e.offset ?? 0
51
- };
52
- }
53
- function c(e, t) {
54
- let n = [], r = e.trimEnd();
55
- for (; r !== "";) {
56
- let e = u(r, t);
57
- if (e === void 0) return;
58
- n.push(e);
59
- let i = r.slice(0, -e.length), a = /(\d+(?:\.\d+)?|\.\d+)\s*$/.exec(i);
60
- if (!a) return;
61
- r = i.slice(0, a.index).trimEnd(), (r === "-" || r === "+" || r === "−") && (r = "");
62
- }
63
- return n.length === 0 ? void 0 : n.reverse();
64
- }
65
- function l(e, t, n) {
66
- let r = t.match(/\d+(?:\.\d+)?|\.\d+/g);
67
- if (!r || r.length !== e.length) return NaN;
68
- let i = /^\s*[-\u2212]/.test(t) ? -1 : 1, a = 0;
69
- for (let [t, i] of e.entries()) {
70
- let { factor: e, offset: c } = s(n[i]);
71
- if (c !== 0) return NaN;
72
- a += o(Number(r[t]), e);
73
- }
74
- return i * a;
75
- }
76
- function u(e, t) {
77
- let n = Object.keys(t).filter((e) => e !== "").sort((e, t) => t.length - e.length), r = e.toLowerCase();
78
- return n.find((t) => e.endsWith(t)) ?? n.find((e) => r.endsWith(e.toLowerCase()));
79
- }
80
- function d(e) {
81
- return String(e).replace(/^-/, "−");
82
- }
83
- function f(e) {
84
- return Number.isFinite(e) ? e <= 2 ? `${d(Math.round(e * 100))}%` : e >= 100 ? `${Math.round(e).toLocaleString("en-US")}x` : `${d(Math.round(e * 10) / 10)}x` : String(e);
85
- }
86
- //#endregion
87
- export { a, f as i, i as n, n as o, t as r, e as t };
88
-
89
- //# sourceMappingURL=number-6S8IzXVt.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"number-6S8IzXVt.js","names":[],"sources":["../../src/format/number.ts"],"sourcesContent":["/**\n * Display-formatter for numbers. Use this anywhere a number is shown to\n * a user. The whole point: negative values get prefixed with the real\n * MINUS SIGN (U+2212) instead of the ASCII HYPHEN-MINUS (U+002D) that\n * `toLocaleString` and template literals produce by default.\n *\n * U+2212 is the same visual width as `+` and reads as a sign rather\n * than a hyphen — columns of signed numbers align cleanly and the\n * glyph doesn't get confused with a bullet or list dash.\n */\nexport const MINUS_SIGN = '−';\n\n/**\n * Formats a number for display, substituting {@link MINUS_SIGN} for the ASCII\n * hyphen `toLocaleString` emits. Non-finite values stringify as-is.\n */\nexport function formatNumber(value: number, options?: Intl.NumberFormatOptions): string {\n const formatted = Number.isFinite(value)\n ? value.toLocaleString(undefined, options)\n : String(value);\n return formatted.replace(/^-/, MINUS_SIGN);\n}\n\n/**\n * Parses a string that may carry {@link MINUS_SIGN} in place of the ASCII\n * hyphen. The inverse of {@link formatNumber} for any editing surface that\n * renders its value through it and reads the edited text back.\n */\nexport function parseSignedNumber(text: string): number {\n return Number(text.replace(MINUS_SIGN, '-'));\n}\n\n/** Powers of ten a typed magnitude suffix stands for. */\nconst EXPONENTS: Record<string, number> = { k: 3, m: 6, b: 9, t: 12 };\n\n/**\n * Formats a number the way a `compact` readout shows it: below 1,000 at\n * `decimals` places, from 1,000 up at three significant figures with a magnitude\n * suffix (`40.0K`, `294K`, `2.00M`), so the readout holds one width whatever the\n * value. Always `en-US`, so {@link parseNumber} reads it back.\n */\nexport function formatCompact(value: number, decimals = 0): string {\n if (!Number.isFinite(value)) return formatNumber(value);\n const options: Intl.NumberFormatOptions =\n Math.abs(value) < 1000\n ? { useGrouping: false, minimumFractionDigits: decimals, maximumFractionDigits: decimals }\n : { notation: 'compact', minimumSignificantDigits: 3, maximumSignificantDigits: 3 };\n return value.toLocaleString('en-US', options).replace(/^-/, MINUS_SIGN);\n}\n\n/**\n * Reads a typed number: anything {@link parseSignedNumber} reads, plus\n * thousands commas in the `40,000` shape and a `k`/`m`/`b`/`t` suffix in either\n * case (`2.5m` is 2,500,000). Empty text is NaN rather than zero.\n *\n * Given `units` — a suffix mapped to the factor it scales by — a trailing unit\n * name is read first: the longest match wins, exact case before any case, and\n * a unit beats a magnitude suffix, so with `m` accepted `2m` is `2 * units.m`.\n */\nexport function parseNumber(text: string, units?: Readonly<UnitTable>): number {\n if (units) {\n const trimmed = text.trim();\n const name = unitSuffixOf(trimmed, units);\n if (name !== undefined) {\n const terms = compoundTermsOf(trimmed, units);\n if (terms !== undefined && terms.length > 1) return compoundValue(terms, trimmed, units);\n const { factor, offset } = scaleOf(units[name]!);\n return scaled(parseNumber(trimmed.slice(0, -name.length)), factor) + offset;\n }\n }\n let t = text.trim().replace(MINUS_SIGN, '-');\n const exponent = EXPONENTS[t.slice(-1).toLowerCase()];\n if (exponent !== undefined) t = t.slice(0, -1).trimEnd();\n if (/^[-+]?\\d{1,3}(,\\d{3})+(\\.\\d*)?$/.test(t)) t = t.replace(/,/g, '');\n if (!/\\d/.test(t)) return Number.NaN;\n // Scaled through the exponent rather than by multiplying: 1.1 * 1000 is 1100.0000000000002.\n return Number(exponent === undefined ? t : `${t}e${exponent}`);\n}\n\n/** One unit's conversion into the shown unit: a bare factor, or a scale that\n * also moves zero. Structurally the kit's `UnitEntry`, kept local so this\n * formatting helper stays free of the scene vocabulary. */\nexport type UnitTableEntry = number | { factor: number; offset?: number };\n/** Suffixes a person may type, each mapped to its conversion. */\nexport type UnitTable = Record<string, UnitTableEntry>;\n\n/** Divided by the reciprocal below 1: 12 * 0.1 is 1.2000000000000002, 12 / 10 is 1.2. */\nfunction scaled(n: number, factor: number): number {\n return factor < 1 ? n / (1 / factor) : n * factor;\n}\n\n/** A unit table entry's scale, with the bare-factor shorthand widened. */\nfunction scaleOf(entry: UnitTableEntry): { factor: number; offset: number } {\n return typeof entry === 'number'\n ? { factor: entry, offset: 0 }\n : { factor: entry.factor, offset: entry.offset ?? 0 };\n}\n\n/**\n * The unit names in `text`, in reading order, when every one of them closes a\n * `<number><unit>` term — which is what tells `5ft 3in` from a malformed\n * `5ft 3`. Undefined when the text is not a run of whole terms.\n */\nfunction compoundTermsOf(text: string, units: Readonly<UnitTable>): string[] | undefined {\n const names: string[] = [];\n let rest = text.trimEnd();\n while (rest !== '') {\n const name = unitSuffixOf(rest, units);\n if (name === undefined) return undefined;\n names.push(name);\n const before = rest.slice(0, -name.length);\n const m = /(\\d+(?:\\.\\d+)?|\\.\\d+)\\s*$/.exec(before);\n if (!m) return undefined;\n rest = before.slice(0, m.index).trimEnd();\n // A sign leads the whole value, so it ends the walk rather than a term.\n if (rest === '-' || rest === '+' || rest === MINUS_SIGN) rest = '';\n }\n return names.length === 0 ? undefined : names.reverse();\n}\n\n/**\n * `5ft 3in` as one number in the shown unit. Every term scales and they sum;\n * a leading sign carries across all of them, so `-5ft 3in` is −63in and not\n * −57. Offsets have no meaning in a sum — 1K + 2degC is not a temperature —\n * so a term carrying one makes the whole value unreadable.\n */\nfunction compoundValue(names: string[], text: string, units: Readonly<UnitTable>): number {\n const digits = text.match(/\\d+(?:\\.\\d+)?|\\.\\d+/g);\n if (!digits || digits.length !== names.length) return Number.NaN;\n const sign = /^\\s*[-\\u2212]/.test(text) ? -1 : 1;\n let total = 0;\n for (const [i, name] of names.entries()) {\n const { factor, offset } = scaleOf(units[name]!);\n if (offset !== 0) return Number.NaN;\n total += scaled(Number(digits[i]), factor);\n }\n return sign * total;\n}\n\n/** The longest unit name `text` ends with — exact case first, then any case. */\nfunction unitSuffixOf(text: string, units: Readonly<UnitTable>): string | undefined {\n const names = Object.keys(units).filter((n) => n !== '').sort((a, b) => b.length - a.length);\n const lower = text.toLowerCase();\n return names.find((n) => text.endsWith(n)) ?? names.find((n) => lower.endsWith(n.toLowerCase()));\n}\n\n/** {@link String} with the leading ASCII hyphen swapped for {@link MINUS_SIGN}.\n * Locale-independent, unlike `toLocaleString`. */\nfunction signedString(value: number): string {\n return String(value).replace(/^-/, MINUS_SIGN);\n}\n\n/**\n * Formats a zoom factor for display. Below 2x a percentage reads naturally;\n * past it the numbers get long and a multiplier is what people say out loud,\n * so 250% shows as `2.5x`. Past 100x a tenth is noise, so the decimal is\n * dropped and thousands are grouped: `1009.74` reads as `1,010x`.\n */\nexport function formatZoom(zoom: number): string {\n if (!Number.isFinite(zoom)) return String(zoom);\n if (zoom <= 2) return `${signedString(Math.round(zoom * 100))}%`;\n if (zoom >= 100) return `${Math.round(zoom).toLocaleString('en-US')}x`;\n return `${signedString(Math.round(zoom * 10) / 10)}x`;\n}\n"],"mappings":";AAUA,IAAa,IAAa;AAM1B,SAAgB,EAAa,GAAe,GAA4C;AAItF,SAHkB,OAAO,SAAS,EAAM,GACpC,EAAM,eAAe,KAAA,GAAW,EAAQ,GACxC,OAAO,EAAM,EACA,QAAQ,MAAA,IAAiB;;AAQ5C,SAAgB,EAAkB,GAAsB;AACtD,QAAO,OAAO,EAAK,QAAA,KAAoB,IAAI,CAAC;;AAI9C,IAAM,IAAoC;CAAE,GAAG;CAAG,GAAG;CAAG,GAAG;CAAG,GAAG;CAAI;AAQrE,SAAgB,EAAc,GAAe,IAAW,GAAW;AACjE,KAAI,CAAC,OAAO,SAAS,EAAM,CAAE,QAAO,EAAa,EAAM;CACvD,IAAM,IACJ,KAAK,IAAI,EAAM,GAAG,MACd;EAAE,aAAa;EAAO,uBAAuB;EAAU,uBAAuB;EAAU,GACxF;EAAE,UAAU;EAAW,0BAA0B;EAAG,0BAA0B;EAAG;AACvF,QAAO,EAAM,eAAe,SAAS,EAAQ,CAAC,QAAQ,MAAA,IAAiB;;AAYzE,SAAgB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AO,EAAK"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"paintPreview-DPtZS4yU.js","names":[],"sources":["../../src/paintPreview.ts"],"sourcesContent":["// A `FillStyle` as one CSS background string, for the swatches and chips that\n// stand in for a paint in a panel.\n//\n// The gradient kinds are sampled rather than translated stop for stop: CSS\n// blends its own stops in sRGB, so an OKLCh gradient handed over as two stops\n// would preview as the sRGB blend of its ends. Sampling through\n// `sampleGradientStops` in the paint's own space puts the curve into the\n// stops themselves, and the browser only interpolates the short hops between.\n\nimport { sampleGradientStops, type FillStyle } from '@weasel-js/core';\n\n/** Sample count along a previewed gradient. Enough that a hue arc reads as a\n * curve at chip size; a straight sRGB ramp would need a fraction of it. */\nconst SAMPLES = 24;\n\n/**\n * A mesh patch as four corner radials over a flat base.\n *\n * This is an approximation and cannot be anything else — CSS has no mesh, and\n * the real surface only exists once the renderer has baked it. Each corner\n * fades out across the chip and they composite to something bilinear-ish,\n * which is enough for a swatch to say \"this one, not that one\". Zero alpha is\n * written as `color-mix` with `transparent` so a named or packed-alpha color\n * works without being parsed here.\n */\nfunction meshPreview(paint: { patches?: { colors: string[] }[] }): string | undefined {\n const colors = paint.patches?.[0]?.colors;\n if (!colors || colors.length < 4) return undefined;\n const fade = (c: string): string => `color-mix(in srgb, ${c} 0%, transparent)`;\n const at: [string, string][] = [\n ['0% 0%', colors[0]], ['100% 0%', colors[1]],\n ['100% 100%', colors[2]], ['0% 100%', colors[3]],\n ];\n const layers = at.map(([pos, c]) =>\n `radial-gradient(farthest-corner at ${pos}, ${c}, ${fade(c)})`);\n // The base keeps the middle opaque where the four fades have all thinned.\n layers.push(`linear-gradient(to bottom, ${colors[0]}, ${colors[2]})`);\n return layers.join(', ');\n}\n\n/** CSS color stops across the whole ramp, in the gradient's own blend space. */\nfunction sampledStops(paint: Extract<FillStyle, { stops: unknown }>): string {\n const space = paint.interpolate ?? 'rgb';\n const out: string[] = [];\n for (let i = 0; i <= SAMPLES; i++) {\n const t = i / SAMPLES;\n out.push(`${sampleGradientStops(paint.stops, t, space)} ${(t * 100).toFixed(1)}%`);\n }\n return out.join(', ');\n}\n\nconst DEG = 180 / Math.PI;\n\n/** A fraction of the box as a CSS percentage. A gradient in absolute units has\n * no box to be a fraction of, so its geometry only ever approximates here. */\nfunction pct(v: number): string {\n return `${(v * 100).toFixed(1)}%`;\n}\n\n/**\n * `paint` as a CSS `background` value, or `undefined` for a paint with no CSS\n * form — a pattern, a registered kind — which a caller shows as a checker or\n * a placeholder rather than as an invented color.\n *\n * Gradient geometry is honored as far as CSS can carry it: the angle of a\n * linear gradient, the center of a radial or conic one. A paint in `'world'`\n * or `'local'` units is measured in the scene rather than in the chip, so its\n * preview shows the ramp and not the placement.\n */\nexport function paintPreviewCss(paint: FillStyle | null | undefined): string | undefined {\n if (paint == null) return undefined;\n const kind = paint.fill ?? 'solid';\n if (kind === 'solid') return (paint as { color: string }).color;\n\n if (paint.fill === 'linear-gradient') {\n const dx = paint.to.x - paint.from.x;\n const dy = paint.to.y - paint.from.y;\n // CSS measures from \"to top\", clockwise; the paint measures in a\n // y-down plane from +x.\n const angle = dx === 0 && dy === 0 ? 90 : Math.atan2(dx, -dy) * DEG;\n return `linear-gradient(${angle.toFixed(1)}deg, ${sampledStops(paint)})`;\n }\n if (paint.fill === 'radial-gradient') {\n const at = `at ${pct(paint.center.x)} ${pct(paint.center.y)}`;\n return `radial-gradient(circle ${at}, ${sampledStops(paint)})`;\n }\n if ((paint.fill as string) === 'mesh-gradient') {\n return meshPreview(paint as unknown as { patches?: { colors: string[] }[] });\n }\n if (paint.fill === 'conic-gradient') {\n // CSS starts a conic gradient at \"to top\"; the paint starts at +x.\n const from = (paint.angle * DEG + 90).toFixed(1);\n return `conic-gradient(from ${from}deg at ${pct(paint.center.x)} ${pct(paint.center.y)}, ${sampledStops(paint)})`;\n }\n return undefined;\n}\n"],"mappings":";;AAaA,IAAM,IAAU;AAYhB,SAAS,EAAY,GAAiE;CACpF,IAAM,IAAS,EAAM,UAAU,IA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AAE,CAAC,GAAG,EAAI,EAAM,OAAO,EAAE,GACvB,IAAI,EAAa,EAAM,CAAC;AAE9D,MAAK,EAAM,SAAoB,gBAC7B,QAAO,EAAY,EAAyD;AAE9E,MAAI,EAAM,SAAS,iBAGjB,QAAO,wBADO,EAAM,QAAQ,IAAM,IAAI,QAAQ,EAChB,CAAK,SAAS,EAAI,EAAM,OAAO,EAAE,CAAC,GAAG,EAAI,EAAM,OAAO,EAAE,CAAC,IAAI,EAAa,EAAM,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"paintValue-Bz6AVuh3.js","names":[],"sources":["../../src/components/paintValue.ts"],"sourcesContent":["// Reading and writing the paint objects a property control may be pointed at.\n//\n// `data.fill` is a `FillStyle` and `data.stroke` a `Stroke`, so a control that\n// assumes either is a hex string reads `undefined` off it and writes a bare\n// string back over it. These helpers are what keep a control honest about the\n// shape it is holding.\n\n/** Whether a value is a `FillStyle` at all: an object naming a kind, or one\n * carrying a color, which is the solid member with its optional tag left off.\n * A pref's stored value is `unknown`, so this is what stands between a paint\n * control and a string someone saved there. */\nexport function isPaint(value: unknown): value is { fill?: string; color?: string } {\n if (typeof value !== 'object' || value === null) return false;\n const paint = value as { fill?: unknown; color?: unknown };\n return typeof paint.fill === 'string' || typeof paint.color === 'string';\n}\n\n/** The color of a solid paint, or `undefined` for anything else — including a\n * value that isn't a paint at all. `fill` is optional on the solid member of\n * the union, so the tag alone can't decide it. */\nexport function solidColorOf(value: unknown): string | undefined {\n if (typeof value !== 'object' || value === null) return undefined;\n const paint = value as { fill?: string; color?: unknown };\n if (paint.fill !== undefined && paint.fill !== 'solid') return undefined;\n return typeof paint.color === 'string' ? paint.color : undefined;\n}\n\n/** The single color a stroke shows, or `undefined` when it has none to show —\n * a gradient or pattern stroke, or no stroke at all. */\nexport function strokeColorOf(value: unknown): string | undefined {\n if (typeof value !== 'object' || value === null || !('paint' in value)) return undefined;\n return solidColorOf((value as { paint: unknown }).paint);\n}\n"],"mappings":";AAWA,SAAgB,EAAQ,GAA4D;AAClF,KAAI,OAAO,KAAU,aAAY,EAAgB,QAAO;CACxD,IAAM,IAAQ;AACd,QAAO,OAAO,EAAM,QAAS,YAAY,OAAO,EAAM,SAAU;;AAMlE,SAAgB,EAAa,GAAoC;AAC/D,KAAI,OAAO,KAAU,aAAY,EAAgB;CACjD,IAAM,IAAQ;AACV,SAAM,SAAS,KAAA,KAAa,EAAM,SAAS,SAC/C,QAAO,OAAO,EAAM,SAAU,WAAW,EAAM,QAAQ,KAAA;;AAKzD,SAAgB,EAAc,GAAoC;AAC5D,cAAO,KAAU,aAAY,KAAkB,EAAE,WAAW,IAChE,QAAO,EAAc,EAA6B,MAAM"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"portalHost-CjpCnuGU.js","names":[],"sources":["../../src/overlays/portalHost.tsx"],"sourcesContent":["import { createContext, useContext, useState, type ReactElement, type ReactNode } from 'react';\n\n/**\n * Elements an overlay may portal into: anything a theme has been stamped on\n * (`applyTheme` / `<ThemeProvider>` write both attributes), plus anything\n * opting in with `data-wzl-portal-host`. The opt-in exists for a styling root\n * that sits *below* the themed element — labkit's `.lk-root` carries element\n * defaults the themed wrapper does not.\n */\nconst HOST_SELECTOR = '[data-wzl-portal-host],[data-wzl-theme],[data-wzl-mode]';\n\n/**\n * The nearest element `from` sits inside that can host a portalled overlay,\n * or `null` when there is none and the body is the only answer.\n */\nexport function nearestPortalHost(from: Element | null | undefined): HTMLElement | null {\n return (from?.closest(HOST_SELECTOR) as HTMLElement | null) ?? null;\n}\n\n/** `undefined` distinguishes \"no provider\" from a provider saying `null`. */\nconst OverlayPortalContext = createContext<Element | null | undefined>(undefined);\n\n/** Props for {@link OverlayPortalProvider}. */\nexport interface OverlayPortalProviderProps {\n /** Where overlays in this subtree portal. `null` means `document.body`. */\n container: Element | null;\n children: ReactNode;\n}\n\n/**\n * Sets the portal container for every weasel overlay rendered below it,\n * overriding the nearest-themed-ancestor default. An individual overlay's\n * own `portalContainer` prop still wins.\n */\nexport function OverlayPortalProvider({ container, children }: OverlayPortalProviderProps) {\n return (\n <OverlayPortalContext.Provider value={container}>{children}</OverlayPortalContext.Provider>\n );\n}\n\n/** The `portalContainer` prop every weasel overlay accepts. */\nexport interface OverlayPortalProps {\n /**\n * Where the overlay's portal mounts. Defaults to the nearest ancestor of\n * the overlay's own position that carries a weasel theme, so the overlay\n * resolves the same `--wzl-*` tokens as the control it belongs to. Pass\n * `null` for `document.body`.\n */\n portalContainer?: Element | null;\n}\n\n/** React Aria props minus the portal key a weasel overlay owns. */\nexport type WithoutPortalTarget<T> = Omit<T, 'UNSTABLE_portalContainer'>;\n\n/** Spread onto the React Aria overlay. The unstable key is spelled here and\n * nowhere else in the package, so an upstream rename lands in one file. */\nexport interface OverlayPortalTarget {\n UNSTABLE_portalContainer: Element | undefined;\n}\n\n/**\n * Resolves where an overlay should portal, and the anchor that answers it.\n *\n * The result goes to React Aria as `UNSTABLE_portalContainer`. Its documented\n * replacement, `UNSAFE_PortalProvider`, is not re-exported by\n * react-aria-components 1.18, and reaching past it to `react-aria` for the\n * provider risks a second copy of that package whose context the overlays\n * never read — a failure that shows up as an unthemed overlay, not an error.\n *\n * Render `anchor` at the component's own position in the tree — outside the\n * portal — and spread `portalProps` onto the React Aria overlay. The anchor\n * is what \"nearest themed ancestor\" is measured from; the first render has\n * none yet, so an overlay that mounts already open lands in its host on the\n * following render, before paint.\n */\nexport function useOverlayPortal(explicit?: Element | null): {\n anchor: ReactElement;\n portalProps: OverlayPortalTarget;\n} {\n const [anchorEl, setAnchorEl] = useState<HTMLElement | null>(null);\n const fromProvider = useContext(OverlayPortalContext);\n\n const resolved =\n explicit !== undefined\n ? explicit\n : fromProvider !== undefined\n ? fromProvider\n : nearestPortalHost(anchorEl);\n\n return {\n anchor: <span hidden ref={setAnchorEl} />,\n portalProps: { UNSTABLE_portalContainer: resolved ?? undefined },\n };\n}\n"],"mappings":";;;AASA,IAAM,IAAgB;AAMtB,SAAgB,EAAkB,GAAsD;AACtF,QAAQ,GAAM,QAAQ,EAAc,IAA2B;;AAIjE,IAAM,IAAuB,EAA0C,KAAA,EAAU;AAcjF,SAAgB,EAAsB,EAAE,cAAW,eAAwC;AACzF,QACE,kBAAC,EAAqB,UAAtB;EAA+B,OAAO;EAAY;EAAyC,CAAA;;AAuC/F,SAAgB,EAAiB,GAG/B;CACA,IAAM,CAAC,GAAU,KAAe,EAA6B,KAAK,EAC5D,IAAe,EAAW,EAAqB,EAE/C,IACJ,MAAa,KAAA,IAET,MAAiB,KAAA,IAEf,EAAkB,EAAS,GAD3B,IAFF;AAKN,QAAO;EACL,QAAQ,kBAAC,QAAD;GAAM,QAAA;GAAO,KAAK;GAAe,CAAA;EACzC,aAAa,EAAE,0BAA0B,KAAY,KAAA,GAAW;EACjE"}