@weasel-js/ui 1.5.1 → 1.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (511) hide show
  1. package/dist/chunks/ActionBar-CYvfmEz0.js +57 -0
  2. package/dist/chunks/ActionBar-CYvfmEz0.js.map +1 -0
  3. package/dist/chunks/{Badge-Bf8Rd1R6.js → Badge-DZ0lFs14.js} +755 -738
  4. package/dist/chunks/Badge-DZ0lFs14.js.map +1 -0
  5. package/dist/chunks/{BandEditor-D8I5Uun-.js → BandEditor-D-nVrVO4.js} +44 -44
  6. package/dist/chunks/BandEditor-D-nVrVO4.js.map +1 -0
  7. package/dist/chunks/Button-Dyp31jMt.js +111 -0
  8. package/dist/chunks/Button-Dyp31jMt.js.map +1 -0
  9. package/dist/chunks/ButtonBar-smZzFuEo.js +46 -0
  10. package/dist/chunks/ButtonBar-smZzFuEo.js.map +1 -0
  11. package/dist/chunks/Callout-xLjnx7Mp.js +119 -0
  12. package/dist/chunks/Callout-xLjnx7Mp.js.map +1 -0
  13. package/dist/chunks/{Checkbox-BZZsPaVF.js → Checkbox-ChZz30Ds.js} +5 -5
  14. package/dist/chunks/Checkbox-ChZz30Ds.js.map +1 -0
  15. package/dist/chunks/Code-v4tDWuuN.js +24 -0
  16. package/dist/chunks/Code-v4tDWuuN.js.map +1 -0
  17. package/dist/chunks/{ColorField-YVf8irfr.js → ColorField-DJSCuSJv.js} +15 -15
  18. package/dist/chunks/{ColorField-YVf8irfr.js.map → ColorField-DJSCuSJv.js.map} +1 -1
  19. package/dist/chunks/ColorModeControl-JOEiqtE0.js +47 -0
  20. package/dist/chunks/ColorModeControl-JOEiqtE0.js.map +1 -0
  21. package/dist/chunks/{ComboBox-D57tNYDD.js → ComboBox-C1JgIpML.js} +13 -13
  22. package/dist/chunks/ComboBox-C1JgIpML.js.map +1 -0
  23. package/dist/chunks/{CurveEditor-BXiMoN9d.js → CurveEditor-f1R4kSbD.js} +2 -2
  24. package/dist/chunks/{CurveEditor-BXiMoN9d.js.map → CurveEditor-f1R4kSbD.js.map} +1 -1
  25. package/dist/chunks/DataGrid-CZPrB_3a.js +152 -0
  26. package/dist/chunks/DataGrid-CZPrB_3a.js.map +1 -0
  27. package/dist/chunks/DetailList-DHaXX4TG.js +43 -0
  28. package/dist/chunks/DetailList-DHaXX4TG.js.map +1 -0
  29. package/dist/chunks/{DetentSlider-BWNSv07Z.js → DetentSlider-BYyaZha6.js} +2 -2
  30. package/dist/chunks/{DetentSlider-BWNSv07Z.js.map → DetentSlider-BYyaZha6.js.map} +1 -1
  31. package/dist/chunks/Dialog-GIvjoDQj.js +66 -0
  32. package/dist/chunks/Dialog-GIvjoDQj.js.map +1 -0
  33. package/dist/chunks/Disclosure-D79jhmh2.js +58 -0
  34. package/dist/chunks/Disclosure-D79jhmh2.js.map +1 -0
  35. package/dist/chunks/DragGhost-DcU7cOwy.js +30 -0
  36. package/dist/chunks/DragGhost-DcU7cOwy.js.map +1 -0
  37. package/dist/chunks/{DragHandleGlyph-CppAz4_8.js → DragHandleGlyph-BtBxHjZS.js} +1 -1
  38. package/dist/chunks/{DragHandleGlyph-CppAz4_8.js.map → DragHandleGlyph-BtBxHjZS.js.map} +1 -1
  39. package/dist/chunks/{Field-BNqvUJfg.js → Field-xbqRmjsI.js} +6 -6
  40. package/dist/chunks/Field-xbqRmjsI.js.map +1 -0
  41. package/dist/chunks/FillStrokeSwatch-BViKXIPx.js +111 -0
  42. package/dist/chunks/FillStrokeSwatch-BViKXIPx.js.map +1 -0
  43. package/dist/chunks/{FontFamilySelect-CO19kyOO.js → FontFamilySelect-r9TV_xIH.js} +2 -2
  44. package/dist/chunks/{FontFamilySelect-CO19kyOO.js.map → FontFamilySelect-r9TV_xIH.js.map} +1 -1
  45. package/dist/chunks/GradientEditor-BRTxHG-W.js +333 -0
  46. package/dist/chunks/GradientEditor-BRTxHG-W.js.map +1 -0
  47. package/dist/chunks/{Icon-QhLhaGFe.js → Icon-BW0qv_U7.js} +50 -21
  48. package/dist/chunks/Icon-BW0qv_U7.js.map +1 -0
  49. package/dist/chunks/InlineRange-BwGFDhpT.js +29 -0
  50. package/dist/chunks/InlineRange-BwGFDhpT.js.map +1 -0
  51. package/dist/chunks/{Input-B9Vh7ASP.js → Input-Bx2cuUbS.js} +24 -19
  52. package/dist/chunks/Input-Bx2cuUbS.js.map +1 -0
  53. package/dist/chunks/ItemList-DzJ2lK0R.js +175 -0
  54. package/dist/chunks/ItemList-DzJ2lK0R.js.map +1 -0
  55. package/dist/chunks/ItemList.module-DDUXfuZL.js +14 -0
  56. package/dist/chunks/ItemList.module-DDUXfuZL.js.map +1 -0
  57. package/dist/chunks/{Jog-BYrxbAQU.js → Jog-LPoac9s4.js} +10 -10
  58. package/dist/chunks/Jog-LPoac9s4.js.map +1 -0
  59. package/dist/chunks/{Keycaps-CGNQV2Pz.js → Keycaps-CKiKOJnJ.js} +75 -69
  60. package/dist/chunks/Keycaps-CKiKOJnJ.js.map +1 -0
  61. package/dist/chunks/LayerList-BeGrkLb9.js +427 -0
  62. package/dist/chunks/LayerList-BeGrkLb9.js.map +1 -0
  63. package/dist/chunks/ListEditor-C6zLzCsJ.js +74 -0
  64. package/dist/chunks/ListEditor-C6zLzCsJ.js.map +1 -0
  65. package/dist/chunks/MenuButton-BcdhrNGh.js +70 -0
  66. package/dist/chunks/MenuButton-BcdhrNGh.js.map +1 -0
  67. package/dist/chunks/MeshEditor-BOOIFWnz.js +87 -0
  68. package/dist/chunks/MeshEditor-BOOIFWnz.js.map +1 -0
  69. package/dist/chunks/{NumberField-CQzS6TjF.js → NumberField-C1Y7zP-a.js} +27 -22
  70. package/dist/chunks/NumberField-C1Y7zP-a.js.map +1 -0
  71. package/dist/chunks/{OptionsBar-BWaYG_OH.js → OptionsBar-DlcagPYK.js} +3 -3
  72. package/dist/chunks/{OptionsBar-BWaYG_OH.js.map → OptionsBar-DlcagPYK.js.map} +1 -1
  73. package/dist/chunks/{PaintField-BVYMu3OI.js → PaintField-B2mLRZa4.js} +20 -20
  74. package/dist/chunks/PaintField-B2mLRZa4.js.map +1 -0
  75. package/dist/chunks/{PaintInput-BzAHCKro.js → PaintInput-BFKhd83I.js} +27 -27
  76. package/dist/chunks/PaintInput-BFKhd83I.js.map +1 -0
  77. package/dist/chunks/{PatternPicker-C4OryrYi.js → PatternPicker-DdfpxoQy.js} +6 -6
  78. package/dist/chunks/PatternPicker-DdfpxoQy.js.map +1 -0
  79. package/dist/chunks/{Plot2D-Czvyt_vG.js → Plot2D-lyO7waPQ.js} +1 -1
  80. package/dist/chunks/{Plot2D-Czvyt_vG.js.map → Plot2D-lyO7waPQ.js.map} +1 -1
  81. package/dist/chunks/{PointPlotter-Xvb98GwB.js → PointPlotter-DGs9i5P-.js} +2 -2
  82. package/dist/chunks/{PointPlotter-Xvb98GwB.js.map → PointPlotter-DGs9i5P-.js.map} +1 -1
  83. package/dist/chunks/{Powerline-B_EH-7Z-.js → Powerline-DBEPceLE.js} +7 -5
  84. package/dist/chunks/Powerline-DBEPceLE.js.map +1 -0
  85. package/dist/chunks/Prefs-Ctu0H4-b.js +475 -0
  86. package/dist/chunks/Prefs-Ctu0H4-b.js.map +1 -0
  87. package/dist/chunks/Properties-Bbneh1ws.js +281 -0
  88. package/dist/chunks/Properties-Bbneh1ws.js.map +1 -0
  89. package/dist/chunks/PropertyField-CDb19d3F.js +756 -0
  90. package/dist/chunks/PropertyField-CDb19d3F.js.map +1 -0
  91. package/dist/chunks/{RadioGroup-C6xpdQNg.js → RadioGroup-BK2mD6Q0.js} +6 -6
  92. package/dist/chunks/RadioGroup-BK2mD6Q0.js.map +1 -0
  93. package/dist/chunks/{RangeSlider-CzgeGLVS.js → RangeSlider-BiRAOsTh.js} +8 -8
  94. package/dist/chunks/RangeSlider-BiRAOsTh.js.map +1 -0
  95. package/dist/chunks/{ResizeHandle-1Ey8AOij.js → ResizeHandle-Cc6EOehs.js} +9 -9
  96. package/dist/chunks/{ResizeHandle-1Ey8AOij.js.map → ResizeHandle-Cc6EOehs.js.map} +1 -1
  97. package/dist/chunks/Select-DVValBe1.js +225 -0
  98. package/dist/chunks/Select-DVValBe1.js.map +1 -0
  99. package/dist/chunks/SelectionPanel-C5LmZA7b.js +103 -0
  100. package/dist/chunks/SelectionPanel-C5LmZA7b.js.map +1 -0
  101. package/dist/chunks/{Sidebar-BlUjn8lD.js → Sidebar-DKKd4R-x.js} +4 -4
  102. package/dist/chunks/Sidebar-DKKd4R-x.js.map +1 -0
  103. package/dist/chunks/{SidebarPanel-BqHfz6VK.js → SidebarPanel-u5NsuAZY.js} +15 -19
  104. package/dist/chunks/SidebarPanel-u5NsuAZY.js.map +1 -0
  105. package/dist/chunks/{Slider-B2ywUZH6.js → Slider-BwRrWHFW.js} +58 -58
  106. package/dist/chunks/Slider-BwRrWHFW.js.map +1 -0
  107. package/dist/chunks/{StatusBar-BFt7Yw5O.js → StatusBar-CdPdmmda.js} +6 -6
  108. package/dist/chunks/StatusBar-CdPdmmda.js.map +1 -0
  109. package/dist/chunks/SwatchGrid-C-Zx2Exd.js +73 -0
  110. package/dist/chunks/SwatchGrid-C-Zx2Exd.js.map +1 -0
  111. package/dist/chunks/{Switch-Om3t3ASc.js → Switch-DxF7TsEu.js} +5 -5
  112. package/dist/chunks/Switch-DxF7TsEu.js.map +1 -0
  113. package/dist/chunks/{Tabs-EAvYywil.js → Tabs-GXEfoe3o.js} +5 -5
  114. package/dist/chunks/Tabs-GXEfoe3o.js.map +1 -0
  115. package/dist/chunks/{Timeline-BEyKaBXl.js → Timeline-SgmpQtUV.js} +128 -132
  116. package/dist/chunks/Timeline-SgmpQtUV.js.map +1 -0
  117. package/dist/chunks/{Toast-iqLDD_XZ.js → Toast-BfcljZz6.js} +15 -15
  118. package/dist/chunks/Toast-BfcljZz6.js.map +1 -0
  119. package/dist/chunks/ToggleBar-Btnl5r7F.js +80 -0
  120. package/dist/chunks/ToggleBar-Btnl5r7F.js.map +1 -0
  121. package/dist/chunks/TokenPanel-5ajHEHha.js +634 -0
  122. package/dist/chunks/TokenPanel-5ajHEHha.js.map +1 -0
  123. package/dist/chunks/{ToolButton-Dd-1T5aX.js → ToolButton-rzqlFlAc.js} +9 -9
  124. package/dist/chunks/ToolButton-rzqlFlAc.js.map +1 -0
  125. package/dist/chunks/{ToolGroup-BBI-W-Gm.js → ToolGroup-4bUBV5k6.js} +3 -3
  126. package/dist/chunks/ToolGroup-4bUBV5k6.js.map +1 -0
  127. package/dist/chunks/ToolOptionsBar-BF3TNXA3.js +85 -0
  128. package/dist/chunks/ToolOptionsBar-BF3TNXA3.js.map +1 -0
  129. package/dist/chunks/ToolPalette-Uw4PvWwa.js +83 -0
  130. package/dist/chunks/ToolPalette-Uw4PvWwa.js.map +1 -0
  131. package/dist/chunks/Tooltip-9XiJF937.js +42 -0
  132. package/dist/chunks/Tooltip-9XiJF937.js.map +1 -0
  133. package/dist/chunks/Tree-BGt6P8tI.js +203 -0
  134. package/dist/chunks/Tree-BGt6P8tI.js.map +1 -0
  135. package/dist/chunks/{createKeyframeLayer-7j7ukrSx.js → createKeyframeLayer-BzDRCrrh.js} +71 -71
  136. package/dist/chunks/{createKeyframeLayer-7j7ukrSx.js.map → createKeyframeLayer-BzDRCrrh.js.map} +1 -1
  137. package/dist/chunks/formatShortcut-BoGqUoWi.js +15 -0
  138. package/dist/chunks/formatShortcut-BoGqUoWi.js.map +1 -0
  139. package/dist/chunks/icons-DbScMMqX.js +179 -0
  140. package/dist/chunks/icons-DbScMMqX.js.map +1 -0
  141. package/dist/chunks/interactiveTarget-C7QUBaJN.js +24 -0
  142. package/dist/chunks/interactiveTarget-C7QUBaJN.js.map +1 -0
  143. package/dist/chunks/{keyGlyph-Bp0wnLHn.js → keyGlyph-CLvUHU8c.js} +1 -1
  144. package/dist/chunks/{keyGlyph-Bp0wnLHn.js.map → keyGlyph-CLvUHU8c.js.map} +1 -1
  145. package/dist/chunks/model-BQMvTLnW.js +360 -0
  146. package/dist/chunks/model-BQMvTLnW.js.map +1 -0
  147. package/dist/chunks/number-6S8IzXVt.js +89 -0
  148. package/dist/chunks/number-6S8IzXVt.js.map +1 -0
  149. package/dist/chunks/paintPreview-DPtZS4yU.js +42 -0
  150. package/dist/chunks/paintPreview-DPtZS4yU.js.map +1 -0
  151. package/dist/chunks/paintValue-Bz6AVuh3.js +18 -0
  152. package/dist/chunks/paintValue-Bz6AVuh3.js.map +1 -0
  153. package/dist/chunks/prefField-CLkhrvYl.js +197 -0
  154. package/dist/chunks/prefField-CLkhrvYl.js.map +1 -0
  155. package/dist/chunks/segmentTooltip-CAkZlW-t.js +29 -0
  156. package/dist/chunks/segmentTooltip-CAkZlW-t.js.map +1 -0
  157. package/dist/chunks/segmentedControl.module-D2nw68Yo.js +11 -0
  158. package/dist/chunks/segmentedControl.module-D2nw68Yo.js.map +1 -0
  159. package/dist/chunks/{snap-B0WQwetQ.js → snap-DC4Km8xG.js} +1 -1
  160. package/dist/chunks/{snap-B0WQwetQ.js.map → snap-DC4Km8xG.js.map} +1 -1
  161. package/dist/chunks/stance-CarrcbbP.js +17 -0
  162. package/dist/chunks/stance-CarrcbbP.js.map +1 -0
  163. package/dist/chunks/useReorderDragList-Dcezzgix.js +131 -0
  164. package/dist/chunks/useReorderDragList-Dcezzgix.js.map +1 -0
  165. package/dist/chunks/{useRovingTabIndex-Dkpf_KhN.js → useRovingTabIndex-B4uJqiKP.js} +1 -1
  166. package/dist/chunks/useRovingTabIndex-B4uJqiKP.js.map +1 -0
  167. package/dist/color/oklch.d.ts +2 -1
  168. package/dist/color/oklch.d.ts.map +1 -1
  169. package/dist/color/ramp.d.ts +38 -0
  170. package/dist/color/ramp.d.ts.map +1 -0
  171. package/dist/components/ActionBar/ActionBar.d.ts +6 -4
  172. package/dist/components/ActionBar/ActionBar.d.ts.map +1 -1
  173. package/dist/components/ActionBar/index.js +1 -1
  174. package/dist/components/Badge/Badge.d.ts +21 -7
  175. package/dist/components/Badge/Badge.d.ts.map +1 -1
  176. package/dist/components/Badge/effects/Aqua.d.ts +1 -1
  177. package/dist/components/Badge/effects/Aqua.d.ts.map +1 -1
  178. package/dist/components/Badge/index.d.ts +1 -1
  179. package/dist/components/Badge/index.d.ts.map +1 -1
  180. package/dist/components/Badge/index.js +1 -1
  181. package/dist/components/Badge/types.d.ts +6 -5
  182. package/dist/components/Badge/types.d.ts.map +1 -1
  183. package/dist/components/BandEditor/index.js +1 -1
  184. package/dist/components/Button/Button.d.ts +17 -3
  185. package/dist/components/Button/Button.d.ts.map +1 -1
  186. package/dist/components/Button/index.d.ts +1 -1
  187. package/dist/components/Button/index.d.ts.map +1 -1
  188. package/dist/components/Button/index.js +1 -1
  189. package/dist/components/ButtonBar/ButtonBar.d.ts +36 -0
  190. package/dist/components/ButtonBar/ButtonBar.d.ts.map +1 -0
  191. package/dist/components/ButtonBar/index.d.ts +3 -0
  192. package/dist/components/ButtonBar/index.d.ts.map +1 -0
  193. package/dist/components/ButtonBar/index.js +2 -0
  194. package/dist/components/Callout/Callout.d.ts +2 -5
  195. package/dist/components/Callout/Callout.d.ts.map +1 -1
  196. package/dist/components/Callout/index.d.ts +1 -1
  197. package/dist/components/Callout/index.d.ts.map +1 -1
  198. package/dist/components/Callout/index.js +1 -1
  199. package/dist/components/Checkbox/index.js +1 -1
  200. package/dist/components/Code/Code.d.ts +28 -0
  201. package/dist/components/Code/Code.d.ts.map +1 -0
  202. package/dist/components/Code/index.d.ts +3 -0
  203. package/dist/components/Code/index.d.ts.map +1 -0
  204. package/dist/components/Code/index.js +2 -0
  205. package/dist/components/ColorField/index.js +1 -1
  206. package/dist/components/ColorModeControl/ColorModeControl.d.ts +21 -0
  207. package/dist/components/ColorModeControl/ColorModeControl.d.ts.map +1 -0
  208. package/dist/components/ColorModeControl/index.d.ts +3 -0
  209. package/dist/components/ColorModeControl/index.d.ts.map +1 -0
  210. package/dist/components/ColorModeControl/index.js +2 -0
  211. package/dist/components/ComboBox/index.js +1 -1
  212. package/dist/components/CurveEditor/index.js +3 -3
  213. package/dist/components/DataGrid/DataGrid.d.ts +22 -0
  214. package/dist/components/DataGrid/DataGrid.d.ts.map +1 -1
  215. package/dist/components/DataGrid/index.js +1 -1
  216. package/dist/components/DetailList/DetailList.d.ts +36 -0
  217. package/dist/components/DetailList/DetailList.d.ts.map +1 -0
  218. package/dist/components/DetailList/index.d.ts +3 -0
  219. package/dist/components/DetailList/index.d.ts.map +1 -0
  220. package/dist/components/DetailList/index.js +2 -0
  221. package/dist/components/DetentSlider/index.js +1 -1
  222. package/dist/components/Dialog/Dialog.d.ts +8 -2
  223. package/dist/components/Dialog/Dialog.d.ts.map +1 -1
  224. package/dist/components/Dialog/index.js +1 -1
  225. package/dist/components/Disclosure/Disclosure.d.ts +25 -17
  226. package/dist/components/Disclosure/Disclosure.d.ts.map +1 -1
  227. package/dist/components/Disclosure/index.d.ts +2 -2
  228. package/dist/components/Disclosure/index.d.ts.map +1 -1
  229. package/dist/components/Disclosure/index.js +2 -2
  230. package/dist/components/DragGhost/DragGhost.d.ts +21 -0
  231. package/dist/components/DragGhost/DragGhost.d.ts.map +1 -0
  232. package/dist/components/DragGhost/index.d.ts +3 -0
  233. package/dist/components/DragGhost/index.d.ts.map +1 -0
  234. package/dist/components/DragGhost/index.js +2 -0
  235. package/dist/components/DragHandleGlyph/index.js +1 -1
  236. package/dist/components/Field/index.js +1 -1
  237. package/dist/components/FillStrokeSwatch/FillStrokeSwatch.d.ts +45 -0
  238. package/dist/components/FillStrokeSwatch/FillStrokeSwatch.d.ts.map +1 -0
  239. package/dist/components/FillStrokeSwatch/index.d.ts +3 -0
  240. package/dist/components/FillStrokeSwatch/index.d.ts.map +1 -0
  241. package/dist/components/FillStrokeSwatch/index.js +2 -0
  242. package/dist/components/FontFamilySelect/index.js +1 -1
  243. package/dist/components/GradientEditor/SceneGradientHandles.d.ts.map +1 -1
  244. package/dist/components/GradientEditor/index.js +1 -1
  245. package/dist/components/InlineRange/InlineRange.d.ts +6 -2
  246. package/dist/components/InlineRange/InlineRange.d.ts.map +1 -1
  247. package/dist/components/InlineRange/index.js +1 -1
  248. package/dist/components/Input/Input.d.ts +13 -0
  249. package/dist/components/Input/Input.d.ts.map +1 -1
  250. package/dist/components/Input/index.js +1 -1
  251. package/dist/components/ItemList/ItemList.d.ts +70 -10
  252. package/dist/components/ItemList/ItemList.d.ts.map +1 -1
  253. package/dist/components/ItemList/index.js +1 -1
  254. package/dist/components/Jog/index.js +1 -1
  255. package/dist/components/Keycaps/index.d.ts +1 -0
  256. package/dist/components/Keycaps/index.d.ts.map +1 -1
  257. package/dist/components/Keycaps/index.js +3 -3
  258. package/dist/components/Keycaps/keySpecsFromMods.d.ts +2 -0
  259. package/dist/components/Keycaps/keySpecsFromMods.d.ts.map +1 -1
  260. package/dist/components/Keycaps/keySpecsFromShortcut.d.ts +16 -0
  261. package/dist/components/Keycaps/keySpecsFromShortcut.d.ts.map +1 -0
  262. package/dist/components/LayerList/LayerList.d.ts +79 -0
  263. package/dist/components/LayerList/LayerList.d.ts.map +1 -0
  264. package/dist/components/LayerList/index.d.ts +3 -0
  265. package/dist/components/LayerList/index.d.ts.map +1 -0
  266. package/dist/components/LayerList/index.js +2 -0
  267. package/dist/components/LayerList/useSceneLayerList.d.ts +20 -0
  268. package/dist/components/LayerList/useSceneLayerList.d.ts.map +1 -0
  269. package/dist/components/ListEditor/ListEditor.d.ts +23 -0
  270. package/dist/components/ListEditor/ListEditor.d.ts.map +1 -0
  271. package/dist/components/ListEditor/index.d.ts +3 -0
  272. package/dist/components/ListEditor/index.d.ts.map +1 -0
  273. package/dist/components/ListEditor/index.js +2 -0
  274. package/dist/components/MenuButton/MenuButton.d.ts +6 -2
  275. package/dist/components/MenuButton/MenuButton.d.ts.map +1 -1
  276. package/dist/components/MenuButton/index.js +1 -1
  277. package/dist/components/MeshEditor/index.js +1 -1
  278. package/dist/components/NumberField/NumberField.d.ts +13 -0
  279. package/dist/components/NumberField/NumberField.d.ts.map +1 -1
  280. package/dist/components/NumberField/UnitField.d.ts +2 -1
  281. package/dist/components/NumberField/UnitField.d.ts.map +1 -1
  282. package/dist/components/NumberField/index.js +1 -1
  283. package/dist/components/OptionsBar/index.js +1 -1
  284. package/dist/components/PaintField/index.js +1 -1
  285. package/dist/components/PaintInput/index.js +1 -1
  286. package/dist/components/PatternPicker/index.js +1 -1
  287. package/dist/components/Plot2D/index.js +1 -1
  288. package/dist/components/PointPlotter/index.js +1 -1
  289. package/dist/components/Powerline/Powerline.d.ts +4 -3
  290. package/dist/components/Powerline/Powerline.d.ts.map +1 -1
  291. package/dist/components/Powerline/index.js +2 -2
  292. package/dist/components/Prefs/PrefsDialog.d.ts +10 -2
  293. package/dist/components/Prefs/PrefsDialog.d.ts.map +1 -1
  294. package/dist/components/Prefs/PrefsForm.d.ts +26 -25
  295. package/dist/components/Prefs/PrefsForm.d.ts.map +1 -1
  296. package/dist/components/Prefs/PrefsPane.d.ts +24 -0
  297. package/dist/components/Prefs/PrefsPane.d.ts.map +1 -0
  298. package/dist/components/Prefs/PrefsRail.d.ts +32 -0
  299. package/dist/components/Prefs/PrefsRail.d.ts.map +1 -0
  300. package/dist/components/Prefs/PrefsRow.d.ts +32 -0
  301. package/dist/components/Prefs/PrefsRow.d.ts.map +1 -0
  302. package/dist/components/Prefs/index.d.ts +5 -2
  303. package/dist/components/Prefs/index.d.ts.map +1 -1
  304. package/dist/components/Prefs/index.js +3 -3
  305. package/dist/components/Prefs/prefField.d.ts +36 -0
  306. package/dist/components/Prefs/prefField.d.ts.map +1 -0
  307. package/dist/components/Prefs/schema.d.ts +32 -1
  308. package/dist/components/Prefs/schema.d.ts.map +1 -1
  309. package/dist/components/Properties/DialogRow.d.ts +33 -0
  310. package/dist/components/Properties/DialogRow.d.ts.map +1 -0
  311. package/dist/components/Properties/PropertyField.d.ts +238 -0
  312. package/dist/components/Properties/PropertyField.d.ts.map +1 -0
  313. package/dist/components/Properties/PropertyGroup.d.ts +18 -3
  314. package/dist/components/Properties/PropertyGroup.d.ts.map +1 -1
  315. package/dist/components/Properties/PropertyPanel.d.ts +50 -256
  316. package/dist/components/Properties/PropertyPanel.d.ts.map +1 -1
  317. package/dist/components/Properties/Subpanel.d.ts +14 -0
  318. package/dist/components/Properties/Subpanel.d.ts.map +1 -0
  319. package/dist/components/Properties/index.d.ts +8 -6
  320. package/dist/components/Properties/index.d.ts.map +1 -1
  321. package/dist/components/Properties/index.js +3 -2
  322. package/dist/components/Properties/storyLayouts.d.ts.map +1 -1
  323. package/dist/components/RadioGroup/index.js +1 -1
  324. package/dist/components/RangeSlider/index.js +1 -1
  325. package/dist/components/ResizeHandle/index.js +1 -1
  326. package/dist/components/Select/Select.d.ts +56 -5
  327. package/dist/components/Select/Select.d.ts.map +1 -1
  328. package/dist/components/Select/index.d.ts +2 -2
  329. package/dist/components/Select/index.d.ts.map +1 -1
  330. package/dist/components/Select/index.js +2 -2
  331. package/dist/components/SelectionPanel/SelectionPanel.d.ts +3 -50
  332. package/dist/components/SelectionPanel/SelectionPanel.d.ts.map +1 -1
  333. package/dist/components/SelectionPanel/index.js +3 -2
  334. package/dist/components/SelectionPanel/model.d.ts +4 -1
  335. package/dist/components/SelectionPanel/model.d.ts.map +1 -1
  336. package/dist/components/SelectionPanel/renderLeaf.d.ts +112 -0
  337. package/dist/components/SelectionPanel/renderLeaf.d.ts.map +1 -0
  338. package/dist/components/Sidebar/index.js +1 -1
  339. package/dist/components/SidebarPanel/SidebarPanel.d.ts +2 -2
  340. package/dist/components/SidebarPanel/SidebarPanel.d.ts.map +1 -1
  341. package/dist/components/SidebarPanel/index.js +1 -1
  342. package/dist/components/Slider/index.js +1 -1
  343. package/dist/components/StatusBar/index.js +1 -1
  344. package/dist/components/SwatchGrid/SwatchGrid.d.ts +34 -0
  345. package/dist/components/SwatchGrid/SwatchGrid.d.ts.map +1 -0
  346. package/dist/components/SwatchGrid/index.d.ts +3 -0
  347. package/dist/components/SwatchGrid/index.d.ts.map +1 -0
  348. package/dist/components/SwatchGrid/index.js +2 -0
  349. package/dist/components/Switch/index.js +1 -1
  350. package/dist/components/Tabs/index.js +1 -1
  351. package/dist/components/Timeline/Lane.d.ts.map +1 -1
  352. package/dist/components/Timeline/index.js +1 -1
  353. package/dist/components/Toast/index.js +1 -1
  354. package/dist/components/ToggleBar/ToggleBar.d.ts +2 -1
  355. package/dist/components/ToggleBar/ToggleBar.d.ts.map +1 -1
  356. package/dist/components/ToggleBar/index.js +1 -1
  357. package/dist/components/TokenPanel/TokenPanel.d.ts +10 -4
  358. package/dist/components/TokenPanel/TokenPanel.d.ts.map +1 -1
  359. package/dist/components/TokenPanel/index.d.ts +2 -2
  360. package/dist/components/TokenPanel/index.d.ts.map +1 -1
  361. package/dist/components/TokenPanel/index.js +2 -2
  362. package/dist/components/TokenPanel/tokenTypes.d.ts +24 -0
  363. package/dist/components/TokenPanel/tokenTypes.d.ts.map +1 -1
  364. package/dist/components/ToolButton/index.js +1 -1
  365. package/dist/components/ToolGroup/index.js +1 -1
  366. package/dist/components/ToolOptionsBar/ToolOptionsBar.d.ts +29 -18
  367. package/dist/components/ToolOptionsBar/ToolOptionsBar.d.ts.map +1 -1
  368. package/dist/components/ToolOptionsBar/index.js +1 -1
  369. package/dist/components/ToolPalette/ToolPalette.d.ts +5 -4
  370. package/dist/components/ToolPalette/ToolPalette.d.ts.map +1 -1
  371. package/dist/components/ToolPalette/index.d.ts +1 -0
  372. package/dist/components/ToolPalette/index.d.ts.map +1 -1
  373. package/dist/components/ToolPalette/index.js +3 -2
  374. package/dist/components/Tooltip/Tooltip.d.ts +6 -2
  375. package/dist/components/Tooltip/Tooltip.d.ts.map +1 -1
  376. package/dist/components/Tooltip/index.d.ts +1 -1
  377. package/dist/components/Tooltip/index.d.ts.map +1 -1
  378. package/dist/components/Tooltip/index.js +2 -2
  379. package/dist/components/Tree/Tree.d.ts +84 -0
  380. package/dist/components/Tree/Tree.d.ts.map +1 -0
  381. package/dist/components/Tree/index.d.ts +3 -0
  382. package/dist/components/Tree/index.d.ts.map +1 -0
  383. package/dist/components/Tree/index.js +2 -0
  384. package/dist/components/segmentTooltip.d.ts +30 -0
  385. package/dist/components/segmentTooltip.d.ts.map +1 -0
  386. package/dist/components/stance.d.ts +30 -0
  387. package/dist/components/stance.d.ts.map +1 -0
  388. package/dist/components/stanceCss.d.ts +31 -0
  389. package/dist/components/stanceCss.d.ts.map +1 -0
  390. package/dist/components/stanceSurfaces.d.ts +4 -0
  391. package/dist/components/stanceSurfaces.d.ts.map +1 -0
  392. package/dist/format/number.d.ts +13 -3
  393. package/dist/format/number.d.ts.map +1 -1
  394. package/dist/icons/Icon.d.ts.map +1 -1
  395. package/dist/icons/ShapeKindIcon.d.ts +10 -0
  396. package/dist/icons/ShapeKindIcon.d.ts.map +1 -0
  397. package/dist/icons/index.d.ts +5 -3
  398. package/dist/icons/index.d.ts.map +1 -1
  399. package/dist/icons/paths.d.ts +11 -1
  400. package/dist/icons/paths.d.ts.map +1 -1
  401. package/dist/index.d.ts +16 -3
  402. package/dist/index.d.ts.map +1 -1
  403. package/dist/index.js +110 -84
  404. package/dist/index.js.map +1 -1
  405. package/dist/interactiveTarget.d.ts +9 -0
  406. package/dist/interactiveTarget.d.ts.map +1 -0
  407. package/dist/style.css +1 -1
  408. package/dist/useReorderDragList.d.ts +36 -7
  409. package/dist/useReorderDragList.d.ts.map +1 -1
  410. package/dist/useRovingTabIndex.d.ts +8 -6
  411. package/dist/useRovingTabIndex.d.ts.map +1 -1
  412. package/dist/useScrollSpy.d.ts +48 -0
  413. package/dist/useScrollSpy.d.ts.map +1 -0
  414. package/package.json +8 -8
  415. package/dist/chunks/ActionBar-GZdcfdQL.js +0 -62
  416. package/dist/chunks/ActionBar-GZdcfdQL.js.map +0 -1
  417. package/dist/chunks/ActionsBar-Fhx_40iP.js +0 -41
  418. package/dist/chunks/ActionsBar-Fhx_40iP.js.map +0 -1
  419. package/dist/chunks/Badge-Bf8Rd1R6.js.map +0 -1
  420. package/dist/chunks/BandEditor-D8I5Uun-.js.map +0 -1
  421. package/dist/chunks/Button-CExdkQcU.js +0 -90
  422. package/dist/chunks/Button-CExdkQcU.js.map +0 -1
  423. package/dist/chunks/Callout-cx5_CWcW.js +0 -122
  424. package/dist/chunks/Callout-cx5_CWcW.js.map +0 -1
  425. package/dist/chunks/Checkbox-BZZsPaVF.js.map +0 -1
  426. package/dist/chunks/ComboBox-D57tNYDD.js.map +0 -1
  427. package/dist/chunks/DataGrid-BVdDMZkQ.js +0 -104
  428. package/dist/chunks/DataGrid-BVdDMZkQ.js.map +0 -1
  429. package/dist/chunks/Dialog-DuOzsR2g.js +0 -61
  430. package/dist/chunks/Dialog-DuOzsR2g.js.map +0 -1
  431. package/dist/chunks/Disclosure-9UgDzc7Z.js +0 -47
  432. package/dist/chunks/Disclosure-9UgDzc7Z.js.map +0 -1
  433. package/dist/chunks/Field-BNqvUJfg.js.map +0 -1
  434. package/dist/chunks/GradientEditor-B_ymIr4Q.js +0 -333
  435. package/dist/chunks/GradientEditor-B_ymIr4Q.js.map +0 -1
  436. package/dist/chunks/Icon-QhLhaGFe.js.map +0 -1
  437. package/dist/chunks/InlineRange-DdIlfGqG.js +0 -29
  438. package/dist/chunks/InlineRange-DdIlfGqG.js.map +0 -1
  439. package/dist/chunks/Input-B9Vh7ASP.js.map +0 -1
  440. package/dist/chunks/ItemList-BZJQReXD.js +0 -42
  441. package/dist/chunks/ItemList-BZJQReXD.js.map +0 -1
  442. package/dist/chunks/Jog-BYrxbAQU.js.map +0 -1
  443. package/dist/chunks/Keycaps-CGNQV2Pz.js.map +0 -1
  444. package/dist/chunks/LayerStack-DOylrQcm.js +0 -142
  445. package/dist/chunks/LayerStack-DOylrQcm.js.map +0 -1
  446. package/dist/chunks/MenuButton-DGE-0DP0.js +0 -60
  447. package/dist/chunks/MenuButton-DGE-0DP0.js.map +0 -1
  448. package/dist/chunks/MeshEditor-CHoGQ9K8.js +0 -123
  449. package/dist/chunks/MeshEditor-CHoGQ9K8.js.map +0 -1
  450. package/dist/chunks/NumberField-CQzS6TjF.js.map +0 -1
  451. package/dist/chunks/PaintField-BVYMu3OI.js.map +0 -1
  452. package/dist/chunks/PaintInput-BzAHCKro.js.map +0 -1
  453. package/dist/chunks/PatternPicker-C4OryrYi.js.map +0 -1
  454. package/dist/chunks/Powerline-B_EH-7Z-.js.map +0 -1
  455. package/dist/chunks/Prefs-FuaJBs3t.js +0 -308
  456. package/dist/chunks/Prefs-FuaJBs3t.js.map +0 -1
  457. package/dist/chunks/Properties-B3KU69NI.js +0 -874
  458. package/dist/chunks/Properties-B3KU69NI.js.map +0 -1
  459. package/dist/chunks/RadioGroup-C6xpdQNg.js.map +0 -1
  460. package/dist/chunks/RangeSlider-CzgeGLVS.js.map +0 -1
  461. package/dist/chunks/Select-BMYVh10x.js +0 -127
  462. package/dist/chunks/Select-BMYVh10x.js.map +0 -1
  463. package/dist/chunks/SelectionPanel-DTpcQidl.js +0 -572
  464. package/dist/chunks/SelectionPanel-DTpcQidl.js.map +0 -1
  465. package/dist/chunks/Sidebar-BlUjn8lD.js.map +0 -1
  466. package/dist/chunks/SidebarPanel-BqHfz6VK.js.map +0 -1
  467. package/dist/chunks/Slider-B2ywUZH6.js.map +0 -1
  468. package/dist/chunks/StatusBar-BFt7Yw5O.js.map +0 -1
  469. package/dist/chunks/Switch-Om3t3ASc.js.map +0 -1
  470. package/dist/chunks/Tabs-EAvYywil.js.map +0 -1
  471. package/dist/chunks/Timeline-BEyKaBXl.js.map +0 -1
  472. package/dist/chunks/Toast-iqLDD_XZ.js.map +0 -1
  473. package/dist/chunks/ToggleBar--9As2PWG.js +0 -75
  474. package/dist/chunks/ToggleBar--9As2PWG.js.map +0 -1
  475. package/dist/chunks/TokenPanel-BL9hlq7x.js +0 -374
  476. package/dist/chunks/TokenPanel-BL9hlq7x.js.map +0 -1
  477. package/dist/chunks/ToolButton-Dd-1T5aX.js.map +0 -1
  478. package/dist/chunks/ToolGroup-BBI-W-Gm.js.map +0 -1
  479. package/dist/chunks/ToolOptionsBar-B2xPWzJf.js +0 -27
  480. package/dist/chunks/ToolOptionsBar-B2xPWzJf.js.map +0 -1
  481. package/dist/chunks/ToolPalette-BmTDDpmz.js +0 -97
  482. package/dist/chunks/ToolPalette-BmTDDpmz.js.map +0 -1
  483. package/dist/chunks/Tooltip-BHre_vbI.js +0 -42
  484. package/dist/chunks/Tooltip-BHre_vbI.js.map +0 -1
  485. package/dist/chunks/icons-Btrs-JD7.js +0 -165
  486. package/dist/chunks/icons-Btrs-JD7.js.map +0 -1
  487. package/dist/chunks/number-f6PydOZK.js +0 -52
  488. package/dist/chunks/number-f6PydOZK.js.map +0 -1
  489. package/dist/chunks/range.module-DSsOIq1R.js +0 -8
  490. package/dist/chunks/range.module-DSsOIq1R.js.map +0 -1
  491. package/dist/chunks/schema-MCVT1MLv.js +0 -47
  492. package/dist/chunks/schema-MCVT1MLv.js.map +0 -1
  493. package/dist/chunks/segmentedControl.module-DmeUMYe3.js +0 -11
  494. package/dist/chunks/segmentedControl.module-DmeUMYe3.js.map +0 -1
  495. package/dist/chunks/useReorderDragList-CSQGd7zQ.js +0 -102
  496. package/dist/chunks/useReorderDragList-CSQGd7zQ.js.map +0 -1
  497. package/dist/chunks/useRovingTabIndex-Dkpf_KhN.js.map +0 -1
  498. package/dist/components/ActionsBar/ActionsBar.d.ts +0 -35
  499. package/dist/components/ActionsBar/ActionsBar.d.ts.map +0 -1
  500. package/dist/components/ActionsBar/index.d.ts +0 -3
  501. package/dist/components/ActionsBar/index.d.ts.map +0 -1
  502. package/dist/components/ActionsBar/index.js +0 -2
  503. package/dist/components/LayerStack/LayerStack.d.ts +0 -62
  504. package/dist/components/LayerStack/LayerStack.d.ts.map +0 -1
  505. package/dist/components/LayerStack/index.d.ts +0 -2
  506. package/dist/components/LayerStack/index.d.ts.map +0 -1
  507. package/dist/components/LayerStack/index.js +0 -2
  508. package/dist/components/Properties/EffectCard.d.ts +0 -69
  509. package/dist/components/Properties/EffectCard.d.ts.map +0 -1
  510. package/dist/components/Properties/PinDot.d.ts +0 -18
  511. package/dist/components/Properties/PinDot.d.ts.map +0 -1
