@weasel-js/ui 1.7.0 → 1.7.1

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 (391) hide show
  1. package/dist/chunks/ActionBar-xA73vzzF.js +64 -0
  2. package/dist/chunks/ActionBar-xA73vzzF.js.map +1 -0
  3. package/dist/chunks/{Badge-D2aD7xVL.js → Badge-jYQjrTKc.js} +235 -264
  4. package/dist/chunks/{Badge-D2aD7xVL.js.map → Badge-jYQjrTKc.js.map} +1 -1
  5. package/dist/chunks/BandEditor-Dd0egAgE.js.map +1 -1
  6. package/dist/chunks/{Button-BIdXHQOx.js → Button-XB-T75YL.js} +2 -2
  7. package/dist/chunks/{Button-BIdXHQOx.js.map → Button-XB-T75YL.js.map} +1 -1
  8. package/dist/chunks/{ButtonBar-DIQTe5GQ.js → ButtonBar-CIMKPPRS.js} +7 -9
  9. package/dist/chunks/{ButtonBar-DIQTe5GQ.js.map → ButtonBar-CIMKPPRS.js.map} +1 -1
  10. package/dist/chunks/Callout-BUn0dP_S.js +115 -0
  11. package/dist/chunks/Callout-BUn0dP_S.js.map +1 -0
  12. package/dist/chunks/Checkbox-DFn-x0JO.js +37 -0
  13. package/dist/chunks/Checkbox-DFn-x0JO.js.map +1 -0
  14. package/dist/chunks/{CloseButton-C2J7wVfo.js → CloseButton-BmNmRVtb.js} +3 -3
  15. package/dist/chunks/{CloseButton-C2J7wVfo.js.map → CloseButton-BmNmRVtb.js.map} +1 -1
  16. package/dist/chunks/ColorField-BLs9fbeq.js +90 -0
  17. package/dist/chunks/ColorField-BLs9fbeq.js.map +1 -0
  18. package/dist/chunks/{ColorModeControl-BewxA0rX.js → ColorModeControl-DaVJ-SyX.js} +3 -3
  19. package/dist/chunks/{ColorModeControl-BewxA0rX.js.map → ColorModeControl-DaVJ-SyX.js.map} +1 -1
  20. package/dist/chunks/ComboBox-CuTLRmUg.js +138 -0
  21. package/dist/chunks/ComboBox-CuTLRmUg.js.map +1 -0
  22. package/dist/chunks/{CurveEditor-DUVjd25R.js → CurveEditor-jVBEqqdv.js} +90 -87
  23. package/dist/chunks/CurveEditor-jVBEqqdv.js.map +1 -0
  24. package/dist/chunks/{DataGrid-LZ2JgY2Y.js → DataGrid-BklgBqS0.js} +2 -2
  25. package/dist/chunks/{DataGrid-LZ2JgY2Y.js.map → DataGrid-BklgBqS0.js.map} +1 -1
  26. package/dist/chunks/{DetailList-BKomDzg5.js → DetailList-DFtqdOJj.js} +7 -7
  27. package/dist/chunks/DetailList-DFtqdOJj.js.map +1 -0
  28. package/dist/chunks/{DetentSlider-5uQPFucv.js → DetentSlider-Bh7EpMqT.js} +2 -2
  29. package/dist/chunks/{DetentSlider-5uQPFucv.js.map → DetentSlider-Bh7EpMqT.js.map} +1 -1
  30. package/dist/chunks/{Dialog-DGFutQ--.js → Dialog-DKfsk5VN.js} +3 -3
  31. package/dist/chunks/{Dialog-DGFutQ--.js.map → Dialog-DKfsk5VN.js.map} +1 -1
  32. package/dist/chunks/{DragGhost-B5_hb9W9.js → DragGhost-BeYDJyLZ.js} +2 -2
  33. package/dist/chunks/{DragGhost-B5_hb9W9.js.map → DragGhost-BeYDJyLZ.js.map} +1 -1
  34. package/dist/chunks/{FallthroughDiagram-BEHiM5IS.js → FallthroughDiagram-C7BUe8eU.js} +3 -3
  35. package/dist/chunks/{FallthroughDiagram-BEHiM5IS.js.map → FallthroughDiagram-C7BUe8eU.js.map} +1 -1
  36. package/dist/chunks/Field-DsBlnFKf.js +25 -0
  37. package/dist/chunks/Field-DsBlnFKf.js.map +1 -0
  38. package/dist/chunks/FillStrokeSwatch-CgsYQgew.js +112 -0
  39. package/dist/chunks/FillStrokeSwatch-CgsYQgew.js.map +1 -0
  40. package/dist/chunks/{FontFamilySelect-DkRgNtag.js → FontFamilySelect-CGJ5OIOy.js} +2 -2
  41. package/dist/chunks/FontFamilySelect-CGJ5OIOy.js.map +1 -0
  42. package/dist/chunks/FontWeightSelect-RbcXYJPS.js +49 -0
  43. package/dist/chunks/FontWeightSelect-RbcXYJPS.js.map +1 -0
  44. package/dist/chunks/{GestureRoute-C_YGl7bJ.js → GestureRoute-BXESrHI0.js} +2 -2
  45. package/dist/chunks/{GestureRoute-C_YGl7bJ.js.map → GestureRoute-BXESrHI0.js.map} +1 -1
  46. package/dist/chunks/GradientEditor-DypXzMc-.js +325 -0
  47. package/dist/chunks/GradientEditor-DypXzMc-.js.map +1 -0
  48. package/dist/chunks/{Icon-CcVjdq2C.js → Icon--B1ME-6c.js} +3 -1
  49. package/dist/chunks/Icon--B1ME-6c.js.map +1 -0
  50. package/dist/chunks/{Input-CHmkfYaD.js → Input-CzwvCZs_.js} +10 -15
  51. package/dist/chunks/Input-CzwvCZs_.js.map +1 -0
  52. package/dist/chunks/{ItemList-Cm-HUWCi.js → ItemList-CRu9y7hL.js} +2 -2
  53. package/dist/chunks/ItemList-CRu9y7hL.js.map +1 -0
  54. package/dist/chunks/{Jog-DRmfrkCg.js → Jog-DfNUYejm.js} +8 -8
  55. package/dist/chunks/Jog-DfNUYejm.js.map +1 -0
  56. package/dist/chunks/{LayerList-wCI1EueM.js → LayerList-CsDqwYh-.js} +151 -153
  57. package/dist/chunks/LayerList-CsDqwYh-.js.map +1 -0
  58. package/dist/chunks/ListEditor-BnGzqERm.js +72 -0
  59. package/dist/chunks/ListEditor-BnGzqERm.js.map +1 -0
  60. package/dist/chunks/MenuButton-L9f5vido.js +75 -0
  61. package/dist/chunks/MenuButton-L9f5vido.js.map +1 -0
  62. package/dist/chunks/MeshEditor-GbqqiPk8.js +199 -0
  63. package/dist/chunks/MeshEditor-GbqqiPk8.js.map +1 -0
  64. package/dist/chunks/{NumberField-BnJxcazc.js → NumberField-DLXXgh48.js} +26 -23
  65. package/dist/chunks/NumberField-DLXXgh48.js.map +1 -0
  66. package/dist/chunks/{OptionsBar-ujxYidhj.js → OptionsBar-DeTAjVb7.js} +6 -8
  67. package/dist/chunks/{OptionsBar-ujxYidhj.js.map → OptionsBar-DeTAjVb7.js.map} +1 -1
  68. package/dist/chunks/PaintField-C0hoXc0Y.js +63 -0
  69. package/dist/chunks/PaintField-C0hoXc0Y.js.map +1 -0
  70. package/dist/chunks/PaintInput-jQRxM95Y.js +132 -0
  71. package/dist/chunks/PaintInput-jQRxM95Y.js.map +1 -0
  72. package/dist/chunks/PatternPicker-CaMYXzhF.js +135 -0
  73. package/dist/chunks/PatternPicker-CaMYXzhF.js.map +1 -0
  74. package/dist/chunks/{Plot2D-CTXHkL5p.js → Plot2D-BHNbgCAl.js} +7 -7
  75. package/dist/chunks/Plot2D-BHNbgCAl.js.map +1 -0
  76. package/dist/chunks/{PointPlotter-ldI4RrU1.js → PointPlotter-BZ_vk6gV.js} +2 -2
  77. package/dist/chunks/{PointPlotter-ldI4RrU1.js.map → PointPlotter-BZ_vk6gV.js.map} +1 -1
  78. package/dist/chunks/{Powerline-DNyH885r.js → Powerline-6wIFmDik.js} +2 -2
  79. package/dist/chunks/{Powerline-DNyH885r.js.map → Powerline-6wIFmDik.js.map} +1 -1
  80. package/dist/chunks/{Prefs-ByA-x51i.js → Prefs-CkyldX-e.js} +83 -70
  81. package/dist/chunks/Prefs-CkyldX-e.js.map +1 -0
  82. package/dist/chunks/{Properties-DmAeQ3mk.js → Properties-D15c8NP-.js} +25 -25
  83. package/dist/chunks/{Properties-DmAeQ3mk.js.map → Properties-D15c8NP-.js.map} +1 -1
  84. package/dist/chunks/PropertyField-CV_Gw57S.js +686 -0
  85. package/dist/chunks/PropertyField-CV_Gw57S.js.map +1 -0
  86. package/dist/chunks/{RadioGroup-Bh4-12e-.js → RadioGroup-4dbzqvGy.js} +2 -2
  87. package/dist/chunks/{RadioGroup-Bh4-12e-.js.map → RadioGroup-4dbzqvGy.js.map} +1 -1
  88. package/dist/chunks/{RangeSlider-SEGE-7VF.js → RangeSlider-BxokZViJ.js} +8 -8
  89. package/dist/chunks/RangeSlider-BxokZViJ.js.map +1 -0
  90. package/dist/chunks/RecentColorsProvider-DHcfk25u.js +84 -0
  91. package/dist/chunks/RecentColorsProvider-DHcfk25u.js.map +1 -0
  92. package/dist/chunks/ResizeHandle-CbAgCQOt.js +81 -0
  93. package/dist/chunks/ResizeHandle-CbAgCQOt.js.map +1 -0
  94. package/dist/chunks/Select-BppLsJTz.js +236 -0
  95. package/dist/chunks/Select-BppLsJTz.js.map +1 -0
  96. package/dist/chunks/{SelectionPanel-BaQnX4Bs.js → SelectionPanel-Cm1qu-ZX.js} +14 -13
  97. package/dist/chunks/{SelectionPanel-BaQnX4Bs.js.map → SelectionPanel-Cm1qu-ZX.js.map} +1 -1
  98. package/dist/chunks/{SidebarPanel-BblDEz4G.js → SidebarPanel-AXQ0jRDx.js} +2 -2
  99. package/dist/chunks/{SidebarPanel-BblDEz4G.js.map → SidebarPanel-AXQ0jRDx.js.map} +1 -1
  100. package/dist/chunks/{Slider-YofwGOI4.js → Slider-Cl5RCeZ7.js} +19 -19
  101. package/dist/chunks/Slider-Cl5RCeZ7.js.map +1 -0
  102. package/dist/chunks/SwatchGrid-9ZPiDmxd.js +78 -0
  103. package/dist/chunks/SwatchGrid-9ZPiDmxd.js.map +1 -0
  104. package/dist/chunks/SwatchStrip-Cw0l8Om7.js +577 -0
  105. package/dist/chunks/SwatchStrip-Cw0l8Om7.js.map +1 -0
  106. package/dist/chunks/{ThemeSwitcher-BlsInAmR.js → ThemeSwitcher-DiBmMh_B.js} +3 -3
  107. package/dist/chunks/{ThemeSwitcher-BlsInAmR.js.map → ThemeSwitcher-DiBmMh_B.js.map} +1 -1
  108. package/dist/chunks/{Timeline-B39cwfMB.js → Timeline-pqnYk5cV.js} +244 -246
  109. package/dist/chunks/Timeline-pqnYk5cV.js.map +1 -0
  110. package/dist/chunks/Toast-C3ozq11V.js +170 -0
  111. package/dist/chunks/Toast-C3ozq11V.js.map +1 -0
  112. package/dist/chunks/{ToggleBar-BTYkBXU9.js → ToggleBar-Z2jZiguF.js} +6 -8
  113. package/dist/chunks/{ToggleBar-BTYkBXU9.js.map → ToggleBar-Z2jZiguF.js.map} +1 -1
  114. package/dist/chunks/{TokenPanel-CMDAOfYH.js → TokenPanel-DAkL6vwQ.js} +32 -32
  115. package/dist/chunks/TokenPanel-DAkL6vwQ.js.map +1 -0
  116. package/dist/chunks/{ToolButton-CAHBa08P.js → ToolButton-BURp4YIO.js} +7 -9
  117. package/dist/chunks/ToolButton-BURp4YIO.js.map +1 -0
  118. package/dist/chunks/{ToolOptionsBar-D_GCrBAN.js → ToolOptionsBar-COsTJ1cu.js} +3 -2
  119. package/dist/chunks/{ToolOptionsBar-D_GCrBAN.js.map → ToolOptionsBar-COsTJ1cu.js.map} +1 -1
  120. package/dist/chunks/{ToolPalette-OOWN51Xx.js → ToolPalette-DKDFWOX-.js} +7 -9
  121. package/dist/chunks/{ToolPalette-OOWN51Xx.js.map → ToolPalette-DKDFWOX-.js.map} +1 -1
  122. package/dist/chunks/{Tooltip-Clg2mhSt.js → Tooltip-C6eFCYxw.js} +2 -2
  123. package/dist/chunks/{Tooltip-Clg2mhSt.js.map → Tooltip-C6eFCYxw.js.map} +1 -1
  124. package/dist/chunks/Tree-Cc8lIzgM.js.map +1 -1
  125. package/dist/chunks/checkbox.module-DLQV9tMX.js +5 -0
  126. package/dist/chunks/checkbox.module-DLQV9tMX.js.map +1 -0
  127. package/dist/chunks/{createKeyframeLayer-DVl321_l.js → createKeyframeLayer-BTa4LyJE.js} +194 -208
  128. package/dist/chunks/createKeyframeLayer-BTa4LyJE.js.map +1 -0
  129. package/dist/chunks/field.module-Bh7BTKMh.js +15 -0
  130. package/dist/chunks/field.module-Bh7BTKMh.js.map +1 -0
  131. package/dist/chunks/formatShortcut-DRQrVThu.js.map +1 -1
  132. package/dist/chunks/handles-CqVANLtu.js +17 -0
  133. package/dist/chunks/handles-CqVANLtu.js.map +1 -0
  134. package/dist/chunks/{icons-BhcR1l64.js → icons-Dr2-r30x.js} +2 -2
  135. package/dist/chunks/icons-Dr2-r30x.js.map +1 -0
  136. package/dist/chunks/listbox.module-BcdVJMbm.js +8 -0
  137. package/dist/chunks/listbox.module-BcdVJMbm.js.map +1 -0
  138. package/dist/chunks/model-B1-gMBIW.js +386 -0
  139. package/dist/chunks/model-B1-gMBIW.js.map +1 -0
  140. package/dist/chunks/{portalHost-yTOVuCej.js → portalHost-CE70wLzo.js} +10 -6
  141. package/dist/chunks/portalHost-CE70wLzo.js.map +1 -0
  142. package/dist/chunks/prefField-BE_Ytr2H.js +229 -0
  143. package/dist/chunks/prefField-BE_Ytr2H.js.map +1 -0
  144. package/dist/chunks/{segmentTooltip-CStYHKzd.js → segmentTooltip-CGxCOWNz.js} +2 -2
  145. package/dist/chunks/{segmentTooltip-CStYHKzd.js.map → segmentTooltip-CGxCOWNz.js.map} +1 -1
  146. package/dist/chunks/segmentedControl.module-BzGXUL5G.js +11 -0
  147. package/dist/chunks/segmentedControl.module-BzGXUL5G.js.map +1 -0
  148. package/dist/chunks/useReorderDragList-CStYKjHl.js +133 -0
  149. package/dist/chunks/useReorderDragList-CStYKjHl.js.map +1 -0
  150. package/dist/chunks/useRovingTabIndex-D7u22Ia_.js +91 -0
  151. package/dist/chunks/useRovingTabIndex-D7u22Ia_.js.map +1 -0
  152. package/dist/components/ActionBar/ActionBar.d.ts.map +1 -1
  153. package/dist/components/ActionBar/index.js +1 -1
  154. package/dist/components/Badge/bases/ChamferedRect.d.ts.map +1 -1
  155. package/dist/components/Badge/index.js +1 -1
  156. package/dist/components/BandEditor/BandEditor.d.ts +1 -0
  157. package/dist/components/BandEditor/BandEditor.d.ts.map +1 -1
  158. package/dist/components/Button/index.js +1 -1
  159. package/dist/components/ButtonBar/ButtonBar.d.ts.map +1 -1
  160. package/dist/components/ButtonBar/index.js +1 -1
  161. package/dist/components/Callout/Callout.d.ts.map +1 -1
  162. package/dist/components/Callout/index.js +1 -1
  163. package/dist/components/Checkbox/Checkbox.d.ts +28 -13
  164. package/dist/components/Checkbox/Checkbox.d.ts.map +1 -1
  165. package/dist/components/Checkbox/index.js +1 -1
  166. package/dist/components/CloseButton/index.js +1 -1
  167. package/dist/components/ColorField/ColorField.d.ts.map +1 -1
  168. package/dist/components/ColorField/OpacityRange.d.ts +18 -0
  169. package/dist/components/ColorField/OpacityRange.d.ts.map +1 -0
  170. package/dist/components/ColorField/index.js +1 -1
  171. package/dist/components/ColorModeControl/index.js +1 -1
  172. package/dist/components/ComboBox/ComboBox.d.ts +7 -0
  173. package/dist/components/ComboBox/ComboBox.d.ts.map +1 -1
  174. package/dist/components/ComboBox/index.js +1 -1
  175. package/dist/components/CurveEditor/CurveEditor.d.ts.map +1 -1
  176. package/dist/components/CurveEditor/LayeredCurveEditor.d.ts.map +1 -1
  177. package/dist/components/CurveEditor/index.js +2 -2
  178. package/dist/components/DataGrid/index.js +1 -1
  179. package/dist/components/DetailList/index.js +1 -1
  180. package/dist/components/DetentSlider/index.js +1 -1
  181. package/dist/components/Dialog/index.js +1 -1
  182. package/dist/components/DragGhost/index.js +1 -1
  183. package/dist/components/FallthroughDiagram/index.js +1 -1
  184. package/dist/components/Field/index.js +1 -1
  185. package/dist/components/FillStrokeSwatch/FillStrokeSwatch.d.ts.map +1 -1
  186. package/dist/components/FillStrokeSwatch/index.js +1 -1
  187. package/dist/components/FontFamilySelect/FontFamilySelect.d.ts +20 -0
  188. package/dist/components/FontFamilySelect/FontFamilySelect.d.ts.map +1 -1
  189. package/dist/components/FontFamilySelect/index.js +1 -1
  190. package/dist/components/FontWeightSelect/FontWeightSelect.d.ts +26 -0
  191. package/dist/components/FontWeightSelect/FontWeightSelect.d.ts.map +1 -0
  192. package/dist/components/FontWeightSelect/index.d.ts +3 -0
  193. package/dist/components/FontWeightSelect/index.d.ts.map +1 -0
  194. package/dist/components/FontWeightSelect/index.js +2 -0
  195. package/dist/components/GestureRoute/index.js +1 -1
  196. package/dist/components/GradientEditor/GradientHandles.d.ts +1 -8
  197. package/dist/components/GradientEditor/GradientHandles.d.ts.map +1 -1
  198. package/dist/components/GradientEditor/SceneGradientHandles.d.ts +7 -5
  199. package/dist/components/GradientEditor/SceneGradientHandles.d.ts.map +1 -1
  200. package/dist/components/GradientEditor/handleOverlay.d.ts +41 -0
  201. package/dist/components/GradientEditor/handleOverlay.d.ts.map +1 -0
  202. package/dist/components/GradientEditor/index.js +1 -1
  203. package/dist/components/Input/Input.d.ts +1 -1
  204. package/dist/components/Input/Input.d.ts.map +1 -1
  205. package/dist/components/Input/index.js +1 -1
  206. package/dist/components/ItemList/ItemList.d.ts +32 -31
  207. package/dist/components/ItemList/ItemList.d.ts.map +1 -1
  208. package/dist/components/ItemList/index.js +1 -1
  209. package/dist/components/Jog/index.js +1 -1
  210. package/dist/components/LayerList/LayerList.d.ts.map +1 -1
  211. package/dist/components/LayerList/index.js +1 -1
  212. package/dist/components/ListEditor/ListEditor.d.ts.map +1 -1
  213. package/dist/components/ListEditor/index.js +1 -1
  214. package/dist/components/MenuButton/MenuButton.d.ts.map +1 -1
  215. package/dist/components/MenuButton/index.js +1 -1
  216. package/dist/components/MeshEditor/MeshEditor.d.ts +4 -3
  217. package/dist/components/MeshEditor/MeshEditor.d.ts.map +1 -1
  218. package/dist/components/MeshEditor/MeshHandles.d.ts +38 -0
  219. package/dist/components/MeshEditor/MeshHandles.d.ts.map +1 -0
  220. package/dist/components/MeshEditor/index.d.ts +2 -0
  221. package/dist/components/MeshEditor/index.d.ts.map +1 -1
  222. package/dist/components/MeshEditor/index.js +2 -2
  223. package/dist/components/NumberField/NumberField.d.ts +1 -1
  224. package/dist/components/NumberField/NumberField.d.ts.map +1 -1
  225. package/dist/components/NumberField/index.js +1 -1
  226. package/dist/components/OptionsBar/OptionsBar.d.ts.map +1 -1
  227. package/dist/components/OptionsBar/index.js +1 -1
  228. package/dist/components/PaintField/PaintField.d.ts.map +1 -1
  229. package/dist/components/PaintField/index.js +1 -1
  230. package/dist/components/PaintInput/PaintInput.d.ts.map +1 -1
  231. package/dist/components/PaintInput/index.js +1 -1
  232. package/dist/components/PatternPicker/PatternPicker.d.ts +6 -5
  233. package/dist/components/PatternPicker/PatternPicker.d.ts.map +1 -1
  234. package/dist/components/PatternPicker/index.js +1 -1
  235. package/dist/components/Plot2D/index.js +1 -1
  236. package/dist/components/PointPlotter/index.js +1 -1
  237. package/dist/components/Powerline/index.js +2 -2
  238. package/dist/components/Prefs/PrefsForm.d.ts +8 -0
  239. package/dist/components/Prefs/PrefsForm.d.ts.map +1 -1
  240. package/dist/components/Prefs/PrefsRail.d.ts +3 -2
  241. package/dist/components/Prefs/PrefsRail.d.ts.map +1 -1
  242. package/dist/components/Prefs/index.js +2 -2
  243. package/dist/components/Prefs/prefField.d.ts +13 -0
  244. package/dist/components/Prefs/prefField.d.ts.map +1 -1
  245. package/dist/components/Properties/PropertyField.d.ts +13 -2
  246. package/dist/components/Properties/PropertyField.d.ts.map +1 -1
  247. package/dist/components/Properties/index.js +3 -3
  248. package/dist/components/RadioGroup/index.js +1 -1
  249. package/dist/components/RangeSlider/index.js +1 -1
  250. package/dist/components/RecentColors/RecentColorsProvider.d.ts +24 -0
  251. package/dist/components/RecentColors/RecentColorsProvider.d.ts.map +1 -0
  252. package/dist/components/RecentColors/index.d.ts +5 -0
  253. package/dist/components/RecentColors/index.d.ts.map +1 -0
  254. package/dist/components/RecentColors/index.js +2 -0
  255. package/dist/components/RecentColors/recentColors.d.ts +39 -0
  256. package/dist/components/RecentColors/recentColors.d.ts.map +1 -0
  257. package/dist/components/ResizeHandle/ResizeHandle.d.ts.map +1 -1
  258. package/dist/components/ResizeHandle/index.js +1 -1
  259. package/dist/components/Select/Select.d.ts +6 -2
  260. package/dist/components/Select/Select.d.ts.map +1 -1
  261. package/dist/components/Select/index.js +1 -1
  262. package/dist/components/SelectionPanel/index.js +2 -2
  263. package/dist/components/SelectionPanel/renderLeaf.d.ts +12 -2
  264. package/dist/components/SelectionPanel/renderLeaf.d.ts.map +1 -1
  265. package/dist/components/SidebarPanel/index.js +1 -1
  266. package/dist/components/Slider/index.js +1 -1
  267. package/dist/components/SwatchGrid/SwatchGrid.d.ts.map +1 -1
  268. package/dist/components/SwatchGrid/index.js +1 -1
  269. package/dist/components/SwatchStrip/SwatchStrip.d.ts +44 -0
  270. package/dist/components/SwatchStrip/SwatchStrip.d.ts.map +1 -0
  271. package/dist/components/SwatchStrip/index.d.ts +5 -0
  272. package/dist/components/SwatchStrip/index.d.ts.map +1 -0
  273. package/dist/components/SwatchStrip/index.js +2 -0
  274. package/dist/components/SwatchStrip/palettes.d.ts +21 -0
  275. package/dist/components/SwatchStrip/palettes.d.ts.map +1 -0
  276. package/dist/components/ThemeSwitcher/index.js +1 -1
  277. package/dist/components/Timeline/AnimatedTimeline.d.ts +1 -0
  278. package/dist/components/Timeline/AnimatedTimeline.d.ts.map +1 -1
  279. package/dist/components/Timeline/EasingPicker.d.ts +3 -0
  280. package/dist/components/Timeline/EasingPicker.d.ts.map +1 -1
  281. package/dist/components/Timeline/LaneGraph.d.ts +1 -1
  282. package/dist/components/Timeline/LaneGraph.d.ts.map +1 -1
  283. package/dist/components/Timeline/Timeline.d.ts +10 -1
  284. package/dist/components/Timeline/Timeline.d.ts.map +1 -1
  285. package/dist/components/Timeline/Transport.d.ts +6 -0
  286. package/dist/components/Timeline/Transport.d.ts.map +1 -1
  287. package/dist/components/Timeline/index.js +1 -1
  288. package/dist/components/Timeline/keys.d.ts +1 -0
  289. package/dist/components/Timeline/keys.d.ts.map +1 -1
  290. package/dist/components/Toast/Toast.d.ts +12 -3
  291. package/dist/components/Toast/Toast.d.ts.map +1 -1
  292. package/dist/components/Toast/index.js +1 -1
  293. package/dist/components/ToggleBar/ToggleBar.d.ts.map +1 -1
  294. package/dist/components/ToggleBar/index.js +1 -1
  295. package/dist/components/TokenPanel/index.js +1 -1
  296. package/dist/components/TokenPanel/tokenTypes.d.ts +1 -0
  297. package/dist/components/TokenPanel/tokenTypes.d.ts.map +1 -1
  298. package/dist/components/ToolButton/ToolButton.d.ts +1 -10
  299. package/dist/components/ToolButton/ToolButton.d.ts.map +1 -1
  300. package/dist/components/ToolButton/index.js +1 -1
  301. package/dist/components/ToolOptionsBar/index.js +1 -1
  302. package/dist/components/ToolPalette/ToolPalette.d.ts.map +1 -1
  303. package/dist/components/ToolPalette/formatShortcut.d.ts +2 -0
  304. package/dist/components/ToolPalette/formatShortcut.d.ts.map +1 -1
  305. package/dist/components/ToolPalette/index.js +1 -1
  306. package/dist/components/Tooltip/index.js +1 -1
  307. package/dist/components/Tree/Tree.d.ts +27 -26
  308. package/dist/components/Tree/Tree.d.ts.map +1 -1
  309. package/dist/icons/index.d.ts +51 -0
  310. package/dist/icons/index.d.ts.map +1 -1
  311. package/dist/icons/paths.d.ts +2 -0
  312. package/dist/icons/paths.d.ts.map +1 -1
  313. package/dist/index.d.ts +4 -1
  314. package/dist/index.d.ts.map +1 -1
  315. package/dist/index.js +98 -95
  316. package/dist/index.js.map +1 -1
  317. package/dist/overlays/portalHost.d.ts +6 -0
  318. package/dist/overlays/portalHost.d.ts.map +1 -1
  319. package/dist/style.css +1 -1
  320. package/dist/useAsyncOptions.d.ts.map +1 -1
  321. package/dist/useReorderDragList.d.ts.map +1 -1
  322. package/dist/useRovingTabIndex.d.ts +40 -39
  323. package/dist/useRovingTabIndex.d.ts.map +1 -1
  324. package/package.json +9 -9
  325. package/dist/chunks/ActionBar-DCq16yFA.js +0 -57
  326. package/dist/chunks/ActionBar-DCq16yFA.js.map +0 -1
  327. package/dist/chunks/Callout-ndW5_Bqx.js +0 -116
  328. package/dist/chunks/Callout-ndW5_Bqx.js.map +0 -1
  329. package/dist/chunks/Checkbox-DHXTUHO9.js +0 -47
  330. package/dist/chunks/Checkbox-DHXTUHO9.js.map +0 -1
  331. package/dist/chunks/ColorField-Yz_BkcCT.js +0 -69
  332. package/dist/chunks/ColorField-Yz_BkcCT.js.map +0 -1
  333. package/dist/chunks/ComboBox-B34H76CW.js +0 -138
  334. package/dist/chunks/ComboBox-B34H76CW.js.map +0 -1
  335. package/dist/chunks/CurveEditor-DUVjd25R.js.map +0 -1
  336. package/dist/chunks/DetailList-BKomDzg5.js.map +0 -1
  337. package/dist/chunks/Field--onYxXTF.js +0 -32
  338. package/dist/chunks/Field--onYxXTF.js.map +0 -1
  339. package/dist/chunks/FillStrokeSwatch-DNb0KXPk.js +0 -111
  340. package/dist/chunks/FillStrokeSwatch-DNb0KXPk.js.map +0 -1
  341. package/dist/chunks/FontFamilySelect-DkRgNtag.js.map +0 -1
  342. package/dist/chunks/GradientEditor-b7v4Ph3i.js +0 -363
  343. package/dist/chunks/GradientEditor-b7v4Ph3i.js.map +0 -1
  344. package/dist/chunks/Icon-CcVjdq2C.js.map +0 -1
  345. package/dist/chunks/Input-CHmkfYaD.js.map +0 -1
  346. package/dist/chunks/ItemList-Cm-HUWCi.js.map +0 -1
  347. package/dist/chunks/Jog-DRmfrkCg.js.map +0 -1
  348. package/dist/chunks/LayerList-wCI1EueM.js.map +0 -1
  349. package/dist/chunks/ListEditor-BeA60TAA.js +0 -71
  350. package/dist/chunks/ListEditor-BeA60TAA.js.map +0 -1
  351. package/dist/chunks/MenuButton-BSqEChJE.js +0 -70
  352. package/dist/chunks/MenuButton-BSqEChJE.js.map +0 -1
  353. package/dist/chunks/MeshEditor-D1HLZcAh.js +0 -87
  354. package/dist/chunks/MeshEditor-D1HLZcAh.js.map +0 -1
  355. package/dist/chunks/NumberField-BnJxcazc.js.map +0 -1
  356. package/dist/chunks/PaintField-DadOELMg.js +0 -62
  357. package/dist/chunks/PaintField-DadOELMg.js.map +0 -1
  358. package/dist/chunks/PaintInput-v8Y7MDbH.js +0 -121
  359. package/dist/chunks/PaintInput-v8Y7MDbH.js.map +0 -1
  360. package/dist/chunks/PatternPicker-R_EQtw2Q.js +0 -93
  361. package/dist/chunks/PatternPicker-R_EQtw2Q.js.map +0 -1
  362. package/dist/chunks/Plot2D-CTXHkL5p.js.map +0 -1
  363. package/dist/chunks/Prefs-ByA-x51i.js.map +0 -1
  364. package/dist/chunks/PropertyField-DfIJJ5GS.js +0 -673
  365. package/dist/chunks/PropertyField-DfIJJ5GS.js.map +0 -1
  366. package/dist/chunks/RangeSlider-SEGE-7VF.js.map +0 -1
  367. package/dist/chunks/ResizeHandle-rKVWyeTG.js +0 -79
  368. package/dist/chunks/ResizeHandle-rKVWyeTG.js.map +0 -1
  369. package/dist/chunks/Select-ClmKtyWg.js +0 -229
  370. package/dist/chunks/Select-ClmKtyWg.js.map +0 -1
  371. package/dist/chunks/Slider-YofwGOI4.js.map +0 -1
  372. package/dist/chunks/SwatchGrid-BYvA8Bmh.js +0 -73
  373. package/dist/chunks/SwatchGrid-BYvA8Bmh.js.map +0 -1
  374. package/dist/chunks/Timeline-B39cwfMB.js.map +0 -1
  375. package/dist/chunks/Toast-BF9GE0HC.js +0 -126
  376. package/dist/chunks/Toast-BF9GE0HC.js.map +0 -1
  377. package/dist/chunks/TokenPanel-CMDAOfYH.js.map +0 -1
  378. package/dist/chunks/ToolButton-CAHBa08P.js.map +0 -1
  379. package/dist/chunks/createKeyframeLayer-DVl321_l.js.map +0 -1
  380. package/dist/chunks/icons-BhcR1l64.js.map +0 -1
  381. package/dist/chunks/model-BaF65rnX.js +0 -365
  382. package/dist/chunks/model-BaF65rnX.js.map +0 -1
  383. package/dist/chunks/portalHost-yTOVuCej.js.map +0 -1
  384. package/dist/chunks/prefField-BopW9bjx.js +0 -201
  385. package/dist/chunks/prefField-BopW9bjx.js.map +0 -1
  386. package/dist/chunks/segmentedControl.module-D6SzYJD7.js +0 -11
  387. package/dist/chunks/segmentedControl.module-D6SzYJD7.js.map +0 -1
  388. package/dist/chunks/useReorderDragList-FCMoFIzH.js +0 -131
  389. package/dist/chunks/useReorderDragList-FCMoFIzH.js.map +0 -1
  390. package/dist/chunks/useRovingTabIndex-Bp_hYm_h.js +0 -65
  391. package/dist/chunks/useRovingTabIndex-Bp_hYm_h.js.map +0 -1
