@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.
- package/dist/chunks/ActionBar-xA73vzzF.js +64 -0
- package/dist/chunks/ActionBar-xA73vzzF.js.map +1 -0
- package/dist/chunks/{Badge-D2aD7xVL.js → Badge-jYQjrTKc.js} +235 -264
- package/dist/chunks/{Badge-D2aD7xVL.js.map → Badge-jYQjrTKc.js.map} +1 -1
- package/dist/chunks/BandEditor-Dd0egAgE.js.map +1 -1
- package/dist/chunks/{Button-BIdXHQOx.js → Button-XB-T75YL.js} +2 -2
- package/dist/chunks/{Button-BIdXHQOx.js.map → Button-XB-T75YL.js.map} +1 -1
- package/dist/chunks/{ButtonBar-DIQTe5GQ.js → ButtonBar-CIMKPPRS.js} +7 -9
- package/dist/chunks/{ButtonBar-DIQTe5GQ.js.map → ButtonBar-CIMKPPRS.js.map} +1 -1
- package/dist/chunks/Callout-BUn0dP_S.js +115 -0
- package/dist/chunks/Callout-BUn0dP_S.js.map +1 -0
- package/dist/chunks/Checkbox-DFn-x0JO.js +37 -0
- package/dist/chunks/Checkbox-DFn-x0JO.js.map +1 -0
- package/dist/chunks/{CloseButton-C2J7wVfo.js → CloseButton-BmNmRVtb.js} +3 -3
- package/dist/chunks/{CloseButton-C2J7wVfo.js.map → CloseButton-BmNmRVtb.js.map} +1 -1
- package/dist/chunks/ColorField-BLs9fbeq.js +90 -0
- package/dist/chunks/ColorField-BLs9fbeq.js.map +1 -0
- package/dist/chunks/{ColorModeControl-BewxA0rX.js → ColorModeControl-DaVJ-SyX.js} +3 -3
- package/dist/chunks/{ColorModeControl-BewxA0rX.js.map → ColorModeControl-DaVJ-SyX.js.map} +1 -1
- package/dist/chunks/ComboBox-CuTLRmUg.js +138 -0
- package/dist/chunks/ComboBox-CuTLRmUg.js.map +1 -0
- package/dist/chunks/{CurveEditor-DUVjd25R.js → CurveEditor-jVBEqqdv.js} +90 -87
- package/dist/chunks/CurveEditor-jVBEqqdv.js.map +1 -0
- package/dist/chunks/{DataGrid-LZ2JgY2Y.js → DataGrid-BklgBqS0.js} +2 -2
- package/dist/chunks/{DataGrid-LZ2JgY2Y.js.map → DataGrid-BklgBqS0.js.map} +1 -1
- package/dist/chunks/{DetailList-BKomDzg5.js → DetailList-DFtqdOJj.js} +7 -7
- package/dist/chunks/DetailList-DFtqdOJj.js.map +1 -0
- package/dist/chunks/{DetentSlider-5uQPFucv.js → DetentSlider-Bh7EpMqT.js} +2 -2
- package/dist/chunks/{DetentSlider-5uQPFucv.js.map → DetentSlider-Bh7EpMqT.js.map} +1 -1
- package/dist/chunks/{Dialog-DGFutQ--.js → Dialog-DKfsk5VN.js} +3 -3
- package/dist/chunks/{Dialog-DGFutQ--.js.map → Dialog-DKfsk5VN.js.map} +1 -1
- package/dist/chunks/{DragGhost-B5_hb9W9.js → DragGhost-BeYDJyLZ.js} +2 -2
- package/dist/chunks/{DragGhost-B5_hb9W9.js.map → DragGhost-BeYDJyLZ.js.map} +1 -1
- package/dist/chunks/{FallthroughDiagram-BEHiM5IS.js → FallthroughDiagram-C7BUe8eU.js} +3 -3
- package/dist/chunks/{FallthroughDiagram-BEHiM5IS.js.map → FallthroughDiagram-C7BUe8eU.js.map} +1 -1
- package/dist/chunks/Field-DsBlnFKf.js +25 -0
- package/dist/chunks/Field-DsBlnFKf.js.map +1 -0
- package/dist/chunks/FillStrokeSwatch-CgsYQgew.js +112 -0
- package/dist/chunks/FillStrokeSwatch-CgsYQgew.js.map +1 -0
- package/dist/chunks/{FontFamilySelect-DkRgNtag.js → FontFamilySelect-CGJ5OIOy.js} +2 -2
- package/dist/chunks/FontFamilySelect-CGJ5OIOy.js.map +1 -0
- package/dist/chunks/FontWeightSelect-RbcXYJPS.js +49 -0
- package/dist/chunks/FontWeightSelect-RbcXYJPS.js.map +1 -0
- package/dist/chunks/{GestureRoute-C_YGl7bJ.js → GestureRoute-BXESrHI0.js} +2 -2
- package/dist/chunks/{GestureRoute-C_YGl7bJ.js.map → GestureRoute-BXESrHI0.js.map} +1 -1
- package/dist/chunks/GradientEditor-DypXzMc-.js +325 -0
- package/dist/chunks/GradientEditor-DypXzMc-.js.map +1 -0
- package/dist/chunks/{Icon-CcVjdq2C.js → Icon--B1ME-6c.js} +3 -1
- package/dist/chunks/Icon--B1ME-6c.js.map +1 -0
- package/dist/chunks/{Input-CHmkfYaD.js → Input-CzwvCZs_.js} +10 -15
- package/dist/chunks/Input-CzwvCZs_.js.map +1 -0
- package/dist/chunks/{ItemList-Cm-HUWCi.js → ItemList-CRu9y7hL.js} +2 -2
- package/dist/chunks/ItemList-CRu9y7hL.js.map +1 -0
- package/dist/chunks/{Jog-DRmfrkCg.js → Jog-DfNUYejm.js} +8 -8
- package/dist/chunks/Jog-DfNUYejm.js.map +1 -0
- package/dist/chunks/{LayerList-wCI1EueM.js → LayerList-CsDqwYh-.js} +151 -153
- package/dist/chunks/LayerList-CsDqwYh-.js.map +1 -0
- package/dist/chunks/ListEditor-BnGzqERm.js +72 -0
- package/dist/chunks/ListEditor-BnGzqERm.js.map +1 -0
- package/dist/chunks/MenuButton-L9f5vido.js +75 -0
- package/dist/chunks/MenuButton-L9f5vido.js.map +1 -0
- package/dist/chunks/MeshEditor-GbqqiPk8.js +199 -0
- package/dist/chunks/MeshEditor-GbqqiPk8.js.map +1 -0
- package/dist/chunks/{NumberField-BnJxcazc.js → NumberField-DLXXgh48.js} +26 -23
- package/dist/chunks/NumberField-DLXXgh48.js.map +1 -0
- package/dist/chunks/{OptionsBar-ujxYidhj.js → OptionsBar-DeTAjVb7.js} +6 -8
- package/dist/chunks/{OptionsBar-ujxYidhj.js.map → OptionsBar-DeTAjVb7.js.map} +1 -1
- package/dist/chunks/PaintField-C0hoXc0Y.js +63 -0
- package/dist/chunks/PaintField-C0hoXc0Y.js.map +1 -0
- package/dist/chunks/PaintInput-jQRxM95Y.js +132 -0
- package/dist/chunks/PaintInput-jQRxM95Y.js.map +1 -0
- package/dist/chunks/PatternPicker-CaMYXzhF.js +135 -0
- package/dist/chunks/PatternPicker-CaMYXzhF.js.map +1 -0
- package/dist/chunks/{Plot2D-CTXHkL5p.js → Plot2D-BHNbgCAl.js} +7 -7
- package/dist/chunks/Plot2D-BHNbgCAl.js.map +1 -0
- package/dist/chunks/{PointPlotter-ldI4RrU1.js → PointPlotter-BZ_vk6gV.js} +2 -2
- package/dist/chunks/{PointPlotter-ldI4RrU1.js.map → PointPlotter-BZ_vk6gV.js.map} +1 -1
- package/dist/chunks/{Powerline-DNyH885r.js → Powerline-6wIFmDik.js} +2 -2
- package/dist/chunks/{Powerline-DNyH885r.js.map → Powerline-6wIFmDik.js.map} +1 -1
- package/dist/chunks/{Prefs-ByA-x51i.js → Prefs-CkyldX-e.js} +83 -70
- package/dist/chunks/Prefs-CkyldX-e.js.map +1 -0
- package/dist/chunks/{Properties-DmAeQ3mk.js → Properties-D15c8NP-.js} +25 -25
- package/dist/chunks/{Properties-DmAeQ3mk.js.map → Properties-D15c8NP-.js.map} +1 -1
- package/dist/chunks/PropertyField-CV_Gw57S.js +686 -0
- package/dist/chunks/PropertyField-CV_Gw57S.js.map +1 -0
- package/dist/chunks/{RadioGroup-Bh4-12e-.js → RadioGroup-4dbzqvGy.js} +2 -2
- package/dist/chunks/{RadioGroup-Bh4-12e-.js.map → RadioGroup-4dbzqvGy.js.map} +1 -1
- package/dist/chunks/{RangeSlider-SEGE-7VF.js → RangeSlider-BxokZViJ.js} +8 -8
- package/dist/chunks/RangeSlider-BxokZViJ.js.map +1 -0
- package/dist/chunks/RecentColorsProvider-DHcfk25u.js +84 -0
- package/dist/chunks/RecentColorsProvider-DHcfk25u.js.map +1 -0
- package/dist/chunks/ResizeHandle-CbAgCQOt.js +81 -0
- package/dist/chunks/ResizeHandle-CbAgCQOt.js.map +1 -0
- package/dist/chunks/Select-BppLsJTz.js +236 -0
- package/dist/chunks/Select-BppLsJTz.js.map +1 -0
- package/dist/chunks/{SelectionPanel-BaQnX4Bs.js → SelectionPanel-Cm1qu-ZX.js} +14 -13
- package/dist/chunks/{SelectionPanel-BaQnX4Bs.js.map → SelectionPanel-Cm1qu-ZX.js.map} +1 -1
- package/dist/chunks/{SidebarPanel-BblDEz4G.js → SidebarPanel-AXQ0jRDx.js} +2 -2
- package/dist/chunks/{SidebarPanel-BblDEz4G.js.map → SidebarPanel-AXQ0jRDx.js.map} +1 -1
- package/dist/chunks/{Slider-YofwGOI4.js → Slider-Cl5RCeZ7.js} +19 -19
- package/dist/chunks/Slider-Cl5RCeZ7.js.map +1 -0
- package/dist/chunks/SwatchGrid-9ZPiDmxd.js +78 -0
- package/dist/chunks/SwatchGrid-9ZPiDmxd.js.map +1 -0
- package/dist/chunks/SwatchStrip-Cw0l8Om7.js +577 -0
- package/dist/chunks/SwatchStrip-Cw0l8Om7.js.map +1 -0
- package/dist/chunks/{ThemeSwitcher-BlsInAmR.js → ThemeSwitcher-DiBmMh_B.js} +3 -3
- package/dist/chunks/{ThemeSwitcher-BlsInAmR.js.map → ThemeSwitcher-DiBmMh_B.js.map} +1 -1
- package/dist/chunks/{Timeline-B39cwfMB.js → Timeline-pqnYk5cV.js} +244 -246
- package/dist/chunks/Timeline-pqnYk5cV.js.map +1 -0
- package/dist/chunks/Toast-C3ozq11V.js +170 -0
- package/dist/chunks/Toast-C3ozq11V.js.map +1 -0
- package/dist/chunks/{ToggleBar-BTYkBXU9.js → ToggleBar-Z2jZiguF.js} +6 -8
- package/dist/chunks/{ToggleBar-BTYkBXU9.js.map → ToggleBar-Z2jZiguF.js.map} +1 -1
- package/dist/chunks/{TokenPanel-CMDAOfYH.js → TokenPanel-DAkL6vwQ.js} +32 -32
- package/dist/chunks/TokenPanel-DAkL6vwQ.js.map +1 -0
- package/dist/chunks/{ToolButton-CAHBa08P.js → ToolButton-BURp4YIO.js} +7 -9
- package/dist/chunks/ToolButton-BURp4YIO.js.map +1 -0
- package/dist/chunks/{ToolOptionsBar-D_GCrBAN.js → ToolOptionsBar-COsTJ1cu.js} +3 -2
- package/dist/chunks/{ToolOptionsBar-D_GCrBAN.js.map → ToolOptionsBar-COsTJ1cu.js.map} +1 -1
- package/dist/chunks/{ToolPalette-OOWN51Xx.js → ToolPalette-DKDFWOX-.js} +7 -9
- package/dist/chunks/{ToolPalette-OOWN51Xx.js.map → ToolPalette-DKDFWOX-.js.map} +1 -1
- package/dist/chunks/{Tooltip-Clg2mhSt.js → Tooltip-C6eFCYxw.js} +2 -2
- package/dist/chunks/{Tooltip-Clg2mhSt.js.map → Tooltip-C6eFCYxw.js.map} +1 -1
- package/dist/chunks/Tree-Cc8lIzgM.js.map +1 -1
- package/dist/chunks/checkbox.module-DLQV9tMX.js +5 -0
- package/dist/chunks/checkbox.module-DLQV9tMX.js.map +1 -0
- package/dist/chunks/{createKeyframeLayer-DVl321_l.js → createKeyframeLayer-BTa4LyJE.js} +194 -208
- package/dist/chunks/createKeyframeLayer-BTa4LyJE.js.map +1 -0
- package/dist/chunks/field.module-Bh7BTKMh.js +15 -0
- package/dist/chunks/field.module-Bh7BTKMh.js.map +1 -0
- package/dist/chunks/formatShortcut-DRQrVThu.js.map +1 -1
- package/dist/chunks/handles-CqVANLtu.js +17 -0
- package/dist/chunks/handles-CqVANLtu.js.map +1 -0
- package/dist/chunks/{icons-BhcR1l64.js → icons-Dr2-r30x.js} +2 -2
- package/dist/chunks/icons-Dr2-r30x.js.map +1 -0
- package/dist/chunks/listbox.module-BcdVJMbm.js +8 -0
- package/dist/chunks/listbox.module-BcdVJMbm.js.map +1 -0
- package/dist/chunks/model-B1-gMBIW.js +386 -0
- package/dist/chunks/model-B1-gMBIW.js.map +1 -0
- package/dist/chunks/{portalHost-yTOVuCej.js → portalHost-CE70wLzo.js} +10 -6
- package/dist/chunks/portalHost-CE70wLzo.js.map +1 -0
- package/dist/chunks/prefField-BE_Ytr2H.js +229 -0
- package/dist/chunks/prefField-BE_Ytr2H.js.map +1 -0
- package/dist/chunks/{segmentTooltip-CStYHKzd.js → segmentTooltip-CGxCOWNz.js} +2 -2
- package/dist/chunks/{segmentTooltip-CStYHKzd.js.map → segmentTooltip-CGxCOWNz.js.map} +1 -1
- package/dist/chunks/segmentedControl.module-BzGXUL5G.js +11 -0
- package/dist/chunks/segmentedControl.module-BzGXUL5G.js.map +1 -0
- package/dist/chunks/useReorderDragList-CStYKjHl.js +133 -0
- package/dist/chunks/useReorderDragList-CStYKjHl.js.map +1 -0
- package/dist/chunks/useRovingTabIndex-D7u22Ia_.js +91 -0
- package/dist/chunks/useRovingTabIndex-D7u22Ia_.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/Badge/bases/ChamferedRect.d.ts.map +1 -1
- package/dist/components/Badge/index.js +1 -1
- package/dist/components/BandEditor/BandEditor.d.ts +1 -0
- package/dist/components/BandEditor/BandEditor.d.ts.map +1 -1
- package/dist/components/Button/index.js +1 -1
- package/dist/components/ButtonBar/ButtonBar.d.ts.map +1 -1
- package/dist/components/ButtonBar/index.js +1 -1
- package/dist/components/Callout/Callout.d.ts.map +1 -1
- package/dist/components/Callout/index.js +1 -1
- package/dist/components/Checkbox/Checkbox.d.ts +28 -13
- package/dist/components/Checkbox/Checkbox.d.ts.map +1 -1
- package/dist/components/Checkbox/index.js +1 -1
- package/dist/components/CloseButton/index.js +1 -1
- package/dist/components/ColorField/ColorField.d.ts.map +1 -1
- package/dist/components/ColorField/OpacityRange.d.ts +18 -0
- package/dist/components/ColorField/OpacityRange.d.ts.map +1 -0
- package/dist/components/ColorField/index.js +1 -1
- package/dist/components/ColorModeControl/index.js +1 -1
- package/dist/components/ComboBox/ComboBox.d.ts +7 -0
- package/dist/components/ComboBox/ComboBox.d.ts.map +1 -1
- package/dist/components/ComboBox/index.js +1 -1
- package/dist/components/CurveEditor/CurveEditor.d.ts.map +1 -1
- package/dist/components/CurveEditor/LayeredCurveEditor.d.ts.map +1 -1
- package/dist/components/CurveEditor/index.js +2 -2
- package/dist/components/DataGrid/index.js +1 -1
- package/dist/components/DetailList/index.js +1 -1
- package/dist/components/DetentSlider/index.js +1 -1
- package/dist/components/Dialog/index.js +1 -1
- package/dist/components/DragGhost/index.js +1 -1
- package/dist/components/FallthroughDiagram/index.js +1 -1
- package/dist/components/Field/index.js +1 -1
- package/dist/components/FillStrokeSwatch/FillStrokeSwatch.d.ts.map +1 -1
- package/dist/components/FillStrokeSwatch/index.js +1 -1
- package/dist/components/FontFamilySelect/FontFamilySelect.d.ts +20 -0
- package/dist/components/FontFamilySelect/FontFamilySelect.d.ts.map +1 -1
- package/dist/components/FontFamilySelect/index.js +1 -1
- package/dist/components/FontWeightSelect/FontWeightSelect.d.ts +26 -0
- package/dist/components/FontWeightSelect/FontWeightSelect.d.ts.map +1 -0
- package/dist/components/FontWeightSelect/index.d.ts +3 -0
- package/dist/components/FontWeightSelect/index.d.ts.map +1 -0
- package/dist/components/FontWeightSelect/index.js +2 -0
- package/dist/components/GestureRoute/index.js +1 -1
- package/dist/components/GradientEditor/GradientHandles.d.ts +1 -8
- package/dist/components/GradientEditor/GradientHandles.d.ts.map +1 -1
- package/dist/components/GradientEditor/SceneGradientHandles.d.ts +7 -5
- package/dist/components/GradientEditor/SceneGradientHandles.d.ts.map +1 -1
- package/dist/components/GradientEditor/handleOverlay.d.ts +41 -0
- package/dist/components/GradientEditor/handleOverlay.d.ts.map +1 -0
- package/dist/components/GradientEditor/index.js +1 -1
- package/dist/components/Input/Input.d.ts +1 -1
- package/dist/components/Input/Input.d.ts.map +1 -1
- package/dist/components/Input/index.js +1 -1
- package/dist/components/ItemList/ItemList.d.ts +32 -31
- package/dist/components/ItemList/ItemList.d.ts.map +1 -1
- package/dist/components/ItemList/index.js +1 -1
- package/dist/components/Jog/index.js +1 -1
- package/dist/components/LayerList/LayerList.d.ts.map +1 -1
- package/dist/components/LayerList/index.js +1 -1
- package/dist/components/ListEditor/ListEditor.d.ts.map +1 -1
- package/dist/components/ListEditor/index.js +1 -1
- package/dist/components/MenuButton/MenuButton.d.ts.map +1 -1
- package/dist/components/MenuButton/index.js +1 -1
- package/dist/components/MeshEditor/MeshEditor.d.ts +4 -3
- package/dist/components/MeshEditor/MeshEditor.d.ts.map +1 -1
- package/dist/components/MeshEditor/MeshHandles.d.ts +38 -0
- package/dist/components/MeshEditor/MeshHandles.d.ts.map +1 -0
- package/dist/components/MeshEditor/index.d.ts +2 -0
- package/dist/components/MeshEditor/index.d.ts.map +1 -1
- package/dist/components/MeshEditor/index.js +2 -2
- package/dist/components/NumberField/NumberField.d.ts +1 -1
- package/dist/components/NumberField/NumberField.d.ts.map +1 -1
- package/dist/components/NumberField/index.js +1 -1
- package/dist/components/OptionsBar/OptionsBar.d.ts.map +1 -1
- package/dist/components/OptionsBar/index.js +1 -1
- package/dist/components/PaintField/PaintField.d.ts.map +1 -1
- package/dist/components/PaintField/index.js +1 -1
- package/dist/components/PaintInput/PaintInput.d.ts.map +1 -1
- package/dist/components/PaintInput/index.js +1 -1
- package/dist/components/PatternPicker/PatternPicker.d.ts +6 -5
- package/dist/components/PatternPicker/PatternPicker.d.ts.map +1 -1
- package/dist/components/PatternPicker/index.js +1 -1
- package/dist/components/Plot2D/index.js +1 -1
- package/dist/components/PointPlotter/index.js +1 -1
- package/dist/components/Powerline/index.js +2 -2
- package/dist/components/Prefs/PrefsForm.d.ts +8 -0
- package/dist/components/Prefs/PrefsForm.d.ts.map +1 -1
- package/dist/components/Prefs/PrefsRail.d.ts +3 -2
- package/dist/components/Prefs/PrefsRail.d.ts.map +1 -1
- package/dist/components/Prefs/index.js +2 -2
- package/dist/components/Prefs/prefField.d.ts +13 -0
- package/dist/components/Prefs/prefField.d.ts.map +1 -1
- package/dist/components/Properties/PropertyField.d.ts +13 -2
- package/dist/components/Properties/PropertyField.d.ts.map +1 -1
- package/dist/components/Properties/index.js +3 -3
- package/dist/components/RadioGroup/index.js +1 -1
- package/dist/components/RangeSlider/index.js +1 -1
- package/dist/components/RecentColors/RecentColorsProvider.d.ts +24 -0
- package/dist/components/RecentColors/RecentColorsProvider.d.ts.map +1 -0
- package/dist/components/RecentColors/index.d.ts +5 -0
- package/dist/components/RecentColors/index.d.ts.map +1 -0
- package/dist/components/RecentColors/index.js +2 -0
- package/dist/components/RecentColors/recentColors.d.ts +39 -0
- package/dist/components/RecentColors/recentColors.d.ts.map +1 -0
- package/dist/components/ResizeHandle/ResizeHandle.d.ts.map +1 -1
- package/dist/components/ResizeHandle/index.js +1 -1
- package/dist/components/Select/Select.d.ts +6 -2
- package/dist/components/Select/Select.d.ts.map +1 -1
- package/dist/components/Select/index.js +1 -1
- package/dist/components/SelectionPanel/index.js +2 -2
- package/dist/components/SelectionPanel/renderLeaf.d.ts +12 -2
- package/dist/components/SelectionPanel/renderLeaf.d.ts.map +1 -1
- package/dist/components/SidebarPanel/index.js +1 -1
- package/dist/components/Slider/index.js +1 -1
- package/dist/components/SwatchGrid/SwatchGrid.d.ts.map +1 -1
- package/dist/components/SwatchGrid/index.js +1 -1
- package/dist/components/SwatchStrip/SwatchStrip.d.ts +44 -0
- package/dist/components/SwatchStrip/SwatchStrip.d.ts.map +1 -0
- package/dist/components/SwatchStrip/index.d.ts +5 -0
- package/dist/components/SwatchStrip/index.d.ts.map +1 -0
- package/dist/components/SwatchStrip/index.js +2 -0
- package/dist/components/SwatchStrip/palettes.d.ts +21 -0
- package/dist/components/SwatchStrip/palettes.d.ts.map +1 -0
- package/dist/components/ThemeSwitcher/index.js +1 -1
- package/dist/components/Timeline/AnimatedTimeline.d.ts +1 -0
- package/dist/components/Timeline/AnimatedTimeline.d.ts.map +1 -1
- package/dist/components/Timeline/EasingPicker.d.ts +3 -0
- package/dist/components/Timeline/EasingPicker.d.ts.map +1 -1
- package/dist/components/Timeline/LaneGraph.d.ts +1 -1
- package/dist/components/Timeline/LaneGraph.d.ts.map +1 -1
- package/dist/components/Timeline/Timeline.d.ts +10 -1
- package/dist/components/Timeline/Timeline.d.ts.map +1 -1
- package/dist/components/Timeline/Transport.d.ts +6 -0
- package/dist/components/Timeline/Transport.d.ts.map +1 -1
- package/dist/components/Timeline/index.js +1 -1
- package/dist/components/Timeline/keys.d.ts +1 -0
- package/dist/components/Timeline/keys.d.ts.map +1 -1
- package/dist/components/Toast/Toast.d.ts +12 -3
- package/dist/components/Toast/Toast.d.ts.map +1 -1
- package/dist/components/Toast/index.js +1 -1
- package/dist/components/ToggleBar/ToggleBar.d.ts.map +1 -1
- package/dist/components/ToggleBar/index.js +1 -1
- package/dist/components/TokenPanel/index.js +1 -1
- package/dist/components/TokenPanel/tokenTypes.d.ts +1 -0
- package/dist/components/TokenPanel/tokenTypes.d.ts.map +1 -1
- package/dist/components/ToolButton/ToolButton.d.ts +1 -10
- package/dist/components/ToolButton/ToolButton.d.ts.map +1 -1
- package/dist/components/ToolButton/index.js +1 -1
- package/dist/components/ToolOptionsBar/index.js +1 -1
- package/dist/components/ToolPalette/ToolPalette.d.ts.map +1 -1
- package/dist/components/ToolPalette/formatShortcut.d.ts +2 -0
- package/dist/components/ToolPalette/formatShortcut.d.ts.map +1 -1
- package/dist/components/ToolPalette/index.js +1 -1
- package/dist/components/Tooltip/index.js +1 -1
- package/dist/components/Tree/Tree.d.ts +27 -26
- package/dist/components/Tree/Tree.d.ts.map +1 -1
- package/dist/icons/index.d.ts +51 -0
- package/dist/icons/index.d.ts.map +1 -1
- package/dist/icons/paths.d.ts +2 -0
- package/dist/icons/paths.d.ts.map +1 -1
- package/dist/index.d.ts +4 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +98 -95
- package/dist/index.js.map +1 -1
- package/dist/overlays/portalHost.d.ts +6 -0
- package/dist/overlays/portalHost.d.ts.map +1 -1
- package/dist/style.css +1 -1
- package/dist/useAsyncOptions.d.ts.map +1 -1
- package/dist/useReorderDragList.d.ts.map +1 -1
- package/dist/useRovingTabIndex.d.ts +40 -39
- package/dist/useRovingTabIndex.d.ts.map +1 -1
- package/package.json +9 -9
- package/dist/chunks/ActionBar-DCq16yFA.js +0 -57
- package/dist/chunks/ActionBar-DCq16yFA.js.map +0 -1
- package/dist/chunks/Callout-ndW5_Bqx.js +0 -116
- package/dist/chunks/Callout-ndW5_Bqx.js.map +0 -1
- package/dist/chunks/Checkbox-DHXTUHO9.js +0 -47
- package/dist/chunks/Checkbox-DHXTUHO9.js.map +0 -1
- package/dist/chunks/ColorField-Yz_BkcCT.js +0 -69
- package/dist/chunks/ColorField-Yz_BkcCT.js.map +0 -1
- package/dist/chunks/ComboBox-B34H76CW.js +0 -138
- package/dist/chunks/ComboBox-B34H76CW.js.map +0 -1
- package/dist/chunks/CurveEditor-DUVjd25R.js.map +0 -1
- package/dist/chunks/DetailList-BKomDzg5.js.map +0 -1
- package/dist/chunks/Field--onYxXTF.js +0 -32
- package/dist/chunks/Field--onYxXTF.js.map +0 -1
- package/dist/chunks/FillStrokeSwatch-DNb0KXPk.js +0 -111
- package/dist/chunks/FillStrokeSwatch-DNb0KXPk.js.map +0 -1
- package/dist/chunks/FontFamilySelect-DkRgNtag.js.map +0 -1
- package/dist/chunks/GradientEditor-b7v4Ph3i.js +0 -363
- package/dist/chunks/GradientEditor-b7v4Ph3i.js.map +0 -1
- package/dist/chunks/Icon-CcVjdq2C.js.map +0 -1
- package/dist/chunks/Input-CHmkfYaD.js.map +0 -1
- package/dist/chunks/ItemList-Cm-HUWCi.js.map +0 -1
- package/dist/chunks/Jog-DRmfrkCg.js.map +0 -1
- package/dist/chunks/LayerList-wCI1EueM.js.map +0 -1
- package/dist/chunks/ListEditor-BeA60TAA.js +0 -71
- package/dist/chunks/ListEditor-BeA60TAA.js.map +0 -1
- package/dist/chunks/MenuButton-BSqEChJE.js +0 -70
- package/dist/chunks/MenuButton-BSqEChJE.js.map +0 -1
- package/dist/chunks/MeshEditor-D1HLZcAh.js +0 -87
- package/dist/chunks/MeshEditor-D1HLZcAh.js.map +0 -1
- package/dist/chunks/NumberField-BnJxcazc.js.map +0 -1
- package/dist/chunks/PaintField-DadOELMg.js +0 -62
- package/dist/chunks/PaintField-DadOELMg.js.map +0 -1
- package/dist/chunks/PaintInput-v8Y7MDbH.js +0 -121
- package/dist/chunks/PaintInput-v8Y7MDbH.js.map +0 -1
- package/dist/chunks/PatternPicker-R_EQtw2Q.js +0 -93
- package/dist/chunks/PatternPicker-R_EQtw2Q.js.map +0 -1
- package/dist/chunks/Plot2D-CTXHkL5p.js.map +0 -1
- package/dist/chunks/Prefs-ByA-x51i.js.map +0 -1
- package/dist/chunks/PropertyField-DfIJJ5GS.js +0 -673
- package/dist/chunks/PropertyField-DfIJJ5GS.js.map +0 -1
- package/dist/chunks/RangeSlider-SEGE-7VF.js.map +0 -1
- package/dist/chunks/ResizeHandle-rKVWyeTG.js +0 -79
- package/dist/chunks/ResizeHandle-rKVWyeTG.js.map +0 -1
- package/dist/chunks/Select-ClmKtyWg.js +0 -229
- package/dist/chunks/Select-ClmKtyWg.js.map +0 -1
- package/dist/chunks/Slider-YofwGOI4.js.map +0 -1
- package/dist/chunks/SwatchGrid-BYvA8Bmh.js +0 -73
- package/dist/chunks/SwatchGrid-BYvA8Bmh.js.map +0 -1
- package/dist/chunks/Timeline-B39cwfMB.js.map +0 -1
- package/dist/chunks/Toast-BF9GE0HC.js +0 -126
- package/dist/chunks/Toast-BF9GE0HC.js.map +0 -1
- package/dist/chunks/TokenPanel-CMDAOfYH.js.map +0 -1
- package/dist/chunks/ToolButton-CAHBa08P.js.map +0 -1
- package/dist/chunks/createKeyframeLayer-DVl321_l.js.map +0 -1
- package/dist/chunks/icons-BhcR1l64.js.map +0 -1
- package/dist/chunks/model-BaF65rnX.js +0 -365
- package/dist/chunks/model-BaF65rnX.js.map +0 -1
- package/dist/chunks/portalHost-yTOVuCej.js.map +0 -1
- package/dist/chunks/prefField-BopW9bjx.js +0 -201
- package/dist/chunks/prefField-BopW9bjx.js.map +0 -1
- package/dist/chunks/segmentedControl.module-D6SzYJD7.js +0 -11
- package/dist/chunks/segmentedControl.module-D6SzYJD7.js.map +0 -1
- package/dist/chunks/useReorderDragList-FCMoFIzH.js +0 -131
- package/dist/chunks/useReorderDragList-FCMoFIzH.js.map +0 -1
- package/dist/chunks/useRovingTabIndex-Bp_hYm_h.js +0 -65
- package/dist/chunks/useRovingTabIndex-Bp_hYm_h.js.map +0 -1
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { i as e } from "./portalHost-CE70wLzo.js";
|
|
2
|
+
import { t } from "./listbox.module-BcdVJMbm.js";
|
|
3
|
+
import { t as n } from "./paintPreview-CuSZiHpR.js";
|
|
4
|
+
import { t as r } from "./PaintInput-jQRxM95Y.js";
|
|
5
|
+
import { usePaintKind as i } from "@weasel-js/core";
|
|
6
|
+
import { jsx as a, jsxs as o } from "react/jsx-runtime";
|
|
7
|
+
import "react";
|
|
8
|
+
import { Button as s, Dialog as c, DialogTrigger as l, Popover as u } from "react-aria-components";
|
|
9
|
+
var d = {
|
|
10
|
+
trigger: "_trigger_1uw1i_1",
|
|
11
|
+
swatch: "_swatch_1uw1i_27",
|
|
12
|
+
label: "_label_1uw1i_48",
|
|
13
|
+
popover: "_popover_1uw1i_57",
|
|
14
|
+
body: "_body_1uw1i_61"
|
|
15
|
+
};
|
|
16
|
+
//#endregion
|
|
17
|
+
//#region src/components/PaintField/PaintField.tsx
|
|
18
|
+
function f(e, t, n) {
|
|
19
|
+
return t ? "Mixed" : e === null ? "None" : e === void 0 ? "—" : n ?? e.fill ?? "solid";
|
|
20
|
+
}
|
|
21
|
+
function p(p) {
|
|
22
|
+
let { value: m, mixed: h = !1, unset: g = !1, kinds: _, allowNone: v = !0, onInput: y, onChange: b, className: x, portalContainer: S } = p, C = p["aria-label"], { anchor: w, portalProps: T } = e(S), E = h ? void 0 : n(m), D = i(m?.fill)?.label;
|
|
23
|
+
return /* @__PURE__ */ o(l, { children: [
|
|
24
|
+
w,
|
|
25
|
+
/* @__PURE__ */ o(s, {
|
|
26
|
+
className: [d.trigger, x].filter(Boolean).join(" "),
|
|
27
|
+
"aria-label": C,
|
|
28
|
+
...g ? { "data-unset": "" } : {},
|
|
29
|
+
...h ? { "data-mixed": "" } : {},
|
|
30
|
+
children: [/* @__PURE__ */ a("span", {
|
|
31
|
+
className: d.swatch,
|
|
32
|
+
"aria-hidden": "true",
|
|
33
|
+
...E ? { style: { background: E } } : { "data-empty": "" }
|
|
34
|
+
}), /* @__PURE__ */ a("span", {
|
|
35
|
+
className: d.label,
|
|
36
|
+
children: f(m, h, D)
|
|
37
|
+
})]
|
|
38
|
+
}),
|
|
39
|
+
/* @__PURE__ */ a(u, {
|
|
40
|
+
className: d.popover,
|
|
41
|
+
"data-weasel-overlay": "",
|
|
42
|
+
...T,
|
|
43
|
+
children: /* @__PURE__ */ a(c, {
|
|
44
|
+
className: `${t.surface} ${d.body}`,
|
|
45
|
+
"aria-label": C ? `${C} editor` : "Paint editor",
|
|
46
|
+
children: /* @__PURE__ */ a(r, {
|
|
47
|
+
value: m,
|
|
48
|
+
mixed: h,
|
|
49
|
+
unset: g,
|
|
50
|
+
kinds: _,
|
|
51
|
+
allowNone: v,
|
|
52
|
+
onInput: y,
|
|
53
|
+
onChange: b,
|
|
54
|
+
"aria-label": C
|
|
55
|
+
})
|
|
56
|
+
})
|
|
57
|
+
})
|
|
58
|
+
] });
|
|
59
|
+
}
|
|
60
|
+
//#endregion
|
|
61
|
+
export { p as t };
|
|
62
|
+
|
|
63
|
+
//# sourceMappingURL=PaintField-C0hoXc0Y.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PaintField-C0hoXc0Y.js","names":["RACButton","s","RACPopover","RACDialog","listbox","useOverlayPortal","paintPreviewCss","PaintInput","PaintField_module_default","kindLabel","mixed","paint","label","PaintField","props","ariaLabel","portalContainer","preview","value","usePaintKind","DialogTrigger","anchor","Button","className","unset","Popover","portalProps","Dialog","listbox_module_default"],"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}\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 { usePaintKind, type FillStyle, type PaintKind } from '@weasel-js/core';\nimport { useOverlayPortal, type OverlayPortalProps } from '../../overlays/portalHost';\nimport { paintPreviewCss } from '../../paintPreview';\nimport { PaintInput } from '../PaintInput';\nimport listbox from '../listbox.module.css';\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, label: string | undefined): string {\n if (mixed) return 'Mixed';\n if (paint === null) return 'None';\n if (paint === undefined) return '—';\n return 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 const label = usePaintKind(value?.fill)?.label;\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, label)}</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={`${listbox.surface} ${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":";;;;;;;;;;;;;;;;;ACqCA,SAASS,EAAU,GAAqC,GAAgB,GAAmC;CAIzG,OAHIC,IAAc,UACdC,MAAU,OAAa,SACvBA,MAAU,KAAA,IAAkB,MACzBC,KAAUD,EAAM,QAAQ;AACjC;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,mBAAgBT,EAAiBW,CAAe,GAC1DC,IAAUP,IAAQ,KAAA,IAAYJ,EAAgBY,CAAK,GACnDN,IAAQO,EAAaD,GAAO,IAAI,CAAC,EAAE;CAEzC,OACE,kBAACE,GAAD,EAAA,UAAA;EACGC;EACD,kBAACrB,GAAD;GACE,WAAW,CAACC,EAAE,SAASsB,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,WAAWT,EAAE;IACb,eAAY;IACZ,GAAKgB,IAAU,EAAE,OAAO,EAAE,YAAYA,EAAQ,EAAE,IAAI,EAAE,cAAc,GAAG;GACxE,CAAA,GACD,kBAAC,QAAD;IAAM,WAAWhB,EAAE;IAAQ,UAAAQ,EAAUS,GAAOR,GAAOE,CAAK;GAAQ,CAAA,CACvD;;EAGX,kBAACV,GAAD;GAAY,WAAWD,EAAE;GAAS,uBAAoB;GAAG,GAAIyB;GAC3D,UAAA,kBAACvB,GAAD;IAAW,WAAW,GAAGC,EAAQ,QAAQ,GAAGH,EAAE;IAAQ,cAAYc,IAAY,GAAGA,EAAU,WAAW;IACpG,UAAA,kBAACR,GAAD;KACS;KACA;KACA;KACA;KACI;KACF;KACC;KACV,cAAYQ;IACb,CAAA;GACQ,CAAA;EACD,CAAA;CACC,EAAA,CAAA;AAEnB"}
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import { a as e, t } from "./Icon--B1ME-6c.js";
|
|
2
|
+
import { n, t as r } from "./ColorField-BLs9fbeq.js";
|
|
3
|
+
import { t as i } from "./ToggleBar-Z2jZiguF.js";
|
|
4
|
+
import { r as a } from "./GradientEditor-DypXzMc-.js";
|
|
5
|
+
import { t as o } from "./PatternPicker-CaMYXzhF.js";
|
|
6
|
+
import { getAlpha01 as s, getPaintKind as c, paintAlpha as l, paintWithAlpha as u, solid as d, switchGradientKind as f, toHex8 as p, usePaintKind as m, usePaintKinds as h, withAlpha01 as g } from "@weasel-js/core";
|
|
7
|
+
import { Fragment as _, jsx as v, jsxs as y } from "react/jsx-runtime";
|
|
8
|
+
import { useCallback as b, useRef as x } from "react";
|
|
9
|
+
var S = {
|
|
10
|
+
root: "_root_4cn6i_2",
|
|
11
|
+
unset: "_unset_4cn6i_10",
|
|
12
|
+
noEditor: "_noEditor_4cn6i_15",
|
|
13
|
+
opacity: "_opacity_4cn6i_22"
|
|
14
|
+
}, C = "#000000ff", w = "none";
|
|
15
|
+
function T(e) {
|
|
16
|
+
let t = p(e.color);
|
|
17
|
+
return g(t.slice(0, 7), s(t) * l(e));
|
|
18
|
+
}
|
|
19
|
+
function E(e) {
|
|
20
|
+
let t = d(e);
|
|
21
|
+
return t.opacity === void 0 ? t : {
|
|
22
|
+
...t,
|
|
23
|
+
opacity: Math.round(t.opacity * 100) / 100
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
function D(e) {
|
|
27
|
+
return e?.fill === "pattern";
|
|
28
|
+
}
|
|
29
|
+
function O(e) {
|
|
30
|
+
return e === null ? w : e === void 0 ? null : e.fill ?? "solid";
|
|
31
|
+
}
|
|
32
|
+
function k(s) {
|
|
33
|
+
let { value: d, mixed: p = !1, unset: g = !1, kinds: k, allowNone: A = !0, onInput: j, onChange: M, className: N } = s, P = s["aria-label"], F = x(/* @__PURE__ */ new Map()), I = p ? null : O(d);
|
|
34
|
+
d != null && I !== null && F.current.set(I, d);
|
|
35
|
+
let L = m(d?.fill), R = h().filter((e) => k === void 0 || k.includes(e.id)), z = (n, r, i) => i && i in e ? {
|
|
36
|
+
value: n,
|
|
37
|
+
label: /* @__PURE__ */ v(t, {
|
|
38
|
+
name: i,
|
|
39
|
+
size: 14
|
|
40
|
+
}),
|
|
41
|
+
ariaLabel: r
|
|
42
|
+
} : {
|
|
43
|
+
value: n,
|
|
44
|
+
label: r
|
|
45
|
+
}, B = [...A ? [z(w, "None", "paintNone")] : [], ...R.map((e) => z(e.id, e.label, e.icon))], V = b(() => d == null ? C : L?.colorOf(d) ?? C, [d, L]), H = (e) => {
|
|
46
|
+
if (e === I) return;
|
|
47
|
+
if (e === w) {
|
|
48
|
+
M(null);
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
let t = F.current.get(e);
|
|
52
|
+
if (t !== void 0) {
|
|
53
|
+
M(t);
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
let n = d == null ? void 0 : f(d, e);
|
|
57
|
+
if (n !== void 0) {
|
|
58
|
+
M(n);
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
let r = c(e);
|
|
62
|
+
r && M(r.seed(V()));
|
|
63
|
+
};
|
|
64
|
+
return /* @__PURE__ */ y("div", {
|
|
65
|
+
className: [
|
|
66
|
+
S.root,
|
|
67
|
+
g && S.unset,
|
|
68
|
+
N
|
|
69
|
+
].filter(Boolean).join(" "),
|
|
70
|
+
title: g ? "Not set" : void 0,
|
|
71
|
+
children: [/* @__PURE__ */ v(i, {
|
|
72
|
+
items: B,
|
|
73
|
+
value: I,
|
|
74
|
+
size: "sm",
|
|
75
|
+
ariaLabel: "Paint kind",
|
|
76
|
+
onChange: (e) => e && H(e)
|
|
77
|
+
}), W()]
|
|
78
|
+
});
|
|
79
|
+
function U(e, t) {
|
|
80
|
+
return /* @__PURE__ */ y(_, { children: [t, /* @__PURE__ */ v("div", {
|
|
81
|
+
className: S.opacity,
|
|
82
|
+
children: /* @__PURE__ */ v(n, {
|
|
83
|
+
value: l(e),
|
|
84
|
+
"aria-label": P,
|
|
85
|
+
onInput: (t) => j?.(u(e, t)),
|
|
86
|
+
onChange: (t) => M(u(e, t))
|
|
87
|
+
})
|
|
88
|
+
})] });
|
|
89
|
+
}
|
|
90
|
+
function W() {
|
|
91
|
+
if (p || d === void 0) return /* @__PURE__ */ v(r, {
|
|
92
|
+
mixed: !0,
|
|
93
|
+
"aria-label": P,
|
|
94
|
+
onChange: (e) => M(E(e))
|
|
95
|
+
});
|
|
96
|
+
if (d === null) return null;
|
|
97
|
+
if (L?.Editor) {
|
|
98
|
+
let e = L.Editor;
|
|
99
|
+
return U(d, /* @__PURE__ */ v(e, {
|
|
100
|
+
value: d,
|
|
101
|
+
onInput: j,
|
|
102
|
+
onChange: M
|
|
103
|
+
}));
|
|
104
|
+
}
|
|
105
|
+
if (L?.stopsOf) return U(d, /* @__PURE__ */ v(a, {
|
|
106
|
+
value: d,
|
|
107
|
+
kindSwitch: !1,
|
|
108
|
+
onInput: j,
|
|
109
|
+
onChange: M
|
|
110
|
+
}));
|
|
111
|
+
if (D(d)) return U(d, /* @__PURE__ */ v(o, {
|
|
112
|
+
value: d,
|
|
113
|
+
color: V(),
|
|
114
|
+
onChange: M
|
|
115
|
+
}));
|
|
116
|
+
let e = O(d);
|
|
117
|
+
return e === "solid" ? /* @__PURE__ */ v(r, {
|
|
118
|
+
value: T(d),
|
|
119
|
+
alpha: !0,
|
|
120
|
+
"aria-label": P,
|
|
121
|
+
onInput: (e) => j?.(E(e)),
|
|
122
|
+
onChange: (e) => M(E(e))
|
|
123
|
+
}) : /* @__PURE__ */ y("div", {
|
|
124
|
+
className: S.noEditor,
|
|
125
|
+
children: [L?.label ?? e, ": no editor"]
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
//#endregion
|
|
130
|
+
export { k as t };
|
|
131
|
+
|
|
132
|
+
//# sourceMappingURL=PaintInput-jQRxM95Y.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PaintInput-jQRxM95Y.js","names":["s","_Fragment","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","valueKind","usePaintKind","entries","usePaintKinds","kinds","entry","segment","icon","id","Icon","label","items","allowNone","currentColor","useCallback","switchKind","kind","seen","converted","switchGradientKind","getPaintKind","onChange","unset","className","renderBody","withOpacity","Fragment","body","OpacityRange","onInput","paintWithAlpha","a01","Editor"],"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\n/* The opacity slider under a paint with no single color, laid out as the\n * solid's sits beside its swatch. */\n.opacity {\n display: flex;\n align-items: center;\n gap: var(--wzl-space-3);\n}\n","import { useCallback, useRef, type ReactElement } from 'react';\nimport {\n getAlpha01,\n getPaintKind,\n paintAlpha,\n paintWithAlpha,\n solid,\n switchGradientKind,\n toHex8,\n usePaintKind,\n usePaintKinds,\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 { OpacityRange } from '../ColorField/OpacityRange';\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 valueKind = usePaintKind(value?.fill);\n const entries = usePaintKinds().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 valueKind?.colorOf(value) ?? FALLBACK_COLOR;\n }, [value, valueKind]);\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 /** A solid's alpha rides its swatch; every other kind has no one color to\n * carry it, so its `opacity` gets the same slider under the body. */\n function withOpacity(paint: FillStyle, body: ReactElement): ReactElement {\n return (\n <>\n {body}\n <div className={s.opacity}>\n <OpacityRange\n value={paintAlpha(paint)}\n aria-label={ariaLabel}\n onInput={(a01) => onInput?.(paintWithAlpha(paint, a01))}\n onChange={(a01) => onChange(paintWithAlpha(paint, a01))}\n />\n </div>\n </>\n );\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 if (valueKind?.Editor) {\n const Editor = valueKind.Editor;\n return withOpacity(value, <Editor value={value} onInput={onInput} onChange={onChange} />);\n }\n if (valueKind?.stopsOf) {\n return withOpacity(value, (\n <GradientEditor\n value={value}\n kindSwitch={false}\n onInput={onInput}\n onChange={onChange}\n />\n ));\n }\n if (isPattern(value)) {\n return withOpacity(\n value,\n <PatternPicker value={value} color={currentColor()} onChange={onChange} />,\n );\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}>{valueKind?.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":";;;;;;;;;;;;;GCyBMQ,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,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EH,IAAIe,EAAUS,CAAK,GACjB,OAAO0B,EACL1B,GACA,kBAACvB,GAAD;GAAsB;GAAO,OAAOqC,EAAa;GAAa;EAAW,CAAA,CAC3E;EAEF,IAAMG,IAAOzB,EAAOQ,CAAK;EAMzB,OALIiB,MAAS,UAMX,kBAAC3C,GAAD;GACE,OAAOO,EAAUmB,CAAK;GACtB,OAAA;GACA,cAAYL;GACZ,UAAU,MAAUmC,IAAU1C,EAAeE,CAAK,CAAC;GACnD,WAAW,MAAUgC,EAASlC,EAAeE,CAAK,CAAC;EACpD,CAAA,IATM,kBAAC,OAAD;GAAK,WAAWnB,EAAE;GAAlB,UAAA,CAA6B8B,GAAW,SAASgB,GAAK,aAAgB;;CAWjF;AACF"}
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
import { r as e } from "./NumberField-DLXXgh48.js";
|
|
2
|
+
import { t } from "./ToggleBar-Z2jZiguF.js";
|
|
3
|
+
import { composePatternTransform as n, decomposePatternTransform as r } from "@weasel-js/core";
|
|
4
|
+
import { jsx as i, jsxs as a } from "react/jsx-runtime";
|
|
5
|
+
import { tilePreviewCssUrl as o } from "@weasel-js/svg";
|
|
6
|
+
var s = {
|
|
7
|
+
root: "_root_dgwqj_2",
|
|
8
|
+
grid: "_grid_dgwqj_9",
|
|
9
|
+
swatch: "_swatch_dgwqj_17",
|
|
10
|
+
swatchActive: "_swatchActive_dgwqj_36"
|
|
11
|
+
}, c = [
|
|
12
|
+
"hatch",
|
|
13
|
+
"crosshatch",
|
|
14
|
+
"dots",
|
|
15
|
+
"chunks"
|
|
16
|
+
], l = [
|
|
17
|
+
{
|
|
18
|
+
value: 4,
|
|
19
|
+
label: "S"
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
value: 8,
|
|
23
|
+
label: "M"
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
value: 16,
|
|
27
|
+
label: "L"
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
value: 32,
|
|
31
|
+
label: "XL"
|
|
32
|
+
}
|
|
33
|
+
], u = 8, d = 16, f = {
|
|
34
|
+
style: "unit",
|
|
35
|
+
unit: "degree",
|
|
36
|
+
unitDisplay: "narrow",
|
|
37
|
+
maximumFractionDigits: 1
|
|
38
|
+
};
|
|
39
|
+
function p(e) {
|
|
40
|
+
let t = ((e * 180 / Math.PI + 180) % 360 + 360) % 360 - 180;
|
|
41
|
+
return t === -180 ? 180 : t;
|
|
42
|
+
}
|
|
43
|
+
function m(e, t) {
|
|
44
|
+
let i = r(e.transform), [a, o, s, c] = n({
|
|
45
|
+
...i,
|
|
46
|
+
rotation: t * Math.PI / 180
|
|
47
|
+
}), { transform: l, ...u } = e;
|
|
48
|
+
return Math.abs(a - 1) < 1e-9 && Math.abs(o) < 1e-9 && Math.abs(s) < 1e-9 && Math.abs(c - 1) < 1e-9 ? u : {
|
|
49
|
+
...u,
|
|
50
|
+
transform: [
|
|
51
|
+
a,
|
|
52
|
+
o,
|
|
53
|
+
s,
|
|
54
|
+
c
|
|
55
|
+
]
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
function h(e) {
|
|
59
|
+
return "tile" in e.pattern ? e.pattern : null;
|
|
60
|
+
}
|
|
61
|
+
function g(e, t, n = u) {
|
|
62
|
+
let r = {
|
|
63
|
+
tile: e,
|
|
64
|
+
color: t,
|
|
65
|
+
size: n
|
|
66
|
+
};
|
|
67
|
+
return e === "chunks" && (r.bg = "#00000000"), {
|
|
68
|
+
fill: "pattern",
|
|
69
|
+
pattern: r,
|
|
70
|
+
units: "bounds"
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
function _(n) {
|
|
74
|
+
let { value: _, color: v, onChange: y, className: b } = n, x = h(_), S = x?.size ?? u, C = (e) => {
|
|
75
|
+
let t = g(e, v, S);
|
|
76
|
+
y(_.transform ? {
|
|
77
|
+
...t,
|
|
78
|
+
transform: _.transform
|
|
79
|
+
} : t);
|
|
80
|
+
}, w = (e) => {
|
|
81
|
+
x && y({
|
|
82
|
+
..._,
|
|
83
|
+
pattern: {
|
|
84
|
+
...x,
|
|
85
|
+
size: e
|
|
86
|
+
}
|
|
87
|
+
});
|
|
88
|
+
};
|
|
89
|
+
return /* @__PURE__ */ a("div", {
|
|
90
|
+
className: [s.root, b].filter(Boolean).join(" "),
|
|
91
|
+
children: [
|
|
92
|
+
/* @__PURE__ */ i("div", {
|
|
93
|
+
className: s.grid,
|
|
94
|
+
children: c.map((e) => {
|
|
95
|
+
let t = {
|
|
96
|
+
tile: e,
|
|
97
|
+
color: v,
|
|
98
|
+
size: d
|
|
99
|
+
};
|
|
100
|
+
e === "chunks" && (t.bg = "#00000000");
|
|
101
|
+
let n = x?.tile === e;
|
|
102
|
+
return /* @__PURE__ */ i("button", {
|
|
103
|
+
type: "button",
|
|
104
|
+
className: [s.swatch, n && s.swatchActive].filter(Boolean).join(" "),
|
|
105
|
+
style: { "--tile-preview": o(t) },
|
|
106
|
+
title: e,
|
|
107
|
+
"aria-label": e,
|
|
108
|
+
"aria-pressed": n,
|
|
109
|
+
onClick: () => C(e)
|
|
110
|
+
}, e);
|
|
111
|
+
})
|
|
112
|
+
}),
|
|
113
|
+
/* @__PURE__ */ i(t, {
|
|
114
|
+
items: l,
|
|
115
|
+
value: S,
|
|
116
|
+
size: "sm",
|
|
117
|
+
ariaLabel: "Tile size",
|
|
118
|
+
onChange: (e) => e != null && w(e)
|
|
119
|
+
}),
|
|
120
|
+
/* @__PURE__ */ i(e, {
|
|
121
|
+
label: "Rotation",
|
|
122
|
+
orientation: "row",
|
|
123
|
+
width: "fit",
|
|
124
|
+
value: p(r(_.transform).rotation),
|
|
125
|
+
step: 15,
|
|
126
|
+
formatOptions: f,
|
|
127
|
+
onChange: (e) => Number.isFinite(e) && y(m(_, e))
|
|
128
|
+
})
|
|
129
|
+
]
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
//#endregion
|
|
133
|
+
export { g as n, _ as t };
|
|
134
|
+
|
|
135
|
+
//# sourceMappingURL=PatternPicker-CaMYXzhF.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PatternPicker-CaMYXzhF.js","names":["s","NumberField","PatternPicker_module_default","TILES","TILE_SIZES","DEFAULT_TILE_SIZE","PREVIEW_SIZE","DEGREES","toDegrees","folded","rad","withRotation","parts","decomposePatternTransform","value","b","c","d","composePatternTransform","degrees","_drop","rest","specOf","fill","seedPattern","spec","from","tile","PatternPicker","props","size","pick","seeded","color","resize","onChange","nextSize","className","preview","selected","tilePreviewCssUrl","ToggleBar","v","deg"],"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 {\n composePatternTransform,\n decomposePatternTransform,\n type FillStyle,\n type TilePatternSpec,\n} from '@weasel-js/core';\nimport { tilePreviewCssUrl } from '@weasel-js/svg';\nimport { NumberField } from '../NumberField';\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\nconst DEGREES: Intl.NumberFormatOptions = { style: 'unit', unit: 'degree', unitDisplay: 'narrow', maximumFractionDigits: 1 };\n\n/** Rotation in degrees, folded into (-180, 180]. */\nfunction toDegrees(rad: number): number {\n const deg = (rad * 180) / Math.PI;\n const folded = ((((deg + 180) % 360) + 360) % 360) - 180;\n return folded === -180 ? 180 : folded;\n}\n\n/** `value` with its transform's rotation replaced, the transform dropped when\n * nothing is left of it. */\nfunction withRotation(value: PatternFill, degrees: number): PatternFill {\n const parts = decomposePatternTransform(value.transform);\n const [a, b, c, d] = composePatternTransform({ ...parts, rotation: (degrees * Math.PI) / 180 });\n const { transform: _drop, ...rest } = value;\n const identity = Math.abs(a - 1) < 1e-9 && Math.abs(b) < 1e-9 && Math.abs(c) < 1e-9 && Math.abs(d - 1) < 1e-9;\n return identity ? rest : { ...rest, transform: [a, b, c, d] };\n}\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, a size change and a\n * committed rotation are 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 and a rotation field, each swatch\n * previewing the real tile at the current color. Rotation edits only the\n * rotation part of the paint's `transform`; scale and skew survive it.\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 const seeded = seedPattern(tile, color, size);\n onChange(value.transform ? { ...seeded, transform: value.transform } : seeded);\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 <NumberField\n label=\"Rotation\"\n orientation=\"row\"\n width=\"fit\"\n value={toDegrees(decomposePatternTransform(value.transform).rotation)}\n step={15}\n formatOptions={DEGREES}\n onChange={(deg) => Number.isFinite(deg) && onChange(withRotation(value, deg))}\n />\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;GCgBMG,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,IAEfC,IAAoC;CAAE,OAAO;CAAQ,MAAM;CAAU,aAAa;CAAU,uBAAuB;AAAE;AAG3H,SAASC,EAAU,GAAqB;CAEtC,IAAMC,MADOC,IAAM,MAAO,KAAK,KACN,OAAO,MAAO,OAAO,MAAO;CACrD,OAAOD,MAAW,OAAO,MAAMA;AACjC;AAIA,SAASE,EAAa,GAAoB,GAA8B;CACtE,IAAMC,IAAQC,EAA0BC,EAAM,SAAS,GACjD,CAAC,GAAGC,GAAGC,GAAGC,KAAKC,EAAwB;EAAE,GAAGN;EAAO,UAAWO,IAAU,KAAK,KAAM;CAAI,CAAC,GACxF,EAAE,WAAWC,GAAO,GAAGC,MAASP;CAEtC,OADiB,KAAK,IAAI,IAAI,CAAC,IAAI,QAAQ,KAAK,IAAIC,CAAC,IAAI,QAAQ,KAAK,IAAIC,CAAC,IAAI,QAAQ,KAAK,IAAIC,IAAI,CAAC,IAAI,OACvFI,IAAO;EAAE,GAAGA;EAAM,WAAW;GAAC;GAAGN;GAAGC;GAAGC;EAAC;CAAE;AAC9D;AAKA,SAASK,EAAO,GAA2C;CACzD,OAAO,UAAUC,EAAK,UAAUA,EAAK,UAAU;AACjD;AAMA,SAAgBC,EACd,GACA,GACA,IAAenB,GACF;CACb,IAAMoB,IAAwB;EAAE;EAA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AAK,QAAQR,EAAOQ,CAAC;GACvC,CAAA;GACD,kBAACzC,GAAD;IACE,OAAM;IACN,aAAY;IACZ,OAAM;IACN,OAAOO,EAAUK,EAA0BC,EAAM,SAAS,CAAC,CAAC,QAAQ;IACpE,MAAM;IACN,eAAeP;IACf,WAAW,MAAQ,OAAO,SAASoC,CAAG,KAAKR,EAASxB,EAAaG,GAAO6B,CAAG,CAAC;GAC7E,CAAA;EACE;;AAET"}
|
|
@@ -56,12 +56,12 @@ function v(e, t) {
|
|
|
56
56
|
return /^-0(\.0*)?$/.test(n) ? n.slice(1) : n;
|
|
57
57
|
}
|
|
58
58
|
var y = {
|
|
59
|
-
root: "
|
|
60
|
-
grid: "
|
|
61
|
-
axis: "
|
|
62
|
-
tick: "
|
|
63
|
-
tickLabels: "
|
|
64
|
-
tickLabel: "
|
|
59
|
+
root: "_root_1arba_1",
|
|
60
|
+
grid: "_grid_1arba_32",
|
|
61
|
+
axis: "_axis_1arba_38",
|
|
62
|
+
tick: "_tick_1arba_44",
|
|
63
|
+
tickLabels: "_tickLabels_1arba_50",
|
|
64
|
+
tickLabel: "_tickLabel_1arba_50"
|
|
65
65
|
}, b = {
|
|
66
66
|
x: 64,
|
|
67
67
|
y: 24
|
|
@@ -289,4 +289,4 @@ var w = r(function(r, p) {
|
|
|
289
289
|
//#endregion
|
|
290
290
|
export { h as a, f as c, _ as i, v as n, g as o, m as r, d as s, w as t };
|
|
291
291
|
|
|
292
|
-
//# sourceMappingURL=Plot2D-
|
|
292
|
+
//# sourceMappingURL=Plot2D-BHNbgCAl.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Plot2D-BHNbgCAl.js","names":["s","dlog","modelToPlot","xFrac","p","m","yFrac","plot","plotToModel","MAX_DECIMALS","niceStep","mag","rough","norm","stepDecimals","step","tickDecimals","most","v","values","d","niceTicks","none","lo","range","hi","span","options","pixels","minSpacing","unitsPerPx","decimals","from","inset","to","first","last","i","formatTick","text","value","ctx","Plot2D_module_default","TICK_SPACING_PX","TICK_INSET_PX","LABEL_GAP_PX","resolveTicks","settings","eps","gaps","even","g","set","axis","format","toPlot","Plot2D","forwardRef","props","svgRef","useRef","modelRange","useMemo","xRange","yRange","plotSize","width","height","clientToPlot","useCallback","rect","left","top","useEffect","useImperativeHandle","ref","pt","handlePointerDown","onPointerDown","model","xTickList","xTicks","yTickList","yTicks","yInside","yLabelsRef","yLabelWidth","setYLabelWidth","useState","yLabelKey","t","measure","widest","el","prev","live","cls","className","renderTickLines","list","renderTickLabels","placement","outside","gap","place","grid","divisions","stroke","fractions","f","axes","children"],"sources":["../../src/components/Plot2D/geometry.ts","../../src/components/Plot2D/ticks.ts","../../src/components/Plot2D/Plot2D.module.css","../../src/components/Plot2D/Plot2D.tsx"],"sourcesContent":["/**\n * Coordinate transforms (model ↔ plot) for Plot2D. Pure / deterministic —\n * no DOM, no React, no state.\n *\n * Model space: caller-defined xRange × yRange. Y axis goes UP.\n * Plot space: 0..width × 0..height in CSS pixels. Y axis goes DOWN (SVG).\n */\n\nexport interface Point {\n x: number;\n y: number;\n}\n\n/**\n * The caller-defined extent of model space, the coordinate system a plot's\n * data lives in.\n */\nexport interface ModelRange {\n xMin: number;\n xMax: number;\n yMin: number;\n yMax: number;\n}\n\n/** The plot's drawing area in CSS pixels. */\nexport interface PlotSize {\n width: number;\n height: number;\n}\n\n/**\n * Maps a model-space point into plot space, flipping the y axis so model y\n * grows upward while SVG y grows downward.\n */\nexport function modelToPlot(p: Point, m: ModelRange, plot: PlotSize): Point {\n const xFrac = (p.x - m.xMin) / (m.xMax - m.xMin);\n const yFrac = (p.y - m.yMin) / (m.yMax - m.yMin);\n return {\n x: xFrac * plot.width,\n // Invert y so model y=0 sits at plot bottom (SVG y grows downward).\n y: (1 - yFrac) * plot.height,\n };\n}\n\n/** The inverse of {@link modelToPlot}. */\nexport function plotToModel(p: Point, m: ModelRange, plot: PlotSize): Point {\n const xFrac = p.x / plot.width;\n const yFrac = 1 - p.y / plot.height;\n return {\n x: m.xMin + xFrac * (m.xMax - m.xMin),\n y: m.yMin + yFrac * (m.yMax - m.yMin),\n };\n}\n","/**\n * Tick placement for a numeric axis. Pure — no DOM, no React.\n */\n\n/** What a tick label formatter knows about the column it is part of. */\nexport interface TickFormatCtx {\n /** Places after the point that every label in the column shares. */\n decimals: number;\n /** Distance between neighboring ticks, or 0 when the ticks were given\n * explicitly and are not evenly spaced. */\n step: number;\n}\n\n/** Turns a tick value into its label. */\nexport type TickFormatter = (value: number, ctx: TickFormatCtx) => string;\n\n/** A column of ticks and the facts its labels share. */\nexport interface TickSet {\n values: number[];\n step: number;\n decimals: number;\n}\n\n/** Options for {@link niceTicks}. */\nexport interface NiceTickOptions {\n /** Smallest gap between neighboring ticks, in px. */\n minSpacing: number;\n /** Ticks closer than this to either end of the axis are dropped, in px.\n * Default 0. */\n inset?: number;\n}\n\nconst MAX_DECIMALS = 20;\n\n/** The smallest of 1, 2 or 5 times a power of ten that is at least `rough`. */\nexport function niceStep(rough: number): number {\n const mag = Math.pow(10, Math.floor(Math.log10(rough)));\n const norm = rough / mag;\n const step = norm <= 1 ? 1 : norm <= 2 ? 2 : norm <= 5 ? 5 : 10;\n return step * mag;\n}\n\n/** Places after the point a multiple of `step` needs, for a 1/2/5 step. */\nexport function stepDecimals(step: number): number {\n if (!(step > 0) || !Number.isFinite(step)) return 0;\n return Math.min(MAX_DECIMALS, Math.max(0, -Math.floor(Math.log10(step) + 1e-9)));\n}\n\n/** The most places after the point any of `values` needs. */\nexport function tickDecimals(values: readonly number[]): number {\n let most = 0;\n for (const v of values) {\n if (!Number.isFinite(v)) continue;\n let d = 0;\n while (d < MAX_DECIMALS && Math.abs(Number(v.toFixed(d)) - v) > 1e-9 * Math.max(1, Math.abs(v))) d++;\n most = Math.max(most, d);\n }\n return most;\n}\n\n/**\n * Ticks at round values across `range`, drawn `pixels` long: the finest\n * 1/2/5 step that keeps neighbors `minSpacing` px apart, so a taller plot\n * gets more of them.\n */\nexport function niceTicks(\n range: readonly [number, number],\n pixels: number,\n options: NiceTickOptions,\n): TickSet {\n const none: TickSet = { values: [], step: 0, decimals: 0 };\n const lo = Math.min(range[0], range[1]);\n const hi = Math.max(range[0], range[1]);\n const span = hi - lo;\n const { minSpacing, inset = 0 } = options;\n if (!(span > 0) || !Number.isFinite(span) || !(pixels > 0) || !(minSpacing > 0)) return none;\n\n const unitsPerPx = span / pixels;\n const step = niceStep(minSpacing * unitsPerPx);\n const decimals = stepDecimals(step);\n const from = lo + inset * unitsPerPx;\n const to = hi - inset * unitsPerPx;\n // A tolerance in step units, so a tick sitting exactly on a bound survives\n // the float error in `from / step`.\n const first = Math.ceil(from / step - 1e-9);\n const last = Math.floor(to / step + 1e-9);\n const values: number[] = [];\n for (let i = first; i <= last; i++) values.push(Number((i * step).toFixed(decimals)) + 0);\n return { values, step, decimals };\n}\n\n/** The default label: `value` fixed to the column's shared decimals, with\n * no negative zero. */\nexport function formatTick(value: number, ctx: TickFormatCtx): string {\n const text = value.toFixed(ctx.decimals);\n return /^-0(\\.0*)?$/.test(text) ? text.slice(1) : text;\n}\n",".root {\n /* Component-local vars layered over theme tokens. Consumers override\n * either the plot-* var (component scope) or the wzl-* token (app\n * scope). */\n --plot-bg: var(--wzl-surface-sunken);\n --plot-grid: var(--wzl-line);\n /* Axes get full foreground contrast — they're the plot frame, the\n * most prominent structural element after caller-rendered content. */\n --plot-axis: var(--wzl-fg);\n --plot-tick: var(--wzl-line-subtle);\n --plot-tick-label: var(--wzl-fg-muted);\n /* Knocks the tick line out from behind an inside label. */\n --plot-tick-label-halo: var(--plot-bg);\n\n display: block;\n /* Caller-rendered marks at the very edge (e.g. CurveEditor anchors)\n * extend past the SVG box by their radius — let them paint over the\n * host page instead of being half-clipped. */\n overflow: visible;\n background: var(--plot-bg);\n user-select: none;\n touch-action: none;\n outline: none;\n}\n\n/* Keyboard-only focus ring. Caller opts in via `tabIndex`. */\n.root:focus-visible {\n outline: 2px solid var(--wzl-focus-ring);\n outline-offset: 2px;\n}\n\n.grid {\n stroke: var(--plot-grid);\n stroke-width: 1;\n fill: none;\n}\n\n.axis {\n stroke: var(--plot-axis);\n stroke-width: var(--wzl-line-width);\n fill: none;\n}\n\n.tick {\n stroke: var(--plot-tick);\n stroke-width: 1;\n fill: none;\n}\n\n.tickLabels { pointer-events: none; }\n\n.tickLabel {\n fill: var(--plot-tick-label);\n font-size: var(--wzl-font-size-xs);\n font-variant-numeric: tabular-nums;\n font-family: var(--wzl-font-numeric);\n}\n\n.tickLabel[data-placement='inside'] {\n stroke: var(--plot-tick-label-halo);\n stroke-width: 3px;\n stroke-linejoin: round;\n paint-order: stroke;\n}\n","import {\n forwardRef, useCallback, useEffect, useImperativeHandle, useLayoutEffect, useMemo, useRef, useState,\n type CSSProperties,\n type KeyboardEvent as ReactKeyboardEvent,\n type PointerEvent as ReactPointerEvent,\n type ReactNode,\n} from 'react';\nimport {\n modelToPlot, plotToModel,\n type ModelRange, type Point,\n} from './geometry';\nimport {\n formatTick, niceTicks, tickDecimals,\n type TickFormatCtx, type TickFormatter,\n} from './ticks';\nimport s from './Plot2D.module.css';\nimport { dlog } from '../../dlog';\n\n/** Background grid configuration for a {@link Plot2D}. */\nexport interface GridSettings {\n /** Number of evenly-spaced internal grid lines per axis (excluding\n * the edges). Applied to both x and y. Default 3. */\n divisions?: number;\n /** Stroke color override. When omitted, uses `var(--plot-grid)`. */\n color?: string;\n}\n\n/** Axis-line configuration for a {@link Plot2D}. */\nexport interface AxesSettings {\n /** Stroke color override. When omitted, uses `var(--plot-axis)`. */\n color?: string;\n}\n\n/**\n * Ticks along one axis of a {@link Plot2D}: a line across the plot at each\n * tick value, and a label naming it. Every label in a column is formatted\n * to the same number of decimal places.\n */\nexport interface TickSettings {\n /** Tick values in model space; any outside the range are skipped.\n * Omitted = round 1/2/5 steps, as many as `minSpacing` allows at the\n * plot's current size. */\n values?: readonly number[];\n /** Smallest gap between generated ticks, in px. Default 24 on y, 64 on x. */\n minSpacing?: number;\n /** A generated tick nearer either end of the axis than this is dropped,\n * so its label stays on the plot, in px. Default 4 on y, 16 on x. */\n inset?: number;\n /** Draw a line across the plot at each tick. Default true. */\n lines?: boolean;\n /** Where labels sit: `'inside'` the plot along its left (y) or bottom (x)\n * edge, `'outside'` it past that edge in space the caller leaves free,\n * or `false` for none. Default `'inside'`. */\n labels?: 'inside' | 'outside' | false;\n /** Space between a label and the plot edge it sits against, in px.\n * Default 4. */\n gap?: number;\n /** Label text for a tick. Default {@link formatTick}. */\n format?: TickFormatter;\n}\n\n/** A pointer position given in both of the plot's coordinate systems. */\nexport interface Plot2DCoords {\n plot: Point;\n model: Point;\n}\n\n/** Props for {@link Plot2D}. */\nexport interface Plot2DProps {\n width: number;\n height: number;\n /** Model-space x range. Default [0, 1]. */\n xRange?: readonly [number, number];\n /** Model-space y range. Default [0, 1]. */\n yRange?: readonly [number, number];\n /** Background grid. `false` / `null` / omitted = no grid. Pass `{}`\n * for default (3 divisions per axis) or populated GridSettings. */\n grid?: GridSettings | false | null;\n /** Axis lines. `false` / `null` = no axes. Omitted = default-styled\n * axes (on). Pass AxesSettings to customize. */\n axes?: AxesSettings | false | null;\n /** Ticks at x values. `false` / `null` / omitted = none; `{}` = defaults. */\n xTicks?: TickSettings | false | null;\n /** Ticks at y values. `false` / `null` / omitted = none; `{}` = defaults. */\n yTicks?: TickSettings | false | null;\n /** Forwarded to the underlying svg. Consumer opts into focus this way. */\n tabIndex?: number;\n /** Default `'img'`. A plot holding focusable marks must not be an image,\n * whose children are presentational to assistive technology. */\n role?: string;\n 'aria-label'?: string;\n className?: string;\n style?: CSSProperties;\n /** Pointer down on the SVG. Receives both plot- and model-space coords\n * pre-computed so consumers don't repeat the rect/transform dance. */\n onPointerDown?: (e: ReactPointerEvent<SVGSVGElement>, coords: Plot2DCoords) => void;\n onKeyDown?: (e: ReactKeyboardEvent<SVGSVGElement>) => void;\n children?: ReactNode;\n}\n\n/**\n * Imperative handle on a {@link Plot2D}: the SVG element, its size, and the\n * coordinate conversions, including ones that start from a raw DOM event so a\n * drag tracked on `window` can still map back into the plot.\n */\nexport interface Plot2DHandle {\n readonly svg: SVGSVGElement | null;\n plotToModel(pt: Point): Point;\n modelToPlot(pt: Point): Point;\n /** Convert a DOM event's clientX/clientY (e.g. from a window-attached\n * pointermove during drag) to plot-space. */\n clientToPlot(e: { clientX: number; clientY: number }): Point;\n /** Convenience: clientToPlot → plotToModel. */\n clientToModel(e: { clientX: number; clientY: number }): Point;\n readonly width: number;\n readonly height: number;\n}\n\ntype Axis = 'x' | 'y';\n\nconst TICK_SPACING_PX: Record<Axis, number> = { x: 64, y: 24 };\nconst TICK_INSET_PX: Record<Axis, number> = { x: 16, y: 4 };\nconst LABEL_GAP_PX = 4;\n\ninterface ResolvedTick {\n value: number;\n /** Plot-space position along the axis. */\n at: number;\n label: string;\n}\n\nfunction resolveTicks(\n settings: TickSettings,\n axis: Axis,\n range: readonly [number, number],\n pixels: number,\n toPlot: (v: number) => number,\n): ResolvedTick[] {\n let values: number[];\n let ctx: TickFormatCtx;\n if (settings.values) {\n const lo = Math.min(range[0], range[1]);\n const hi = Math.max(range[0], range[1]);\n const eps = (hi - lo) * 1e-9;\n values = settings.values.filter((v) => v >= lo - eps && v <= hi + eps);\n const gaps = values.slice(1).map((v, i) => v - values[i]);\n const even = gaps.length > 0 && gaps.every((g) => Math.abs(g - gaps[0]) <= Math.abs(gaps[0]) * 1e-9);\n ctx = { decimals: tickDecimals(values), step: even ? gaps[0] : 0 };\n } else {\n const set = niceTicks(range, pixels, {\n minSpacing: settings.minSpacing ?? TICK_SPACING_PX[axis],\n inset: settings.inset ?? TICK_INSET_PX[axis],\n });\n values = set.values;\n ctx = { decimals: set.decimals, step: set.step };\n }\n const format = settings.format ?? formatTick;\n return values.map((value) => ({ value, at: toPlot(value), label: format(value, ctx) }));\n}\n\n/**\n * An SVG plotting surface with an optional grid, axes and ticks. It draws the\n * frame and owns the model-space to plot-space mapping; the plotted content is\n * whatever children are passed, positioned in plot space.\n */\nexport const Plot2D = forwardRef<Plot2DHandle, Plot2DProps>(function Plot2D(props, ref) {\n const {\n width, height,\n xRange = [0, 1],\n yRange = [0, 1],\n grid,\n axes,\n xTicks,\n yTicks,\n tabIndex,\n role = 'img',\n className,\n style,\n onPointerDown,\n onKeyDown,\n children,\n } = props;\n\n const svgRef = useRef<SVGSVGElement | null>(null);\n\n const modelRange: ModelRange = useMemo(\n () => ({ xMin: xRange[0], xMax: xRange[1], yMin: yRange[0], yMax: yRange[1] }),\n [xRange, yRange],\n );\n\n const plotSize = useMemo(() => ({ width, height }), [width, height]);\n\n const clientToPlot = useCallback((e: { clientX: number; clientY: number }): Point => {\n const rect = svgRef.current?.getBoundingClientRect();\n const left = rect?.left ?? 0;\n const top = rect?.top ?? 0;\n return { x: e.clientX - left, y: e.clientY - top };\n }, []);\n\n useEffect(() => {\n dlog('plot2d', 'mount', { width, height });\n return () => dlog('plot2d', 'unmount');\n // Mount/unmount trace: re-running on a resize would log a spurious mount.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n useImperativeHandle(ref, () => ({\n get svg() { return svgRef.current; },\n plotToModel: (pt: Point) => plotToModel(pt, modelRange, plotSize),\n modelToPlot: (pt: Point) => modelToPlot(pt, modelRange, plotSize),\n clientToPlot,\n clientToModel: (e) => plotToModel(clientToPlot(e), modelRange, plotSize),\n get width() { return plotSize.width; },\n get height() { return plotSize.height; },\n }), [modelRange, plotSize, clientToPlot]);\n\n const handlePointerDown = useCallback((e: ReactPointerEvent<SVGSVGElement>) => {\n if (!onPointerDown) return;\n const plot = clientToPlot(e);\n const model = plotToModel(plot, modelRange, plotSize);\n onPointerDown(e, { plot, model });\n }, [onPointerDown, clientToPlot, modelRange, plotSize]);\n\n const xTickList = xTicks\n ? resolveTicks(xTicks, 'x', xRange, width, (v) => modelToPlot({ x: v, y: yRange[0] }, modelRange, plotSize).x)\n : [];\n const yTickList = yTicks\n ? resolveTicks(yTicks, 'y', yRange, height, (v) => modelToPlot({ x: xRange[0], y: v }, modelRange, plotSize).y)\n : [];\n\n // An inside y column is right-aligned against its widest label, which only\n // the rendered text can say.\n const yInside = !!yTicks && (yTicks.labels ?? 'inside') === 'inside';\n const yLabelsRef = useRef<SVGGElement | null>(null);\n const [yLabelWidth, setYLabelWidth] = useState(0);\n const yLabelKey = yInside ? yTickList.map((t) => t.label).join('\\n') : '';\n useLayoutEffect(() => {\n if (!yInside) return;\n const measure = (): void => {\n let widest = 0;\n for (const el of yLabelsRef.current?.querySelectorAll('text') ?? []) {\n if (typeof el.getComputedTextLength === 'function') widest = Math.max(widest, el.getComputedTextLength());\n }\n setYLabelWidth((prev) => (prev === widest ? prev : widest));\n };\n measure();\n let live = true;\n // A web font landing after the first measure changes every width.\n document.fonts?.ready.then(() => { if (live) measure(); });\n return () => { live = false; };\n }, [yInside, yLabelKey]);\n\n const cls = [s.root, className].filter(Boolean).join(' ');\n\n const renderTickLines = (axis: Axis, list: ResolvedTick[], settings: TickSettings | false | null | undefined) => {\n if (!settings || settings.lines === false || list.length === 0) return null;\n return (\n <g>\n {list.map((t) => (\n <line\n key={`t${axis}-${t.value}`}\n data-plot-element=\"tick\"\n data-axis={axis}\n className={s.tick}\n {...(axis === 'x'\n ? { x1: t.at, x2: t.at, y1: 0, y2: height }\n : { x1: 0, x2: width, y1: t.at, y2: t.at })}\n />\n ))}\n </g>\n );\n };\n\n const renderTickLabels = (axis: Axis, list: ResolvedTick[], settings: TickSettings | false | null | undefined) => {\n if (!settings || list.length === 0) return null;\n const placement = settings.labels ?? 'inside';\n if (placement === false) return null;\n const outside = placement === 'outside';\n const gap = settings.gap ?? LABEL_GAP_PX;\n let place: { x?: number; y?: number; textAnchor: 'start' | 'middle' | 'end'; dominantBaseline?: 'central' | 'hanging' };\n if (axis === 'y') {\n place = outside\n ? { x: -gap, textAnchor: 'end', dominantBaseline: 'central' }\n : yLabelWidth > 0\n ? { x: gap + yLabelWidth, textAnchor: 'end', dominantBaseline: 'central' }\n : { x: gap, textAnchor: 'start', dominantBaseline: 'central' };\n } else {\n place = outside\n ? { y: height + gap, textAnchor: 'middle', dominantBaseline: 'hanging' }\n : { y: height - gap, textAnchor: 'middle' };\n }\n return (\n <g ref={axis === 'y' ? yLabelsRef : undefined} className={s.tickLabels} aria-hidden=\"true\">\n {list.map((t) => (\n <text\n key={`l${axis}-${t.value}`}\n data-plot-element=\"tick-label\"\n data-axis={axis}\n data-placement={placement}\n className={s.tickLabel}\n x={axis === 'x' ? t.at : place.x}\n y={axis === 'y' ? t.at : place.y}\n textAnchor={place.textAnchor}\n dominantBaseline={place.dominantBaseline}\n >\n {t.label}\n </text>\n ))}\n </g>\n );\n };\n\n return (\n <svg\n ref={svgRef}\n className={cls}\n style={style}\n width={width}\n height={height}\n viewBox={`0 0 ${width} ${height}`}\n role={role}\n aria-label={props['aria-label']}\n tabIndex={tabIndex}\n onPointerDown={onPointerDown ? handlePointerDown : undefined}\n onKeyDown={onKeyDown}\n >\n {grid && (() => {\n const divisions = grid.divisions ?? 3;\n const stroke = grid.color;\n // Evenly-spaced internal divisions, excluding the edges (which\n // belong to the axes). For divisions=3, fractions are 1/4, 2/4, 3/4.\n const fractions: number[] = [];\n for (let i = 1; i <= divisions; i++) fractions.push(i / (divisions + 1));\n return (\n <g>\n {fractions.map((f) => (\n <line\n key={`gx-${f}`}\n data-plot-element=\"grid\"\n className={s.grid}\n stroke={stroke}\n x1={f * width} x2={f * width}\n y1={0} y2={height}\n />\n ))}\n {fractions.map((f) => (\n <line\n key={`gy-${f}`}\n data-plot-element=\"grid\"\n className={s.grid}\n stroke={stroke}\n x1={0} x2={width}\n y1={f * height} y2={f * height}\n />\n ))}\n </g>\n );\n })()}\n {renderTickLines('x', xTickList, xTicks)}\n {renderTickLines('y', yTickList, yTicks)}\n {axes !== false && axes !== null && (() => {\n const stroke = axes?.color;\n return (\n <g>\n <line\n data-plot-element=\"axis\"\n className={s.axis}\n stroke={stroke}\n x1={0} x2={width}\n y1={height} y2={height}\n />\n <line\n data-plot-element=\"axis\"\n className={s.axis}\n stroke={stroke}\n x1={0} x2={0}\n y1={0} y2={height}\n />\n </g>\n );\n })()}\n {renderTickLabels('x', xTickList, xTicks)}\n {renderTickLabels('y', yTickList, yTicks)}\n {children}\n </svg>\n );\n});\n"],"mappings":";;;;AAkCA,SAAgBE,EAAY,GAAU,GAAe,GAAuB;CAC1E,IAAMC,KAASC,EAAE,IAAIC,EAAE,SAASA,EAAE,OAAOA,EAAE,OACrCC,KAASF,EAAE,IAAIC,EAAE,SAASA,EAAE,OAAOA,EAAE;CAC3C,OAAO;EACL,GAAGF,IAAQI,EAAK;EAEhB,IAAI,IAAID,KAASC,EAAK;CACxB;AACF;AAGA,SAAgBC,EAAY,GAAU,GAAe,GAAuB;CAC1E,IAAML,IAAQC,EAAE,IAAIG,EAAK,OACnBD,IAAQ,IAAIF,EAAE,IAAIG,EAAK;CAC7B,OAAO;EACL,GAAGF,EAAE,OAAOF,KAASE,EAAE,OAAOA,EAAE;EAChC,GAAGA,EAAE,OAAOC,KAASD,EAAE,OAAOA,EAAE;CAClC;AACF;;;ACpBA,IAAMI,IAAe;AAGrB,SAAgBC,EAAS,GAAuB;CAC9C,IAAMC,IAAe,MAAI,KAAK,MAAM,KAAK,MAAMC,CAAK,CAAC,GAC/CC,IAAOD,IAAQD;CAErB,QADaE,KAAQ,IAAI,IAAIA,KAAQ,IAAI,IAAIA,KAAQ,IAAI,IAAI,MAC/CF;AAChB;AAGA,SAAgBG,EAAa,GAAsB;CAEjD,OADI,EAAEC,IAAO,MAAM,CAAC,OAAO,SAASA,CAAI,IAAU,IAC3C,KAAK,IAAIN,GAAc,KAAK,IAAI,GAAG,CAAC,KAAK,MAAM,KAAK,MAAMM,CAAI,IAAI,IAAI,CAAC,CAAC;AACjF;AAGA,SAAgBC,EAAa,GAAmC;CAC9D,IAAIC,IAAO;CACX,KAAK,IAAMC,KAAKC,GAAQ;EACtB,IAAI,CAAC,OAAO,SAASD,CAAC,GAAG;EACzB,IAAIE,IAAI;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B,EAAiB,KAAKlB,GAAWC,CAAM;GACvC4B;EACE;;AAET,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as e } from "./CurveEditor-
|
|
1
|
+
import { n as e } from "./CurveEditor-jVBEqqdv.js";
|
|
2
2
|
import { jsx as t } from "react/jsx-runtime";
|
|
3
3
|
//#region src/components/PointPlotter/PointPlotter.tsx
|
|
4
4
|
function n(n) {
|
|
@@ -14,4 +14,4 @@ function n(n) {
|
|
|
14
14
|
//#endregion
|
|
15
15
|
export { n as t };
|
|
16
16
|
|
|
17
|
-
//# sourceMappingURL=PointPlotter-
|
|
17
|
+
//# sourceMappingURL=PointPlotter-BZ_vk6gV.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PointPlotter-
|
|
1
|
+
{"version":3,"file":"PointPlotter-BZ_vk6gV.js","names":["CurveEditor","PointPlotter","curveProps","props"],"sources":["../../src/components/PointPlotter/PointPlotter.tsx"],"sourcesContent":["import type { CSSProperties, ReactNode } from 'react';\nimport {\n CurveEditor,\n type AnchorRenderProps,\n type ControlPoint,\n type CurveEditorProps,\n} from '../CurveEditor';\nimport type { GridSettings, AxesSettings, TickSettings } from '../Plot2D';\n\n/** Props for {@link PointPlotter}. */\nexport interface PointPlotterProps {\n /** Plotted points; caller-owned. */\n value: readonly ControlPoint[];\n /** Fires every frame during drag with the live in-flight value. */\n onInput: (next: ControlPoint[]) => void;\n /** Fires once per discrete user action (drag-end, add, delete) with\n * the new value and the value at gesture start. Wire history here. */\n onChange?: (next: ControlPoint[], prev: readonly ControlPoint[]) => void;\n /** Model-space x range. Default [0, 1]. */\n xRange?: readonly [number, number];\n /** Model-space y range. Default [0, 1]. */\n yRange?: readonly [number, number];\n width: number;\n height: number;\n grid?: GridSettings | false | null;\n axes?: AxesSettings | false | null;\n xTicks?: TickSettings | false | null;\n yTicks?: TickSettings | false | null;\n /** Minimum allowed point count. User-initiated deletion is refused\n * while `value.length <= minPoints`. */\n minPoints?: number;\n /** Maximum allowed point count. User-initiated insertion is refused\n * while `value.length >= maxPoints`. */\n maxPoints?: number;\n /** How new points are added. Default `'click-empty'`. Set to `'never'`\n * to disable insertion entirely. */\n addPointMode?: 'click-empty' | 'never';\n /** Built-in undo/redo via keyboard when the component has focus.\n * Default `true`. See `CurveEditor.history` for details. */\n history?: boolean;\n /** Custom per-anchor renderer. See `CurveEditor.renderAnchor`. */\n renderAnchor?: (info: AnchorRenderProps) => ReactNode;\n /** Extra SVG content beneath the anchors. See `CurveEditor.decorations`. */\n decorations?: ReactNode;\n className?: string;\n style?: CSSProperties;\n}\n\n/**\n * 2D point plotter — a CurveEditor with the curve hidden. Anchors,\n * drag, shift+click delete, right-click delete, and click-empty insert\n * are inherited from CurveEditor verbatim, so the two components share\n * gesture semantics and stay in sync as CurveEditor evolves.\n *\n * Differences from CurveEditor: no curve `<path>` drawn, no fill, no\n * endpoint pinning, no interpolation, default `addPointMode` is\n * `'click-empty'` (CurveEditor defaults to `'click-curve'`, which\n * doesn't make sense without a curve to hit-test against).\n */\nexport function PointPlotter(props: PointPlotterProps) {\n const curveProps: CurveEditorProps = {\n ...props,\n addPointMode: props.addPointMode ?? 'click-empty',\n curve: false,\n fill: false,\n endpoints: 'free',\n };\n return <CurveEditor {...curveProps} />;\n}\n"],"mappings":";;;AA2DA,SAAgBC,EAAa,GAA0B;CACrD,IAAMC,IAA+B;EACnC,GAAGC;EACH,cAAcA,EAAM,gBAAgB;EACpC,OAAO;EACP,MAAM;EACN,WAAW;CACb;CACA,OAAO,kBAACH,GAAD,EAAa,GAAIE,EAAa,CAAA;AACvC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as e } from "./Badge-
|
|
1
|
+
import { t as e } from "./Badge-jYQjrTKc.js";
|
|
2
2
|
import { jsx as t } from "react/jsx-runtime";
|
|
3
3
|
var n = {
|
|
4
4
|
row: "_row_1a09e_1",
|
|
@@ -39,4 +39,4 @@ function r({ segments: r, startCap: i = "flat", size: a, variant: o, depth: s, g
|
|
|
39
39
|
//#endregion
|
|
40
40
|
export { r as t };
|
|
41
41
|
|
|
42
|
-
//# sourceMappingURL=Powerline-
|
|
42
|
+
//# sourceMappingURL=Powerline-6wIFmDik.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Powerline-
|
|
1
|
+
{"version":3,"file":"Powerline-6wIFmDik.js","names":["s","Badge","Powerline_module_default","Powerline","rest","cls","className","style","gap","segments","leftEdge","i","startCap","rightEdge","seg","depth","variant","size"],"sources":["../../src/components/Powerline/Powerline.module.css","../../src/components/Powerline/Powerline.tsx"],"sourcesContent":[".row {\n display: inline-flex;\n align-items: stretch;\n gap: var(--powerline-gap, 0.2em);\n}\n\n.matrix {\n display: grid;\n gap: var(--wzl-space-6);\n}\n\n/* Reset Badge's opinionated text defaults — Powerline segments should pick up\n * the surrounding text style instead of forcing uppercase / 10px / extra\n * tracking. Consumers can still override via className on Powerline. */\n.segment {\n font-size: inherit;\n text-transform: none;\n letter-spacing: normal;\n}\n","import type { CSSProperties, ReactNode } from 'react';\nimport { Badge } from '../Badge/Badge';\nimport type { BadgeSize, BadgeStatus, BadgeVariant } from '../Badge/types';\nimport type { StanceProps } from '../stance';\nimport type { EdgeCap } from '../Badge/bases/edgeProfiles';\nimport s from './Powerline.module.css';\n\n/**\n * One segment of a {@link Powerline}. Giving it `onClick` or `href` makes it\n * interactive, the same way it does on a `Badge`.\n */\nexport interface PowerlineSegment extends StanceProps {\n text: ReactNode;\n /** Cap on this segment's right edge. Next segment's left edge adopts the same profile. */\n endCap?: EdgeCap;\n status?: BadgeStatus;\n variant?: BadgeVariant;\n size?: BadgeSize;\n onClick?: () => void;\n href?: string;\n 'aria-label'?: string;\n}\n\n/** Props for {@link Powerline}. */\nexport interface PowerlineProps {\n segments: PowerlineSegment[];\n /** Left edge of the first segment. Defaults to 'flat'. */\n startCap?: EdgeCap;\n /** Default size for every segment (per-segment `size` wins). */\n size?: BadgeSize;\n /** Default variant for every segment (per-segment `variant` wins). */\n variant?: BadgeVariant;\n /** Protrusion depth in CSS px, passed through to every segment's base. */\n depth?: number;\n /** Visible gap between adjacent segments. Number → px; string → literal CSS length.\n * Default: `0.2em` (scales with the row's font size). Pass `0` for flush. */\n gap?: number | string;\n className?: string;\n 'aria-label'?: string;\n}\n\n/**\n * A row of chevron-linked badge segments, in the style of a shell powerline\n * prompt. Each segment's `endCap` shapes both its own right edge and the next\n * segment's left edge, so the run reads as one continuous chain.\n *\n * Built for showing a path through a sequence of steps — the inspector uses\n * it to display how input routes from tool to gesture to action to target.\n */\nexport function Powerline({\n segments,\n startCap = 'flat',\n size,\n variant,\n depth,\n gap,\n className,\n ...rest\n}: PowerlineProps) {\n const cls = [s.row, className].filter(Boolean).join(' ');\n const style: CSSProperties | undefined = gap !== undefined\n ? { ['--powerline-gap' as never]: typeof gap === 'number' ? `${gap}px` : gap }\n : undefined;\n return (\n <span className={cls} style={style} aria-label={rest['aria-label']}>\n {segments.map((seg, i) => {\n const leftEdge: EdgeCap = i === 0 ? startCap : (segments[i - 1].endCap ?? 'flat');\n const rightEdge: EdgeCap = seg.endCap ?? 'flat';\n return (\n <Badge\n key={i}\n base=\"powerline\"\n baseParams={{ leftEdge, rightEdge, ...(depth !== undefined && { depth }) }}\n status={seg.status}\n stance={seg.stance}\n tone={seg.tone}\n variant={seg.variant ?? variant}\n size={seg.size ?? size}\n onClick={seg.onClick}\n href={seg.href}\n aria-label={seg['aria-label']}\n className={s.segment}\n >\n {seg.text}\n </Badge>\n );\n })}\n </span>\n );\n}\n"],"mappings":";;;;;;;;;ACiDA,SAAgBG,EAAU,EACxB,aACA,cAAW,QACX,SACA,YACA,UACA,QACA,cACA,GAAGC,KACc;CACjB,IAAMC,IAAM,CAACL,EAAE,KAAKM,CAAS,CAAC,CAAC,OAAO,OAAO,CAAC,CAAC,KAAK,GAAG,GACjDC,IAAmCC,MAAQ,KAAA,IAE7C,KAAA,IADA,EAAG,mBAA6B,OAAOA,KAAQ,WAAW,GAAGA,EAAI,MAAMA,EAAI;CAE/E,OACE,kBAAC,QAAD;EAAM,WAAWH;EAAY;EAAO,cAAYD,EAAK;EAClD,UAAAK,EAAS,KAAK,GAAK,MAAM;GACxB,IAAMC,IAAoBC,MAAM,IAAIC,IAAYH,EAASE,IAAI,EAAE,CAAC,UAAU,QACpEE,IAAqBC,EAAI,UAAU;GACzC,OACE,kBAACb,GAAD;IAEE,MAAK;IACL,YAAY;KAAE;KAAU;KAAW,GAAIc,MAAU,KAAA,KAAa,EAAE,SAAM;IAAG;IACzE,QAAQD,EAAI;IACZ,QAAQA,EAAI;IACZ,MAAMA,EAAI;IACV,SAASA,EAAI,WAAWE;IACxB,MAAMF,EAAI,QAAQG;IAClB,SAASH,EAAI;IACb,MAAMA,EAAI;IACV,cAAYA,EAAI;IAChB,WAAWd,EAAE;IAEZ,UAAAc,EAAI;GACA,GAdAH,CAcA;EAEX,CAAC;CACG,CAAA;AAEV"}
|