@weasel-js/ui 1.4.4 → 1.5.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.
- package/dist/chunks/{ActionBar-DxGp3WuZ.js → ActionBar-GZdcfdQL.js} +1 -2
- package/dist/chunks/{ActionBar-DxGp3WuZ.js.map → ActionBar-GZdcfdQL.js.map} +1 -1
- package/dist/chunks/{ActionsBar-D1VFreoj.js → ActionsBar-Fhx_40iP.js} +2 -2
- package/dist/chunks/{ActionsBar-D1VFreoj.js.map → ActionsBar-Fhx_40iP.js.map} +1 -1
- package/dist/chunks/{BandEditor-CUlbOlJi.js → BandEditor-D8I5Uun-.js} +93 -98
- package/dist/chunks/BandEditor-D8I5Uun-.js.map +1 -0
- package/dist/chunks/{Callout-Dvt6lqVn.js → Callout-cx5_CWcW.js} +1 -1
- package/dist/chunks/{Callout-Dvt6lqVn.js.map → Callout-cx5_CWcW.js.map} +1 -1
- package/dist/chunks/{Checkbox-D-pVpobU.js → Checkbox-BZZsPaVF.js} +1 -1
- package/dist/chunks/{Checkbox-D-pVpobU.js.map → Checkbox-BZZsPaVF.js.map} +1 -1
- package/dist/chunks/{ColorField-C20aRvCg.js → ColorField-YVf8irfr.js} +2 -2
- package/dist/chunks/{ColorField-C20aRvCg.js.map → ColorField-YVf8irfr.js.map} +1 -1
- package/dist/chunks/ComboBox-D57tNYDD.js +138 -0
- package/dist/chunks/ComboBox-D57tNYDD.js.map +1 -0
- package/dist/chunks/CurveEditor-BXiMoN9d.js +533 -0
- package/dist/chunks/CurveEditor-BXiMoN9d.js.map +1 -0
- package/dist/chunks/DetentSlider-BWNSv07Z.js +72 -0
- package/dist/chunks/DetentSlider-BWNSv07Z.js.map +1 -0
- package/dist/chunks/{Dialog-CYBLjwbd.js → Dialog-DuOzsR2g.js} +1 -1
- package/dist/chunks/{Dialog-CYBLjwbd.js.map → Dialog-DuOzsR2g.js.map} +1 -1
- package/dist/chunks/{Disclosure-DiA6UKdM.js → Disclosure-9UgDzc7Z.js} +6 -6
- package/dist/chunks/{Disclosure-DiA6UKdM.js.map → Disclosure-9UgDzc7Z.js.map} +1 -1
- package/dist/chunks/{Field-dzlxOGxT.js → Field-BNqvUJfg.js} +1 -1
- package/dist/chunks/{Field-dzlxOGxT.js.map → Field-BNqvUJfg.js.map} +1 -1
- package/dist/chunks/{FontFamilySelect-DIJ4phXz.js → FontFamilySelect-CO19kyOO.js} +2 -2
- package/dist/chunks/{FontFamilySelect-DIJ4phXz.js.map → FontFamilySelect-CO19kyOO.js.map} +1 -1
- package/dist/chunks/{GradientEditor-BLpAtMDK.js → GradientEditor-B_ymIr4Q.js} +74 -51
- package/dist/chunks/GradientEditor-B_ymIr4Q.js.map +1 -0
- package/dist/chunks/Icon-QhLhaGFe.js +498 -0
- package/dist/chunks/Icon-QhLhaGFe.js.map +1 -0
- package/dist/chunks/{InlineRange-CcfzY80y.js → InlineRange-DdIlfGqG.js} +2 -2
- package/dist/chunks/{InlineRange-CcfzY80y.js.map → InlineRange-DdIlfGqG.js.map} +1 -1
- package/dist/chunks/{Input-CoKOtyD0.js → Input-B9Vh7ASP.js} +2 -2
- package/dist/chunks/{Input-CoKOtyD0.js.map → Input-B9Vh7ASP.js.map} +1 -1
- package/dist/chunks/Jog-BYrxbAQU.js +81 -0
- package/dist/chunks/Jog-BYrxbAQU.js.map +1 -0
- package/dist/chunks/{Keycaps-DSeq6QWH.js → Keycaps-CGNQV2Pz.js} +5 -5
- package/dist/chunks/Keycaps-CGNQV2Pz.js.map +1 -0
- package/dist/chunks/MenuButton-DGE-0DP0.js +60 -0
- package/dist/chunks/MenuButton-DGE-0DP0.js.map +1 -0
- package/dist/chunks/MeshEditor-CHoGQ9K8.js +123 -0
- package/dist/chunks/MeshEditor-CHoGQ9K8.js.map +1 -0
- package/dist/chunks/NumberField-CQzS6TjF.js +112 -0
- package/dist/chunks/NumberField-CQzS6TjF.js.map +1 -0
- package/dist/chunks/{OptionsBar-D_Cd3ZYs.js → OptionsBar-BWaYG_OH.js} +2 -2
- package/dist/chunks/{OptionsBar-D_Cd3ZYs.js.map → OptionsBar-BWaYG_OH.js.map} +1 -1
- package/dist/chunks/PaintField-BVYMu3OI.js +62 -0
- package/dist/chunks/PaintField-BVYMu3OI.js.map +1 -0
- package/dist/chunks/PaintInput-BzAHCKro.js +131 -0
- package/dist/chunks/PaintInput-BzAHCKro.js.map +1 -0
- package/dist/chunks/{PatternPicker-Ba22Bf4L.js → PatternPicker-C4OryrYi.js} +2 -2
- package/dist/chunks/{PatternPicker-Ba22Bf4L.js.map → PatternPicker-C4OryrYi.js.map} +1 -1
- package/dist/chunks/Plot2D-Czvyt_vG.js +292 -0
- package/dist/chunks/Plot2D-Czvyt_vG.js.map +1 -0
- package/dist/chunks/{PointPlotter-CbDKVggs.js → PointPlotter-Xvb98GwB.js} +2 -2
- package/dist/chunks/PointPlotter-Xvb98GwB.js.map +1 -0
- package/dist/chunks/{Powerline-BaHDJlcO.js → Powerline-B_EH-7Z-.js} +1 -1
- package/dist/chunks/{Powerline-BaHDJlcO.js.map → Powerline-B_EH-7Z-.js.map} +1 -1
- package/dist/chunks/Prefs-FuaJBs3t.js +308 -0
- package/dist/chunks/Prefs-FuaJBs3t.js.map +1 -0
- package/dist/chunks/Properties-B3KU69NI.js +874 -0
- package/dist/chunks/Properties-B3KU69NI.js.map +1 -0
- package/dist/chunks/{RadioGroup-B2_LUgDp.js → RadioGroup-C6xpdQNg.js} +2 -2
- package/dist/chunks/{RadioGroup-B2_LUgDp.js.map → RadioGroup-C6xpdQNg.js.map} +1 -1
- package/dist/chunks/{RangeSlider-S2R3zA8N.js → RangeSlider-CzgeGLVS.js} +1 -1
- package/dist/chunks/{RangeSlider-S2R3zA8N.js.map → RangeSlider-CzgeGLVS.js.map} +1 -1
- package/dist/chunks/{ResizeHandle-BrCO0JrH.js → ResizeHandle-1Ey8AOij.js} +1 -1
- package/dist/chunks/{ResizeHandle-BrCO0JrH.js.map → ResizeHandle-1Ey8AOij.js.map} +1 -1
- package/dist/chunks/{Select-CacMfs4v.js → Select-BMYVh10x.js} +20 -17
- package/dist/chunks/Select-BMYVh10x.js.map +1 -0
- package/dist/chunks/{SelectionPanel-C59wavdA.js → SelectionPanel-DTpcQidl.js} +211 -201
- package/dist/chunks/SelectionPanel-DTpcQidl.js.map +1 -0
- package/dist/chunks/{Sidebar-BvwjZiFm.js → Sidebar-BlUjn8lD.js} +1 -1
- package/dist/chunks/{Sidebar-BvwjZiFm.js.map → Sidebar-BlUjn8lD.js.map} +1 -1
- package/dist/chunks/{SidebarPanel-D5Ua2vyP.js → SidebarPanel-BqHfz6VK.js} +2 -2
- package/dist/chunks/{SidebarPanel-D5Ua2vyP.js.map → SidebarPanel-BqHfz6VK.js.map} +1 -1
- package/dist/chunks/Slider-B2ywUZH6.js +381 -0
- package/dist/chunks/Slider-B2ywUZH6.js.map +1 -0
- package/dist/chunks/{StatusBar-Bqv4D0dW.js → StatusBar-BFt7Yw5O.js} +1 -1
- package/dist/chunks/{StatusBar-Bqv4D0dW.js.map → StatusBar-BFt7Yw5O.js.map} +1 -1
- package/dist/chunks/{Switch-C4NU-me1.js → Switch-Om3t3ASc.js} +1 -1
- package/dist/chunks/{Switch-C4NU-me1.js.map → Switch-Om3t3ASc.js.map} +1 -1
- package/dist/chunks/{Tabs-BT3CDkoQ.js → Tabs-EAvYywil.js} +1 -1
- package/dist/chunks/{Tabs-BT3CDkoQ.js.map → Tabs-EAvYywil.js.map} +1 -1
- package/dist/chunks/Timeline-BEyKaBXl.js +916 -0
- package/dist/chunks/Timeline-BEyKaBXl.js.map +1 -0
- package/dist/chunks/{Toast-B7ylq7fz.js → Toast-iqLDD_XZ.js} +1 -1
- package/dist/chunks/{Toast-B7ylq7fz.js.map → Toast-iqLDD_XZ.js.map} +1 -1
- package/dist/chunks/{ToggleBar-Bxwv6xvj.js → ToggleBar--9As2PWG.js} +8 -8
- package/dist/chunks/ToggleBar--9As2PWG.js.map +1 -0
- package/dist/chunks/TokenPanel-BL9hlq7x.js +374 -0
- package/dist/chunks/TokenPanel-BL9hlq7x.js.map +1 -0
- package/dist/chunks/{ToolButton-CtDkqUIc.js → ToolButton-Dd-1T5aX.js} +1 -1
- package/dist/chunks/{ToolButton-CtDkqUIc.js.map → ToolButton-Dd-1T5aX.js.map} +1 -1
- package/dist/chunks/{ToolGroup-zDtqt0QJ.js → ToolGroup-BBI-W-Gm.js} +1 -1
- package/dist/chunks/{ToolGroup-zDtqt0QJ.js.map → ToolGroup-BBI-W-Gm.js.map} +1 -1
- package/dist/chunks/{ToolPalette-BbrMHfQ9.js → ToolPalette-BmTDDpmz.js} +3 -3
- package/dist/chunks/{ToolPalette-BbrMHfQ9.js.map → ToolPalette-BmTDDpmz.js.map} +1 -1
- package/dist/chunks/createKeyframeLayer-7j7ukrSx.js +699 -0
- package/dist/chunks/createKeyframeLayer-7j7ukrSx.js.map +1 -0
- package/dist/chunks/{icons-BV27dhKB.js → icons-Btrs-JD7.js} +35 -32
- package/dist/chunks/icons-Btrs-JD7.js.map +1 -0
- package/dist/chunks/number-f6PydOZK.js +52 -0
- package/dist/chunks/number-f6PydOZK.js.map +1 -0
- package/dist/chunks/range.module-DSsOIq1R.js +8 -0
- package/dist/chunks/range.module-DSsOIq1R.js.map +1 -0
- package/dist/chunks/{schema-CtWwGbqJ.js → schema-MCVT1MLv.js} +15 -9
- package/dist/chunks/schema-MCVT1MLv.js.map +1 -0
- package/dist/chunks/segmentedControl.module-DmeUMYe3.js +11 -0
- package/dist/chunks/segmentedControl.module-DmeUMYe3.js.map +1 -0
- package/dist/chunks/snap-B0WQwetQ.js +13 -0
- package/dist/chunks/snap-B0WQwetQ.js.map +1 -0
- package/dist/components/ActionBar/ActionBar.d.ts.map +1 -1
- package/dist/components/ActionBar/index.js +1 -1
- package/dist/components/ActionsBar/index.js +1 -1
- package/dist/components/BandEditor/BandEditor.d.ts.map +1 -1
- package/dist/components/BandEditor/index.js +1 -1
- package/dist/components/BandEditor/scale.d.ts +1 -8
- package/dist/components/BandEditor/scale.d.ts.map +1 -1
- package/dist/components/Callout/index.js +1 -1
- package/dist/components/Checkbox/index.js +1 -1
- package/dist/components/ColorField/index.js +1 -1
- package/dist/components/ComboBox/ComboBox.d.ts +36 -0
- package/dist/components/ComboBox/ComboBox.d.ts.map +1 -1
- package/dist/components/ComboBox/index.d.ts +1 -1
- package/dist/components/ComboBox/index.d.ts.map +1 -1
- package/dist/components/ComboBox/index.js +1 -1
- package/dist/components/CurveEditor/CurveEditor.d.ts +4 -2
- package/dist/components/CurveEditor/CurveEditor.d.ts.map +1 -1
- package/dist/components/CurveEditor/LayeredCurveEditor.d.ts +8 -1
- package/dist/components/CurveEditor/LayeredCurveEditor.d.ts.map +1 -1
- package/dist/components/CurveEditor/createFunctionLayer.d.ts +2 -0
- package/dist/components/CurveEditor/createFunctionLayer.d.ts.map +1 -1
- package/dist/components/CurveEditor/createKeyframeLayer.d.ts +70 -0
- package/dist/components/CurveEditor/createKeyframeLayer.d.ts.map +1 -0
- package/dist/components/CurveEditor/index.d.ts +3 -1
- package/dist/components/CurveEditor/index.d.ts.map +1 -1
- package/dist/components/CurveEditor/index.js +4 -2
- package/dist/components/CurveEditor/layerTypes.d.ts +8 -3
- package/dist/components/CurveEditor/layerTypes.d.ts.map +1 -1
- package/dist/components/DetentSlider/DetentSlider.d.ts +9 -10
- package/dist/components/DetentSlider/DetentSlider.d.ts.map +1 -1
- package/dist/components/DetentSlider/index.js +1 -1
- package/dist/components/Dialog/index.js +1 -1
- package/dist/components/Disclosure/index.js +1 -1
- package/dist/components/Field/index.js +1 -1
- package/dist/components/FontFamilySelect/index.js +1 -1
- package/dist/components/GradientEditor/GradientEditor.d.ts +3 -0
- package/dist/components/GradientEditor/GradientEditor.d.ts.map +1 -1
- package/dist/components/GradientEditor/index.js +1 -1
- package/dist/components/InlineRange/index.js +1 -1
- package/dist/components/Input/index.js +1 -1
- package/dist/components/Jog/Jog.d.ts +28 -0
- package/dist/components/Jog/Jog.d.ts.map +1 -0
- package/dist/components/Jog/index.d.ts +3 -0
- package/dist/components/Jog/index.d.ts.map +1 -0
- package/dist/components/Jog/index.js +2 -0
- package/dist/components/Keycaps/index.js +1 -1
- package/dist/components/MenuButton/MenuButton.d.ts +29 -0
- package/dist/components/MenuButton/MenuButton.d.ts.map +1 -0
- package/dist/components/MenuButton/index.d.ts +3 -0
- package/dist/components/MenuButton/index.d.ts.map +1 -0
- package/dist/components/MenuButton/index.js +2 -0
- package/dist/components/MeshEditor/MeshEditor.d.ts +30 -0
- package/dist/components/MeshEditor/MeshEditor.d.ts.map +1 -0
- package/dist/components/MeshEditor/index.d.ts +3 -0
- package/dist/components/MeshEditor/index.d.ts.map +1 -0
- package/dist/components/MeshEditor/index.js +2 -0
- package/dist/components/NumberField/UnitField.d.ts +30 -0
- package/dist/components/NumberField/UnitField.d.ts.map +1 -0
- package/dist/components/NumberField/index.d.ts +2 -0
- package/dist/components/NumberField/index.d.ts.map +1 -1
- package/dist/components/NumberField/index.js +2 -2
- package/dist/components/OptionsBar/index.js +1 -1
- package/dist/components/PaintField/PaintField.d.ts +36 -0
- package/dist/components/PaintField/PaintField.d.ts.map +1 -0
- package/dist/components/PaintField/index.d.ts +3 -0
- package/dist/components/PaintField/index.d.ts.map +1 -0
- package/dist/components/PaintField/index.js +2 -0
- package/dist/components/PaintInput/PaintInput.d.ts.map +1 -1
- package/dist/components/PaintInput/index.js +1 -1
- package/dist/components/PatternPicker/index.js +1 -1
- package/dist/components/Plot2D/Plot2D.d.ts +38 -2
- package/dist/components/Plot2D/Plot2D.d.ts.map +1 -1
- package/dist/components/Plot2D/index.d.ts +2 -1
- package/dist/components/Plot2D/index.d.ts.map +1 -1
- package/dist/components/Plot2D/index.js +2 -2
- package/dist/components/Plot2D/ticks.d.ts +43 -0
- package/dist/components/Plot2D/ticks.d.ts.map +1 -0
- package/dist/components/PointPlotter/PointPlotter.d.ts +3 -1
- package/dist/components/PointPlotter/PointPlotter.d.ts.map +1 -1
- package/dist/components/PointPlotter/index.js +1 -1
- package/dist/components/Powerline/index.js +1 -1
- package/dist/components/Prefs/PrefsForm.d.ts +4 -0
- package/dist/components/Prefs/PrefsForm.d.ts.map +1 -1
- package/dist/components/Prefs/index.d.ts +1 -1
- package/dist/components/Prefs/index.d.ts.map +1 -1
- package/dist/components/Prefs/index.js +3 -3
- package/dist/components/Prefs/schema.d.ts +5 -2
- package/dist/components/Prefs/schema.d.ts.map +1 -1
- package/dist/components/Properties/PinDot.d.ts +18 -0
- package/dist/components/Properties/PinDot.d.ts.map +1 -0
- package/dist/components/Properties/PropertyPanel.d.ts +106 -12
- package/dist/components/Properties/PropertyPanel.d.ts.map +1 -1
- package/dist/components/Properties/index.d.ts +4 -2
- package/dist/components/Properties/index.d.ts.map +1 -1
- package/dist/components/Properties/index.js +2 -2
- package/dist/components/Properties/storyLayouts.d.ts +1 -1
- package/dist/components/RadioGroup/index.js +1 -1
- package/dist/components/RangeSlider/index.js +1 -1
- package/dist/components/ResizeHandle/index.js +1 -1
- package/dist/components/Select/Select.d.ts +8 -0
- package/dist/components/Select/Select.d.ts.map +1 -1
- package/dist/components/Select/index.js +1 -1
- package/dist/components/SelectionPanel/index.js +1 -1
- package/dist/components/Sidebar/index.js +1 -1
- package/dist/components/SidebarPanel/index.js +1 -1
- package/dist/components/Slider/Slider.d.ts +19 -1
- package/dist/components/Slider/Slider.d.ts.map +1 -1
- package/dist/components/Slider/index.d.ts +1 -1
- package/dist/components/Slider/index.d.ts.map +1 -1
- package/dist/components/Slider/index.js +1 -1
- package/dist/components/StatusBar/index.js +1 -1
- package/dist/components/Switch/index.js +1 -1
- package/dist/components/Tabs/index.js +1 -1
- package/dist/components/Timeline/Lane.d.ts +9 -7
- package/dist/components/Timeline/Lane.d.ts.map +1 -1
- package/dist/components/Timeline/LaneGraph.d.ts +24 -0
- package/dist/components/Timeline/LaneGraph.d.ts.map +1 -0
- package/dist/components/Timeline/Ruler.d.ts.map +1 -1
- package/dist/components/Timeline/Timeline.d.ts.map +1 -1
- package/dist/components/Timeline/index.js +2 -2
- package/dist/components/Timeline/keys.d.ts +4 -3
- package/dist/components/Timeline/keys.d.ts.map +1 -1
- package/dist/components/Timeline/timeScale.d.ts +2 -0
- package/dist/components/Timeline/timeScale.d.ts.map +1 -1
- package/dist/components/Toast/index.js +1 -1
- package/dist/components/ToggleBar/index.js +1 -1
- package/dist/components/TokenPanel/TokenPanel.d.ts +33 -0
- package/dist/components/TokenPanel/TokenPanel.d.ts.map +1 -0
- package/dist/components/TokenPanel/color.d.ts +7 -0
- package/dist/components/TokenPanel/color.d.ts.map +1 -0
- package/dist/components/TokenPanel/index.d.ts +5 -0
- package/dist/components/TokenPanel/index.d.ts.map +1 -0
- package/dist/components/TokenPanel/index.js +2 -0
- package/dist/components/TokenPanel/tokenTypes.d.ts +31 -0
- package/dist/components/TokenPanel/tokenTypes.d.ts.map +1 -0
- package/dist/components/ToolButton/index.js +1 -1
- package/dist/components/ToolGroup/index.js +1 -1
- package/dist/components/ToolPalette/index.js +1 -1
- package/dist/components/paintValue.d.ts +8 -0
- package/dist/components/paintValue.d.ts.map +1 -1
- package/dist/format/number.d.ts +16 -0
- package/dist/format/number.d.ts.map +1 -1
- package/dist/handles.d.ts +20 -0
- package/dist/handles.d.ts.map +1 -0
- package/dist/icons/Icon.d.ts +10 -2
- package/dist/icons/Icon.d.ts.map +1 -1
- package/dist/icons/index.d.ts +6 -3
- package/dist/icons/index.d.ts.map +1 -1
- package/dist/icons/paths.d.ts +270 -16
- package/dist/icons/paths.d.ts.map +1 -1
- package/dist/index.d.ts +11 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +105 -65
- package/dist/index.js.map +1 -1
- package/dist/paintPreview.d.ts +13 -0
- package/dist/paintPreview.d.ts.map +1 -0
- package/dist/snap.d.ts +5 -0
- package/dist/snap.d.ts.map +1 -0
- package/dist/style.css +1 -1
- package/dist/useAsyncOptions.d.ts +38 -0
- package/dist/useAsyncOptions.d.ts.map +1 -0
- package/package.json +8 -6
- package/dist/chunks/BandEditor-CUlbOlJi.js.map +0 -1
- package/dist/chunks/ComboBox-BBRRWvdc.js +0 -107
- package/dist/chunks/ComboBox-BBRRWvdc.js.map +0 -1
- package/dist/chunks/CurveEditor-DtjdpJVB.js +0 -784
- package/dist/chunks/CurveEditor-DtjdpJVB.js.map +0 -1
- package/dist/chunks/DetentSlider-BpD7bgjN.js +0 -83
- package/dist/chunks/DetentSlider-BpD7bgjN.js.map +0 -1
- package/dist/chunks/GradientEditor-BLpAtMDK.js.map +0 -1
- package/dist/chunks/Icon-DBXtBB1f.js +0 -101
- package/dist/chunks/Icon-DBXtBB1f.js.map +0 -1
- package/dist/chunks/Keycaps-DSeq6QWH.js.map +0 -1
- package/dist/chunks/NumberField-DBowmOfe.js +0 -62
- package/dist/chunks/NumberField-DBowmOfe.js.map +0 -1
- package/dist/chunks/PaintInput-B7AScmHN.js +0 -118
- package/dist/chunks/PaintInput-B7AScmHN.js.map +0 -1
- package/dist/chunks/Plot2D-C97pO13t.js +0 -134
- package/dist/chunks/Plot2D-C97pO13t.js.map +0 -1
- package/dist/chunks/PointPlotter-CbDKVggs.js.map +0 -1
- package/dist/chunks/Prefs-4JSEtuU-.js +0 -294
- package/dist/chunks/Prefs-4JSEtuU-.js.map +0 -1
- package/dist/chunks/Properties-BpUYKi7-.js +0 -758
- package/dist/chunks/Properties-BpUYKi7-.js.map +0 -1
- package/dist/chunks/Select-CacMfs4v.js.map +0 -1
- package/dist/chunks/SelectionPanel-C59wavdA.js.map +0 -1
- package/dist/chunks/Slider-Bs-KSYgQ.js +0 -303
- package/dist/chunks/Slider-Bs-KSYgQ.js.map +0 -1
- package/dist/chunks/Timeline-Bz806JbE.js +0 -908
- package/dist/chunks/Timeline-Bz806JbE.js.map +0 -1
- package/dist/chunks/ToggleBar-Bxwv6xvj.js.map +0 -1
- package/dist/chunks/icons-BV27dhKB.js.map +0 -1
- package/dist/chunks/number-Bv1nbhOJ.js +0 -18
- package/dist/chunks/number-Bv1nbhOJ.js.map +0 -1
- package/dist/chunks/range.module-CvSfABmu.js +0 -8
- package/dist/chunks/range.module-CvSfABmu.js.map +0 -1
- package/dist/chunks/schema-CtWwGbqJ.js.map +0 -1
- package/dist/chunks/segmentedControl.module-BgvAPkSZ.js +0 -11
- package/dist/chunks/segmentedControl.module-BgvAPkSZ.js.map +0 -1
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { t as e } from "./Slider-B2ywUZH6.js";
|
|
2
|
+
import { jsx as t } from "react/jsx-runtime";
|
|
3
|
+
import { useEffect as n, useRef as r } from "react";
|
|
4
|
+
var i = {
|
|
5
|
+
root: "_root_jww5h_1",
|
|
6
|
+
slider: "_slider_jww5h_12"
|
|
7
|
+
};
|
|
8
|
+
//#endregion
|
|
9
|
+
//#region src/components/DetentSlider/DetentSlider.tsx
|
|
10
|
+
function a(e) {
|
|
11
|
+
return e.map((e) => typeof e == "object" && e ? e : { value: e });
|
|
12
|
+
}
|
|
13
|
+
function o(e, t) {
|
|
14
|
+
let n = e.findIndex((e) => e.value === t);
|
|
15
|
+
if (n !== -1) return n;
|
|
16
|
+
if (typeof t != "number") return 0;
|
|
17
|
+
let r = 0, i = Infinity;
|
|
18
|
+
for (let n = 0; n < e.length; n++) {
|
|
19
|
+
let a = e[n].value;
|
|
20
|
+
if (typeof a != "number") continue;
|
|
21
|
+
let o = Math.abs(a - t);
|
|
22
|
+
o < i && (i = o, r = n);
|
|
23
|
+
}
|
|
24
|
+
return r;
|
|
25
|
+
}
|
|
26
|
+
function s(e, t) {
|
|
27
|
+
return String(typeof e == "string" || typeof e == "number" ? e : t);
|
|
28
|
+
}
|
|
29
|
+
function c(c) {
|
|
30
|
+
let { value: l, onChange: u, onCommit: d, formatLabel: f, ariaLabel: p, className: m } = c, h = a(c.items), g = o(h, l), _ = Math.max(0, h.length - 1), v = (e, t) => e.label ?? f?.(e.value, t) ?? String(e.value), y = r(g), b = r(!1);
|
|
31
|
+
n(() => {
|
|
32
|
+
y.current = g;
|
|
33
|
+
}, [g]);
|
|
34
|
+
let x = (e) => {
|
|
35
|
+
let t = e[0].value;
|
|
36
|
+
t !== y.current && (y.current = t, b.current = !0, u(h[t].value, t));
|
|
37
|
+
}, S = (e) => {
|
|
38
|
+
if (!b.current) return;
|
|
39
|
+
b.current = !1;
|
|
40
|
+
let t = e[0].value;
|
|
41
|
+
d?.(h[t].value, t);
|
|
42
|
+
}, C = h[g];
|
|
43
|
+
if (!C) return /* @__PURE__ */ t("div", { className: m ? `${i.root} ${m}` : i.root });
|
|
44
|
+
let w = [{
|
|
45
|
+
value: g,
|
|
46
|
+
valueText: C.ariaLabel ?? s(v(C, g), C.value)
|
|
47
|
+
}], T = h.map((e, t) => ({
|
|
48
|
+
value: t,
|
|
49
|
+
label: v(e, t)
|
|
50
|
+
}));
|
|
51
|
+
return /* @__PURE__ */ t("div", {
|
|
52
|
+
className: m ? `${i.root} ${m}` : i.root,
|
|
53
|
+
children: /* @__PURE__ */ t(e, {
|
|
54
|
+
className: i.slider,
|
|
55
|
+
min: 0,
|
|
56
|
+
max: _,
|
|
57
|
+
stops: T,
|
|
58
|
+
snap: "strict",
|
|
59
|
+
stopLabels: c.labels ?? "all",
|
|
60
|
+
trackClick: "move-nearest",
|
|
61
|
+
trackHeight: c.trackHeight ?? 8,
|
|
62
|
+
ariaLabel: p,
|
|
63
|
+
thumbs: w,
|
|
64
|
+
onInput: x,
|
|
65
|
+
onChange: S
|
|
66
|
+
})
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
//#endregion
|
|
70
|
+
export { c as t };
|
|
71
|
+
|
|
72
|
+
//# sourceMappingURL=DetentSlider-BWNSv07Z.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DetentSlider-BWNSv07Z.js","names":[],"sources":["../../src/components/DetentSlider/DetentSlider.module.css","../../src/components/DetentSlider/DetentSlider.tsx"],"sourcesContent":[".root {\n position: relative;\n /* Read by Slider's track and stop marks. Detents run the full height of the\n * track so they read as notches rather than as tally marks beside it. */\n --rp-tick-inset: 0;\n --rp-tick-width: 1px;\n --rp-tick-color: var(--wzl-border-strong);\n --rp-track-cursor: pointer;\n font-family: var(--wzl-font-ui);\n}\n\n.slider {\n width: 100%;\n}\n\n","import { useEffect, useRef, type ReactElement, type ReactNode } from 'react';\nimport { Slider, type SliderStop, type Thumb } from '../Slider/Slider';\nimport s from './DetentSlider.module.css';\n\n/** What a detent can carry. Narrowed so identity comparison and React keys\n * both work without a keying callback. */\nexport type DetentValue = string | number;\n\n/** One detent on a {@link DetentSlider}. */\nexport type DetentItem<V extends DetentValue = number> = {\n value: V;\n /** Drawn under the detent. Defaults to `formatLabel(value)`, then `value`. */\n label?: ReactNode;\n /** Spoken form, when the drawn label is not the right thing to say. */\n ariaLabel?: string;\n};\n\n/**\n * Props for {@link DetentSlider}.\n *\n * `items` takes bare values or `DetentItem`s interchangeably — a bare value is\n * a detent with no label of its own.\n *\n * `onChange` fires on every detent the control passes through, including\n * mid-drag: each one is a complete, legal choice, so there is no in-flight\n * value to withhold. `onCommit` fires once the gesture that changed things\n * ends, and is the one to write to history.\n */\nexport type DetentSliderProps<V extends DetentValue = number> = {\n items: readonly (V | DetentItem<V>)[];\n value: V;\n onChange: (value: V, index: number) => void;\n onCommit?: (value: V, index: number) => void;\n formatLabel?: (value: V, index: number) => ReactNode;\n labels?: 'all' | 'ends' | 'none';\n trackHeight?: number;\n ariaLabel?: string;\n className?: string;\n};\n\nfunction normalize<V extends DetentValue>(items: readonly (V | DetentItem<V>)[]): DetentItem<V>[] {\n return items.map(it => (typeof it === 'object' && it !== null ? it : ({ value: it } as DetentItem<V>)));\n}\n\n/**\n * The detent `value` selects. An exact match wins; a number that matches none\n * lands on the nearest one, so a value arriving from a numeric field or an\n * older save renders where it belongs rather than silently reading as the\n * first detent.\n */\nfunction resolveIndex<V extends DetentValue>(items: readonly DetentItem<V>[], value: V): number {\n const exact = items.findIndex(it => it.value === value);\n if (exact !== -1) return exact;\n if (typeof value !== 'number') return 0;\n let best = 0;\n let bestGap = Infinity;\n for (let i = 0; i < items.length; i++) {\n const v = items[i].value;\n if (typeof v !== 'number') continue;\n const gap = Math.abs(v - value);\n if (gap < bestGap) {\n bestGap = gap;\n best = i;\n }\n }\n return best;\n}\n\nfunction plainText(label: ReactNode, fallback: DetentValue): string {\n return typeof label === 'string' || typeof label === 'number' ? String(label) : String(fallback);\n}\n\n/**\n * Slider over a fixed list of values: one detent per value, evenly spaced, the\n * thumb resting on one of them.\n *\n * This is the shape to reach for when an option has a small set of allowed\n * values along a line — playback rate, zoom step, quality — in place of a\n * dropdown, which hides the ordering and the extent of the range behind a\n * click. The values need only be ordered, not numeric.\n *\n * It is a strict {@link Slider} over the *index* of `items`, which keeps the\n * detents evenly spaced however the values are distributed. Since the index is\n * meaningless to a screen reader, the value is published as `aria-valuetext`.\n * For numbers that may also rest between the detents, use `Slider` directly\n * with `spacing=\"even\"` and magnetic stops.\n */\nexport function DetentSlider<V extends DetentValue = number>(props: DetentSliderProps<V>): ReactElement {\n const { value, onChange, onCommit, formatLabel, ariaLabel, className } = props;\n const items = normalize(props.items);\n const index = resolveIndex(items, value);\n const lastIndex = Math.max(0, items.length - 1);\n\n const labelOf = (item: DetentItem<V>, i: number): ReactNode =>\n item.label ?? formatLabel?.(item.value, i) ?? String(item.value);\n\n // Deduped separately: `live` suppresses the repeat reports a drag produces\n // while the pointer crosses one detent, `changed` keeps a press that chose\n // nothing from landing a no-op entry in the consumer's history.\n const liveRef = useRef(index);\n const changedRef = useRef(false);\n useEffect(() => {\n liveRef.current = index;\n }, [index]);\n\n const handleInput = (next: Thumb[]) => {\n const i = next[0].value;\n if (i === liveRef.current) return;\n liveRef.current = i;\n changedRef.current = true;\n onChange(items[i].value, i);\n };\n\n const handleCommit = (next: Thumb[]) => {\n if (!changedRef.current) return;\n changedRef.current = false;\n const i = next[0].value;\n onCommit?.(items[i].value, i);\n };\n\n const current = items[index];\n if (!current) return <div className={className ? `${s.root} ${className}` : s.root} />;\n\n const thumbs: Thumb[] = [\n { value: index, valueText: current.ariaLabel ?? plainText(labelOf(current, index), current.value) },\n ];\n\n const stops: SliderStop[] = items.map((item, i) => ({ value: i, label: labelOf(item, i) }));\n\n return (\n <div className={className ? `${s.root} ${className}` : s.root}>\n <Slider\n className={s.slider}\n min={0}\n max={lastIndex}\n stops={stops}\n snap=\"strict\"\n stopLabels={props.labels ?? 'all'}\n trackClick=\"move-nearest\"\n trackHeight={props.trackHeight ?? 8}\n ariaLabel={ariaLabel}\n thumbs={thumbs}\n onInput={handleInput}\n onChange={handleCommit}\n />\n </div>\n );\n}\n"],"mappings":";;;;;;;;;ACwCA,SAAS,EAAiC,GAAwD;AAChG,QAAO,EAAM,KAAI,MAAO,OAAO,KAAO,YAAY,IAAc,IAAM,EAAE,OAAO,GAAI,CAAoB;;AASzG,SAAS,EAAoC,GAAiC,GAAkB;CAC9F,IAAM,IAAQ,EAAM,WAAU,MAAM,EAAG,UAAU,EAAM;AACvD,KAAI,MAAU,GAAI,QAAO;AACzB,KAAI,OAAO,KAAU,SAAU,QAAO;CACtC,IAAI,IAAO,GACP,IAAU;AACd,MAAK,IAAI,IAAI,GAAG,IAAI,EAAM,QAAQ,KAAK;EACrC,IAAM,IAAI,EAAM,GAAG;AACnB,MAAI,OAAO,KAAM,SAAU;EAC3B,IAAM,IAAM,KAAK,IAAI,IAAI,EAAM;AAC/B,EAAI,IAAM,MACR,IAAU,GACV,IAAO;;AAGX,QAAO;;AAGT,SAAS,EAAU,GAAkB,GAA+B;AAClE,QAAgE,OAAzD,OAAO,KAAU,YAAY,OAAO,KAAU,WAAkB,IAAgB,EAAS;;AAkBlG,SAAgB,EAA6C,GAA2C;CACtG,IAAM,EAAE,UAAO,aAAU,aAAU,gBAAa,cAAW,iBAAc,GACnE,IAAQ,EAAU,EAAM,MAAM,EAC9B,IAAQ,EAAa,GAAO,EAAM,EAClC,IAAY,KAAK,IAAI,GAAG,EAAM,SAAS,EAAE,EAEzC,KAAW,GAAqB,MACpC,EAAK,SAAS,IAAc,EAAK,OAAO,EAAE,IAAI,OAAO,EAAK,MAAM,EAK5D,IAAU,EAAO,EAAM,EACvB,IAAa,EAAO,GAAM;AAChC,SAAgB;AACd,IAAQ,UAAU;IACjB,CAAC,EAAM,CAAC;CAEX,IAAM,KAAe,MAAkB;EACrC,IAAM,IAAI,EAAK,GAAG;AACd,QAAM,EAAQ,YAClB,EAAQ,UAAU,GAClB,EAAW,UAAU,IACrB,EAAS,EAAM,GAAG,OAAO,EAAE;IAGvB,KAAgB,MAAkB;AACtC,MAAI,CAAC,EAAW,QAAS;AACzB,IAAW,UAAU;EACrB,IAAM,IAAI,EAAK,GAAG;AAClB,MAAW,EAAM,GAAG,OAAO,EAAE;IAGzB,IAAU,EAAM;AACtB,KAAI,CAAC,EAAS,QAAO,kBAAC,OAAD,EAAK,WAAW,IAAY,GAAG,EAAE,KAAK,GAAG,MAAc,EAAE,MAAQ,CAAA;CAEtF,IAAM,IAAkB,CACtB;EAAE,OAAO;EAAO,WAAW,EAAQ,aAAa,EAAU,EAAQ,GAAS,EAAM,EAAE,EAAQ,MAAM;EAAE,CACpG,EAEK,IAAsB,EAAM,KAAK,GAAM,OAAO;EAAE,OAAO;EAAG,OAAO,EAAQ,GAAM,EAAE;EAAE,EAAE;AAE3F,QACE,kBAAC,OAAD;EAAK,WAAW,IAAY,GAAG,EAAE,KAAK,GAAG,MAAc,EAAE;YACvD,kBAAC,GAAD;GACE,WAAW,EAAE;GACb,KAAK;GACL,KAAK;GACE;GACP,MAAK;GACL,YAAY,EAAM,UAAU;GAC5B,YAAW;GACX,aAAa,EAAM,eAAe;GACvB;GACH;GACR,SAAS;GACT,UAAU;GACV,CAAA;EACE,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Dialog-
|
|
1
|
+
{"version":3,"file":"Dialog-DuOzsR2g.js","names":[],"sources":["../../src/components/Dialog/Dialog.module.css","../../src/components/Dialog/Dialog.tsx"],"sourcesContent":[".overlay {\n position: fixed;\n inset: 0;\n background: rgba(0, 0, 0, 0.4);\n display: flex;\n align-items: center;\n justify-content: center;\n z-index: 1000;\n opacity: 0;\n transition: opacity var(--wzl-motion-fast);\n}\n\n.overlay[data-entering] {\n opacity: 0;\n}\n\n.overlay[data-entering][data-rac] {\n opacity: 1;\n}\n\n.overlay[data-exiting] {\n opacity: 0;\n}\n\n.overlay[data-rac]:not([data-entering]):not([data-exiting]) {\n opacity: 1;\n}\n\n.modal {\n background: var(--wzl-surface);\n border: 1px solid var(--wzl-border);\n border-radius: var(--wzl-radius-md);\n box-shadow: 0 24px 64px rgba(0, 0, 0, 0.45);\n color: var(--wzl-fg);\n font-family: var(--wzl-font-ui);\n max-width: min(900px, calc(100vw - 32px));\n max-height: calc(100vh - 32px);\n display: flex;\n flex-direction: column;\n outline: none;\n}\n\n.dialog {\n display: flex;\n flex-direction: column;\n min-height: 0;\n flex: 1;\n outline: none;\n}\n\n.header {\n display: flex;\n align-items: center;\n gap: 12px;\n padding: 14px 16px;\n border-bottom: 1px solid var(--wzl-border);\n flex: 0 0 auto;\n}\n\n.title {\n flex: 1;\n margin: 0;\n font-size: var(--wzl-font-size);\n font-weight: var(--wzl-font-weight-bold);\n color: var(--wzl-fg);\n}\n\n.close {\n flex: 0 0 auto;\n width: 22px;\n height: 22px;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n background: transparent;\n border: 1px solid transparent;\n border-radius: var(--wzl-radius-sm);\n color: var(--wzl-fg-muted);\n cursor: pointer;\n padding: 0;\n font-size: var(--wzl-font-size-lg);\n line-height: 1;\n}\n\n.close:hover {\n background: var(--wzl-surface-hover);\n color: var(--wzl-fg);\n}\n\n.body {\n flex: 1;\n min-height: 0;\n overflow: auto;\n padding: 16px;\n}\n\n.footer {\n display: flex;\n align-items: center;\n justify-content: flex-end;\n gap: 8px;\n padding: 12px 16px;\n border-top: 1px solid var(--wzl-border);\n flex: 0 0 auto;\n}\n","import type { ReactNode } from 'react';\nimport {\n Modal as RACModal,\n ModalOverlay,\n Dialog as RACDialog,\n Heading,\n type ModalOverlayProps,\n type DialogProps as RACDialogProps,\n} from 'react-aria-components';\nimport { useOverlayPortal, type OverlayPortalProps, type WithoutPortalTarget } from '../../overlays/portalHost';\nimport s from './Dialog.module.css';\n\n/** Props for {@link Dialog}, on top of React Aria's `ModalOverlay` props. */\nexport type DialogProps = Omit<\n WithoutPortalTarget<ModalOverlayProps>,\n 'children' | 'className'\n> &\n OverlayPortalProps & {\n /** Heading rendered in the dialog's default header. Omit when supplying\n * a custom `header` slot via children. */\n title?: ReactNode;\n /** Show the built-in close button. Defaults to true when `onOpenChange`\n * is wired so the user has an escape hatch. */\n showCloseButton?: boolean;\n /** Body content. */\n children?: ReactNode;\n /** Footer slot — typically action buttons. */\n footer?: ReactNode;\n /** ARIA role. Defaults to `dialog`. Use `alertdialog` for confirms. */\n role?: RACDialogProps['role'];\n /** Class applied to the modal box (inside the overlay). */\n className?: string;\n };\n\n/**\n * Modal dialog wrapping React Aria. Supplies a default header (title +\n * close), scrollable body, and footer slot. Pass `isOpen` + `onOpenChange`\n * for controlled visibility, or omit both and use a `<DialogTrigger>` from\n * `react-aria-components` upstream of this component.\n *\n * Escape, click-outside, focus trap, and scroll lock all come from the\n * underlying primitives.\n */\nexport function Dialog(props: DialogProps) {\n const {\n title,\n showCloseButton,\n children,\n footer,\n role = 'dialog',\n className,\n isOpen,\n onOpenChange,\n portalContainer,\n ...rest\n } = props;\n\n const showClose = showCloseButton ?? Boolean(onOpenChange);\n const { anchor, portalProps } = useOverlayPortal(portalContainer);\n\n return (\n <>\n {anchor}\n <ModalOverlay\n {...rest}\n isOpen={isOpen}\n onOpenChange={onOpenChange}\n className={s.overlay}\n data-weasel-overlay=\"\"\n {...portalProps}\n >\n <RACModal className={[s.modal, className].filter(Boolean).join(' ')}>\n <RACDialog role={role} className={s.dialog}>\n {({ close }) => (\n <>\n {(title !== undefined || showClose) && (\n <header className={s.header}>\n {title !== undefined && (\n <Heading slot=\"title\" className={s.title}>{title}</Heading>\n )}\n {showClose && (\n <button\n type=\"button\"\n className={s.close}\n onClick={close}\n aria-label=\"Close dialog\"\n >\n ×\n </button>\n )}\n </header>\n )}\n <div className={s.body}>{children}</div>\n {footer !== undefined && <footer className={s.footer}>{footer}</footer>}\n </>\n )}\n </RACDialog>\n </RACModal>\n </ModalOverlay>\n </>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;AC2CA,SAAgB,EAAO,GAAoB;CACzC,IAAM,EACJ,UACA,oBACA,aACA,WACA,UAAO,UACP,cACA,WACA,iBACA,oBACA,GAAG,MACD,GAEE,IAAY,KAAmB,EAAQ,GACvC,EAAE,WAAQ,mBAAgB,EAAiB,EAAgB;AAEjE,QACE,kBAAA,GAAA,EAAA,UAAA,CACG,GACD,kBAAC,GAAD;EACE,GAAI;EACI;EACM;EACd,WAAW,EAAE;EACb,uBAAoB;EACpB,GAAI;YAEJ,kBAAC,GAAD;GAAU,WAAW,CAAC,EAAE,OAAO,EAAU,CAAC,OAAO,QAAQ,CAAC,KAAK,IAAI;aACjE,kBAAC,GAAD;IAAiB;IAAM,WAAW,EAAE;eAChC,EAAE,eACF,kBAAA,GAAA,EAAA,UAAA;MACI,MAAU,KAAA,KAAa,MACvB,kBAAC,UAAD;MAAQ,WAAW,EAAE;gBAArB,CACG,MAAU,KAAA,KACT,kBAAC,GAAD;OAAS,MAAK;OAAQ,WAAW,EAAE;iBAAQ;OAAgB,CAAA,EAE5D,KACC,kBAAC,UAAD;OACE,MAAK;OACL,WAAW,EAAE;OACb,SAAS;OACT,cAAW;iBACZ;OAEQ,CAAA,CAEJ;;KAEX,kBAAC,OAAD;MAAK,WAAW,EAAE;MAAO;MAAe,CAAA;KACvC,MAAW,KAAA,KAAa,kBAAC,UAAD;MAAQ,WAAW,EAAE;gBAAS;MAAgB,CAAA;KACtE,EAAA,CAAA;IAEK,CAAA;GACH,CAAA;EACE,CAAA,CACd,EAAA,CAAA"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { jsx as e, jsxs as t } from "react/jsx-runtime";
|
|
2
2
|
var n = {
|
|
3
|
-
twisty: "
|
|
4
|
-
mark: "
|
|
5
|
-
down: "
|
|
6
|
-
row: "
|
|
7
|
-
rowBody: "
|
|
3
|
+
twisty: "_twisty_guuy6_5",
|
|
4
|
+
mark: "_mark_guuy6_45",
|
|
5
|
+
down: "_down_guuy6_57",
|
|
6
|
+
row: "_row_guuy6_71",
|
|
7
|
+
rowBody: "_rowBody_guuy6_79"
|
|
8
8
|
};
|
|
9
9
|
//#endregion
|
|
10
10
|
//#region src/components/Disclosure/Disclosure.tsx
|
|
@@ -44,4 +44,4 @@ function i({ children: i, className: a, ...o }) {
|
|
|
44
44
|
//#endregion
|
|
45
45
|
export { i as n, r as t };
|
|
46
46
|
|
|
47
|
-
//# sourceMappingURL=Disclosure-
|
|
47
|
+
//# sourceMappingURL=Disclosure-9UgDzc7Z.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Disclosure-
|
|
1
|
+
{"version":3,"file":"Disclosure-9UgDzc7Z.js","names":[],"sources":["../../src/components/Disclosure/Disclosure.module.css","../../src/components/Disclosure/Disclosure.tsx"],"sourcesContent":["/* Every dimension is stated because a host app's bare-element defaults can be\n authored at zero specificity — labkit's `:where(.lk-root) :where(button)`\n sets `height: var(--wzl-control-h)` and horizontal padding, which would\n otherwise stretch a 12px mark into a full-height control. */\n.twisty {\n flex: 0 0 auto;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n /* A floor, not a size: a control sized to a 12px glyph is a 12px target,\n which is under every pointer-size guideline there is. Stated as a minimum\n so a larger mark grows the target with it rather than being shrunk to fit\n — a flex item's default `flex-shrink: 1` would otherwise crush it. */\n min-width: var(--wzl-disclosure-target, 20px);\n min-height: var(--wzl-disclosure-target, 20px);\n padding: 0;\n border: 0;\n border-radius: var(--wzl-radius-sm);\n background: none;\n backdrop-filter: none;\n -webkit-backdrop-filter: none;\n color: var(--wzl-fg-muted);\n line-height: 1;\n cursor: pointer;\n}\n\n.twisty:hover:not(:disabled) {\n color: var(--wzl-fg);\n background: var(--wzl-surface-raised);\n}\n\n.twisty:focus-visible {\n outline: 2px solid var(--wzl-focus-ring);\n outline-offset: -2px;\n color: var(--wzl-fg);\n}\n\n.twisty:disabled {\n color: var(--wzl-fg-subtle);\n cursor: not-allowed;\n}\n\n/* `currentColor` so the mark follows the button's own hover and disabled\n colors, and so a consumer can recolor the pair with one declaration. */\n.mark {\n display: block;\n flex: none;\n fill: currentColor;\n transition: transform var(--wzl-motion-fast, 90ms) var(--wzl-ease-out-cubic);\n}\n\n.twisty[aria-expanded='true'] .mark {\n transform: rotate(90deg);\n}\n\n/* `direction=\"down\"` starts pointing down and lifts to point up. */\n.down .mark {\n transform: rotate(90deg);\n}\n\n.down[aria-expanded='true'] .mark {\n transform: rotate(-90deg);\n}\n\n@media (prefers-reduced-motion: reduce) {\n .mark {\n transition: none;\n }\n}\n\n.row {\n display: flex;\n align-items: center;\n gap: var(--wzl-disclosure-gap, 4px);\n}\n\n/* The row's content takes the rest and is allowed to shrink; the twisty is\n not, so a long label truncates rather than crushing the control. */\n.rowBody {\n flex: 1 1 auto;\n min-width: 0;\n}\n","import type { ReactNode } from 'react';\nimport s from './Disclosure.module.css';\n\n/** Which way the mark points when the section is closed. */\nexport type DisclosureDirection = 'right' | 'down';\n\n/** Props for `<Disclosure>`. */\nexport interface DisclosureProps {\n /** Whether the section it controls is open. The consumer owns this. */\n open: boolean;\n onToggle: () => void;\n /**\n * Names the section, for a screen reader. The control has no text of its\n * own, so without this it announces as an unlabeled button.\n */\n label: string;\n /**\n * `id` of the element this expands. Sets `aria-controls`, which lets a\n * screen reader move to the revealed content.\n */\n controls?: string;\n /** Which way the closed mark points. `'right'` (default) rotates down when\n * open; `'down'` rotates up. */\n direction?: DisclosureDirection;\n /** Mark size in px. The hit target is at least 20px and grows with it.\n * Default 12. */\n size?: number;\n disabled?: boolean;\n className?: string;\n}\n\n/**\n * The twisty on a collapsible section: a triangle that turns as it opens.\n *\n * Presentational — it holds no open/closed state and renders no children.\n * The consumer owns the state and the panel; this is the control that toggles\n * it, and `aria-expanded` is what ties the two together.\n *\n * Three things it settles that a hand-rolled twisty keeps getting wrong. The\n * mark is drawn rather than typed, because `--wzl-font-ui` carries no ▸/▾ and\n * a text glyph falls back to whatever the system offers at whatever size that\n * font renders it — around 6px against 13px body text, which reads as dirt on\n * the screen. The hit target is larger than the mark. And it is a sibling of\n * the row's label rather than a child, so clicking to expand does not actuate\n * the label's own control.\n *\n * Deliberately not part of the icon register, on the same grounds as\n * `DragHandleGlyph`: that register is outline strokes at a fixed weight, and\n * `base.mjs` rejects a solid triangle in it by name. A disclosure mark is\n * filled.\n */\nexport function Disclosure({\n open,\n onToggle,\n label,\n controls,\n direction = 'right',\n size = 12,\n disabled,\n className,\n}: DisclosureProps) {\n const cls = [s.twisty, direction === 'down' && s.down, className].filter(Boolean).join(' ');\n return (\n <button\n type=\"button\"\n className={cls}\n aria-expanded={open}\n aria-controls={controls}\n aria-label={label}\n disabled={disabled}\n onClick={onToggle}\n >\n <svg\n className={s.mark}\n viewBox=\"0 0 12 12\"\n width={size}\n height={size}\n aria-hidden=\"true\"\n focusable=\"false\"\n >\n {/* Vertex on the right edge at the vertical center, so the rotation\n about the box center keeps the point on the same circle. */}\n <path d=\"M4 2.5 L8.5 6 L4 9.5 Z\" />\n </svg>\n </button>\n );\n}\n\n/** Props for `<DisclosureRow>`. */\nexport interface DisclosureRowProps extends Omit<DisclosureProps, 'className'> {\n /** The row's own content — a label, a checkbox, a count. */\n children: ReactNode;\n className?: string;\n}\n\n/**\n * A `<Disclosure>` and a row of content beside it, laid out so the twisty\n * leads and the content takes the rest.\n *\n * The layout is the point: the twisty sits *outside* whatever the row puts in\n * it, so a row whose content is a `<label>` wrapping a checkbox stays\n * clickable as a label without the twisty actuating it.\n */\nexport function DisclosureRow({ children, className, ...twisty }: DisclosureRowProps) {\n return (\n <div className={className ? `${s.row} ${className}` : s.row}>\n <Disclosure {...twisty} />\n <div className={s.rowBody}>{children}</div>\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;ACmDA,SAAgB,EAAW,EACzB,SACA,aACA,UACA,aACA,eAAY,SACZ,UAAO,IACP,aACA,gBACkB;AAElB,QACE,kBAAC,UAAD;EACE,MAAK;EACL,WAJQ;GAAC,EAAE;GAAQ,MAAc,UAAU,EAAE;GAAM;GAAU,CAAC,OAAO,QAAQ,CAAC,KAAK,IAIxE;EACX,iBAAe;EACf,iBAAe;EACf,cAAY;EACF;EACV,SAAS;YAET,kBAAC,OAAD;GACE,WAAW,EAAE;GACb,SAAQ;GACR,OAAO;GACP,QAAQ;GACR,eAAY;GACZ,WAAU;aAIV,kBAAC,QAAD,EAAM,GAAE,0BAA2B,CAAA;GAC/B,CAAA;EACC,CAAA;;AAmBb,SAAgB,EAAc,EAAE,aAAU,cAAW,GAAG,KAA8B;AACpF,QACE,kBAAC,OAAD;EAAK,WAAW,IAAY,GAAG,EAAE,IAAI,GAAG,MAAc,EAAE;YAAxD,CACE,kBAAC,GAAD,EAAY,GAAI,GAAU,CAAA,EAC1B,kBAAC,OAAD;GAAK,WAAW,EAAE;GAAU;GAAe,CAAA,CACvC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Field-
|
|
1
|
+
{"version":3,"file":"Field-BNqvUJfg.js","names":[],"sources":["../../src/components/Field/Field.module.css","../../src/components/Field/Field.tsx"],"sourcesContent":[".field {\n display: flex;\n flex-direction: column;\n gap: 4px;\n font-family: var(--wzl-font-ui);\n color: var(--wzl-fg);\n}\n\n.label {\n font-size: var(--wzl-font-size-sm);\n font-weight: var(--wzl-font-weight-medium);\n color: var(--wzl-fg);\n cursor: default;\n}\n\n.hint {\n font-size: var(--wzl-font-size-sm);\n color: var(--wzl-fg-subtle);\n line-height: 1.4;\n}\n\n.error {\n font-size: var(--wzl-font-size-sm);\n color: var(--wzl-danger);\n line-height: 1.4;\n}\n\n.row {\n flex-direction: row;\n align-items: center;\n gap: 8px;\n}\n\n.row .label {\n flex: 1;\n min-width: 0;\n}\n","import type { ReactNode } from 'react';\nimport s from './Field.module.css';\n\n/**\n * Whether a {@link Field} stacks its label above the control or sits them\n * side by side.\n */\nexport type FieldOrientation = 'stacked' | 'row';\n\n/** Props for {@link Field}. */\nexport type FieldProps = {\n orientation?: FieldOrientation;\n className?: string;\n children?: ReactNode;\n};\n\n/**\n * Layout primitive that arranges a label, control, hint, and error in the\n * canonical weasel-ui form-row shape. The control itself owns its semantics\n * (RAC `TextField`, `Checkbox`, etc.); this just paints the layout.\n *\n * Most users will instead reach for `Input` / `Checkbox` / `Switch`, which\n * compose Field internally. Use Field directly when you need a custom\n * control to sit in the same visual rhythm.\n */\nexport function Field({ orientation = 'stacked', className, children }: FieldProps) {\n const cls = [s.field, orientation === 'row' && s.row, className].filter(Boolean).join(' ');\n return <div className={cls}>{children}</div>;\n}\n\n/**\n * The class names {@link Field} paints its slots with, so a control composing\n * its own layout can match the same form-row rhythm.\n */\nexport const fieldClasses = {\n root: s.field,\n row: s.row,\n label: s.label,\n hint: s.hint,\n error: s.error,\n};\n"],"mappings":";;;;;;;;;;ACyBA,SAAgB,EAAM,EAAE,iBAAc,WAAW,cAAW,eAAwB;AAElF,QAAO,kBAAC,OAAD;EAAK,WADA;GAAC,EAAE;GAAO,MAAgB,SAAS,EAAE;GAAK;GAAU,CAAC,OAAO,QAAQ,CAAC,KAAK,IAC/D;EAAM;EAAe,CAAA;;AAO9C,IAAa,IAAe;CAC1B,MAAM,EAAE;CACR,KAAK,EAAE;CACP,OAAO,EAAE;CACT,MAAM,EAAE;CACR,OAAO,EAAE;CACV"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as e } from "./Select-
|
|
1
|
+
import { t as e } from "./Select-BMYVh10x.js";
|
|
2
2
|
import { jsx as t } from "react/jsx-runtime";
|
|
3
3
|
import { listCanvasFonts as n, listFonts as r, resolveFontVariant as i } from "@weasel-js/font";
|
|
4
4
|
//#region src/components/FontFamilySelect/FontFamilySelect.tsx
|
|
@@ -26,4 +26,4 @@ function o(i) {
|
|
|
26
26
|
//#endregion
|
|
27
27
|
export { o as t };
|
|
28
28
|
|
|
29
|
-
//# sourceMappingURL=FontFamilySelect-
|
|
29
|
+
//# sourceMappingURL=FontFamilySelect-CO19kyOO.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FontFamilySelect-
|
|
1
|
+
{"version":3,"file":"FontFamilySelect-CO19kyOO.js","names":[],"sources":["../../src/components/FontFamilySelect/FontFamilySelect.tsx"],"sourcesContent":["/**\n * Font-family picker driven by the live font registry.\n *\n * **What it offers.** Both tiers that can actually paint: `listFonts()` for\n * families with a baked atlas, and `listCanvasFonts()` for families the\n * dynamic canvas-SDF tier will serve. Offer what will render, invent\n * nothing — and `listCanvasFonts` reports service rather than membership,\n * so a family auto-enrolled under a policy that is no longer in force\n * doesn't appear.\n *\n * **What it does with a value it can't offer.** Nothing about the model\n * stops a node from naming a family that was never registered — a pasted\n * node, an imported SVG, a document from a session that loaded more fonts.\n * The control keeps that value visible as its own entry and names what is\n * actually painting instead, read structurally off\n * `resolveFontVariant().substituted`. Dropping the value would silently\n * rewrite the document on the next edit; showing it bare would claim a font\n * is in use that isn't.\n */\nimport { listCanvasFonts, listFonts, resolveFontVariant } from '@weasel-js/font';\nimport { Select } from '../Select';\n\nexport interface FontFamilySelectProps {\n /** Current family, or `undefined` when the sources disagree (`mixed`). */\n value?: string;\n /** Indeterminate presentation — the aggregated sources name different families. */\n mixed?: boolean;\n onChange: (family: string) => void;\n /** The weight / style the text actually renders at, so the substitution\n * probe reports the variant that paints rather than a nominal 400/normal. */\n weight?: number;\n fontStyle?: 'normal' | 'italic';\n 'aria-label'?: string;\n className?: string;\n}\n\n/** Label for a value that isn't in the registry: name the substitute when the\n * fallback chain found one, otherwise say only what is known. */\nfunction unregisteredLabel(family: string, weight: number, style: 'normal' | 'italic'): string {\n const { substituted } = resolveFontVariant(family, weight, style);\n return substituted\n ? `${family} — not loaded, showing ${substituted.resolved}`\n : `${family} — not loaded`;\n}\n\nexport function FontFamilySelect(props: FontFamilySelectProps) {\n const { value, mixed = false, onChange, weight = 400, fontStyle = 'normal', className } = props;\n // Both tiers that actually render: families with a baked atlas, and\n // families the dynamic canvas-SDF tier will serve. Neither list is a guess\n // — `listCanvasFonts` reports what the registry will really route, so a\n // family reaches this menu only if it can paint.\n const baked = listFonts();\n const canvas = listCanvasFonts().filter((c) => !baked.some((f) => f.family === c.family));\n const available = [...baked.map((f) => f.family), ...canvas.map((c) => c.family)];\n const options = available.map((family) => ({ value: family, label: family }));\n if (value !== undefined && !available.includes(value)) {\n options.push({ value, label: unregisteredLabel(value, weight, fontStyle) });\n }\n return (\n <Select<string>\n className={className}\n options={options}\n selectedKey={mixed ? null : (value ?? null)}\n placeholder={mixed ? 'Mixed' : undefined}\n onSelectionChange={onChange}\n aria-label={props['aria-label'] ?? 'Font'}\n />\n );\n}\n"],"mappings":";;;;AAsCA,SAAS,EAAkB,GAAgB,GAAgB,GAAoC;CAC7F,IAAM,EAAE,mBAAgB,EAAmB,GAAQ,GAAQ,EAAM;AACjE,QAAO,IACH,GAAG,EAAO,yBAAyB,EAAY,aAC/C,GAAG,EAAO;;AAGhB,SAAgB,EAAiB,GAA8B;CAC7D,IAAM,EAAE,UAAO,WAAQ,IAAO,aAAU,YAAS,KAAK,eAAY,UAAU,iBAAc,GAKpF,IAAQ,GAAW,EACnB,IAAS,GAAiB,CAAC,QAAQ,MAAM,CAAC,EAAM,MAAM,MAAM,EAAE,WAAW,EAAE,OAAO,CAAC,EACnF,IAAY,CAAC,GAAG,EAAM,KAAK,MAAM,EAAE,OAAO,EAAE,GAAG,EAAO,KAAK,MAAM,EAAE,OAAO,CAAC,EAC3E,IAAU,EAAU,KAAK,OAAY;EAAE,OAAO;EAAQ,OAAO;EAAQ,EAAE;AAI7E,QAHI,MAAU,KAAA,KAAa,CAAC,EAAU,SAAS,EAAM,IACnD,EAAQ,KAAK;EAAE;EAAO,OAAO,EAAkB,GAAO,GAAQ,EAAU;EAAE,CAAC,EAG3E,kBAAC,GAAD;EACa;EACF;EACT,aAAa,IAAQ,OAAQ,KAAS;EACtC,aAAa,IAAQ,UAAU,KAAA;EAC/B,mBAAmB;EACnB,cAAY,EAAM,iBAAiB;EACnC,CAAA"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { t as e } from "./Slider-
|
|
2
|
-
import { t } from "./ToggleBar
|
|
3
|
-
import { t as n } from "./ColorField-
|
|
1
|
+
import { t as e } from "./Slider-B2ywUZH6.js";
|
|
2
|
+
import { t } from "./ToggleBar--9As2PWG.js";
|
|
3
|
+
import { t as n } from "./ColorField-YVf8irfr.js";
|
|
4
4
|
import { Fragment as r, jsx as i, jsxs as a } from "react/jsx-runtime";
|
|
5
5
|
import { fillInPoseFrame as o, fillToBoundsFrame as s, gradientGeometry as c, isGradientFill as l, sampleGradientStops as u, useActionsRegistry as d, useHandleDrag as f, useNodeOverlayFrame as p, withGradientKind as m } from "@weasel-js/core";
|
|
6
6
|
import { useCallback as h, useRef as g } from "react";
|
|
@@ -54,26 +54,39 @@ var y = {
|
|
|
54
54
|
value: "conic-gradient",
|
|
55
55
|
label: "Conic"
|
|
56
56
|
}
|
|
57
|
-
], x =
|
|
58
|
-
|
|
59
|
-
|
|
57
|
+
], x = [
|
|
58
|
+
{
|
|
59
|
+
value: "rgb",
|
|
60
|
+
label: "sRGB"
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
value: "oklab",
|
|
64
|
+
label: "OKLab"
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
value: "oklch",
|
|
68
|
+
label: "OKLCh"
|
|
69
|
+
}
|
|
70
|
+
], S = 2;
|
|
71
|
+
function C(r) {
|
|
72
|
+
let { value: o, onInput: s, onChange: c, kindSwitch: l = !0, spaceSwitch: d = !0, className: f } = r, p = o.stops, g = o.interpolate ?? "rgb", _ = h((e) => ({
|
|
60
73
|
...o,
|
|
61
74
|
stops: e
|
|
62
|
-
}), [o]),
|
|
75
|
+
}), [o]), C = p.map((e) => ({
|
|
63
76
|
value: e.offset,
|
|
64
77
|
color: e.color
|
|
65
|
-
})),
|
|
78
|
+
})), w = (e) => e.map((e) => ({
|
|
66
79
|
offset: e.value,
|
|
67
80
|
color: e.color
|
|
68
|
-
})),
|
|
81
|
+
})), T = (e, t) => p.map((n, r) => r === e ? {
|
|
69
82
|
...n,
|
|
70
83
|
color: t
|
|
71
|
-
} : n),
|
|
84
|
+
} : n), E = p.map((e, t) => ({
|
|
72
85
|
stop: e,
|
|
73
86
|
index: t
|
|
74
87
|
})).sort((e, t) => e.stop.offset - t.stop.offset);
|
|
75
88
|
return /* @__PURE__ */ a("div", {
|
|
76
|
-
className: [y.root,
|
|
89
|
+
className: [y.root, f].filter(Boolean).join(" "),
|
|
77
90
|
children: [
|
|
78
91
|
l && /* @__PURE__ */ i(t, {
|
|
79
92
|
items: b,
|
|
@@ -87,65 +100,75 @@ function S(r) {
|
|
|
87
100
|
max: 1,
|
|
88
101
|
step: .005,
|
|
89
102
|
constraint: "free",
|
|
90
|
-
thumbs:
|
|
103
|
+
thumbs: C,
|
|
91
104
|
ariaLabel: "Gradient stops",
|
|
92
105
|
readoutPlacement: "none",
|
|
93
|
-
onInput: (e) => s?.(
|
|
94
|
-
onChange: (e) => c(
|
|
106
|
+
onInput: (e) => s?.(_(w(e))),
|
|
107
|
+
onChange: (e) => c(_(w(e))),
|
|
95
108
|
onAddThumb: (e) => ({
|
|
96
109
|
value: e,
|
|
97
|
-
color: u(
|
|
110
|
+
color: u(p, e, g)
|
|
98
111
|
}),
|
|
99
|
-
onRemoveThumb: () =>
|
|
112
|
+
onRemoveThumb: () => p.length > S,
|
|
100
113
|
renderTrack: v({
|
|
101
|
-
gradient: (e) => u(
|
|
102
|
-
samples: 32
|
|
114
|
+
gradient: (e) => u(p, e, g),
|
|
115
|
+
samples: g === "rgb" ? 32 : 64
|
|
116
|
+
})
|
|
117
|
+
}),
|
|
118
|
+
d && /* @__PURE__ */ i(t, {
|
|
119
|
+
items: x,
|
|
120
|
+
value: g,
|
|
121
|
+
size: "sm",
|
|
122
|
+
ariaLabel: "Blend space",
|
|
123
|
+
onChange: (e) => e && c({
|
|
124
|
+
...o,
|
|
125
|
+
interpolate: e
|
|
103
126
|
})
|
|
104
127
|
}),
|
|
105
128
|
/* @__PURE__ */ i("div", {
|
|
106
129
|
className: y.swatches,
|
|
107
|
-
children:
|
|
130
|
+
children: E.map(({ stop: e, index: t }) => /* @__PURE__ */ i(n, {
|
|
108
131
|
value: e.color,
|
|
109
132
|
alpha: !0,
|
|
110
133
|
"aria-label": `Stop ${t + 1} at ${Math.round(e.offset * 100)}%`,
|
|
111
134
|
className: y.swatch,
|
|
112
|
-
onInput: (e) => s?.(
|
|
113
|
-
onChange: (e) => c(
|
|
135
|
+
onInput: (e) => s?.(_(T(t, e))),
|
|
136
|
+
onChange: (e) => c(_(T(t, e)))
|
|
114
137
|
}, t))
|
|
115
138
|
})
|
|
116
139
|
]
|
|
117
140
|
});
|
|
118
141
|
}
|
|
119
|
-
var
|
|
142
|
+
var w = {
|
|
120
143
|
overlay: "_overlay_6yu3h_3",
|
|
121
144
|
guide: "_guide_6yu3h_13",
|
|
122
145
|
handle: "_handle_6yu3h_21"
|
|
123
146
|
};
|
|
124
147
|
//#endregion
|
|
125
148
|
//#region src/components/GradientEditor/GradientHandles.tsx
|
|
126
|
-
function
|
|
149
|
+
function T(e) {
|
|
127
150
|
let { value: t, toScreen: n, toLocal: r, onInput: a, onChange: o, width: s, height: c, className: l } = e;
|
|
128
151
|
return /* @__PURE__ */ i("svg", {
|
|
129
|
-
className: [
|
|
152
|
+
className: [w.overlay, l].filter(Boolean).join(" "),
|
|
130
153
|
width: s,
|
|
131
154
|
height: c,
|
|
132
|
-
children:
|
|
155
|
+
children: E(t, n, r, a, o)
|
|
133
156
|
});
|
|
134
157
|
}
|
|
135
|
-
function
|
|
158
|
+
function E(e, t, n, o, s) {
|
|
136
159
|
let l = (e, t) => {
|
|
137
160
|
t === "input" ? o?.(e) : s(e);
|
|
138
161
|
};
|
|
139
162
|
if (e.fill === "linear-gradient") {
|
|
140
163
|
let o = t(e.from), s = t(e.to);
|
|
141
164
|
return /* @__PURE__ */ a(r, { children: [
|
|
142
|
-
/* @__PURE__ */ i(
|
|
165
|
+
/* @__PURE__ */ i(O, {
|
|
143
166
|
x1: o.x,
|
|
144
167
|
y1: o.y,
|
|
145
168
|
x2: s.x,
|
|
146
169
|
y2: s.y
|
|
147
170
|
}),
|
|
148
|
-
/* @__PURE__ */ i(
|
|
171
|
+
/* @__PURE__ */ i(k, {
|
|
149
172
|
at: o,
|
|
150
173
|
label: "Gradient start",
|
|
151
174
|
onDrag: (t, r) => l({
|
|
@@ -153,7 +176,7 @@ function T(e, t, n, o, s) {
|
|
|
153
176
|
from: n(t)
|
|
154
177
|
}, r)
|
|
155
178
|
}),
|
|
156
|
-
/* @__PURE__ */ i(
|
|
179
|
+
/* @__PURE__ */ i(k, {
|
|
157
180
|
at: s,
|
|
158
181
|
label: "Gradient end",
|
|
159
182
|
onDrag: (t, r) => l({
|
|
@@ -170,12 +193,12 @@ function T(e, t, n, o, s) {
|
|
|
170
193
|
}), c = Math.hypot(s.x - o.x, s.y - o.y);
|
|
171
194
|
return /* @__PURE__ */ a(r, { children: [
|
|
172
195
|
/* @__PURE__ */ i("circle", {
|
|
173
|
-
className:
|
|
196
|
+
className: w.guide,
|
|
174
197
|
cx: o.x,
|
|
175
198
|
cy: o.y,
|
|
176
199
|
r: c
|
|
177
200
|
}),
|
|
178
|
-
/* @__PURE__ */ i(
|
|
201
|
+
/* @__PURE__ */ i(k, {
|
|
179
202
|
at: o,
|
|
180
203
|
label: "Gradient center",
|
|
181
204
|
onDrag: (t, r) => l({
|
|
@@ -183,14 +206,14 @@ function T(e, t, n, o, s) {
|
|
|
183
206
|
center: n(t)
|
|
184
207
|
}, r)
|
|
185
208
|
}),
|
|
186
|
-
/* @__PURE__ */ i(
|
|
209
|
+
/* @__PURE__ */ i(k, {
|
|
187
210
|
at: s,
|
|
188
211
|
label: "Gradient radius",
|
|
189
212
|
onDrag: (t, r) => {
|
|
190
213
|
let i = n(t), a = Math.hypot(i.x - e.center.x, i.y - e.center.y);
|
|
191
214
|
l({
|
|
192
215
|
...e,
|
|
193
|
-
radius: Math.max(
|
|
216
|
+
radius: Math.max(D, a)
|
|
194
217
|
}, r);
|
|
195
218
|
}
|
|
196
219
|
})
|
|
@@ -201,13 +224,13 @@ function T(e, t, n, o, s) {
|
|
|
201
224
|
y: e.center.y + Math.sin(e.angle) * d
|
|
202
225
|
});
|
|
203
226
|
return /* @__PURE__ */ a(r, { children: [
|
|
204
|
-
/* @__PURE__ */ i(
|
|
227
|
+
/* @__PURE__ */ i(O, {
|
|
205
228
|
x1: u.x,
|
|
206
229
|
y1: u.y,
|
|
207
230
|
x2: f.x,
|
|
208
231
|
y2: f.y
|
|
209
232
|
}),
|
|
210
|
-
/* @__PURE__ */ i(
|
|
233
|
+
/* @__PURE__ */ i(k, {
|
|
211
234
|
at: u,
|
|
212
235
|
label: "Gradient center",
|
|
213
236
|
onDrag: (t, r) => l({
|
|
@@ -215,7 +238,7 @@ function T(e, t, n, o, s) {
|
|
|
215
238
|
center: n(t)
|
|
216
239
|
}, r)
|
|
217
240
|
}),
|
|
218
|
-
/* @__PURE__ */ i(
|
|
241
|
+
/* @__PURE__ */ i(k, {
|
|
219
242
|
at: f,
|
|
220
243
|
label: "Gradient angle",
|
|
221
244
|
onDrag: (t, r) => {
|
|
@@ -228,14 +251,14 @@ function T(e, t, n, o, s) {
|
|
|
228
251
|
})
|
|
229
252
|
] });
|
|
230
253
|
}
|
|
231
|
-
var
|
|
232
|
-
function
|
|
254
|
+
var D = 1;
|
|
255
|
+
function O(e) {
|
|
233
256
|
return /* @__PURE__ */ i("line", {
|
|
234
|
-
className:
|
|
257
|
+
className: w.guide,
|
|
235
258
|
...e
|
|
236
259
|
});
|
|
237
260
|
}
|
|
238
|
-
function
|
|
261
|
+
function k({ at: e, label: t, onDrag: n }) {
|
|
239
262
|
let r = g(e), a = f({
|
|
240
263
|
onStart: () => {
|
|
241
264
|
r.current = e;
|
|
@@ -251,15 +274,15 @@ function O({ at: e, label: t, onDrag: n }) {
|
|
|
251
274
|
}
|
|
252
275
|
});
|
|
253
276
|
return /* @__PURE__ */ i("circle", {
|
|
254
|
-
className:
|
|
277
|
+
className: w.handle,
|
|
255
278
|
cx: e.x,
|
|
256
279
|
cy: e.y,
|
|
257
|
-
r:
|
|
280
|
+
r: A,
|
|
258
281
|
role: "button",
|
|
259
282
|
"aria-label": t,
|
|
260
283
|
tabIndex: 0,
|
|
261
284
|
onKeyDown: (t) => {
|
|
262
|
-
let r = t.shiftKey ?
|
|
285
|
+
let r = t.shiftKey ? j * 10 : j, i = 0, a = 0;
|
|
263
286
|
if (t.key === "ArrowLeft") i = -r;
|
|
264
287
|
else if (t.key === "ArrowRight") i = r;
|
|
265
288
|
else if (t.key === "ArrowUp") a = -r;
|
|
@@ -275,17 +298,17 @@ function O({ at: e, label: t, onDrag: n }) {
|
|
|
275
298
|
...a
|
|
276
299
|
});
|
|
277
300
|
}
|
|
278
|
-
var
|
|
301
|
+
var A = 7, j = 1;
|
|
279
302
|
//#endregion
|
|
280
303
|
//#region src/components/GradientEditor/SceneGradientHandles.tsx
|
|
281
|
-
function
|
|
282
|
-
let { scene: t, containerRef: n, nodeId: r, slot: a, view: c, className: l } = e, u = d(), f = p(t, n, r, { view: c }), m = g(null), h = f ? N(
|
|
304
|
+
function M(e) {
|
|
305
|
+
let { scene: t, containerRef: n, nodeId: r, slot: a, view: c, className: l } = e, u = d(), f = p(t, n, r, { view: c }), m = g(null), h = f ? P(N(t, r, a)) : null;
|
|
283
306
|
if (!f || !h) return null;
|
|
284
307
|
let _ = (e, t) => {
|
|
285
308
|
let n = s(e, f.box), r = a === "fill" ? "setFill" : "setStroke";
|
|
286
309
|
m.current ? m.current.update({ paint: n }) : m.current = u?.begin(r, { paint: n }) ?? null, t === "commit" && m.current && (m.current.end("commit"), m.current = null);
|
|
287
310
|
};
|
|
288
|
-
return /* @__PURE__ */ i(
|
|
311
|
+
return /* @__PURE__ */ i(T, {
|
|
289
312
|
value: o(h, f.box),
|
|
290
313
|
toScreen: f.toScreen,
|
|
291
314
|
toLocal: f.toLocal,
|
|
@@ -296,15 +319,15 @@ function j(e) {
|
|
|
296
319
|
onChange: (e) => _(e, "commit")
|
|
297
320
|
});
|
|
298
321
|
}
|
|
299
|
-
function
|
|
322
|
+
function N(e, t, n) {
|
|
300
323
|
if (t == null) return;
|
|
301
324
|
let r = e.nodes.get(t)?.data;
|
|
302
325
|
if (r) return n === "fill" ? r.fill : r.stroke?.paint;
|
|
303
326
|
}
|
|
304
|
-
function
|
|
327
|
+
function P(e) {
|
|
305
328
|
return l(e) ? e : null;
|
|
306
329
|
}
|
|
307
330
|
//#endregion
|
|
308
|
-
export { v as i,
|
|
331
|
+
export { v as i, T as n, C as r, M as t };
|
|
309
332
|
|
|
310
|
-
//# sourceMappingURL=GradientEditor-
|
|
333
|
+
//# sourceMappingURL=GradientEditor-B_ymIr4Q.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GradientEditor-B_ymIr4Q.js","names":[],"sources":["../../src/paintGradientTrack.tsx","../../src/components/GradientEditor/GradientEditor.module.css","../../src/components/GradientEditor/GradientEditor.tsx","../../src/components/GradientEditor/GradientHandles.module.css","../../src/components/GradientEditor/GradientHandles.tsx","../../src/components/GradientEditor/SceneGradientHandles.tsx"],"sourcesContent":["import type { ReactNode, CSSProperties } from 'react';\nimport type { TrackCtx } from './components/Slider';\n\n/**\n * Options for {@link paintGradientTrack}.\n *\n * `gradient` maps a normalized position along the track (0 to 1) to a CSS\n * color; `samples` is how many stops the resulting linear-gradient uses.\n * `activeRange`, given in the slider's own value units, keeps that span at\n * full strength and dims + hatches the rest.\n */\nexport type GradientTrackOpts = {\n gradient: (t: number) => string;\n samples?: number;\n activeRange?: [number, number];\n hatch?: {\n angleDeg?: number;\n stripe?: number;\n gap?: number;\n dim?: number;\n };\n};\n\nconst DEFAULT_HATCH = { angleDeg: 135, stripe: 2, gap: 4, dim: 75 };\n\n/**\n * Builds a `Slider` `renderTrack` function that paints the track as a\n * sampled color gradient, optionally dimming and hatching the portions\n * outside an active range.\n */\nexport function paintGradientTrack(opts: GradientTrackOpts): (ctx: TrackCtx) => ReactNode {\n const { gradient, samples = 16, activeRange, hatch } = opts;\n\n return (ctx: TrackCtx) => {\n const stops: string[] = [];\n for (let i = 0; i <= samples; i++) {\n const t = i / samples;\n stops.push(`${gradient(t)} ${(t * 100).toFixed(1)}%`);\n }\n const baseGradient = `linear-gradient(to right, ${stops.join(', ')})`;\n\n const layers: string[] = [];\n if (activeRange) {\n const lowPct = ctx.valueToFraction(activeRange[0]) * 100;\n const highPct = ctx.valueToFraction(activeRange[1]) * 100;\n const h = { ...DEFAULT_HATCH, ...hatch };\n const stripe = `repeating-linear-gradient(${h.angleDeg}deg, transparent 0 ${h.stripe}px, var(--wzl-surface) ${h.stripe}px ${h.stripe + h.gap}px)`;\n const dimColor = `color-mix(in srgb, var(--wzl-surface) ${h.dim}%, transparent)`;\n const dimOverlay = `linear-gradient(${dimColor}, ${dimColor})`;\n\n if (lowPct > 0) {\n layers.push(`${dimOverlay} left 0 / ${lowPct.toFixed(2)}% 100% no-repeat`);\n layers.push(`${stripe} left 0 / ${lowPct.toFixed(2)}% 100% no-repeat`);\n }\n if (highPct < 100) {\n const wR = (100 - highPct).toFixed(2);\n layers.push(`${dimOverlay} right 0 / ${wR}% 100% no-repeat`);\n layers.push(`${stripe} right 0 / ${wR}% 100% no-repeat`);\n }\n }\n layers.push(baseGradient);\n\n const style: CSSProperties = {\n position: 'absolute',\n inset: 0,\n background: layers.join(', '),\n };\n return <div style={style} />;\n };\n}\n",".root {\n display: flex;\n flex-direction: column;\n gap: 8px;\n min-inline-size: 0;\n}\n\n.swatches {\n display: flex;\n flex-wrap: wrap;\n gap: 6px;\n}\n\n/* Each stop's opacity slider would otherwise stretch the row to a width no\n * properties panel has; the chip stays legible, the slider yields. */\n.swatch {\n flex: 0 1 auto;\n min-inline-size: 0;\n}\n","import { useCallback, type ReactElement } from 'react';\nimport {\n sampleGradientStops,\n withGradientKind,\n type ColorSpace,\n type GradStop,\n type GradientFill,\n type GradientKind,\n} from '@weasel-js/core';\nimport { Slider, type Thumb } from '../Slider';\nimport { ColorField } from '../ColorField';\nimport { ToggleBar, type ToggleBarItem } from '../ToggleBar';\nimport { paintGradientTrack } from '../../paintGradientTrack';\nimport s from './GradientEditor.module.css';\n\nconst KINDS: readonly ToggleBarItem<GradientKind>[] = [\n { value: 'linear-gradient', label: 'Linear' },\n { value: 'radial-gradient', label: 'Radial' },\n { value: 'conic-gradient', label: 'Conic' },\n];\n\nconst SPACES: readonly ToggleBarItem<ColorSpace>[] = [\n { value: 'rgb', label: 'sRGB' },\n { value: 'oklab', label: 'OKLab' },\n { value: 'oklch', label: 'OKLCh' },\n];\n\n/** Fewer than two stops is not a gradient any renderer can ramp between. */\nconst MIN_STOPS = 2;\n\n/**\n * Props for {@link GradientEditor}. `onInput` fires throughout a gesture and\n * `onChange` once at its end.\n */\nexport interface GradientEditorProps {\n /** The gradient being edited. */\n value: GradientFill;\n /**\n * Live value during a gesture — a stop drag, a color-picker scrub. Wire\n * it for preview; it fires many times per gesture and must not be\n * written to history.\n */\n onInput?: (next: GradientFill) => void;\n /** Committed value: one call per completed gesture. Pair with an\n * undoable write. */\n onChange: (next: GradientFill) => void;\n /** Show the linear / radial / conic switch. Default true; turn it off\n * when the surrounding UI already owns the kind. */\n kindSwitch?: boolean;\n /** Show the sRGB / OKLab / OKLCh switch, which writes `interpolate`.\n * Default true. */\n spaceSwitch?: boolean;\n className?: string;\n}\n\ntype StopThumb = Thumb & { color: string };\n\n/**\n * Editor for a gradient's kind and stop list.\n *\n * Geometry (`from`/`to`, `center`, `radius`, `angle`) is deliberately not\n * edited here — on a canvas that belongs on the artwork, via\n * `<GradientHandles>`. This component owns the parts with no spatial\n * meaning, so it composes into a properties panel at any width.\n *\n * Stops are addressed by their position in `value.stops`, which is never\n * reordered — dragging one stop past another leaves both indices alone, so\n * a drag can cross a neighbour without the two swapping under the pointer.\n * Rendering sorts a copy.\n */\nexport function GradientEditor(props: GradientEditorProps): ReactElement {\n const { value, onInput, onChange, kindSwitch = true, spaceSwitch = true, className } = props;\n const stops = value.stops;\n const space = value.interpolate ?? 'rgb';\n\n const withStops = useCallback(\n (next: GradStop[]): GradientFill => ({ ...value, stops: next }),\n [value],\n );\n\n const thumbs: StopThumb[] = stops.map((stop) => ({ value: stop.offset, color: stop.color }));\n\n const applyThumbs = (next: StopThumb[]): GradStop[] =>\n next.map((t) => ({ offset: t.value, color: t.color }));\n\n const setStopColor = (index: number, color: string): GradStop[] =>\n stops.map((stop, i) => (i === index ? { ...stop, color } : stop));\n\n // Sorted view for the swatch row, carrying each stop's real index so a\n // recolor writes back to the right entry.\n const ordered = stops\n .map((stop, index) => ({ stop, index }))\n .sort((a, b) => a.stop.offset - b.stop.offset);\n\n return (\n <div className={[s.root, className].filter(Boolean).join(' ')}>\n {kindSwitch && (\n <ToggleBar<GradientKind>\n items={KINDS}\n value={value.fill}\n size=\"sm\"\n ariaLabel=\"Gradient kind\"\n onChange={(kind) => kind && onChange(withGradientKind(value, kind))}\n />\n )}\n\n <Slider<StopThumb>\n min={0}\n max={1}\n step={0.005}\n constraint=\"free\"\n thumbs={thumbs}\n ariaLabel=\"Gradient stops\"\n readoutPlacement=\"none\"\n onInput={(next) => onInput?.(withStops(applyThumbs(next)))}\n onChange={(next) => onChange(withStops(applyThumbs(next)))}\n onAddThumb={(at) => ({ value: at, color: sampleGradientStops(stops, at, space) })}\n onRemoveThumb={() => stops.length > MIN_STOPS}\n renderTrack={paintGradientTrack({\n gradient: (t) => sampleGradientStops(stops, t, space),\n // The track lerps between samples in sRGB whatever the gradient does,\n // so a hue arc needs more of them to not read as a straight line.\n samples: space === 'rgb' ? 32 : 64,\n })}\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({ ...value, interpolate: next })}\n />\n )}\n\n <div className={s.swatches}>\n {ordered.map(({ stop, index }) => (\n <ColorField\n key={index}\n value={stop.color}\n alpha\n aria-label={`Stop ${index + 1} at ${Math.round(stop.offset * 100)}%`}\n className={s.swatch}\n onInput={(hex) => onInput?.(withStops(setStopColor(index, hex)))}\n onChange={(hex) => onChange(withStops(setStopColor(index, hex)))}\n />\n ))}\n </div>\n </div>\n );\n}\n","/* The overlay covers the canvas but must not intercept tool input; only the\n * handles opt back into hit-testing. */\n.overlay {\n position: absolute;\n inset: 0;\n pointer-events: none;\n}\n\n/* These sit over artwork of unknown color, not over the app's own surface,\n * so they are deliberately not themed: a themed handle disappears against\n * whatever the user painted underneath. White-on-dark reads on anything,\n * which is why every editor draws handles this way. */\n.guide {\n fill: none;\n stroke: #ffffff;\n stroke-opacity: 0.7;\n stroke-dasharray: 4 4;\n paint-order: stroke;\n}\n\n.handle {\n fill: #ffffff;\n stroke: #222222;\n stroke-width: 2;\n cursor: grab;\n pointer-events: auto;\n}\n\n.handle:active {\n cursor: grabbing;\n}\n\n.handle:focus-visible {\n outline: 2px solid var(--wzl-accent, #4a9eff);\n outline-offset: 2px;\n}\n","import { useRef, type KeyboardEvent as ReactKeyboardEvent, type ReactElement, type ReactNode } from 'react';\nimport { useHandleDrag, gradientGeometry, type GradientFill } from '@weasel-js/core';\nimport s from './GradientHandles.module.css';\n\n/** Structural, and deliberately not exported — `Plot2D` and `CurveEditor`\n * each publish their own `Point`, and a third would only be ambiguous at\n * the package barrel. Consumers pass any `{ x, y }`. */\ninterface Point {\n x: number;\n y: number;\n}\n\n/**\n * Props for {@link GradientHandles}. `onInput` fires throughout a drag and\n * `onChange` once at its end.\n */\nexport interface GradientHandlesProps {\n /**\n * The gradient whose geometry these handles move, in a **resolved,\n * isotropic** frame — one where `radius` is a length in the same units as\n * `center.x` and a right angle is a right angle.\n *\n * A `units: 'bounds'` gradient is not such a frame: `x` and `y` are\n * fractions of two different lengths, so a circle there is an ellipse on\n * screen and polar math silently mixes scales. Resolve it first with\n * `fillInPoseFrame(fill, box)` and convert edits back with\n * `fillToBoundsFrame(next, box)`.\n */\n value: GradientFill;\n /**\n * Gradient space → overlay pixels. For a `units: 'local'` gradient this\n * is the node's local-to-screen transform; for `'world'`, the view.\n */\n toScreen: (p: Point) => Point;\n /** Overlay pixels → gradient space. Must invert `toScreen`. */\n toLocal: (p: Point) => Point;\n /** Live during a drag — wire for preview, do not write to history. */\n onInput?: (next: GradientFill) => void;\n /** Committed at drag end: one call per gesture. */\n onChange: (next: GradientFill) => void;\n /** Overlay size in CSS pixels. */\n width: number;\n height: number;\n className?: string;\n}\n\n/**\n * Direct-manipulation handles for a gradient's geometry, drawn as an SVG\n * overlay above a canvas: endpoints for linear, center and radius for\n * radial, center and angle arm for conic.\n *\n * Positioning is entirely the consumer's `toScreen` / `toLocal` — this\n * component never sees a view or a scene node, so the same handles serve a\n * node-local gradient, a world-space one, and a plain unzoomed preview.\n *\n * The overlay ignores pointer events except on the handles themselves, so\n * it can sit over live canvas content without swallowing tool input.\n */\nexport function GradientHandles(props: GradientHandlesProps): ReactElement {\n const { value, toScreen, toLocal, onInput, onChange, width, height, className } = props;\n\n return (\n <svg\n className={[s.overlay, className].filter(Boolean).join(' ')}\n width={width}\n height={height}\n >\n {renderForKind(value, toScreen, toLocal, onInput, onChange)}\n </svg>\n );\n}\n\nfunction renderForKind(\n value: GradientFill,\n toScreen: (p: Point) => Point,\n toLocal: (p: Point) => Point,\n onInput: ((next: GradientFill) => void) | undefined,\n onChange: (next: GradientFill) => void,\n): ReactNode {\n const emit = (next: GradientFill, phase: 'input' | 'commit'): void => {\n if (phase === 'input') onInput?.(next);\n else onChange(next);\n };\n\n if (value.fill === 'linear-gradient') {\n const from = toScreen(value.from);\n const to = toScreen(value.to);\n return (\n <>\n <Guide x1={from.x} y1={from.y} x2={to.x} y2={to.y} />\n <DragPoint\n at={from}\n label=\"Gradient start\"\n onDrag={(p, phase) => emit({ ...value, from: toLocal(p) }, phase)}\n />\n <DragPoint\n at={to}\n label=\"Gradient end\"\n onDrag={(p, phase) => emit({ ...value, to: toLocal(p) }, phase)}\n />\n </>\n );\n }\n\n if (value.fill === 'radial-gradient') {\n const center = toScreen(value.center);\n // The radius handle rides the +x axis of gradient space, so it stays on\n // the drawn circle under a rotated or anisotropic transform.\n const edge = toScreen({ x: value.center.x + value.radius, y: value.center.y });\n const screenRadius = Math.hypot(edge.x - center.x, edge.y - center.y);\n return (\n <>\n <circle className={s.guide} cx={center.x} cy={center.y} r={screenRadius} />\n <DragPoint\n at={center}\n label=\"Gradient center\"\n onDrag={(p, phase) => emit({ ...value, center: toLocal(p) }, phase)}\n />\n <DragPoint\n at={edge}\n label=\"Gradient radius\"\n onDrag={(p, phase) => {\n const local = toLocal(p);\n const radius = Math.hypot(local.x - value.center.x, local.y - value.center.y);\n emit({ ...value, radius: Math.max(MIN_RADIUS, radius) }, phase);\n }}\n />\n </>\n );\n }\n\n const center = toScreen(value.center);\n const { radius } = gradientGeometry(value);\n const tip = toScreen({\n x: value.center.x + Math.cos(value.angle) * radius,\n y: value.center.y + Math.sin(value.angle) * radius,\n });\n return (\n <>\n <Guide x1={center.x} y1={center.y} x2={tip.x} y2={tip.y} />\n <DragPoint\n at={center}\n label=\"Gradient center\"\n onDrag={(p, phase) => emit({ ...value, center: toLocal(p) }, phase)}\n />\n <DragPoint\n at={tip}\n label=\"Gradient angle\"\n onDrag={(p, phase) => {\n const local = toLocal(p);\n const angle = Math.atan2(local.y - value.center.y, local.x - value.center.x);\n emit({ ...value, angle }, phase);\n }}\n />\n </>\n );\n}\n\n/** A radius of zero divides by zero in the shader's `t`; keep it off the floor. */\nconst MIN_RADIUS = 1;\n\nfunction Guide(props: { x1: number; y1: number; x2: number; y2: number }): ReactElement {\n return <line className={s.guide} {...props} />;\n}\n\nfunction DragPoint({\n at,\n label,\n onDrag,\n}: {\n at: Point;\n label: string;\n onDrag: (p: Point, phase: 'input' | 'commit') => void;\n}): ReactElement {\n const start = useRef<Point>(at);\n const drag = useHandleDrag<SVGCircleElement>({\n onStart: () => { start.current = at; },\n onMove: (p) => { onDrag(p, 'input'); },\n onEnd: ({ point, moved }) => {\n // A press that never moved is not an edit and must not write anything.\n if (moved) onDrag(point, 'commit');\n },\n // An abandoned gesture is not an edit either — put the live preview back\n // where it started rather than committing where it was left.\n onCancel: () => { onDrag(start.current, 'input'); },\n });\n const onKeyDown = (e: ReactKeyboardEvent<SVGCircleElement>): void => {\n const amount = e.shiftKey ? KEY_STEP * 10 : KEY_STEP;\n let dx = 0;\n let dy = 0;\n if (e.key === 'ArrowLeft') dx = -amount;\n else if (e.key === 'ArrowRight') dx = amount;\n else if (e.key === 'ArrowUp') dy = -amount;\n else if (e.key === 'ArrowDown') dy = amount;\n else return;\n e.preventDefault();\n const next = { x: at.x + dx, y: at.y + dy };\n onDrag(next, 'input');\n onDrag(next, 'commit');\n };\n return (\n <circle\n className={s.handle}\n cx={at.x}\n cy={at.y}\n r={HANDLE_RADIUS}\n // Not `slider`: the handle carries a 2-D position, not one value, so\n // it has no `aria-valuenow` to honor the role's contract with.\n role=\"button\"\n aria-label={label}\n tabIndex={0}\n onKeyDown={onKeyDown}\n {...drag}\n />\n );\n}\n\nconst HANDLE_RADIUS = 7;\n\n/** One arrow-key step, in overlay pixels. */\nconst KEY_STEP = 1;\n","import { useRef, type ReactElement, type RefObject } from 'react';\nimport {\n fillInPoseFrame,\n fillToBoundsFrame,\n isGradientFill,\n useActionsRegistry,\n useNodeOverlayFrame,\n type FillStyle,\n type GradientFill,\n type RectPose,\n type Scene,\n type Stroke,\n type UiOngoingControl,\n type View,\n} from '@weasel-js/core';\nimport { GradientHandles } from './GradientHandles';\n\n/** The paint slots a node carries. Either may hold a gradient, and each has\n * its own action, so the overlay is told which one it is editing. */\nexport type PaintSlot = 'fill' | 'stroke';\n\n/** What `SceneGradientHandles` reads off a node. Every field is optional, so\n * any richer app data shape satisfies it. */\nexport interface PaintedNodeData {\n fill?: FillStyle | null;\n stroke?: Stroke | null;\n}\n\nexport interface SceneGradientHandlesProps<\n TData extends PaintedNodeData,\n TLayer extends string,\n TPose extends RectPose,\n> {\n scene: Scene<TData, TLayer, TPose>;\n /** The element the overlay is positioned in. Must be the canvas's own box,\n * or the handles land somewhere other than the paint. */\n containerRef: RefObject<HTMLElement | null>;\n /** The node whose paint is being edited — usually the lone selected id. */\n nodeId: string | null | undefined;\n /** Which of the node's two paints these handles move. */\n slot: PaintSlot;\n /** Current viewport; a thunk is re-read per projection. See\n * `useNodeOverlayFrame`. */\n view?: View | (() => View);\n className?: string;\n}\n\n/**\n * Scene-aware `GradientHandles`: on-canvas geometry handles for the gradient\n * in one node's `fill` or `stroke`, committed through the `setFill` /\n * `setStroke` actions as a single undo entry per drag.\n *\n * Renders nothing unless the targeted slot holds a gradient. The node stores\n * its gradient in `units: 'bounds'` — fractions of its own box, so the paint\n * survives pan, zoom and resize — which is not a frame polar math can work\n * in; the handles get it resolved onto the box and every edit is normalized\n * back on the way out.\n *\n * `slot` is a prop rather than state the kit keeps: an app that edits fill\n * and stroke separately already knows which one has focus.\n */\nexport function SceneGradientHandles<\n TData extends PaintedNodeData,\n TLayer extends string,\n TPose extends RectPose,\n>(props: SceneGradientHandlesProps<TData, TLayer, TPose>): ReactElement | null {\n const { scene, containerRef, nodeId, slot, view, className } = props;\n const actions = useActionsRegistry();\n const frame = useNodeOverlayFrame(scene, containerRef, nodeId, { view });\n const ctrlRef = useRef<UiOngoingControl | null>(null);\n\n const gradient = frame ? gradientInSlot(paintOf(scene, nodeId, slot)) : null;\n if (!frame || !gradient) return null;\n\n const dispatch = (next: GradientFill, phase: 'input' | 'commit'): void => {\n const paint = fillToBoundsFrame(next, frame.box);\n const id = slot === 'fill' ? 'setFill' : 'setStroke';\n if (!ctrlRef.current) ctrlRef.current = actions?.begin(id, { paint }) ?? null;\n else ctrlRef.current.update({ paint });\n if (phase === 'commit' && ctrlRef.current) {\n ctrlRef.current.end('commit');\n ctrlRef.current = null;\n }\n };\n\n return (\n <GradientHandles\n value={fillInPoseFrame(gradient, frame.box) as GradientFill}\n toScreen={frame.toScreen}\n toLocal={frame.toLocal}\n width={frame.width}\n height={frame.height}\n className={className}\n onInput={(next) => dispatch(next, 'input')}\n onChange={(next) => dispatch(next, 'commit')}\n />\n );\n}\n\nfunction paintOf<TData extends PaintedNodeData, TLayer extends string, TPose extends RectPose>(\n scene: Scene<TData, TLayer, TPose>,\n nodeId: string | null | undefined,\n slot: PaintSlot,\n): FillStyle | null | undefined {\n if (nodeId == null) return undefined;\n const data = (scene.nodes as ReadonlyMap<string, { data: TData }>).get(nodeId)?.data;\n if (!data) return undefined;\n return slot === 'fill' ? data.fill : data.stroke?.paint;\n}\n\nfunction gradientInSlot(paint: FillStyle | null | undefined): GradientFill | null {\n return isGradientFill(paint) ? paint : null;\n}\n"],"mappings":";;;;;;;AAuBA,IAAM,IAAgB;CAAE,UAAU;CAAK,QAAQ;CAAG,KAAK;CAAG,KAAK;CAAI;AAOnE,SAAgB,EAAmB,GAAuD;CACxF,IAAM,EAAE,aAAU,aAAU,IAAI,gBAAa,aAAU;AAEvD,SAAQ,MAAkB;EACxB,IAAM,IAAkB,EAAE;AAC1B,OAAK,IAAI,IAAI,GAAG,KAAK,GAAS,KAAK;GACjC,IAAM,IAAI,IAAI;AACd,KAAM,KAAK,GAAG,EAAS,EAAE,CAAC,IAAI,IAAI,KAAK,QAAQ,EAAE,CAAC,GAAG;;EAEvD,IAAM,IAAe,6BAA6B,EAAM,KAAK,KAAK,CAAC,IAE7D,IAAmB,EAAE;AAC3B,MAAI,GAAa;GACf,IAAM,IAAS,EAAI,gBAAgB,EAAY,GAAG,GAAG,KAC/C,IAAU,EAAI,gBAAgB,EA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