@@ -1,70 +0,0 @@
1
- import { r as e } from "./portalHost-yTOVuCej.js";
2
- import { n as t, r as n } from "./segmentTooltip-CStYHKzd.js";
3
- import { jsx as r, jsxs as i } from "react/jsx-runtime";
4
- import { Button as a, Menu as o, MenuItem as s, MenuTrigger as c, Popover as l } from "react-aria-components";
5
- var u = {
6
- trigger: "_trigger_djrlo_1",
7
- label: "_label_djrlo_30",
8
- chevron: "_chevron_djrlo_34",
9
- popover: "_popover_djrlo_41",
10
- menu: "_menu_djrlo_47",
11
- item: "_item_djrlo_60"
12
- };
13
- //#endregion
14
- //#region src/components/MenuButton/MenuButton.tsx
15
- function d({ label: d, items: f, onAction: p, isDisabled: m, className: h, "aria-label": g, portalContainer: _, shortcut: v, tooltip: y }) {
16
- let { anchor: b, portalProps: x } = e(_);
17
- return /* @__PURE__ */ i(c, { children: [
18
- b,
19
- /* @__PURE__ */ r(t, {
20
- content: n({
21
- tooltip: y,
22
- shortcut: v,
23
- ariaLabel: g,
24
- label: d
25
- }),
26
- disabled: m,
27
- children: /* @__PURE__ */ i(a, {
28
- className: [u.trigger, h].filter(Boolean).join(" "),
29
- isDisabled: m,
30
- "aria-label": g,
31
- children: [/* @__PURE__ */ r("span", {
32
- className: u.label,
33
- children: d
34
- }), /* @__PURE__ */ r("svg", {
35
- className: u.chevron,
36
- viewBox: "0 0 10 10",
37
- "aria-hidden": "true",
38
- children: /* @__PURE__ */ r("path", {
39
- d: "M2 4 L5 7 L8 4",
40
- fill: "none",
41
- stroke: "currentColor",
42
- strokeWidth: "1.5",
43
- strokeLinecap: "round",
44
- strokeLinejoin: "round"
45
- })
46
- })]
47
- })
48
- }),
49
- /* @__PURE__ */ r(l, {
50
- className: u.popover,
51
- "data-weasel-overlay": "",
52
- ...x,
53
- children: /* @__PURE__ */ r(o, {
54
- className: u.menu,
55
- onAction: (e) => p(e),
56
- children: f.map((e) => /* @__PURE__ */ r(s, {
57
- id: e.value,
58
- className: u.item,
59
- isDisabled: e.isDisabled,
60
- textValue: e.textValue ?? (typeof e.label == "string" ? e.label : void 0),
61
- children: e.label
62
- }, e.value))
63
- })
64
- })
65
- ] });
66
- }
67
- //#endregion
68
- export { d as t };
69
-
70
- //# sourceMappingURL=MenuButton-BSqEChJE.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"MenuButton-BSqEChJE.js","names":["RACButton","s","RACPopover","RACMenu","RACMenuItem","useOverlayPortal","TriggerTooltip","segmentTooltipContent","MenuButton_module_default","MenuButton","ariaLabel","portalContainer","MenuTrigger","anchor","isDisabled","Button","className","label","Popover","portalProps","Menu","onAction","key","items","MenuItem","item"],"sources":["../../src/components/MenuButton/MenuButton.module.css","../../src/components/MenuButton/MenuButton.tsx"],"sourcesContent":[".trigger {\n display: inline-flex;\n flex: none;\n align-items: center;\n gap: var(--wzl-space-3);\n height: var(--wzl-control-h);\n padding: 0 var(--wzl-space-3) 0 var(--wzl-space-5);\n background: var(--wzl-input-surface, var(--wzl-surface-sunken));\n border: 1px solid var(--wzl-border);\n border-radius: var(--wzl-radius-sm);\n color: var(--wzl-fg);\n font-family: var(--wzl-font-ui);\n font-size: var(--wzl-font-size);\n line-height: 1;\n white-space: nowrap;\n cursor: pointer;\n transition: border-color var(--wzl-motion-fast), box-shadow var(--wzl-motion-fast);\n}\n\n.trigger[data-focus-visible] {\n border-color: var(--wzl-focus-ring);\n box-shadow: 0 0 0 1px var(--wzl-focus-ring);\n}\n\n.trigger[data-disabled] {\n opacity: 0.5;\n cursor: not-allowed;\n}\n\n.label {\n color: var(--wzl-fg-subtle);\n}\n\n.chevron {\n width: 10px;\n height: 10px;\n color: var(--wzl-fg-muted);\n flex: 0 0 auto;\n}\n\n.popover {\n min-width: var(--trigger-width);\n max-height: inherit;\n outline: none;\n}\n\n.menu {\n background: var(--wzl-surface-raised);\n border: 1px solid var(--wzl-border);\n border-radius: var(--wzl-radius-md);\n box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);\n padding: var(--wzl-space-2);\n max-height: 280px;\n overflow: auto;\n outline: none;\n font-family: var(--wzl-font-ui);\n font-size: var(--wzl-font-size);\n}\n\n.item {\n display: flex;\n align-items: center;\n padding: var(--wzl-space-2) var(--wzl-space-4);\n border-radius: var(--wzl-radius-sm);\n cursor: pointer;\n color: var(--wzl-fg);\n white-space: nowrap;\n outline: none;\n}\n\n.item[data-focused] {\n background: var(--wzl-surface-hover);\n}\n\n.item[data-disabled] {\n opacity: 0.4;\n cursor: not-allowed;\n}\n","import type { ReactNode } from 'react';\nimport {\n Button as RACButton,\n Menu as RACMenu,\n MenuItem as RACMenuItem,\n MenuTrigger,\n Popover as RACPopover,\n} from 'react-aria-components';\nimport { useOverlayPortal, type OverlayPortalProps } from '../../overlays/portalHost';\nimport s from './MenuButton.module.css';\nimport { TriggerTooltip, segmentTooltipContent, type SegmentTooltipFields } from '../segmentTooltip';\n\n/** One row in a {@link MenuButton}'s list. */\nexport type MenuButtonItem<T extends string = string> = {\n value: T;\n label: ReactNode;\n isDisabled?: boolean;\n /** Plain-text form of `label`, for type-to-select and screen readers. A\n * string label supplies this itself. */\n textValue?: string;\n};\n\n/** Props for {@link MenuButton}. */\nexport type MenuButtonProps<T extends string = string> = {\n /** What the button says. It never changes to show a chosen row. */\n label: ReactNode;\n items: ReadonlyArray<MenuButtonItem<T>>;\n /** Fired with the value of the row chosen. */\n onAction: (value: T) => void;\n isDisabled?: boolean;\n className?: string;\n 'aria-label'?: string;\n} & SegmentTooltipFields & OverlayPortalProps;\n\n/**\n * A button that opens a list and acts on the row chosen — \"Add trial…\",\n * \"Load…\". Unlike a {@link Select} it holds no value, so it sizes to its own\n * label rather than to its widest row.\n *\n * `shortcut` adds a kit tooltip reading `Name (⌘N)`, named by `aria-label` or\n * a string `label`, as `Button` does; `tooltip` replaces that text.\n */\nexport function MenuButton<T extends string = string>({\n label,\n items,\n onAction,\n isDisabled,\n className,\n 'aria-label': ariaLabel,\n portalContainer,\n shortcut,\n tooltip,\n}: MenuButtonProps<T>) {\n const { anchor, portalProps } = useOverlayPortal(portalContainer);\n return (\n <MenuTrigger>\n {anchor}\n <TriggerTooltip\n content={segmentTooltipContent({ tooltip, shortcut, ariaLabel, label })}\n disabled={isDisabled}\n >\n <RACButton\n className={[s.trigger, className].filter(Boolean).join(' ')}\n isDisabled={isDisabled}\n aria-label={ariaLabel}\n >\n <span className={s.label}>{label}</span>\n <svg className={s.chevron} viewBox=\"0 0 10 10\" aria-hidden=\"true\">\n <path d=\"M2 4 L5 7 L8 4\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"1.5\" strokeLinecap=\"round\" strokeLinejoin=\"round\" />\n </svg>\n </RACButton>\n </TriggerTooltip>\n {/* `data-weasel-overlay`: see Select — the list renders in a portal,\n outside the subtree the trigger sits in. */}\n <RACPopover className={s.popover} data-weasel-overlay=\"\" {...portalProps}>\n <RACMenu className={s.menu} onAction={(key) => onAction(key as T)}>\n {items.map((item) => (\n <RACMenuItem\n key={item.value}\n id={item.value}\n className={s.item}\n isDisabled={item.isDisabled}\n textValue={item.textValue ?? (typeof item.label === 'string' ? item.label : undefined)}\n >\n {item.label}\n </RACMenuItem>\n ))}\n </RACMenu>\n </RACPopover>\n </MenuTrigger>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;AC0CA,SAAgBS,EAAsC,EACpD,UACA,UACA,aACA,eACA,cACA,cAAcC,GACd,oBACA,aACA,cACqB;CACrB,IAAM,EAAE,WAAQ,mBAAgBL,EAAiBM,CAAe;CAChE,OACE,kBAACC,GAAD,EAAA,UAAA;EACGC;EACD,kBAACP,GAAD;GACE,SAASC,EAAsB;IAAE;IAAS;IAAU;IAAW;GAAM,CAAC;GACtE,UAAUO;GAEV,UAAA,kBAACd,GAAD;IACE,WAAW,CAACC,EAAE,SAASe,CAAS,CAAC,CAAC,OAAO,OAAO,CAAC,CAAC,KAAK,GAAG;IAC9C;IACZ,cAAYN;IAHd,UAAA,CAKE,kBAAC,QAAD;KAAM,WAAWT,EAAE;KAAQ,UAAAgB;IAAY,CAAA,GACvC,kBAAC,OAAD;KAAK,WAAWhB,EAAE;KAAS,SAAQ;KAAY,eAAY;KACzD,UAAA,kBAAC,QAAD;MAAM,GAAE;MAAiB,MAAK;MAAO,QAAO;MAAe,aAAY;MAAM,eAAc;MAAQ,gBAAe;KAAS,CAAA;IACxH,CAAA,CACI;;EACG,CAAA;EAGhB,kBAACC,GAAD;GAAY,WAAWD,EAAE;GAAS,uBAAoB;GAAG,GAAIkB;GAC3D,UAAA,kBAAChB,GAAD;IAAS,WAAWF,EAAE;IAAM,WAAW,MAAQoB,EAASC,CAAQ;IAC7D,UAAAC,EAAM,KAAK,MACV,kBAACnB,GAAD;KAEE,IAAIqB,EAAK;KACT,WAAWxB,EAAE;KACb,YAAYwB,EAAK;KACjB,WAAWA,EAAK,cAAc,OAAOA,EAAK,SAAU,WAAWA,EAAK,QAAQ,KAAA;KAE3E,UAAAA,EAAK;IACK,GAPNA,EAAK,KAOC,CACd;GACM,CAAA;EACC,CAAA;CACD,EAAA,CAAA;AAEjB"}
@@ -1,87 +0,0 @@
1
- import { t as e } from "./ColorField-Yz_BkcCT.js";
2
- import { t } from "./paintPreview-CuSZiHpR.js";
3
- import { t as n } from "./ToggleBar-BTYkBXU9.js";
4
- import { asPaint as r, isMeshGradientFill as i } from "@weasel-js/core";
5
- import { jsx as a, jsxs as o } from "react/jsx-runtime";
6
- import "react";
7
- var s = {
8
- root: "_root_g12ri_1",
9
- patch: "_patch_g12ri_7",
10
- preview: "_preview_g12ri_13",
11
- corners: "_corners_g12ri_21",
12
- corner: "_corner_g12ri_21"
13
- }, c = [
14
- {
15
- value: "rgb",
16
- label: "sRGB"
17
- },
18
- {
19
- value: "oklab",
20
- label: "OKLab"
21
- },
22
- {
23
- value: "oklch",
24
- label: "OKLCh"
25
- }
26
- ];
27
- function l(t) {
28
- let { value: i, onInput: l, onChange: d, spaceSwitch: f = !0, className: p } = t, m = i.interpolate ?? "rgb", h = (e, t, n) => r({
29
- ...i,
30
- patches: i.patches.map((r, i) => {
31
- if (i !== e) return r;
32
- let [a, o, s, c] = r.colors, l = [
33
- a,
34
- o,
35
- s,
36
- c
37
- ];
38
- return l[t] = n, {
39
- ...r,
40
- colors: l
41
- };
42
- })
43
- });
44
- return /* @__PURE__ */ o("div", {
45
- className: [s.root, p].filter(Boolean).join(" "),
46
- children: [i.patches.map((t, n) => /* @__PURE__ */ o("div", {
47
- className: s.patch,
48
- children: [/* @__PURE__ */ a("span", {
49
- className: s.preview,
50
- "aria-hidden": "true",
51
- style: { background: u(i, n) }
52
- }), /* @__PURE__ */ a("div", {
53
- className: s.corners,
54
- children: t.colors.map((t, r) => /* @__PURE__ */ a(e, {
55
- value: t,
56
- alpha: !0,
57
- "aria-label": `Patch ${n + 1} corner ${r + 1}`,
58
- className: s.corner,
59
- onInput: (e) => l?.(h(n, r, e)),
60
- onChange: (e) => d(h(n, r, e))
61
- }, r))
62
- })]
63
- }, n)), f && /* @__PURE__ */ a(n, {
64
- items: c,
65
- value: m,
66
- size: "sm",
67
- ariaLabel: "Blend space",
68
- onChange: (e) => e && d(r({
69
- ...i,
70
- interpolate: e
71
- }))
72
- })]
73
- });
74
- }
75
- function u(e, n) {
76
- return t({
77
- ...e,
78
- patches: [e.patches[n]]
79
- });
80
- }
81
- function d(e) {
82
- return i(e);
83
- }
84
- //#endregion
85
- export { d as n, l as t };
86
-
87
- //# sourceMappingURL=MeshEditor-D1HLZcAh.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"MeshEditor-D1HLZcAh.js","names":["s","ColorField","ToggleBar","MeshEditor_module_default","SPACES","MeshEditor","props","space","value","withCorner","asPaint","patchIndex","patch","b","c","d","next","corner","color","className","previewOf","onInput","onChange","spaceSwitch","paintPreviewCss","isMeshPaint","isMeshGradientFill","fill"],"sources":["../../src/components/MeshEditor/MeshEditor.module.css","../../src/components/MeshEditor/MeshEditor.tsx"],"sourcesContent":[".root {\n display: flex;\n flex-direction: column;\n gap: var(--wzl-space-4);\n}\n\n.patch {\n display: flex;\n align-items: center;\n gap: var(--wzl-space-4);\n}\n\n.preview {\n inline-size: 34px;\n block-size: 34px;\n flex: 0 0 auto;\n border-radius: var(--wzl-radius-sm);\n box-shadow: inset 0 0 0 1px var(--wzl-border);\n}\n\n.corners {\n display: grid;\n grid-template-columns: repeat(2, auto);\n gap: var(--wzl-space-2) var(--wzl-space-3);\n min-inline-size: 0;\n}\n\n.corner {\n min-inline-size: 0;\n}\n","import { type ReactElement } from 'react';\nimport {\n asPaint,\n isMeshGradientFill,\n type ColorSpace,\n type FillStyle,\n type MeshGradientFill,\n} from '@weasel-js/core';\nimport { ColorField } from '../ColorField';\nimport { ToggleBar, type ToggleBarItem } from '../ToggleBar';\nimport { paintPreviewCss } from '../../paintPreview';\nimport s from './MeshEditor.module.css';\n\nconst SPACES: readonly ToggleBarItem<ColorSpace>[] = [\n { value: 'rgb', label: 'sRGB' },\n { value: 'oklab', label: 'OKLab' },\n { value: 'oklch', label: 'OKLCh' },\n];\n\n/** Props for {@link MeshEditor}. `onInput` fires throughout a gesture and\n * `onChange` once at its end. */\nexport interface MeshEditorProps {\n value: MeshGradientFill;\n /** Emitted as a `FillStyle`, which is what every paint control passes\n * around — `FillStyle`'s discriminant stays closed over the built-in\n * members, so a registered kind's own shape only travels through it. */\n onInput?: (next: FillStyle) => void;\n onChange: (next: FillStyle) => void;\n /** Show the sRGB / OKLab / OKLCh switch. Default true. */\n spaceSwitch?: boolean;\n className?: string;\n}\n\n/**\n * Editor for a mesh gradient's colors.\n *\n * Geometry is absent for the same reason it is absent from `GradientEditor`:\n * a patch's twelve control points are a thing to drag on the artwork, not a\n * column of numbers in a panel. What is left is what a panel is good at — the\n * color at each corner, and the space the four of them blend through.\n *\n * Corners are numbered in the patch's own walk order, which is the order the\n * paint stores them in, so a corner's number is stable while it is dragged.\n */\nexport function MeshEditor(props: MeshEditorProps): ReactElement {\n const { value, onInput, onChange, spaceSwitch = true, className } = props;\n const space = value.interpolate ?? 'rgb';\n\n const withCorner = (patchIndex: number, corner: number, color: string): FillStyle => asPaint({\n ...value,\n patches: value.patches.map((patch, i) => {\n if (i !== patchIndex) return patch;\n const [a, b, c, d] = patch.colors;\n const next: [string, string, string, string] = [a, b, c, d];\n next[corner] = color;\n return { ...patch, colors: next };\n }),\n });\n\n return (\n <div className={[s.root, className].filter(Boolean).join(' ')}>\n {value.patches.map((patch, patchIndex) => (\n // A patch has no id; its position in the list is its identity, the way\n // a gradient stop's is.\n <div key={patchIndex} className={s.patch}>\n <span\n className={s.preview}\n aria-hidden=\"true\"\n style={{ background: previewOf(value, patchIndex) }}\n />\n <div className={s.corners}>\n {patch.colors.map((color, corner) => (\n <ColorField\n key={corner}\n value={color}\n alpha\n aria-label={`Patch ${patchIndex + 1} corner ${corner + 1}`}\n className={s.corner}\n onInput={(next) => onInput?.(withCorner(patchIndex, corner, next))}\n onChange={(next) => onChange(withCorner(patchIndex, corner, next))}\n />\n ))}\n </div>\n </div>\n ))}\n\n {spaceSwitch && (\n <ToggleBar<ColorSpace>\n items={SPACES}\n value={space}\n size=\"sm\"\n ariaLabel=\"Blend space\"\n onChange={(next) => next && onChange(asPaint({ ...value, interpolate: next }))}\n />\n )}\n </div>\n );\n}\n\n/** One patch as a swatch: the paint with the other patches taken out, so a\n * multi-patch mesh shows which row belongs to which part of it. */\nfunction previewOf(value: MeshGradientFill, patchIndex: number): string | undefined {\n return paintPreviewCss(\n { ...value, patches: [value.patches[patchIndex]] } as unknown as FillStyle,\n );\n}\n\n/** Narrowing for a consumer rendering this behind a kind switch. */\nexport function isMeshPaint(fill: FillStyle | null | undefined): fill is FillStyle & MeshGradientFill {\n return isMeshGradientFill(fill);\n}\n"],"mappings":";;;;;;;;;;;;GCaMI,IAA+C;CACnD;EAAE,OAAO;EAAO,OAAO;CAAO;CAC9B;EAAE,OAAO;EAAS,OAAO;CAAQ;CACjC;EAAE,OAAO;EAAS,OAAO;CAAQ;AACnC;AA2BA,SAAgBC,EAAW,GAAsC;CAC/D,IAAM,EAAE,UAAO,YAAS,aAAU,iBAAc,IAAM,iBAAcC,GAC9DC,IAAQC,EAAM,eAAe,OAE7BC,KAAc,GAAoB,GAAgB,MAA6BC,EAAQ;EAC3F,GAAGF;EACH,SAASA,EAAM,QAAQ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,SAAgBc,EAAY,GAA0E;CACpG,OAAOC,EAAmBC,CAAI;AAChC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"NumberField-BnJxcazc.js","names":["NumberField","RACNumberField","s","RACInput","RACButton","s","fieldClasses","NumberField_module_default","NumberField$1","forwardRef","rest","props","NumberField","width","orientation","className","label","Label","Group","ghost","Input","hideSteppers","Button","description","Text","FieldError","errorMessage","clampToBounds","max","min","n","placesOf","text","e","dot","spinKey","by","places","from","bounds","key","FULL_PRECISION","decimal","REPEAT_DELAY_MS","REPEAT_EVERY_MS","UnitField","ariaLabel","draft","setDraft","useState","canceled","useRef","input","known","value","qty","display","read","accepts","parseNumber","typed","parseAs","minValue","maxValue","stepTo","onInput","next","onChange","spin","latestSpin","useEffect","el","onWheel","repeat","stopRepeat","startRepeat","tick","delay","stepper","atBound","glyph","steppers"],"sources":["../../src/components/NumberField/NumberField.module.css","../../src/components/NumberField/NumberField.tsx","../../src/components/spin.ts","../../src/components/NumberField/UnitField.tsx"],"sourcesContent":[".field {\n display: flex;\n flex-direction: column;\n width: 100%;\n min-width: 0;\n gap: var(--wzl-space-2);\n}\n\n/* `orientation='row'`: the label keeps its own width and the field takes the\n rest; description and error wrap onto a line of their own. A `fit` field\n keeps its own width and centers on the label instead. */\n.field.row {\n flex-direction: row;\n align-items: center;\n flex-wrap: wrap;\n column-gap: var(--wzl-space-4);\n row-gap: var(--wzl-space-2);\n}\n.field.row .label { flex: 0 0 auto; }\n.field.row:not(.fit) .frame { flex: 1 1 0; min-width: 0; }\n.field.row.fit { align-items: center; }\n.field.row .below { flex-basis: 100%; }\n\n.frame {\n display: flex;\n align-items: stretch;\n height: var(--wzl-field-h, var(--wzl-control-h));\n background: var(--wzl-input-surface, var(--wzl-surface-sunken));\n border: 1px solid var(--wzl-border);\n border-radius: var(--wzl-radius-sm);\n color: var(--wzl-fg);\n font-family: var(--wzl-font-ui);\n font-size: var(--wzl-font-size);\n line-height: 1;\n overflow: hidden;\n transition: border-color var(--wzl-motion-fast), box-shadow var(--wzl-motion-fast);\n}\n\n.frame:focus-within {\n border-color: var(--wzl-focus-ring);\n box-shadow: 0 0 0 1px var(--wzl-focus-ring);\n}\n\n.field[data-invalid] .frame {\n border-color: var(--wzl-danger);\n}\n\n.field[data-disabled] .frame {\n opacity: 0.5;\n cursor: not-allowed;\n}\n\n.frame input {\n flex: 1;\n min-width: 0;\n background: transparent;\n border: none;\n outline: none;\n color: inherit;\n font: inherit;\n padding: 0 var(--wzl-field-pad-x);\n text-align: right;\n -moz-appearance: textfield;\n}\n\n.frame input::-webkit-outer-spin-button,\n.frame input::-webkit-inner-spin-button {\n -webkit-appearance: none;\n margin: 0;\n}\n\n.steppers {\n display: flex;\n flex-direction: column;\n border-left: 1px solid var(--wzl-border);\n}\n\n.stepper {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n width: var(--wzl-control-h-xs);\n flex: 1;\n /* The two share the frame's height; left to their glyphs' line boxes they\n overflow it, and the frame clips the lower one. */\n min-height: 0;\n height: auto;\n overflow: hidden;\n background: transparent;\n border: none;\n color: var(--wzl-fg-muted);\n cursor: pointer;\n padding: 0;\n font: inherit;\n font-size: min(var(--wzl-font-size-2xs), calc(var(--wzl-field-h, var(--wzl-control-h)) * 0.35));\n line-height: 1;\n}\n\n.stepper:not(:last-child) {\n border-bottom: 1px solid var(--wzl-border);\n}\n\n.stepper[data-hovered]:not([data-disabled]),\n.stepper:hover:not(:disabled):not([data-rac]) {\n background: var(--wzl-surface-hover);\n color: var(--wzl-fg);\n}\n\n.stepper[data-pressed]:not([data-disabled]),\n.stepper:active:not(:disabled):not([data-rac]) {\n background: var(--wzl-surface-pressed);\n}\n\n.stepper[data-disabled],\n.stepper:disabled {\n opacity: 0.4;\n cursor: not-allowed;\n}\n\n/* Mirrors the property rows' editable readout (`.readoutInput`), so a number\n sitting inside other chrome does not draw a second box around itself. */\n.ghost {\n height: auto;\n background: transparent;\n border-color: transparent;\n color: var(--wzl-accent-fg);\n font-weight: var(--wzl-font-weight-medium);\n}\n\n.ghost input {\n padding: 1px 0;\n}\n\n.ghost:hover {\n background: color-mix(in srgb, currentColor 8%, transparent);\n}\n\n.ghost:focus-within {\n background: var(--wzl-surface-sunken);\n border-color: var(--wzl-focus-ring);\n box-shadow: none;\n}\n\n/* `width='fit'` states the field's width in characters: left alone an `<input>`\n asks for its 20-character intrinsic width, wider than most rows it sits in. */\n.fit {\n width: auto;\n max-width: 100%;\n align-items: flex-start;\n}\n\n.fit .frame {\n width: fit-content;\n max-width: 100%;\n}\n\n.fit .frame input {\n flex: 0 0 auto;\n width: var(--wzl-number-field-width, 9ch);\n}\n","import { forwardRef, type ReactNode, type Ref } from 'react';\nimport {\n NumberField as RACNumberField,\n Label,\n Input as RACInput,\n Group,\n Button as RACButton,\n Text,\n FieldError,\n type NumberFieldProps as RACNumberFieldProps,\n type ValidationResult,\n} from 'react-aria-components';\nimport { fieldClasses, type FieldOrientation } from '../Field/Field';\nimport s from './NumberField.module.css';\n\n/** Props for {@link NumberField}, on top of React Aria's `NumberField` props. */\nexport type NumberFieldProps = Omit<RACNumberFieldProps, 'children' | 'className'> & {\n label?: ReactNode;\n /**\n * `'stacked'` (the default) puts the label above the field; `'row'` sets it\n * beside the field at its own width, with any description or error on a\n * line below. Same vocabulary as {@link Field}'s `orientation`.\n */\n orientation?: FieldOrientation;\n description?: ReactNode;\n errorMessage?: ReactNode | ((v: ValidationResult) => ReactNode);\n /** Hide the up/down stepper buttons. Defaults to false. */\n hideSteppers?: boolean;\n /** Render with no box until focused — the readout treatment the property\n * rows use, for a value that sits inside other chrome rather than in a form. */\n ghost?: boolean;\n /** Native input placeholder — e.g. `'Mixed'` for a multi-selection\n * editor with no shared value. */\n placeholder?: string;\n /**\n * `'fill'` (the default) takes the width of whatever row the field sits in.\n * `'fit'` sizes it to `--wzl-number-field-width` (`9ch` by default) plus its\n * own chrome, rather than to the input's 20-character intrinsic width.\n */\n width?: 'fill' | 'fit';\n className?: string;\n};\n\n/**\n * Numeric input with stepper buttons, wrapping React Aria's NumberField and\n * supplying the same label / description / errorMessage slots as `Input`.\n * Arrow keys and scroll step the value; parsing and formatting are React\n * Aria's.\n *\n * `ref` forwards to the underlying `<input>`.\n */\nexport const NumberField = forwardRef(function NumberField(\n props: NumberFieldProps,\n ref: Ref<HTMLInputElement>,\n) {\n const {\n label,\n orientation = 'stacked',\n description,\n errorMessage,\n hideSteppers,\n ghost,\n placeholder,\n width = 'fill',\n className,\n ...rest\n } = props;\n return (\n <RACNumberField\n {...rest}\n className={[\n s.field,\n width === 'fit' && s.fit,\n fieldClasses.root,\n orientation === 'row' && fieldClasses.row,\n orientation === 'row' && s.row,\n className,\n ]\n .filter(Boolean)\n .join(' ')}\n >\n {label !== undefined && <Label className={`${fieldClasses.label} ${s.label}`}>{label}</Label>}\n <Group className={ghost ? `${s.frame} ${s.ghost}` : s.frame}>\n <RACInput ref={ref} placeholder={placeholder} />\n {!hideSteppers && (\n <div className={s.steppers}>\n <RACButton slot=\"increment\" className={s.stepper} aria-label=\"Increment\">▲</RACButton>\n <RACButton slot=\"decrement\" className={s.stepper} aria-label=\"Decrement\">▼</RACButton>\n </div>\n )}\n </Group>\n {description !== undefined && (\n <Text slot=\"description\" className={`${fieldClasses.hint} ${s.below}`}>\n {description}\n </Text>\n )}\n <FieldError className={`${fieldClasses.error} ${s.below}`}>{errorMessage}</FieldError>\n </RACNumberField>\n );\n});\n","/** The bounds a spin key moves a value within. */\nexport interface SpinBounds {\n step: number;\n min?: number;\n max?: number;\n}\n\n/** `n` held within the bounds. */\nexport function clampToBounds(n: number, { min, max }: SpinBounds): number {\n return Math.min(max ?? Infinity, Math.max(min ?? -Infinity, n));\n}\n\n/** Decimal places `n` is written with, up to ten. */\nfunction placesOf(n: number): number {\n if (!Number.isFinite(n)) return 0;\n const text = String(n);\n const e = text.indexOf('e-');\n if (e >= 0) return Math.min(10, Number(text.slice(e + 2)));\n const dot = text.indexOf('.');\n return dot < 0 ? 0 : Math.min(10, text.length - dot - 1);\n}\n\n/**\n * The value a spin-button key moves `from` to, or `null` for a key that does\n * not spin: the arrows by a step, Page Up and Page Down by ten, and Home and\n * End to a bound, where there is one. A sum of steps is rounded to the places\n * its operands carry, so `0.1 + 0.2` lands on `0.3`.\n */\nexport function spinKey(key: string, from: number, bounds: SpinBounds): number | null {\n const by = (n: number) => {\n const places = Math.max(placesOf(from), placesOf(bounds.step));\n return clampToBounds(Number((from + n * bounds.step).toFixed(places)), bounds);\n };\n switch (key) {\n case 'ArrowUp':\n return by(1);\n case 'ArrowDown':\n return by(-1);\n case 'PageUp':\n return by(10);\n case 'PageDown':\n return by(-10);\n case 'Home':\n return bounds.min ?? null;\n case 'End':\n return bounds.max ?? null;\n default:\n return null;\n }\n}\n","import { useEffect, useRef, useState } from 'react';\nimport { decimal, parseAs, parseNumber, qty, type Display, type UnitTable } from '@weasel-js/quantity';\nimport { fieldClasses } from '../Field/Field';\nimport { clampToBounds, spinKey } from '../spin';\nimport s from './NumberField.module.css';\n\n/** Props for {@link UnitField}. */\nexport interface UnitFieldProps {\n /** The value in the unit the field shows. NaN shows an empty field. */\n value: number;\n /** The committed value, read and clamped, in the unit the field shows: on\n * blur or Enter, and on every step. */\n onChange: (value: number) => void;\n /** The live value: every keystroke that reads as a number, and every step. */\n onInput?: (value: number) => void;\n minValue?: number;\n maxValue?: number;\n /** What an arrow key, a stepper or a wheel notch adds or takes away; Page Up\n * and Page Down move ten. Defaults to 1. */\n step?: number;\n /** Units a person may type, each mapped to the factor that turns a number\n * in it into the unit the field shows: `{ mm: 0.1, cm: 1 }`. */\n accepts?: Readonly<UnitTable>;\n /** How the value shows, is spoken, and reads back when typed: `fraction()`\n * shows `1/12` and reads `1/12` typed. `accepts`, when given, does the\n * reading instead. Default: the number with every decimal it has. */\n display?: Display;\n placeholder?: string;\n /** Up and down buttons beside the value, which repeat while held. */\n steppers?: boolean;\n /** Render with no box until focused, as {@link NumberField}'s `ghost` does. */\n ghost?: boolean;\n /** As {@link NumberField}'s `width`. */\n width?: 'fill' | 'fit';\n className?: string;\n /** Id for the input, for a `<label htmlFor>` outside it. */\n id?: string;\n 'aria-label'?: string;\n}\n\nconst FULL_PRECISION = decimal({ maxPlaces: 20, grouping: false });\n\nconst REPEAT_DELAY_MS = 400;\nconst REPEAT_EVERY_MS = 60;\n\n/**\n * A number typed as text, so it can carry a unit: `12mm` in a field showing\n * centimeters commits `1.2`. Commits on blur or Enter, reverts on Escape or on\n * text it cannot read, and clamps to its bounds. Steps like a spin button —\n * arrows, Page Up and Down, Home and End to a bound, the wheel while focused,\n * and optional steppers. React Aria's `NumberField` refuses letters as they\n * are typed, which is why this is not that.\n */\nexport function UnitField({\n value,\n onChange,\n onInput,\n minValue,\n maxValue,\n step = 1,\n accepts,\n display = FULL_PRECISION,\n placeholder,\n steppers,\n ghost,\n width = 'fill',\n className,\n id,\n 'aria-label': ariaLabel,\n}: UnitFieldProps) {\n const [draft, setDraft] = useState<string | null>(null);\n const canceled = useRef(false);\n const input = useRef<HTMLInputElement>(null);\n const known = Number.isFinite(value);\n const text = known ? qty(value, display).text : '';\n const read = (typed: string) => (accepts ? parseNumber(typed, accepts) : parseAs(typed, display));\n const bounds = { step, min: minValue, max: maxValue };\n\n // What a step starts from: the text as typed where it reads, else the value.\n const from = (): number => {\n const typed = draft === null ? value : read(draft);\n return Number.isFinite(typed) ? typed : Number.isFinite(value) ? value : 0;\n };\n const stepTo = (next: number) => {\n setDraft(null);\n onInput?.(next);\n if (next !== value) onChange(next);\n };\n const spin = (key: string): boolean => {\n const next = spinKey(key, from(), bounds);\n if (next === null) return false;\n stepTo(next);\n return true;\n };\n\n // The latest `spin`, for the listeners below, which outlive a render.\n const latestSpin = useRef(spin);\n useEffect(() => {\n latestSpin.current = spin;\n });\n\n // The wheel steps only a focused field, so scrolling past one changes nothing.\n // Not passive, so it can keep the page from scrolling under it.\n useEffect(() => {\n const el = input.current;\n if (!el) return;\n const onWheel = (e: WheelEvent) => {\n if (document.activeElement !== el || e.deltaY === 0) return;\n e.preventDefault();\n latestSpin.current(e.deltaY < 0 ? 'ArrowUp' : 'ArrowDown');\n };\n el.addEventListener('wheel', onWheel, { passive: false });\n return () => el.removeEventListener('wheel', onWheel);\n }, []);\n\n const repeat = useRef<ReturnType<typeof setTimeout> | null>(null);\n const stopRepeat = () => {\n if (repeat.current !== null) clearTimeout(repeat.current);\n repeat.current = null;\n };\n useEffect(() => stopRepeat, []);\n const startRepeat = (key: 'ArrowUp' | 'ArrowDown') => {\n stopRepeat();\n latestSpin.current(key);\n const tick = (delay: number) => {\n repeat.current = setTimeout(() => {\n latestSpin.current(key);\n tick(REPEAT_EVERY_MS);\n }, delay);\n };\n tick(REPEAT_DELAY_MS);\n };\n const stepper = (key: 'ArrowUp' | 'ArrowDown', label: string, glyph: string, atBound: boolean) => (\n <button\n type=\"button\"\n className={s.stepper}\n aria-label={label}\n tabIndex={-1}\n disabled={atBound}\n // Keeps focus in the input, where a press on the button would take it.\n onPointerDown={(e) => {\n e.preventDefault();\n startRepeat(key);\n }}\n onPointerUp={stopRepeat}\n onPointerLeave={stopRepeat}\n onPointerCancel={stopRepeat}\n // A click with no pointer down before it — assistive tech, or a test.\n onClick={(e) => {\n if (e.detail === 0) latestSpin.current(key);\n }}\n >\n {glyph}\n </button>\n );\n\n return (\n <div\n className={[s.field, width === 'fit' && s.fit, fieldClasses.root, className]\n .filter(Boolean)\n .join(' ')}\n >\n <div className={ghost ? `${s.frame} ${s.ghost}` : s.frame}>\n <input\n ref={input}\n id={id}\n type=\"text\"\n role=\"spinbutton\"\n inputMode=\"decimal\"\n autoComplete=\"off\"\n aria-label={ariaLabel}\n aria-valuenow={known ? value : undefined}\n aria-valuetext={known ? qty(value, display).spoken : undefined}\n aria-valuemin={minValue}\n aria-valuemax={maxValue}\n placeholder={placeholder}\n value={draft ?? text}\n onChange={(e) => {\n const typed = e.target.value;\n setDraft(typed);\n const n = read(typed);\n if (onInput && typed.trim() !== '' && Number.isFinite(n)) onInput(clampToBounds(n, bounds));\n }}\n onFocus={() => {\n canceled.current = false;\n }}\n onBlur={() => {\n if (draft !== null && !canceled.current) {\n const n = read(draft);\n if (Number.isFinite(n)) {\n const next = clampToBounds(n, bounds);\n if (next !== value) onChange(next);\n }\n }\n setDraft(null);\n }}\n onKeyDown={(e) => {\n if (e.key === 'Enter') {\n e.currentTarget.blur();\n } else if (e.key === 'Escape') {\n canceled.current = true;\n e.currentTarget.blur();\n } else if (spin(e.key)) {\n e.preventDefault();\n }\n }}\n />\n {steppers && (\n <div className={s.steppers}>\n {stepper('ArrowUp', 'Increment', '▲', known && maxValue !== undefined && value >= maxValue)}\n {stepper('ArrowDown', 'Decrement', '▼', known && minValue !== undefined && value <= minValue)}\n </div>\n )}\n </div>\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;GCmDaA,IAAcS,EAAW,SACpC,GACA,GACA;CACA,IAAM,EACJ,UACA,iBAAc,WACd,gBACA,iBACA,iBACA,UACA,gBACA,WAAQ,QACR,cACA,GAAGC,MACDC;CACJ,OACE,kBAACV,GAAD;EACE,GAAIS;EACJ,WAAW;GACTR,EAAE;GACFW,MAAU,SAASX,EAAE;GACrBI,EAAa;GACbQ,MAAgB,SAASR,EAAa;GACtCQ,MAAgB,SAASZ,EAAE;GAC3Ba;EACF,CAAC,CACE,OAAO,OAAO,CAAC,CACf,KAAK,GAAG;EAXb,UAAA;GAaGC,MAAU,KAAA,KAAa,kBAACC,GAAD;IAAO,WAAW,GAAGX,EAAa,MAAM,GAAGJ,EAAE;IAAU,UAAAc;GAAa,CAAA;GAC5F,kBAACE,GAAD;IAAO,WAAWC,IAAQ,GAAGjB,EAAE,MAAM,GAAGA,EAAE,UAAUA,EAAE;IAAtD,UAAA,CACE,kBAACC,GAAD;KAAe;KAAkB;IAAc,CAAA,GAC9C,CAACkB,KACA,kBAAC,OAAD;KAAK,WAAWnB,EAAE;KAAlB,UAAA,CACE,kBAACE,GAAD;MAAW,MAAK;MAAY,WAAWF,EAAE;MAAS,cAAW;MAAY,UA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ej.js";
2
- import { t } from "./paintPreview-CuSZiHpR.js";
3
- import { t as n } from "./PaintInput-v8Y7MDbH.js";
4
- import { getPaintKind as r } from "@weasel-js/core";
5
- import { jsx as i, jsxs as a } from "react/jsx-runtime";
6
- import "react";
7
- import { Button as o, Dialog as s, DialogTrigger as c, Popover as l } from "react-aria-components";
8
- var u = {
9
- trigger: "_trigger_1p91w_1",
10
- swatch: "_swatch_1p91w_27",
11
- label: "_label_1p91w_48",
12
- popover: "_popover_1p91w_57",
13
- body: "_body_1p91w_61"
14
- };
15
- //#endregion
16
- //#region src/components/PaintField/PaintField.tsx
17
- function d(e, t) {
18
- return t ? "Mixed" : e === null ? "None" : e === void 0 ? "—" : r(e.fill ?? "solid")?.label ?? e.fill ?? "solid";
19
- }
20
- function f(r) {
21
- let { value: f, mixed: p = !1, unset: m = !1, kinds: h, allowNone: g = !0, onInput: _, onChange: v, className: y, portalContainer: b } = r, x = r["aria-label"], { anchor: S, portalProps: C } = e(b), w = p ? void 0 : t(f);
22
- return /* @__PURE__ */ a(c, { children: [
23
- S,
24
- /* @__PURE__ */ a(o, {
25
- className: [u.trigger, y].filter(Boolean).join(" "),
26
- "aria-label": x,
27
- ...m ? { "data-unset": "" } : {},
28
- ...p ? { "data-mixed": "" } : {},
29
- children: [/* @__PURE__ */ i("span", {
30
- className: u.swatch,
31
- "aria-hidden": "true",
32
- ...w ? { style: { background: w } } : { "data-empty": "" }
33
- }), /* @__PURE__ */ i("span", {
34
- className: u.label,
35
- children: d(f, p)
36
- })]
37
- }),
38
- /* @__PURE__ */ i(l, {
39
- className: u.popover,
40
- "data-weasel-overlay": "",
41
- ...C,
42
- children: /* @__PURE__ */ i(s, {
43
- className: u.body,
44
- "aria-label": x ? `${x} editor` : "Paint editor",
45
- children: /* @__PURE__ */ i(n, {
46
- value: f,
47
- mixed: p,
48
- unset: m,
49
- kinds: h,
50
- allowNone: g,
51
- onInput: _,
52
- onChange: v,
53
- "aria-label": x
54
- })
55
- })
56
- })
57
- ] });
58
- }
59
- //#endregion
60
- export { f as t };
61
-
62
- //# sourceMappingURL=PaintField-DadOELMg.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"PaintField-DadOELMg.js","names":["RACButton","s","RACPopover","RACDialog","useOverlayPortal","PaintInput","PaintField_module_default","kindLabel","mixed","paint","getPaintKind","PaintField","props","ariaLabel","portalContainer","preview","paintPreviewCss","value","DialogTrigger","anchor","Button","className","unset","Popover","portalProps","Dialog"],"sources":["../../src/components/PaintField/PaintField.module.css","../../src/components/PaintField/PaintField.tsx"],"sourcesContent":[".trigger {\n display: inline-flex;\n align-items: center;\n gap: var(--wzl-space-3);\n inline-size: 100%;\n min-inline-size: 0;\n padding: 1px var(--wzl-space-3) 1px 1px;\n border: 1px solid var(--wzl-border);\n border-radius: var(--wzl-radius-sm);\n background: var(--wzl-surface);\n color: var(--wzl-fg);\n font-family: var(--wzl-font-ui);\n font-size: var(--wzl-font-size-sm);\n cursor: pointer;\n}\n\n.trigger[data-unset] {\n opacity: 0.6;\n}\n\n.trigger[data-focus-visible] {\n outline: none;\n border-color: var(--wzl-focus-ring);\n box-shadow: 0 0 0 1px var(--wzl-focus-ring);\n}\n\n.swatch {\n /* A paint preview at a fixed 26:18 aspect, not a control box. */\n inline-size: 26px;\n block-size: 18px; /* not-a-control */\n flex: 0 0 auto;\n border-radius: calc(var(--wzl-radius-sm) - var(--wzl-border-w));\n /* Checker under the paint, so a translucent one reads as translucent. */\n background-color: var(--wzl-surface-raised);\n box-shadow: inset 0 0 0 1px var(--wzl-border);\n}\n\n/* No paint to show: the checker stands in rather than an invented color. */\n.swatch[data-empty],\n.trigger[data-mixed] .swatch {\n background: repeating-conic-gradient(\n var(--wzl-checker-a) 0% 25%,\n var(--wzl-checker-b) 0% 50%\n )\n 50% / var(--wzl-checker-size) var(--wzl-checker-size);\n}\n\n.label {\n flex: 1 1 auto;\n min-inline-size: 0;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n text-align: start;\n}\n\n.popover {\n outline: none;\n}\n\n.body {\n inline-size: 240px;\n padding: var(--wzl-space-4);\n border: 1px solid var(--wzl-border);\n border-radius: var(--wzl-radius-md);\n background: var(--wzl-surface-raised);\n box-shadow: 0 8px 24px rgb(0 0 0 / 0.3);\n outline: none;\n font-family: var(--wzl-font-ui);\n font-size: var(--wzl-font-size);\n}\n","import { type ReactElement } from 'react';\nimport {\n Button as RACButton,\n Dialog as RACDialog,\n DialogTrigger,\n Popover as RACPopover,\n} from 'react-aria-components';\nimport { getPaintKind, type FillStyle, type PaintKind } from '@weasel-js/core';\nimport { useOverlayPortal, type OverlayPortalProps } from '../../overlays/portalHost';\nimport { paintPreviewCss } from '../../paintPreview';\nimport { PaintInput } from '../PaintInput';\nimport s from './PaintField.module.css';\n\n/** Props for {@link PaintField}. `onInput` fires throughout a gesture inside\n * the popover and `onChange` once at its end. */\nexport interface PaintFieldProps extends OverlayPortalProps {\n /** The paint being edited. `null` is an explicit \"no paint\"; `undefined` is\n * no value to show. */\n value: FillStyle | null | undefined;\n /** Indeterminate presentation: the trigger says \"Mixed\" and the editor\n * lights no kind. */\n mixed?: boolean;\n /** Dim the trigger — a value is in effect but was never chosen. */\n unset?: boolean;\n /** Restrict the editor's kind bar. Default: every registered kind. */\n kinds?: readonly PaintKind[];\n /** Offer \"None\" in the editor. Default `true`. */\n allowNone?: boolean;\n onInput?: (next: FillStyle | null) => void;\n onChange: (next: FillStyle | null) => void;\n /** Names the paint this field edits — `Fill`, `Color`. */\n 'aria-label'?: string;\n className?: string;\n}\n\n/** What the trigger says it is holding. */\nfunction kindLabel(paint: FillStyle | null | undefined, mixed: boolean): string {\n if (mixed) return 'Mixed';\n if (paint === null) return 'None';\n if (paint === undefined) return '—';\n return getPaintKind(paint.fill ?? 'solid')?.label ?? (paint.fill ?? 'solid');\n}\n\n/**\n * A whole `FillStyle` in one control slot: a swatch that says which kind it\n * holds, and a popover holding {@link PaintInput}.\n *\n * `PaintInput` itself is a kind bar over a body — six segments and a stop\n * editor — which a property row's control column cannot hold. This is the\n * shape for a narrow slot, and the difference that matters is fidelity: a\n * `ColorField` in that slot reads a gradient's first stop and writes a solid\n * back, so touching the control loses the paint.\n */\nexport function PaintField(props: PaintFieldProps): ReactElement {\n const {\n value, mixed = false, unset = false, kinds, allowNone = true,\n onInput, onChange, className, portalContainer,\n } = props;\n const ariaLabel = props['aria-label'];\n const { anchor, portalProps } = useOverlayPortal(portalContainer);\n const preview = mixed ? undefined : paintPreviewCss(value);\n\n return (\n <DialogTrigger>\n {anchor}\n <RACButton\n className={[s.trigger, className].filter(Boolean).join(' ')}\n aria-label={ariaLabel}\n {...(unset ? { 'data-unset': '' } : {})}\n {...(mixed ? { 'data-mixed': '' } : {})}\n >\n <span\n className={s.swatch}\n aria-hidden=\"true\"\n {...(preview ? { style: { background: preview } } : { 'data-empty': '' })}\n />\n <span className={s.label}>{kindLabel(value, mixed)}</span>\n </RACButton>\n {/* `data-weasel-overlay`: see Select — the popover renders in a portal,\n outside the subtree the trigger sits in. */}\n <RACPopover className={s.popover} data-weasel-overlay=\"\" {...portalProps}>\n <RACDialog className={s.body} aria-label={ariaLabel ? `${ariaLabel} editor` : 'Paint editor'}>\n <PaintInput\n value={value}\n mixed={mixed}\n unset={unset}\n kinds={kinds}\n allowNone={allowNone}\n onInput={onInput}\n onChange={onChange}\n aria-label={ariaLabel}\n />\n </RACDialog>\n </RACPopover>\n </DialogTrigger>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;ACoCA,SAASO,EAAU,GAAqC,GAAwB;CAI9E,OAHIC,IAAc,UACdC,MAAU,OAAa,SACvBA,MAAU,KAAA,IAAkB,MACzBC,EAAaD,EAAM,QAAQ,OAAO,CAAC,EAAE,SAAUA,EAAM,QAAQ;AACtE;AAYA,SAAgBE,EAAW,GAAsC;CAC/D,IAAM,EACJ,UAAO,WAAQ,IAAO,WAAQ,IAAO,UAAO,eAAY,IACxD,YAAS,aAAU,cAAW,uBAC5BC,GACEC,IAAYD,EAAM,eAClB,EAAE,WAAQ,mBAAgBR,EAAiBU,CAAe,GAC1DC,IAAUP,IAAQ,KAAA,IAAYQ,EAAgBC,CAAK;CAEzD,OACE,kBAACC,GAAD,EAAA,UAAA;EACGC;EACD,kBAACnB,GAAD;GACE,WAAW,CAACC,EAAE,SAASoB,CAAS,CAAC,CAAC,OAAO,OAAO,CAAC,CAAC,KAAK,GAAG;GAC1D,cAAYR;GACZ,GAAKS,IAAQ,EAAE,cAAc,GAAG,IAAI,CAAC;GACrC,GAAKd,IAAQ,EAAE,cAAc,GAAG,IAAI,CAAC;GAJvC,UAAA,CAME,kBAAC,QAAD;IACE,WAAWP,EAAE;IACb,eAAY;IACZ,GAAKc,IAAU,EAAE,OAAO,EAAE,YAAYA,EAAQ,EAAE,IAAI,EAAE,cAAc,GAAG;GACxE,CAAA,GACD,kBAAC,QAAD;IAAM,WAAWd,EAAE;IAAQ,UAAAM,EAAUU,GAAOT,CAAK;GAAQ,CAAA,CAChD;;EAGX,kBAACN,GAAD;GAAY,WAAWD,EAAE;GAAS,uBAAoB;GAAG,GAAIuB;GAC3D,UAAA,kBAACrB,GAAD;IAAW,WAAWF,EAAE;IAAM,cAAYY,IAAY,GAAGA,EAAU,WAAW;IAC5E,UAAA,kBAACR,GAAD;KACS;KACA;KACA;KACA;KACI;KACF;KACC;KACV,cAAYQ;IACb,CAAA;GACQ,CAAA;EACD,CAAA;CACC,EAAA,CAAA;AAEnB"}
@@ -1,121 +0,0 @@
1
- import { a as e, t } from "./Icon-CcVjdq2C.js";
2
- import { t as n } from "./ColorField-Yz_BkcCT.js";
3
- import { t as r } from "./ToggleBar-BTYkBXU9.js";
4
- import { r as i } from "./GradientEditor-b7v4Ph3i.js";
5
- import { t as a } from "./PatternPicker-R_EQtw2Q.js";
6
- import { getAlpha01 as o, getPaintKind as s, listPaintKinds as c, paintAlpha as l, solid as u, switchGradientKind as d, toHex8 as f, withAlpha01 as p } from "@weasel-js/core";
7
- import { jsx as m, jsxs as h } from "react/jsx-runtime";
8
- import { useCallback as g, useRef as _ } from "react";
9
- var v = {
10
- root: "_root_1nsz3_2",
11
- unset: "_unset_1nsz3_10",
12
- noEditor: "_noEditor_1nsz3_15"
13
- }, y = "#000000ff", b = "none";
14
- function x(e) {
15
- let t = f(e.color);
16
- return p(t.slice(0, 7), o(t) * l(e));
17
- }
18
- function S(e) {
19
- let t = u(e);
20
- return t.opacity === void 0 ? t : {
21
- ...t,
22
- opacity: Math.round(t.opacity * 100) / 100
23
- };
24
- }
25
- function C(e) {
26
- return e?.fill === "pattern";
27
- }
28
- function w(e) {
29
- return e === null ? b : e === void 0 ? null : e.fill ?? "solid";
30
- }
31
- function T(o) {
32
- let { value: l, mixed: u = !1, unset: f = !1, kinds: p, allowNone: T = !0, onInput: E, onChange: D, className: O } = o, k = o["aria-label"], A = _(/* @__PURE__ */ new Map()), j = u ? null : w(l);
33
- l != null && j !== null && A.current.set(j, l);
34
- let M = c().filter((e) => p === void 0 || p.includes(e.id)), N = (n, r, i) => i && i in e ? {
35
- value: n,
36
- label: /* @__PURE__ */ m(t, {
37
- name: i,
38
- size: 14
39
- }),
40
- ariaLabel: r
41
- } : {
42
- value: n,
43
- label: r
44
- }, P = [...T ? [N(b, "None", "paintNone")] : [], ...M.map((e) => N(e.id, e.label, e.icon))], F = g(() => l == null ? y : s(w(l) ?? "solid")?.colorOf(l) ?? y, [l]), I = (e) => {
45
- if (e === j) return;
46
- if (e === b) {
47
- D(null);
48
- return;
49
- }
50
- let t = A.current.get(e);
51
- if (t !== void 0) {
52
- D(t);
53
- return;
54
- }
55
- let n = l == null ? void 0 : d(l, e);
56
- if (n !== void 0) {
57
- D(n);
58
- return;
59
- }
60
- let r = s(e);
61
- r && D(r.seed(F()));
62
- };
63
- return /* @__PURE__ */ h("div", {
64
- className: [
65
- v.root,
66
- f && v.unset,
67
- O
68
- ].filter(Boolean).join(" "),
69
- title: f ? "Not set" : void 0,
70
- children: [/* @__PURE__ */ m(r, {
71
- items: P,
72
- value: j,
73
- size: "sm",
74
- ariaLabel: "Paint kind",
75
- onChange: (e) => e && I(e)
76
- }), L()]
77
- });
78
- function L() {
79
- if (u || l === void 0) return /* @__PURE__ */ m(n, {
80
- mixed: !0,
81
- "aria-label": k,
82
- onChange: (e) => D(S(e))
83
- });
84
- if (l === null) return null;
85
- let e = s(w(l) ?? "solid");
86
- if (e?.Editor) {
87
- let t = e.Editor;
88
- return /* @__PURE__ */ m(t, {
89
- value: l,
90
- onInput: E,
91
- onChange: D
92
- });
93
- }
94
- if (e?.stopsOf) return /* @__PURE__ */ m(i, {
95
- value: l,
96
- kindSwitch: !1,
97
- onInput: E,
98
- onChange: D
99
- });
100
- if (C(l)) return /* @__PURE__ */ m(a, {
101
- value: l,
102
- color: F(),
103
- onChange: D
104
- });
105
- let t = w(l);
106
- return t === "solid" ? /* @__PURE__ */ m(n, {
107
- value: x(l),
108
- alpha: !0,
109
- "aria-label": k,
110
- onInput: (e) => E?.(S(e)),
111
- onChange: (e) => D(S(e))
112
- }) : /* @__PURE__ */ h("div", {
113
- className: v.noEditor,
114
- children: [e?.label ?? t, ": no editor"]
115
- });
116
- }
117
- }
118
- //#endregion
119
- export { T as t };
120
-
121
- //# sourceMappingURL=PaintInput-v8Y7MDbH.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"PaintInput-v8Y7MDbH.js","names":["s","ICON_PATHS","ColorField","ToggleBar","GradientEditor","PatternPicker","PaintInput_module_default","FALLBACK_COLOR","NONE","solidHex8","hex8","toHex8","paint","withAlpha01","getAlpha01","paintAlpha","solidFromField","solid","color","isPattern","kindOf","PaintInput","props","ariaLabel","remembered","useRef","active","mixed","value","entries","listPaintKinds","kinds","entry","segment","icon","id","Icon","label","items","allowNone","currentColor","useCallback","getPaintKind","switchKind","kind","seen","converted","switchGradientKind","onChange","unset","className","renderBody","Editor","onInput"],"sources":["../../src/components/PaintInput/PaintInput.module.css","../../src/components/PaintInput/PaintInput.tsx"],"sourcesContent":["/* Kind switch stacked over whichever paint body it selects. */\n.root {\n display: flex;\n flex-direction: column;\n gap: var(--wzl-space-3);\n min-inline-size: 0;\n}\n\n/* A value is in effect but nobody chose it. Never louder than mixed. */\n.unset {\n opacity: 0.55;\n}\n\n/* A kind with no editor: named, not editable. */\n.noEditor {\n font-size: var(--wzl-font-size-sm);\n color: var(--wzl-fg-muted);\n}\n","import { useCallback, useRef, type ReactElement } from 'react';\nimport {\n getAlpha01,\n getPaintKind,\n listPaintKinds,\n paintAlpha,\n solid,\n switchGradientKind,\n toHex8,\n withAlpha01,\n type FillStyle,\n type PaintKind,\n} from '@weasel-js/core';\nimport { Icon } from '../../icons/Icon';\nimport { ICON_PATHS, type IconName } from '../../icons/paths';\nimport { ColorField } from '../ColorField';\nimport { GradientEditor } from '../GradientEditor';\nimport { PatternPicker, type PatternFill } from '../PatternPicker';\nimport { ToggleBar, type ToggleBarItem } from '../ToggleBar';\nimport s from './PaintInput.module.css';\n\n/** What a kind with no color of its own seeds from. */\nconst FALLBACK_COLOR = '#000000ff';\n\n/** The bar's answer for \"no paint at all\". Not a registered kind — absence\n * has no seed, no color and nothing to render — so it is this control's own\n * segment rather than a registry entry. */\nconst NONE = 'none';\n\n/** A solid paint as the one `#rrggbbaa` a color field edits. Its alpha lives\n * in `opacity`; a hex alpha left in `color` multiplies with it when painted,\n * so both fold in. */\nfunction solidHex8(paint: FillStyle): string {\n const hex8 = toHex8((paint as { color: string }).color);\n return withAlpha01(hex8.slice(0, 7), getAlpha01(hex8) * paintAlpha(paint));\n}\n\n/** `solid(color)` at the slider's own 1% resolution: the alpha arrives\n * through a hex channel, which would turn 70% into 0.70196. */\nfunction solidFromField(color: string): FillStyle {\n const paint = solid(color);\n return paint.opacity === undefined\n ? paint\n : { ...paint, opacity: Math.round(paint.opacity * 100) / 100 };\n}\n\nfunction isPattern(paint: FillStyle | undefined): paint is PatternFill {\n return paint?.fill === 'pattern';\n}\n\n/** A paint's own discriminant. The solid member leaves `fill` off, and an\n * explicit `null` is the absence of paint rather than an unknown one. */\nfunction kindOf(paint: FillStyle | null | undefined): PaintKind | null {\n if (paint === null) return NONE;\n if (paint === undefined) return null;\n return paint.fill ?? 'solid';\n}\n\n/** Props for {@link PaintInput}. `onInput` fires throughout a gesture and\n * `onChange` once at its end. */\nexport interface PaintInputProps {\n /** The paint being edited. `null` is an explicit \"no paint\"; `undefined`\n * is no value to show. */\n value: FillStyle | null | undefined;\n /** Indeterminate presentation: no kind lit, and the body withheld because\n * there is no single paint to show. */\n mixed?: boolean;\n /** Dim the control — a value is in effect but was never chosen. */\n unset?: boolean;\n /** Restrict the kind bar. Default: every registered kind. */\n kinds?: readonly PaintKind[];\n /** Offer \"None\". Default `true` — the bar answers \"what kind of paint is\n * this?\" and no-paint is one of the answers. Turn it off where the slot\n * cannot express absence. */\n allowNone?: boolean;\n onInput?: (next: FillStyle | null) => void;\n onChange: (next: FillStyle | null) => void;\n /** Names the paint this control edits — `Fill`, `Color`. Carried by the\n * solid body's swatch, which is the part with a value to announce. */\n 'aria-label'?: string;\n className?: string;\n}\n\n/**\n * Editor for a whole `FillStyle` — a kind bar over whichever body that kind\n * wants.\n *\n * The bar is driven by the paint-kind registry rather than a fixed list, so a\n * consumer's registered kind appears in it and renders that entry's `Editor`.\n * The five built-in kinds keep their branch here: their editors live in this\n * package and `@weasel-js/core`, which owns the registry, cannot import it.\n *\n * Geometry is deliberately absent — on a canvas it belongs on the artwork,\n * via `<SceneGradientHandles>`.\n */\nexport function PaintInput(props: PaintInputProps): ReactElement {\n const {\n value, mixed = false, unset = false, kinds, allowNone = true,\n onInput, onChange, className,\n } = props;\n const ariaLabel = props['aria-label'];\n\n // Per-kind memory, so linear → solid → linear comes back with its stops.\n // A ref, not state: it must not survive the control being pointed at a\n // different selection, and nothing renders off it directly.\n const remembered = useRef(new Map<PaintKind, FillStyle>());\n\n const active = mixed ? null : kindOf(value);\n if (value != null && active !== null) remembered.current.set(active, value);\n\n const entries = listPaintKinds().filter(\n (entry) => kinds === undefined || kinds.includes(entry.id),\n );\n const segment = (id: string, label: string, icon: string | undefined): ToggleBarItem<PaintKind> =>\n icon && icon in ICON_PATHS\n // Icon-only: six labelled segments do not fit a property row, and the\n // full label stays the accessible name.\n // 14 to match the panel's other glyph segments. A `sm` bar is 17px tall\n // over 1px of padding, so 15 fills the segment box edge to edge.\n ? { value: id, label: <Icon name={icon as IconName} size={14} />, ariaLabel: label }\n : { value: id, label };\n\n const items: readonly ToggleBarItem<PaintKind>[] = [\n ...(allowNone ? [segment(NONE, 'None', 'paintNone')] : []),\n ...entries.map((entry) => segment(entry.id, entry.label, entry.icon)),\n ];\n\n /** The color a switch seeds from: whatever the current paint shows. */\n const currentColor = useCallback((): string => {\n if (value == null) return FALLBACK_COLOR;\n return getPaintKind(kindOf(value) ?? 'solid')?.colorOf(value) ?? FALLBACK_COLOR;\n }, [value]);\n\n const switchKind = (kind: PaintKind): void => {\n if (kind === active) return;\n if (kind === NONE) {\n onChange(null);\n return;\n }\n const seen = remembered.current.get(kind);\n if (seen !== undefined) {\n onChange(seen);\n return;\n }\n const converted = value != null ? switchGradientKind(value, kind) : undefined;\n if (converted !== undefined) {\n onChange(converted);\n return;\n }\n const entry = getPaintKind(kind);\n if (entry) onChange(entry.seed(currentColor()));\n };\n\n return (\n <div\n className={[s.root, unset && s.unset, className].filter(Boolean).join(' ')}\n title={unset ? 'Not set' : undefined}\n >\n <ToggleBar<PaintKind>\n items={items}\n value={active}\n size=\"sm\"\n ariaLabel=\"Paint kind\"\n onChange={(kind) => kind && switchKind(kind)}\n />\n {renderBody()}\n </div>\n );\n\n function renderBody(): ReactElement | null {\n if (mixed || value === undefined) {\n return (\n <ColorField\n mixed\n aria-label={ariaLabel}\n onChange={(color) => onChange(solidFromField(color))}\n />\n );\n }\n // Absence has nothing to edit. The lit segment is the whole statement.\n if (value === null) return null;\n // A registered `Editor` wins even for a built-in id: re-registering one is\n // how a consumer replaces a kit control, and the built-in branches below\n // are the fallback for the ids that ship without an entry editor.\n const entry = getPaintKind(kindOf(value) ?? 'solid');\n if (entry?.Editor) {\n const Editor = entry.Editor;\n return <Editor value={value} onInput={onInput} onChange={onChange} />;\n }\n if (entry?.stopsOf) {\n return (\n <GradientEditor\n value={value}\n kindSwitch={false}\n onInput={onInput}\n onChange={onChange}\n />\n );\n }\n if (isPattern(value)) {\n return <PatternPicker value={value} color={currentColor()} onChange={onChange} />;\n }\n const kind = kindOf(value);\n if (kind !== 'solid') {\n // Editing a paint this control cannot represent would overwrite it, so\n // a kind with no editor is shown and left alone.\n return <div className={s.noEditor}>{entry?.label ?? kind}: no editor</div>;\n }\n return (\n <ColorField\n value={solidHex8(value)}\n alpha\n aria-label={ariaLabel}\n onInput={(color) => onInput?.(solidFromField(color))}\n onChange={(color) => onChange(solidFromField(color))}\n />\n );\n }\n}\n"],"mappings":";;;;;;;;;;;;GCsBMO,IAAiB,aAKjBC,IAAO;AAKb,SAASC,EAAU,GAA0B;CAC3C,IAAMC,IAAOC,EAAQC,EAA4B,KAAK;CACtD,OAAOC,EAAYH,EAAK,MAAM,GAAG,CAAC,GAAGI,EAAWJ,CAAI,IAAIK,EAAWH,CAAK,CAAC;AAC3E;AAIA,SAASI,EAAe,GAA0B;CAChD,IAAMJ,IAAQK,EAAMC,CAAK;CACzB,OAAON,EAAM,YAAY,KAAA,IACrBA,IACA;EAAE,GAAGA;EAAO,SAAS,KAAK,MAAMA,EAAM,UAAU,GAAG,IAAI;CAAI;AACjE;AAEA,SAASO,EAAU,GAAoD;CACrE,OAAOP,GAAO,SAAS;AACzB;AAIA,SAASQ,EAAO,GAAuD;CAGrE,OAFIR,MAAU,OAAaJ,IACvBI,MAAU,KAAA,IAAkB,OACzBA,EAAM,QAAQ;AACvB;AAuCA,SAAgBS,EAAW,GAAsC;CAC/D,IAAM,EACJ,UAAO,WAAQ,IAAO,WAAQ,IAAO,UAAO,eAAY,IACxD,YAAS,aAAU,iBACjBC,GACEC,IAAYD,EAAM,eAKlBE,IAAaC,kBAAO,IAAI,IAA0B,CAAC,GAEnDC,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;GAAOkD;EAAS,CAAC,CAAC,OAAO,OAAO,CAAC,CAAC,KAAK,GAAG;EACzE,OAAOD,IAAQ,YAAY,KAAA;EAF7B,UAAA,CAIE,kBAAC9C,GAAD;GACS;GACP,OAAOuB;GACP,MAAK;GACL,WAAU;GACV,WAAW,MAASkB,KAAQD,EAAWC,CAAI;EAC5C,CAAA,GACAO,EAAW,CACT;;CAGP,SAASA,IAAkC;EACzC,IAAIxB,KAASC,MAAU,KAAA,GACrB,OACE,kBAAC1B,GAAD;GACE,OAAA;GACA,cAAYqB;GACZ,WAAW,MAAUyB,EAAShC,EAAeE,CAAK,CAAC;EACpD,CAAA;EAIL,IAAIU,MAAU,MAAM,OAAO;EAI3B,IAAMI,IAAQU,EAAatB,EAAOQ,CAAK,KAAK,OAAO;EACnD,IAAII,GAAO,QAAQ;GACjB,IAAMoB,IAASpB,EAAM;GACrB,OAAO,kBAACoB,GAAD;IAAe;IAAgB;IAAmB;GAAW,CAAA;EACtE;EACA,IAAIpB,GAAO,SACT,OACE,kBAAC5B,GAAD;GACS;GACP,YAAY;GACH;GACC;EACX,CAAA;EAGL,IAAIe,EAAUS,CAAK,GACjB,OAAO,kBAACvB,GAAD;GAAsB;GAAO,OAAOmC,EAAa;GAAa;EAAW,CAAA;EAElF,IAAMI,IAAOxB,EAAOQ,CAAK;EAMzB,OALIgB,MAAS,UAMX,kBAAC1C,GAAD;GACE,OAAOO,EAAUmB,CAAK;GACtB,OAAA;GACA,cAAYL;GACZ,UAAU,MAAU8B,IAAUrC,EAAeE,CAAK,CAAC;GACnD,WAAW,MAAU8B,EAAShC,EAAeE,CAAK,CAAC;EACpD,CAAA,IATM,kBAAC,OAAD;GAAK,WAAWlB,EAAE;GAAlB,UAAA,CAA6BgC,GAAO,SAASY,GAAK,aAAgB;;CAW7E;AACF"}
@@ -1,93 +0,0 @@
1
- import { t as e } from "./ToggleBar-BTYkBXU9.js";
2
- import { jsx as t, jsxs as n } from "react/jsx-runtime";
3
- import { tilePreviewCssUrl as r } from "@weasel-js/svg";
4
- var i = {
5
- root: "_root_dgwqj_2",
6
- grid: "_grid_dgwqj_9",
7
- swatch: "_swatch_dgwqj_17",
8
- swatchActive: "_swatchActive_dgwqj_36"
9
- }, a = [
10
- "hatch",
11
- "crosshatch",
12
- "dots",
13
- "chunks"
14
- ], o = [
15
- {
16
- value: 4,
17
- label: "S"
18
- },
19
- {
20
- value: 8,
21
- label: "M"
22
- },
23
- {
24
- value: 16,
25
- label: "L"
26
- },
27
- {
28
- value: 32,
29
- label: "XL"
30
- }
31
- ], s = 8, c = 16;
32
- function l(e) {
33
- return "tile" in e.pattern ? e.pattern : null;
34
- }
35
- function u(e, t, n = s) {
36
- let r = {
37
- tile: e,
38
- color: t,
39
- size: n
40
- };
41
- return e === "chunks" && (r.bg = "#00000000"), {
42
- fill: "pattern",
43
- pattern: r,
44
- units: "bounds"
45
- };
46
- }
47
- function d(d) {
48
- let { value: f, color: p, onChange: m, className: h } = d, g = l(f), _ = g?.size ?? s, v = (e) => {
49
- m(u(e, p, _));
50
- }, y = (e) => {
51
- g && m({
52
- ...f,
53
- pattern: {
54
- ...g,
55
- size: e
56
- }
57
- });
58
- };
59
- return /* @__PURE__ */ n("div", {
60
- className: [i.root, h].filter(Boolean).join(" "),
61
- children: [/* @__PURE__ */ t("div", {
62
- className: i.grid,
63
- children: a.map((e) => {
64
- let n = {
65
- tile: e,
66
- color: p,
67
- size: c
68
- };
69
- e === "chunks" && (n.bg = "#00000000");
70
- let a = g?.tile === e;
71
- return /* @__PURE__ */ t("button", {
72
- type: "button",
73
- className: [i.swatch, a && i.swatchActive].filter(Boolean).join(" "),
74
- style: { "--tile-preview": r(n) },
75
- title: e,
76
- "aria-label": e,
77
- "aria-pressed": a,
78
- onClick: () => v(e)
79
- }, e);
80
- })
81
- }), /* @__PURE__ */ t(e, {
82
- items: o,
83
- value: _,
84
- size: "sm",
85
- ariaLabel: "Tile size",
86
- onChange: (e) => e != null && y(e)
87
- })]
88
- });
89
- }
90
- //#endregion
91
- export { u as n, d as t };
92
-
93
- //# sourceMappingURL=PatternPicker-R_EQtw2Q.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"PatternPicker-R_EQtw2Q.js","names":["s","ToggleBar","PatternPicker_module_default","TILES","TILE_SIZES","DEFAULT_TILE_SIZE","PREVIEW_SIZE","specOf","fill","seedPattern","spec","from","tile","PatternPicker","props","value","size","pick","color","resize","onChange","nextSize","className","preview","selected","tilePreviewCssUrl","v"],"sources":["../../src/components/PatternPicker/PatternPicker.module.css","../../src/components/PatternPicker/PatternPicker.tsx"],"sourcesContent":["/* Tile grid over the size switch. */\n.root {\n display: flex;\n flex-direction: column;\n gap: var(--wzl-space-3);\n min-inline-size: 0;\n}\n\n.grid {\n display: grid;\n grid-template-columns: repeat(auto-fill, minmax(var(--wzl-swatch-size, 28px), 1fr));\n gap: 0;\n}\n\n/* The swatch's whole face is its own tile, so it must not carry a flat\n background — and the tile repeats at its own scale, not the swatch's. */\n.swatch {\n width: 100%;\n aspect-ratio: 1 / 1;\n min-width: 0;\n padding: 0;\n border: 0.5px solid var(--wzl-border);\n border-radius: 0;\n cursor: pointer;\n background-color: var(--wzl-surface-sunken);\n background-image: var(--tile-preview);\n background-repeat: repeat;\n background-size: 16px 16px;\n background-clip: padding-box;\n}\n\n.swatch:hover {\n border-color: var(--wzl-fg-muted);\n}\n\n.swatchActive {\n border-color: var(--wzl-accent);\n box-shadow: 0 0 0 1px var(--wzl-accent);\n}\n","import type { ReactElement } from 'react';\nimport type { CSSProperties } from 'react';\nimport type { FillStyle, TilePatternSpec } from '@weasel-js/core';\nimport { tilePreviewCssUrl } from '@weasel-js/svg';\nimport { ToggleBar } from '../ToggleBar';\nimport s from './PatternPicker.module.css';\n\n/** The `pattern` member of the paint union. */\nexport type PatternFill = Extract<FillStyle, { fill: 'pattern' }>;\n\nconst TILES: readonly TilePatternSpec['tile'][] = ['hatch', 'crosshatch', 'dots', 'chunks'];\n\n/** Tile sizes the picker offers, coarse enough that each reads as a\n * distinct texture rather than a nudge. */\nconst TILE_SIZES: readonly { value: number; label: string }[] = [\n { value: 4, label: 'S' },\n { value: 8, label: 'M' },\n { value: 16, label: 'L' },\n { value: 32, label: 'XL' },\n];\n\nconst DEFAULT_TILE_SIZE = 8;\n\n/** Every swatch previews at one size so the grid compares tiles, not scales. */\nconst PREVIEW_SIZE = 16;\n\n/** The spec a pattern paint carries, if it carries one. A consumer-built\n * `TextureHandle` has no spec, so the picker shows no tile selected and\n * replaces it wholesale on the next click. */\nfunction specOf(fill: PatternFill): TilePatternSpec | null {\n return 'tile' in fill.pattern ? fill.pattern : null;\n}\n\n/**\n * A pattern seeded from a color. `units: 'bounds'` anchors the tile to the\n * node's box, so the texture travels with the shape.\n */\nexport function seedPattern(\n tile: TilePatternSpec['tile'],\n from: string,\n size: number = DEFAULT_TILE_SIZE,\n): PatternFill {\n const spec: TilePatternSpec = { tile, color: from, size };\n // `chunks` is a scatter over a ground rather than a line texture; without a\n // background it reads as loose specks on whatever sits beneath.\n if (tile === 'chunks') spec.bg = '#00000000';\n return { fill: 'pattern', pattern: spec, units: 'bounds' };\n}\n\n/** Props for {@link PatternPicker}. */\nexport interface PatternPickerProps {\n /** The pattern paint being edited. */\n value: PatternFill;\n /** The color new tiles are seeded with — the paint's own, normally. */\n color: string;\n /** Committed value: one call per click. A tile pick and a size change are\n * each a complete gesture, so there is no `onInput`. */\n onChange: (next: PatternFill) => void;\n className?: string;\n}\n\n/**\n * Grid of tile swatches over a size switch, each swatch previewing the real\n * tile at the current color.\n *\n * The preview shares its shape mapper with what the renderer paints, so a\n * swatch cannot drift from the texture it selects.\n */\nexport function PatternPicker(props: PatternPickerProps): ReactElement {\n const { value, color, onChange, className } = props;\n const spec = specOf(value);\n const size = spec?.size ?? DEFAULT_TILE_SIZE;\n\n const pick = (tile: TilePatternSpec['tile']): void => {\n onChange(seedPattern(tile, color, size));\n };\n\n const resize = (nextSize: number): void => {\n if (!spec) return;\n onChange({ ...value, pattern: { ...spec, size: nextSize } });\n };\n\n return (\n <div className={[s.root, className].filter(Boolean).join(' ')}>\n <div className={s.grid}>\n {TILES.map((tile) => {\n const preview: TilePatternSpec = { tile, color, size: PREVIEW_SIZE };\n if (tile === 'chunks') preview.bg = '#00000000';\n const selected = spec?.tile === tile;\n return (\n <button\n key={tile}\n type=\"button\"\n className={[s.swatch, selected && s.swatchActive].filter(Boolean).join(' ')}\n style={{ ['--tile-preview' as string]: tilePreviewCssUrl(preview) } as CSSProperties}\n title={tile}\n aria-label={tile}\n aria-pressed={selected}\n onClick={() => pick(tile)}\n />\n );\n })}\n </div>\n <ToggleBar<number>\n items={TILE_SIZES}\n value={size}\n size=\"sm\"\n ariaLabel=\"Tile size\"\n onChange={(v) => v != null && resize(v)}\n />\n </div>\n );\n}\n"],"mappings":";;;;;;;;GCUMG,IAA4C;CAAC;CAAS;CAAc;CAAQ;AAAQ,GAIpFC,IAA0D;CAC9D;EAAE,OAAO;EAAG,OAAO;CAAI;CACvB;EAAE,OAAO;EAAG,OAAO;CAAI;CACvB;EAAE,OAAO;EAAI,OAAO;CAAI;CACxB;EAAE,OAAO;EAAI,OAAO;CAAK;AAC3B,GAEMC,IAAoB,GAGpBC,IAAe;AAKrB,SAASC,EAAO,GAA2C;CACzD,OAAO,UAAUC,EAAK,UAAUA,EAAK,UAAU;AACjD;AAMA,SAAgBC,EACd,GACA,GACA,IAAeJ,GACF;CACb,IAAMK,IAAwB;EAAE;EAAM,OAAOC;EAAM;CAAK;CAIxD,OADIC,MAAS,aAAU,EAAK,KAAK,cAC1B;EAAE,MAAM;EAAW,SAASF;EAAM,OAAO;CAAS;AAC3D;AAqBA,SAAgBG,EAAc,GAAyC;CACrE,IAAM,EAAE,UAAO,UAAO,aAAU,iBAAcC,GACxCJ,IAAOH,EAAOQ,CAAK,GACnBC,IAAON,GAAM,QAAQL,GAErBY,KAAQ,MAAwC;EACpD,EAASR,EAAYG,GAAMM,GAAOF,CAAI,CAAC;CACzC,GAEMG,KAAU,M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