@@ -0,0 +1,197 @@
1
+ import { a as e, t } from "./Icon-BW0qv_U7.js";
2
+ import { t as n } from "./paintValue-Bz6AVuh3.js";
3
+ import { isBuiltinToolPref as r } from "@weasel-js/core";
4
+ import { jsx as i } from "react/jsx-runtime";
5
+ //#region src/components/Prefs/schema.ts
6
+ function a(e) {
7
+ if (!e.unit) return {
8
+ min: e.min,
9
+ max: e.max,
10
+ step: e.step ?? 1
11
+ };
12
+ let { toDisplay: t } = e.unit, n = e.min === void 0 ? void 0 : t(e.min), r = e.max === void 0 ? void 0 : t(e.max), i = n !== void 0 && r !== void 0 && n > r, a = e.step === void 0 ? 1 : Math.abs(t(e.step) - t(0)) || e.step;
13
+ return {
14
+ min: i ? r : n,
15
+ max: i ? n : r,
16
+ step: a
17
+ };
18
+ }
19
+ function o(e) {
20
+ return e.suffix === void 0 ? { ...e.accepts } : {
21
+ [e.suffix]: 1,
22
+ ...e.accepts
23
+ };
24
+ }
25
+ function s(e) {
26
+ return "kind" in e;
27
+ }
28
+ function c(e, t) {
29
+ let n = e;
30
+ for (let e of t.split(".")) {
31
+ if (typeof n != "object" || !n) return;
32
+ n = n[e];
33
+ }
34
+ return n;
35
+ }
36
+ function l(e, t) {
37
+ if (s(e)) return e.hidden && !t ? null : e;
38
+ let n = e, r = {};
39
+ for (let [e, i] of Object.entries(n.children)) {
40
+ let n = l(i, t);
41
+ n && (r[e] = n);
42
+ }
43
+ return Object.keys(r).length === 0 ? null : {
44
+ ...e,
45
+ children: r
46
+ };
47
+ }
48
+ function u(e) {
49
+ if (s(e)) return 1;
50
+ let t = 0;
51
+ for (let n of Object.values(e.children)) t += u(n);
52
+ return t;
53
+ }
54
+ function d(e) {
55
+ let t = [], n = Object.values(e.children).filter(s).length;
56
+ n > 0 && t.push({
57
+ path: "",
58
+ name: e.name,
59
+ depth: 0,
60
+ section: "",
61
+ matches: n
62
+ });
63
+ for (let [n, r] of Object.entries(e.children)) if (!s(r)) {
64
+ t.push({
65
+ path: n,
66
+ name: r.name,
67
+ depth: 0,
68
+ section: n,
69
+ matches: u(r)
70
+ });
71
+ for (let [e, i] of Object.entries(r.children)) s(i) || t.push({
72
+ path: `${n}.${e}`,
73
+ name: i.name,
74
+ depth: 1,
75
+ section: n,
76
+ matches: u(i)
77
+ });
78
+ }
79
+ return t;
80
+ }
81
+ function f(e, t, n) {
82
+ return e.name.toLowerCase().includes(n) || e.description?.toLowerCase().includes(n) ? !0 : t.toLowerCase().includes(n);
83
+ }
84
+ function p(e, t, n = "") {
85
+ let r = t.trim().toLowerCase();
86
+ if (r === "") return e;
87
+ if (s(e)) return f(e, n, r) ? e : null;
88
+ let i = e;
89
+ if (i.name.toLowerCase().includes(r)) return e;
90
+ let a = {};
91
+ for (let [e, t] of Object.entries(i.children)) {
92
+ let i = p(t, r, n === "" ? e : `${n}.${e}`);
93
+ i && (a[e] = i);
94
+ }
95
+ return Object.keys(a).length === 0 ? null : {
96
+ ...e,
97
+ children: a
98
+ };
99
+ }
100
+ //#endregion
101
+ //#region src/components/Prefs/prefField.tsx
102
+ function m(e, t) {
103
+ let { value: i, mixed: s = !1, unset: c = !1, siblings: l, setValue: u } = t;
104
+ if (e.kind === "font-family") {
105
+ let e = t.fontVariant ? t.fontVariant.weight : l?.fontWeight, n = t.fontVariant ? t.fontVariant.style : l?.fontStyle;
106
+ return {
107
+ kind: "font-family",
108
+ value: typeof i == "string" ? i : void 0,
109
+ mixed: s,
110
+ unset: c,
111
+ onChange: u,
112
+ weight: typeof e == "number" ? e : void 0,
113
+ fontStyle: n === "italic" ? "italic" : void 0
114
+ };
115
+ }
116
+ if (!r(e)) return null;
117
+ switch (e.kind) {
118
+ case "boolean": return {
119
+ kind: "boolean",
120
+ control: e.control,
121
+ value: typeof i == "boolean" ? i : void 0,
122
+ mixed: s,
123
+ unset: c,
124
+ glyph: h(e.icon) ?? e.short,
125
+ onChange: u
126
+ };
127
+ case "number": {
128
+ let t = e.unit, n = typeof i == "number" && Number.isFinite(i) ? i : void 0, r = a(e), l = (e) => Math.min(r.max ?? Infinity, Math.max(r.min ?? -Infinity, e));
129
+ return {
130
+ kind: "number",
131
+ control: e.control,
132
+ value: n === void 0 ? void 0 : t ? t.toDisplay(n) : n,
133
+ mixed: s,
134
+ unset: c,
135
+ min: r.min,
136
+ max: r.max,
137
+ step: r.step,
138
+ unit: t?.suffix,
139
+ accepts: t ? o(t) : void 0,
140
+ notation: e.format,
141
+ onChange: (e) => u(t ? t.fromDisplay(l(e)) : l(e))
142
+ };
143
+ }
144
+ case "string": return {
145
+ kind: "string",
146
+ control: e.control,
147
+ value: typeof i == "string" ? i : "",
148
+ mixed: s,
149
+ unset: c,
150
+ onChange: u
151
+ };
152
+ case "enum": {
153
+ let t = e.encoding, n = t ? s ? void 0 : t.read(i, l) : s || c ? void 0 : typeof i == "string" ? i : e.default;
154
+ return {
155
+ kind: "enum",
156
+ control: e.control,
157
+ value: n,
158
+ mixed: s,
159
+ unset: c,
160
+ options: e.options.map((e) => ({
161
+ value: e.value,
162
+ label: e.label,
163
+ glyph: h(e.icon) ?? e.short,
164
+ disabled: e.disabled
165
+ })),
166
+ onChange: (e) => u(t ? t.write(e, l) : e)
167
+ };
168
+ }
169
+ case "color": return {
170
+ kind: "color",
171
+ value: typeof i == "string" ? i : e.default,
172
+ mixed: s,
173
+ unset: c,
174
+ alpha: e.alpha ? !0 : void 0,
175
+ onChange: u
176
+ };
177
+ case "paint": return {
178
+ kind: "paint",
179
+ value: i === null ? null : n(i) ? i : s ? void 0 : n(e.default) ? e.default : null,
180
+ mixed: s,
181
+ unset: c,
182
+ onChange: u
183
+ };
184
+ case "object": return null;
185
+ default: throw Error(`prefFieldProps: no control for built-in pref kind "${e.kind}"`);
186
+ }
187
+ }
188
+ function h(n) {
189
+ return n && n in e ? /* @__PURE__ */ i(t, {
190
+ name: n,
191
+ size: 14
192
+ }) : void 0;
193
+ }
194
+ //#endregion
195
+ export { d as a, a as i, p as n, c as o, s as r, l as s, m as t };
196
+
197
+ //# sourceMappingURL=prefField-CLkhrvYl.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prefField-CLkhrvYl.js","names":[],"sources":["../../src/components/Prefs/schema.ts","../../src/components/Prefs/prefField.tsx"],"sourcesContent":["// Preference-schema vocabulary for PrefsForm / PrefsDialog / SelectionPanel:\n// core's `ToolPref*` family under this package's names. Never re-declare them\n// here — this was a hand-kept structural copy until it drifted, and the\n// independence from `@weasel-js/core` it bought is long gone anyway.\n\nexport type {\n ToolPref as BuiltinPref,\n ToolPrefBoolean as PrefBoolean,\n ToolPrefBooleanControl as PrefBooleanControl,\n ToolPrefColor as PrefColor,\n ToolPrefCustom as PrefCustom,\n ToolPrefEnum as PrefEnum,\n ToolPrefEnumControl as PrefEnumControl,\n ToolPrefEnumEncoding as PrefEnumEncoding,\n ToolPrefGroup as PrefGroup,\n ToolPrefKind as PrefKind,\n ToolPrefLeaf as PrefLeaf,\n ToolPrefNumber as PrefNumber,\n ToolPrefNumberControl as PrefNumberControl,\n ToolPrefNumberFormat as PrefNumberFormat,\n ToolPrefNumberUnit as PrefNumberUnit,\n ToolPrefObject as PrefObject,\n ToolPrefPaint as PrefPaint,\n ToolPrefString as PrefString,\n ToolPrefStringControl as PrefStringControl,\n} from '@weasel-js/core';\n\nimport type { UnitTable } from '../../format/number';\nimport type { ToolPrefGroup, ToolPrefLeaf, ToolPrefNumber, ToolPrefNumberUnit as PrefNumberUnitType } from '@weasel-js/core';\n\n/**\n * A number leaf's bounds in the unit it is displayed in.\n *\n * Only what the leaf declares converts: an omitted bound has no stored\n * counterpart to put through the conversion, and its fallback — 0..100 for a\n * slider's track, a step of 1 — is a display-space number already. `min` and\n * `max` are points, so they convert the way the value does; `step` is a\n * distance, and a unit with an offset maps zero somewhere else, so converting\n * it as a point would scale it wrong. A decreasing conversion swaps which end\n * is the lower one.\n */\nexport function prefDisplayBounds(\n p: ToolPrefNumber,\n): { min?: number; max?: number; step: number } {\n if (!p.unit) return { min: p.min, max: p.max, step: p.step ?? 1 };\n const { toDisplay } = p.unit;\n const lo = p.min === undefined ? undefined : toDisplay(p.min);\n const hi = p.max === undefined ? undefined : toDisplay(p.max);\n const flipped = lo !== undefined && hi !== undefined && lo > hi;\n const step = p.step === undefined\n ? 1\n : Math.abs(toDisplay(p.step) - toDisplay(0)) || p.step;\n return { min: flipped ? hi : lo, max: flipped ? lo : hi, step };\n}\n\n/** What a unit leaf's field reads as typed text: its `accepts` table, and its\n * `suffix` as the display unit itself. */\nexport function prefUnitAccepts(unit: PrefNumberUnitType): Readonly<UnitTable> {\n return unit.suffix === undefined ? { ...unit.accepts } : { [unit.suffix]: 1, ...unit.accepts };\n}\n\n/** Distinguishes a leaf from a group while walking a schema tree. */\nexport function isPrefLeaf(node: ToolPrefLeaf | ToolPrefGroup): node is ToolPrefLeaf {\n return 'kind' in node;\n}\n\n/** Get the value at a dotted path inside a nested value tree. Returns\n * `undefined` when a segment is missing or hits a non-object. */\nexport function prefValueAtPath(values: unknown, path: string): unknown {\n let cur: unknown = values;\n for (const seg of path.split('.')) {\n if (cur == null || typeof cur !== 'object') return undefined;\n cur = (cur as Record<string, unknown>)[seg];\n }\n return cur;\n}\n\n/**\n * Recursively drop `hidden` leaves (unless `showHidden`), pruning groups\n * that end up empty. Returns null when the entire subtree is hidden.\n */\nexport function visiblePrefSubtree<T extends ToolPrefLeaf | ToolPrefGroup>(\n node: T,\n showHidden: boolean,\n): T | null {\n if (isPrefLeaf(node)) return node.hidden && !showHidden ? null : node;\n const group = node as ToolPrefGroup;\n const children: Record<string, ToolPrefLeaf | ToolPrefGroup> = {};\n for (const [key, child] of Object.entries(group.children)) {\n const kept = visiblePrefSubtree(child, showHidden);\n if (kept) children[key] = kept;\n }\n if (Object.keys(children).length === 0) return null;\n return { ...node, children };\n}\n\n/** One entry in a {@link PrefsForm} rail: a group the reader can navigate to. */\nexport interface PrefRailItem {\n /** Dotted path of the group. Empty for the entry holding loose root leaves. */\n path: string;\n name: string;\n /** 0 opens a pane; 1 scrolls within the open one. The rail goes no deeper. */\n depth: 0 | 1;\n /** Path of the depth-0 ancestor — its own path when `depth` is 0. */\n section: string;\n /** Leaves surviving the active filter, counted over the whole subtree. */\n matches: number;\n}\n\n/** Leaves anywhere under `node`, counted. */\nfunction countPrefLeaves(node: ToolPrefLeaf | ToolPrefGroup): number {\n if (isPrefLeaf(node)) return 1;\n let n = 0;\n for (const child of Object.values(node.children)) n += countPrefLeaves(child);\n return n;\n}\n\n/**\n * The rail's model for a schema: depth-0 groups, each followed by its depth-1\n * children. Deeper groups render inside a pane and get no entry — a schema\n * that nests ten deep still navigates two levels.\n *\n * Loose leaves directly under the root lead the list under an entry named for\n * the root itself, since they belong to no group that could name them.\n */\nexport function prefRailItems(root: ToolPrefGroup): PrefRailItem[] {\n const items: PrefRailItem[] = [];\n const loose = Object.values(root.children).filter(isPrefLeaf).length;\n if (loose > 0) {\n items.push({ path: '', name: root.name, depth: 0, section: '', matches: loose });\n }\n for (const [key, child] of Object.entries(root.children)) {\n if (isPrefLeaf(child)) continue;\n items.push({\n path: key,\n name: child.name,\n depth: 0,\n section: key,\n matches: countPrefLeaves(child),\n });\n for (const [subKey, sub] of Object.entries(child.children)) {\n if (isPrefLeaf(sub)) continue;\n items.push({\n path: `${key}.${subKey}`,\n name: sub.name,\n depth: 1,\n section: key,\n matches: countPrefLeaves(sub),\n });\n }\n }\n return items;\n}\n\n/** Whether one leaf answers to a filter query, by name, description or path. */\nfunction prefLeafMatches(pref: ToolPrefLeaf, path: string, query: string): boolean {\n if (pref.name.toLowerCase().includes(query)) return true;\n if (pref.description?.toLowerCase().includes(query)) return true;\n return path.toLowerCase().includes(query);\n}\n\n/**\n * Drop every leaf that does not answer to `query`, pruning groups left empty.\n * A group whose own name matches keeps all of its leaves — a reader who typed\n * the group's name is asking for the group, not for leaves repeating it.\n *\n * An empty or whitespace query matches everything, so a cleared field restores\n * the tree rather than emptying it.\n */\nexport function filterPrefSubtree<T extends ToolPrefLeaf | ToolPrefGroup>(\n node: T,\n query: string,\n path = '',\n): T | null {\n const q = query.trim().toLowerCase();\n if (q === '') return node;\n if (isPrefLeaf(node)) return prefLeafMatches(node, path, q) ? node : null;\n const group = node as ToolPrefGroup;\n if (group.name.toLowerCase().includes(q)) return node;\n const children: Record<string, ToolPrefLeaf | ToolPrefGroup> = {};\n for (const [key, child] of Object.entries(group.children)) {\n const kept = filterPrefSubtree(child, q, path === '' ? key : `${path}.${key}`);\n if (kept) children[key] = kept;\n }\n if (Object.keys(children).length === 0) return null;\n return { ...node, children };\n}\n","import type { ReactNode } from 'react';\nimport { isBuiltinToolPref, type FillStyle } from '@weasel-js/core';\nimport { Icon } from '../../icons/Icon';\nimport { ICON_PATHS, type IconName } from '../../icons/paths';\nimport { isPaint } from '../paintValue';\nimport type { PropertyControlProps } from '../Properties/PropertyField';\nimport { prefDisplayBounds, prefUnitAccepts, type PrefLeaf } from './schema';\n\n/** What {@link prefFieldProps} is told about one leaf's value. */\nexport interface PrefFieldState {\n /** The value held at the leaf. `undefined` when `mixed` or `unset`. */\n value: unknown;\n mixed?: boolean;\n unset?: boolean;\n /** The object the leaf is a field of, for an enum `encoding` and a font's\n * weight and slant. `undefined` for a top-level leaf. */\n siblings?: Record<string, unknown>;\n /** Writes a value in the leaf's stored form. */\n setValue: (value: unknown) => void;\n /** A font family's weight and slant, where they are not `siblings`' own\n * `fontWeight` / `fontStyle`. */\n fontVariant?: { weight?: unknown; style?: unknown };\n}\n\n/**\n * A schema leaf as {@link PropertyControl} props: its value, bounds and\n * options in the form it is shown in, and a writer that stores what the\n * control reports in the form the leaf holds.\n *\n * The conversions every schema-driven surface needs live here once — a\n * number's display unit and its bounds, an enum's `encoding`, a color's\n * alpha, an icon resolved to a glyph. A leaf that is not a single control —\n * an `object`, whose fields each are, or an app-defined kind — returns\n * `null`, and the surface draws it.\n *\n * Spread the result and add what the surface decides: `chrome`, `name`, a\n * class, a different default `control`.\n */\nexport function prefFieldProps(leaf: PrefLeaf, state: PrefFieldState): PropertyControlProps | null {\n const { value, mixed = false, unset = false, siblings, setValue } = state;\n if (leaf.kind === 'font-family') {\n const weight = state.fontVariant ? state.fontVariant.weight : siblings?.fontWeight;\n const style = state.fontVariant ? state.fontVariant.style : siblings?.fontStyle;\n return {\n kind: 'font-family',\n value: typeof value === 'string' ? value : undefined,\n mixed,\n unset,\n onChange: setValue,\n weight: typeof weight === 'number' ? weight : undefined,\n fontStyle: style === 'italic' ? 'italic' : undefined,\n };\n }\n if (!isBuiltinToolPref(leaf)) return null;\n switch (leaf.kind) {\n case 'boolean':\n return {\n kind: 'boolean',\n control: leaf.control,\n value: typeof value === 'boolean' ? value : undefined,\n mixed,\n unset,\n glyph: glyphOf(leaf.icon) ?? leaf.short,\n onChange: setValue,\n };\n case 'number': {\n const unit = leaf.unit;\n const stored = typeof value === 'number' && Number.isFinite(value) ? value : undefined;\n // `min`/`max`/`step` are declared in the stored unit, like the value, so\n // they convert with it — a leaf storing radians and showing degrees was\n // clamping typed degrees against 0..6.28.\n const bounds = prefDisplayBounds(leaf);\n const clamp = (n: number) =>\n Math.min(bounds.max ?? Infinity, Math.max(bounds.min ?? -Infinity, n));\n const store = (shown: number) => setValue(unit ? unit.fromDisplay(clamp(shown)) : clamp(shown));\n return {\n kind: 'number',\n control: leaf.control,\n value: stored === undefined ? undefined : unit ? unit.toDisplay(stored) : stored,\n mixed,\n unset,\n min: bounds.min,\n max: bounds.max,\n step: bounds.step,\n unit: unit?.suffix,\n accepts: unit ? prefUnitAccepts(unit) : undefined,\n notation: leaf.format,\n onChange: store,\n };\n }\n case 'string':\n return {\n kind: 'string',\n control: leaf.control,\n value: typeof value === 'string' ? value : '',\n mixed,\n unset,\n onChange: setValue,\n };\n case 'enum': {\n const encoding = leaf.encoding;\n // An encoded leaf stores something other than the option string (a dash\n // array), so the option comes from the encoding — and an absent field is\n // one of the things it reads (no dash is `solid`), which is why `unset`\n // does not blank it.\n const option = encoding\n ? mixed\n ? undefined\n : encoding.read(value, siblings)\n : mixed || unset\n ? undefined\n : typeof value === 'string'\n ? value\n : leaf.default;\n return {\n kind: 'enum',\n control: leaf.control,\n value: option,\n mixed,\n unset,\n options: leaf.options.map((o) => ({\n value: o.value,\n label: o.label,\n glyph: glyphOf(o.icon) ?? o.short,\n disabled: o.disabled,\n })),\n onChange: (next: string) => setValue(encoding ? encoding.write(next, siblings) : next),\n };\n }\n case 'color':\n return {\n kind: 'color',\n value: typeof value === 'string' ? value : leaf.default,\n mixed,\n unset,\n alpha: leaf.alpha ? true : undefined,\n onChange: setValue,\n };\n case 'paint': {\n // `??` would read an explicit `null` — \"no paint\" — as absent and show\n // the default over it. Unset shows the fallback actually in effect,\n // dimmed by the control: true, but not chosen.\n const paint =\n value === null\n ? null\n : isPaint(value)\n ? value\n : mixed\n ? undefined\n : isPaint(leaf.default)\n ? leaf.default\n : null;\n return {\n kind: 'paint',\n value: paint as FillStyle | null | undefined,\n mixed,\n unset,\n onChange: setValue,\n };\n }\n case 'object':\n return null;\n default: {\n // Not reachable while every built-in kind has an arm — and a new kind\n // that lacks one is a compile error here, never a blank row.\n const _exhaustive: never = leaf;\n throw new Error(\n `prefFieldProps: no control for built-in pref kind \"${(_exhaustive as { kind: string }).kind}\"`,\n );\n }\n }\n}\n\n/** A leaf's `icon` as a glyph, where the kit's icon set has it. */\nfunction glyphOf(icon: string | undefined): ReactNode {\n return icon && icon in ICON_PATHS ? <Icon name={icon as IconName} size={14} /> : undefined;\n}\n"],"mappings":";;;;;AAyCA,SAAgB,EACd,GAC8C;AAC9C,KAAI,CAAC,EAAE,KAAM,QAAO;EAAE,KAAK,EAAE;EAAK,KAAK,EAAE;EAAK,MAAM,EAAE,QAAQ;EAAG;CACjE,IAAM,EAAE,iBAAc,EAAE,MAClB,IAAK,EAAE,QAAQ,KAAA,IAAY,KAAA,IAAY,EAAU,EAAE,IAAI,EACvD,IAAK,EAAE,QAAQ,KAAA,IAAY,KAAA,IAAY,EAAU,EAAE,IAAI,EACvD,IAAU,MAAO,KAAA,KAAa,MAAO,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K;GACd,OAAO,OAAO,KAAU,WAAW,IAAQ;GAC3C;GACA;GACA,UAAU;GACX;EACH,KAAK,QAAQ;GACX,IAAM,IAAW,EAAK,UAKhB,IAAS,IACX,IACE,KAAA,IACA,EAAS,KAAK,GAAO,EAAS,GAChC,KAAS,IACP,KAAA,IACA,OAAO,KAAU,WACf,IACA,EAAK;AACb,UAAO;IACL,MAAM;IACN,SAAS,EAAK;IACd,OAAO;IACP;IACA;IACA,SAAS,EAAK,QAAQ,KAAK,OAAO;KAChC,OAAO,EAAE;KACT,OAAO,EAAE;KACT,OAAO,EAAQ,EAAE,KAAK,IAAI,EAAE;KAC5B,UAAU,EAAE;KACb,EAAE;IACH,WAAW,MAAiB,EAAS,IAAW,EAAS,MAAM,GAAM,EAAS,GAAG,EAAK;IACvF;;EAEH,KAAK,QACH,QAAO;GACL,MAAM;GACN,OAAO,OAAO,KAAU,WAAW,IAAQ,EAAK;GAChD;GACA;GACA,OAAO,EAAK,QAAQ,KAAO,KAAA;GAC3B,UAAU;GACX;EACH,KAAK,QAcH,QAAO;GACL,MAAM;GACN,OAXA,MAAU,OACN,OACA,EAAQ,EAAM,GACZ,IACA,IACE,KAAA,IACA,EAAQ,EAAK,QAAQ,GACnB,EAAK,UACL;GAIV;GACA;GACA,UAAU;GACX;EAEH,KAAK,SACH,QAAO;EACT,QAIE,OAAU,MACR,sDAAuD,EAAiC,KAAK,GAC9F;;;AAMP,SAAS,EAAQ,GAAqC;AACpD,QAAO,KAAQ,KAAQ,IAAa,kBAAC,GAAD;EAAM,MAAM;EAAkB,MAAM;EAAM,CAAA,GAAG,KAAA"}
@@ -0,0 +1,29 @@
1
+ import { n as e, r as t } from "./Tooltip-9XiJF937.js";
2
+ import { jsx as n, jsxs as r } from "react/jsx-runtime";
3
+ import { Focusable as i } from "react-aria-components";
4
+ //#region src/components/segmentTooltip.tsx
5
+ function a(e) {
6
+ if (e.tooltip !== void 0) return e.tooltip;
7
+ if (!e.shortcut) return;
8
+ let t = e.ariaLabel ?? (typeof e.label == "string" ? e.label : void 0);
9
+ return t ? `${t} (${e.shortcut})` : e.shortcut;
10
+ }
11
+ function o({ content: a, disabled: o, children: s }) {
12
+ return a == null || a === !1 ? s : /* @__PURE__ */ r(t, {
13
+ isDisabled: o,
14
+ children: [/* @__PURE__ */ n(i, {
15
+ isDisabled: o,
16
+ children: s
17
+ }), /* @__PURE__ */ n(e, { children: a })]
18
+ });
19
+ }
20
+ function s({ content: i, disabled: a, children: o }) {
21
+ return i == null || i === !1 ? o : /* @__PURE__ */ r(t, {
22
+ isDisabled: a,
23
+ children: [o, /* @__PURE__ */ n(e, { children: i })]
24
+ });
25
+ }
26
+ //#endregion
27
+ export { s as n, a as r, o as t };
28
+
29
+ //# sourceMappingURL=segmentTooltip-CAkZlW-t.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"segmentTooltip-CAkZlW-t.js","names":[],"sources":["../../src/components/segmentTooltip.tsx"],"sourcesContent":["import type { DOMAttributes, ReactElement, ReactNode } from 'react';\nimport { Focusable } from 'react-aria-components';\nimport { Tooltip, TooltipTrigger } from './Tooltip';\n\n/** The tooltip fields a segmented bar's item carries. */\nexport interface SegmentTooltipFields {\n /** Tooltip content. Overrides the name-plus-`shortcut` default. */\n tooltip?: ReactNode;\n /** Shortcut hint shown in the tooltip as `Name (⌘Z)`, the way `ToolButton`\n * and `ActionBar` show theirs. The name is `ariaLabel`, else a string\n * `label`. */\n shortcut?: string;\n}\n\n/** Tooltip content for an item, or `undefined` for none. */\nexport function segmentTooltipContent(\n item: SegmentTooltipFields & { label?: ReactNode; ariaLabel?: string },\n): ReactNode | undefined {\n if (item.tooltip !== undefined) return item.tooltip;\n if (!item.shortcut) return undefined;\n const name = item.ariaLabel ?? (typeof item.label === 'string' ? item.label : undefined);\n return name ? `${name} (${item.shortcut})` : item.shortcut;\n}\n\n/** Wraps a segment's `<button>` in a kit tooltip when there is content for one. */\nexport function SegmentTooltip({ content, disabled, children }: {\n content: ReactNode | undefined;\n disabled?: boolean;\n children: ReactElement<DOMAttributes<HTMLButtonElement>, 'button'>;\n}): ReactElement {\n if (content === undefined || content === null || content === false) return children;\n return (\n <TooltipTrigger isDisabled={disabled}>\n <Focusable isDisabled={disabled}>{children}</Focusable>\n <Tooltip>{content}</Tooltip>\n </TooltipTrigger>\n );\n}\n\n/** {@link SegmentTooltip} for a React Aria trigger (`Button` inside a\n * `MenuTrigger` or `Select`), which takes the tooltip's hover and focus props\n * itself and so needs no `Focusable` around it. */\nexport function TriggerTooltip({ content, disabled, children }: {\n content: ReactNode | undefined;\n disabled?: boolean;\n children: ReactElement;\n}): ReactElement {\n if (content === undefined || content === null || content === false) return children;\n return (\n <TooltipTrigger isDisabled={disabled}>\n {children}\n <Tooltip>{content}</Tooltip>\n </TooltipTrigger>\n );\n}\n"],"mappings":";;;;AAeA,SAAgB,EACd,GACuB;AACvB,KAAI,EAAK,YAAY,KAAA,EAAW,QAAO,EAAK;AAC5C,KAAI,CAAC,EAAK,SAAU;CACpB,IAAM,IAAO,EAAK,cAAc,OAAO,EAAK,SAAU,WAAW,EAAK,QAAQ,KAAA;AAC9E,QAAO,IAAO,GAAG,EAAK,IAAI,EAAK,SAAS,KAAK,EAAK;;AAIpD,SAAgB,EAAe,EAAE,YAAS,aAAU,eAInC;AAEf,QADI,KAAqC,QAAQ,MAAY,KAAc,IAEzE,kBAAC,GAAD;EAAgB,YAAY;YAA5B,CACE,kBAAC,GAAD;GAAW,YAAY;GAAW;GAAqB,CAAA,EACvD,kBAAC,GAAD,EAAA,UAAU,GAAkB,CAAA,CACb;;;AAOrB,SAAgB,EAAe,EAAE,YAAS,aAAU,eAInC;AAEf,QADI,KAAqC,QAAQ,MAAY,KAAc,IAEzE,kBAAC,GAAD;EAAgB,YAAY;YAA5B,CACG,GACD,kBAAC,GAAD,EAAA,UAAU,GAAkB,CAAA,CACb"}
@@ -0,0 +1,11 @@
1
+ var e = {
2
+ root: "_root_4jvk7_10",
3
+ segment: "_segment_4jvk7_32",
4
+ segmentSelected: "_segmentSelected_4jvk7_81",
5
+ size_sm: "_size_sm_4jvk7_139",
6
+ variant_minimal: "_variant_minimal_4jvk7_152"
7
+ };
8
+ //#endregion
9
+ export { e as t };
10
+
11
+ //# sourceMappingURL=segmentedControl.module-D2nw68Yo.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"segmentedControl.module-D2nw68Yo.js","names":[],"sources":["../../src/components/segmentedControl.module.css"],"sourcesContent":["/* Shared by ButtonBar and OptionsBar, which look identical and differ only\n in what a segment does. Lives here rather than in either component so\n neither owns the other's styling.\n\n Aqua-glass segmented control. The track is a pill-shaped well; the\n selected segment becomes a tinted glass cylinder that reads as the same\n \"lozenge\" family as the standalone Button. Visual params come from the\n `--btn-*` custom properties (see Button.module.css) so the Button Lab\n can tune both surfaces with one set of sliders. */\n.root {\n display: inline-flex;\n height: var(--tb-h, var(--wzl-control-h, 24px));\n padding: var(--wzl-space-1);\n background: linear-gradient(\n 180deg,\n rgba(0, 0, 0, 0.18) 0%,\n rgba(0, 0, 0, 0.05) 100%\n );\n border-radius: var(--wzl-radius-pill);\n /* Clip segments to the track outline so interior corners read crisp and\n the selected segment's glass treatment doesn't paint over the rounded\n outer pixels. */\n overflow: hidden;\n box-shadow:\n inset 0 1px 2px rgba(0, 0, 0, 0.4),\n 0 1px 0 rgba(255, 255, 255, 0.06);\n user-select: none;\n -webkit-user-select: none;\n touch-action: none;\n}\n\n.segment {\n position: relative;\n flex: 1 1 0;\n min-width: 0;\n /* The track's stretch sizes a segment; without this, labkit's :where(button) height wins and overflows a small bar. */\n height: auto;\n padding: 0 var(--wzl-space-6);\n display: inline-flex;\n align-items: center;\n justify-content: center;\n background: transparent;\n border: none;\n margin: 0;\n font-family: var(--wzl-font-ui);\n font-weight: var(--wzl-font-weight-normal);\n font-size: var(--btn-fontsize, var(--wzl-font-size));\n line-height: 1;\n color: var(--wzl-fg-muted);\n cursor: pointer;\n /* Only round the outer corners of the bar — middle segments stay square\n so the seams between them don't render as facing parentheses. */\n border-radius: 0;\n isolation: isolate;\n overflow: hidden;\n transition: color var(--wzl-motion-fast);\n}\n\n.segment:first-child {\n border-radius: var(--wzl-radius-pill) 0 0 var(--wzl-radius-pill);\n}\n\n.segment:last-child {\n border-radius: 0 var(--wzl-radius-pill) var(--wzl-radius-pill) 0;\n}\n\n.segment:only-child {\n border-radius: var(--wzl-radius-pill);\n}\n\n.segment:focus-visible {\n outline: 2px solid var(--wzl-accent);\n outline-offset: -2px;\n}\n\n.segment:disabled {\n opacity: 0.5;\n cursor: not-allowed;\n}\n\n.segment:hover:not(:disabled):not(.segmentSelected) {\n color: var(--wzl-fg);\n}\n\n/* Selected segment — full Aqua glass cylinder. Mirrors Button.variant_primary. */\n.segmentSelected {\n background: linear-gradient(\n 180deg,\n color-mix(in srgb, var(--wzl-accent) var(--btn-top-alpha, 45%), transparent) 0%,\n color-mix(in srgb, var(--wzl-accent) var(--btn-upper-alpha, 70%), transparent) calc(var(--btn-equator, 52%) - var(--btn-equator-spread, 12%)),\n color-mix(in srgb, var(--wzl-accent) var(--btn-equator-tint, 95%), white) var(--btn-equator, 52%),\n var(--wzl-accent) calc(var(--btn-equator, 52%) + var(--btn-equator-spread, 12%) * 1.6),\n color-mix(in srgb, var(--wzl-accent) var(--btn-base-tint, 70%), black) 100%\n );\n backdrop-filter: blur(var(--btn-blur, 6px)) saturate(var(--btn-saturate, 1.3));\n -webkit-backdrop-filter: blur(var(--btn-blur, 6px)) saturate(var(--btn-saturate, 1.3));\n color: var(--wzl-fg-on-accent);\n text-shadow:\n 0 1px 0 rgba(0, 0, 0, var(--btn-text-shadow, 0.35)),\n var(--btn-text-inset-x, 0px) var(--btn-text-inset-y, 1px) 0 rgba(0, 0, 0, var(--btn-text-inset, 0.55)),\n 0 0 6px rgba(0, 0, 0, calc(var(--btn-text-shadow, 0.35) * 0.5));\n box-shadow:\n inset 0 1px 0 rgba(255, 255, 255, var(--btn-inset-hi, 0.42)),\n inset 0 -1px 2px rgba(0, 0, 0, var(--btn-inset-lo, 0.3)),\n 0 0 0 1px rgba(0, 0, 0, var(--btn-rim, 0.22)),\n 0 1px 2px rgba(0, 0, 0, var(--btn-drop-near, 0.3)),\n 0 2px 4px rgba(0, 0, 0, calc(var(--btn-drop-far, 0.18) * 0.8));\n}\n\n/* Specular gloss on the selected segment. Top corners inherit the\n segment's radius so they hug the upper edge cleanly; bottom corners\n are flattened so the gloss ends in a straight line at the equator\n instead of two little curves that read as `)(` brackets. */\n.segmentSelected::before {\n content: '';\n position: absolute;\n inset: 1px 1px var(--btn-gloss-bottom, 50%) 1px;\n border-radius: inherit;\n border-bottom-left-radius: 0;\n border-bottom-right-radius: 0;\n background: linear-gradient(\n 180deg,\n rgba(255, 255, 255, var(--btn-gloss-top, 0.42)) 0%,\n rgba(255, 255, 255, var(--btn-gloss-mid, 0.12)) 60%,\n rgba(255, 255, 255, 0) 100%\n );\n pointer-events: none;\n z-index: 1;\n}\n\n.segmentSelected > * {\n position: relative;\n z-index: 2;\n}\n\n/* Small variant — ~60% of the default height, with proportionally reduced\n padding and font. Sized for dense surfaces (lab control panels, inline\n filters, etc.). */\n.size_sm {\n height: 17px;\n padding: 1px;\n}\n\n.size_sm .segment {\n padding: 0 var(--wzl-space-4);\n font-size: var(--wzl-font-size-sm);\n}\n\n/* Minimal variant — strips the pill track, glass selected state, inset\n shadows, and outer padding. Used in dense diagnostic surfaces (dispatch\n trace, lab inspectors) where the bar must read as plain text controls. */\n.variant_minimal {\n height: auto;\n padding: 0;\n background: none;\n border-radius: 0;\n box-shadow: none;\n gap: var(--wzl-space-1);\n}\n\n.variant_minimal .segment {\n padding: 0 var(--wzl-space-2);\n font-size: var(--wzl-font-size-sm);\n font-weight: var(--wzl-font-weight-medium);\n line-height: 1.4;\n border-radius: var(--wzl-radius-sm);\n color: var(--wzl-fg-muted);\n transition: none;\n}\n\n.variant_minimal .segment:first-child,\n.variant_minimal .segment:last-child,\n.variant_minimal .segment:only-child {\n border-radius: var(--wzl-radius-sm);\n}\n\n.variant_minimal .segment:hover:not(:disabled):not(.segmentSelected) {\n color: var(--wzl-fg);\n background: var(--wzl-surface-hover);\n}\n\n.variant_minimal .segmentSelected {\n background: none;\n backdrop-filter: none;\n -webkit-backdrop-filter: none;\n color: var(--wzl-accent-fg, var(--wzl-accent));\n text-shadow: none;\n box-shadow: none;\n font-weight: var(--wzl-font-weight-medium);\n}\n\n.variant_minimal .segmentSelected::before {\n content: none;\n}\n"],"mappings":""}
@@ -10,4 +10,4 @@ function e(e, t, n) {
10
10
  //#endregion
11
11
  export { e as t };
12
12
 
13
- //# sourceMappingURL=snap-B0WQwetQ.js.map
13
+ //# sourceMappingURL=snap-DC4Km8xG.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"snap-B0WQwetQ.js","names":[],"sources":["../../src/snap.ts"],"sourcesContent":["/** How close, in screen pixels, a drag has to come to a candidate to snap to it. */\nexport const SNAP_RADIUS_PX = 6;\n\n/** Snap `value` to the nearest candidate within `tolerance`, else return it. */\nexport function snapToNearest(value: number, candidates: readonly number[], tolerance: number): number {\n let best = value;\n let bestDist = tolerance;\n for (const c of candidates) {\n const d = Math.abs(c - value);\n if (d <= bestDist) {\n best = c;\n bestDist = d;\n }\n }\n return best;\n}\n"],"mappings":";AAIA,SAAgB,EAAc,GAAe,GAA+B,GAA2B;CACrG,IAAI,IAAO,GACP,IAAW;AACf,MAAK,IAAM,KAAK,GAAY;EAC1B,IAAM,IAAI,KAAK,IAAI,IAAI,EAAM;AAC7B,EAAI,KAAK,MACP,IAAO,GACP,IAAW;;AAGf,QAAO"}
1
+ {"version":3,"file":"snap-DC4Km8xG.js","names":[],"sources":["../../src/snap.ts"],"sourcesContent":["/** How close, in screen pixels, a drag has to come to a candidate to snap to it. */\nexport const SNAP_RADIUS_PX = 6;\n\n/** Snap `value` to the nearest candidate within `tolerance`, else return it. */\nexport function snapToNearest(value: number, candidates: readonly number[], tolerance: number): number {\n let best = value;\n let bestDist = tolerance;\n for (const c of candidates) {\n const d = Math.abs(c - value);\n if (d <= bestDist) {\n best = c;\n bestDist = d;\n }\n }\n return best;\n}\n"],"mappings":";AAIA,SAAgB,EAAc,GAAe,GAA+B,GAA2B;CACrG,IAAI,IAAO,GACP,IAAW;AACf,MAAK,IAAM,KAAK,GAAY;EAC1B,IAAM,IAAI,KAAK,IAAI,IAAI,EAAM;AAC7B,EAAI,KAAK,MACP,IAAO,GACP,IAAW;;AAGf,QAAO"}
@@ -0,0 +1,17 @@
1
+ import { colorCssAt as e } from "@weasel-js/theme";
2
+ import { useTones as t } from "@weasel-js/theme/react";
3
+ //#region src/components/stance.ts
4
+ function n({ stance: n, tone: r }) {
5
+ let i = t();
6
+ if (n === void 0 && r === void 0) return {};
7
+ let a = r === void 0 ? void 0 : typeof r == "number" ? e(i.tones, r, i) : r;
8
+ return {
9
+ "data-stance": n,
10
+ "data-tone": r === void 0 ? void 0 : String(r),
11
+ style: a === void 0 ? void 0 : { "--wzl-tone": a }
12
+ };
13
+ }
14
+ //#endregion
15
+ export { n as t };
16
+
17
+ //# sourceMappingURL=stance-CarrcbbP.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stance-CarrcbbP.js","names":[],"sources":["../../src/components/stance.ts"],"sourcesContent":["import { colorCssAt, type Stance } from '@weasel-js/theme';\nimport { useTones } from '@weasel-js/theme/react';\nimport type { CSSProperties } from 'react';\n\nexport type { Stance } from '@weasel-js/theme';\n\n/**\n * What a surface holds, and which of its peers it is. Every surface that takes\n * these takes both, and the theme decides how each looks.\n */\nexport interface StanceProps {\n /** The class of content the surface holds. Omitted, it draws as it always has. */\n stance?: Stance;\n /**\n * Which of its peers this is: an index into the theme's tone list, wrapping,\n * or a color given directly. Independent of `stance`, and allowed without one.\n */\n tone?: number | string;\n}\n\n/** The attributes a stanced surface renders, and the style carrying its resolved tone. */\nexport interface StanceAttrs {\n 'data-stance'?: Stance;\n 'data-tone'?: string;\n style?: CSSProperties;\n}\n\n/**\n * Resolves `stance` and `tone` for a surface's root element. The tone is\n * written inline as `--wzl-tone`; a tone-list index resolves through the nearest\n * `<ThemeProvider>`'s tones, as a custom-property reference where the list is\n * a theme ramp, so it follows the mode without a re-render.\n */\nexport function useStance({ stance, tone }: StanceProps): StanceAttrs {\n const ctx = useTones();\n if (stance === undefined && tone === undefined) return {};\n const color = tone === undefined ? undefined : typeof tone === 'number' ? colorCssAt(ctx.tones, tone, ctx) : tone;\n return {\n 'data-stance': stance,\n 'data-tone': tone === undefined ? undefined : String(tone),\n style: color === undefined ? undefined : ({ '--wzl-tone': color } as CSSProperties),\n };\n}\n"],"mappings":";;;AAiCA,SAAgB,EAAU,EAAE,WAAQ,WAAkC;CACpE,IAAM,IAAM,GAAU;AACtB,KAAI,MAAW,KAAA,KAAa,MAAS,KAAA,EAAW,QAAO,EAAE;CACzD,IAAM,IAAQ,MAAS,KAAA,IAAY,KAAA,IAAY,OAAO,KAAS,WAAW,EAAW,EAAI,OAAO,GAAM,EAAI,GAAG;AAC7G,QAAO;EACL,eAAe;EACf,aAAa,MAAS,KAAA,IAAY,KAAA,IAAY,OAAO,EAAK;EAC1D,OAAO,MAAU,KAAA,IAAY,KAAA,IAAa,EAAE,cAAc,GAAO;EAClE"}
@@ -0,0 +1,131 @@
1
+ import { n as e } from "./interactiveTarget-C7QUBaJN.js";
2
+ import { startThresholdDrag as t } from "@weasel-js/core";
3
+ import { useCallback as n, useEffect as r, useRef as i, useState as a } from "react";
4
+ //#region src/useReorderDragList.ts
5
+ var o = {
6
+ draggedIds: null,
7
+ targetIndex: null,
8
+ ghost: null
9
+ };
10
+ function s(e, t) {
11
+ let n = 0;
12
+ for (let r = t - 1; r >= 0; r--) if (e[r]?.locked) {
13
+ n = r + 1;
14
+ break;
15
+ }
16
+ let r = e.length;
17
+ for (let n = t + 1; n < e.length; n++) if (e[n]?.locked) {
18
+ r = n;
19
+ break;
20
+ }
21
+ return [n, r];
22
+ }
23
+ function c(e, t, n, r) {
24
+ let [i, a] = s(e, r);
25
+ return (t.includes(n) ? [...t] : [n]).filter((t) => {
26
+ let n = e.findIndex((e) => e.id === t);
27
+ return n >= i && n < a;
28
+ });
29
+ }
30
+ function l(e, t, n) {
31
+ let r = t.map((t) => e.findIndex((e) => e.id === t)).filter((e) => e >= 0).sort((e, t) => e - t), i = r.length > 0 && r.every((e, t) => {
32
+ if (t === 0) return !0;
33
+ let n = r[t - 1];
34
+ return n !== void 0 && e === n + 1;
35
+ }), a = r[0], o = r[r.length - 1];
36
+ return i && a !== void 0 && o !== void 0 && n >= a && n <= o + 1;
37
+ }
38
+ function u(u) {
39
+ let f = i(u);
40
+ f.current = u;
41
+ let p = i(null), m = i(null), [h, g] = a(o);
42
+ r(() => () => {
43
+ m.current?.cancel();
44
+ }, []);
45
+ let _ = n((e, t) => {
46
+ let [n, r] = s(f.current.items, t), i = p.current;
47
+ if (!i) return n;
48
+ let a = f.current.rowSelector, o = a ? Array.from(i.children).filter((e) => e.matches(a)) : Array.from(i.children), c = o.length;
49
+ for (let t = 0; t < o.length; t++) {
50
+ let n = o[t];
51
+ if (n && e < n.getBoundingClientRect().bottom) {
52
+ c = t;
53
+ break;
54
+ }
55
+ }
56
+ return Math.max(n, Math.min(c, r));
57
+ }, []), v = n((e) => {
58
+ p.current = e;
59
+ }, []), y = n(() => {
60
+ m.current = null, g(o);
61
+ }, []), b = n((n, r, i) => {
62
+ let a = p.current;
63
+ if (!a || m.current || e(i.target, i.currentTarget)) return;
64
+ let o = {
65
+ shiftKey: i.shiftKey,
66
+ ctrlKey: i.ctrlKey,
67
+ metaKey: i.metaKey,
68
+ altKey: i.altKey
69
+ }, s = [], u = 0, h = i.currentTarget, v = (Array.from(a.children).find((e) => e.contains(h)) ?? h).getBoundingClientRect(), b = {
70
+ x: i.clientX - v.left,
71
+ y: i.clientY - v.top
72
+ }, x = (e) => ({
73
+ ids: s,
74
+ left: e.clientX - b.x,
75
+ top: e.clientY - b.y,
76
+ width: v.width
77
+ });
78
+ m.current = t(i, {
79
+ origin: a,
80
+ threshold: f.current.items[r]?.locked ? Infinity : f.current.threshold ?? 4,
81
+ onActivate: (e) => {
82
+ s = c(f.current.items, f.current.selectedIds, n, r), u = _(e.clientY, r), g({
83
+ draggedIds: s,
84
+ targetIndex: u,
85
+ ghost: x(e)
86
+ });
87
+ },
88
+ onMove: (e) => {
89
+ u = _(e.clientY, r), g({
90
+ draggedIds: s,
91
+ targetIndex: u,
92
+ ghost: x(e)
93
+ });
94
+ },
95
+ onCommit: (e) => {
96
+ let t = _(e.clientY, r);
97
+ l(f.current.items, s, t) || f.current.onReorder(s, t), y();
98
+ },
99
+ onClick: () => {
100
+ let { onPress: e } = f.current;
101
+ e && (e(n, o), d(a)), y();
102
+ },
103
+ onCancel: y
104
+ });
105
+ }, [_, y]);
106
+ return {
107
+ nudge: n((e, t, n) => {
108
+ let { items: r, selectedIds: i, onReorder: a } = f.current;
109
+ if (r[t]?.locked) return !1;
110
+ let o = c(r, i, e, t), u = o.map((e) => r.findIndex((t) => t.id === e)).sort((e, t) => e - t), d = u[0], p = u[u.length - 1];
111
+ if (d === void 0 || p === void 0) return !1;
112
+ let [m, h] = s(r, t), g = n < 0 ? d - 1 : p + 2;
113
+ return g < m || g > h || l(r, o, g) ? !1 : (a(o, g), !0);
114
+ }, []),
115
+ rowProps: (e, t) => ({ onPointerDown: (n) => b(e, t, n) }),
116
+ containerProps: { ref: v },
117
+ state: h
118
+ };
119
+ }
120
+ function d(e) {
121
+ let t = (e) => {
122
+ e.stopPropagation();
123
+ };
124
+ e.addEventListener("click", t, !0), setTimeout(() => {
125
+ e.removeEventListener("click", t, !0);
126
+ }, 0);
127
+ }
128
+ //#endregion
129
+ export { u as t };
130
+
131
+ //# sourceMappingURL=useReorderDragList-Dcezzgix.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useReorderDragList-Dcezzgix.js","names":[],"sources":["../../src/useReorderDragList.ts"],"sourcesContent":["import { useCallback, useEffect, useRef, useState } from 'react';\nimport type { ReactNode, PointerEvent as ReactPointerEvent, RefCallback } from 'react';\nimport { startThresholdDrag, type ThresholdDragHandle } from '@weasel-js/core';\nimport { isInControlWithin } from './interactiveTarget';\n\n/** One row in a reorderable list. */\nexport interface ReorderItem {\n id: string;\n label: ReactNode;\n /** Locked rows cannot be dragged, cannot be crossed by drops, and\n * never combine with other rows in a multi-selection. */\n locked?: boolean;\n}\n\n/**\n * Options for {@link useReorderDragList}. `onReorder` receives the dragged ids\n * and the index they were dropped at, measured against the pre-drag `items`.\n */\nexport interface UseReorderDragListOptions {\n items: ReorderItem[];\n selectedIds: string[];\n onReorder(ids: string[], targetIndex: number): void;\n /** A press that was released without ever engaging a drag — the click a\n * list row means by it. Fires for locked rows too, which can be selected\n * but not dragged. Modifiers are read at press, not at release. When this\n * is given, the DOM click that follows the press is dropped, so a row that\n * also handles `click` sees one press, not two. A press that starts on a\n * control inside the row (a toggle) is left to the control. */\n onPress?(id: string, mods: PressModifiers): void;\n /** Pointer-move distance (px) before pending drag engages. Default 4. */\n threshold?: number;\n /** Selector matching the container's children that are rows, for a list\n * that interleaves other elements (a table's detail rows). Default: every\n * child is a row. */\n rowSelector?: string;\n}\n\n/** Modifier keys held when a press began. */\nexport interface PressModifiers {\n shiftKey: boolean;\n ctrlKey: boolean;\n metaKey: boolean;\n altKey: boolean;\n}\n\n/**\n * Where a drag's ghost goes: the dragged rows, drawn again with their top-left\n * at a client-space point, so the row that was grabbed stays under the pointer\n * where it was picked up. `width` is the grabbed row's.\n */\nexport interface ReorderGhost {\n ids: readonly string[];\n left: number;\n top: number;\n width: number;\n}\n\n/**\n * Live drag state for rendering feedback: which ids are being dragged, the\n * insertion index the drop would use, and where their ghost goes. All `null`\n * when no drag is engaged.\n */\nexport interface ReorderDragState {\n draggedIds: string[] | null;\n targetIndex: number | null;\n ghost: ReorderGhost | null;\n}\n\nconst IDLE: ReorderDragState = { draggedIds: null, targetIndex: null, ghost: null };\n\n/**\n * A `ref` for the list container, an `onPointerDown` for each row, and the\n * live {@link ReorderDragState}. The container ref is required, not optional\n * decoration: it is what the drop index is measured against and what the\n * pointer session is opened on.\n */\nexport interface ReorderDragHandlers {\n rowProps(id: string, index: number): { onPointerDown(e: ReactPointerEvent): void };\n containerProps: {\n ref: RefCallback<HTMLElement>;\n };\n state: ReorderDragState;\n /**\n * Move the row at `index` one place up (`-1`) or down (`1`) — the keyboard\n * reorder. It moves what a drag of that row would: the whole selection if\n * the row is in it, else the row alone, never across a locked row. Calls\n * `onReorder` and returns `true`, or returns `false` when nothing can move.\n */\n nudge(id: string, index: number, delta: -1 | 1): boolean;\n}\n\n/**\n * The half-open run of indices a row at `sourceIndex` may be dropped into:\n * bounded by the nearest locked row above and below it, so a locked row is a\n * wall in both directions rather than a global ceiling.\n */\nfunction unlockedSegment(items: readonly ReorderItem[], sourceIndex: number): [number, number] {\n let lo = 0;\n for (let i = sourceIndex - 1; i >= 0; i--) {\n if (items[i]?.locked) { lo = i + 1; break; }\n }\n let hi = items.length;\n for (let i = sourceIndex + 1; i < items.length; i++) {\n if (items[i]?.locked) { hi = i; break; }\n }\n return [lo, hi];\n}\n\n/** What a drag of the row at `index` carries: the selection within its segment if the row is selected, else the row. */\nfunction draggedIdsFor(\n items: readonly ReorderItem[],\n selectedIds: readonly string[],\n id: string,\n index: number,\n): string[] {\n const [lo, hi] = unlockedSegment(items, index);\n return (selectedIds.includes(id) ? [...selectedIds] : [id]).filter((x) => {\n const i = items.findIndex((it) => it.id === x);\n return i >= lo && i < hi;\n });\n}\n\n/** Would dropping `draggedIds` at `targetIndex` leave a contiguous block where it already is? */\nfunction isNoopDrop(items: readonly ReorderItem[], draggedIds: readonly string[], targetIndex: number): boolean {\n const indices = draggedIds\n .map((id) => items.findIndex((it) => it.id === id))\n .filter((i) => i >= 0)\n .sort((a, b) => a - b);\n const contiguous =\n indices.length > 0 &&\n indices.every((v, i) => {\n if (i === 0) return true;\n const prev = indices[i - 1];\n return prev !== undefined && v === prev + 1;\n });\n const first = indices[0];\n const last = indices[indices.length - 1];\n return contiguous\n && first !== undefined\n && last !== undefined\n && targetIndex >= first\n && targetIndex <= last + 1;\n}\n\n/**\n * Drag-to-reorder for a vertical list of rows. Dragging a row that is part of\n * the current selection drags the whole selection; dragging any other row\n * drags just that row. Locked rows can neither be dragged nor crossed by a\n * drop. A drop that would leave a contiguous block where it already is does\n * not call `onReorder`.\n *\n * The rows are the container's children, whatever they are: `ItemList` rows,\n * or the `PropertyGroup`s of a `PropertyList`. A row's `onPointerDown` can go\n * on the whole row or on a handle inside it.\n *\n * A press opens a `startThresholdDrag` on the *container*, which owns the\n * rest of the gesture: a drag that leaves the list still tracks, a release\n * anywhere still drops, and a release the window never delivered still ends\n * the drag. The container is the origin rather than the row because rows come\n * and go as the list re-renders, and a drag must outlive the row it grabbed.\n */\nexport function useReorderDragList(opts: UseReorderDragListOptions): ReorderDragHandlers {\n const optsRef = useRef(opts);\n optsRef.current = opts;\n const containerRef = useRef<HTMLElement | null>(null);\n const dragRef = useRef<ThresholdDragHandle | null>(null);\n const [state, setState] = useState<ReorderDragState>(IDLE);\n\n useEffect(() => () => { dragRef.current?.cancel(); }, []);\n\n const computeTargetIndex = useCallback((clientY: number, sourceIndex: number): number => {\n const [lo, hi] = unlockedSegment(optsRef.current.items, sourceIndex);\n const c = containerRef.current;\n if (!c) return lo;\n const sel = optsRef.current.rowSelector;\n const rows = (sel ? Array.from(c.children).filter((el) => el.matches(sel)) : Array.from(c.children)) as HTMLElement[];\n let raw = rows.length;\n for (let i = 0; i < rows.length; i++) {\n const row = rows[i];\n if (!row) continue;\n const r = row.getBoundingClientRect();\n if (clientY < r.bottom) { raw = i; break; }\n }\n return Math.max(lo, Math.min(raw, hi));\n }, []);\n\n const refCb = useCallback<RefCallback<HTMLElement>>((el) => {\n containerRef.current = el;\n }, []);\n\n const reset = useCallback(() => {\n dragRef.current = null;\n setState(IDLE);\n }, []);\n\n const onPointerDownRow = useCallback((id: string, index: number, e: ReactPointerEvent) => {\n const container = containerRef.current;\n if (!container || dragRef.current) return;\n if (isInControlWithin(e.target, e.currentTarget as Element)) return;\n\n const mods: PressModifiers = {\n shiftKey: e.shiftKey, ctrlKey: e.ctrlKey, metaKey: e.metaKey, altKey: e.altKey,\n };\n let draggedIds: string[] = [];\n let targetIndex = 0;\n // Where in the grabbed row the pointer went down, so the ghost keeps that point under it. The handler may sit on\n // a handle inside the row rather than the row itself, so the row is the container's child holding it.\n const pressed = e.currentTarget as Element;\n const rowEl = Array.from(container.children).find((child) => child.contains(pressed)) ?? pressed;\n const row = rowEl.getBoundingClientRect();\n const grab = { x: e.clientX - row.left, y: e.clientY - row.top };\n const ghostAt = (ev: { clientX: number; clientY: number }): ReorderGhost => ({\n ids: draggedIds,\n left: ev.clientX - grab.x,\n top: ev.clientY - grab.y,\n width: row.width,\n });\n\n dragRef.current = startThresholdDrag(e, {\n origin: container,\n // A locked row still opens a drag so its release reaches `onPress`, and\n // a threshold nothing can cross is what keeps it from ever engaging.\n threshold: optsRef.current.items[index]?.locked\n ? Number.POSITIVE_INFINITY\n : (optsRef.current.threshold ?? 4),\n onActivate: (ev) => {\n draggedIds = draggedIdsFor(optsRef.current.items, optsRef.current.selectedIds, id, index);\n targetIndex = computeTargetIndex(ev.clientY, index);\n setState({ draggedIds, targetIndex, ghost: ghostAt(ev) });\n },\n onMove: (ev) => {\n targetIndex = computeTargetIndex(ev.clientY, index);\n setState({ draggedIds, targetIndex, ghost: ghostAt(ev) });\n },\n onCommit: (ev) => {\n const drop = computeTargetIndex(ev.clientY, index);\n if (!isNoopDrop(optsRef.current.items, draggedIds, drop)) {\n optsRef.current.onReorder(draggedIds, drop);\n }\n reset();\n },\n onClick: () => {\n const { onPress } = optsRef.current;\n if (onPress) {\n onPress(id, mods);\n swallowNextClick(container);\n }\n reset();\n },\n // Every cancel reason — the browser's, a lost capture, an unmount —\n // says the gesture was interrupted rather than aimed, so the rows stay\n // where they were.\n onCancel: reset,\n });\n }, [computeTargetIndex, reset]);\n\n const nudge = useCallback((id: string, index: number, delta: -1 | 1): boolean => {\n const { items, selectedIds, onReorder } = optsRef.current;\n if (items[index]?.locked) return false;\n const ids = draggedIdsFor(items, selectedIds, id, index);\n const at = ids.map((x) => items.findIndex((it) => it.id === x)).sort((a, b) => a - b);\n const first = at[0];\n const last = at[at.length - 1];\n if (first === undefined || last === undefined) return false;\n const [lo, hi] = unlockedSegment(items, index);\n const target = delta < 0 ? first - 1 : last + 2;\n if (target < lo || target > hi || isNoopDrop(items, ids, target)) return false;\n onReorder(ids, target);\n return true;\n }, []);\n\n return {\n nudge,\n rowProps: (id, index) => ({\n onPointerDown: (e) => onPointerDownRow(id, index, e),\n }),\n containerProps: {\n ref: refCb,\n },\n state,\n };\n}\n\n/**\n * The session captured the pointer on the container, so browsers disagree on\n * where the release's click lands; it may still reach the row. `onPress` has\n * already reported this press, so that click is dropped rather than read as a\n * second one. It is dispatched in the same task as the release.\n */\nfunction swallowNextClick(container: HTMLElement): void {\n const swallow = (e: Event) => { e.stopPropagation(); };\n container.addEventListener('click', swallow, true);\n setTimeout(() => { container.removeEventListener('click', swallow, true); }, 0);\n}\n"],"mappings":";;;;AAoEA,IAAM,IAAyB;CAAE,YAAY;CAAM,aAAa;CAAM,OAAO;CAAM;AA4BnF,SAAS,EAAgB,GAA+B,GAAuC;CAC7F,IAAI,IAAK;AACT,MAAK,IAAI,IAAI,IAAc,GAAG,KAAK,GAAG,IACpC,KAAI,EAAM,IAAI,QAAQ;AAAE,MAAK,IAAI;AAAG;;CAEtC,IAAI,IAAK,EAAM;AACf,MAAK,IAAI,IAAI,IAAc,GAAG,IAAI,EAAM,QAAQ,IAC9C,KAAI,EAAM,IAAI,QAAQ;AAAE,MAAK;AAAG;;AAElC,QAAO,CAAC,GAAI,EAAG;;AAIjB,SAAS,EACP,GACA,GACA,GACA,GACU;CACV,IAAM,CAAC,GAAI,KAAM,EAAgB,GAAO,EAAM;AAC9C,SAAQ,EAAY,SAAS,EAAG,GAAG,CAAC,GAAG,EAAY,GAAG,CAAC,EAAG,EAAE,QAAQ,MAAM;EACxE,I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AU,oBAAoB,SAAS,GAAS,GAAK;IAAK,EAAE"}
@@ -62,4 +62,4 @@ function a(a) {
62
62
  //#endregion
63
63
  export { a as t };
64
64
 
65
- //# sourceMappingURL=useRovingTabIndex-Dkpf_KhN.js.map
65
+ //# sourceMappingURL=useRovingTabIndex-B4uJqiKP.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useRovingTabIndex-B4uJqiKP.js","names":[],"sources":["../../src/useRovingTabIndex.ts"],"sourcesContent":["import { useRef, type KeyboardEvent as ReactKeyboardEvent, type RefObject } from 'react';\n\n/** The only thing the hook needs to know about a bar's items: which are\n * skipped by arrow navigation. */\nexport type RovingItem = { disabled?: boolean };\n\n/** Options for {@link useRovingTabIndex}. */\nexport type UseRovingTabIndexOptions = {\n /** In the same order as the elements carrying `itemClassName`. */\n items: readonly RovingItem[];\n /** Class on the focusable element of each item, inside the container the\n * returned `rootRef` is attached to. Their DOM order must match `items`. */\n itemClassName: string;\n /** Index that carries `tabIndex=0`. Defaults to the first enabled item; a\n * radiogroup-style bar passes its selected index so Tab lands on the\n * current value. */\n tabStopIndex?: number;\n /** Called with the new index as arrow/Home/End focus moves, before focus\n * moves. This is where a selection-follows-focus bar commits the value. */\n onNavigate?: (index: number) => void;\n /** Space/Enter on the item at `index`. When omitted the keypress is left\n * alone, which on a native `<button>` produces an ordinary click. */\n onActivate?: (index: number) => void;\n};\n\n/**\n * What {@link useRovingTabIndex} returns: a container ref plus the per-item\n * `tabIndex` and `onKeyDown` values to spread onto each item.\n */\nexport type RovingTabIndex<T extends HTMLElement = HTMLDivElement> = {\n /** Attach to the container element that holds the items. */\n rootRef: RefObject<T | null>;\n /** `tabIndex` value for the item at `index`. */\n tabIndexFor: (index: number) => 0 | -1;\n /** `onKeyDown` for the item at `index`. */\n onKeyDown: (index: number) => (e: ReactKeyboardEvent<HTMLElement>) => void;\n};\n\nfunction firstEnabledIndex(items: readonly RovingItem[]): number {\n for (let i = 0; i < items.length; i++) if (!items[i].disabled) return i;\n return -1;\n}\n\nfunction lastEnabledIndex(items: readonly RovingItem[]): number {\n for (let i = items.length - 1; i >= 0; i--) if (!items[i].disabled) return i;\n return -1;\n}\n\nfunction nextEnabledIndex(items: readonly RovingItem[], from: number): number {\n const n = items.length;\n for (let k = 1; k <= n; k++) {\n const i = (from + k + n) % n;\n if (!items[i].disabled) return i;\n }\n return from;\n}\n\nfunction prevEnabledIndex(items: readonly RovingItem[], from: number): number {\n const n = items.length;\n for (let k = 1; k <= n; k++) {\n const i = (from - k + n) % n;\n if (!items[i].disabled) return i;\n }\n return from;\n}\n\n/**\n * Roving tabindex for a bar of items: one item is in the tab order, and the\n * arrow keys move focus among the rest, skipping disabled ones and wrapping\n * at both ends. Home and End go to the first and last enabled item. Both axes\n * navigate, so the same bar works laid out either way.\n *\n * Backs `ButtonBar`, `OptionsBar`, and `ToggleBar`.\n *\n * **When a bar should not use this.** What decides it is the items, not who\n * owns them. A container of compound controls — a number field, a select, a\n * color field — must leave the arrow keys alone, because those controls edit\n * their own value with them; taking the arrows over would break the control\n * to navigate between controls. `ToolOptionsBar` is that case: it draws its\n * own controls from a tool's schema now rather than taking arbitrary\n * children, and a schema-drawn number field eats arrows exactly as a\n * hand-placed one did, so it keeps plain DOM tab order. A bar whose items are\n * all simple buttons is the case this hook is for.\n *\n * With every item disabled there is no tab stop and the bar drops out of the\n * tab order entirely.\n */\nexport function useRovingTabIndex<T extends HTMLElement = HTMLDivElement>(\n options: UseRovingTabIndexOptions,\n): RovingTabIndex<T> {\n const { items, itemClassName, onNavigate, onActivate } = options;\n const rootRef = useRef<T | null>(null);\n\n const tabStopIndex = options.tabStopIndex ?? firstEnabledIndex(items);\n\n const focusItem = (index: number): void => {\n const root = rootRef.current;\n if (!root) return;\n const elements = root.querySelectorAll<HTMLElement>(`.${itemClassName}`);\n elements[index]?.focus();\n };\n\n const onKeyDown = (index: number) => (e: ReactKeyboardEvent<HTMLElement>): void => {\n let nextIndex = -1;\n switch (e.key) {\n case 'ArrowLeft':\n case 'ArrowUp':\n nextIndex = prevEnabledIndex(items, index);\n break;\n case 'ArrowRight':\n case 'ArrowDown':\n nextIndex = nextEnabledIndex(items, index);\n break;\n case 'Home':\n nextIndex = firstEnabledIndex(items);\n break;\n case 'End':\n nextIndex = lastEnabledIndex(items);\n break;\n case ' ':\n case 'Enter':\n if (onActivate) {\n e.preventDefault();\n onActivate(index);\n }\n return;\n default:\n return;\n }\n if (nextIndex < 0 || nextIndex === index) return;\n e.preventDefault();\n onNavigate?.(nextIndex);\n focusItem(nextIndex);\n };\n\n return {\n rootRef,\n tabIndexFor: (index: number) => (index === tabStopIndex ? 0 : -1),\n onKeyDown,\n };\n}\n"],"mappings":";;AAsCA,SAAS,EAAkB,GAAsC;AAC/D,MAAK,IAAI,IAAI,GAAG,IAAI,EAAM,QAAQ,IAAK,KAAI,CAAC,EAAM,GAAG,SAAU,QAAO;AACtE,QAAO;;AAGT,SAAS,EAAiB,GAAsC;AAC9D,MAAK,IAAI,IAAI,EAAM,SAAS,GAAG,KAAK,GAAG,IAAK,KAAI,CAAC,EAAM,GAAG,SAAU,QAAO;AAC3E,QAAO;;AAGT,SAAS,EAAiB,GAA8B,GAAsB;CAC5E,IAAM,IAAI,EAAM;AAChB,MAAK,IAAI,IAAI,GAAG,KAAK,GAAG,KAAK;EAC3B,IAAM,KAAK,IAAO,IAAI,KAAK;AAC3B,MAAI,CAAC,EAAM,GAAG,SAAU,QAAO;;AAEjC,QAAO;;AAGT,SAAS,EAAiB,GAA8B,GAAsB;CAC5E,IAAM,IAAI,EAAM;AAChB,MAAK,IAAI,IAAI,GAAG,KAAK,GAAG,KAAK;EAC3B,IAAM,KAAK,IAAO,IAAI,KAAK;AAC3B,MAAI,CAAC,EAAM,GAAG,SAAU,QAAO;;AAEjC,QAAO;;AAwBT,SAAgB,EACd,GACmB;CACnB,IAAM,EAAE,UAAO,kBAAe,eAAY,kBAAe,GACnD,IAAU,EAAiB,KAAK,EAEhC,IAAe,EAAQ,gBAAgB,EAAkB,EAAM,EAE/D,KAAa,MAAwB;EACzC,IAAM,IAAO,EAAQ;AAChB,OACY,EAAK,iBAA8B,IAAI,IACxD,CAAS,IAAQ,OAAO;;AAoC1B,QAAO;EACL;EACA,cAAc,MAAmB,MAAU,IAAe,IAAI;EAC9D,YApCiB,OAAmB,MAA6C;GACjF,IAAI,IAAY;AAChB,WAAQ,EAAE,KAAV;IACE,KAAK;IACL,KAAK;AACH,SAAY,EAAiB,GAAO,EAAM;AAC1C;IACF,KAAK;IACL,KAAK;AACH,SAAY,EAAiB,GAAO,EAAM;AAC1C;IACF,KAAK;AACH,SAAY,EAAkB,EAAM;AACpC;IACF,KAAK;AACH,SAAY,EAAiB,EAAM;AACnC;IACF,KAAK;IACL,KAAK;AACH,KAAI,MACF,EAAE,gBAAgB,EAClB,EAAW,EAAM;AAEnB;IACF,QACE;;AAEA,OAAY,KAAK,MAAc,MACnC,EAAE,gBAAgB,EAClB,IAAa,EAAU,EACvB,EAAU,EAAU;;EAOrB"}
@@ -1,3 +1,4 @@
1
+ import { oklchDegToHex } from '@weasel-js/core';
1
2
  /**
2
3
  * A chroma envelope over lightness, as three linear segments: flat at `cBot`
3
4
  * below `lRange[0]`, rising to `cPeak` at `midL`, falling to `cTop` at
@@ -20,7 +21,7 @@ export type ChromaCurvePoint = {
20
21
  * Converts an OKLCH color to a gamut-clipped `#rrggbb` string. Hue is in
21
22
  * degrees, unlike the kit's OKLab helpers which take radians.
22
23
  */
23
- export declare function oklchToHex(L: number, C: number, Hdeg: number): string;
24
+ export declare const oklchToHex: typeof oklchDegToHex;
24
25
  /** Evaluates a {@link ChromaCurve} at a lightness, clamping outside its range. */
25
26
  export declare function chromaAt(L: number, curve: ChromaCurve): number;
26
27
  //# sourceMappingURL=oklch.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"oklch.d.ts","sourceRoot":"","sources":["../../src/color/oklch.ts"],"names":[],"mappings":"AAGA;;;;;GAKG;AACH,MAAM,MAAM,WAAW,GAAG;IACxB,MAAM,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAEF,wCAAwC;AACxC,MAAM,MAAM,gBAAgB,GAAG;IAAE,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AAExD;;;GAGG;AACH,wBAAgB,UAAU,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAMrE;AAED,kFAAkF;AAClF,wBAAgB,QAAQ,CAAC,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,WAAW,GAAG,MAAM,CAM9D"}
1
+ {"version":3,"file":"oklch.d.ts","sourceRoot":"","sources":["../../src/color/oklch.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAEhD;;;;;GAKG;AACH,MAAM,MAAM,WAAW,GAAG;IACxB,MAAM,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAEF,wCAAwC;AACxC,MAAM,MAAM,gBAAgB,GAAG;IAAE,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AAExD;;;GAGG;AACH,eAAO,MAAM,UAAU,sBAAgB,CAAC;AAExC,kFAAkF;AAClF,wBAAgB,QAAQ,CAAC,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,WAAW,GAAG,MAAM,CAM9D"}
@@ -0,0 +1,38 @@
1
+ import { type ColorInterpolationSpace, type HueInterpolation } from '@weasel-js/core';
2
+ import { type ChromaCurve } from './oklch';
3
+ /**
4
+ * How {@link rampColor} and {@link colorRamp} travel between two endpoints.
5
+ *
6
+ * What each space interpolates:
7
+ *
8
+ * | `space` | components lerped | hue |
9
+ * | --------------- | ---------------------------- | -------------------- |
10
+ * | `'oklch'` | L, C, H | around the wheel |
11
+ * | `'hsl'` | H, S, L | around the wheel |
12
+ * | `'oklab'` | L, a, b | through the wheel |
13
+ * | `'srgb'` | gamma-encoded R, G, B | through the wheel |
14
+ * | `'srgb-linear'` | linear-light R, G, B | through the wheel |
15
+ *
16
+ * A lightness ramp is two endpoints that differ in lightness, and a hue ramp
17
+ * two that differ in hue: the polar spaces keep chroma or saturation fixed
18
+ * while they move, and the others cut a straight line between the two colors,
19
+ * which for a hue ramp passes through gray.
20
+ *
21
+ * `chroma` is an OKLCH envelope in every space, since {@link ChromaCurve}'s
22
+ * numbers are OKLCH chroma over OKLCH lightness. It runs after the
23
+ * interpolation: each sample keeps its lightness and hue, and its chroma is
24
+ * replaced with the curve's value at that lightness. A sample left with no
25
+ * hue (a gray midpoint) takes the hue an OKLCH ramp would have had there.
26
+ */
27
+ export interface ColorRampOptions {
28
+ /** Default `'oklch'`. */
29
+ space?: ColorInterpolationSpace;
30
+ /** Polar spaces only. Default `'shorter'`. */
31
+ hue?: HueInterpolation;
32
+ chroma?: ChromaCurve;
33
+ }
34
+ /** One sample of a ramp from `from` to `to` (`#rrggbb`), `t` in 0..1. */
35
+ export declare function rampColor(from: string, to: string, t: number, options?: ColorRampOptions): string;
36
+ /** `steps` evenly spaced samples from `from` to `to`, both ends included. */
37
+ export declare function colorRamp(from: string, to: string, steps: number, options?: ColorRampOptions): string[];
38
+ //# sourceMappingURL=ramp.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ramp.d.ts","sourceRoot":"","sources":["../../src/color/ramp.ts"],"names":[],"mappings":"AAAA,OAAO,EAKL,KAAK,uBAAuB,EAC5B,KAAK,gBAAgB,EACtB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAwB,KAAK,WAAW,EAAE,MAAM,SAAS,CAAC;AAEjE;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,MAAM,WAAW,gBAAgB;IAC/B,yBAAyB;IACzB,KAAK,CAAC,EAAE,uBAAuB,CAAC;IAChC,8CAA8C;IAC9C,GAAG,CAAC,EAAE,gBAAgB,CAAC;IACvB,MAAM,CAAC,EAAE,WAAW,CAAC;CACtB;AAOD,yEAAyE;AACzE,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,OAAO,GAAE,gBAAqB,GAAG,MAAM,CASrG;AAED,6EAA6E;AAC7E,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,GAAE,gBAAqB,GAAG,MAAM,EAAE,CAG3G"}
@@ -6,15 +6,16 @@ export interface ActionBarProps {
6
6
  /** Layout direction. Defaults to `'horizontal'`. */
7
7
  orientation?: 'horizontal' | 'vertical';
8
8
  /**
9
- * Per-id icon overrides — keyed by `action.id`. When an entry is provided
9
+ * Per-entry icon overrides, keyed by `ActionItem.key` — the action id, or
10
+ * `id:variant` for one variant of a parametric action. When an entry is provided
10
11
  * it replaces the action's own `icon` for this bar only. Mirrors
11
12
  * `PathfinderPanelProps.icons` so call sites that ship custom glyph sets
12
13
  * can swap them in without re-registering actions.
13
14
  */
14
15
  icons?: Record<string, ReactNode>;
15
16
  /**
16
- * Per-id label overrides — keyed by `action.id`. Drives both `aria-label`
17
- * and `title`. When omitted, the action's own `label` is used.
17
+ * Per-entry label overrides, keyed like `icons`. Drives both `aria-label`
18
+ * and `title`. When omitted, the entry's own `label` is used.
18
19
  */
19
20
  labels?: Record<string, string>;
20
21
  /** Additional class for the toolbar root. */
@@ -23,7 +24,8 @@ export interface ActionBarProps {
23
24
  /**
24
25
  * Generic group-keyed action toolbar. Reads the parent `ActionsRegistry`,
25
26
  * filters to actions whose `group` matches `props.group`, and renders one
26
- * icon button per match. Disabled state is derived from each action's
27
+ * icon button per match — or per variant, for an action that declares
28
+ * `variants`. Disabled state is derived from each action's
27
29
  * `enabled` predicate via `evaluateEnabled` (so the button greys out and
28
30
  * swallows clicks while the keybinding — if any — still fires through the
29
31
  * registry's keydown listener; that's the registry's contract, not ours).
@@ -1 +1 @@
1
- {"version":3,"file":"ActionBar.d.ts","sourceRoot":"","sources":["../../../src/components/ActionBar/ActionBar.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAwB,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAc7D,mCAAmC;AACnC,MAAM,WAAW,cAAc;IAC7B,2EAA2E;IAC3E,KAAK,EAAE,MAAM,CAAC;IACd,oDAAoD;IACpD,WAAW,CAAC,EAAE,YAAY,GAAG,UAAU,CAAC;IACxC;;;;;OAKG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;IAClC;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAChC,6CAA6C;IAC7C,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAaD;;;;;;;;;;;;GAYG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,cAAc,2CAiE9C"}
1
+ {"version":3,"file":"ActionBar.d.ts","sourceRoot":"","sources":["../../../src/components/ActionBar/ActionBar.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAwB,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAmB7D,mCAAmC;AACnC,MAAM,WAAW,cAAc;IAC7B,2EAA2E;IAC3E,KAAK,EAAE,MAAM,CAAC;IACd,oDAAoD;IACpD,WAAW,CAAC,EAAE,YAAY,GAAG,UAAU,CAAC;IACxC;;;;;;OAMG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;IAClC;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAChC,6CAA6C;IAC7C,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAcD;;;;;;;;;;;;;GAaG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,cAAc,2CAqD9C"}