@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
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"model-BaF65rnX.js","names":["s","Fragment","ICON_PATHS","PropertyControl","ToggleBar","prefFieldProps","Fragment$1","SelectionPanel_module_default","isFlagCell","cell","leaf","renderers","renderCells","out","i","cells","content","j","run","c","FlagBar","flags","on","f","field","now","next","renderBuiltin","ctx","pref","ObjectLeaf","ariaLabel","settledOnly","selectionKey","nested","held","allGrouped","child","rowsOf","isRow","v","pending","flush","prev","key","block","children","labeled","inner","indent","childPath","update","base","fn","_dropped","rest","childCtx","custom","rendered","Icon","entry","rows","classifyKind","node","routing","isGroup","n","flatten","sections","untitled","collect","group","into","schema","leaves","pairRows","item","pair","effectiveSections","uniq","kinds","byName","entries","schemas","k","s","first","flatFirst","leafKey","l","restKeys","r","keep","set","section","row","nodeValueAt","segments","path","head","cursor","setAtPath","root","value","aggregateValue","nodes","MIXED","kindBreakdown","counts"],"sources":["../../src/components/SelectionPanel/SelectionPanel.module.css","../../src/components/SelectionPanel/renderLeaf.tsx","../../src/components/SelectionPanel/model.ts"],"sourcesContent":[".root {\n display: flex;\n flex-direction: column;\n font-size: var(--wzl-font-size-sm);\n color: var(--wzl-fg);\n}\n\n.header {\n display: flex;\n align-items: baseline;\n gap: var(--wzl-space-4);\n padding: var(--wzl-space-4) 0;\n border-block-end: 1px solid var(--wzl-border);\n}\n\n.kind {\n font-weight: var(--wzl-font-weight-bold);\n font-size: var(--wzl-font-size);\n}\n\n.breakdown {\n font-size: var(--wzl-font-size-sm);\n opacity: 0.6;\n}\n\n.section {\n padding: var(--wzl-space-3) 0 var(--wzl-space-4);\n border-block-end: 1px solid var(--wzl-border);\n}\n\n.section:last-child {\n border-block-end: none;\n}\n\n.sectionTitle {\n margin: 0 0 var(--wzl-space-3);\n font-size: var(--wzl-font-size-xs);\n font-weight: var(--wzl-font-weight-bold);\n text-transform: uppercase;\n letter-spacing: 0.06em;\n opacity: 0.55;\n}\n\n.row {\n display: grid;\n grid-template-columns: 64px 1fr;\n gap: var(--wzl-space-3);\n align-items: center;\n margin-block-end: 5px;\n}\n\n.rowLabel {\n opacity: 0.75;\n}\n\n.rowControls {\n display: flex;\n flex-wrap: wrap;\n gap: var(--wzl-space-3);\n align-items: center;\n min-inline-size: 0;\n}\n\n/* Glyph plus its control, held together so the pair row wraps between\n fields rather than between a field and the icon naming it. */\n.namedField {\n display: flex;\n align-items: center;\n gap: var(--wzl-space-2);\n min-inline-size: 0;\n}\n\n.namedField > svg {\n flex: none;\n opacity: 0.75;\n}\n\n.blockRow {\n margin-block-end: 5px;\n}\n\n/* Fields paired into one row split it evenly, the way Position's x/y do. */\n.rowControls > .namedField {\n flex: 1 1 0;\n}\n\n/* Except around a segmented bar, which is sized by its segments: an equal\n share of the row is wider than the buttons want to be. */\n.rowControls > .namedField:has(> .toggle) {\n flex: 0 1 auto;\n}\n\n.rowControls > * {\n flex: 1;\n min-inline-size: 0;\n}\n\n/* Bars sharing a row split the leftover between them, so the gap stays fixed\n and the width lands on the segments. A bar with the row to itself is sized\n by its segments instead — a third of 240px is a plate, not a button. */\n.rowControls > .toggle {\n flex: 1 1 auto;\n}\n\n.rowControls > .toggle:only-child {\n flex: 0 1 auto;\n}\n\n/* A flag bar is sized by its glyphs rather than by a share of the row: an\n even split would fling one-letter segments to the margins. */\n.rowControls > .flagToggle {\n flex: 0 0 auto;\n}\n\n.number :global(input),\n.select {\n font-size: var(--wzl-font-size-sm);\n}\n\n.unrenderable {\n font-size: var(--wzl-font-size-sm);\n opacity: 0.5;\n font-style: italic;\n}\n\n/* A `block` leaf that renders its own rows — an object leaf's fields. */\n.objectLeaf {\n margin-block: var(--wzl-space-4) var(--wzl-space-2);\n}\n\n.objectLeaf .sectionTitle {\n margin-block: 7px 5px;\n}\n\n/* Fields under a heading inside an object read as belonging to it. */\n.objectGroup {\n padding-inline-start: var(--wzl-space-4);\n border-inline-start: 1px solid var(--wzl-border);\n margin-block-end: var(--wzl-space-2);\n}\n\n/* The slider's track; the row only says how it shares the space. */\n.slider {\n flex: 1;\n}\n","/**\n * A selection's leaves as cells: one `ToolPrefLeaf` and its aggregated value\n * in, one rendered cell out, plus the run logic that turns a row of paired\n * toggles into a single segmented bar and the rows of an object leaf.\n *\n * The control itself is `PropertyControl`'s, through `prefFieldProps`; what\n * is decided here is how a selection surface sizes and composes it.\n * `ToolOptionsBar` renders a tool's options through the same functions.\n */\nimport { Fragment, type ReactNode } from 'react';\nimport type {\n ToolPrefBoolean,\n ToolPrefGroup,\n ToolPrefLeaf,\n ToolPrefObject,\n} from '@weasel-js/core';\nimport { prefFieldProps } from '../Prefs/prefField';\nimport { PropertyControl, type PropertyBooleanFieldProps } from '../Properties/PropertyField';\nimport { ToggleBar } from '../ToggleBar';\nimport { Icon } from '../../icons/Icon';\nimport { ICON_PATHS, type IconName } from '../../icons/paths';\nimport s from './SelectionPanel.module.css';\n\n\n/** What a {@link PropertyRenderer} is given for the property it is rendering. */\nexport interface PropertyRenderContext {\n /** Dotted node path of the leaf (`pose.x`, `data.fill`). */\n path: string;\n /** The schema leaf. App renderers narrow it to their own kind shape. */\n pref: ToolPrefLeaf;\n /** Aggregated value across the selection; `undefined` when mixed or unset. */\n value: unknown;\n /** True when selected nodes disagree at this path. */\n mixed: boolean;\n /**\n * True when the nodes agree and what they agree on is nothing — the field\n * is absent, and whatever paints comes from a fallback further down.\n *\n * Distinct from `mixed`, and both leave `value` undefined. A control must\n * not substitute its schema default here: doing so shows a value the node\n * does not hold, and the next edit writes that invention back.\n */\n unset: boolean;\n /**\n * The fields of the object this leaf is a field of — `undefined` for a\n * top-level leaf, and for a field of an object the node does not hold.\n *\n * What a control needs when its own field doesn't carry the whole answer:\n * a stroke's dash lengths are multiples of the stroke's width, so reading\n * the array as a style takes both.\n */\n siblings?: Record<string, unknown>;\n /** Commit a value — fans out to every selected node in one undo step. */\n setValue: (value: unknown) => void;\n /**\n * Commit a value derived from what each node holds at this path, in one undo\n * step. What `setValue` cannot do across a selection whose nodes differ: a\n * field of an object leaf has to land in each node's own object, not in one\n * object written over all of them.\n */\n update: (fn: (prev: unknown) => unknown) => void;\n /**\n * The aggregated value at another node path — what `value` and `mixed` are\n * for this leaf's own path, for any path.\n *\n * A control whose subject spans more than one field needs it: a font picker\n * reporting which variant will actually paint has to read the node's weight\n * and style. Reading it off `value` is impossible — a leaf is handed one\n * field.\n */\n valueAt: (path: string) => { value: unknown; mixed: boolean };\n /**\n * The ids of the nodes the values were read from, joined. It changes exactly\n * when the selection does, so a control holding scratch that belongs to one\n * selection can key on it and be remounted rather than carry it to the next.\n * Absent where the values come from no selection, as in a tool options bar.\n */\n selectionKey?: string;\n}\n\n/**\n * Renders the control for one property across the whole selection.\n * Returning `null` collapses the leaf.\n */\nexport type PropertyRenderer = (ctx: PropertyRenderContext) => ReactNode;\n\n\n/**\n * One leaf with its context built but nothing rendered yet.\n *\n * Deferring the render is what lets a run of sibling flags become one bar:\n * whether a leaf joins its neighbors is a fact about the run, which no leaf\n * rendering itself can see.\n */\nexport interface LeafCell {\n key: string;\n leaf: ToolPrefLeaf;\n ctx: PropertyRenderContext;\n /** The accessible name this leaf's control carries — qualified by the row's\n * pair where the row holds more than one leaf. */\n ariaLabel: string;\n /** Renders the leaf on its own, chrome and all. */\n render: () => ReactNode;\n}\n\n/** A cell's content, once the run it belongs to has been decided. */\nexport interface RenderedCell {\n key: string;\n /** The leaf that names the cell — the run's first, for a flag bar. */\n leaf: ToolPrefLeaf;\n block: boolean;\n content: ReactNode;\n}\n\n/**\n * True for a leaf that can join a flag bar: a paired toggle boolean the\n * consumer has not claimed with a renderer of its own.\n */\nexport function isFlagCell(cell: LeafCell, renderers?: Record<string, PropertyRenderer>): boolean {\n const { leaf } = cell;\n return (\n leaf.kind === 'boolean' &&\n (leaf as ToolPrefBoolean).control === 'toggle' &&\n leaf.pair !== undefined &&\n renderers?.[cell.ctx.path] === undefined &&\n renderers?.[leaf.kind] === undefined\n );\n}\n\n/**\n * Renders a row's cells, collapsing each run of adjacent same-`pair` toggle\n * booleans into one segmented bar — the idiom the enum toggle a row away\n * already uses, rather than one detached pill per flag.\n */\nexport function renderCells(\n cells: readonly LeafCell[],\n renderers?: Record<string, PropertyRenderer>,\n): RenderedCell[] {\n const out: RenderedCell[] = [];\n for (let i = 0; i < cells.length; ) {\n const cell = cells[i];\n if (!isFlagCell(cell, renderers)) {\n const content = cell.render();\n if (content != null) {\n out.push({ key: cell.key, leaf: cell.leaf, block: cell.leaf.block === true, content });\n }\n i += 1;\n continue;\n }\n let j = i + 1;\n while (\n j < cells.length &&\n isFlagCell(cells[j], renderers) &&\n cells[j].leaf.pair === cell.leaf.pair\n ) {\n j += 1;\n }\n const run = cells.slice(i, j);\n out.push({\n key: cell.key,\n leaf: cell.leaf,\n block: run.every((c) => c.leaf.block === true),\n content: <FlagBar run={run} ariaLabel={cell.leaf.pair as string} />,\n });\n i = j;\n }\n return out;\n}\n\n/**\n * A run of paired boolean flags as one multi-select bar — U / S / O, the way\n * every text editor draws them.\n */\nfunction FlagBar({ run, ariaLabel }: { run: readonly LeafCell[]; ariaLabel: string }): ReactNode {\n // Each flag through the same field props a lone one gets, so an `encoding`\n // (Italic stored as `fontStyle`) reads and writes the same way in a bar.\n const flags = run.map((c) => {\n const field = prefFieldProps(c.leaf, {\n value: c.ctx.value,\n mixed: c.ctx.mixed,\n unset: c.ctx.unset,\n siblings: c.ctx.siblings,\n setValue: c.ctx.setValue,\n }) as PropertyBooleanFieldProps;\n return { cell: c, field };\n });\n const on = flags.filter((f) => !f.cell.ctx.mixed && f.field.value === true).map((f) => f.cell.key);\n return (\n <ToggleBar<string>\n mode=\"multiple\"\n size=\"sm\"\n variant=\"flat\"\n className={s.flagToggle}\n ariaLabel={ariaLabel}\n items={flags.map(({ cell, field }) => ({\n value: cell.key,\n label: field.glyph ?? cell.leaf.name.slice(0, 1),\n ariaLabel: cell.ariaLabel,\n tooltip: field.glyph !== undefined && typeof field.glyph !== 'string' ? cell.leaf.name : undefined,\n }))}\n value={on}\n // Each flag owns its own path, so only the segment that moved is\n // written — committing the run would write two fields nobody touched,\n // and inside an object leaf would fabricate values for the other two.\n mixedValues={run.filter((c) => c.ctx.mixed).map((c) => c.key)}\n onChange={(next) => {\n for (const { cell, field } of flags) {\n const now = next.includes(cell.key);\n if (now !== on.includes(cell.key)) field.onChange(now);\n }\n }}\n />\n );\n}\n\nexport function renderBuiltin(\n ctx: PropertyRenderContext,\n ariaLabel: string,\n renderers?: Record<string, PropertyRenderer>,\n /** Identifies the current selection, so a control holding per-selection\n * scratch (the paint kind memory) is remounted rather than carried over. */\n selectionKey = '',\n /** True for a field of an object leaf. Such a field writes itself into its\n * parent, so it can only hold values its parent's type permits — which is\n * what rules \"none\" out for a nested paint. */\n nested = false,\n): ReactNode {\n const { pref, value, mixed, unset, setValue } = ctx;\n if (pref.kind === 'object') {\n // One value with fields hanging off it. Each child writes the parent\n // whole, so a field is never set on a half-built object.\n return <ObjectLeaf ctx={ctx} renderers={renderers} selectionKey={selectionKey} />;\n }\n const field = prefFieldProps(pref, {\n value,\n mixed,\n unset,\n siblings: ctx.siblings,\n setValue,\n // The substitution probe runs at the node's own weight and style, so the\n // picker names the variant that will actually paint. A mixed selection\n // has no single one; the probe falls back to 400/normal there.\n fontVariant: {\n weight: ctx.valueAt('data.style.fontWeight').value,\n style: ctx.valueAt('data.style.fontStyle').value,\n },\n });\n if (field === null) {\n return <span className={s.unrenderable}>({pref.kind}: no renderer)</span>;\n }\n switch (field.kind) {\n case 'boolean':\n // A panel's flag is a switch unless it asks otherwise.\n return (\n <PropertyControl\n {...field}\n name={ariaLabel}\n control={field.control ?? 'switch'}\n className={field.control === 'toggle' ? s.flagToggle : undefined}\n />\n );\n case 'number':\n return (\n <PropertyControl\n {...field}\n name={ariaLabel}\n className={field.control === 'slider' ? s.slider : s.number}\n // A typed number writes once it is entered, as text does; a slider\n // writes as it moves.\n onInput={field.control === 'slider' ? field.onInput : settledOnly}\n />\n );\n case 'string':\n // Settled values only: a live write per keystroke would be one undo\n // step per character.\n return <PropertyControl {...field} name={ariaLabel} onInput={settledOnly} />;\n case 'enum':\n return (\n <PropertyControl\n {...field}\n name={ariaLabel}\n // A clearable toggle is a set of exclusive flags, and sits beside\n // other flags sized the way they are.\n className={\n field.control === 'toggle'\n ? field.onClear ? s.flagToggle : s.toggle\n : field.control === 'radio' ? undefined : s.select\n }\n />\n );\n case 'font-family':\n return <PropertyControl {...field} name={ariaLabel} className={s.select} />;\n case 'paint':\n return (\n <PropertyControl\n {...field}\n name={ariaLabel}\n // Per-kind switch memory is scratch for one selection; carrying it\n // across would recall the previous node's gradient.\n key={selectionKey}\n control=\"inline\"\n // A nested paint writes one field of its parent, and no kit paint\n // field is optional — `Stroke.paint` is required. Removing the\n // whole parent is a different edit than repainting it, so the\n // control must not offer one as the other.\n allowNone={!nested}\n />\n );\n case 'color':\n // One write per gesture, not one per step of the picker.\n return <PropertyControl {...field} name={ariaLabel} onInput={settledOnly} />;\n }\n}\n\nconst settledOnly = (): void => {};\n\n/**\n * Renders an object leaf: a titled block whose rows are the object's own\n * fields. A child's edit commits the parent object, never the child's path —\n * writing into a path whose value is not an object yet would corrupt it.\n */\n/** One labeled row inside an object leaf; `pair` merges adjacent fields into\n * it, exactly as the section rows merge theirs. */\ninterface ObjectRow {\n key: string;\n pair?: string;\n label: string;\n title?: string;\n /** Every field in the row brought its own chrome, so the row drops the\n * label column and spans the block. One unlabeled field in an otherwise\n * labeled pair would leave the row named after half of itself. */\n block: boolean;\n controls: ReactNode[];\n}\n\n/**\n * Renders an object leaf: the object's own fields, as rows. A child's edit\n * commits the parent object, never the child's path — writing into a path\n * whose value is not an object yet would corrupt it.\n */\nfunction ObjectLeaf({\n ctx,\n renderers,\n selectionKey = '',\n}: {\n ctx: PropertyRenderContext;\n renderers?: Record<string, PropertyRenderer>;\n selectionKey?: string;\n}): ReactNode {\n const pref = ctx.pref as ToolPrefObject;\n const held = typeof ctx.value === 'object' && ctx.value !== null\n ? (ctx.value as Record<string, unknown>)\n : undefined;\n\n // A value whose fields are entirely grouped is titled by those groups — its\n // own heading would stack onto the first one and name nothing new.\n const allGrouped = Object.values(pref.children).every((child) => !('kind' in child));\n\n // `indent` is false when nothing visible sits above these rows: depth is\n // drawn only where a label marks it.\n const rowsOf = (\n children: Record<string, ToolPrefLeaf | ToolPrefGroup>,\n indent: boolean,\n ): ReactNode[] => {\n const out: (ReactNode | ObjectRow)[] = [];\n const isRow = (v: ReactNode | ObjectRow): v is ObjectRow =>\n typeof v === 'object' && v !== null && 'controls' in v;\n\n // Cells accumulate unrendered so a run of adjacent same-`pair` flags can\n // be seen as a run before any of them draws; a group heading between two\n // fields ends the run, exactly as it ends a paired row.\n let pending: LeafCell[] = [];\n const flush = (): void => {\n for (const { key, leaf, block, content } of renderCells(pending, renderers)) {\n const prev = out[out.length - 1];\n if (leaf.pair !== undefined && isRow(prev) && prev.pair === leaf.pair) {\n prev.controls.push(<Fragment key={key}>{content}</Fragment>);\n prev.block &&= block;\n continue;\n }\n out.push({\n key,\n pair: leaf.pair,\n label: leaf.pair ?? leaf.name,\n title: leaf.description,\n block,\n controls: [<Fragment key={key}>{content}</Fragment>],\n });\n }\n pending = [];\n };\n\n for (const [key, child] of Object.entries(children)) {\n // A group among the children organises the fields under a heading\n // without contributing to the path — the rule group keys follow at the\n // top level.\n if (!('kind' in child)) {\n const labeled = child.name !== '';\n const inner = rowsOf(child.children, labeled);\n if (inner.length === 0) continue;\n flush();\n out.push(\n <div key={`group:${key}`} className={labeled && indent ? s.objectGroup : undefined}>\n {labeled && <h5 className={s.sectionTitle}>{child.name}</h5>}\n {inner}\n </div>,\n );\n continue;\n }\n const childPath = `${ctx.path}.${key}`;\n // Nodes whose objects differ still agree or disagree field by field: two\n // styles at different sizes are both upright, and saying \"mixed\" for\n // every field of them hides that.\n const field = ctx.mixed ? ctx.valueAt(childPath) : { value: held?.[key], mixed: false };\n // Each node's own object, with this one field changed. Deriving it per\n // node is what keeps a multi-selection edit from writing one node's\n // object over all the others.\n const update = (fn: (prev: unknown) => unknown): void =>\n ctx.update((prev) => {\n // The node holds no object yet, so writing one field has to\n // materialize the rest: the leaf's `default` is what a complete\n // value looks like. Starting from `{}` instead committed the one\n // field on its own — a `data.stroke` of `{ width: 2 }` with no\n // `paint`, which the type forbids and the painter threw on, taking\n // the whole frame and the visible document with it.\n const base: Record<string, unknown> =\n typeof prev === 'object' && prev !== null\n ? (prev as Record<string, unknown>)\n : (pref.fromScalar?.(prev)\n ?? (typeof pref.default === 'object' && pref.default !== null\n ? { ...(pref.default as Record<string, unknown>) }\n : {}));\n const v = fn(base[key]);\n if (v === undefined) {\n // A field written as absent is absent — leaving the key holding\n // `undefined` says the object has a dash of nothing.\n const { [key]: _dropped, ...rest } = base;\n return rest;\n }\n return { ...base, [key]: v };\n });\n const childCtx: PropertyRenderContext = {\n path: childPath,\n pref: child,\n value: field.mixed ? undefined : field.value,\n mixed: field.mixed,\n // A field of an object the node does not hold is unset, and so is one\n // the object omits — `data.stroke` absent leaves every stroke field\n // with nothing behind it, not with the schema's defaults.\n unset: !field.mixed && field.value === undefined,\n siblings: held,\n valueAt: ctx.valueAt,\n selectionKey: ctx.selectionKey,\n update,\n setValue: (v) => update(() => v),\n };\n pending.push({\n key: childPath,\n leaf: child,\n ctx: childCtx,\n ariaLabel: child.name,\n render: () => {\n const custom = renderers?.[childPath] ?? renderers?.[child.kind];\n const rendered = custom\n ? custom(childCtx)\n : renderBuiltin(childCtx, child.name, renderers, selectionKey, true);\n if (rendered == null) return null;\n // Neither a paired row nor a block one gives a field its own label\n // column, so the glyph is all that names it on screen. The control\n // already carries `name` as its accessible name, which leaves the\n // glyph decorative.\n const unlabeled = child.pair !== undefined || child.block === true;\n const glyph = unlabeled && child.icon && child.icon in ICON_PATHS;\n if (!glyph) return rendered;\n return (\n <span className={s.namedField}>\n <Icon name={child.icon as IconName} size={14} />\n {rendered}\n </span>\n );\n },\n });\n }\n flush();\n return out.map((entry) =>\n typeof entry === 'object' && entry !== null && 'controls' in entry ? (\n entry.block ? (\n <div key={entry.key} className={`${s.rowControls} ${s.blockRow}`} title={entry.title}>\n {entry.controls}\n </div>\n ) : (\n <div key={entry.key} className={s.row}>\n <span className={s.rowLabel} title={entry.title}>{entry.label}</span>\n <span className={s.rowControls}>{entry.controls}</span>\n </div>\n )\n ) : (\n entry\n ),\n );\n };\n\n const rows = rowsOf(pref.children, !allGrouped);\n if (rows.length === 0) return null;\n return (\n <div className={s.objectLeaf}>\n {!allGrouped && <h4 className={s.sectionTitle}>{pref.name}</h4>}\n {rows}\n </div>\n );\n}\n","// Pure selection→panel derivations for SelectionPanel. Kept free of\n// React so intersection/aggregation semantics are unit-testable.\n//\n// Path convention (see core `NodePropertiesEntry`): a leaf's OWN KEY in\n// the schema is its node path — a dotted path of any depth rooted at\n// `pose` or `data` (`pose.x`, `data.fill`, `data.style.fontSize`). Group\n// keys are organizational only.\n\nimport {\n MIXED,\n type Mixed,\n type NodePropertiesEntry,\n type NodeRoutingEntry,\n type SceneNode,\n type ToolPrefGroup,\n type ToolPrefLeaf,\n} from '@weasel-js/core';\n\n// Re-exported under its existing public name here: the kit-wide \"these\n// values disagree\" sentinel (`@weasel-js/core`'s `MIXED`) also covers\n// multi-node aggregation, so this panel doesn't get its own symbol.\nexport { MIXED };\nexport type { Mixed };\n\nexport type AnyNode = SceneNode<unknown, string, unknown>;\n\n/**\n * One editable property in a {@link SelectionPanel}, paired with the dotted\n * node path it reads and writes.\n */\nexport interface PanelLeaf {\n /** Dotted node path — the leaf's key in the schema. */\n path: string;\n leaf: ToolPrefLeaf;\n}\n\n/**\n * One labeled row of a panel section. Holds several leaves when the schema\n * paired them.\n */\nexport interface PanelRow {\n label: string;\n leaves: PanelLeaf[];\n}\n\n/**\n * A titled block of rows, derived from one top-level group of a properties\n * schema. `key` is that group's schema key.\n */\nexport interface PanelSection {\n key: string;\n name: string;\n rows: PanelRow[];\n}\n\n/** Derive a node's kind: containers are `'group'`; leaves classify their\n * `data` through the routing entries (first match wins, `'unknown'`\n * otherwise) — same semantics as core's `NodeRouting.classify`. */\nexport function classifyKind(\n node: AnyNode,\n routing: readonly NodeRoutingEntry[],\n): string {\n if (node.kind === 'container') return 'group';\n for (const entry of routing) {\n if (entry.matches(node.data)) return entry.name;\n }\n return 'unknown';\n}\n\nexport function isGroup(n: ToolPrefLeaf | ToolPrefGroup): n is ToolPrefGroup {\n return !('kind' in n);\n}\n\n/** Flatten a schema to sections of leaves. Nested groups fold into their\n * top-level section; top-level leaves get an untitled leading section. */\nfunction flatten(schema: ToolPrefGroup): PanelSection[] {\n const sections: PanelSection[] = [];\n const untitled: PanelLeaf[] = [];\n\n const collect = (group: ToolPrefGroup, into: PanelLeaf[]): void => {\n for (const [key, child] of Object.entries(group.children)) {\n if (isGroup(child)) collect(child, into);\n else into.push({ path: key, leaf: child });\n }\n };\n\n for (const [key, child] of Object.entries(schema.children)) {\n if (isGroup(child)) {\n const leaves: PanelLeaf[] = [];\n collect(child, leaves);\n sections.push({ key, name: child.name, rows: pairRows(leaves) });\n } else {\n untitled.push({ path: key, leaf: child });\n }\n }\n if (untitled.length > 0) {\n sections.unshift({ key: '', name: '', rows: pairRows(untitled) });\n }\n return sections;\n}\n\n/** Merge consecutive leaves sharing a `pair` id into one labeled row. */\nexport function pairRows(leaves: readonly PanelLeaf[]): PanelRow[] {\n const rows: PanelRow[] = [];\n for (const item of leaves) {\n const pair = item.leaf.pair;\n const prev = rows[rows.length - 1];\n if (pair !== undefined && prev !== undefined && prev.label === pair) {\n prev.leaves.push(item);\n } else {\n rows.push({ label: pair ?? item.leaf.name, leaves: [item] });\n }\n }\n return rows;\n}\n\n/**\n * The schema the panel shows for a set of kinds: one kind → its full\n * schema; several → the intersection by (path, leaf kind), shaped by the\n * first kind's section/row layout. Kinds without a registered schema\n * contribute nothing, so their presence collapses the intersection.\n */\nexport function effectiveSections(\n kinds: readonly string[],\n entries: readonly NodePropertiesEntry[],\n): PanelSection[] {\n const uniq = [...new Set(kinds)];\n if (uniq.length === 0) return [];\n const byName = new Map(entries.map((e) => [e.name, e]));\n const schemas = uniq.map((k) => byName.get(k)?.schema);\n if (schemas.some((s) => s === undefined)) return [];\n const [first, ...rest] = schemas as ToolPrefGroup[];\n\n const flatFirst = flatten(first);\n if (rest.length === 0) return flatFirst;\n\n // '\\0' delimiter: path and kind strings are unconstrained, so a\n // printable separator could collide with real content.\n const leafKey = (l: PanelLeaf): string => `${l.path}\\0${l.leaf.kind}`;\n const restKeys = rest.map(\n (schema) =>\n new Set(\n flatten(schema)\n .flatMap((s) => s.rows)\n .flatMap((r) => r.leaves)\n .map(leafKey),\n ),\n );\n const keep = (l: PanelLeaf): boolean =>\n restKeys.every((set) => set.has(leafKey(l)));\n\n return flatFirst\n .map((section) => ({\n ...section,\n rows: section.rows\n .map((row) => ({ ...row, leaves: row.leaves.filter(keep) }))\n .filter((row) => row.leaves.length > 0),\n }))\n .filter((section) => section.rows.length > 0);\n}\n\n/** Read a node value at a dotted path of any depth (`pose.x`,\n * `data.style.fontSize`, `data.style.fill.color`). Returns `undefined` if\n * the path is dotless (mirrors `commit`'s no-op on a malformed schema\n * key) or if any intermediate segment is missing or not an object. */\nexport function nodeValueAt(node: AnyNode, path: string): unknown {\n const segments = path.split('.');\n if (segments.length < 2) return undefined;\n const head = segments[0];\n let cursor: unknown = head === 'pose' ? node.pose : head === 'data' ? node.data : undefined;\n for (let i = 1; i < segments.length; i++) {\n if (cursor == null || typeof cursor !== 'object') return undefined;\n cursor = (cursor as Record<string, unknown>)[segments[i]];\n }\n return cursor;\n}\n\n/** Immutably set `value` at a dotted path within `root`, cloning each level\n * on the way down so React sees new object identities. Arrays stay arrays\n * (an array intermediate is shallow-copied, not flattened into `{0: ...}`)\n * — this is the write-side twin of `nodeValueAt`, so a schema author who\n * gets a working read gets a working write. */\nexport function setAtPath(root: object, segments: readonly string[], value: unknown): object {\n const [head, ...rest] = segments;\n if (rest.length === 0) {\n return Array.isArray(root)\n ? Object.assign([...root], { [head]: value })\n : { ...root, [head]: value };\n }\n const child = (root as Record<string, unknown>)[head];\n const childObj = Array.isArray(child)\n ? [...child]\n : child != null && typeof child === 'object'\n ? { ...child }\n : {};\n const nested = setAtPath(childObj, rest, value);\n return Array.isArray(root)\n ? Object.assign([...root], { [head]: nested })\n : { ...root, [head]: nested };\n}\n\n/** Aggregate a path across nodes: the shared value, or `MIXED`. */\nexport function aggregateValue(\n nodes: readonly AnyNode[],\n path: string,\n): unknown | Mixed {\n let value: unknown;\n let first = true;\n for (const node of nodes) {\n const v = nodeValueAt(node, path);\n if (first) {\n value = v;\n first = false;\n } else if (!Object.is(v, value)) {\n return MIXED;\n }\n }\n return value;\n}\n\n/** `'rect ×2 · text'` — kinds in first-seen order with counts. */\nexport function kindBreakdown(kinds: readonly string[]): string {\n const counts = new Map<string, number>();\n for (const k of kinds) counts.set(k, (counts.get(k) ?? 0) + 1);\n return [...counts.entries()]\n .map(([k, n]) => (n > 1 ? `${k} ×${n}` : k))\n .join(' · ');\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACsHA,SAAgBQ,EAAW,GAAgB,GAAuD;CAChG,IAAM,EAAE,YAASC;CACjB,OACEC,EAAK,SAAS,aACbA,EAAyB,YAAY,YACtCA,EAAK,SAAS,KAAA,KACdC,IAAYF,EAAK,IAAI,UAAU,KAAA,KAC/BE,IAAYD,EAAK,UAAU,KAAA;AAE/B;AAOA,SAAgBE,EACd,GACA,GACgB;CAChB,IAAMC,IAAsB,CAAC;CAC7B,KAAK,IAAIC,IAAI,GAAGA,IAAIC,EAAM,SAAU;EAClC,IAAMN,IAAOM,EAAMD;EACnB,IAAI,CAACN,EAAWC,GAAME,CAAS,GAAG;GAChC,IAAMK,IAAUP,EAAK,OAAO;GAI5B,AAHIO,KAAW,QACbH,EAAI,KAA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,KAAK,IAAMvB,KAAQ0C,GAAO;EACxB,IAAMjE,IAAIwD,EAAYjC,GAAMmC,CAAI;EAChC,IAAIZ,GAEF,AADA,IAAQ9C,GACR,IAAQ;OACH,IAAI,CAAC,OAAO,GAAGA,GAAG+D,CAAK,GAC5B,OAAOG;CAEX;CACA,OAAOH;AACT;AAGA,SAAgBI,EAAc,GAAkC;CAC9D,IAAMC,oBAAS,IAAI,IAAoB;CACvC,KAAK,IAAMxB,KAAKJ,GAAO,EAAO,IAAII,IAAIwB,EAAO,IAAIxB,CAAC,KAAK,KAAK,CAAC;CAC7D,OAAO,CAAC,GAAGwB,EAAO,QAAQ,CAAC,CAAC,CACzB,KAAK,CAACxB,GAAGlB,OAAQA,IAAI,IAAI,GAAGkB,EAAE,IAAIlB,MAAMkB,CAAE,CAAC,CAC3C,KAAK,KAAK;AACf"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"portalHost-yTOVuCej.js","names":["HOST_SELECTOR","nearestPortalHost","from","OverlayPortalContext","createContext","OverlayPortalProvider","container","useOverlayPortal","anchorEl","setAnchorEl","useState","fromProvider","useContext","resolved","explicit"],"sources":["../../src/overlays/portalHost.tsx"],"sourcesContent":["import { createContext, useContext, useState, type ReactElement, type ReactNode } from 'react';\n\n/**\n * Elements an overlay may portal into: anything a theme has been stamped on\n * (`applyTheme` / `<ThemeProvider>` write both attributes), plus anything\n * opting in with `data-wzl-portal-host`. The opt-in exists for a styling root\n * that sits *below* the themed element — labkit's `.lk-root` carries element\n * defaults the themed wrapper does not.\n */\nconst HOST_SELECTOR = '[data-wzl-portal-host],[data-wzl-theme],[data-wzl-mode]';\n\n/**\n * The nearest element `from` sits inside that can host a portalled overlay,\n * or `null` when there is none and the body is the only answer.\n */\nexport function nearestPortalHost(from: Element | null | undefined): HTMLElement | null {\n return (from?.closest(HOST_SELECTOR) as HTMLElement | null) ?? null;\n}\n\n/** `undefined` distinguishes \"no provider\" from a provider saying `null`. */\nconst OverlayPortalContext = createContext<Element | null | undefined>(undefined);\n\n/** Props for {@link OverlayPortalProvider}. */\nexport interface OverlayPortalProviderProps {\n /** Where overlays in this subtree portal. `null` means `document.body`. */\n container: Element | null;\n children: ReactNode;\n}\n\n/**\n * Sets the portal container for every weasel overlay rendered below it,\n * overriding the nearest-themed-ancestor default. An individual overlay's\n * own `portalContainer` prop still wins.\n */\nexport function OverlayPortalProvider({ container, children }: OverlayPortalProviderProps) {\n return (\n <OverlayPortalContext.Provider value={container}>{children}</OverlayPortalContext.Provider>\n );\n}\n\n/** The `portalContainer` prop every weasel overlay accepts. */\nexport interface OverlayPortalProps {\n /**\n * Where the overlay's portal mounts. Defaults to the nearest ancestor of\n * the overlay's own position that carries a weasel theme, so the overlay\n * resolves the same `--wzl-*` tokens as the control it belongs to. Pass\n * `null` for `document.body`.\n */\n portalContainer?: Element | null;\n}\n\n/** React Aria props minus the portal key a weasel overlay owns. */\nexport type WithoutPortalTarget<T> = Omit<T, 'UNSTABLE_portalContainer'>;\n\n/** Spread onto the React Aria overlay. The unstable key is spelled here and\n * nowhere else in the package, so an upstream rename lands in one file. */\nexport interface OverlayPortalTarget {\n UNSTABLE_portalContainer: Element | undefined;\n}\n\n/**\n * Resolves where an overlay should portal, and the anchor that answers it.\n *\n * The result goes to React Aria as `UNSTABLE_portalContainer`. Its documented\n * replacement, `UNSAFE_PortalProvider`, is not re-exported by\n * react-aria-components 1.18, and reaching past it to `react-aria` for the\n * provider risks a second copy of that package whose context the overlays\n * never read — a failure that shows up as an unthemed overlay, not an error.\n *\n * Render `anchor` at the component's own position in the tree — outside the\n * portal — and spread `portalProps` onto the React Aria overlay. The anchor\n * is what \"nearest themed ancestor\" is measured from; the first render has\n * none yet, so an overlay that mounts already open lands in its host on the\n * following render, before paint.\n */\nexport function useOverlayPortal(explicit?: Element | null): {\n anchor: ReactElement;\n portalProps: OverlayPortalTarget;\n} {\n const [anchorEl, setAnchorEl] = useState<HTMLElement | null>(null);\n const fromProvider = useContext(OverlayPortalContext);\n\n const resolved =\n explicit !== undefined\n ? explicit\n : fromProvider !== undefined\n ? fromProvider\n : nearestPortalHost(anchorEl);\n\n return {\n anchor: <span hidden ref={setAnchorEl} />,\n portalProps: { UNSTABLE_portalContainer: resolved ?? undefined },\n };\n}\n"],"mappings":";;;AASA,IAAMA,IAAgB;AAMtB,SAAgBC,EAAkB,GAAsD;CACtF,OAAQC,GAAM,QAAQF,CAAa,KAA4B;AACjE;AAGA,IAAMG,IAAuBC,EAA0C,KAAA,CAAS;AAchF,SAAgBC,EAAsB,EAAE,cAAW,eAAwC;CACzF,OACE,kBAACF,EAAqB,UAAtB;EAA+B,OAAOG;EAAY;CAAwC,CAAA;AAE9F;AAqCA,SAAgBC,EAAiB,GAG/B;CACA,IAAM,CAACC,GAAUC,KAAeC,EAA6B,IAAI,GAC3DC,IAAeC,EAAWT,CAAoB,GAE9CU,IACJC,MAAa,KAAA,IAETH,MAAiB,KAAA,IAEfV,EAAkBO,CAAQ,IAD1BG,IAFFG;CAKN,OAAO;EACL,QAAQ,kBAAC,QAAD;GAAM,QAAA;GAAO,KAAKL;EAAc,CAAA;EACxC,aAAa,EAAE,0BAA0BI,KAAY,KAAA,EAAU;CACjE;AACF"}
|
|
@@ -1,201 +0,0 @@
|
|
|
1
|
-
import { a as e, t } from "./Icon-CcVjdq2C.js";
|
|
2
|
-
import { t as n } from "./paintValue-BpaGPjV3.js";
|
|
3
|
-
import { isBuiltinToolPref as r } from "@weasel-js/core";
|
|
4
|
-
import { jsx as i } from "react/jsx-runtime";
|
|
5
|
-
//#region src/components/Prefs/schema.ts
|
|
6
|
-
function a(e) {
|
|
7
|
-
if (!e.unit) return {
|
|
8
|
-
min: e.min,
|
|
9
|
-
max: e.max,
|
|
10
|
-
step: e.step ?? 1
|
|
11
|
-
};
|
|
12
|
-
let { toDisplay: t } = e.unit, n = e.min === void 0 ? void 0 : t(e.min), r = e.max === void 0 ? void 0 : t(e.max), i = n !== void 0 && r !== void 0 && n > r, a = e.step === void 0 ? 1 : Math.abs(t(e.step) - t(0)) || e.step;
|
|
13
|
-
return {
|
|
14
|
-
min: i ? r : n,
|
|
15
|
-
max: i ? n : r,
|
|
16
|
-
step: a
|
|
17
|
-
};
|
|
18
|
-
}
|
|
19
|
-
function o(e) {
|
|
20
|
-
return e.suffix === void 0 ? { ...e.accepts } : {
|
|
21
|
-
[e.suffix]: 1,
|
|
22
|
-
...e.accepts
|
|
23
|
-
};
|
|
24
|
-
}
|
|
25
|
-
function s(e) {
|
|
26
|
-
return "kind" in e;
|
|
27
|
-
}
|
|
28
|
-
function c(e, t) {
|
|
29
|
-
let n = e;
|
|
30
|
-
for (let e of t.split(".")) {
|
|
31
|
-
if (typeof n != "object" || !n) return;
|
|
32
|
-
n = n[e];
|
|
33
|
-
}
|
|
34
|
-
return n;
|
|
35
|
-
}
|
|
36
|
-
function l(e, t) {
|
|
37
|
-
if (s(e)) return e.hidden && !t ? null : e;
|
|
38
|
-
let n = e, r = {};
|
|
39
|
-
for (let [e, i] of Object.entries(n.children)) {
|
|
40
|
-
let n = l(i, t);
|
|
41
|
-
n && (r[e] = n);
|
|
42
|
-
}
|
|
43
|
-
return Object.keys(r).length === 0 ? null : {
|
|
44
|
-
...e,
|
|
45
|
-
children: r
|
|
46
|
-
};
|
|
47
|
-
}
|
|
48
|
-
function u(e) {
|
|
49
|
-
if (s(e)) return 1;
|
|
50
|
-
let t = 0;
|
|
51
|
-
for (let n of Object.values(e.children)) t += u(n);
|
|
52
|
-
return t;
|
|
53
|
-
}
|
|
54
|
-
function d(e) {
|
|
55
|
-
let t = [], n = Object.values(e.children).filter(s).length;
|
|
56
|
-
n > 0 && t.push({
|
|
57
|
-
path: "",
|
|
58
|
-
name: e.name,
|
|
59
|
-
depth: 0,
|
|
60
|
-
section: "",
|
|
61
|
-
matches: n
|
|
62
|
-
});
|
|
63
|
-
for (let [n, r] of Object.entries(e.children)) if (!s(r)) {
|
|
64
|
-
t.push({
|
|
65
|
-
path: n,
|
|
66
|
-
name: r.name,
|
|
67
|
-
depth: 0,
|
|
68
|
-
section: n,
|
|
69
|
-
matches: u(r)
|
|
70
|
-
});
|
|
71
|
-
for (let [e, i] of Object.entries(r.children)) s(i) || t.push({
|
|
72
|
-
path: `${n}.${e}`,
|
|
73
|
-
name: i.name,
|
|
74
|
-
depth: 1,
|
|
75
|
-
section: n,
|
|
76
|
-
matches: u(i)
|
|
77
|
-
});
|
|
78
|
-
}
|
|
79
|
-
return t;
|
|
80
|
-
}
|
|
81
|
-
function f(e, t, n) {
|
|
82
|
-
return e.name.toLowerCase().includes(n) || e.description?.toLowerCase().includes(n) ? !0 : t.toLowerCase().includes(n);
|
|
83
|
-
}
|
|
84
|
-
function p(e, t, n = "") {
|
|
85
|
-
let r = t.trim().toLowerCase();
|
|
86
|
-
if (r === "") return e;
|
|
87
|
-
if (s(e)) return f(e, n, r) ? e : null;
|
|
88
|
-
let i = e;
|
|
89
|
-
if (i.name.toLowerCase().includes(r)) return e;
|
|
90
|
-
let a = {};
|
|
91
|
-
for (let [e, t] of Object.entries(i.children)) {
|
|
92
|
-
let i = p(t, r, n === "" ? e : `${n}.${e}`);
|
|
93
|
-
i && (a[e] = i);
|
|
94
|
-
}
|
|
95
|
-
return Object.keys(a).length === 0 ? null : {
|
|
96
|
-
...e,
|
|
97
|
-
children: a
|
|
98
|
-
};
|
|
99
|
-
}
|
|
100
|
-
//#endregion
|
|
101
|
-
//#region src/components/Prefs/prefField.tsx
|
|
102
|
-
function m(e, t) {
|
|
103
|
-
let { value: i, mixed: s = !1, unset: c = !1, siblings: l, setValue: u } = t;
|
|
104
|
-
if (e.kind === "font-family") {
|
|
105
|
-
let e = t.fontVariant ? t.fontVariant.weight : l?.fontWeight, n = t.fontVariant ? t.fontVariant.style : l?.fontStyle;
|
|
106
|
-
return {
|
|
107
|
-
kind: "font-family",
|
|
108
|
-
value: typeof i == "string" ? i : void 0,
|
|
109
|
-
mixed: s,
|
|
110
|
-
unset: c,
|
|
111
|
-
onChange: u,
|
|
112
|
-
weight: typeof e == "number" ? e : void 0,
|
|
113
|
-
fontStyle: n === "italic" ? "italic" : void 0
|
|
114
|
-
};
|
|
115
|
-
}
|
|
116
|
-
if (!r(e)) return null;
|
|
117
|
-
switch (e.kind) {
|
|
118
|
-
case "boolean": {
|
|
119
|
-
let t = e.encoding;
|
|
120
|
-
return {
|
|
121
|
-
kind: "boolean",
|
|
122
|
-
control: e.control,
|
|
123
|
-
value: t ? s ? void 0 : t.read(i, l) : typeof i == "boolean" ? i : void 0,
|
|
124
|
-
mixed: s,
|
|
125
|
-
unset: c,
|
|
126
|
-
glyph: h(e.icon) ?? e.short,
|
|
127
|
-
onChange: t ? (e) => u(t.write(e, l)) : u
|
|
128
|
-
};
|
|
129
|
-
}
|
|
130
|
-
case "number": {
|
|
131
|
-
let t = e.unit, n = typeof i == "number" && Number.isFinite(i) ? i : void 0, r = a(e), l = (e) => Math.min(r.max ?? Infinity, Math.max(r.min ?? -Infinity, e));
|
|
132
|
-
return {
|
|
133
|
-
kind: "number",
|
|
134
|
-
control: e.control,
|
|
135
|
-
value: n === void 0 ? void 0 : t ? t.toDisplay(n) : n,
|
|
136
|
-
mixed: s,
|
|
137
|
-
unset: c,
|
|
138
|
-
min: r.min,
|
|
139
|
-
max: r.max,
|
|
140
|
-
step: r.step,
|
|
141
|
-
unit: t?.suffix,
|
|
142
|
-
accepts: t ? o(t) : void 0,
|
|
143
|
-
display: e.display,
|
|
144
|
-
onChange: (e) => u(t ? t.fromDisplay(l(e)) : l(e))
|
|
145
|
-
};
|
|
146
|
-
}
|
|
147
|
-
case "string": return {
|
|
148
|
-
kind: "string",
|
|
149
|
-
control: e.control,
|
|
150
|
-
value: typeof i == "string" ? i : "",
|
|
151
|
-
mixed: s,
|
|
152
|
-
unset: c,
|
|
153
|
-
onChange: u
|
|
154
|
-
};
|
|
155
|
-
case "enum": {
|
|
156
|
-
let t = e.encoding, n = t ? s ? void 0 : t.read(i, l) : s || c ? void 0 : typeof i == "string" ? i : e.default;
|
|
157
|
-
return {
|
|
158
|
-
kind: "enum",
|
|
159
|
-
control: e.control,
|
|
160
|
-
value: n,
|
|
161
|
-
mixed: s,
|
|
162
|
-
unset: c,
|
|
163
|
-
options: e.options.map((e) => ({
|
|
164
|
-
value: e.value,
|
|
165
|
-
label: e.label,
|
|
166
|
-
glyph: h(e.icon) ?? e.short,
|
|
167
|
-
disabled: e.disabled
|
|
168
|
-
})),
|
|
169
|
-
onChange: (e) => u(t ? t.write(e, l) : e),
|
|
170
|
-
onClear: e.clearable ? () => u(void 0) : void 0
|
|
171
|
-
};
|
|
172
|
-
}
|
|
173
|
-
case "color": return {
|
|
174
|
-
kind: "color",
|
|
175
|
-
value: typeof i == "string" ? i : e.default,
|
|
176
|
-
mixed: s,
|
|
177
|
-
unset: c,
|
|
178
|
-
alpha: e.alpha ? !0 : void 0,
|
|
179
|
-
onChange: u
|
|
180
|
-
};
|
|
181
|
-
case "paint": return {
|
|
182
|
-
kind: "paint",
|
|
183
|
-
value: i === null ? null : n(i) ? i : s ? void 0 : n(e.default) ? e.default : null,
|
|
184
|
-
mixed: s,
|
|
185
|
-
unset: c,
|
|
186
|
-
onChange: u
|
|
187
|
-
};
|
|
188
|
-
case "object": return null;
|
|
189
|
-
default: throw Error(`prefFieldProps: no control for built-in pref kind "${e.kind}"`);
|
|
190
|
-
}
|
|
191
|
-
}
|
|
192
|
-
function h(n) {
|
|
193
|
-
return n && n in e ? /* @__PURE__ */ i(t, {
|
|
194
|
-
name: n,
|
|
195
|
-
size: 14
|
|
196
|
-
}) : void 0;
|
|
197
|
-
}
|
|
198
|
-
//#endregion
|
|
199
|
-
export { d as a, a as i, p as n, c as o, s as r, l as s, m as t };
|
|
200
|
-
|
|
201
|
-
//# sourceMappingURL=prefField-BopW9bjx.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"prefField-BopW9bjx.js","names":["_exhaustive","ICON_PATHS","isPaint","prefDisplayBounds","p","lo","toDisplay","hi","flipped","step","prefUnitAccepts","unit","isPrefLeaf","node","prefValueAtPath","cur","values","seg","path","visiblePrefSubtree","showHidden","group","children","key","child","kept","countPrefLeaves","n","prefRailItems","items","loose","root","subKey","sub","prefLeafMatches","pref","query","filterPrefSubtree","q","prefFieldProps","state","leaf","weight","siblings","style","value","setValue","isBuiltinToolPref","encoding","mixed","glyphOf","on","stored","bounds","clamp","shown","option","unset","o","next","icon","Icon"],"sources":["../../src/components/Prefs/schema.ts","../../src/components/Prefs/prefField.tsx"],"sourcesContent":["// Preference-schema vocabulary for PrefsForm / PrefsDialog / SelectionPanel:\n// core's `ToolPref*` family under this package's names. Never re-declare them\n// here — this was a hand-kept structural copy until it drifted, and the\n// independence from `@weasel-js/core` it bought is long gone anyway.\n\nexport type {\n ToolPref as BuiltinPref,\n ToolPrefBoolean as PrefBoolean,\n ToolPrefBooleanControl as PrefBooleanControl,\n ToolPrefBooleanEncoding as PrefBooleanEncoding,\n ToolPrefColor as PrefColor,\n ToolPrefCustom as PrefCustom,\n ToolPrefEnum as PrefEnum,\n ToolPrefEnumControl as PrefEnumControl,\n ToolPrefEnumEncoding as PrefEnumEncoding,\n ToolPrefGroup as PrefGroup,\n ToolPrefKind as PrefKind,\n ToolPrefLeaf as PrefLeaf,\n ToolPrefNumber as PrefNumber,\n ToolPrefNumberControl as PrefNumberControl,\n ToolPrefNumberUnit as PrefNumberUnit,\n ToolPrefObject as PrefObject,\n ToolPrefPaint as PrefPaint,\n ToolPrefString as PrefString,\n ToolPrefStringControl as PrefStringControl,\n} from '@weasel-js/core';\n\nimport type { UnitTable } from '@weasel-js/quantity';\nimport type { ToolPrefGroup, ToolPrefLeaf, ToolPrefNumber, ToolPrefNumberUnit as PrefNumberUnitType } from '@weasel-js/core';\n\n/**\n * A number leaf's bounds in the unit it is displayed in.\n *\n * Only what the leaf declares converts: an omitted bound has no stored\n * counterpart to put through the conversion, and its fallback — 0..100 for a\n * slider's track, a step of 1 — is a display-space number already. `min` and\n * `max` are points, so they convert the way the value does; `step` is a\n * distance, and a unit with an offset maps zero somewhere else, so converting\n * it as a point would scale it wrong. A decreasing conversion swaps which end\n * is the lower one.\n */\nexport function prefDisplayBounds(\n p: ToolPrefNumber,\n): { min?: number; max?: number; step: number } {\n if (!p.unit) return { min: p.min, max: p.max, step: p.step ?? 1 };\n const { toDisplay } = p.unit;\n const lo = p.min === undefined ? undefined : toDisplay(p.min);\n const hi = p.max === undefined ? undefined : toDisplay(p.max);\n const flipped = lo !== undefined && hi !== undefined && lo > hi;\n const step = p.step === undefined\n ? 1\n : Math.abs(toDisplay(p.step) - toDisplay(0)) || p.step;\n return { min: flipped ? hi : lo, max: flipped ? lo : hi, step };\n}\n\n/** What a unit leaf's field reads as typed text: its `accepts` table, and its\n * `suffix` as the display unit itself. */\nexport function prefUnitAccepts(unit: PrefNumberUnitType): Readonly<UnitTable> {\n return unit.suffix === undefined ? { ...unit.accepts } : { [unit.suffix]: 1, ...unit.accepts };\n}\n\n/** Distinguishes a leaf from a group while walking a schema tree. */\nexport function isPrefLeaf(node: ToolPrefLeaf | ToolPrefGroup): node is ToolPrefLeaf {\n return 'kind' in node;\n}\n\n/** Get the value at a dotted path inside a nested value tree. Returns\n * `undefined` when a segment is missing or hits a non-object. */\nexport function prefValueAtPath(values: unknown, path: string): unknown {\n let cur: unknown = values;\n for (const seg of path.split('.')) {\n if (cur == null || typeof cur !== 'object') return undefined;\n cur = (cur as Record<string, unknown>)[seg];\n }\n return cur;\n}\n\n/**\n * Recursively drop `hidden` leaves (unless `showHidden`), pruning groups\n * that end up empty. Returns null when the entire subtree is hidden.\n */\nexport function visiblePrefSubtree<T extends ToolPrefLeaf | ToolPrefGroup>(\n node: T,\n showHidden: boolean,\n): T | null {\n if (isPrefLeaf(node)) return node.hidden && !showHidden ? null : node;\n const group = node as ToolPrefGroup;\n const children: Record<string, ToolPrefLeaf | ToolPrefGroup> = {};\n for (const [key, child] of Object.entries(group.children)) {\n const kept = visiblePrefSubtree(child, showHidden);\n if (kept) children[key] = kept;\n }\n if (Object.keys(children).length === 0) return null;\n return { ...node, children };\n}\n\n/** One entry in a {@link PrefsForm} rail: a group the reader can navigate to. */\nexport interface PrefRailItem {\n /** Dotted path of the group. Empty for the entry holding loose root leaves. */\n path: string;\n name: string;\n /** 0 opens a pane; 1 scrolls within the open one. The rail goes no deeper. */\n depth: 0 | 1;\n /** Path of the depth-0 ancestor — its own path when `depth` is 0. */\n section: string;\n /** Leaves surviving the active filter, counted over the whole subtree. */\n matches: number;\n}\n\n/** Leaves anywhere under `node`, counted. */\nfunction countPrefLeaves(node: ToolPrefLeaf | ToolPrefGroup): number {\n if (isPrefLeaf(node)) return 1;\n let n = 0;\n for (const child of Object.values(node.children)) n += countPrefLeaves(child);\n return n;\n}\n\n/**\n * The rail's model for a schema: depth-0 groups, each followed by its depth-1\n * children. Deeper groups render inside a pane and get no entry — a schema\n * that nests ten deep still navigates two levels.\n *\n * Loose leaves directly under the root lead the list under an entry named for\n * the root itself, since they belong to no group that could name them.\n */\nexport function prefRailItems(root: ToolPrefGroup): PrefRailItem[] {\n const items: PrefRailItem[] = [];\n const loose = Object.values(root.children).filter(isPrefLeaf).length;\n if (loose > 0) {\n items.push({ path: '', name: root.name, depth: 0, section: '', matches: loose });\n }\n for (const [key, child] of Object.entries(root.children)) {\n if (isPrefLeaf(child)) continue;\n items.push({\n path: key,\n name: child.name,\n depth: 0,\n section: key,\n matches: countPrefLeaves(child),\n });\n for (const [subKey, sub] of Object.entries(child.children)) {\n if (isPrefLeaf(sub)) continue;\n items.push({\n path: `${key}.${subKey}`,\n name: sub.name,\n depth: 1,\n section: key,\n matches: countPrefLeaves(sub),\n });\n }\n }\n return items;\n}\n\n/** Whether one leaf answers to a filter query, by name, description or path. */\nfunction prefLeafMatches(pref: ToolPrefLeaf, path: string, query: string): boolean {\n if (pref.name.toLowerCase().includes(query)) return true;\n if (pref.description?.toLowerCase().includes(query)) return true;\n return path.toLowerCase().includes(query);\n}\n\n/**\n * Drop every leaf that does not answer to `query`, pruning groups left empty.\n * A group whose own name matches keeps all of its leaves — a reader who typed\n * the group's name is asking for the group, not for leaves repeating it.\n *\n * An empty or whitespace query matches everything, so a cleared field restores\n * the tree rather than emptying it.\n */\nexport function filterPrefSubtree<T extends ToolPrefLeaf | ToolPrefGroup>(\n node: T,\n query: string,\n path = '',\n): T | null {\n const q = query.trim().toLowerCase();\n if (q === '') return node;\n if (isPrefLeaf(node)) return prefLeafMatches(node, path, q) ? node : null;\n const group = node as ToolPrefGroup;\n if (group.name.toLowerCase().includes(q)) return node;\n const children: Record<string, ToolPrefLeaf | ToolPrefGroup> = {};\n for (const [key, child] of Object.entries(group.children)) {\n const kept = filterPrefSubtree(child, q, path === '' ? key : `${path}.${key}`);\n if (kept) children[key] = kept;\n }\n if (Object.keys(children).length === 0) return null;\n return { ...node, children };\n}\n","import type { ReactNode } from 'react';\nimport { isBuiltinToolPref, type FillStyle } from '@weasel-js/core';\nimport { Icon } from '../../icons/Icon';\nimport { ICON_PATHS, type IconName } from '../../icons/paths';\nimport { isPaint } from '../paintValue';\nimport type { PropertyControlProps } from '../Properties/PropertyField';\nimport { prefDisplayBounds, prefUnitAccepts, type PrefLeaf } from './schema';\n\n/** What {@link prefFieldProps} is told about one leaf's value. */\nexport interface PrefFieldState {\n /** The value held at the leaf. `undefined` when `mixed` or `unset`. */\n value: unknown;\n mixed?: boolean;\n unset?: boolean;\n /** The object the leaf is a field of, for an enum `encoding` and a font's\n * weight and slant. `undefined` for a top-level leaf. */\n siblings?: Record<string, unknown>;\n /** Writes a value in the leaf's stored form. */\n setValue: (value: unknown) => void;\n /** A font family's weight and slant, where they are not `siblings`' own\n * `fontWeight` / `fontStyle`. */\n fontVariant?: { weight?: unknown; style?: unknown };\n}\n\n/**\n * A schema leaf as {@link PropertyControl} props: its value, bounds and\n * options in the form it is shown in, and a writer that stores what the\n * control reports in the form the leaf holds.\n *\n * The conversions every schema-driven surface needs live here once — a\n * number's display unit and its bounds, an enum's `encoding`, a color's\n * alpha, an icon resolved to a glyph. A leaf that is not a single control —\n * an `object`, whose fields each are, or an app-defined kind — returns\n * `null`, and the surface draws it.\n *\n * Spread the result and add what the surface decides: `chrome`, `name`, a\n * class, a different default `control`.\n */\nexport function prefFieldProps(leaf: PrefLeaf, state: PrefFieldState): PropertyControlProps | null {\n const { value, mixed = false, unset = false, siblings, setValue } = state;\n if (leaf.kind === 'font-family') {\n const weight = state.fontVariant ? state.fontVariant.weight : siblings?.fontWeight;\n const style = state.fontVariant ? state.fontVariant.style : siblings?.fontStyle;\n return {\n kind: 'font-family',\n value: typeof value === 'string' ? value : undefined,\n mixed,\n unset,\n onChange: setValue,\n weight: typeof weight === 'number' ? weight : undefined,\n fontStyle: style === 'italic' ? 'italic' : undefined,\n };\n }\n if (!isBuiltinToolPref(leaf)) return null;\n switch (leaf.kind) {\n case 'boolean': {\n const encoding = leaf.encoding;\n return {\n kind: 'boolean',\n control: leaf.control,\n value: encoding\n ? mixed\n ? undefined\n : encoding.read(value, siblings)\n : typeof value === 'boolean'\n ? value\n : undefined,\n mixed,\n unset,\n glyph: glyphOf(leaf.icon) ?? leaf.short,\n onChange: encoding ? (on: boolean) => setValue(encoding.write(on, siblings)) : setValue,\n };\n }\n case 'number': {\n const unit = leaf.unit;\n const stored = typeof value === 'number' && Number.isFinite(value) ? value : undefined;\n // `min`/`max`/`step` are declared in the stored unit, like the value, so\n // they convert with it — a leaf storing radians and showing degrees was\n // clamping typed degrees against 0..6.28.\n const bounds = prefDisplayBounds(leaf);\n const clamp = (n: number) =>\n Math.min(bounds.max ?? Infinity, Math.max(bounds.min ?? -Infinity, n));\n const store = (shown: number) => setValue(unit ? unit.fromDisplay(clamp(shown)) : clamp(shown));\n return {\n kind: 'number',\n control: leaf.control,\n value: stored === undefined ? undefined : unit ? unit.toDisplay(stored) : stored,\n mixed,\n unset,\n min: bounds.min,\n max: bounds.max,\n step: bounds.step,\n unit: unit?.suffix,\n accepts: unit ? prefUnitAccepts(unit) : undefined,\n display: leaf.display,\n onChange: store,\n };\n }\n case 'string':\n return {\n kind: 'string',\n control: leaf.control,\n value: typeof value === 'string' ? value : '',\n mixed,\n unset,\n onChange: setValue,\n };\n case 'enum': {\n const encoding = leaf.encoding;\n // An encoded leaf stores something other than the option string (a dash\n // array), so the option comes from the encoding — and an absent field is\n // one of the things it reads (no dash is `solid`), which is why `unset`\n // does not blank it.\n const option = encoding\n ? mixed\n ? undefined\n : encoding.read(value, siblings)\n : mixed || unset\n ? undefined\n : typeof value === 'string'\n ? value\n : leaf.default;\n return {\n kind: 'enum',\n control: leaf.control,\n value: option,\n mixed,\n unset,\n options: leaf.options.map((o) => ({\n value: o.value,\n label: o.label,\n glyph: glyphOf(o.icon) ?? o.short,\n disabled: o.disabled,\n })),\n onChange: (next: string) => setValue(encoding ? encoding.write(next, siblings) : next),\n onClear: leaf.clearable ? () => setValue(undefined) : undefined,\n };\n }\n case 'color':\n return {\n kind: 'color',\n value: typeof value === 'string' ? value : leaf.default,\n mixed,\n unset,\n alpha: leaf.alpha ? true : undefined,\n onChange: setValue,\n };\n case 'paint': {\n // `??` would read an explicit `null` — \"no paint\" — as absent and show\n // the default over it. Unset shows the fallback actually in effect,\n // dimmed by the control: true, but not chosen.\n const paint =\n value === null\n ? null\n : isPaint(value)\n ? value\n : mixed\n ? undefined\n : isPaint(leaf.default)\n ? leaf.default\n : null;\n return {\n kind: 'paint',\n value: paint as FillStyle | null | undefined,\n mixed,\n unset,\n onChange: setValue,\n };\n }\n case 'object':\n return null;\n default: {\n // Not reachable while every built-in kind has an arm — and a new kind\n // that lacks one is a compile error here, never a blank row.\n const _exhaustive: never = leaf;\n throw new Error(\n `prefFieldProps: no control for built-in pref kind \"${(_exhaustive as { kind: string }).kind}\"`,\n );\n }\n }\n}\n\n/** A leaf's `icon` as a glyph, where the kit's icon set has it. */\nfunction glyphOf(icon: string | undefined): ReactNode {\n return icon && icon in ICON_PATHS ? <Icon name={icon as IconName} size={14} /> : undefined;\n}\n"],"mappings":";;;;;AAyCA,S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AE;KACT,OAAOR,EAAQQ,EAAE,IAAI,KAAKA,EAAE;KAC5B,UAAUA,EAAE;IACd,EAAE;IACF,WAAW,MAAiBZ,EAASE,IAAWA,EAAS,MAAMW,GAAMhB,CAAQ,IAAIgB,CAAI;IACrF,SAASlB,EAAK,kBAAkBK,EAAS,KAAA,CAAS,IAAI,KAAA;GACxD;EACF;EACA,KAAK,SACH,OAAO;GACL,MAAM;GACN,OAAO,OAAOD,KAAU,WAAWA,IAAQJ,EAAK;GAChD;GACA;GACA,OAAOA,EAAK,QAAQ,KAAO,KAAA;GAC3B,UAAUK;EACZ;EACF,KAAK,SAcH,OAAO;GACL,MAAM;GACN,OAXAD,MAAU,OACN,OACA3C,EAAQ2C,CAAK,IACXA,IACAI,IACE,KAAA,IACA/C,EAAQuC,EAAK,OAAO,IAClBA,EAAK,UACL;GAIV;GACA;GACA,UAAUK;EACZ;EAEF,KAAK,UACH,OAAO;EACT,SAIE,MAAU,MACR,sDAAuD9C,EAAiC,KAAK,EAC/F;CAEJ;AACF;AAGA,SAASkD,EAAQ,GAAqC;CACpD,OAAOU,KAAQA,KAAQ3D,IAAa,kBAAC4D,GAAD;EAAM,MAAMD;EAAkB,MAAM;CAAK,CAAA,IAAI,KAAA;AACnF"}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
var e = {
|
|
2
|
-
root: "_root_29hwb_10",
|
|
3
|
-
segment: "_segment_29hwb_32",
|
|
4
|
-
segmentSelected: "_segmentSelected_29hwb_79",
|
|
5
|
-
size_sm: "_size_sm_29hwb_137",
|
|
6
|
-
variant_minimal: "_variant_minimal_29hwb_150"
|
|
7
|
-
};
|
|
8
|
-
//#endregion
|
|
9
|
-
export { e as t };
|
|
10
|
-
|
|
11
|
-
//# sourceMappingURL=segmentedControl.module-D6SzYJD7.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"segmentedControl.module-D6SzYJD7.js","names":["segmentedControl_module_default"],"sources":["../../src/components/segmentedControl.module.css"],"sourcesContent":["/* Shared by ButtonBar and OptionsBar, which look identical and differ only\n in what a segment does. Lives here rather than in either component so\n neither owns the other's styling.\n\n Aqua-glass segmented control. The track is a pill-shaped well; the\n selected segment becomes a tinted glass cylinder that reads as the same\n \"lozenge\" family as the standalone Button. Visual params come from the\n `--btn-*` custom properties (see Button.module.css) so the Button Lab\n can tune both surfaces with one set of sliders. */\n.root {\n display: inline-flex;\n height: var(--tb-h, var(--wzl-control-h));\n padding: var(--wzl-space-1);\n background: linear-gradient(\n 180deg,\n rgba(0, 0, 0, 0.18) 0%,\n rgba(0, 0, 0, 0.05) 100%\n );\n border-radius: var(--wzl-radius-pill);\n /* Clip segments to the track outline so interior corners read crisp and\n the selected segment's glass treatment doesn't paint over the rounded\n outer pixels. */\n overflow: hidden;\n box-shadow:\n inset 0 1px 2px rgba(0, 0, 0, 0.4),\n 0 1px 0 rgba(255, 255, 255, 0.06);\n user-select: none;\n -webkit-user-select: none;\n touch-action: none;\n}\n\n.segment {\n position: relative;\n flex: 1 1 0;\n min-width: 0;\n padding: 0 var(--wzl-space-6);\n display: inline-flex;\n align-items: center;\n justify-content: center;\n background: transparent;\n border: none;\n margin: 0;\n font-family: var(--wzl-font-ui);\n font-weight: var(--wzl-font-weight-normal);\n font-size: var(--btn-fontsize, var(--wzl-font-size));\n line-height: 1;\n color: var(--wzl-fg-muted);\n cursor: pointer;\n /* Only round the outer corners of the bar — middle segments stay square\n so the seams between them don't render as facing parentheses. */\n border-radius: 0;\n isolation: isolate;\n overflow: hidden;\n transition: color var(--wzl-motion-fast);\n}\n\n.segment:first-child {\n border-radius: var(--wzl-radius-pill) 0 0 var(--wzl-radius-pill);\n}\n\n.segment:last-child {\n border-radius: 0 var(--wzl-radius-pill) var(--wzl-radius-pill) 0;\n}\n\n.segment:only-child {\n border-radius: var(--wzl-radius-pill);\n}\n\n.segment:focus-visible {\n outline: 2px solid var(--wzl-accent);\n outline-offset: -2px;\n}\n\n.segment:disabled {\n opacity: 0.5;\n cursor: not-allowed;\n}\n\n.segment:hover:not(:disabled):not(.segmentSelected) {\n color: var(--wzl-fg);\n}\n\n/* Selected segment — full Aqua glass cylinder. Mirrors Button.variant_primary. */\n.segmentSelected {\n background: linear-gradient(\n 180deg,\n color-mix(in srgb, var(--wzl-accent) var(--btn-top-alpha, 45%), transparent) 0%,\n color-mix(in srgb, var(--wzl-accent) var(--btn-upper-alpha, 70%), transparent) calc(var(--btn-equator, 52%) - var(--btn-equator-spread, 12%)),\n color-mix(in srgb, var(--wzl-accent) var(--btn-equator-tint, 95%), white) var(--btn-equator, 52%),\n var(--wzl-accent) calc(var(--btn-equator, 52%) + var(--btn-equator-spread, 12%) * 1.6),\n color-mix(in srgb, var(--wzl-accent) var(--btn-base-tint, 70%), black) 100%\n );\n backdrop-filter: blur(var(--btn-blur, 6px)) saturate(var(--btn-saturate, 1.3));\n -webkit-backdrop-filter: blur(var(--btn-blur, 6px)) saturate(var(--btn-saturate, 1.3));\n color: var(--wzl-fg-on-accent);\n text-shadow:\n 0 1px 0 rgba(0, 0, 0, var(--btn-text-shadow, 0.35)),\n var(--btn-text-inset-x, 0px) var(--btn-text-inset-y, 1px) 0 rgba(0, 0, 0, var(--btn-text-inset, 0.55)),\n 0 0 6px rgba(0, 0, 0, calc(var(--btn-text-shadow, 0.35) * 0.5));\n box-shadow:\n inset 0 1px 0 rgba(255, 255, 255, var(--btn-inset-hi, 0.42)),\n inset 0 -1px 2px rgba(0, 0, 0, var(--btn-inset-lo, 0.3)),\n 0 0 0 1px rgba(0, 0, 0, var(--btn-rim, 0.22)),\n 0 1px 2px rgba(0, 0, 0, var(--btn-drop-near, 0.3)),\n 0 2px 4px rgba(0, 0, 0, calc(var(--btn-drop-far, 0.18) * 0.8));\n}\n\n/* Specular gloss on the selected segment. Top corners inherit the\n segment's radius so they hug the upper edge cleanly; bottom corners\n are flattened so the gloss ends in a straight line at the equator\n instead of two little curves that read as `)(` brackets. */\n.segmentSelected::before {\n content: '';\n position: absolute;\n inset: 1px 1px var(--btn-gloss-bottom, 50%) 1px;\n border-radius: inherit;\n border-bottom-left-radius: 0;\n border-bottom-right-radius: 0;\n background: linear-gradient(\n 180deg,\n rgba(255, 255, 255, var(--btn-gloss-top, 0.42)) 0%,\n rgba(255, 255, 255, var(--btn-gloss-mid, 0.12)) 60%,\n rgba(255, 255, 255, 0) 100%\n );\n pointer-events: none;\n z-index: 1;\n}\n\n.segmentSelected > * {\n position: relative;\n z-index: 2;\n}\n\n/* Small variant — ~60% of the default height, with proportionally reduced\n padding and font. Sized for dense surfaces (lab control panels, inline\n filters, etc.). */\n.size_sm {\n height: 17px;\n padding: 1px;\n}\n\n.size_sm .segment {\n padding: 0 var(--wzl-space-4);\n font-size: var(--wzl-font-size-sm);\n}\n\n/* Minimal variant — strips the pill track, glass selected state, inset\n shadows, and outer padding. Used in dense diagnostic surfaces (dispatch\n trace, lab inspectors) where the bar must read as plain text controls. */\n.variant_minimal {\n height: auto;\n padding: 0;\n background: none;\n border-radius: 0;\n box-shadow: none;\n gap: var(--wzl-space-1);\n}\n\n.variant_minimal .segment {\n padding: 0 var(--wzl-space-2);\n font-size: var(--wzl-font-size-sm);\n font-weight: var(--wzl-font-weight-medium);\n line-height: 1.4;\n border-radius: var(--wzl-radius-sm);\n color: var(--wzl-fg-muted);\n transition: none;\n}\n\n.variant_minimal .segment:first-child,\n.variant_minimal .segment:last-child,\n.variant_minimal .segment:only-child {\n border-radius: var(--wzl-radius-sm);\n}\n\n.variant_minimal .segment:hover:not(:disabled):not(.segmentSelected) {\n color: var(--wzl-fg);\n background: var(--wzl-surface-hover);\n}\n\n.variant_minimal .segmentSelected {\n background: none;\n backdrop-filter: none;\n -webkit-backdrop-filter: none;\n color: var(--wzl-accent-fg);\n text-shadow: none;\n box-shadow: none;\n font-weight: var(--wzl-font-weight-medium);\n}\n\n.variant_minimal .segmentSelected::before {\n content: none;\n}\n"],"mappings":""}
|
|
@@ -1,131 +0,0 @@
|
|
|
1
|
-
import { n as e } from "./interactiveTarget-BNZmTow2.js";
|
|
2
|
-
import { startThresholdDrag as t } from "@weasel-js/core";
|
|
3
|
-
import { useCallback as n, useEffect as r, useRef as i, useState as a } from "react";
|
|
4
|
-
//#region src/useReorderDragList.ts
|
|
5
|
-
var o = {
|
|
6
|
-
draggedIds: null,
|
|
7
|
-
targetIndex: null,
|
|
8
|
-
ghost: null
|
|
9
|
-
};
|
|
10
|
-
function s(e, t) {
|
|
11
|
-
let n = 0;
|
|
12
|
-
for (let r = t - 1; r >= 0; r--) if (e[r]?.locked) {
|
|
13
|
-
n = r + 1;
|
|
14
|
-
break;
|
|
15
|
-
}
|
|
16
|
-
let r = e.length;
|
|
17
|
-
for (let n = t + 1; n < e.length; n++) if (e[n]?.locked) {
|
|
18
|
-
r = n;
|
|
19
|
-
break;
|
|
20
|
-
}
|
|
21
|
-
return [n, r];
|
|
22
|
-
}
|
|
23
|
-
function c(e, t, n, r) {
|
|
24
|
-
let [i, a] = s(e, r);
|
|
25
|
-
return (t.includes(n) ? [...t] : [n]).filter((t) => {
|
|
26
|
-
let n = e.findIndex((e) => e.id === t);
|
|
27
|
-
return n >= i && n < a;
|
|
28
|
-
});
|
|
29
|
-
}
|
|
30
|
-
function l(e, t, n) {
|
|
31
|
-
let r = t.map((t) => e.findIndex((e) => e.id === t)).filter((e) => e >= 0).sort((e, t) => e - t), i = r.length > 0 && r.every((e, t) => {
|
|
32
|
-
if (t === 0) return !0;
|
|
33
|
-
let n = r[t - 1];
|
|
34
|
-
return n !== void 0 && e === n + 1;
|
|
35
|
-
}), a = r[0], o = r[r.length - 1];
|
|
36
|
-
return i && a !== void 0 && o !== void 0 && n >= a && n <= o + 1;
|
|
37
|
-
}
|
|
38
|
-
function u(u) {
|
|
39
|
-
let f = i(u);
|
|
40
|
-
f.current = u;
|
|
41
|
-
let p = i(null), m = i(null), [h, g] = a(o);
|
|
42
|
-
r(() => () => {
|
|
43
|
-
m.current?.cancel();
|
|
44
|
-
}, []);
|
|
45
|
-
let _ = n((e, t) => {
|
|
46
|
-
let [n, r] = s(f.current.items, t), i = p.current;
|
|
47
|
-
if (!i) return n;
|
|
48
|
-
let a = f.current.rowSelector, o = a ? Array.from(i.children).filter((e) => e.matches(a)) : Array.from(i.children), c = o.length;
|
|
49
|
-
for (let t = 0; t < o.length; t++) {
|
|
50
|
-
let n = o[t];
|
|
51
|
-
if (n && e < n.getBoundingClientRect().bottom) {
|
|
52
|
-
c = t;
|
|
53
|
-
break;
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
return Math.max(n, Math.min(c, r));
|
|
57
|
-
}, []), v = n((e) => {
|
|
58
|
-
p.current = e;
|
|
59
|
-
}, []), y = n(() => {
|
|
60
|
-
m.current = null, g(o);
|
|
61
|
-
}, []), b = n((n, r, i) => {
|
|
62
|
-
let a = p.current;
|
|
63
|
-
if (!a || m.current || e(i.target, i.currentTarget)) return;
|
|
64
|
-
let o = {
|
|
65
|
-
shiftKey: i.shiftKey,
|
|
66
|
-
ctrlKey: i.ctrlKey,
|
|
67
|
-
metaKey: i.metaKey,
|
|
68
|
-
altKey: i.altKey
|
|
69
|
-
}, s = [], u = 0, h = i.currentTarget, v = (Array.from(a.children).find((e) => e.contains(h)) ?? h).getBoundingClientRect(), b = {
|
|
70
|
-
x: i.clientX - v.left,
|
|
71
|
-
y: i.clientY - v.top
|
|
72
|
-
}, x = (e) => ({
|
|
73
|
-
ids: s,
|
|
74
|
-
left: e.clientX - b.x,
|
|
75
|
-
top: e.clientY - b.y,
|
|
76
|
-
width: v.width
|
|
77
|
-
});
|
|
78
|
-
m.current = t(i, {
|
|
79
|
-
origin: a,
|
|
80
|
-
threshold: f.current.items[r]?.locked ? Infinity : f.current.threshold,
|
|
81
|
-
onActivate: (e) => {
|
|
82
|
-
s = c(f.current.items, f.current.selectedIds, n, r), u = _(e.clientY, r), g({
|
|
83
|
-
draggedIds: s,
|
|
84
|
-
targetIndex: u,
|
|
85
|
-
ghost: x(e)
|
|
86
|
-
});
|
|
87
|
-
},
|
|
88
|
-
onMove: (e) => {
|
|
89
|
-
u = _(e.clientY, r), g({
|
|
90
|
-
draggedIds: s,
|
|
91
|
-
targetIndex: u,
|
|
92
|
-
ghost: x(e)
|
|
93
|
-
});
|
|
94
|
-
},
|
|
95
|
-
onCommit: (e) => {
|
|
96
|
-
let t = _(e.clientY, r);
|
|
97
|
-
l(f.current.items, s, t) || f.current.onReorder(s, t), y();
|
|
98
|
-
},
|
|
99
|
-
onClick: () => {
|
|
100
|
-
let { onPress: e } = f.current;
|
|
101
|
-
e && (e(n, o), d(a)), y();
|
|
102
|
-
},
|
|
103
|
-
onCancel: y
|
|
104
|
-
});
|
|
105
|
-
}, [_, y]);
|
|
106
|
-
return {
|
|
107
|
-
nudge: n((e, t, n) => {
|
|
108
|
-
let { items: r, selectedIds: i, onReorder: a } = f.current;
|
|
109
|
-
if (r[t]?.locked) return !1;
|
|
110
|
-
let o = c(r, i, e, t), u = o.map((e) => r.findIndex((t) => t.id === e)).sort((e, t) => e - t), d = u[0], p = u[u.length - 1];
|
|
111
|
-
if (d === void 0 || p === void 0) return !1;
|
|
112
|
-
let [m, h] = s(r, t), g = n < 0 ? d - 1 : p + 2;
|
|
113
|
-
return g < m || g > h || l(r, o, g) ? !1 : (a(o, g), !0);
|
|
114
|
-
}, []),
|
|
115
|
-
rowProps: (e, t) => ({ onPointerDown: (n) => b(e, t, n) }),
|
|
116
|
-
containerProps: { ref: v },
|
|
117
|
-
state: h
|
|
118
|
-
};
|
|
119
|
-
}
|
|
120
|
-
function d(e) {
|
|
121
|
-
let t = (e) => {
|
|
122
|
-
e.stopPropagation();
|
|
123
|
-
};
|
|
124
|
-
e.addEventListener("click", t, !0), setTimeout(() => {
|
|
125
|
-
e.removeEventListener("click", t, !0);
|
|
126
|
-
}, 0);
|
|
127
|
-
}
|
|
128
|
-
//#endregion
|
|
129
|
-
export { u as t };
|
|
130
|
-
|
|
131
|
-
//# sourceMappingURL=useReorderDragList-FCMoFIzH.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useReorderDragList-FCMoFIzH.js","names":["isInControlWithin","IDLE","unlockedSegment","lo","i","sourceIndex","items","hi","draggedIdsFor","index","selectedIds","id","it","x","isNoopDrop","indices","draggedIds","a","b","contiguous","prev","v","first","last","targetIndex","useReorderDragList","optsRef","useRef","opts","containerRef","dragRef","state","setState","useState","computeTargetIndex","useCallback","c","sel","rows","el","raw","row","clientY","refCb","reset","onPointerDownRow","container","e","mods","pressed","child","grab","ghostAt","ev","startThresholdDrag","drop","onPress","swallowNextClick","ids","at","target","delta","onReorder","swallow"],"sources":["../../src/useReorderDragList.ts"],"sourcesContent":["import { useCallback, useEffect, useRef, useState } from 'react';\nimport type { ReactNode, PointerEvent as ReactPointerEvent, RefCallback } from 'react';\nimport { startThresholdDrag, type ThresholdDragHandle } from '@weasel-js/core';\nimport { isInControlWithin } from './interactiveTarget';\n\n/** One row in a reorderable list. */\nexport interface ReorderItem {\n id: string;\n label: ReactNode;\n /** Locked rows cannot be dragged, cannot be crossed by drops, and\n * never combine with other rows in a multi-selection. */\n locked?: boolean;\n}\n\n/**\n * Options for {@link useReorderDragList}. `onReorder` receives the dragged ids\n * and the index they were dropped at, measured against the pre-drag `items`.\n */\nexport interface UseReorderDragListOptions {\n items: ReorderItem[];\n selectedIds: string[];\n onReorder(ids: string[], targetIndex: number): void;\n /** A press that was released without ever engaging a drag — the click a\n * list row means by it. Fires for locked rows too, which can be selected\n * but not dragged. Modifiers are read at press, not at release. When this\n * is given, the DOM click that follows the press is dropped, so a row that\n * also handles `click` sees one press, not two. A press that starts on a\n * control inside the row (a toggle) is left to the control. */\n onPress?(id: string, mods: PressModifiers): void;\n /** Pointer-move distance (px) before pending drag engages. Default `DRAG_THRESHOLD_PX`. */\n threshold?: number;\n /** Selector matching the container's children that are rows, for a list\n * that interleaves other elements (a table's detail rows). Default: every\n * child is a row. */\n rowSelector?: string;\n}\n\n/** Modifier keys held when a press began. */\nexport interface PressModifiers {\n shiftKey: boolean;\n ctrlKey: boolean;\n metaKey: boolean;\n altKey: boolean;\n}\n\n/**\n * Where a drag's ghost goes: the dragged rows, drawn again with their top-left\n * at a client-space point, so the row that was grabbed stays under the pointer\n * where it was picked up. `width` is the grabbed row's.\n */\nexport interface ReorderGhost {\n ids: readonly string[];\n left: number;\n top: number;\n width: number;\n}\n\n/**\n * Live drag state for rendering feedback: which ids are being dragged, the\n * insertion index the drop would use, and where their ghost goes. All `null`\n * when no drag is engaged.\n */\nexport interface ReorderDragState {\n draggedIds: string[] | null;\n targetIndex: number | null;\n ghost: ReorderGhost | null;\n}\n\nconst IDLE: ReorderDragState = { draggedIds: null, targetIndex: null, ghost: null };\n\n/**\n * A `ref` for the list container, an `onPointerDown` for each row, and the\n * live {@link ReorderDragState}. The container ref is required, not optional\n * decoration: it is what the drop index is measured against and what the\n * pointer session is opened on.\n */\nexport interface ReorderDragHandlers {\n rowProps(id: string, index: number): { onPointerDown(e: ReactPointerEvent): void };\n containerProps: {\n ref: RefCallback<HTMLElement>;\n };\n state: ReorderDragState;\n /**\n * Move the row at `index` one place up (`-1`) or down (`1`) — the keyboard\n * reorder. It moves what a drag of that row would: the whole selection if\n * the row is in it, else the row alone, never across a locked row. Calls\n * `onReorder` and returns `true`, or returns `false` when nothing can move.\n */\n nudge(id: string, index: number, delta: -1 | 1): boolean;\n}\n\n/**\n * The half-open run of indices a row at `sourceIndex` may be dropped into:\n * bounded by the nearest locked row above and below it, so a locked row is a\n * wall in both directions rather than a global ceiling.\n */\nfunction unlockedSegment(items: readonly ReorderItem[], sourceIndex: number): [number, number] {\n let lo = 0;\n for (let i = sourceIndex - 1; i >= 0; i--) {\n if (items[i]?.locked) { lo = i + 1; break; }\n }\n let hi = items.length;\n for (let i = sourceIndex + 1; i < items.length; i++) {\n if (items[i]?.locked) { hi = i; break; }\n }\n return [lo, hi];\n}\n\n/** What a drag of the row at `index` carries: the selection within its segment if the row is selected, else the row. */\nfunction draggedIdsFor(\n items: readonly ReorderItem[],\n selectedIds: readonly string[],\n id: string,\n index: number,\n): string[] {\n const [lo, hi] = unlockedSegment(items, index);\n return (selectedIds.includes(id) ? [...selectedIds] : [id]).filter((x) => {\n const i = items.findIndex((it) => it.id === x);\n return i >= lo && i < hi;\n });\n}\n\n/** Would dropping `draggedIds` at `targetIndex` leave a contiguous block where it already is? */\nfunction isNoopDrop(items: readonly ReorderItem[], draggedIds: readonly string[], targetIndex: number): boolean {\n const indices = draggedIds\n .map((id) => items.findIndex((it) => it.id === id))\n .filter((i) => i >= 0)\n .sort((a, b) => a - b);\n const contiguous =\n indices.length > 0 &&\n indices.every((v, i) => {\n if (i === 0) return true;\n const prev = indices[i - 1];\n return prev !== undefined && v === prev + 1;\n });\n const first = indices[0];\n const last = indices[indices.length - 1];\n return contiguous\n && first !== undefined\n && last !== undefined\n && targetIndex >= first\n && targetIndex <= last + 1;\n}\n\n/**\n * Drag-to-reorder for a vertical list of rows. Dragging a row that is part of\n * the current selection drags the whole selection; dragging any other row\n * drags just that row. Locked rows can neither be dragged nor crossed by a\n * drop. A drop that would leave a contiguous block where it already is does\n * not call `onReorder`.\n *\n * The rows are the container's children, whatever they are: `ItemList` rows,\n * or the `PropertyGroup`s of a `PropertyList`. A row's `onPointerDown` can go\n * on the whole row or on a handle inside it.\n *\n * A press opens a `startThresholdDrag` on the *container*, which owns the\n * rest of the gesture: a drag that leaves the list still tracks, a release\n * anywhere still drops, and a release the window never delivered still ends\n * the drag. The container is the origin rather than the row because rows come\n * and go as the list re-renders, and a drag must outlive the row it grabbed.\n */\nexport function useReorderDragList(opts: UseReorderDragListOptions): ReorderDragHandlers {\n const optsRef = useRef(opts);\n optsRef.current = opts;\n const containerRef = useRef<HTMLElement | null>(null);\n const dragRef = useRef<ThresholdDragHandle | null>(null);\n const [state, setState] = useState<ReorderDragState>(IDLE);\n\n useEffect(() => () => { dragRef.current?.cancel(); }, []);\n\n const computeTargetIndex = useCallback((clientY: number, sourceIndex: number): number => {\n const [lo, hi] = unlockedSegment(optsRef.current.items, sourceIndex);\n const c = containerRef.current;\n if (!c) return lo;\n const sel = optsRef.current.rowSelector;\n const rows = (sel ? Array.from(c.children).filter((el) => el.matches(sel)) : Array.from(c.children)) as HTMLElement[];\n let raw = rows.length;\n for (let i = 0; i < rows.length; i++) {\n const row = rows[i];\n if (!row) continue;\n const r = row.getBoundingClientRect();\n if (clientY < r.bottom) { raw = i; break; }\n }\n return Math.max(lo, Math.min(raw, hi));\n }, []);\n\n const refCb = useCallback<RefCallback<HTMLElement>>((el) => {\n containerRef.current = el;\n }, []);\n\n const reset = useCallback(() => {\n dragRef.current = null;\n setState(IDLE);\n }, []);\n\n const onPointerDownRow = useCallback((id: string, index: number, e: ReactPointerEvent) => {\n const container = containerRef.current;\n if (!container || dragRef.current) return;\n if (isInControlWithin(e.target, e.currentTarget as Element)) return;\n\n const mods: PressModifiers = {\n shiftKey: e.shiftKey, ctrlKey: e.ctrlKey, metaKey: e.metaKey, altKey: e.altKey,\n };\n let draggedIds: string[] = [];\n let targetIndex = 0;\n // Where in the grabbed row the pointer went down, so the ghost keeps that point under it. The handler may sit on\n // a handle inside the row rather than the row itself, so the row is the container's child holding it.\n const pressed = e.currentTarget as Element;\n const rowEl = Array.from(container.children).find((child) => child.contains(pressed)) ?? pressed;\n const row = rowEl.getBoundingClientRect();\n const grab = { x: e.clientX - row.left, y: e.clientY - row.top };\n const ghostAt = (ev: { clientX: number; clientY: number }): ReorderGhost => ({\n ids: draggedIds,\n left: ev.clientX - grab.x,\n top: ev.clientY - grab.y,\n width: row.width,\n });\n\n dragRef.current = startThresholdDrag(e, {\n origin: container,\n // A locked row still opens a drag so its release reaches `onPress`, and\n // a threshold nothing can cross is what keeps it from ever engaging.\n threshold: optsRef.current.items[index]?.locked\n ? Number.POSITIVE_INFINITY\n : optsRef.current.threshold,\n onActivate: (ev) => {\n draggedIds = draggedIdsFor(optsRef.current.items, optsRef.current.selectedIds, id, index);\n targetIndex = computeTargetIndex(ev.clientY, index);\n setState({ draggedIds, targetIndex, ghost: ghostAt(ev) });\n },\n onMove: (ev) => {\n targetIndex = computeTargetIndex(ev.clientY, index);\n setState({ draggedIds, targetIndex, ghost: ghostAt(ev) });\n },\n onCommit: (ev) => {\n const drop = computeTargetIndex(ev.clientY, index);\n if (!isNoopDrop(optsRef.current.items, draggedIds, drop)) {\n optsRef.current.onReorder(draggedIds, drop);\n }\n reset();\n },\n onClick: () => {\n const { onPress } = optsRef.current;\n if (onPress) {\n onPress(id, mods);\n swallowNextClick(container);\n }\n reset();\n },\n // Every cancel reason — the browser's, a lost capture, an unmount —\n // says the gesture was interrupted rather than aimed, so the rows stay\n // where they were.\n onCancel: reset,\n });\n }, [computeTargetIndex, reset]);\n\n const nudge = useCallback((id: string, index: number, delta: -1 | 1): boolean => {\n const { items, selectedIds, onReorder } = optsRef.current;\n if (items[index]?.locked) return false;\n const ids = draggedIdsFor(items, selectedIds, id, index);\n const at = ids.map((x) => items.findIndex((it) => it.id === x)).sort((a, b) => a - b);\n const first = at[0];\n const last = at[at.length - 1];\n if (first === undefined || last === undefined) return false;\n const [lo, hi] = unlockedSegment(items, index);\n const target = delta < 0 ? first - 1 : last + 2;\n if (target < lo || target > hi || isNoopDrop(items, ids, target)) return false;\n onReorder(ids, target);\n return true;\n }, []);\n\n return {\n nudge,\n rowProps: (id, index) => ({\n onPointerDown: (e) => onPointerDownRow(id, index, e),\n }),\n containerProps: {\n ref: refCb,\n },\n state,\n };\n}\n\n/**\n * The session captured the pointer on the container, so browsers disagree on\n * where the release's click lands; it may still reach the row. `onPress` has\n * already reported this press, so that click is dropped rather than read as a\n * second one. It is dispatched in the same task as the release.\n */\nfunction swallowNextClick(container: HTMLElement): void {\n const swallow = (e: Event) => { e.stopPropagation(); };\n container.addEventListener('click', swallow, true);\n setTimeout(() => { container.removeEventListener('click', swallow, true); }, 0);\n}\n"],"mappings":";;;;AAoEA,IAAMC,IAAyB;CAAE,YAAY;CAAM,aAAa;CAAM,OAAO;AAAK;AA4BlF,SAASC,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Z,CAAC;CACH,GAAG,CAACV,GAAoBU,CAAK,CAAC;CAiB9B,OAAO;EACL,OAhBYT,GAAa,GAAY,GAAe,MAA2B;GAC/E,IAAM,EAAE,UAAO,gBAAa,iBAAcT,EAAQ;GAClD,IAAIpB,EAAMG,EAAM,EAAE,QAAQ,OAAO;GACjC,IAAMiD,IAAMlD,EAAcF,GAAOI,GAAaC,GAAIF,CAAK,GACjDkD,IAAKD,EAAI,KAAK,MAAMpD,EAAM,WAAW,MAAOM,EAAG,OAAOC,CAAC,CAAC,CAAC,CAAC,MAAM,GAAG,MAAMI,IAAIC,CAAC,GAC9EI,IAAQqC,EAAG,IACXpC,IAAOoC,EAAGA,EAAG,SAAS;GAC5B,IAAIrC,MAAU,KAAA,KAAaC,MAAS,KAAA,GAAW,OAAO;GACtD,IAAM,CAACpB,GAAII,KAAML,EAAgBI,GAAOG,CAAK,GACvCmD,IAASC,IAAQ,IAAIvC,IAAQ,IAAIC,IAAO;GAG9C,OAFIqC,IAASzD,KAAMyD,IAASrD,KAAMO,EAAWR,GAAOoD,GAAKE,CAAM,IAAU,MACzEE,EAAUJ,GAAKE,CAAM,GACd;EACT,GAAG,CAAC,CAGF;EACA,WAAW,GAAI,OAAW,EACxB,gBAAgB,MAAMf,EAAiBlC,GAAIF,GAAOsC,CAAC,EACrD;EACA,gBAAgB,EACd,KAAKJ,EACP;EACA;CACF;AACF;AAQA,SAASc,EAAiB,GAA8B;CACtD,IAAMM,KAAW,MAAa;EAAE,EAAE,gBAAgB;CAAG;CAErD,AADAjB,EAAU,iBAAiB,SAASiB,GAAS,EAAI,GACjD,iBAAiB;EAAE,EAAU,oBAAoB,SAASA,GAAS,EAAI;CAAG,GAAG,CAAC;AAChF"}
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
import { useRef as e } from "react";
|
|
2
|
-
//#region src/useRovingTabIndex.ts
|
|
3
|
-
function t(e) {
|
|
4
|
-
for (let t = 0; t < e.length; t++) if (!e[t].disabled) return t;
|
|
5
|
-
return -1;
|
|
6
|
-
}
|
|
7
|
-
function n(e) {
|
|
8
|
-
for (let t = e.length - 1; t >= 0; t--) if (!e[t].disabled) return t;
|
|
9
|
-
return -1;
|
|
10
|
-
}
|
|
11
|
-
function r(e, t) {
|
|
12
|
-
let n = e.length;
|
|
13
|
-
for (let r = 1; r <= n; r++) {
|
|
14
|
-
let i = (t + r + n) % n;
|
|
15
|
-
if (!e[i].disabled) return i;
|
|
16
|
-
}
|
|
17
|
-
return t;
|
|
18
|
-
}
|
|
19
|
-
function i(e, t) {
|
|
20
|
-
let n = e.length;
|
|
21
|
-
for (let r = 1; r <= n; r++) {
|
|
22
|
-
let i = (t - r + n) % n;
|
|
23
|
-
if (!e[i].disabled) return i;
|
|
24
|
-
}
|
|
25
|
-
return t;
|
|
26
|
-
}
|
|
27
|
-
function a(a) {
|
|
28
|
-
let { items: o, itemClassName: s, onNavigate: c, onActivate: l } = a, u = e(null), d = a.tabStopIndex ?? t(o), f = (e) => {
|
|
29
|
-
let t = u.current;
|
|
30
|
-
t && t.querySelectorAll(`.${s}`)[e]?.focus();
|
|
31
|
-
};
|
|
32
|
-
return {
|
|
33
|
-
rootRef: u,
|
|
34
|
-
tabIndexFor: (e) => e === d ? 0 : -1,
|
|
35
|
-
onKeyDown: (e) => (a) => {
|
|
36
|
-
let s = -1;
|
|
37
|
-
switch (a.key) {
|
|
38
|
-
case "ArrowLeft":
|
|
39
|
-
case "ArrowUp":
|
|
40
|
-
s = i(o, e);
|
|
41
|
-
break;
|
|
42
|
-
case "ArrowRight":
|
|
43
|
-
case "ArrowDown":
|
|
44
|
-
s = r(o, e);
|
|
45
|
-
break;
|
|
46
|
-
case "Home":
|
|
47
|
-
s = t(o);
|
|
48
|
-
break;
|
|
49
|
-
case "End":
|
|
50
|
-
s = n(o);
|
|
51
|
-
break;
|
|
52
|
-
case " ":
|
|
53
|
-
case "Enter":
|
|
54
|
-
l && (a.preventDefault(), l(e));
|
|
55
|
-
return;
|
|
56
|
-
default: return;
|
|
57
|
-
}
|
|
58
|
-
s < 0 || s === e || (a.preventDefault(), c?.(s), f(s));
|
|
59
|
-
}
|
|
60
|
-
};
|
|
61
|
-
}
|
|
62
|
-
//#endregion
|
|
63
|
-
export { a as t };
|
|
64
|
-
|
|
65
|
-
//# sourceMappingURL=useRovingTabIndex-Bp_hYm_h.js.map
|