@weasel-js/ui 1.7.3 → 1.8.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 → ActionBar-CfXS7-9f.js} +2 -2
- package/dist/chunks/{ActionBar-xA73vzzF.js.map → ActionBar-CfXS7-9f.js.map} +1 -1
- package/dist/chunks/{Badge-jYQjrTKc.js → Badge-4ShpqA0h.js} +2 -2
- package/dist/chunks/{Badge-jYQjrTKc.js.map → Badge-4ShpqA0h.js.map} +1 -1
- package/dist/chunks/{Badge-CTc9Lkwn.js → Badge-qkV9EqKs.js} +6 -2
- package/dist/chunks/Badge-qkV9EqKs.js.map +1 -0
- package/dist/chunks/{Button-XB-T75YL.js → Button-CQA-K1g9.js} +17 -17
- package/dist/chunks/Button-CQA-K1g9.js.map +1 -0
- package/dist/chunks/Button-KF-qSGtA.js +11 -0
- package/dist/chunks/Button-KF-qSGtA.js.map +1 -0
- package/dist/chunks/{ButtonBar-CIMKPPRS.js → ButtonBar-B-cYuoem.js} +10 -4
- package/dist/chunks/ButtonBar-B-cYuoem.js.map +1 -0
- package/dist/chunks/{Callout-BUn0dP_S.js → Callout-VyYDIP7w.js} +26 -26
- package/dist/chunks/Callout-VyYDIP7w.js.map +1 -0
- package/dist/chunks/{Checkbox-DFn-x0JO.js → Checkbox-d4IfhiXh.js} +2 -2
- package/dist/chunks/{Checkbox-DFn-x0JO.js.map → Checkbox-d4IfhiXh.js.map} +1 -1
- package/dist/chunks/{CloseButton-BmNmRVtb.js → CloseButton-CKarkTT9.js} +3 -3
- package/dist/chunks/{CloseButton-BmNmRVtb.js.map → CloseButton-CKarkTT9.js.map} +1 -1
- package/dist/chunks/{Code-AsKpgnv6.js → Code-ChwKP1V0.js} +8 -2
- package/dist/chunks/Code-ChwKP1V0.js.map +1 -0
- package/dist/chunks/{ColorModeControl-DaVJ-SyX.js → ColorModeControl-CH9PmDlT.js} +6 -6
- package/dist/chunks/{ColorModeControl-DaVJ-SyX.js.map → ColorModeControl-CH9PmDlT.js.map} +1 -1
- package/dist/chunks/{ComboBox-DKln_mOd.js → ComboBox-BMj_IKBj.js} +4 -4
- package/dist/chunks/ComboBox-BMj_IKBj.js.map +1 -0
- package/dist/chunks/{DataGrid-CmHJe57v.js → DataGrid-CjiVKoaA.js} +3 -3
- package/dist/chunks/{DataGrid-CmHJe57v.js.map → DataGrid-CjiVKoaA.js.map} +1 -1
- package/dist/chunks/{DetentSlider-DNTAk8xP.js → DetentSlider-D40V8Oma.js} +2 -2
- package/dist/chunks/{DetentSlider-DNTAk8xP.js.map → DetentSlider-D40V8Oma.js.map} +1 -1
- package/dist/chunks/{Dialog-DKfsk5VN.js → Dialog-Du4POZ52.js} +12 -12
- package/dist/chunks/Dialog-Du4POZ52.js.map +1 -0
- package/dist/chunks/{Disclosure-Ch2KxYuB.js → Disclosure-CpWt87nO.js} +7 -7
- package/dist/chunks/{Disclosure-Ch2KxYuB.js.map → Disclosure-CpWt87nO.js.map} +1 -1
- package/dist/chunks/{DragGhost-BeYDJyLZ.js → DragGhost-_IpuN_xM.js} +2 -2
- package/dist/chunks/{DragGhost-BeYDJyLZ.js.map → DragGhost-_IpuN_xM.js.map} +1 -1
- package/dist/chunks/{FallthroughDiagram-CS1IhQaU.js → FallthroughDiagram-Cn6QLWKA.js} +9 -9
- package/dist/chunks/{FallthroughDiagram-CS1IhQaU.js.map → FallthroughDiagram-Cn6QLWKA.js.map} +1 -1
- package/dist/chunks/{FillStrokeSwatch-C4h3rUFM.js → FillStrokeSwatch-BkUhlpQL.js} +2 -2
- package/dist/chunks/{FillStrokeSwatch-C4h3rUFM.js.map → FillStrokeSwatch-BkUhlpQL.js.map} +1 -1
- package/dist/chunks/FitLabel-BzZGkWfL.js +76 -0
- package/dist/chunks/FitLabel-BzZGkWfL.js.map +1 -0
- package/dist/chunks/{FontFamilySelect-DEvMXyZd.js → FontFamilySelect-CXN7O2-p.js} +2 -2
- package/dist/chunks/{FontFamilySelect-DEvMXyZd.js.map → FontFamilySelect-CXN7O2-p.js.map} +1 -1
- package/dist/chunks/{FontWeightSelect-BLQ_LMJF.js → FontWeightSelect-BBuJGe_2.js} +2 -2
- package/dist/chunks/{FontWeightSelect-BLQ_LMJF.js.map → FontWeightSelect-BBuJGe_2.js.map} +1 -1
- package/dist/chunks/{GestureRoute-BXESrHI0.js → GestureRoute-BqHUrGeQ.js} +13 -13
- package/dist/chunks/{GestureRoute-BXESrHI0.js.map → GestureRoute-BqHUrGeQ.js.map} +1 -1
- package/dist/chunks/{GradientEditor-DD2OjQtn.js → GradientEditor-DX4sb1Hf.js} +4 -4
- package/dist/chunks/{GradientEditor-DD2OjQtn.js.map → GradientEditor-DX4sb1Hf.js.map} +1 -1
- package/dist/chunks/{Icon--B1ME-6c.js → Icon-BfqYtAX5.js} +33 -1
- package/dist/chunks/Icon-BfqYtAX5.js.map +1 -0
- package/dist/chunks/{ItemList-CRu9y7hL.js → ItemList-nbakLf3N.js} +32 -32
- package/dist/chunks/ItemList-nbakLf3N.js.map +1 -0
- package/dist/chunks/{Jog-BrkzdGV2.js → Jog-BU0xuM3G.js} +7 -7
- package/dist/chunks/{Jog-BrkzdGV2.js.map → Jog-BU0xuM3G.js.map} +1 -1
- package/dist/chunks/{Keycaps-C-FJyG8k.js → Keycaps-CM-gOj0e.js} +8 -2
- package/dist/chunks/Keycaps-CM-gOj0e.js.map +1 -0
- package/dist/chunks/LayerList-vfAoImxX.js +432 -0
- package/dist/chunks/LayerList-vfAoImxX.js.map +1 -0
- package/dist/chunks/{ListEditor-OQDzG4A5.js → ListEditor-BAKs47bN.js} +3 -3
- package/dist/chunks/{ListEditor-OQDzG4A5.js.map → ListEditor-BAKs47bN.js.map} +1 -1
- package/dist/chunks/{MenuButton-TAFg88Lp.js → MenuButton-CJGdhwGr.js} +5 -5
- package/dist/chunks/MenuButton-CJGdhwGr.js.map +1 -0
- package/dist/chunks/{MeshEditor-DWpvg8H6.js → MeshEditor-rhf7cXfG.js} +2 -2
- package/dist/chunks/{MeshEditor-DWpvg8H6.js.map → MeshEditor-rhf7cXfG.js.map} +1 -1
- package/dist/chunks/{NumberField-DS0WSiin.js → NumberField-BXFrOi5M.js} +8 -5
- package/dist/chunks/{NumberField-DS0WSiin.js.map → NumberField-BXFrOi5M.js.map} +1 -1
- package/dist/chunks/{OptionsBar-DeTAjVb7.js → OptionsBar-DyTXbev-.js} +9 -3
- package/dist/chunks/OptionsBar-DyTXbev-.js.map +1 -0
- package/dist/chunks/{PaintField-BdmQM53v.js → PaintField--GbF8sL7.js} +7 -7
- package/dist/chunks/PaintField--GbF8sL7.js.map +1 -0
- package/dist/chunks/{PaintInput-DaQMeBsI.js → PaintInput-DSS5IjXn.js} +5 -5
- package/dist/chunks/{PaintInput-DaQMeBsI.js.map → PaintInput-DSS5IjXn.js.map} +1 -1
- package/dist/chunks/{PatternPicker-B3HcMZWg.js → PatternPicker-82DCUvUk.js} +9 -9
- package/dist/chunks/PatternPicker-82DCUvUk.js.map +1 -0
- package/dist/chunks/{Powerline-6wIFmDik.js → Powerline-CogJv9VU.js} +2 -2
- package/dist/chunks/{Powerline-6wIFmDik.js.map → Powerline-CogJv9VU.js.map} +1 -1
- package/dist/chunks/{Prefs-BnVEyfWO.js → Prefs-BSSKOvPa.js} +41 -41
- package/dist/chunks/Prefs-BSSKOvPa.js.map +1 -0
- package/dist/chunks/{Properties-BoG2MMHR.js → Properties-DteSVEWs.js} +5 -5
- package/dist/chunks/{Properties-BoG2MMHR.js.map → Properties-DteSVEWs.js.map} +1 -1
- package/dist/chunks/PropertyField-CLbUOynA.js +751 -0
- package/dist/chunks/PropertyField-CLbUOynA.js.map +1 -0
- package/dist/chunks/{Select-ouV8O6cp.js → Select-BhHwjNsb.js} +13 -13
- package/dist/chunks/Select-BhHwjNsb.js.map +1 -0
- package/dist/chunks/{SelectionPanel-COZ6z9_P.js → SelectionPanel-B6HinSdB.js} +2 -2
- package/dist/chunks/{SelectionPanel-COZ6z9_P.js.map → SelectionPanel-B6HinSdB.js.map} +1 -1
- package/dist/chunks/{SidebarPanel-AXQ0jRDx.js → SidebarPanel-P3a8tIIj.js} +3 -3
- package/dist/chunks/{SidebarPanel-AXQ0jRDx.js.map → SidebarPanel-P3a8tIIj.js.map} +1 -1
- package/dist/chunks/Slider-CHBQ8uUC.js +439 -0
- package/dist/chunks/Slider-CHBQ8uUC.js.map +1 -0
- package/dist/chunks/{StatusBar-BEOfOX0D.js → StatusBar-DEh7J2Gj.js} +14 -9
- package/dist/chunks/StatusBar-DEh7J2Gj.js.map +1 -0
- package/dist/chunks/{SwatchGrid-9ZPiDmxd.js → SwatchGrid-DxK9e_IV.js} +3 -3
- package/dist/chunks/SwatchGrid-DxK9e_IV.js.map +1 -0
- package/dist/chunks/{SwatchStrip-Bi9iPLoh.js → SwatchStrip-D7YNn_p0.js} +3 -3
- package/dist/chunks/{SwatchStrip-Bi9iPLoh.js.map → SwatchStrip-D7YNn_p0.js.map} +1 -1
- package/dist/chunks/{ThemeSwitcher-DiBmMh_B.js → ThemeSwitcher-BJWP1l87.js} +6 -6
- package/dist/chunks/{ThemeSwitcher-DiBmMh_B.js.map → ThemeSwitcher-BJWP1l87.js.map} +1 -1
- package/dist/chunks/{Timeline-sMCH2fah.js → Timeline-CisRg82u.js} +4 -4
- package/dist/chunks/{Timeline-sMCH2fah.js.map → Timeline-CisRg82u.js.map} +1 -1
- package/dist/chunks/{Toast-C3ozq11V.js → Toast-DhkU9Z0b.js} +3 -3
- package/dist/chunks/{Toast-C3ozq11V.js.map → Toast-DhkU9Z0b.js.map} +1 -1
- package/dist/chunks/ToggleBar-CRc2k89_.js +10 -0
- package/dist/chunks/ToggleBar-CRc2k89_.js.map +1 -0
- package/dist/chunks/ToggleBar-CfYbMK3x.js +84 -0
- package/dist/chunks/ToggleBar-CfYbMK3x.js.map +1 -0
- package/dist/chunks/{TokenPanel-WtKGY2Db.js → TokenPanel-cL37E39j.js} +26 -26
- package/dist/chunks/{TokenPanel-WtKGY2Db.js.map → TokenPanel-cL37E39j.js.map} +1 -1
- package/dist/chunks/{ToolButton-BURp4YIO.js → ToolButton-Bo7WH1wt.js} +2 -2
- package/dist/chunks/{ToolButton-BURp4YIO.js.map → ToolButton-Bo7WH1wt.js.map} +1 -1
- package/dist/chunks/ToolOptionsBar-DmhzrOmd.js +94 -0
- package/dist/chunks/ToolOptionsBar-DmhzrOmd.js.map +1 -0
- package/dist/chunks/{ToolPalette-DKDFWOX-.js → ToolPalette-BTD84k9C.js} +2 -2
- package/dist/chunks/{ToolPalette-DKDFWOX-.js.map → ToolPalette-BTD84k9C.js.map} +1 -1
- package/dist/chunks/{Tooltip-C6eFCYxw.js → Tooltip-DljsPEQG.js} +4 -4
- package/dist/chunks/Tooltip-DljsPEQG.js.map +1 -0
- package/dist/chunks/Tree-B_PW6K-W.js +215 -0
- package/dist/chunks/Tree-B_PW6K-W.js.map +1 -0
- package/dist/chunks/checkbox.module-Dcx8ILgR.js +5 -0
- package/dist/chunks/checkbox.module-Dcx8ILgR.js.map +1 -0
- package/dist/chunks/{icons-Dr2-r30x.js → icons-B_fPKEis.js} +52 -43
- package/dist/chunks/icons-B_fPKEis.js.map +1 -0
- package/dist/chunks/{model-B6zuQg6b.js → model-Ca0f95r0.js} +134 -133
- package/dist/chunks/model-Ca0f95r0.js.map +1 -0
- package/dist/chunks/{portalHost-CE70wLzo.js → portalHost-RUQPxIoW.js} +3 -2
- package/dist/chunks/{portalHost-CE70wLzo.js.map → portalHost-RUQPxIoW.js.map} +1 -1
- package/dist/chunks/{prefField-BE_Ytr2H.js → prefField-DPPbAmRR.js} +81 -75
- package/dist/chunks/prefField-DPPbAmRR.js.map +1 -0
- package/dist/chunks/{segmentTooltip-CGxCOWNz.js → segmentTooltip-8VBPNgEc.js} +2 -2
- package/dist/chunks/{segmentTooltip-CGxCOWNz.js.map → segmentTooltip-8VBPNgEc.js.map} +1 -1
- package/dist/chunks/segmentedControl.module-62qjNWJk.js +11 -0
- package/dist/chunks/{segmentedControl.module-BzGXUL5G.js.map → segmentedControl.module-62qjNWJk.js.map} +1 -1
- package/dist/chunks/{useReorderDragList-CStYKjHl.js → useReorderDragList-DnqqvRGK.js} +38 -30
- package/dist/chunks/useReorderDragList-DnqqvRGK.js.map +1 -0
- package/dist/components/ActionBar/index.js +1 -1
- package/dist/components/Badge/index.d.ts +1 -0
- package/dist/components/Badge/index.d.ts.map +1 -1
- package/dist/components/Badge/index.js +3 -3
- package/dist/components/Badge/variantIcons.d.ts +5 -0
- package/dist/components/Badge/variantIcons.d.ts.map +1 -0
- package/dist/components/Button/index.d.ts +1 -0
- package/dist/components/Button/index.d.ts.map +1 -1
- package/dist/components/Button/index.js +3 -2
- package/dist/components/Button/variantIcons.d.ts +5 -0
- package/dist/components/Button/variantIcons.d.ts.map +1 -0
- package/dist/components/ButtonBar/index.d.ts +1 -0
- package/dist/components/ButtonBar/index.d.ts.map +1 -1
- package/dist/components/ButtonBar/index.js +2 -2
- package/dist/components/ButtonBar/variantIcons.d.ts +5 -0
- package/dist/components/ButtonBar/variantIcons.d.ts.map +1 -0
- package/dist/components/Callout/Callout.d.ts.map +1 -1
- package/dist/components/Callout/index.js +1 -1
- package/dist/components/Checkbox/index.js +1 -1
- package/dist/components/CloseButton/index.js +1 -1
- package/dist/components/Code/index.d.ts +1 -0
- package/dist/components/Code/index.d.ts.map +1 -1
- package/dist/components/Code/index.js +2 -2
- package/dist/components/Code/variantIcons.d.ts +5 -0
- package/dist/components/Code/variantIcons.d.ts.map +1 -0
- package/dist/components/ColorModeControl/index.js +1 -1
- package/dist/components/ComboBox/ComboBox.d.ts.map +1 -1
- package/dist/components/ComboBox/index.js +1 -1
- package/dist/components/DataGrid/index.js +1 -1
- package/dist/components/DetentSlider/index.js +1 -1
- package/dist/components/Dialog/Dialog.d.ts.map +1 -1
- package/dist/components/Dialog/index.js +1 -1
- package/dist/components/Disclosure/index.js +1 -1
- package/dist/components/DragGhost/index.js +1 -1
- package/dist/components/FallthroughDiagram/index.js +1 -1
- package/dist/components/FillStrokeSwatch/index.js +1 -1
- package/dist/components/FitLabel/FitLabel.d.ts +41 -0
- package/dist/components/FitLabel/FitLabel.d.ts.map +1 -0
- package/dist/components/FitLabel/index.d.ts +3 -0
- package/dist/components/FitLabel/index.d.ts.map +1 -0
- package/dist/components/FitLabel/index.js +2 -0
- package/dist/components/FontFamilySelect/index.js +1 -1
- package/dist/components/FontWeightSelect/index.js +1 -1
- package/dist/components/GestureRoute/index.js +1 -1
- package/dist/components/GradientEditor/index.js +1 -1
- package/dist/components/InlineRange/InlineRange.d.ts +1 -1
- package/dist/components/ItemList/index.js +1 -1
- package/dist/components/Jog/index.js +1 -1
- package/dist/components/Keycaps/index.d.ts +1 -0
- package/dist/components/Keycaps/index.d.ts.map +1 -1
- package/dist/components/Keycaps/index.js +2 -2
- package/dist/components/Keycaps/variantIcons.d.ts +5 -0
- package/dist/components/Keycaps/variantIcons.d.ts.map +1 -0
- package/dist/components/LayerList/LayerList.d.ts.map +1 -1
- package/dist/components/LayerList/index.js +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/index.js +1 -1
- package/dist/components/NumberField/UnitField.d.ts.map +1 -1
- package/dist/components/NumberField/index.js +1 -1
- package/dist/components/OptionsBar/index.d.ts +1 -0
- package/dist/components/OptionsBar/index.d.ts.map +1 -1
- package/dist/components/OptionsBar/index.js +2 -2
- package/dist/components/OptionsBar/variantIcons.d.ts +5 -0
- package/dist/components/OptionsBar/variantIcons.d.ts.map +1 -0
- package/dist/components/PaintField/PaintField.d.ts.map +1 -1
- package/dist/components/PaintField/index.js +1 -1
- package/dist/components/PaintInput/index.js +1 -1
- package/dist/components/PatternPicker/index.js +1 -1
- package/dist/components/Powerline/index.js +2 -2
- package/dist/components/Prefs/index.js +2 -2
- package/dist/components/Prefs/prefField.d.ts.map +1 -1
- package/dist/components/Properties/NumberControls.d.ts +16 -0
- package/dist/components/Properties/NumberControls.d.ts.map +1 -0
- package/dist/components/Properties/PropertyField.d.ts +18 -8
- package/dist/components/Properties/PropertyField.d.ts.map +1 -1
- package/dist/components/Properties/index.js +2 -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.map +1 -1
- package/dist/components/SidebarPanel/index.js +1 -1
- package/dist/components/Slider/Slider.d.ts +6 -0
- package/dist/components/Slider/Slider.d.ts.map +1 -1
- package/dist/components/Slider/index.js +1 -1
- package/dist/components/StatusBar/StatusBar.d.ts +2 -0
- package/dist/components/StatusBar/StatusBar.d.ts.map +1 -1
- package/dist/components/StatusBar/index.js +1 -1
- package/dist/components/SwatchGrid/index.js +1 -1
- package/dist/components/SwatchStrip/index.js +1 -1
- package/dist/components/ThemeSwitcher/index.js +1 -1
- package/dist/components/Timeline/index.js +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.d.ts +1 -0
- package/dist/components/ToggleBar/index.d.ts.map +1 -1
- package/dist/components/ToggleBar/index.js +3 -2
- package/dist/components/ToggleBar/variantIcons.d.ts +5 -0
- package/dist/components/ToggleBar/variantIcons.d.ts.map +1 -0
- package/dist/components/TokenPanel/index.js +1 -1
- package/dist/components/ToolButton/index.js +1 -1
- package/dist/components/ToolOptionsBar/ToolOptionsBar.d.ts +1 -1
- package/dist/components/ToolOptionsBar/ToolOptionsBar.d.ts.map +1 -1
- package/dist/components/ToolOptionsBar/index.js +1 -1
- package/dist/components/ToolPalette/index.js +1 -1
- package/dist/components/Tooltip/Tooltip.d.ts.map +1 -1
- package/dist/components/Tooltip/index.js +1 -1
- package/dist/components/Tree/Tree.d.ts +1 -1
- package/dist/components/Tree/Tree.d.ts.map +1 -1
- package/dist/components/Tree/index.js +1 -1
- package/dist/components/stanceCss.d.ts +6 -0
- package/dist/components/stanceCss.d.ts.map +1 -1
- package/dist/components/stanceSurfaces.d.ts.map +1 -1
- package/dist/endless.d.ts +7 -0
- package/dist/endless.d.ts.map +1 -0
- package/dist/icons/index.d.ts +6 -0
- package/dist/icons/index.d.ts.map +1 -1
- package/dist/icons/paths.d.ts +14 -0
- package/dist/icons/paths.d.ts.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +101 -97
- package/dist/index.js.map +1 -1
- package/dist/overlays/portalHost.d.ts +10 -4
- package/dist/overlays/portalHost.d.ts.map +1 -1
- package/dist/style.css +1 -1
- package/dist/useReorderDragList.d.ts +3 -0
- package/dist/useReorderDragList.d.ts.map +1 -1
- package/package.json +10 -9
- package/dist/chunks/Badge-CTc9Lkwn.js.map +0 -1
- package/dist/chunks/Button-XB-T75YL.js.map +0 -1
- package/dist/chunks/ButtonBar-CIMKPPRS.js.map +0 -1
- package/dist/chunks/Callout-BUn0dP_S.js.map +0 -1
- package/dist/chunks/Code-AsKpgnv6.js.map +0 -1
- package/dist/chunks/ComboBox-DKln_mOd.js.map +0 -1
- package/dist/chunks/Dialog-DKfsk5VN.js.map +0 -1
- package/dist/chunks/Icon--B1ME-6c.js.map +0 -1
- package/dist/chunks/ItemList-CRu9y7hL.js.map +0 -1
- package/dist/chunks/Keycaps-C-FJyG8k.js.map +0 -1
- package/dist/chunks/LayerList-BqeWFuGc.js +0 -421
- package/dist/chunks/LayerList-BqeWFuGc.js.map +0 -1
- package/dist/chunks/MenuButton-TAFg88Lp.js.map +0 -1
- package/dist/chunks/OptionsBar-DeTAjVb7.js.map +0 -1
- package/dist/chunks/PaintField-BdmQM53v.js.map +0 -1
- package/dist/chunks/PatternPicker-B3HcMZWg.js.map +0 -1
- package/dist/chunks/Prefs-BnVEyfWO.js.map +0 -1
- package/dist/chunks/PropertyField-PMrqBA0n.js +0 -743
- package/dist/chunks/PropertyField-PMrqBA0n.js.map +0 -1
- package/dist/chunks/Select-ouV8O6cp.js.map +0 -1
- package/dist/chunks/Slider-DSrlMEq8.js +0 -389
- package/dist/chunks/Slider-DSrlMEq8.js.map +0 -1
- package/dist/chunks/StatusBar-BEOfOX0D.js.map +0 -1
- package/dist/chunks/SwatchGrid-9ZPiDmxd.js.map +0 -1
- package/dist/chunks/ToggleBar-Z2jZiguF.js +0 -80
- package/dist/chunks/ToggleBar-Z2jZiguF.js.map +0 -1
- package/dist/chunks/ToolOptionsBar-BJKwnemU.js +0 -88
- package/dist/chunks/ToolOptionsBar-BJKwnemU.js.map +0 -1
- package/dist/chunks/Tooltip-C6eFCYxw.js.map +0 -1
- package/dist/chunks/Tree-Cc8lIzgM.js +0 -203
- package/dist/chunks/Tree-Cc8lIzgM.js.map +0 -1
- package/dist/chunks/checkbox.module-DLQV9tMX.js +0 -5
- package/dist/chunks/checkbox.module-DLQV9tMX.js.map +0 -1
- package/dist/chunks/icons-Dr2-r30x.js.map +0 -1
- package/dist/chunks/interactiveTarget-BNZmTow2.js +0 -24
- package/dist/chunks/interactiveTarget-BNZmTow2.js.map +0 -1
- package/dist/chunks/model-B6zuQg6b.js.map +0 -1
- package/dist/chunks/prefField-BE_Ytr2H.js.map +0 -1
- package/dist/chunks/segmentedControl.module-BzGXUL5G.js +0 -11
- package/dist/chunks/useReorderDragList-CStYKjHl.js.map +0 -1
- package/dist/interactiveTarget.d.ts +0 -9
- package/dist/interactiveTarget.d.ts.map +0 -1
|
@@ -1,9 +1,12 @@
|
|
|
1
|
-
import { a as e, t } from "./Icon
|
|
1
|
+
import { a as e, t } from "./Icon-BfqYtAX5.js";
|
|
2
2
|
import { t as n } from "./paintValue-BpaGPjV3.js";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
3
|
+
import { r } from "./PropertyField-CLbUOynA.js";
|
|
4
|
+
import { n as i } from "./Slider-CHBQ8uUC.js";
|
|
5
|
+
import { isBuiltinToolPref as a, numericWeight as o } from "@weasel-js/core";
|
|
6
|
+
import { jsx as s } from "react/jsx-runtime";
|
|
7
|
+
import { endless as c } from "@weasel-js/quantity";
|
|
5
8
|
//#region src/components/Prefs/schema.ts
|
|
6
|
-
function
|
|
9
|
+
function l(e) {
|
|
7
10
|
if (!e.unit) return {
|
|
8
11
|
min: e.min,
|
|
9
12
|
max: e.max,
|
|
@@ -16,16 +19,16 @@ function o(e) {
|
|
|
16
19
|
step: a
|
|
17
20
|
};
|
|
18
21
|
}
|
|
19
|
-
function
|
|
22
|
+
function u(e) {
|
|
20
23
|
return e.suffix === void 0 ? { ...e.accepts } : {
|
|
21
24
|
[e.suffix]: 1,
|
|
22
25
|
...e.accepts
|
|
23
26
|
};
|
|
24
27
|
}
|
|
25
|
-
function
|
|
28
|
+
function d(e) {
|
|
26
29
|
return "kind" in e;
|
|
27
30
|
}
|
|
28
|
-
function
|
|
31
|
+
function f(e, t) {
|
|
29
32
|
let n = e;
|
|
30
33
|
for (let e of t.split(".")) {
|
|
31
34
|
if (typeof n != "object" || !n) return;
|
|
@@ -33,11 +36,11 @@ function l(e, t) {
|
|
|
33
36
|
}
|
|
34
37
|
return n;
|
|
35
38
|
}
|
|
36
|
-
function
|
|
37
|
-
if (
|
|
39
|
+
function p(e, t) {
|
|
40
|
+
if (d(e)) return e.hidden && !t ? null : e;
|
|
38
41
|
let n = e, r = {};
|
|
39
42
|
for (let [e, i] of Object.entries(n.children)) {
|
|
40
|
-
let n =
|
|
43
|
+
let n = p(i, t);
|
|
41
44
|
n && (r[e] = n);
|
|
42
45
|
}
|
|
43
46
|
return Object.keys(r).length === 0 ? null : {
|
|
@@ -45,14 +48,14 @@ function u(e, t) {
|
|
|
45
48
|
children: r
|
|
46
49
|
};
|
|
47
50
|
}
|
|
48
|
-
function
|
|
49
|
-
if (
|
|
51
|
+
function m(e) {
|
|
52
|
+
if (d(e)) return 1;
|
|
50
53
|
let t = 0;
|
|
51
|
-
for (let n of Object.values(e.children)) t +=
|
|
54
|
+
for (let n of Object.values(e.children)) t += m(n);
|
|
52
55
|
return t;
|
|
53
56
|
}
|
|
54
|
-
function
|
|
55
|
-
let t = [], n = Object.values(e.children).filter(
|
|
57
|
+
function h(e) {
|
|
58
|
+
let t = [], n = Object.values(e.children).filter(d).length;
|
|
56
59
|
n > 0 && t.push({
|
|
57
60
|
path: "",
|
|
58
61
|
name: e.name,
|
|
@@ -60,36 +63,36 @@ function f(e) {
|
|
|
60
63
|
section: "",
|
|
61
64
|
matches: n
|
|
62
65
|
});
|
|
63
|
-
for (let [n, r] of Object.entries(e.children)) if (!
|
|
66
|
+
for (let [n, r] of Object.entries(e.children)) if (!d(r)) {
|
|
64
67
|
t.push({
|
|
65
68
|
path: n,
|
|
66
69
|
name: r.name,
|
|
67
70
|
depth: 0,
|
|
68
71
|
section: n,
|
|
69
|
-
matches:
|
|
72
|
+
matches: m(r)
|
|
70
73
|
});
|
|
71
|
-
for (let [e, i] of Object.entries(r.children))
|
|
74
|
+
for (let [e, i] of Object.entries(r.children)) d(i) || t.push({
|
|
72
75
|
path: `${n}.${e}`,
|
|
73
76
|
name: i.name,
|
|
74
77
|
depth: 1,
|
|
75
78
|
section: n,
|
|
76
|
-
matches:
|
|
79
|
+
matches: m(i)
|
|
77
80
|
});
|
|
78
81
|
}
|
|
79
82
|
return t;
|
|
80
83
|
}
|
|
81
|
-
function
|
|
84
|
+
function g(e, t, n) {
|
|
82
85
|
return e.name.toLowerCase().includes(n) || e.description?.toLowerCase().includes(n) ? !0 : t.toLowerCase().includes(n);
|
|
83
86
|
}
|
|
84
|
-
function
|
|
87
|
+
function _(e, t, n = "") {
|
|
85
88
|
let r = t.trim().toLowerCase();
|
|
86
89
|
if (r === "") return e;
|
|
87
|
-
if (
|
|
90
|
+
if (d(e)) return g(e, n, r) ? e : null;
|
|
88
91
|
let i = e;
|
|
89
92
|
if (i.name.toLowerCase().includes(r)) return e;
|
|
90
93
|
let a = {};
|
|
91
94
|
for (let [e, t] of Object.entries(i.children)) {
|
|
92
|
-
let i =
|
|
95
|
+
let i = _(t, r, n === "" ? e : `${n}.${e}`);
|
|
93
96
|
i && (a[e] = i);
|
|
94
97
|
}
|
|
95
98
|
return Object.keys(a).length === 0 ? null : {
|
|
@@ -99,108 +102,111 @@ function m(e, t, n = "") {
|
|
|
99
102
|
}
|
|
100
103
|
//#endregion
|
|
101
104
|
//#region src/components/Prefs/prefField.tsx
|
|
102
|
-
function
|
|
103
|
-
let { value:
|
|
105
|
+
function v(e, t) {
|
|
106
|
+
let { value: s, mixed: d = !1, unset: f = !1, siblings: p, setValue: m } = t;
|
|
104
107
|
if (e.kind === "font-weight") {
|
|
105
|
-
let e = "fontFamily" in t ? t.fontFamily :
|
|
108
|
+
let e = "fontFamily" in t ? t.fontFamily : p?.fontFamily;
|
|
106
109
|
return {
|
|
107
110
|
kind: "font-weight",
|
|
108
|
-
value: typeof
|
|
109
|
-
mixed:
|
|
110
|
-
unset:
|
|
111
|
-
onChange:
|
|
111
|
+
value: typeof s == "number" || typeof s == "string" ? o(s) : void 0,
|
|
112
|
+
mixed: d,
|
|
113
|
+
unset: f,
|
|
114
|
+
onChange: m,
|
|
112
115
|
family: typeof e == "string" ? e : void 0
|
|
113
116
|
};
|
|
114
117
|
}
|
|
115
118
|
if (e.kind === "font-family") {
|
|
116
|
-
let e = t.fontVariant ? t.fontVariant.weight :
|
|
119
|
+
let e = t.fontVariant ? t.fontVariant.weight : p?.fontWeight, n = t.fontVariant ? t.fontVariant.style : p?.fontStyle;
|
|
117
120
|
return {
|
|
118
121
|
kind: "font-family",
|
|
119
|
-
value: typeof
|
|
120
|
-
mixed:
|
|
121
|
-
unset:
|
|
122
|
-
onChange:
|
|
122
|
+
value: typeof s == "string" ? s : void 0,
|
|
123
|
+
mixed: d,
|
|
124
|
+
unset: f,
|
|
125
|
+
onChange: m,
|
|
123
126
|
weight: typeof e == "number" ? e : void 0,
|
|
124
127
|
fontStyle: n === "italic" ? "italic" : void 0
|
|
125
128
|
};
|
|
126
129
|
}
|
|
127
|
-
if (!
|
|
130
|
+
if (!a(e)) return null;
|
|
128
131
|
switch (e.kind) {
|
|
129
132
|
case "boolean": {
|
|
130
|
-
let n = e.encoding ?
|
|
133
|
+
let n = e.encoding ? y(e.encoding, t) : void 0;
|
|
131
134
|
return {
|
|
132
135
|
kind: "boolean",
|
|
133
136
|
control: e.control,
|
|
134
|
-
value: n ? n.value : typeof
|
|
135
|
-
mixed: n ? n.mixed :
|
|
136
|
-
unset:
|
|
137
|
-
glyph:
|
|
138
|
-
|
|
137
|
+
value: n ? n.value : typeof s == "boolean" ? s : void 0,
|
|
138
|
+
mixed: n ? n.mixed : d,
|
|
139
|
+
unset: f,
|
|
140
|
+
glyph: b(e.icon),
|
|
141
|
+
short: e.short,
|
|
142
|
+
onChange: n ? n.write : m
|
|
139
143
|
};
|
|
140
144
|
}
|
|
141
145
|
case "number": {
|
|
142
|
-
let t = e.unit, n =
|
|
146
|
+
let t = e.unit, n = e.endless, a = typeof s == "number" && (Number.isFinite(s) || i(n, s)) ? s : void 0, o = l(e), p = (e) => i(n, e) ? e : Math.min(o.max ?? Infinity, Math.max(o.min ?? -Infinity, e));
|
|
143
147
|
return {
|
|
144
148
|
kind: "number",
|
|
145
149
|
control: e.control,
|
|
146
|
-
value:
|
|
147
|
-
mixed:
|
|
148
|
-
unset:
|
|
149
|
-
min:
|
|
150
|
-
max:
|
|
151
|
-
step:
|
|
150
|
+
value: a === void 0 ? void 0 : t ? t.toDisplay(a) : a,
|
|
151
|
+
mixed: d,
|
|
152
|
+
unset: f,
|
|
153
|
+
min: o.min,
|
|
154
|
+
max: o.max,
|
|
155
|
+
step: o.step,
|
|
152
156
|
unit: t?.suffix,
|
|
153
|
-
accepts: t ?
|
|
154
|
-
display: e.display,
|
|
155
|
-
|
|
157
|
+
accepts: t ? u(t) : void 0,
|
|
158
|
+
display: e.infinity === void 0 ? e.display : c(e.display ?? r(o.step), e.infinity),
|
|
159
|
+
endless: n,
|
|
160
|
+
onChange: (e) => m(t ? t.fromDisplay(p(e)) : p(e))
|
|
156
161
|
};
|
|
157
162
|
}
|
|
158
163
|
case "string": return {
|
|
159
164
|
kind: "string",
|
|
160
165
|
control: e.control,
|
|
161
|
-
value: typeof
|
|
162
|
-
mixed:
|
|
163
|
-
unset:
|
|
164
|
-
onChange:
|
|
166
|
+
value: typeof s == "string" ? s : "",
|
|
167
|
+
mixed: d,
|
|
168
|
+
unset: f,
|
|
169
|
+
onChange: m
|
|
165
170
|
};
|
|
166
171
|
case "enum": {
|
|
167
|
-
let n = e.encoding ?
|
|
172
|
+
let n = e.encoding ? y(e.encoding, t) : void 0, r = n ? n.value : d || f ? void 0 : typeof s == "string" ? s : e.default;
|
|
168
173
|
return {
|
|
169
174
|
kind: "enum",
|
|
170
175
|
control: e.control,
|
|
171
176
|
value: r,
|
|
172
|
-
mixed: n ? n.mixed :
|
|
173
|
-
unset:
|
|
177
|
+
mixed: n ? n.mixed : d,
|
|
178
|
+
unset: f,
|
|
174
179
|
options: e.options.map((e) => ({
|
|
175
180
|
value: e.value,
|
|
176
181
|
label: e.label,
|
|
177
|
-
glyph:
|
|
182
|
+
glyph: b(e.icon),
|
|
183
|
+
short: e.short,
|
|
178
184
|
disabled: e.disabled
|
|
179
185
|
})),
|
|
180
|
-
onChange: n ? n.write :
|
|
181
|
-
onClear: e.clearable ? () =>
|
|
186
|
+
onChange: n ? n.write : m,
|
|
187
|
+
onClear: e.clearable ? () => m(void 0) : void 0
|
|
182
188
|
};
|
|
183
189
|
}
|
|
184
190
|
case "color": return {
|
|
185
191
|
kind: "color",
|
|
186
|
-
value: typeof
|
|
187
|
-
mixed:
|
|
188
|
-
unset:
|
|
192
|
+
value: typeof s == "string" ? s : e.default,
|
|
193
|
+
mixed: d,
|
|
194
|
+
unset: f,
|
|
189
195
|
alpha: e.alpha ? !0 : void 0,
|
|
190
|
-
onChange:
|
|
196
|
+
onChange: m
|
|
191
197
|
};
|
|
192
198
|
case "paint": return {
|
|
193
199
|
kind: "paint",
|
|
194
|
-
value:
|
|
195
|
-
mixed:
|
|
196
|
-
unset:
|
|
197
|
-
onChange:
|
|
200
|
+
value: s === null ? null : n(s) ? s : d ? void 0 : n(e.default) ? e.default : null,
|
|
201
|
+
mixed: d,
|
|
202
|
+
unset: f,
|
|
203
|
+
onChange: m
|
|
198
204
|
};
|
|
199
205
|
case "object": return null;
|
|
200
206
|
default: throw Error(`prefFieldProps: no control for built-in pref kind "${e.kind}"`);
|
|
201
207
|
}
|
|
202
208
|
}
|
|
203
|
-
function
|
|
209
|
+
function y(e, t) {
|
|
204
210
|
let { perNode: n, update: r } = t;
|
|
205
211
|
if (n !== void 0 && n.length > 0 && r !== void 0) {
|
|
206
212
|
let t = n.map((t) => e.read(t.value, t.siblings)), i = t.every((e) => e === t[0]);
|
|
@@ -217,13 +223,13 @@ function g(e, t) {
|
|
|
217
223
|
write: (n) => t.setValue(e.write(n, t.siblings))
|
|
218
224
|
};
|
|
219
225
|
}
|
|
220
|
-
function
|
|
221
|
-
return n && n in e ? /* @__PURE__ */
|
|
226
|
+
function b(n) {
|
|
227
|
+
return n && n in e ? /* @__PURE__ */ s(t, {
|
|
222
228
|
name: n,
|
|
223
229
|
size: 14
|
|
224
230
|
}) : void 0;
|
|
225
231
|
}
|
|
226
232
|
//#endregion
|
|
227
|
-
export {
|
|
233
|
+
export { h as a, l as i, _ as n, f as o, d as r, p as s, v as t };
|
|
228
234
|
|
|
229
|
-
//# sourceMappingURL=prefField-
|
|
235
|
+
//# sourceMappingURL=prefField-DPPbAmRR.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prefField-DPPbAmRR.js","names":["endless","withInfinity","_exhaustive","ICON_PATHS","isPaint","endlessAllows","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","family","siblings","value","numericWeight","setValue","weight","style","isBuiltinToolPref","coded","throughEncoding","mixed","glyphOf","endless$1","stored","bounds","clamp","endless","stepDisplay","shown","option","unset","o","perNode","update","reads","encoding","agree","r","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, numericWeight, type FillStyle } from '@weasel-js/core';\nimport { endless as withInfinity } from '@weasel-js/quantity';\nimport { endlessAllows } from '../../endless';\nimport { stepDisplay } from '../Properties/NumberControls';\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 /**\n * Each selected node's stored value with its own `siblings`. Given with\n * `update`, an `encoding` reads and writes every node against its own object\n * — which a selection whose objects differ needs, having no one `siblings`.\n */\n perNode?: readonly { value: unknown; siblings: Record<string, unknown> | undefined }[];\n /** Writes each node a value derived from its own `siblings`. */\n update?: (fn: (prev: unknown, siblings?: Record<string, unknown>) => 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 /** A font weight's family, where it is not `siblings`' own `fontFamily`. */\n fontFamily?: 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-weight') {\n const family = 'fontFamily' in state ? state.fontFamily : siblings?.fontFamily;\n return {\n kind: 'font-weight',\n value: typeof value === 'number' || typeof value === 'string' ? numericWeight(value) : undefined,\n mixed,\n unset,\n onChange: setValue,\n family: typeof family === 'string' ? family : undefined,\n };\n }\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 coded = leaf.encoding ? throughEncoding(leaf.encoding, state) : undefined;\n return {\n kind: 'boolean',\n control: leaf.control,\n value: coded ? coded.value : typeof value === 'boolean' ? value : undefined,\n mixed: coded ? coded.mixed : mixed,\n unset,\n glyph: glyphOf(leaf.icon),\n short: leaf.short,\n onChange: coded ? coded.write : setValue,\n };\n }\n case 'number': {\n const unit = leaf.unit;\n // ±Infinity is a value only where an end of the leaf stands for it.\n const endless = leaf.endless;\n const stored =\n typeof value === 'number' && (Number.isFinite(value) || endlessAllows(endless, 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 endlessAllows(endless, n)\n ? n\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:\n leaf.infinity === undefined ? leaf.display : withInfinity(leaf.display ?? stepDisplay(bounds.step), leaf.infinity),\n endless,\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 // 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 coded = leaf.encoding ? throughEncoding(leaf.encoding, state) : undefined;\n const option = coded\n ? coded.value\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: coded ? coded.mixed : mixed,\n unset,\n options: leaf.options.map((o) => ({\n value: o.value,\n label: o.label,\n glyph: glyphOf(o.icon),\n short: o.short,\n disabled: o.disabled,\n })),\n onChange: coded ? coded.write : setValue,\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/**\n * An encoded leaf's shown value and its writer. Across nodes whose objects\n * differ, each node is read against its own object and the option is shown\n * only where every node reads the same one; a write lands in each node\n * computed from that node's object.\n */\nfunction throughEncoding<T>(\n encoding: {\n read: (stored: unknown, siblings: Record<string, unknown> | undefined) => T | undefined;\n write: (option: T, siblings: Record<string, unknown> | undefined) => unknown;\n },\n state: PrefFieldState,\n): { value: T | undefined; mixed: boolean; write: (option: T) => void } {\n const { perNode, update } = state;\n if (perNode !== undefined && perNode.length > 0 && update !== undefined) {\n const reads = perNode.map((n) => encoding.read(n.value, n.siblings));\n const agree = reads.every((r) => r === reads[0]);\n return {\n value: agree ? reads[0] : undefined,\n mixed: !agree,\n write: (option) => update((_prev, siblings) => encoding.write(option, siblings)),\n };\n }\n const mixed = state.mixed === true;\n return {\n value: mixed ? undefined : encoding.read(state.value, state.siblings),\n mixed,\n write: (option) => state.setValue(encoding.write(option, state.siblings)),\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,SAAgBM,EACd,GAC8C;CAC9C,IAAI,CAACC,EAAE,MAAM,OAAO;EAAE,KAAKA,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AAE,OAAOA,EAAE,QAAQ,CAAC,GAC7DyC,IAAQF,EAAM,OAAO,MAAMG,MAAMH,EAAM,EAAE;EAC/C,OAAO;GACL,OAAOE,IAAQF,EAAM,KAAK,KAAA;GAC1B,OAAO,CAACE;GACR,QAAQ,MAAWH,GAAQ,GAAO,MAAaE,EAAS,MAAMN,GAAQlB,CAAQ,CAAC;EACjF;CACF;CACA,IAAMS,IAAQZ,EAAM,UAAU;CAC9B,OAAO;EACL,OAAOY,IAAQ,KAAA,IAAYe,EAAS,KAAK3B,EAAM,OAAOA,EAAM,QAAQ;EACpE;EACA,QAAQ,MAAWA,EAAM,SAAS2B,EAAS,MAAMN,GAAQrB,EAAM,QAAQ,CAAC;CAC1E;AACF;AAGA,SAASa,EAAQ,GAAqC;CACpD,OAAOiB,KAAQA,KAAQtE,IAAa,kBAACuE,GAAD;EAAM,MAAMD;EAAkB,MAAM;CAAK,CAAA,IAAI,KAAA;AACnF"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as e, r as t } from "./Tooltip-
|
|
1
|
+
import { n as e, r as t } from "./Tooltip-DljsPEQG.js";
|
|
2
2
|
import { jsx as n, jsxs as r } from "react/jsx-runtime";
|
|
3
3
|
import { Focusable as i } from "react-aria-components";
|
|
4
4
|
//#region src/components/segmentTooltip.tsx
|
|
@@ -26,4 +26,4 @@ function s({ content: i, disabled: a, children: o }) {
|
|
|
26
26
|
//#endregion
|
|
27
27
|
export { s as n, a as r, o as t };
|
|
28
28
|
|
|
29
|
-
//# sourceMappingURL=segmentTooltip-
|
|
29
|
+
//# sourceMappingURL=segmentTooltip-8VBPNgEc.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"segmentTooltip-
|
|
1
|
+
{"version":3,"file":"segmentTooltip-8VBPNgEc.js","names":["TooltipTrigger","Tooltip","Tooltip$1","TooltipTrigger$1","segmentTooltipContent","item","name","SegmentTooltip","content","children","disabled","Focusable","TriggerTooltip"],"sources":["../../src/components/segmentTooltip.tsx"],"sourcesContent":["import type { DOMAttributes, ReactElement, ReactNode } from 'react';\nimport { Focusable } from 'react-aria-components';\nimport { Tooltip, TooltipTrigger } from './Tooltip';\n\n/** The tooltip fields a segmented bar's item carries. */\nexport interface SegmentTooltipFields {\n /** Tooltip content. Overrides the name-plus-`shortcut` default. */\n tooltip?: ReactNode;\n /** Shortcut hint shown in the tooltip as `Name (⌘Z)`, the way `ToolButton`\n * and `ActionBar` show theirs. The name is `ariaLabel`, else a string\n * `label`. */\n shortcut?: string;\n}\n\n/** Tooltip content for an item, or `undefined` for none. */\nexport function segmentTooltipContent(\n item: SegmentTooltipFields & { label?: ReactNode; ariaLabel?: string },\n): ReactNode | undefined {\n if (item.tooltip !== undefined) return item.tooltip;\n if (!item.shortcut) return undefined;\n const name = item.ariaLabel ?? (typeof item.label === 'string' ? item.label : undefined);\n return name ? `${name} (${item.shortcut})` : item.shortcut;\n}\n\n/** Wraps a segment's `<button>` in a kit tooltip when there is content for one. */\nexport function SegmentTooltip({ content, disabled, children }: {\n content: ReactNode | undefined;\n disabled?: boolean;\n children: ReactElement<DOMAttributes<HTMLButtonElement>, 'button'>;\n}): ReactElement {\n if (content === undefined || content === null || content === false) return children;\n return (\n <TooltipTrigger isDisabled={disabled}>\n <Focusable isDisabled={disabled}>{children}</Focusable>\n <Tooltip>{content}</Tooltip>\n </TooltipTrigger>\n );\n}\n\n/** {@link SegmentTooltip} for a React Aria trigger (`Button` inside a\n * `MenuTrigger` or `Select`), which takes the tooltip's hover and focus props\n * itself and so needs no `Focusable` around it. */\nexport function TriggerTooltip({ content, disabled, children }: {\n content: ReactNode | undefined;\n disabled?: boolean;\n children: ReactElement;\n}): ReactElement {\n if (content === undefined || content === null || content === false) return children;\n return (\n <TooltipTrigger isDisabled={disabled}>\n {children}\n <Tooltip>{content}</Tooltip>\n </TooltipTrigger>\n );\n}\n"],"mappings":";;;;AAeA,SAAgBI,EACd,GACuB;CACvB,IAAIC,EAAK,YAAY,KAAA,GAAW,OAAOA,EAAK;CAC5C,IAAI,CAACA,EAAK,UAAU;CACpB,IAAMC,IAAOD,EAAK,cAAc,OAAOA,EAAK,SAAU,WAAWA,EAAK,QAAQ,KAAA;CAC9E,OAAOC,IAAO,GAAGA,EAAK,IAAID,EAAK,SAAS,KAAKA,EAAK;AACpD;AAGA,SAAgBE,EAAe,EAAE,YAAS,aAAU,eAInC;CAEf,OADIC,KAAqC,QAAQA,MAAY,KAAcC,IAEzE,kBAACT,GAAD;EAAgB,YAAYU;EAA5B,UAAA,CACE,kBAACC,GAAD;GAAW,YAAYD;GAAW;EAAoB,CAAA,GACtD,kBAACT,GAAD,EAAA,UAAUO,EAAiB,CAAA,CACb;;AAEpB;AAKA,SAAgBI,EAAe,EAAE,YAAS,aAAU,eAInC;CAEf,OADIJ,KAAqC,QAAQA,MAAY,KAAcC,IAEzE,kBAACT,GAAD;EAAgB,YAAYU;EAA5B,UAAA,CACGD,GACD,kBAACR,GAAD,EAAA,UAAUO,EAAiB,CAAA,CACb;;AAEpB"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
var e = {
|
|
2
|
+
root: "_root_3zw9r_10",
|
|
3
|
+
segment: "_segment_3zw9r_34",
|
|
4
|
+
segmentSelected: "_segmentSelected_3zw9r_88",
|
|
5
|
+
size_sm: "_size_sm_3zw9r_148",
|
|
6
|
+
variant_minimal: "_variant_minimal_3zw9r_166"
|
|
7
|
+
};
|
|
8
|
+
//#endregion
|
|
9
|
+
export { e as t };
|
|
10
|
+
|
|
11
|
+
//# sourceMappingURL=segmentedControl.module-62qjNWJk.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"segmentedControl.module-
|
|
1
|
+
{"version":3,"file":"segmentedControl.module-62qjNWJk.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 /* The track clips, so without this a squeezing row shrinks it to nothing. */\n min-width: max-content;\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 /* Equal widths when there is room, never narrower than the label. The\n segment clips its gloss, which otherwise drops its flex minimum to 0. */\n min-width: max-content;\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/* 8px around a 14px glyph is most of a segment. */\n.segment:has(> svg) {\n padding: 0 5px;\n}\n\n.segment:first-of-type {\n border-radius: var(--wzl-radius-pill) 0 0 var(--wzl-radius-pill);\n}\n\n.segment:last-of-type {\n border-radius: 0 var(--wzl-radius-pill) var(--wzl-radius-pill) 0;\n}\n\n.segment:only-of-type {\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 --wzl-fg-muted: var(--wzl-fg-muted-on-accent);\n --wzl-fg-subtle: var(--wzl-fg-subtle-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/* `.size_sm .segment` outranks the glyph rule above on specificity. */\n.size_sm .segment:has(> svg) {\n padding: 0 3px;\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-of-type,\n.variant_minimal .segment:last-of-type,\n.variant_minimal .segment:only-of-type {\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,13 +1,19 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { startThresholdDrag as t, useLatest as n } from "@weasel-js/core";
|
|
1
|
+
import { isInControlWithin as e, startThresholdDrag as t, useLatest as n } from "@weasel-js/core";
|
|
3
2
|
import { useCallback as r, useEffect as i, useRef as a, useState as o } from "react";
|
|
4
3
|
//#region src/useReorderDragList.ts
|
|
5
|
-
|
|
4
|
+
function s(e) {
|
|
5
|
+
return {
|
|
6
|
+
shift: e.shiftKey,
|
|
7
|
+
meta: e.metaKey,
|
|
8
|
+
ctrl: e.ctrlKey
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
var c = {
|
|
6
12
|
draggedIds: null,
|
|
7
13
|
targetIndex: null,
|
|
8
14
|
ghost: null
|
|
9
15
|
};
|
|
10
|
-
function
|
|
16
|
+
function l(e, t) {
|
|
11
17
|
let n = 0;
|
|
12
18
|
for (let r = t - 1; r >= 0; r--) if (e[r]?.locked) {
|
|
13
19
|
n = r + 1;
|
|
@@ -20,14 +26,14 @@ function c(e, t) {
|
|
|
20
26
|
}
|
|
21
27
|
return [n, r];
|
|
22
28
|
}
|
|
23
|
-
function
|
|
24
|
-
let [i, a] =
|
|
29
|
+
function u(e, t, n, r) {
|
|
30
|
+
let [i, a] = l(e, r);
|
|
25
31
|
return (t.includes(n) ? [...t] : [n]).filter((t) => {
|
|
26
32
|
let n = e.findIndex((e) => e.id === t);
|
|
27
33
|
return n >= i && n < a;
|
|
28
34
|
});
|
|
29
35
|
}
|
|
30
|
-
function
|
|
36
|
+
function d(e, t, n) {
|
|
31
37
|
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
38
|
if (t === 0) return !0;
|
|
33
39
|
let n = r[t - 1];
|
|
@@ -35,27 +41,29 @@ function u(e, t, n) {
|
|
|
35
41
|
}), a = r[0], o = r[r.length - 1];
|
|
36
42
|
return i && a !== void 0 && o !== void 0 && n >= a && n <= o + 1;
|
|
37
43
|
}
|
|
38
|
-
function
|
|
39
|
-
let
|
|
44
|
+
function f(s) {
|
|
45
|
+
let f = n(s), m = a(null), h = a(null), [g, _] = o(c);
|
|
40
46
|
i(() => () => {
|
|
41
47
|
h.current?.cancel();
|
|
42
48
|
}, []);
|
|
43
49
|
let v = r((e, t) => {
|
|
44
|
-
let [n, r] =
|
|
50
|
+
let [n, r] = l(f.current.items, t), i = m.current;
|
|
45
51
|
if (!i) return n;
|
|
46
|
-
let a =
|
|
52
|
+
let a = f.current.rowSelector, o = a ? Array.from(i.children).filter((e) => e.matches(a)) : Array.from(i.children), s = o.length;
|
|
47
53
|
for (let t = 0; t < o.length; t++) {
|
|
48
54
|
let n = o[t];
|
|
49
|
-
if (n
|
|
55
|
+
if (!n) continue;
|
|
56
|
+
let r = n.getBoundingClientRect();
|
|
57
|
+
if (e < r.top + r.height / 2) {
|
|
50
58
|
s = t;
|
|
51
59
|
break;
|
|
52
60
|
}
|
|
53
61
|
}
|
|
54
62
|
return Math.max(n, Math.min(s, r));
|
|
55
|
-
}, [
|
|
63
|
+
}, [f]), y = r((e) => {
|
|
56
64
|
m.current = e;
|
|
57
65
|
}, []), b = r(() => {
|
|
58
|
-
h.current = null, _(
|
|
66
|
+
h.current = null, _(c);
|
|
59
67
|
}, []), x = r((n, r, i) => {
|
|
60
68
|
let a = m.current;
|
|
61
69
|
if (!a || h.current || e(i.target, i.currentTarget)) return;
|
|
@@ -64,7 +72,7 @@ function d(d) {
|
|
|
64
72
|
ctrlKey: i.ctrlKey,
|
|
65
73
|
metaKey: i.metaKey,
|
|
66
74
|
altKey: i.altKey
|
|
67
|
-
}, s = [], c = 0,
|
|
75
|
+
}, s = [], c = 0, l = i.currentTarget, g = (Array.from(a.children).find((e) => e.contains(l)) ?? l).getBoundingClientRect(), y = {
|
|
68
76
|
x: i.clientX - g.left,
|
|
69
77
|
y: i.clientY - g.top
|
|
70
78
|
}, x = (e) => ({
|
|
@@ -75,9 +83,9 @@ function d(d) {
|
|
|
75
83
|
});
|
|
76
84
|
h.current = t(i, {
|
|
77
85
|
origin: a,
|
|
78
|
-
threshold:
|
|
86
|
+
threshold: f.current.items[r]?.locked ? Infinity : f.current.threshold,
|
|
79
87
|
onActivate: (e) => {
|
|
80
|
-
s =
|
|
88
|
+
s = u(f.current.items, f.current.selectedIds, n, r), c = v(e.clientY, r), _({
|
|
81
89
|
draggedIds: s,
|
|
82
90
|
targetIndex: c,
|
|
83
91
|
ghost: x(e)
|
|
@@ -92,34 +100,34 @@ function d(d) {
|
|
|
92
100
|
},
|
|
93
101
|
onCommit: (e) => {
|
|
94
102
|
let t = v(e.clientY, r);
|
|
95
|
-
|
|
103
|
+
d(f.current.items, s, t) || f.current.onReorder(s, t), b();
|
|
96
104
|
},
|
|
97
105
|
onClick: () => {
|
|
98
|
-
let { onPress: e } =
|
|
99
|
-
e && (e(n, o),
|
|
106
|
+
let { onPress: e } = f.current;
|
|
107
|
+
e && (e(n, o), p(a)), b();
|
|
100
108
|
},
|
|
101
109
|
onCancel: b
|
|
102
110
|
});
|
|
103
111
|
}, [
|
|
104
112
|
v,
|
|
105
113
|
b,
|
|
106
|
-
|
|
114
|
+
f
|
|
107
115
|
]);
|
|
108
116
|
return {
|
|
109
117
|
nudge: r((e, t, n) => {
|
|
110
|
-
let { items: r, selectedIds: i, onReorder: a } =
|
|
118
|
+
let { items: r, selectedIds: i, onReorder: a } = f.current;
|
|
111
119
|
if (r[t]?.locked) return !1;
|
|
112
|
-
let o =
|
|
113
|
-
if (
|
|
114
|
-
let [m, h] =
|
|
115
|
-
return g < m || g > h ||
|
|
116
|
-
}, [
|
|
120
|
+
let o = u(r, i, e, t), s = o.map((e) => r.findIndex((t) => t.id === e)).sort((e, t) => e - t), c = s[0], p = s[s.length - 1];
|
|
121
|
+
if (c === void 0 || p === void 0) return !1;
|
|
122
|
+
let [m, h] = l(r, t), g = n < 0 ? c - 1 : p + 2;
|
|
123
|
+
return g < m || g > h || d(r, o, g) ? !1 : (a(o, g), !0);
|
|
124
|
+
}, [f]),
|
|
117
125
|
rowProps: (e, t) => ({ onPointerDown: (n) => x(e, t, n) }),
|
|
118
126
|
containerProps: { ref: y },
|
|
119
127
|
state: g
|
|
120
128
|
};
|
|
121
129
|
}
|
|
122
|
-
function
|
|
130
|
+
function p(e) {
|
|
123
131
|
let t = (e) => {
|
|
124
132
|
e.stopPropagation();
|
|
125
133
|
};
|
|
@@ -128,6 +136,6 @@ function f(e) {
|
|
|
128
136
|
}, 0);
|
|
129
137
|
}
|
|
130
138
|
//#endregion
|
|
131
|
-
export {
|
|
139
|
+
export { f as n, s as t };
|
|
132
140
|
|
|
133
|
-
//# sourceMappingURL=useReorderDragList-
|
|
141
|
+
//# sourceMappingURL=useReorderDragList-DnqqvRGK.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useReorderDragList-DnqqvRGK.js","names":["selectModifiers","mods","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","useLatest","opts","containerRef","useRef","dragRef","state","setState","useState","computeTargetIndex","useCallback","c","sel","rows","el","raw","row","clientY","refCb","reset","onPointerDownRow","container","isInControlWithin","e","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 { isInControlWithin, startThresholdDrag, useLatest, type ThresholdDragHandle } from '@weasel-js/core';\nimport type { SelectModifiers } from '@weasel-js/select';\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/** A press's modifiers as `@weasel-js/select` reads them. */\nexport function selectModifiers(mods: PressModifiers): SelectModifiers {\n return { shift: mods.shiftKey, meta: mods.metaKey, ctrl: mods.ctrlKey };\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 = useLatest(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.top + r.height / 2) { raw = i; break; }\n }\n return Math.max(lo, Math.min(raw, hi));\n }, [optsRef]);\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, optsRef]);\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 }, [optsRef]);\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":";;;AA8CA,SAAgBA,EAAgB,GAAuC;CACrE,OAAO;EAAE,OAAOC,EAAK;EAAU,MAAMA,EAAK;EAAS,MAAMA,EAAK;CAAQ;AACxE;AAyBA,IAAMC,IAAyB;CAAE,YAAY;CAAM,aAAa;CAAM,OAAO;AAAK;AA4BlF,SAASC,EAAgB,GAA+B,GAAuC;CAC7F,IAAIC,IAAK;CACT,KAAK,IAAIC,IAAIC,IAAc,GAAGD,KAAK,GAAG,KACpC,IAAIE,EAAMF,EAAE,EAAE,QAAQ;EAAE,IAAKA,IAAI;EAAG;CAAO;CAE7C,IAAIG,IAAKD,EAAM;CACf,KAAK,IAAIF,IAAIC,IAAc,GAAGD,IAAIE,EAAM,QAA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AMnD,EAAcF,GAAOI,GAAaC,GAAIF,CAAK,GACjDmD,IAAKD,EAAI,KAAK,MAAMrD,EAAM,WAAW,MAAOM,EAAG,OAAOC,CAAC,CAAC,CAAC,CAAC,MAAM,GAAG,MAAMI,IAAIC,CAAC,GAC9EI,IAAQsC,EAAG,IACXrC,IAAOqC,EAAGA,EAAG,SAAS;GAC5B,IAAItC,MAAU,KAAA,KAAaC,MAAS,KAAA,GAAW,OAAO;GACtD,IAAM,CAACpB,GAAII,KAAML,EAAgBI,GAAOG,CAAK,GACvCoD,IAASC,IAAQ,IAAIxC,IAAQ,IAAIC,IAAO;GAG9C,OAFIsC,IAAS1D,KAAM0D,IAAStD,KAAMO,EAAWR,GAAOqD,GAAKE,CAAM,IAAU,MACzEE,EAAUJ,GAAKE,CAAM,GACd;EACT,GAAG,CAACnC,CAAO,CAGT;EACA,WAAW,GAAI,OAAW,EACxB,gBAAgB,MAAMoB,EAAiBnC,GAAIF,GAAOwC,CAAC,EACrD;EACA,gBAAgB,EACd,KAAKL,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,2 +1,2 @@
|
|
|
1
|
-
import { t as e } from "../../chunks/ActionBar-
|
|
1
|
+
import { t as e } from "../../chunks/ActionBar-CfXS7-9f.js";
|
|
2
2
|
export { e as ActionBar };
|
|
@@ -2,4 +2,5 @@ export { Badge } from './Badge';
|
|
|
2
2
|
export type { BadgeProps } from './Badge';
|
|
3
3
|
export type { BadgeShape, BadgeStatus, BadgeVariant, BadgeSize } from './types';
|
|
4
4
|
export { BADGE_STATUS_ICONS } from './statusIcons';
|
|
5
|
+
export { BADGE_VARIANT_ICONS } from './variantIcons';
|
|
5
6
|
//# sourceMappingURL=index.d.ts.map
|