@jimka/typescript-ui 0.6.0 → 0.8.0
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/lib/AbstractInput-Dt9ooHjo.js +2 -0
- package/dist/lib/AbstractInput-Dt9ooHjo.js.map +1 -0
- package/dist/lib/AccordionConstraints-DahZEfEp.js +2 -0
- package/dist/lib/AccordionConstraints-DahZEfEp.js.map +1 -0
- package/dist/lib/{Anchor-CwRhdP2J.js → Anchor-DdYgyn2V.js} +2 -2
- package/dist/lib/{Anchor-CwRhdP2J.js.map → Anchor-DdYgyn2V.js.map} +1 -1
- package/dist/lib/AnimatedDropdown-_KhHzX5D.js +2 -0
- package/dist/lib/AnimatedDropdown-_KhHzX5D.js.map +1 -0
- package/dist/lib/Border-BELbqMDJ.js +2 -0
- package/dist/lib/Border-BELbqMDJ.js.map +1 -0
- package/dist/lib/Button-CKzjQyqA.js +2 -0
- package/dist/lib/Button-CKzjQyqA.js.map +1 -0
- package/dist/lib/{Card-QYo27r5b.js → Card-CAp7LcB5.js} +2 -2
- package/dist/lib/{Card-QYo27r5b.js.map → Card-CAp7LcB5.js.map} +1 -1
- package/dist/lib/Checkbox-CvAZJ4_T.js +2 -0
- package/dist/lib/Checkbox-CvAZJ4_T.js.map +1 -0
- package/dist/lib/CodeEditor-DoGGdL1Y.js +2 -0
- package/dist/lib/CodeEditor-DoGGdL1Y.js.map +1 -0
- package/dist/lib/ComboBox-DgjMnpdh.js +2 -0
- package/dist/lib/ComboBox-DgjMnpdh.js.map +1 -0
- package/dist/lib/Component-YrLXKJZS.js +2 -0
- package/dist/lib/Component-YrLXKJZS.js.map +1 -0
- package/dist/lib/Container-C5cxnioS.js +2 -0
- package/dist/lib/{Container-abY5Ww3W.js.map → Container-C5cxnioS.js.map} +1 -1
- package/dist/lib/DOM-DDhDN8lQ.js +2 -0
- package/dist/lib/DOM-DDhDN8lQ.js.map +1 -0
- package/dist/lib/Diagnostics-MI6Yw-3E.js +2 -0
- package/dist/lib/Diagnostics-MI6Yw-3E.js.map +1 -0
- package/dist/lib/Dialog-CXQXRQQK.js +2 -0
- package/dist/lib/Dialog-CXQXRQQK.js.map +1 -0
- package/dist/lib/DragManager-D5pBaPPg.js +2 -0
- package/dist/lib/DragManager-D5pBaPPg.js.map +1 -0
- package/dist/lib/{FieldDecorator-BlYMfZ9L.js → FieldDecorator-37IgKHHm.js} +2 -2
- package/dist/lib/{FieldDecorator-BlYMfZ9L.js.map → FieldDecorator-37IgKHHm.js.map} +1 -1
- package/dist/lib/{Fit-BhlB-HAo.js → Fit-amTWlJM2.js} +2 -2
- package/dist/lib/{Fit-BhlB-HAo.js.map → Fit-amTWlJM2.js.map} +1 -1
- package/dist/lib/{FloatingPanel-DkJXsZ2D.js → FloatingPanel-CwsFPYbc.js} +2 -2
- package/dist/lib/{FloatingPanel-DkJXsZ2D.js.map → FloatingPanel-CwsFPYbc.js.map} +1 -1
- package/dist/lib/Glyph-Cof7BxfJ.js +2 -0
- package/dist/lib/Glyph-Cof7BxfJ.js.map +1 -0
- package/dist/lib/{Grid-Daiz7F5d.js → Grid-BQZ4UIUH.js} +2 -2
- package/dist/lib/{Grid-Daiz7F5d.js.map → Grid-BQZ4UIUH.js.map} +1 -1
- package/dist/lib/GridConstraints-BkXa62z0.js +2 -0
- package/dist/lib/GridConstraints-BkXa62z0.js.map +1 -0
- package/dist/lib/{Header-Dql3Zxc6.js → Header-Cj33ABP1.js} +2 -2
- package/dist/lib/{Header-Dql3Zxc6.js.map → Header-Cj33ABP1.js.map} +1 -1
- package/dist/lib/{IconText-PUjhTLlp.js → IconText-Dp64iq_q.js} +2 -2
- package/dist/lib/{IconText-PUjhTLlp.js.map → IconText-Dp64iq_q.js.map} +1 -1
- package/dist/lib/LabeledGrid-Dpelrc1k.js +2 -0
- package/dist/lib/LabeledGrid-Dpelrc1k.js.map +1 -0
- package/dist/lib/LayoutSerialization-DgLJSuew.js +2 -0
- package/dist/lib/LayoutSerialization-DgLJSuew.js.map +1 -0
- package/dist/lib/Link-DE8tE3u3.js +2 -0
- package/dist/lib/Link-DE8tE3u3.js.map +1 -0
- package/dist/lib/List-TfgHScl3.js +2 -0
- package/dist/lib/List-TfgHScl3.js.map +1 -0
- package/dist/lib/ListenerBag-DYRl4TSb.js +2 -0
- package/dist/lib/ListenerBag-DYRl4TSb.js.map +1 -0
- package/dist/lib/{MemoryStore-DhPoU-7X.js → MemoryStore-ByGDEKYI.js} +2 -2
- package/dist/lib/{MemoryStore-DhPoU-7X.js.map → MemoryStore-ByGDEKYI.js.map} +1 -1
- package/dist/lib/Menu-BCQISKiQ.js +2 -0
- package/dist/lib/Menu-BCQISKiQ.js.map +1 -0
- package/dist/lib/{MenuButton-DCXi0tsP.js → MenuButton-BO4y3jf2.js} +2 -2
- package/dist/lib/{MenuButton-DCXi0tsP.js.map → MenuButton-BO4y3jf2.js.map} +1 -1
- package/dist/lib/{OverlayFade-3pof2AJH.js → OverlayFade-C1yQKffL.js} +2 -2
- package/dist/lib/{OverlayFade-3pof2AJH.js.map → OverlayFade-C1yQKffL.js.map} +1 -1
- package/dist/lib/{Panel-Cy1pdlWO.js → Panel-DlsVVuvn.js} +2 -2
- package/dist/lib/{Panel-Cy1pdlWO.js.map → Panel-DlsVVuvn.js.map} +1 -1
- package/dist/lib/{Position-BwtxouxK.js → Position-DWR1nIpA.js} +2 -2
- package/dist/lib/Position-DWR1nIpA.js.map +1 -0
- package/dist/lib/ProgressSpinner-BI9tFIVm.js +2 -0
- package/dist/lib/ProgressSpinner-BI9tFIVm.js.map +1 -0
- package/dist/lib/RadioButton-BxcuFChp.js +2 -0
- package/dist/lib/RadioButton-BxcuFChp.js.map +1 -0
- package/dist/lib/RadioMenuRow-B2bthoxj.js +2 -0
- package/dist/lib/RadioMenuRow-B2bthoxj.js.map +1 -0
- package/dist/lib/{RovingTabIndex-pHEv5oLD.js → RovingTabIndex-BttlsARv.js} +2 -2
- package/dist/lib/{RovingTabIndex-pHEv5oLD.js.map → RovingTabIndex-BttlsARv.js.map} +1 -1
- package/dist/lib/Scrollbar-orAWHWap.js +2 -0
- package/dist/lib/Scrollbar-orAWHWap.js.map +1 -0
- package/dist/lib/SelectableText-BbS_lRzY.js +2 -0
- package/dist/lib/SelectableText-BbS_lRzY.js.map +1 -0
- package/dist/lib/Slider-BvXc-cx5.js +2 -0
- package/dist/lib/Slider-BvXc-cx5.js.map +1 -0
- package/dist/lib/Spacer-C6faKe1V.js +2 -0
- package/dist/lib/Spacer-C6faKe1V.js.map +1 -0
- package/dist/lib/StyleTraits-CAtzeyRR.js +2 -0
- package/dist/lib/StyleTraits-CAtzeyRR.js.map +1 -0
- package/dist/lib/TabButton-BQDaBszs.js +2 -0
- package/dist/lib/TabButton-BQDaBszs.js.map +1 -0
- package/dist/lib/TabCloseButton-B-iLVPGZ.js +2 -0
- package/dist/lib/TabCloseButton-B-iLVPGZ.js.map +1 -0
- package/dist/lib/Table-3McEw5gr.js +7 -0
- package/dist/lib/Table-3McEw5gr.js.map +1 -0
- package/dist/lib/Text-CGFXPhHD.js +2 -0
- package/dist/lib/Text-CGFXPhHD.js.map +1 -0
- package/dist/lib/Tooltip-DgRHQZhL.js +3 -0
- package/dist/lib/Tooltip-DgRHQZhL.js.map +1 -0
- package/dist/lib/Tree-Bq2pjjAz.js +2 -0
- package/dist/lib/Tree-Bq2pjjAz.js.map +1 -0
- package/dist/lib/{VBox-DfJPWXqc.js → VBox-hFIZAEpT.js} +2 -2
- package/dist/lib/{VBox-DfJPWXqc.js.map → VBox-hFIZAEpT.js.map} +1 -1
- package/dist/lib/{VirtualScroller-DTIn19o1.js → VirtualScroller-Csa3GBSM.js} +2 -2
- package/dist/lib/{VirtualScroller-DTIn19o1.js.map → VirtualScroller-Csa3GBSM.js.map} +1 -1
- package/dist/lib/Window-CQ14_65z.js +2 -0
- package/dist/lib/Window-CQ14_65z.js.map +1 -0
- package/dist/lib/component/button.es.js +1 -1
- package/dist/lib/component/button.es.js.map +1 -1
- package/dist/lib/component/chart.es.js +1 -1
- package/dist/lib/component/chart.es.js.map +1 -1
- package/dist/lib/component/container.es.js +1 -1
- package/dist/lib/component/container.es.js.map +1 -1
- package/dist/lib/component/diagram.es.js +1 -1
- package/dist/lib/component/diagram.es.js.map +1 -1
- package/dist/lib/component/display.es.js +1 -1
- package/dist/lib/component/display.es.js.map +1 -1
- package/dist/lib/component/editor.es.js +2 -2
- package/dist/lib/component/editor.es.js.map +1 -1
- package/dist/lib/component/input.es.js +1 -1
- package/dist/lib/component/input.es.js.map +1 -1
- package/dist/lib/component/list.es.js +1 -1
- package/dist/lib/component/list.es.js.map +1 -1
- package/dist/lib/component/menubar.es.js +1 -1
- package/dist/lib/component/menubar.es.js.map +1 -1
- package/dist/lib/component/table.es.js +1 -6
- package/dist/lib/component/table.es.js.map +1 -1
- package/dist/lib/component/tree.es.js +1 -1
- package/dist/lib/component/tree.es.js.map +1 -1
- package/dist/lib/core-DpzpKLWE.js +2 -0
- package/dist/lib/core-DpzpKLWE.js.map +1 -0
- package/dist/lib/core.es.js +1 -2
- package/dist/lib/data.es.js +1 -1
- package/dist/lib/diagnostics.es.js +24 -0
- package/dist/lib/diagnostics.es.js.map +1 -0
- package/dist/lib/glyphs/solid/index.es.js +1 -1
- package/dist/lib/layout.es.js +1 -1
- package/dist/lib/layout.es.js.map +1 -1
- package/dist/lib/overlay.es.js +1 -1
- package/dist/lib/overlay.es.js.map +1 -1
- package/dist/lib/primitive-8YvORgGS.js +2 -0
- package/dist/lib/primitive-8YvORgGS.js.map +1 -0
- package/dist/lib/primitive.es.js +1 -2
- package/dist/lib/router.es.js +1 -1
- package/dist/lib/selectionsEqual-DWdW5pxP.js +2 -0
- package/dist/lib/{selectionsEqual-gMG7gCVI.js.map → selectionsEqual-DWdW5pxP.js.map} +1 -1
- package/dist/lib/types/component/button/Button.d.ts +7 -6
- package/dist/lib/types/component/button/TabButton.d.ts +3 -0
- package/dist/lib/types/component/button/TabCloseButton.d.ts +3 -0
- package/dist/lib/types/component/button/ToggleButton.d.ts +2 -2
- package/dist/lib/types/component/chart/AbstractChart.d.ts +2 -0
- package/dist/lib/types/component/container/AccordionHeader.d.ts +6 -1
- package/dist/lib/types/component/container/AccordionIndicator.d.ts +2 -0
- package/dist/lib/types/component/container/FieldSet.d.ts +2 -0
- package/dist/lib/types/component/container/LabeledFieldSet.d.ts +1 -1
- package/dist/lib/types/component/container/LabeledGrid.d.ts +4 -1
- package/dist/lib/types/component/container/Legend.d.ts +2 -2
- package/dist/lib/types/component/container/MenuItem.d.ts +1 -0
- package/dist/lib/types/component/container/WindowBorder.d.ts +2 -2
- package/dist/lib/types/component/container/WindowHeader.d.ts +6 -0
- package/dist/lib/types/component/diagram/DiagramEdgeLayer.d.ts +10 -0
- package/dist/lib/types/component/diagram/DiagramGroupNode.d.ts +2 -0
- package/dist/lib/types/component/diagram/DiagramNode.d.ts +6 -2
- package/dist/lib/types/component/diagram/DiagramNodeLayer.d.ts +25 -0
- package/dist/lib/types/component/diagram/DiagramResidency.d.ts +11 -0
- package/dist/lib/types/component/diagram/DiagramView.d.ts +22 -0
- package/dist/lib/types/component/display/Markdown.d.ts +2 -1
- package/dist/lib/types/component/input/AbstractCalendarDropdown.d.ts +4 -2
- package/dist/lib/types/component/input/AbstractInput.d.ts +1 -0
- package/dist/lib/types/component/input/AbstractPickerField.d.ts +4 -0
- package/dist/lib/types/component/input/AutoCompleteDropdown.d.ts +2 -0
- package/dist/lib/types/component/input/AutoCompleteField.d.ts +1 -0
- package/dist/lib/types/component/input/ComboBox.d.ts +6 -1
- package/dist/lib/types/component/input/Link.d.ts +2 -0
- package/dist/lib/types/component/input/PasswordField.d.ts +2 -0
- package/dist/lib/types/component/input/PickerButton.d.ts +5 -2
- package/dist/lib/types/component/input/PickerInput.d.ts +2 -0
- package/dist/lib/types/component/input/SelectableText.d.ts +11 -0
- package/dist/lib/types/component/input/SpinButton.d.ts +3 -0
- package/dist/lib/types/component/input/Text.d.ts +12 -2
- package/dist/lib/types/component/input/TextArea.d.ts +2 -0
- package/dist/lib/types/component/input/TextField.d.ts +2 -0
- package/dist/lib/types/component/input/TextInput.d.ts +4 -0
- package/dist/lib/types/component/input/TimePickerDropdown.d.ts +3 -1
- package/dist/lib/types/component/input/UsernameField.d.ts +2 -0
- package/dist/lib/types/component/input/index.d.ts +2 -0
- package/dist/lib/types/component/list/AbstractMarkerList.d.ts +2 -0
- package/dist/lib/types/component/list/AbstractSelectableList.d.ts +6 -2
- package/dist/lib/types/component/list/ListItem.d.ts +2 -1
- package/dist/lib/types/component/menubar/MenuBarButton.d.ts +3 -0
- package/dist/lib/types/component/menubar/ToolBar.d.ts +2 -0
- package/dist/lib/types/component/table/Body.d.ts +54 -20
- package/dist/lib/types/component/table/Column.d.ts +2 -0
- package/dist/lib/types/component/table/ColumnConfig.d.ts +1 -0
- package/dist/lib/types/component/table/Footer.d.ts +2 -0
- package/dist/lib/types/component/table/Header.d.ts +8 -1
- package/dist/lib/types/component/table/Row.d.ts +22 -2
- package/dist/lib/types/component/table/Table.d.ts +6 -1
- package/dist/lib/types/component/table/TableExporter.d.ts +3 -0
- package/dist/lib/types/component/table/TablePanel.d.ts +6 -0
- package/dist/lib/types/component/table/TreeTablePanel.d.ts +6 -0
- package/dist/lib/types/component/table/cell/Cell.d.ts +8 -2
- package/dist/lib/types/component/table/cell/Default.d.ts +1 -1
- package/dist/lib/types/component/table/cell/Header.d.ts +4 -0
- package/dist/lib/types/component/table/cell/ParentHeader.d.ts +4 -0
- package/dist/lib/types/component/table/cell/ResizeHandle.d.ts +1 -1
- package/dist/lib/types/component/table/cell/renderer/CellRenderer.d.ts +2 -2
- package/dist/lib/types/component/table/cell/renderer/String.d.ts +3 -1
- package/dist/lib/types/component/table/index.d.ts +1 -1
- package/dist/lib/types/component/tree/TreeRow.d.ts +2 -0
- package/dist/lib/types/core/AnimatedDropdown.d.ts +2 -0
- package/dist/lib/types/core/Binding.d.ts +1 -0
- package/dist/lib/types/core/ClassStyleRules.d.ts +69 -4
- package/dist/lib/types/core/Component.d.ts +69 -14
- package/dist/lib/types/core/DOM.d.ts +11 -1
- package/dist/lib/types/core/Diagnostics.d.ts +22 -0
- package/dist/lib/types/core/Event.d.ts +7 -0
- package/dist/lib/types/core/LayerManager.d.ts +3 -0
- package/dist/lib/types/core/ListenerBag.d.ts +1 -0
- package/dist/lib/types/core/StyleTarget.d.ts +14 -0
- package/dist/lib/types/core/StyleTraits.d.ts +4 -0
- package/dist/lib/types/core/Theme.d.ts +6 -2
- package/dist/lib/types/core/Util.d.ts +4 -0
- package/dist/lib/types/core/index.d.ts +6 -3
- package/dist/lib/types/diagnostics/DiagnosticsOverlay.d.ts +29 -0
- package/dist/lib/types/diagnostics/DiagnosticsSampler.d.ts +61 -0
- package/dist/lib/types/diagnostics/StyleAudit.d.ts +19 -0
- package/dist/lib/types/diagnostics/StyleAuditOverlay.d.ts +12 -0
- package/dist/lib/types/diagnostics/StyleAuditView.d.ts +13 -0
- package/dist/lib/types/diagnostics/index.d.ts +7 -0
- package/dist/lib/types/layout/LayoutManager.d.ts +3 -0
- package/dist/lib/types/layout/Table.d.ts +3 -0
- package/dist/lib/types/overlay/AbstractWindow.d.ts +36 -0
- package/dist/lib/types/overlay/ButtonGroup.d.ts +1 -0
- package/dist/lib/types/overlay/Dialog.d.ts +1 -0
- package/dist/lib/types/overlay/Menu.d.ts +2 -0
- package/dist/lib/types/overlay/Notification.d.ts +0 -1
- package/dist/lib/types/overlay/PopupPanel.d.ts +2 -0
- package/dist/lib/types/overlay/RailHandle.d.ts +4 -5
- package/dist/lib/types/overlay/TabWindow.d.ts +3 -0
- package/dist/lib/types/overlay/Tooltip.d.ts +1 -0
- package/dist/lib/types/overlay/Window.d.ts +4 -1
- package/dist/lib/validation.es.js +1 -1
- package/llms.txt +2 -0
- package/package.json +5 -1
- package/dist/lib/AbstractInput-sRNPzWel.js +0 -2
- package/dist/lib/AbstractInput-sRNPzWel.js.map +0 -1
- package/dist/lib/AnimatedDropdown-H3Rh-YMZ.js +0 -2
- package/dist/lib/AnimatedDropdown-H3Rh-YMZ.js.map +0 -1
- package/dist/lib/Border-0DJFDiij.js +0 -2
- package/dist/lib/Border-0DJFDiij.js.map +0 -1
- package/dist/lib/Button-MpMIYBYJ.js +0 -2
- package/dist/lib/Button-MpMIYBYJ.js.map +0 -1
- package/dist/lib/Checkbox-D0JYK-wc.js +0 -2
- package/dist/lib/Checkbox-D0JYK-wc.js.map +0 -1
- package/dist/lib/CheckboxMenuRow-CesLhSnp.js +0 -2
- package/dist/lib/CheckboxMenuRow-CesLhSnp.js.map +0 -1
- package/dist/lib/CodeEditor-N1FQodcF.js +0 -2
- package/dist/lib/CodeEditor-N1FQodcF.js.map +0 -1
- package/dist/lib/ComboBox-Dx8Tk9yg.js +0 -2
- package/dist/lib/ComboBox-Dx8Tk9yg.js.map +0 -1
- package/dist/lib/Component-B0ShfPVi.js +0 -2
- package/dist/lib/Component-B0ShfPVi.js.map +0 -1
- package/dist/lib/Container-abY5Ww3W.js +0 -2
- package/dist/lib/DOM-C-Edb3tA.js +0 -2
- package/dist/lib/DOM-C-Edb3tA.js.map +0 -1
- package/dist/lib/Dialog-cbA9V17e.js +0 -2
- package/dist/lib/Dialog-cbA9V17e.js.map +0 -1
- package/dist/lib/Glyph-_VeBacS2.js +0 -2
- package/dist/lib/Glyph-_VeBacS2.js.map +0 -1
- package/dist/lib/GridConstraints-C58LuTqM.js +0 -2
- package/dist/lib/GridConstraints-C58LuTqM.js.map +0 -1
- package/dist/lib/LayoutSerialization-CMxunLfV.js +0 -2
- package/dist/lib/LayoutSerialization-CMxunLfV.js.map +0 -1
- package/dist/lib/List-nx8220Fi.js +0 -2
- package/dist/lib/List-nx8220Fi.js.map +0 -1
- package/dist/lib/ListenerBag-WPdKuuds.js +0 -2
- package/dist/lib/ListenerBag-WPdKuuds.js.map +0 -1
- package/dist/lib/Menu-Q0bpXXze.js +0 -2
- package/dist/lib/Menu-Q0bpXXze.js.map +0 -1
- package/dist/lib/Position-BwtxouxK.js.map +0 -1
- package/dist/lib/ProgressSpinner-DK8xEQ9y.js +0 -2
- package/dist/lib/ProgressSpinner-DK8xEQ9y.js.map +0 -1
- package/dist/lib/RadioButton-BEwpqg1k.js +0 -2
- package/dist/lib/RadioButton-BEwpqg1k.js.map +0 -1
- package/dist/lib/RadioMenuRow-DP5qPyFR.js +0 -2
- package/dist/lib/RadioMenuRow-DP5qPyFR.js.map +0 -1
- package/dist/lib/Scrollbar-t8fFrUVQ.js +0 -2
- package/dist/lib/Scrollbar-t8fFrUVQ.js.map +0 -1
- package/dist/lib/Slider-CTbwR6HR.js +0 -2
- package/dist/lib/Slider-CTbwR6HR.js.map +0 -1
- package/dist/lib/Spacer-srdN2d2b.js +0 -2
- package/dist/lib/Spacer-srdN2d2b.js.map +0 -1
- package/dist/lib/TabButton-DLoMQzky.js +0 -2
- package/dist/lib/TabButton-DLoMQzky.js.map +0 -1
- package/dist/lib/TabCloseButton-CY7BGitY.js +0 -2
- package/dist/lib/TabCloseButton-CY7BGitY.js.map +0 -1
- package/dist/lib/Text-CMKnK9uB.js +0 -2
- package/dist/lib/Text-CMKnK9uB.js.map +0 -1
- package/dist/lib/Tooltip-CUOJOqQi.js +0 -3
- package/dist/lib/Tooltip-CUOJOqQi.js.map +0 -1
- package/dist/lib/Tree-C64JNPWJ.js +0 -2
- package/dist/lib/Tree-C64JNPWJ.js.map +0 -1
- package/dist/lib/core.es.js.map +0 -1
- package/dist/lib/primitive.es.js.map +0 -1
- package/dist/lib/selectionsEqual-gMG7gCVI.js +0 -2
- package/dist/lib/types/component/table/CellGeometry.d.ts +0 -6
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Position-BwtxouxK.js","names":[],"sources":["../../src/typescript/lib/core/Util.ts","../../src/typescript/lib/core/BaseObject.ts","../../src/typescript/lib/primitive/Size.ts","../../src/typescript/lib/primitive/Border.ts","../../src/typescript/lib/primitive/Insets.ts","../../src/typescript/lib/primitive/Position.ts"],"sourcesContent":["// SPDX-License-Identifier: PolyForm-Noncommercial-1.0.0\n\nimport { Size } from \"~/primitive/Size.js\";\nimport type { Insets } from \"~/primitive/Insets.js\";\nimport { DOM } from \"~/core/DOM.js\";\n\n/**\n * Font options for off-screen text measurement.\n * All properties default to the active theme variables when omitted.\n */\nexport interface TextMeasureOptions {\n fontFamily?: string;\n fontSize? : string;\n fontWeight?: string;\n fontStyle? : string;\n fontVariant?: string;\n fontStretch?: string;\n lineHeight?: string\n /**\n * When set, the probe wraps at this pixel width (using `pre-wrap`) instead of\n * measuring on a single `nowrap` line. The returned `height` then reflects the\n * wrapped, multi-line box. Omit to measure the natural single-line size.\n */\n maxWidth?: number;\n}\n\n/**\n * Result of an off-screen text measurement that also reports the typographic baseline.\n *\n * @remarks `baseline` is the offset from the top of the measured box to the font baseline,\n * in pixels — analogous to CSS `vertical-align: baseline` on an inline-block element.\n */\nexport interface TextMetrics {\n width: number;\n height: number;\n baseline: number;\n}\n\n/**\n * General-purpose utility functions for DOM interaction and browser environment queries.\n *\n * @category Util\n */\nexport namespace Util {\n\n // Cached text-metric results, invalidated together on theme change via\n // `invalidateTextMetricsCache`. `-1` is the \"not yet measured\" sentinel\n // (a real padding / font size / baseline / offset is always >= 0).\n let linePaddingCache: number = -1;\n let rootFontSizeCache: number = -1;\n let textBaselineCache: number = -1;\n let opticalOffsetCache: number = -1;\n\n // Generation counter bumped by `invalidateTextMetricsCache`, so a caller\n // (e.g. `Text.needsMeasure`) can tell whether its last measurement\n // predates the active theme without holding its own subscription.\n let metricsGeneration = 0;\n\n // Resolved bound-font-size results, keyed by `cssVar + \"|\" + cssRule`, so\n // every `Text` bound to the same CSS var/rule pair shares one resolution\n // per theme change instead of each instance re-probing the cascade.\n const boundFontSizeCache = new Map<string, number | null>();\n\n /**\n * Measures the rendered size of a text string using an off-screen probe `<span>`.\n *\n * @param text - The string to measure.\n * @param options - Font properties to apply. Defaults to the active theme variables.\n * @returns The measured `{width, height}` in pixels, ceiled to whole pixels.\n */\n export function measureTextSize(text: string, options: TextMeasureOptions = {}): Size {\n const metrics = DOM.source.measureText(text, options);\n\n return { width: metrics.width, height: metrics.height };\n }\n\n /**\n * Returns the rendered pixel width of a text string.\n *\n * @param text - The string to measure.\n * @param options - Font properties to apply. Defaults to the active theme variables.\n * @returns The measured width in pixels, ceiled to a whole pixel.\n */\n export function measureTextWidth(text: string, options?: TextMeasureOptions): number {\n return measureTextSize(text, options).width;\n }\n\n /**\n * Measures many strings under one font in a single document reflow,\n * instead of one reflow per string.\n *\n * @param texts - The strings to measure.\n * @param options - Font properties to apply. Defaults to the active theme variables.\n * @returns One width per input, in input order.\n */\n export function measureTextWidths(texts: string[], options?: TextMeasureOptions): number[] {\n return DOM.source.measureTextWidths(texts, options);\n }\n\n /**\n * Returns the active theme's leading (`--ts-ui-line-padding`) in pixels.\n *\n * @returns The integer-pixel value of `--ts-ui-line-padding`, or `4` as a\n * fallback when the variable is missing or unparseable.\n */\n function linePaddingPx(): number {\n if (linePaddingCache >= 0) {\n return linePaddingCache;\n }\n\n const raw = DOM.source.getThemeVar(\"--ts-ui-line-padding\");\n const parsed = parseFloat(raw);\n\n // 2 mirrors the `--ts-ui-line-padding` default shipped by every theme\n // (see ModernTheme/DarkTheme/ClassicTheme `font.linePadding: '2px'`);\n // it only applies when the var is absent (e.g. pre-theme-apply probe).\n linePaddingCache = isNaN(parsed) ? 2 : parsed;\n\n return linePaddingCache;\n }\n\n /**\n * Returns the document root font size (`--ts-ui-font-size`) in pixels, the\n * default font size for a control that doesn't override it.\n *\n * @returns The integer-pixel root font size, or `14` as a fallback.\n */\n function rootFontSizePx(): number {\n if (rootFontSizeCache >= 0) {\n return rootFontSizeCache;\n }\n\n const raw = DOM.source.getThemeVar(\"--ts-ui-font-size\");\n const parsed = parseFloat(raw);\n\n rootFontSizeCache = isNaN(parsed) ? 14 : parsed;\n\n return rootFontSizeCache;\n }\n\n /**\n * Returns a vertical text metric in integer pixels: a control's font size,\n * plus the theme leading (`--ts-ui-line-padding`) by default.\n *\n * @param options - Measurement options.\n * @param options.fontSizePx - The control's font size in pixels. Omit to use\n * the document root font size (`--ts-ui-font-size`), which is what the\n * native `<input>`-backed controls render at.\n * @param options.linePadding - Controls the leading added to the font size:\n * `true` (the default) adds the theme `--ts-ui-line-padding`, giving the\n * full rendered line box (matching the `calc(1em + …)` line-height controls\n * render at); `false` adds nothing, returning the bare font size to size a\n * box from its font without leading; a number adds that exact pixel padding.\n * @returns `round(fontSize + leading)`, where leading is the theme padding,\n * `0`, or the given number.\n *\n * @remarks With the default leading the line box scales with font size, so\n * 12px and 14px text get proportionate line boxes from the one token. Text\n * components, table rows, and the baseline computation use the default so\n * their measurement matches the rendered line box; the native input box\n * heights pass `false` so the box hugs the font size plus their own chrome.\n * The padding and root font size are cached; call\n * {@link invalidateTextMetricsCache} after a theme change to force a\n * re-read.\n */\n export function lineHeightPx(options: { fontSizePx?: number, linePadding?: boolean | number } = {}): number {\n let fs = options.fontSizePx ?? rootFontSizePx();\n\n const linePadding = options.linePadding ?? true;\n\n if (linePadding === true) {\n fs += linePaddingPx();\n } else if (typeof linePadding === \"number\") {\n fs += linePadding;\n }\n\n return Math.round(fs);\n }\n\n /**\n * Returns the content-relative text baseline for the unified line-height\n * model: the offset from the top of the `lineHeightPx()` line box to the\n * font baseline.\n *\n * @returns The baseline offset in pixels, rounded to the nearest integer.\n *\n * @remarks Computed from the canvas 2D `measureText` font metrics rather\n * than a DOM probe, so it is deterministic and UA-independent. A CSS line\n * box centres the font's ascent+descent within `line-height`; this\n * reproduces that centring with the known px line box —\n * `round(lineGap / 2 + ascent)` where `lineGap = lineHeightPx - (ascent +\n * descent)` — so the measured baseline matches where the browser paints the\n * glyph in both a native `<input>` and a `Text`/`Label`. `fontBoundingBox*`\n * (font-intrinsic, string-independent) is used in preference to\n * `actualBoundingBox*` (glyph-ink specific) so the baseline does not shift\n * per measured string; `\"X\"` is passed only to satisfy `measureText`. The\n * result is cached; call {@link invalidateTextMetricsCache} after a theme\n * change to force re-measurement.\n */\n export function measureTextBaseline(): number {\n if (textBaselineCache >= 0) {\n return textBaselineCache;\n }\n\n const m = DOM.source.measureFontMetrics();\n const gap = lineHeightPx() - (m.ascent + m.descent);\n\n textBaselineCache = Math.round(gap / 2 + m.ascent);\n\n return textBaselineCache;\n }\n\n /**\n * Returns the pixel height of a single-line input box: the theme line-box\n * height ({@link lineHeightPx}) plus the component's own vertical chrome\n * (insets + optional padding + border).\n *\n * @param insets - The component's layout insets (top/bottom read).\n * @param padding - The component's CSS padding, or `null` when it has none.\n * @param border - The component's border widths (top/bottom read).\n * @returns The single-line box height in pixels.\n *\n * @remarks Factors out the `chrome = insets + padding + border; h =\n * lineHeightPx() + chrome` idiom shared by every single-line native-input\n * box height (`TextField` / `PasswordField` / `ComboBox` / the picker fields\n * / `NumberSpinner`). Only the vertical (top/bottom) edges contribute; the\n * horizontal edges are the caller's width concern. `NumberSpinner` uniquely\n * passes its *inner input's* padding rather than its own.\n */\n export function singleLineBoxHeight(\n insets: Insets,\n padding: Insets | null,\n border: { top: number; bottom: number },\n ): number {\n const chrome = insets.getTop() + insets.getBottom()\n + (padding ? padding.getTop() + padding.getBottom() : 0)\n + border.top + border.bottom;\n\n return lineHeightPx() + chrome;\n }\n\n /**\n * Returns the downward pixel offset that moves a single line of text from\n * its line-box (geometric) centre to its optical (cap-height) centre.\n *\n * @returns The downward offset in pixels (`>= 0`), rounded to the nearest\n * integer.\n *\n * @remarks A label's visible glyphs occupy cap-top→baseline; the descender\n * band below the baseline is empty ink, so the ink's visual centre sits\n * above the font box's geometric centre and a geometrically-centred label\n * reads as too high. This returns roughly half the unused descender space —\n * `round(boxMid - inkMid)` where `boxMid = (ascent - descent) / 2` and\n * `inkMid = capTop / 2` with `capTop = actualBoundingBoxAscent` (the cap-top\n * ink of `\"X\"`) — so a consumer ([`Button`](/api/component/button/classes/Button))\n * can nudge single-line text down onto its true optical centre. Derived\n * from the same cached canvas\n * metrics as {@link measureTextBaseline}; cached and invalidated together\n * via {@link invalidateTextMetricsCache}.\n */\n export function opticalCenterOffset(): number {\n if (opticalOffsetCache >= 0) {\n return opticalOffsetCache;\n }\n\n const m = DOM.source.measureFontMetrics();\n const boxMid = (m.ascent - m.descent) / 2;\n const inkMid = m.capTop / 2;\n\n opticalOffsetCache = Math.max(0, Math.round(boxMid - inkMid));\n\n return opticalOffsetCache;\n }\n\n /**\n * Returns the generation counter for the cached text metrics, bumped once\n * every time {@link invalidateTextMetricsCache} runs.\n *\n * @returns The current generation number.\n *\n * @remarks Lets a caller that measured against a past generation (stashed\n * from a prior read of this function) tell, cheaply and without holding\n * its own theme subscription, whether a re-measure is due — the pattern\n * `Text` uses instead of subscribing to `ThemeManager` per instance.\n */\n export function textMetricsGeneration(): number {\n return metricsGeneration;\n }\n\n /**\n * Resolves a CSS custom property bound to a control's font size to a\n * pixel number, caching the result per `cssVar`/`cssRule` pair so every\n * control bound to the same token shares one resolution per theme change.\n *\n * @param cssVar - The CSS custom property name (e.g. `\"--ts-ui-font-size\"`).\n * @param cssRule - The CSS value the control's `font-size` rule is set to\n * (e.g. `\"var(--ts-ui-font-size, 14px)\"`), used as the fallback probe\n * when `cssVar`'s raw value isn't a bare, parseable pixel number (a\n * `calc(...)`-valued relative token). Pass `null` when the control has\n * no rule text of its own; the probe then falls back to `var(${cssVar})`.\n * @returns The resolved pixel size.\n *\n * @remarks Mirrors the theme-var-then-probe strategy every other cached\n * metric in this namespace uses: a simple var parses straight off its raw\n * string; a `calc(...)`-valued token falls back to\n * {@link DOMSource.resolveFontSizePx}, a cascade-evaluating probe. Cleared\n * together with the rest of the text metrics by\n * {@link invalidateTextMetricsCache}.\n */\n export function boundFontSizePx(cssVar: string, cssRule: string | null): number | null {\n const key = cssVar + \"|\" + (cssRule ?? \"\");\n const cached = boundFontSizeCache.get(key);\n\n if (cached !== undefined) {\n return cached;\n }\n\n const raw = parseFloat(DOM.source.getThemeVar(cssVar));\n const resolved = isNaN(raw)\n ? DOM.source.resolveFontSizePx(cssRule ?? `var(${cssVar})`)\n : raw;\n\n boundFontSizeCache.set(key, resolved);\n\n return resolved;\n }\n\n /**\n * Discards every cached text metric (line box, baseline, optical offset,\n * bound font sizes) so the next read re-measures against the active theme\n * font.\n *\n * @remarks Call this whenever the active theme's font size, family, or\n * line-height changes, since the cached values reflect the font in use at\n * the time of the first measurement and would otherwise mis-align controls\n * against each other after a theme swap.\n */\n export function invalidateTextMetricsCache(): void {\n linePaddingCache = -1;\n rootFontSizeCache = -1;\n textBaselineCache = -1;\n opticalOffsetCache = -1;\n boundFontSizeCache.clear();\n metricsGeneration++;\n }\n\n /**\n * Generates a UUID string, ensuring the first character is never a digit.\n *\n * @returns A UUID v4 string with a guaranteed non-numeric first character.\n *\n * @remarks If the standard UUID generation produces a leading digit, it is replaced\n * with the letter \"a\" so the result is safe to use as a DOM id or CSS identifier.\n */\n export function generateUUID() {\n let uuid = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {\n let r = Math.random() * 16 | 0,\n v = c == 'x' ? r : (r & 0x3 | 0x8);\n return v.toString(16);\n });\n\n let first = parseInt(uuid[0]);\n if (Util.isInteger(first)) {\n uuid = \"a\" + uuid.substring(1, uuid.length);\n }\n\n return uuid;\n }\n\n /**\n * Returns true if value is an integer.\n *\n * @param value - The value to test.\n *\n * @returns `true` if `value` is an integer, `false` otherwise.\n */\n export function isInteger(value: Object) {\n return Number.isInteger(value);\n }\n\n /**\n * Clamps a number into an inclusive `[min, max]` range.\n *\n * @param value - The number to clamp.\n * @param min - The lower bound.\n * @param max - The upper bound.\n *\n * @returns `value` when it lies within the range, otherwise the nearer bound.\n *\n * @remarks Assumes `min <= max` (the framework's `min <= preferred <= max`\n * size invariant). When `min > max` the maximum wins (`clamp(v, 10, 0) === 0`)\n * — the low-first `Math.min(Math.max(...))` tie-break; callers must not rely\n * on it. `NaN` propagates (a `NaN` input returns `NaN`), matching the inlined\n * `Math.min`/`Math.max` expressions this replaces.\n */\n export function clamp(value: number, min: number, max: number): number {\n return Math.min(Math.max(value, min), max);\n }\n\n /**\n * Converts a hyphen-separated identifier (e.g. `\"border-top-width\"`) to its\n * camelCase equivalent (`\"borderTopWidth\"`). Useful for translating\n * CSS-style kebab-case property names into the camelCase form expected by\n * `CSSStyleDeclaration` bracket-indexed assignment.\n *\n * @param value - The kebab-case input string.\n * @returns The camelCase equivalent.\n */\n export function kebabToCamel(value: string): string {\n return value.replace(/-([a-z])/g, (_, c: string) => c.toUpperCase());\n }\n\n}\n","// SPDX-License-Identifier: PolyForm-Noncommercial-1.0.0\n\nimport { Util } from \"~/core/Util.js\"\n\n/**\n * Base class for all library objects.\n * Automatically assigns a unique identifier on construction.\n *\n * @category Core\n */\nexport class BaseObject {\n\n private _id: string;\n\n constructor() {\n this._id = Util.generateUUID();\n }\n\n /**\n * Returns the unique identifier for this object.\n *\n * @returns The UUID string assigned at construction time.\n */\n getId() {\n return this._id;\n }\n\n /**\n * Sets the unique identifier for this object.\n *\n * @param id - The new identifier string to assign.\n */\n setId(id: string) : this {\n this._id = id;\n\n return this;\n }\n\n /**\n * Returns the runtime class name of this object.\n *\n * @returns The name of the constructor function as a string.\n */\n getClassName() {\n return this.constructor.name;\n }\n};\n","// SPDX-License-Identifier: PolyForm-Noncommercial-1.0.0\n\n/**\n * Represents a two-dimensional size with width and height in pixels.\n *\n * @category Util\n */\nexport interface Size {\n width: number,\n height: number\n}\n\n/**\n * The sentinel extent meaning \"no upper bound\" on a size axis.\n *\n * @category Util\n */\nexport const UNBOUNDED: number = Number.MAX_SAFE_INTEGER;\n\n/**\n * True when an extent is at or above the unbounded sentinel (recognises the\n * legacy `Number.MAX_VALUE` too).\n *\n * @param n - The extent to test.\n * @returns `true` when `n` is at or above {@link UNBOUNDED}.\n *\n * @category Util\n */\nexport function isUnbounded(n: number): boolean {\n return n >= Number.MAX_SAFE_INTEGER;\n}\n\n/**\n * Caps an extent at the unbounded sentinel so an unbounded sum cannot overflow\n * it.\n *\n * @param n - The extent to cap.\n * @returns `n`, capped at {@link UNBOUNDED}.\n *\n * @category Util\n */\nexport function saturate(n: number): number {\n return Math.min(n, UNBOUNDED);\n}\n","// SPDX-License-Identifier: PolyForm-Noncommercial-1.0.0\n\n/**\n * A border specification built from complete CSS border strings.\n * `border` is the all-sides fallback; each per-side field overrides it for\n * that side. An unspecified side falls back to `border`, then to `\"none\"`.\n *\n * @category Util\n */\nexport interface BorderOptions {\n /** CSS `border` shorthand applied to all four sides (e.g. `\"1px solid rgb(...)\"`, `\"none\"`, `\"var(--x)\"`). */\n border?: string;\n /** CSS `border-top` value; overrides `border` for the top side. */\n borderTop?: string;\n /** CSS `border-right` value; overrides `border` for the right side. */\n borderRight?: string;\n /** CSS `border-bottom` value; overrides `border` for the bottom side. */\n borderBottom?: string;\n /** CSS `border-left` value; overrides `border` for the left side. */\n borderLeft?: string;\n}\n\n/**\n * Expands a {@link BorderOptions} into the four camelCase longhand style keys\n * (`borderTop`/`borderRight`/`borderBottom`/`borderLeft`) that `StyleRule.setMany`\n * consumes. Each side resolves via `side ?? border ?? \"none\"`, so a pure-longhand\n * map replays deterministically regardless of what else touched the rule.\n *\n * @param border - The border specification to expand.\n *\n * @returns A map of the four longhand keys to their resolved CSS values.\n *\n * @category Util\n */\nexport function borderToStyle(border: BorderOptions): Record<string, string | null> {\n const all = border.border ?? \"none\";\n\n return {\n borderTop: border.borderTop ?? all,\n borderRight: border.borderRight ?? all,\n borderBottom: border.borderBottom ?? all,\n borderLeft: border.borderLeft ?? all,\n };\n}\n\n/**\n * Best-effort leading-`<n>px` width of one side's CSS value. Returns `0` for\n * `undefined`, `none`, `0`, `var(...)`, or any non-`px` leading token. Used both\n * to parse the always-`<n>px` values `getComputedStyle` returns (authoritative,\n * post-render) and to estimate a width from a spec string before an element exists.\n *\n * @param value - A single side's CSS border value, or `undefined`.\n *\n * @returns The leading pixel width, or `0` when none can be parsed.\n *\n * @category Util\n */\nexport function borderSideWidth(value: string | undefined): number {\n if (!value) {\n return 0;\n }\n\n const match = value.trim().match(/^([\\d.]+)px\\b/i);\n\n return match ? parseFloat(match[1]) : 0;\n}\n","// SPDX-License-Identifier: PolyForm-Noncommercial-1.0.0\n\nimport { BaseObject } from \"~/core/BaseObject.js\";\n\n/**\n * Represents the four directional inset (padding/margin) values for a rectangular area.\n * All values are expressed in pixels.\n *\n * @example\n * ```typescript\n * import { Insets } from '@jimka/typescript-ui/primitive';\n*\n * component.setInsets(new Insets(8, 12, 8, 12)); // top, right, bottom, left\n * ```\n *\n * @category Util\n */\nexport class Insets extends BaseObject {\n\n private _top: number;\n private _right: number;\n private _bottom: number;\n private _left: number;\n\n /**\n * @param top - Top inset in pixels.\n * @param right - Right inset in pixels.\n * @param bottom - Bottom inset in pixels.\n * @param left - Left inset in pixels.\n */\n constructor(top: number, right: number, bottom: number, left: number) {\n super();\n\n this._top = top || 0;\n this._right = right || 0;\n this._bottom = bottom || 0;\n this._left = left || 0;\n }\n\n /**\n * Returns the top inset in pixels.\n *\n * @returns The top inset value, defaulting to `0` if unset.\n */\n getTop() {\n return this._top || 0;\n }\n\n /**\n * Sets the top inset in pixels.\n *\n * @param value - The new top inset value in pixels.\n */\n setTop(value: number) : this {\n this._top = value;\n\n return this;\n }\n\n /**\n * Returns the right inset in pixels.\n *\n * @returns The right inset value, defaulting to `0` if unset.\n */\n getRight() {\n return this._right || 0;\n }\n\n /**\n * Sets the right inset in pixels.\n *\n * @param value - The new right inset value in pixels.\n */\n setRight(value: number) : this {\n this._right = value;\n\n return this;\n }\n\n /**\n * Returns the bottom inset in pixels.\n *\n * @returns The bottom inset value, defaulting to `0` if unset.\n */\n getBottom() {\n return this._bottom || 0;\n }\n\n /**\n * Sets the bottom inset in pixels.\n *\n * @param value - The new bottom inset value in pixels.\n */\n setBottom(value: number) : this {\n this._bottom = value;\n\n return this;\n }\n\n /**\n * Returns the left inset in pixels.\n *\n * @returns The left inset value, defaulting to `0` if unset.\n */\n getLeft() {\n return this._left || 0;\n }\n\n /**\n * Sets the left inset in pixels.\n *\n * @param value - The new left inset value in pixels.\n */\n setLeft(value: number) : this {\n this._left = value;\n\n return this;\n }\n\n /**\n * Sets all four inset values at once.\n *\n * @param top - Top inset in pixels.\n * @param right - Right inset in pixels.\n * @param bottom - Bottom inset in pixels.\n * @param left - Left inset in pixels.\n */\n set(top: number, right: number, bottom: number, left: number) : this {\n this._top = top;\n this._right = right;\n this._bottom = bottom;\n this._left = left;\n\n return this;\n }\n\n /**\n * Returns the insets as a CSS shorthand string (e.g. `\"4px 4px 4px 4px\"`).\n *\n * @returns A CSS margin/padding shorthand string with all four sides in top-right-bottom-left order.\n */\n render() {\n return this.getTop() + \"px \" + this.getRight() + \"px \" + this.getBottom() + \"px \" + this.getLeft() + \"px\";\n }\n};\n","// SPDX-License-Identifier: PolyForm-Noncommercial-1.0.0\n\n/**\n * CSS `position` values used by the framework.\n *\n * The framework positions every component absolutely (see\n * [ARCHITECTURE.md](/ARCHITECTURE.md) §Positioning). Only three values\n * are exposed:\n *\n * - `ABSOLUTE` — the universal default for every framework component.\n * - `FIXED` — the documented exception for floating overlays that anchor to\n * the viewport (`AnimatedDropdown`, `Popover`, `Notification`, `Dialog`,\n * `DialogBackdrop`). Set internally by these subclasses; never by callers.\n * - `STATIC` — the documented exception for an HTML element whose native\n * semantics require in-flow rendering (currently only `Legend`, which needs\n * the notch in its parent `<fieldset>`'s border).\n *\n * Other CSS values (`relative`, `sticky`, `initial`, `inherit`) are\n * intentionally **not** members. Application code does not call\n * `setPosition` — that setter is `protected` on `Component`.\n *\n * @category Util\n */\nexport enum Position {\n STATIC = \"static\",\n FIXED = \"fixed\",\n ABSOLUTE = \"absolute\",\n}\n"],"mappings":"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"}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{t as e}from"./DOM-C-Edb3tA.js";import{b as t,h as n,t as r}from"./Component-B0ShfPVi.js";t.ensureKeyframes(`ts-ui-progress-spinner-rotate`,`from { transform: rotate(0deg); } to { transform: rotate(360deg); }`);var i=3;function readThemeFontSizePx(){let t=e.source.getThemeVar(`--ts-ui-font-size`),n=parseFloat(t);return isNaN(n)?14:n}var ProgressSpinner=class extends r{_arc;_size;_trackThemeFontSize;_themeFontSizeResolved=!1;_overlayTarget=null;constructor(e,t){super(),this._trackThemeFontSize=e===void 0,this._size=this._trackThemeFontSize?14:e,this.clearInsets(),this._arc=new r,this._arc.setBorderRadius(`50%`),this._arc.setBorder({border:`${i}px solid var(--ts-ui-progress-spinner-color, rgb(30, 100, 200))`,borderTop:`${i}px solid transparent`}),this._arc.setAnimation(`ts-ui-progress-spinner-rotate 0.8s linear infinite`),super.addComponent(this._arc),this.setPreferredSize({width:this._size,height:this._size}),this._trackThemeFontSize&&this.subscribeTheme(()=>{if(!this._trackThemeFontSize)return;let e=readThemeFontSizePx();e!==this._size&&(this._size=e,this.setPreferredSize({width:e,height:e}),this.scheduleLayout())}),this.getAria().setRole(`status`),this.getAria().setLabel(`Loading`),t&&this.applyOptions(t)}applyOptions(e){return super.applyOptions(e),e.spinnerSize!==void 0&&this.setSpinnerSize(e.spinnerSize),this}getSpinnerSize(){return this._size}getBaseline(){let e=this.getPreferredSize();return e?e.height-2:null}setSpinnerSize(e){return this._trackThemeFontSize=!1,this._size===e?this:(this._size=e,this.setPreferredSize({width:e,height:e}),this.scheduleLayout(),this)}showOverlay(t){if(this._overlayTarget)return;this._overlayTarget=t,this.setBackgroundColor(`var(--ts-ui-progress-spinner-backdrop, rgba(255, 255, 255, 0.6))`),this.setZIndex(9999);let n=t.getElement(!0),r=this.getElement(!0);e.sink.appendChild(n,r),this.setX(0),this.setY(0),this.setSize({width:t.getWidth(),height:t.getHeight()}),this.doLayout()}hideOverlay(){this._overlayTarget&&(this._overlayTarget=null,this.removeElement(),this.clearBackgroundColor(),this.setZIndex(0))}isOverlay(){return this._overlayTarget!==null}doLayout(){if(this._trackThemeFontSize&&!this._themeFontSizeResolved){this._themeFontSizeResolved=!0;let e=readThemeFontSizePx();e!==this._size&&(this._size=e,this.setPreferredSize({width:e,height:e}))}this._overlayTarget&&this.setSize({width:this._overlayTarget.getWidth(),height:this._overlayTarget.getHeight()});let e=this.getContentBounds();if(!e)return super.doLayout(),this;let t=Math.min(this._size,e.width,e.height),n=e.x+Math.round((e.width-t)/2),r=e.y+Math.round((e.height-t)/2);return this._arc.setX(n),this._arc.setY(r),this._arc.setSize({width:t,height:t}),super.doLayout(),this}},a=n(ProgressSpinner);export{a as t};
|
|
2
|
-
//# sourceMappingURL=ProgressSpinner-DK8xEQ9y.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ProgressSpinner-DK8xEQ9y.js","names":[],"sources":["../../src/typescript/lib/component/display/ProgressSpinner.ts"],"sourcesContent":["// SPDX-License-Identifier: PolyForm-Noncommercial-1.0.0\n\nimport { Component, ComponentOptions } from \"~/core/Component.js\";\nimport { DOM } from \"~/core/DOM.js\";\nimport { StyleRule } from \"~/core/StyleTarget.js\";\nimport { callable } from \"~/core/Callable.js\";\n\n/**\n * Construction-time options for {@link ProgressSpinner}.\n *\n * @category Components\n */\nexport interface ProgressSpinnerOptions extends ComponentOptions {\n spinnerSize?: number;\n}\n\nStyleRule.ensureKeyframes(\n 'ts-ui-progress-spinner-rotate',\n 'from { transform: rotate(0deg); } to { transform: rotate(360deg); }'\n);\n\nconst ARC_BORDER_WIDTH = 3;\n\n/**\n * Reads the active theme's `--ts-ui-font-size` as a pixel value.\n *\n * @returns The current theme font size in pixels, or `14` as a fallback.\n */\nfunction readThemeFontSizePx(): number {\n const raw = DOM.source.getThemeVar(\"--ts-ui-font-size\");\n const parsed = parseFloat(raw);\n\n return isNaN(parsed) ? 14 : parsed;\n}\n\n/**\n * A circular loading indicator rendered as a rotating arc.\n *\n * Supports two usage modes:\n * - **Inline**: instantiate, size, and add to a parent like any other component.\n * - **Overlay**: call {@link showOverlay} to mount the spinner as an absolute\n * overlay over a target component, complete with a semi-transparent backdrop.\n * {@link hideOverlay} removes it.\n *\n * @category Components\n */\nclass ProgressSpinner extends Component {\n\n private _arc: Component;\n private _size: number;\n private _trackThemeFontSize: boolean;\n private _themeFontSizeResolved: boolean = false;\n private _overlayTarget: Component | null = null;\n\n /**\n * Constructs a ProgressSpinner.\n *\n * @param size - Optional. Diameter in pixels of the arc when used inline.\n * Omit to track the active theme's `--ts-ui-font-size` so the spinner\n * matches surrounding text by default; updates automatically on theme change.\n */\n constructor(size?: number, options?: ProgressSpinnerOptions) {\n // Child components are built first; options are applied via applyOptions at the constructor tail.\n // eslint-disable-next-line local/forward-super-options\n super();\n\n this._trackThemeFontSize = size === undefined;\n // Theme font-size is resolved at first `doLayout` (post-attach) so\n // construction stays JS-only per ARCHITECTURE.md \"Defer DOM work to\n // render time\". Use the same `14` fallback that `readThemeFontSizePx`\n // returns when the variable is missing, so the preferred-size write a\n // few lines below has a sensible value before the theme read fires.\n this._size = this._trackThemeFontSize ? 14 : size!;\n\n // Use no insets so the arc fills the declared size — otherwise the\n // default 4-pixel inset shrinks a 24-pixel spinner's arc to 16 pixels\n // and leaves 8 pixels of empty space around it.\n this.clearInsets();\n\n this._arc = new Component();\n this._arc.setBorderRadius(\"50%\");\n this._arc.setBorder({\n border: `${ARC_BORDER_WIDTH}px solid var(--ts-ui-progress-spinner-color, rgb(30, 100, 200))`,\n borderTop: `${ARC_BORDER_WIDTH}px solid transparent`,\n });\n this._arc.setAnimation(\"ts-ui-progress-spinner-rotate 0.8s linear infinite\");\n\n super.addComponent(this._arc);\n\n this.setPreferredSize({ width: this._size, height: this._size });\n\n if (this._trackThemeFontSize) {\n this.subscribeTheme(() => {\n if (!this._trackThemeFontSize) {\n return;\n }\n\n const next = readThemeFontSizePx();\n if (next === this._size) {\n return;\n }\n\n this._size = next;\n this.setPreferredSize({ width: next, height: next });\n this.scheduleLayout();\n });\n }\n\n this.getAria().setRole(\"status\");\n this.getAria().setLabel(\"Loading\");\n\n if (options) {\n this.applyOptions(options);\n }\n }\n\n /**\n * Applies a {@link ProgressSpinnerOptions} bag, dispatching the explicit\n * spinner diameter after inherited Component fields.\n *\n * @param options - The options bag carrying the values to apply.\n */\n protected applyOptions(options: ProgressSpinnerOptions): this {\n super.applyOptions(options);\n\n if (options.spinnerSize !== undefined) {\n this.setSpinnerSize(options.spinnerSize);\n }\n\n return this;\n }\n\n /**\n * Returns the spinner arc diameter in pixels.\n *\n * @returns The diameter.\n *\n * @remarks Returns the most recently resolved diameter; when the spinner\n * tracks the theme font-size (default constructor with no `size` argument),\n * the resolved value is only available after the first layout pass — earlier\n * calls return the `14`-pixel fallback.\n */\n getSpinnerSize(): number {\n return this._size;\n }\n\n /**\n * Returns a baseline near the bottom edge so the spinner participates in\n * baseline alignment — sitting with its bottom roughly on the surrounding\n * text baseline — instead of being vertically centred in the row. The 2px\n * lift matches the other graphical controls so it doesn't sit below the\n * text descenders.\n *\n * @returns The preferred height minus 2, or `null` before a size is set.\n */\n getBaseline(): number | null {\n const size = this.getPreferredSize();\n\n return size ? size.height - 2 : null;\n }\n\n /**\n * Sets a new arc diameter and updates the component's preferred size.\n *\n * @param size - Diameter in pixels.\n *\n * @remarks Calling this disables the default theme-font-size tracking so\n * the spinner stays at the explicit size across subsequent theme changes.\n */\n setSpinnerSize(size: number): this {\n this._trackThemeFontSize = false;\n\n if (this._size === size) {\n return this;\n }\n\n this._size = size;\n this.setPreferredSize({ width: size, height: size });\n this.scheduleLayout();\n\n return this;\n }\n\n /**\n * Mounts this ProgressSpinner as an absolute overlay covering the given component.\n *\n * The spinner element is appended directly to the target's DOM element (bypassing\n * the target's layout manager, mirroring how [`Window`](/api/overlay/classes/Window)\n * mounts itself onto `document.documentElement`). Sized to the target's full bounds with a\n * semi-transparent backdrop and the spinning arc centred inside it. No-op if\n * already shown as an overlay.\n *\n * @param target - The component to overlay.\n */\n showOverlay(target: Component): void {\n if (this._overlayTarget) {\n return;\n }\n\n this._overlayTarget = target;\n\n this.setBackgroundColor(\"var(--ts-ui-progress-spinner-backdrop, rgba(255, 255, 255, 0.6))\");\n this.setZIndex(9999);\n\n const targetEl = target.getElement(true)!;\n const spinnerEl = this.getElement(true)!;\n\n DOM.sink.appendChild(targetEl, spinnerEl);\n\n this.setX(0);\n this.setY(0);\n this.setSize({ width: target.getWidth(), height: target.getHeight() });\n this.doLayout();\n }\n\n /**\n * Removes the overlay from its target and resets state. No-op if not currently shown\n * as an overlay.\n */\n hideOverlay(): void {\n if (!this._overlayTarget) {\n return;\n }\n\n this._overlayTarget = null;\n\n this.removeElement();\n\n this.clearBackgroundColor();\n this.setZIndex(0);\n }\n\n /**\n * Returns whether the spinner is currently mounted as an overlay.\n *\n * @returns True if showOverlay has been called and hideOverlay has not.\n */\n isOverlay(): boolean {\n return this._overlayTarget !== null;\n }\n\n /**\n * Lays out the inner arc element at the centre of the component bounds.\n *\n * @returns This component, for method chaining.\n */\n doLayout(): this {\n if (this._trackThemeFontSize && !this._themeFontSizeResolved) {\n this._themeFontSizeResolved = true;\n\n const next = readThemeFontSizePx();\n if (next !== this._size) {\n this._size = next;\n this.setPreferredSize({ width: next, height: next });\n }\n }\n\n if (this._overlayTarget) {\n this.setSize({ width: this._overlayTarget.getWidth(), height: this._overlayTarget.getHeight() });\n }\n\n // The content box, not the inner size: the inner size gives the right\n // extent to centre within but no origin, so a padded spinner would\n // centre the arc in the padding box and ignore the padding it just\n // subtracted.\n const box = this.getContentBounds();\n if (!box) {\n super.doLayout();\n\n return this;\n }\n\n const diameter = Math.min(this._size, box.width, box.height);\n const x = box.x + Math.round((box.width - diameter) / 2);\n const y = box.y + Math.round((box.height - diameter) / 2);\n\n this._arc.setX(x);\n this._arc.setY(y);\n this._arc.setSize({ width: diameter, height: diameter });\n\n super.doLayout();\n\n return this;\n }\n}\n\nconst ProgressSpinnerCallable = callable(ProgressSpinner);\ntype ProgressSpinnerCallable = ProgressSpinner;\nexport {\n ProgressSpinner as _ProgressSpinner,\n ProgressSpinnerCallable as ProgressSpinner\n};\n"],"mappings":"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"}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{S as e,h as t,t as n,v as r}from"./Component-B0ShfPVi.js";import{t as i}from"./Glyph-_VeBacS2.js";import{n as a}from"./Checkbox-D0JYK-wc.js";import{r as o}from"./VBox-DfJPWXqc.js";import{circle as s}from"./glyphs/solid/circle.es.js";i.register(s);var c={outline:`none`},RadioButton=class extends a{_ring;_dot;constructor(t,a,s){super({...a??{}},{...c,...s??{}}),this.setLayoutManager(new o),this._ring=new n,this._ring.setPreferredSize({width:16,height:16}),this._ring.setMinSize({width:16,height:16}),this._ring.setMaxSize({width:16,height:16}),this._ring.setSize({width:16,height:16}),this._ring.setBackgroundColor(`var(--ts-ui-radio-bg, var(--ts-ui-form-bg, rgb(255, 255, 255)))`),this._ring.setBorder(`1px solid var(--ts-ui-form-border, rgb(160, 160, 160))`),this._ring.setBorderRadius(`50%`),this._ring.setCursor(`pointer`),this._dot=new i(`circle`),this._dot.setForegroundColor(`var(--ts-ui-radio-dot-color, rgb(255, 255, 255))`),this._dot.setPreferredSize({width:8,height:8}),this._dot.setMaxSize({width:8,height:8}),this._dot.setX(3),this._dot.setY(3),this._dot.setOpacity(0),this._dot.setPointerEvents(`none`),r.isReducedMotion()||(this._dot.setTransition(`opacity 120ms ease-out`),this._ring.setTransition(`background-color 120ms ease-out, border-color 120ms ease-out`)),this._ring.addComponent(this._dot),super.addComponent(this._ring),this.getAria().setRole(`radio`),this.getAria().setTabIndex(0),this.getAria().setChecked(!1),e.addListener(this._ring,`click`,()=>this.activateFromPointer()),this.installKeyboard(),this._options.label===void 0&&this._options.text===void 0&&t!==void 0?this._options.label=t:this._options.label===void 0&&this._options.text!==void 0&&(this._options.label=this._options.text),this._options.value!==void 0&&this._options.selected===void 0&&(this._options.selected=this._options.value),this._options.selected!==void 0&&this.applySelected(this._options.selected),this._options.label!==void 0&&this.applyLabel(this._options.label),this._options.enabled!==void 0&&this.applyEnabled(this._options.enabled),this._options.readOnly!==void 0&&this.applyReadOnly(this._options.readOnly)}applyOptions(e){return super.applyOptions(e),e.selected!==void 0&&(this._options.selected=e.selected),e.value!==void 0&&(this._options.value=e.value),e.label!==void 0&&(this._options.label=e.label),e.text!==void 0&&(this._options.text=e.text),e.radioName!==void 0&&(this._options.radioName=e.radioName),e.enabled!==void 0&&(this._options.enabled=e.enabled),e.readOnly!==void 0&&(this._options.readOnly=e.readOnly),this}activate(){this.isSelected()||(this.setSelected(!0),e.fireEvent(this,`change`))}getInteractiveSurface(){return this._ring}isSelected(){return this._options.selected??!1}setSelected(e){let t=!!e;return t===this.isSelected()?this:(this._options.selected=t,this.applySelected(t),this.notifyChange(t),this)}getValue(){return this.isSelected()}setValue(e){return this.setSelected(e)}setRadioName(e){return this._options.radioName=e,this}clearRadioName(){return this._options.radioName=void 0,this}getRadioName(){return this._options.radioName??null}on(t,n){return t===`action`?(e.addListener(this,`change`,n),this):super.on(t,n)}off(t,n){return t===`action`?(e.removeListener(this,`change`,n),this):super.off(t,n)}applySelected(e){this.getAria().setChecked(e),this._ring.setBackgroundColor(e?`var(--ts-ui-radio-bg-selected, rgb(30, 100, 200))`:`var(--ts-ui-radio-bg, var(--ts-ui-form-bg, rgb(255, 255, 255)))`),this._ring.setBorder(e?`1px solid var(--ts-ui-radio-bg-selected, rgb(30, 100, 200))`:`1px solid var(--ts-ui-form-border, rgb(160, 160, 160))`),this._dot.setOpacity(+!!e)}},l=t(RadioButton);export{l as t};
|
|
2
|
-
//# sourceMappingURL=RadioButton-BEwpqg1k.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"RadioButton-BEwpqg1k.js","names":[],"sources":["../../src/typescript/lib/component/input/RadioButton.ts"],"sourcesContent":["// SPDX-License-Identifier: PolyForm-Noncommercial-1.0.0\n\nimport { Animation } from \"~/core/Animation.js\";\nimport { AbstractBooleanInput, AbstractBooleanInputOptions } from \"~/component/input/AbstractBooleanInput.js\";\nimport { Component } from \"~/core/Component.js\";\nimport { Event } from \"~/core/Event.js\";\nimport { Glyph } from \"~/component/display/Glyph.js\";\nimport { HBox } from \"~/layout/HBox.js\";\nimport { callable } from \"~/core/Callable.js\";\nimport { circle } from \"~/glyphs/solid/circle.js\";\n\n// Idempotent registration: makes the `\"circle\"` glyph available for the dot\n// regardless of which control imports first.\nGlyph.register(circle);\n\n/**\n * Construction-time options for {@link RadioButton}.\n *\n * @category Components\n */\nexport interface RadioButtonOptions extends AbstractBooleanInputOptions {\n selected?: boolean;\n value?: boolean;\n text?: string;\n radioName?: string;\n /**\n * Construction-time listener bag — the declarative form of `on()`. Adds the\n * radio button's `action` shorthand to the inherited `change` / `binding`.\n */\n listeners?: {\n action?: () => void;\n change?: (value: boolean) => void;\n binding?: () => void;\n };\n}\n\nconst _defaultRadioButtonOptions: Partial<RadioButtonOptions> = {\n outline: \"none\",\n};\n\n/**\n * A custom-drawn radio button rendered as a focusable `<div>` with\n * `role=\"radio\"`. The ring + dot is drawn with framework primitives; the\n * native `<input type=\"radio\">` is intentionally not used. Group selection\n * is coordinated by [`ButtonGroup`](/api/overlay/classes/ButtonGroup); keyboard\n * navigation within a group is provided by\n * [`RovingTabIndex`](/api/core/classes/RovingTabIndex).\n *\n * @category Components\n */\nclass RadioButton<TOptions extends RadioButtonOptions = RadioButtonOptions>\n extends AbstractBooleanInput<TOptions>\n{\n private _ring: Component;\n private _dot: Glyph;\n\n /**\n * Constructs a RadioButton.\n *\n * @param text - Optional label text. Equivalent to `options.label`; kept\n * positional for back-compat with consumers that wrote\n * `new RadioButton(\"Hello\")`.\n * @param options - Optional construction-time options bag.\n * @param subclassDefaults - Per-subclass default bag layered over this\n * class's defaults; subclasses forward their `_defaultXxxOptions`\n * constant here.\n */\n constructor(text?: string, options?: RadioButtonOptions, subclassDefaults?: Partial<RadioButtonOptions>);\n constructor(text?: string, options?: TOptions, subclassDefaults?: Partial<TOptions>) {\n super(\n { ...(options ?? {}) } as TOptions,\n { ..._defaultRadioButtonOptions, ...(subclassDefaults ?? {}) } as Partial<TOptions>,\n );\n\n this.setLayoutManager(new HBox());\n\n this._ring = new Component();\n this._ring.setPreferredSize({ width: 16, height: 16 });\n // Min = preferred = max so the outer HBox shrink-on-overallocation\n // can't collapse the ring graphic when the radio is packed into a\n // tight container with siblings that have flexible widths.\n this._ring.setMinSize({ width: 16, height: 16 });\n this._ring.setMaxSize({ width: 16, height: 16 });\n this._ring.setSize({ width: 16, height: 16 });\n this._ring.setBackgroundColor(\"var(--ts-ui-radio-bg, var(--ts-ui-form-bg, rgb(255, 255, 255)))\");\n this._ring.setBorder(\"1px solid var(--ts-ui-form-border, rgb(160, 160, 160))\");\n this._ring.setBorderRadius(\"50%\");\n // The ring owns the click + cursor surface so the pointer/click area\n // matches the visible graphic exactly. The root stays inert (default\n // cursor, no click listener), so clicks on a label or in any\n // stretched empty space don't select and don't show the pointer cursor.\n this._ring.setCursor(\"pointer\");\n\n this._dot = new Glyph(\"circle\");\n this._dot.setForegroundColor(\"var(--ts-ui-radio-dot-color, rgb(255, 255, 255))\");\n this._dot.setPreferredSize({ width: 8, height: 8 });\n this._dot.setMaxSize({ width: 8, height: 8 });\n this._dot.setX(3);\n this._dot.setY(3);\n this._dot.setOpacity(0);\n // Pass-through so clicks on the dot still hit the ring underneath.\n this._dot.setPointerEvents(\"none\");\n\n if (!Animation.isReducedMotion()) {\n this._dot.setTransition(\"opacity 120ms ease-out\");\n this._ring.setTransition(\"background-color 120ms ease-out, border-color 120ms ease-out\");\n }\n\n this._ring.addComponent(this._dot);\n super.addComponent(this._ring);\n\n this.getAria().setRole(\"radio\");\n this.getAria().setTabIndex(0);\n this.getAria().setChecked(false);\n\n // The ring owns the user-select click so the pointer/click + cursor\n // surface is exactly the visible 16 × 16 graphic — clicks on a label or\n // in any stretched empty area pass through to the root, which has no\n // listener of its own. This pointer line stays per-subclass (a closure\n // over the widget `this`) because a listener registered on the child\n // ring would otherwise bind `this` to the ring; only the keyboard path,\n // registered on the root, moves into the base.\n Event.addListener(this._ring, \"click\", () => this.activateFromPointer());\n this.installKeyboard();\n\n // The positional `text` arg wins only when `options.label` (or\n // `options.text`) was not provided.\n if (this._options.label === undefined && this._options.text === undefined && text !== undefined) {\n this._options.label = text;\n } else if (this._options.label === undefined && this._options.text !== undefined) {\n this._options.label = this._options.text;\n }\n\n if (this._options.value !== undefined && this._options.selected === undefined) {\n this._options.selected = this._options.value;\n }\n\n if (this._options.selected !== undefined) {\n this.applySelected(this._options.selected);\n }\n\n if (this._options.label !== undefined) {\n this.applyLabel(this._options.label);\n }\n\n if (this._options.enabled !== undefined) {\n this.applyEnabled(this._options.enabled);\n }\n\n if (this._options.readOnly !== undefined) {\n this.applyReadOnly(this._options.readOnly);\n }\n }\n\n /**\n * Applies a {@link RadioButtonOptions} bag. Inherited Component fields\n * cascade through `super.applyOptions`; radio-button-specific fields are\n * stored pure on `_options` so the constructor body can dispatch them\n * after children are built.\n *\n * @param options - The options bag carrying the values to apply.\n *\n * @returns This component, for method chaining.\n */\n protected applyOptions(options: TOptions): this {\n super.applyOptions(options);\n\n if (options.selected !== undefined) this._options.selected = options.selected;\n if (options.value !== undefined) this._options.value = options.value;\n if (options.label !== undefined) this._options.label = options.label;\n if (options.text !== undefined) this._options.text = options.text;\n if (options.radioName !== undefined) this._options.radioName = options.radioName;\n if (options.enabled !== undefined) this._options.enabled = options.enabled;\n if (options.readOnly !== undefined) this._options.readOnly = options.readOnly;\n\n return this;\n }\n\n /**\n * Activates the radio button from a click or key: radio buttons can only be\n * selected, never directly deselected by the user (the `ButtonGroup`\n * deselects siblings on change), so this selects and fires the DOM `change`\n * only on a real off→on transition. The enabled/read-only guard is applied\n * by the base before this runs.\n */\n protected activate(): void {\n if (!this.isSelected()) {\n this.setSelected(true);\n Event.fireEvent(this, \"change\");\n }\n }\n\n /**\n * Returns the inner ring graphic — the click + cursor surface.\n *\n * @returns The ring component.\n */\n protected getInteractiveSurface(): Component {\n return this._ring;\n }\n\n /**\n * Returns whether the radio button is currently selected.\n *\n * @returns `true` when selected.\n */\n isSelected(): boolean {\n return this._options.selected ?? false;\n }\n\n /**\n * Sets the selected state and updates the visual + ARIA cache. Used both\n * by user-driven selection and by `ButtonGroup` when it deselects\n * siblings.\n *\n * @param value - `true` to select, `false` to deselect.\n *\n * @returns This component, for method chaining.\n */\n setSelected(value: boolean): this {\n const next = !!value;\n if (next === this.isSelected()) {\n return this;\n }\n\n this._options.selected = next;\n this.applySelected(next);\n this.notifyChange(next);\n\n return this;\n }\n\n /**\n * Returns the current value (alias for {@link isSelected}, satisfies\n * [`Bindable`](/api/core/interfaces/Bindable)).\n *\n * @returns `true` when selected.\n */\n getValue(): boolean {\n return this.isSelected();\n }\n\n /**\n * Sets the value (alias for {@link setSelected}, satisfies [`Bindable`](/api/core/interfaces/Bindable)).\n *\n * @param value - The new selected state.\n *\n * @returns This component, for method chaining.\n */\n setValue(value: boolean): this {\n return this.setSelected(value);\n }\n\n /**\n * Back-compat shim that stores the supplied group name on `_options` but\n * does not emit a `name` attribute (the host element is no longer\n * `<input>`). Consumers that read the group name through\n * {@link getRadioName} keep working.\n *\n * @param name - Group name string.\n *\n * @returns This component, for method chaining.\n */\n setRadioName(name: string): this {\n this._options.radioName = name;\n\n return this;\n }\n\n /**\n * Clears the back-compat radio-name field.\n *\n * @returns This component, for method chaining.\n */\n clearRadioName(): this {\n this._options.radioName = undefined;\n\n return this;\n }\n\n /**\n * Returns the group name set via {@link setRadioName}, or `null`.\n *\n * @returns The group name string, or `null`.\n */\n getRadioName(): string | null {\n return this._options.radioName ?? null;\n }\n\n /**\n * Registers a listener for one of this radio button's events.\n * `\"action\"` is a typed semantic shorthand over {@link Event.addListener}\n * for the DOM change event — fired on user-driven selection and used by\n * [`ButtonGroup`](/api/overlay/classes/ButtonGroup) to enforce mutual\n * exclusivity. `\"change\"` and `\"binding\"` are the inherited\n * {@link AbstractInput} listener-bag events.\n *\n * @param event - The event name.\n * @param listener - The callback to invoke when the event fires.\n *\n * @returns This component, for method chaining.\n */\n on(event: \"action\", listener: Event.Listener): this;\n on(event: \"change\", listener: (value: boolean) => void): this;\n on(event: \"binding\", listener: () => void): this;\n on(event: \"action\" | \"change\" | \"binding\", listener: Function): this {\n if (event === \"action\") {\n Event.addListener(this, \"change\", listener as Event.Listener);\n\n return this;\n }\n\n return super.on(event as \"change\", listener as (value: boolean) => void);\n }\n\n /**\n * Removes a previously registered listener. The exact callback\n * reference must match the one passed to {@link on}.\n *\n * @param event - The event the listener was registered for.\n * @param listener - The callback to remove.\n *\n * @returns This component, for method chaining.\n */\n off(event: \"action\" | \"change\" | \"binding\", listener: Function): this {\n if (event === \"action\") {\n Event.removeListener(this, \"change\", listener as Event.Listener);\n\n return this;\n }\n\n return super.off(event, listener);\n }\n\n /**\n * Updates the visual + ARIA state for the given selected flag.\n */\n private applySelected(selected: boolean): void {\n this.getAria().setChecked(selected);\n\n this._ring.setBackgroundColor(selected\n ? \"var(--ts-ui-radio-bg-selected, rgb(30, 100, 200))\"\n : \"var(--ts-ui-radio-bg, var(--ts-ui-form-bg, rgb(255, 255, 255)))\");\n this._ring.setBorder(selected\n ? \"1px solid var(--ts-ui-radio-bg-selected, rgb(30, 100, 200))\"\n : \"1px solid var(--ts-ui-form-border, rgb(160, 160, 160))\");\n\n this._dot.setOpacity(selected ? 1 : 0);\n }\n\n}\n\nconst RadioButtonCallable = callable(RadioButton);\ntype RadioButtonCallable<TOptions extends RadioButtonOptions = RadioButtonOptions> = RadioButton<TOptions>;\nexport {\n RadioButton as _RadioButton,\n RadioButtonCallable as RadioButton\n};\n"],"mappings":"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"}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{t as e}from"./DOM-C-Edb3tA.js";import{l as t,n}from"./Position-BwtxouxK.js";import{S as r,f as i,h as a,m as o,p as s,r as c,t as l,v as u}from"./Component-B0ShfPVi.js";import{t as d}from"./ListenerBag-WPdKuuds.js";import{i as f,r as p}from"./Scrollbar-t8fFrUVQ.js";import{t as m}from"./Container-abY5Ww3W.js";import{t as h}from"./Glyph-_VeBacS2.js";import{t as g}from"./Panel-Cy1pdlWO.js";import{t as _}from"./RovingTabIndex-pHEv5oLD.js";import{a as v,t as y}from"./Tooltip-CUOJOqQi.js";import{t as b}from"./Fit-BhlB-HAo.js";import{n as x,r as S}from"./VBox-DfJPWXqc.js";import{t as C}from"./RadioButton-BEwpqg1k.js";import{c as w,i as T,l as ee,n as E,r as te}from"./CheckboxMenuRow-CesLhSnp.js";import{t as ne}from"./ProgressSpinner-DK8xEQ9y.js";import{t as D}from"./Placement-7kqdaK4Z.js";import{t as O}from"./LayoutConstraints-LIHYYd2F.js";import{t as k}from"./Border-0DJFDiij.js";import{t as A}from"./Header-Dql3Zxc6.js";import{t as j}from"./Button-MpMIYBYJ.js";import{xmark as M}from"./glyphs/solid/xmark.es.js";import{window_maximize as re}from"./glyphs/solid/window_maximize.es.js";import{window_minimize as ie}from"./glyphs/solid/window_minimize.es.js";import{window_restore as ae}from"./glyphs/solid/window_restore.es.js";import{t as oe}from"./TabButton-DLoMQzky.js";import{angle_left as se}from"./glyphs/solid/angle_left.es.js";import{angle_right as ce}from"./glyphs/solid/angle_right.es.js";import{angle_up as le}from"./glyphs/solid/angle_up.es.js";import{angle_down as ue}from"./glyphs/solid/angle_down.es.js";import{i as de,r as N,t as fe}from"./Menu-Q0bpXXze.js";var ButtonGroup=class{buttons=[];_groupId=`bg-`+Math.random().toString(36).slice(2,10);_allowDeselect=!1;_rovingTabIndex=null;_listeners=new d;constructor(e){if(e?.allowDeselect!==void 0&&(this._allowDeselect=e.allowDeselect),e?.buttons!==void 0&&this.addButtons(e.buttons),e?.listeners!==void 0){let t=e.listeners;for(let e of Object.keys(t)){let n=t[e];n!==void 0&&this.on(e,n)}}}updateButtonStates(e){e.isSelected()?this.buttons.forEach(t=>{t!==e&&t.setSelected(!1)}):this._allowDeselect||e.setSelected(!0),this.emit(`selection`,e)}setAllowDeselect(e){return this._allowDeselect=e,this}on(e,t){return this._listeners.add(e,t),this}off(e,t){return this._listeners.remove(e,t),this}emit(e,...t){this._listeners.fire(e,...t)}getButtons(){return this.buttons.slice()}addButtons(...e){for(let t of e){let e=Array.isArray(t)?t:[t];for(let t of e)this.addButton(t)}return this}addButton(e){return this.buttons.push(e),e.on(`action`,()=>{this.updateButtonStates(e)}),e instanceof C&&e.setRadioName(this._groupId),this._rovingTabIndex!==null&&this._rovingTabIndex.add(e),this}removeButton(e){let t=this.buttons.indexOf(e);return t<0?this:(this.buttons.splice(t,1),this._rovingTabIndex!==null&&this._rovingTabIndex.remove(e),this)}setContainer(e){this._rovingTabIndex=new _;for(let e of this.buttons)this._rovingTabIndex.add(e);return r.addSubtreeListener(e,`keydown`,e=>{if(e.key===`ArrowRight`||e.key===`ArrowDown`)this._rovingTabIndex.moveNext();else if(e.key===`ArrowLeft`||e.key===`ArrowUp`)this._rovingTabIndex.movePrev();else return;return{prevent:!0}}),this}},P=a(ButtonGroup),F=function(e){return e[e.NORTH=0]=`NORTH`,e[e.SOUTH=1]=`SOUTH`,e[e.WEST=2]=`WEST`,e[e.EAST=3]=`EAST`,e[e.NORTHWEST=4]=`NORTHWEST`,e[e.SOUTHEAST=5]=`SOUTHEAST`,e[e.SOUTHWEST=6]=`SOUTHWEST`,e[e.NORTHEAST=7]=`NORTHEAST`,e}({}),I=`snap-target`,L={tag:`div`},WindowBorder=class extends l{_direction=0;_listeners=new d;_dragStartListener;_dragStopListener;_fireDragListener;_snapTarget=!1;get snapTargetStyleRule(){return this._snapTargetStyleRule??=this.createStyleRule(`.snap-target`)}constructor(e,t,n){super(t,{...L,...n??{}}),e&&(this._direction=e),this._dragStartListener=this.onDragStart.bind(this),this._dragStopListener=this.onDragStop.bind(this),this._fireDragListener=this._dispatchDrag.bind(this),r.addListener(this,`mousedown`,this._dragStartListener),this.applyListeners(t?.listeners),this.snapTargetStyleRule.set(`boxShadow`,`var(--ts-ui-window-snap-glow, 0 0 0 2px rgba(30, 100, 200, 0.7))`)}getDirection(){return this._direction}setDirection(e){return e||=0,this._direction=e,this}on(e,t){return this._listeners.add(e,t),this}off(e,t){return this._listeners.remove(e,t),this}emit(e,...t){this._listeners.fire(e,...t)}_dispatchDrag(e){return this.emit(`drag`,this,e),!0}isSnapTarget(){return this._snapTarget}setSnapTarget(t){if(this._snapTarget===t)return this;this._snapTarget=t;let n=this.getElement();return n&&e.sink.apply(n,{toggleClass:{[I]:t}}),this}onDragStart(e){e&&!r.isPrimaryButton(e)||(r.addViewportListener(this,`mouseup`,this._dragStopListener),r.addViewportListener(this,`touchend`,this._dragStopListener),r.addViewportListener(this,`touchcancel`,this._dragStopListener),r.addViewportListener(this,`mousemove`,this._fireDragListener),r.addViewportListener(this,`touchmove`,this._fireDragListener),p(this.dragCursor()??`default`))}onDragStop(){return r.removeViewportListener(this,`mouseup`,this._dragStopListener),r.removeViewportListener(this,`touchend`,this._dragStopListener),r.removeViewportListener(this,`touchcancel`,this._dragStopListener),r.removeViewportListener(this,`mousemove`,this._fireDragListener),r.removeViewportListener(this,`touchmove`,this._fireDragListener),f(),this.setSnapTarget(!1),!0}dragCursor(){switch(this._direction){case 0:case 1:return`ns-resize`;case 2:case 3:return`ew-resize`;case 4:case 5:return`nwse-resize`;case 6:case 7:return`nesw-resize`}}render(){let t=super.render(),n=this.dragCursor();return n&&this.setCursor(n),this._snapTarget&&e.sink.apply(t,{addClass:[I]}),t}},R=a(WindowBorder);function createSpinnerWrap(){let e=new l;return e.setLayoutManager(new b({fill:o.NONE})),e.addComponent(new ne(24)),e}var z=4,B=150,V=4,pe=200,H=24,U=26,me={x:50,y:50,width:400,height:300,insets:new n(z,z,z,z),border:`1px solid var(--ts-ui-border-color, black)`,borderRadius:`var(--ts-ui-border-radius, 4px)`,shadow:`var(--ts-ui-window-shadow, 3px 3px 2px rgba(0, 0, 0, 0.4))`,backgroundColor:`var(--ts-ui-body-bg, rgb(241, 241, 241))`,closeable:!0,minimizable:!0,maximizable:!0,maximizeBounds:`viewport`,windowState:`normal`,snapResizeEnabled:!0,snapThreshold:12,snapModifier:`ctrl`,constrainToViewport:!0},he=10,W=class AbstractWindow extends m{static openWindows=new Set;_borderComponents;_animationFrameId=null;_pendingClientX=0;_pendingClientY=0;_pendingBorder=null;_resizeSessionActive=!1;_resizeOriginClientX=0;_resizeOriginClientY=0;_resizeOriginX=0;_resizeOriginY=0;_resizeOriginW=0;_resizeOriginH=0;_resizeFps=60;_lastFlushTime=0;_dragStartLeft=0;_dragStartTop=0;_dragOriginClientX=0;_dragOriginClientY=0;_dragDX=0;_dragDY=0;_dragReachMinX=0;_dragReachMaxX=0;_dragReachMinY=0;_dragReachMaxY=0;_contentFactory=null;_contentReadyCallback=null;_preMinimizeState=`normal`;_restoreRect=null;_bodyHost=null;_rail=null;_windowListeners=new d;_stateAnimHandle=null;_showAnimation=null;_materializeAnimation=null;_closeAnimation=null;_railCollapseAnimation=null;_railExpandAnimation=null;_viewportResizeBound=!1;_snapEnabled=!1;_snapKeysAttached=!1;_snapMoveAttached=!1;_snapTargetBorder=null;_boundOnDrag=e=>this.onDrag(e);_boundOnMouseUp=()=>this.onMouseUp();_boundOnResizeEnd=()=>this.onResizeEnd();_boundOnSnapKeyDown=e=>this.onSnapKeyDown(e);_boundOnSnapKeyUp=e=>this.onSnapKeyUp(e);_boundOnSnapMouseMove=e=>this.onSnapMouseMove(e);_boundOnSnapMouseDown=e=>this.onSnapMouseDown(e);_boundOnViewportResize=()=>this.onViewportResize();_boundOnSnapBlur=()=>this.clearSnapState();_boundOnBorderResize=(e,t)=>this.onResize(e,t);_boundOnBringToFront=()=>this.bringToFront();_boundOnThemeReflow=()=>this.scheduleLayout();constructor(e,t){super(e,{...me,...t??{}}),this.subscribeTheme(this._boundOnThemeReflow),this._borderComponents={west:new R(F.WEST),northwest:new R(F.NORTHWEST),north:new R(F.NORTH),northeast:new R(F.NORTHEAST),east:new R(F.EAST),southeast:new R(F.SOUTHEAST),south:new R(F.SOUTH),southwest:new R(F.SOUTHWEST)},this._borderComponents.west.on(`drag`,this._boundOnBorderResize),this._borderComponents.northwest.on(`drag`,this._boundOnBorderResize),this._borderComponents.north.on(`drag`,this._boundOnBorderResize),this._borderComponents.northeast.on(`drag`,this._boundOnBorderResize),this._borderComponents.east.on(`drag`,this._boundOnBorderResize),this._borderComponents.southeast.on(`drag`,this._boundOnBorderResize),this._borderComponents.south.on(`drag`,this._boundOnBorderResize),this._borderComponents.southwest.on(`drag`,this._boundOnBorderResize);for(let e of Object.values(this._borderComponents))e.setZIndex(he);this.setVisible(!1),this.setContain(`layout`),this.getAria().setTabIndex(-1),r.addSubtreeListener(this,`mousedown`,{button:`any`,handler:this._boundOnBringToFront})}initChrome(e){this._options.contentFactory!==void 0&&this.setContentFactory(this._options.contentFactory,this._options.onReady),this.setCloseable(this.isCloseable()),this.setMinimizable(this.isMinimizable()),this.setMaximizable(this.isMaximizable()),this.setMaximizeBounds(this.getMaximizeBounds()),this.setWindowState(this.getWindowState()),this.wireMoveTrigger(),e?.minSize===void 0&&this.setMinSize({width:this.minContentWidthSeed(),height:200})}applyOptions(e){return super.applyOptions(e),e.headerText!==void 0&&(this._options.headerText=e.headerText),e.glyph!==void 0&&(this._options.glyph=e.glyph),e.contentFactory!==void 0&&(this._options.contentFactory=e.contentFactory),e.onReady!==void 0&&(this._options.onReady=e.onReady),this.setX(e.x??this._defaultOptions.x),this.setY(e.y??this._defaultOptions.y),this.setWidth(e.width??this._defaultOptions.width),this.setHeight(e.height??this._defaultOptions.height),e.closeable!==void 0&&(this._options.closeable=e.closeable),e.minimizable!==void 0&&(this._options.minimizable=e.minimizable),e.maximizable!==void 0&&(this._options.maximizable=e.maximizable),e.maximizeBounds!==void 0&&(this._options.maximizeBounds=e.maximizeBounds),e.windowState!==void 0&&(this._options.windowState=e.windowState),this.setSnapResizeEnabled(e.snapResizeEnabled??this.isSnapResizeEnabled()),this.setSnapThreshold(e.snapThreshold??this.getSnapThreshold()),this.setSnapModifier(e.snapModifier??this.getSnapModifier()),this.setConstrainToViewport(e.constrainToViewport??this.isConstrainToViewport()),this}chromeHeight(){return 0}chromeMinSize(){let e=this.getBorderSize(),t=this.getInsets(),n=(Number(e.left)||0)+(Number(e.right)||0)+t.getLeft(),r=(Number(e.top)||0)+(Number(e.bottom)||0)+t.getTop();return{width:this.minContentWidthSeed()+n,height:(this.chromeHeight()||U)+r}}isChromeComponent(e){return!1}setWidth(e){if(this.getElement()){let t=this.chromeMinSize();e<t.width&&(e=t.width)}return super.setWidth(e)}setHeight(e){if(this.getElement()){let t=this.chromeMinSize();e<t.height&&(e=t.height)}return super.setHeight(e)}show(){let e=this.getElement(!0);if(v.register(this),w(this),this.doLayout(),this.bringToFront(),AbstractWindow.openWindows.add(this),v.mount(e),this.setVisible(!0),this._showAnimation?.cancel(),this._showAnimation=u.play(e,{from:{opacity:`0`,transform:`scale(0.97)`},to:{opacity:`1`,transform:`scale(1)`},durationMs:B,properties:[`opacity`,`transform`]}),this._contentFactory){let e=this._contentFactory,t=this._contentReadyCallback;this._contentFactory=null,this._contentReadyCallback=null;let n=createSpinnerWrap();this._materializeAnimation?.cancel(),this._materializeAnimation=u.materialize({host:this,factory:e,spinnerComponent:n,onReady:e=>{this._bodyHost=e,t&&t(e)}})}else this._bodyHost=this.findBodyHost();return this.isSnapResizeEnabled()&&this.attachSnapKeyboardListeners(),this}setContentFactory(e,t){return this._contentFactory=e,this._contentReadyCallback=t??null,this}bringToFront(){v.bringToFront(this)}getLayerElement(){return this.getElement()??null}getDismissMode(){return`manual`}onActivate(e){this.paintActive(e),e&&(this.focusSelf(),this.emit(`activate`))}focusSelf(){let t=this.getElement();!t||e.source.contains(t,e.source.getActiveElement())||this.focus(!0)}requestClose(){this.onExitAction()}getBand(){return v.Band.Window}isLayerRoot(){return!0}onZIndexChanged(e){this.setZIndex(e)}onExitAction(){this.emit(`close`),this._animationFrameId!==null&&(e.sink.cancelAnimationFrame(this._animationFrameId),this._animationFrameId=null),this._stateAnimHandle?.cancel(),this._stateAnimHandle=null,this._contentFactory=null,this._contentReadyCallback=null,this.detachSnapKeyboardListeners(),this.detachSnapMouseListeners(),this.detachViewportResizeListener(),this.clearSnapTargetBorder(),v.unregister(this),ee(this),AbstractWindow.openWindows.delete(this),AbstractWindow.relayoutMinimizedStack();let t=this.getElement(),finalize=()=>{this.setVisible(!1),this.destructor()};if(!t){finalize();return}this._closeAnimation?.cancel(),this._closeAnimation=u.play(t,{to:{opacity:`0`,transform:`scale(0.97)`},durationMs:B,properties:[`opacity`,`transform`],onComplete:finalize})}destructor(){this._stateAnimHandle?.cancel(),this._stateAnimHandle=null,this._showAnimation?.cancel(),this._showAnimation=null,this._materializeAnimation?.cancel(),this._materializeAnimation=null,this._closeAnimation?.cancel(),this._closeAnimation=null,this._railCollapseAnimation?.cancel(),this._railCollapseAnimation=null,this._railExpandAnimation?.cancel(),this._railExpandAnimation=null;for(let e of Object.values(this._borderComponents))e.dispose();super.destructor()}getWindowState(){return this._options.windowState??this._defaultOptions.windowState}static getOpenWindows(){return Array.from(AbstractWindow.openWindows)}getRect(){return this.currentRect()}applyRect(e){return this.setX(e.x),this.setY(e.y),this.setWidth(e.width),this.setHeight(e.height),this}getRestoreRect(){return this._restoreRect}setWindowState(t){let n=this.getWindowState();if(n===t)return this;if(this._animationFrameId!==null&&(e.sink.cancelAnimationFrame(this._animationFrameId),this._animationFrameId=null),this._options.windowState=t,n===`minimized`&&this._rail!==null&&(this.setDisplayed(!0),this.animateRailExpand()),t===`normal`){this.setBodyHostDisplayed(!0),this.reflectMaximizeState(`normal`);let e=this._restoreRect??this.currentRect();this._restoreRect=null,this.detachViewportResizeListener(),this.animateRect(e,()=>AbstractWindow.relayoutMinimizedStack())}else if(t===`minimized`){if(n===`normal`&&(this._restoreRect=this.currentRect()),this._preMinimizeState=n===`maximized`?`maximized`:`normal`,this.reflectMaximizeState(`minimized`),this.detachViewportResizeListener(),this._rail!==null)this.animateRailCollapse(()=>{this.setDisplayed(!1),this.emit(`minimize`)});else{let e=this.computeDockRect();this.animateRect(e,()=>{this.setBodyHostDisplayed(!1),AbstractWindow.relayoutMinimizedStack()}),this.emit(`minimize`)}}else{n===`normal`&&(this._restoreRect=this.currentRect()),this.setBodyHostDisplayed(!0),this.reflectMaximizeState(`maximized`);let e=this.computeMaximizeRect();this.animateRect(e,()=>{this.attachViewportResizeListener(),AbstractWindow.relayoutMinimizedStack()})}return n===`minimized`&&t!==`minimized`&&this.emit(`restore`),this}isMaximized(){return this.getWindowState()===`maximized`}isMinimized(){return this.getWindowState()===`minimized`}toggleMinimize(){this.isMinimizable()&&(this.getWindowState()===`minimized`?this.setWindowState(`normal`):this.setWindowState(`minimized`))}minimize(){return this.setWindowState(`minimized`)}restore(){return this.isMinimized()?(this.setWindowState(this._preMinimizeState),this.bringToFront(),this.focus(!0),this):this}setRail(e){return this._rail===e?this:(this._rail!==null&&this._rail.unregisterWindow(this),this._rail=e,e!==null&&e.registerWindow(this),this)}getRail(){return this._rail}getGlyph(){return this._options.glyph}on(e,t){return this._windowListeners.add(e,t),this}off(e,t){return this._windowListeners.remove(e,t),this}emit(e){this._windowListeners.fire(e)}toggleMaximize(){this.isMaximizable()&&(this.getWindowState()===`maximized`?this.setWindowState(`normal`):this.setWindowState(`maximized`))}setCloseable(e){return this._options.closeable=e,this.reflectCloseable(e),this}isCloseable(){return this._options.closeable??this._defaultOptions.closeable}setMinimizable(e){return this._options.minimizable=e,this.reflectMinimizable(e),this}isMinimizable(){return this._options.minimizable??this._defaultOptions.minimizable}setMaximizable(e){return this._options.maximizable=e,this.reflectMaximizable(e),this}isMaximizable(){return this._options.maximizable??this._defaultOptions.maximizable}setMaximizeBounds(e){return this._options.maximizeBounds=e,this}getMaximizeBounds(){return this._options.maximizeBounds??this._defaultOptions.maximizeBounds}setSnapResizeEnabled(e){return this._options.snapResizeEnabled===e?this:(this._options.snapResizeEnabled=e,e?this.getElement()&&this.attachSnapKeyboardListeners():(this.clearSnapState(),this.detachSnapKeyboardListeners()),this)}isSnapResizeEnabled(){return this._options.snapResizeEnabled??this._defaultOptions.snapResizeEnabled}setConstrainToViewport(e){return this._options.constrainToViewport=e,this}isConstrainToViewport(){return this._options.constrainToViewport??this._defaultOptions.constrainToViewport}setSnapThreshold(e){return this._options.snapThreshold=e,this}getSnapThreshold(){return this._options.snapThreshold??this._defaultOptions.snapThreshold}setSnapModifier(e){return this._options.snapModifier=e,this}getSnapModifier(){return this._options.snapModifier??this._defaultOptions.snapModifier}onMouseDown(e){this.startMoveFrom(e)}startMoveFrom(e){r.isPrimaryButton(e)&&(e.shiftKey||this.getWindowState()===`normal`&&(this._dragStartLeft=this.getX(),this._dragStartTop=this.getY(),this._dragOriginClientX=e.clientX,this._dragOriginClientY=e.clientY,this._dragDX=0,this._dragDY=0,this._dragReachMinX=this._dragStartLeft,this._dragReachMaxX=this._dragStartLeft,this._dragReachMinY=this._dragStartTop,this._dragReachMaxY=this._dragStartTop,this.setWillChange(`transform`),r.addViewportListener(this,`mouseup`,this._boundOnMouseUp),r.addViewportListener(this,`mousemove`,this._boundOnDrag)))}onResize(t,n){this.getWindowState()===`normal`&&(n.preventDefault(),this._resizeSessionActive||(this._resizeSessionActive=!0,this._resizeOriginClientX=n.clientX,this._resizeOriginClientY=n.clientY,this._resizeOriginX=this.getX(),this._resizeOriginY=this.getY(),this._resizeOriginW=this.getWidth(),this._resizeOriginH=this.getHeight(),r.addViewportListener(this,`mouseup`,this._boundOnResizeEnd),r.addViewportListener(this,`touchend`,this._boundOnResizeEnd),r.addViewportListener(this,`touchcancel`,this._boundOnResizeEnd)),this._pendingClientX=n.clientX,this._pendingClientY=n.clientY,this._pendingBorder=t,this._animationFrameId===null&&(this._animationFrameId=e.sink.requestAnimationFrame(e=>this.flushResize(e))))}onResizeEnd(){return this._resizeSessionActive=!1,r.removeViewportListener(this,`mouseup`,this._boundOnResizeEnd),r.removeViewportListener(this,`touchend`,this._boundOnResizeEnd),r.removeViewportListener(this,`touchcancel`,this._boundOnResizeEnd),!0}getResizeFps(){return this._resizeFps}setResizeFps(e){return this._resizeFps=e,this}flushResize(t){if(t-this._lastFlushTime<1e3/this._resizeFps){this._animationFrameId=e.sink.requestAnimationFrame(e=>this.flushResize(e));return}this._lastFlushTime=t,this._animationFrameId=null;let n=this._pendingBorder;if(this._pendingBorder=null,!n)return;let r=this._pendingClientX-this._resizeOriginClientX,i=this._pendingClientY-this._resizeOriginClientY,a=this._resizeOriginX+this._resizeOriginW,o=this._resizeOriginY+this._resizeOriginH,s=e.source.getViewportSize(),c=s.width-this._resizeOriginX,l=a,u=s.height-this._resizeOriginY,d=o;switch(this.setAutoCommitStyle(!1),n.getDirection()){case F.NORTHWEST:this.setWidth(Math.min(this._resizeOriginW-r,l)),this.setHeight(Math.min(this._resizeOriginH-i,d)),this.setX(a-this.getWidth()),this.setY(o-this.getHeight());break;case F.NORTH:this.setHeight(Math.min(this._resizeOriginH-i,d)),this.setY(o-this.getHeight());break;case F.NORTHEAST:this.setWidth(Math.min(this._resizeOriginW+r,c)),this.setHeight(Math.min(this._resizeOriginH-i,d)),this.setY(o-this.getHeight());break;case F.EAST:this.setWidth(Math.min(this._resizeOriginW+r,c));break;case F.SOUTHEAST:this.setWidth(Math.min(this._resizeOriginW+r,c)),this.setHeight(Math.min(this._resizeOriginH+i,u));break;case F.SOUTH:this.setHeight(Math.min(this._resizeOriginH+i,u));break;case F.SOUTHWEST:this.setWidth(Math.min(this._resizeOriginW-r,l)),this.setHeight(Math.min(this._resizeOriginH+i,u)),this.setX(a-this.getWidth());break;case F.WEST:this.setWidth(Math.min(this._resizeOriginW-r,l)),this.setX(a-this.getWidth())}this.doLayout(),this.setAutoCommitStyle(!0)}viewportPositionBounds(){let t=this.getWidth(),n=e.source.getViewportSize(),r=n.width,i=n.height;if(this.isConstrainToViewport())return{minX:0,maxX:r-t,minY:0,maxY:i-this.getHeight()};let a=this.chromeHeight()||U;return{minX:H-t,maxX:r-H,minY:0,maxY:i-a}}clampDragDelta(){let{minX:e,maxX:n,minY:r,maxY:i}=this.viewportPositionBounds(),a=Math.max(n,this._dragReachMinX),o=Math.min(e,this._dragReachMaxX),s=Math.max(i,this._dragReachMinY),c=Math.min(r,this._dragReachMaxY),l=this._dragStartLeft+this._dragDX,u=this._dragStartTop+this._dragDY,d=t.clamp(l,o,a),f=t.clamp(u,c,s);this._dragReachMinX=Math.min(this._dragReachMinX,d),this._dragReachMaxX=Math.max(this._dragReachMaxX,d),this._dragReachMinY=Math.min(this._dragReachMinY,f),this._dragReachMaxY=Math.max(this._dragReachMaxY,f),this._dragDX=d-this._dragStartLeft,this._dragDY=f-this._dragStartTop}clampPositionToViewport(){let{minX:e,maxX:t,minY:n,maxY:r}=this.viewportPositionBounds();return this.setX(Math.max(Math.min(this.getX(),t),e)),this.setY(Math.max(Math.min(this.getY(),r),n)),this}onDrag(e){return this._dragDX=e.clientX-this._dragOriginClientX,this._dragDY=e.clientY-this._dragOriginClientY,this.clampDragDelta(),this.setTranslate(this._dragDX,this._dragDY),{stop:!0,prevent:!0}}onMouseUp(){return this.setX(this._dragStartLeft+this._dragDX),this.setY(this._dragStartTop+this._dragDY),this.setTranslate(0,0),this.setWillChange(null),r.removeViewportListener(this,`mouseup`,this._boundOnMouseUp),r.removeViewportListener(this,`mousemove`,this._boundOnDrag),!0}doLayout(){super.doLayout();let e=this.getBorderSize(),t=this.getInsets(),n=(Number(e.left)||0)+(Number(e.right)||0)+t.getLeft(),r=(Number(e.top)||0)+(Number(e.bottom)||0)+t.getTop(),i=this.getSize();if(!i)throw Error(`Component doesn't seem to be rendered.`);let a=this.getInnerSize();if(!a)throw Error(`Component doesn't seem to be rendered.`);return this._borderComponents.west.setAutoCommitStyle(!1),this._borderComponents.northwest.setAutoCommitStyle(!1),this._borderComponents.north.setAutoCommitStyle(!1),this._borderComponents.northeast.setAutoCommitStyle(!1),this._borderComponents.east.setAutoCommitStyle(!1),this._borderComponents.southeast.setAutoCommitStyle(!1),this._borderComponents.south.setAutoCommitStyle(!1),this._borderComponents.southwest.setAutoCommitStyle(!1),this._borderComponents.west.setX(0),this._borderComponents.west.setY(t.getTop()),this._borderComponents.west.setWidth(t.getLeft()),this._borderComponents.west.setHeight(a.height),this._borderComponents.northwest.setX(0),this._borderComponents.northwest.setY(0),this._borderComponents.northwest.setWidth(t.getLeft()),this._borderComponents.northwest.setHeight(t.getTop()),this._borderComponents.north.setX(t.getLeft()),this._borderComponents.north.setY(0),this._borderComponents.north.setWidth(a.width),this._borderComponents.north.setHeight(t.getTop()),this._borderComponents.northeast.setX(i.width-n),this._borderComponents.northeast.setY(0),this._borderComponents.northeast.setWidth(t.getRight()),this._borderComponents.northeast.setHeight(t.getTop()),this._borderComponents.east.setX(i.width-n),this._borderComponents.east.setY(t.getTop()),this._borderComponents.east.setWidth(t.getRight()),this._borderComponents.east.setHeight(a.height),this._borderComponents.southeast.setX(i.width-n),this._borderComponents.southeast.setY(i.height-r),this._borderComponents.southeast.setWidth(t.getRight()),this._borderComponents.southeast.setHeight(t.getBottom()),this._borderComponents.south.setX(t.getLeft()),this._borderComponents.south.setY(i.height-r),this._borderComponents.south.setWidth(a.width),this._borderComponents.south.setHeight(t.getRight()),this._borderComponents.southwest.setX(0),this._borderComponents.southwest.setY(i.height-r),this._borderComponents.southwest.setWidth(t.getLeft()),this._borderComponents.southwest.setHeight(t.getBottom()),this._borderComponents.west.setAutoCommitStyle(!0),this._borderComponents.northwest.setAutoCommitStyle(!0),this._borderComponents.north.setAutoCommitStyle(!0),this._borderComponents.northeast.setAutoCommitStyle(!0),this._borderComponents.east.setAutoCommitStyle(!0),this._borderComponents.southeast.setAutoCommitStyle(!0),this._borderComponents.south.setAutoCommitStyle(!0),this._borderComponents.southwest.setAutoCommitStyle(!0),this}render(){let t=super.render();return e.sink.appendChild(t,this._borderComponents.west.getElement(!0)),e.sink.appendChild(t,this._borderComponents.northwest.getElement(!0)),e.sink.appendChild(t,this._borderComponents.north.getElement(!0)),e.sink.appendChild(t,this._borderComponents.northeast.getElement(!0)),e.sink.appendChild(t,this._borderComponents.east.getElement(!0)),e.sink.appendChild(t,this._borderComponents.southeast.getElement(!0)),e.sink.appendChild(t,this._borderComponents.south.getElement(!0)),e.sink.appendChild(t,this._borderComponents.southwest.getElement(!0)),t}currentRect(){return{x:this.getX(),y:this.getY(),width:this.getWidth(),height:this.getHeight()}}findBodyHost(){let e=this.getComponents();for(let t of e)if(!this.isChromeComponent(t))return t;return null}setBodyHostDisplayed(e){this._bodyHost||=this.findBodyHost(),this._bodyHost&&this._bodyHost.setDisplayed(e)}computeMaximizeRect(){if(this.getMaximizeBounds()===`parent`){let t=this.getElement(),n=t?e.source.getParentElement(t):null;if(n&&n!==e.source.getDocumentElement()){let t=e.source.getElementRect(n);return{x:0,y:0,width:t.width,height:t.height}}}let t=e.source.getViewportSize();return{x:0,y:0,width:t.width,height:t.height}}computeDockRect(){let t=this.getMinDockWidth(),n=this.computeDockSlotIndex(),r=this.chromeHeight()||U;return{x:n*(t+V),y:e.source.getViewportSize().height-r,width:t,height:r}}railGenieTransform(){let t=this._rail,n=t.getThickness(),r=this.currentRect(),i=Math.min(.5,n/Math.max(r.width,1)),a=t.getEdge(),o=a===D.EAST||a===D.WEST,s=t.handleMainAxisOffset(this),c=t.handleMainAxisExtent(this),l=(o?r.height:r.width)*i,u=c>0?s+(c-l)/2:s,d=0,f=0;switch(a){case D.EAST:d=e.source.getViewportSize().width-n,f=u;break;case D.WEST:f=u;break;case D.SOUTH:d=u,f=e.source.getViewportSize().height-n;break;case D.NORTH:d=u;break;default:f=u}return`translate(${d-r.x}px, ${f-r.y}px) scale(${i})`}animateRailCollapse(e){let t=this.getElement();if(!t){e();return}this._railCollapseAnimation?.cancel(),this._railCollapseAnimation=u.play(t,{from:{transformOrigin:`0 0`,transform:`translate(0, 0) scale(1)`,opacity:`1`},to:{transform:this.railGenieTransform(),opacity:`0`},durationMs:B,properties:[`transform`,`opacity`],onComplete:e})}animateRailExpand(){let e=this.getElement();e&&(this._railExpandAnimation?.cancel(),this._railExpandAnimation=u.play(e,{from:{transformOrigin:`0 0`,transform:this.railGenieTransform(),opacity:`0`},to:{transform:`translate(0, 0) scale(1)`,opacity:`1`},durationMs:B,properties:[`transform`,`opacity`]}))}getMinDockWidth(){let t=e.source.getThemeVar(`--ts-ui-window-min-dock-width`);if(t){let e=parseFloat(t);if(!isNaN(e)&&e>0)return e}return pe}computeDockSlotIndex(){let e=0;for(let t of AbstractWindow.openWindows){if(t===this)return e;t.getWindowState()===`minimized`&&e++}return e}static relayoutMinimizedStack(){let t=0;for(let n of AbstractWindow.openWindows){if(n.getWindowState()!==`minimized`)continue;let r=n.getMinDockWidth(),i=n.chromeHeight()||U,a=t*(r+V),o=e.source.getViewportSize().height-i;n.setAutoCommitStyle(!1),n.setX(a),n.setY(o),n.setWidth(r),n.setHeight(i),n.doLayout(),n.setAutoCommitStyle(!0),t++}}animateRect(e,t){this._stateAnimHandle?.cancel(),this._stateAnimHandle=null;let commit=e=>{this.setAutoCommitStyle(!1),this.setX(e.x),this.setY(e.y),this.setWidth(e.width),this.setHeight(e.height),this.doLayout(),this.setAutoCommitStyle(!0)};this._stateAnimHandle=u.tween({from:this.currentRect(),to:e,durationMs:B,onStep:commit,onComplete:()=>{this._stateAnimHandle=null,t?.()}})}attachViewportResizeListener(){this._viewportResizeBound||=(r.addViewportListener(this,`resize`,this._boundOnViewportResize),!0)}detachViewportResizeListener(){this._viewportResizeBound&&=(r.removeViewportListener(this,`resize`,this._boundOnViewportResize),!1)}onViewportResize(){if(this.getWindowState()!==`maximized`)return;let e=this.computeMaximizeRect();this.setAutoCommitStyle(!1),this.setX(e.x),this.setY(e.y),this.setWidth(e.width),this.setHeight(e.height),this.doLayout(),this.setAutoCommitStyle(!0),AbstractWindow.relayoutMinimizedStack()}attachSnapKeyboardListeners(){this._snapKeysAttached||=(r.addViewportListener(this,`keydown`,this._boundOnSnapKeyDown),r.addViewportListener(this,`keyup`,this._boundOnSnapKeyUp),r.addViewportListener(this,`blur`,this._boundOnSnapBlur),!0)}detachSnapKeyboardListeners(){this._snapKeysAttached&&=(r.removeViewportListener(this,`keydown`,this._boundOnSnapKeyDown),r.removeViewportListener(this,`keyup`,this._boundOnSnapKeyUp),r.removeViewportListener(this,`blur`,this._boundOnSnapBlur),!1)}attachSnapMouseListeners(){this._snapMoveAttached||=(r.addViewportListener(this,`mousemove`,this._boundOnSnapMouseMove),r.addViewportListener(this,`mousedown`,this._boundOnSnapMouseDown),!0)}detachSnapMouseListeners(){this._snapMoveAttached&&=(r.removeViewportListener(this,`mousemove`,this._boundOnSnapMouseMove),r.removeViewportListener(this,`mousedown`,this._boundOnSnapMouseDown),!1)}clearSnapTargetBorder(){this._snapTargetBorder&&=(this._snapTargetBorder.setSnapTarget(!1),null)}clearSnapState(){this._snapEnabled=!1,this.detachSnapMouseListeners(),this.clearSnapTargetBorder()}onSnapKeyDown(e){this.isSnapResizeEnabled()&&this.getWindowState()===`normal`&&this.modifierMatches(e)&&(this._snapEnabled||(this._snapEnabled=!0,this.attachSnapMouseListeners()))}onSnapKeyUp(e){this._snapEnabled&&(this.modifierStillHeld(e)||this.clearSnapState())}modifierMatches(e){switch(this.getSnapModifier()){case`ctrl`:return e.ctrlKey;case`meta`:return e.metaKey;case`alt`:return e.altKey;case`shift`:return e.shiftKey}}modifierStillHeld(e){return this.modifierMatches(e)}onSnapMouseMove(e){if(!this._snapEnabled)return;let t=this.pickSnapBorder(e.clientX,e.clientY);t!==this._snapTargetBorder&&(this._snapTargetBorder&&this._snapTargetBorder.setSnapTarget(!1),this._snapTargetBorder=t,t&&t.setSnapTarget(!0))}pickSnapBorder(t,n){let r=[this._borderComponents.northwest,this._borderComponents.northeast,this._borderComponents.southeast,this._borderComponents.southwest,this._borderComponents.north,this._borderComponents.east,this._borderComponents.south,this._borderComponents.west],i=null,a=this.getSnapThreshold();for(let o of r){let r=o.getElement();if(!r)continue;let s=e.source.getElementRect(r),c=Math.max(s.left-t,0,t-s.right),l=Math.max(s.top-n,0,n-s.bottom),u=Math.hypot(c,l);u<=a&&(i=o,a=u)}return i}onSnapMouseDown(t){let n=this._snapTargetBorder;if(!n)return;let r=n.getElement();if(r&&e.source.isNode(t.target)&&e.source.contains(r,e.source.intern(t.target))){this._snapTargetBorder=null;return}return n.onDragStart(t),this._snapTargetBorder=null,!0}},ge=[{suffix:``,styles:{background:`var(--ts-ui-window-control-bg)`,border:`var(--ts-ui-window-control-border)`,boxShadow:`var(--ts-ui-window-control-shadow)`}},{suffix:`:hover:not(.pressed)`,styles:{background:`var(--ts-ui-window-control-hover-bg)`}},{suffix:`.pressed`,styles:{background:`var(--ts-ui-window-control-active-bg)`}}],_e=[{suffix:``,styles:{background:`transparent`,border:`1px solid transparent`,boxShadow:`none`}}];function createWindowControlButton(e){return new j({glyph:e,chromeless:!0,styleRules:ge,insets:new n(2,2,2,2)})}function createWindowLeadGlyphButton(e){let t=new j({glyph:e,chromeless:!0,styleRules:_e,insets:new n(2,2,2,2)});return t.setPointerEvents(`none`),t}function setWindowControlsActive(e,t){let n=t?`var(--ts-ui-window-control-bg)`:`transparent`;for(let t of e)t.setBackground(n)}h.register(M,re,ie,ae);var WindowHeader=class extends A{_exitButton;_minimizeButton;_maximizeButton;_trailingRow;_activeBackground;_titleGlyph=null;_titleRow;_closeable=!0;_minimizable=!0;_maximizable=!0;constructor(e,t){super(e),this._activeBackground=`var(--ts-ui-window-header-bg, #eee)`,this.setBackgroundColor(this._activeBackground),this.setInsets(new n(0,4,0,4));let r=this.getText();this.removeComponent(r),this._titleRow=new l,this._titleRow.setLayoutManager(new S({spacing:8})),this._titleRow.setInsets(new n(0,0,0,5)),this._titleRow.setPointerEvents(`none`),this._titleRow.addComponent(r);let i=new l;i.setLayoutManager(new b({fill:o.HORIZONTAL})),i.setPointerEvents(`none`),i.addComponent(this._titleRow),this.addComponent(i,{placement:D.WEST,anchor:s.WEST,fill:o.HORIZONTAL}),this._minimizeButton=createWindowControlButton(`window-minimize`),this._maximizeButton=createWindowControlButton(`window-maximize`),this._exitButton=createWindowControlButton(`xmark`);for(let e of[this._minimizeButton,this._maximizeButton,this._exitButton])e.setInsets(new n(0,4,0,4));this._trailingRow=new l,this._trailingRow.setLayoutManager(new S({spacing:0,stretching:!0})),this._trailingRow.setInsets(new n(0,0,0,0)),this._trailingRow.addComponent(this._minimizeButton),this._trailingRow.addComponent(this._maximizeButton),this._trailingRow.addComponent(this._exitButton),this.addComponent(this._trailingRow,{placement:D.EAST}),t?.glyph===void 0&&this.setGlyph(`window-maximize`),t&&this.applyOptions(t)}updatePreferredSize(){let e=this.getText().getPreferredSize(),t=e?e.height:20;if(this.setPreferredSize({width:100,height:t+8}),this._titleGlyph){let e=this.resolveTitleGlyphInk();this._titleGlyph.setPreferredSize({width:e,height:e})}}resolveTitleGlyphInk(){return c.getResolvedScale().titleGlyph}applyOptions(e){return super.applyOptions(e),e.closeable!==void 0&&this.setCloseable(e.closeable),e.minimizable!==void 0&&this.setMinimizable(e.minimizable),e.maximizable!==void 0&&this.setMaximizable(e.maximizable),e.glyph!==void 0&&this.setGlyph(e.glyph),this}setGlyph(e){this._titleGlyph&&=(this._titleRow.removeComponent(this._titleGlyph),null);let t=new h(e),n=this.resolveTitleGlyphInk();return t.setPreferredSize({width:n,height:n}),t.setPointerEvents(`none`),this._titleGlyph=t,this._titleRow.insertComponent(t,0),this}clearGlyph(){return this._titleGlyph&&=(this._titleRow.removeComponent(this._titleGlyph),null),this}getGlyph(){return this._titleGlyph}setActive(e){return this.setBackgroundColor(e?this._activeBackground:`var(--ts-ui-gutter-bg, rgb(200, 200, 200))`),setWindowControlsActive([this._minimizeButton,this._maximizeButton,this._exitButton],e),this}setCloseable(e){return this._closeable=e,this._exitButton.setEnabled(e),this}isCloseable(){return this._closeable}setMinimizable(e){return this._minimizable=e,this._minimizeButton.setVisible(e),this}isMinimizable(){return this._minimizable}setMaximizable(e){return this._maximizable=e,this._maximizeButton.setVisible(e),this}isMaximizable(){return this._maximizable}setMaximizeButtonGlyph(e){return this._maximizeButton.setGlyph(e),this}setMinimizeButtonGlyph(e){return this._minimizeButton.setGlyph(e),this}addExitButtonListener(e){return this._exitButton.on(`action`,e),this}addMinimizeButtonListener(e){return this._minimizeButton.on(`action`,e),this}addMaximizeButtonListener(e){return this._maximizeButton.on(`action`,e),this}addHeaderDoubleClickListener(e){return r.addSubtreeListener(this,`dblclick`,e),this}getMinContentWidth(e=100){let t=this._titleGlyph?.getPreferredSize()?.width??0,n=this._trailingRow.getPreferredSize()?.width??0;return t+e+n}getMinimizeButtonElement(){return this._minimizeButton.getElement()}getMaximizeButtonElement(){return this._maximizeButton.getElement()}getExitButtonElement(){return this._exitButton.getElement()}},G=a(WindowHeader),Window=class extends W{_header;_headerDragShift=!1;_headerDragComponentId=``;_boundCaptureHeaderShift=e=>this.captureHeaderShift(e);_boundOnHeaderMouseDown=e=>this.onHeaderMouseDown(e);constructor(e,t){super(t),this.setLayoutManager(new k);let n=this._options.headerText??e??`Window`;this._header=new G(n),this.addComponent(this._header,{placement:D.NORTH,ignoreParentInsets:!0}),this._header.addExitButtonListener(()=>this.onExitAction()),this._header.addMinimizeButtonListener(()=>this.toggleMinimize()),this._header.addMaximizeButtonListener(()=>this.toggleMaximize()),this._header.addHeaderDoubleClickListener(e=>this.onHeaderDoubleClick(e)),this._options.glyph!==void 0&&this._header.setGlyph(this._options.glyph),this.initChrome(t)}getHeader(){return this._header}setHeaderText(e){if(!this._header)throw Error(`Window does not have a header.`);return this._header.getText().setText(e),this}setGlyph(e){return this._options.glyph=e,this._header.setGlyph(e),this}wireMoveTrigger(){r.addSubtreeListener(this._header,`mousedown`,this._boundOnHeaderMouseDown),r.addSubtreeListener(this._header,`mousedown`,this._boundCaptureHeaderShift),E.makeDragSource(this._header,{dragData:()=>this.buildHeaderDragData(),onDragStart:()=>this.onHeaderDragStart(),onDragEnd:(e,t)=>this.onHeaderDragEnd(t)})}reflectCloseable(e){this._header.setCloseable(e)}reflectMinimizable(e){this._header.setMinimizable(e)}reflectMaximizable(e){this._header.setMaximizable(e)}reflectMaximizeState(e){this._header.setMaximizeButtonGlyph(e===`maximized`?`window-restore`:`window-maximize`),this._header.setMinimizeButtonGlyph(e===`minimized`?`window-restore`:`window-minimize`)}paintActive(e){this._header.setActive(e)}getTitle(){return String(this._header.getText().getText())}minContentWidthSeed(){return this._header.getMinContentWidth()}chromeHeight(){return this._header.getHeight()}addContent(e){this.addComponent(e,{placement:D.CENTER})}isChromeComponent(e){return e===this._header}onHeaderMouseDown(t){let n=t.target===null?null:e.source.intern(t.target);n&&this.targetIsInTrailingButton(n)||this.onMouseDown(t)}onHeaderDoubleClick(t){let n=t.target===null?null:e.source.intern(t.target);if(!(n&&this.targetIsInTrailingButton(n))){if(this.getWindowState()===`minimized`){this.setWindowState(this._preMinimizeState);return}this.isMaximizable()&&this.toggleMaximize()}}targetIsInTrailingButton(t){let n=[this._header.getMinimizeButtonElement(),this._header.getMaximizeButtonElement(),this._header.getExitButtonElement()];for(let r of n)if(r&&e.source.contains(r,t))return!0;return!1}captureHeaderShift(e){this._headerDragShift=e.shiftKey}buildHeaderDragData(){let e=this.findBodyHost();return{tabDrag:!0,sourceTabId:this.getId(),componentId:e?e.getId():``,label:String(this._header.getText().getText())}}onHeaderDragStart(){let e=this._headerDragShift;this._headerDragShift=!1;let t=this.findBodyHost();if(!e||!t)return!1;this._headerDragComponentId=t.getId(),T.set(t.getId(),t)}onHeaderDragEnd(e){T.delete(this._headerDragComponentId),this._headerDragComponentId=``,e&&this.findBodyHost()===null&&this.requestClose()}},K=a(Window);h.register(se,ce,le,ue);var ve=24,ye=80,be={backgroundColor:`transparent`},ScrollStrip=class extends g{_stepProvider=null;_clip=new g;_leadArrow=null;_trailArrow=null;constructor(e,t){super(e,{...be,...t??{}}),this._orientation??=`horizontal`,this._scrollable??=!0,this._arrowBackground??=null,this._arrowStep??=ye,this.setScrollbarStyle(`native`),this.clearInsets(),this._clip.setOverflow(`hidden`),this._clip.setBackgroundColor(`transparent`),this._clip.clearInsets(),this.installBox(this._orientation)}init(t){super.init(t);let n=t??this.getElement(!0);return e.sink.appendChild(n,this._clip.getElement(!0)),this}applyOptions(e){return super.applyOptions(e),e.orientation!==void 0&&this.setOrientation(e.orientation),e.scrollable!==void 0&&this.setScrollable(e.scrollable),e.arrowBackground!==void 0&&this.setArrowBackground(e.arrowBackground),e.arrowStep!==void 0&&this.setArrowStep(e.arrowStep),this}installBox(e){if(!this._clip)return;let t=e===`vertical`?new x({mode:`equal`,spacing:0,stretching:!0}):new S({mode:`equal`,spacing:0,stretching:!0});this._clip.setLayoutManager(t)}isVertical(){return this._orientation===`vertical`}setOrientation(e){return this._orientation===e?this:(this._orientation=e,this.installBox(e),this)}getOrientation(){return this._orientation}setScrollable(e){return this._scrollable=e,this}isScrollable(){return this._scrollable}setArrowBackground(e){return this._arrowBackground=e,this._leadArrow?.setBackgroundColor(e),this._trailArrow?.setBackgroundColor(e),this}setArrowStep(e){return this._arrowStep=e,this}setStepProvider(e){return this._stepProvider=e,this}resolveStep(){return this._stepProvider?this._stepProvider():this._arrowStep}addItem(e){return this._clip.addComponent(e),this}removeItem(e){return this._clip.removeComponent(e),this}moveItem(e,t){return this._clip.moveComponent(e,t),this}getItems(){return this._clip.getComponents()}getContentBox(){return this._clip.getLayoutManager()}layoutItems(){return this._clip.doLayout(),this._clip.syncScrollOffsets(),this}getClipElement(e){return this._clip.getElement(e)??null}arrowReserve(e,t){return this._scrollable&&e>t+1?ve:0}ensureArrows(){if(this._leadArrow&&this._trailArrow)return;let t=new j({glyph:`angle-left`}),n=new j({glyph:`angle-right`});for(let e of[t,n])this._arrowBackground!==null&&e.setBackgroundColor(this._arrowBackground),e.setBackgroundImage(`none`),e.clearBorder(),e.clearShadow(),e.setBorderRadius(`0`),e.clearInsets(),e.setZIndex(3);t.on(`action`,this.leadClicked),n.on(`action`,this.trailClicked);let r=this.getElement(!0);e.sink.appendChild(r,t.getElement(!0)),e.sink.appendChild(r,n.getElement(!0)),this._leadArrow=t,this._trailArrow=n}layoutContent(e,t){let r=this.getContentBounds()??{x:0,y:0,width:this.getWidth()||0,height:this.getHeight()||0},i=this.isVertical(),a=i?r.height:r.width,o=i?r.width:r.height,s=a-2*e;return i?(this._clip.setX(r.x),this._clip.setY(r.y+e),this._clip.setWidth(o),this._clip.setHeight(s),this._clip.setInsets(new n(t,0,0,0))):(this._clip.setX(r.x+e),this._clip.setY(r.y),this._clip.setWidth(s),this._clip.setHeight(o),this._clip.setInsets(new n(0,0,0,t))),this.layoutItems(),this.layoutArrows(r,e),this}layoutArrows(e,t){if(!this._scrollable||t<=0){this.hideArrows();return}this.ensureArrows();let n=this._leadArrow,r=this._trailArrow,i=this.isVertical(),a=i?e.height:e.width,o=i?e.width:e.height;n.setGlyph(i?`angle-up`:`angle-left`),r.setGlyph(i?`angle-down`:`angle-right`),n.setVisible(!0),r.setVisible(!0),this.refreshArrows();let s=(i?e.y:e.x)+a-t;for(let a of[n,r])i?(a.setMinSize({width:0,height:t}),a.setMaxSize({width:Number.MAX_VALUE,height:t}),a.setX(e.x),a.setWidth(o),a.setHeight(t)):(a.setMinSize({width:t,height:0}),a.setMaxSize({width:t,height:Number.MAX_VALUE}),a.setY(e.y),a.setHeight(o),a.setWidth(t));i?(n.setY(e.y),r.setY(s)):(n.setX(e.x),r.setX(s))}hideArrows(){this._leadArrow?.setVisible(!1),this._trailArrow?.setVisible(!1)}mainScroll(){return this.isVertical()?this._clip.getScrollTop():this._clip.getScrollLeft()}mainScrollMax(){return this.isVertical()?this._clip.getMaxScrollTop():this._clip.getMaxScrollLeft()}setMainScroll(e){this.isVertical()?this._clip.setScrollTop(e):this._clip.setScrollLeft(e)}resetScroll(){return this._clip.setScrollLeft(0),this._clip.setScrollTop(0),this}refreshArrows(){let e=this._leadArrow,t=this._trailArrow;if(!e||!t)return;let n=this.mainScroll();e.setEnabled(n>0),t.setEnabled(n<this.mainScrollMax()-1)}scrollBy(e){this.setMainScroll(this.mainScroll()+e),this.refreshArrows()}leadClicked=()=>{this.scrollBy(-this.resolveStep())};trailClicked=()=>{this.scrollBy(this.resolveStep())};revealItem(t){let n=this._clip.getElement();if(!n)return;let r=this.isVertical(),i=e.source.getElementRect(n),a=e.source.getElementRect(t),o=r?i.top:i.left,s=r?i.bottom:i.right,c=r?a.top:a.left,l=r?a.bottom:a.right,u=0;c<o?u=c-o:l>s&&(u=l-s),u!==0&&(this.setMainScroll(this.mainScroll()+u),this.refreshArrows())}containsArrow(t){if(!e.source.isNode(t))return!1;let n=e.source.intern(t);for(let t of[this._leadArrow,this._trailArrow]){let r=t?.getElement()??null;if(r&&e.source.contains(r,n))return!0}return!1}destructor(){this._clip.dispose(),this._leadArrow?.dispose(),this._trailArrow?.dispose(),super.destructor()}},q=a(ScrollStrip);function computeBulkCloseIds(e,t,n,r){return e.filter((e,n)=>{switch(r){case`all`:return!0;case`others`:return n!==t;case`right`:return n>t;case`left`:return n<t}}).filter(n)}var J=120,Y=30,xe=24,Se=4,Ce=80,TabIndicator=class extends l{_mainPos=0;_mainExtent=0;_side=`north`;constructor(){super(),this.setBackgroundColor(`var(--ts-ui-tab-indicator-color, #1a73e8)`),this.setTransition(`transform ${J}ms ease, width ${J}ms ease, height ${J}ms ease`),this.setPointerEvents(`none`),this.setZIndex(2)}slideTo(e,t,n){return this._mainPos=e,this._mainExtent=t,this._side=n,this.getElement()&&this.applyBarGeometry(),this}applyStyle(e){return super.applyStyle(e),this.applyBarGeometry(),this}applyBarGeometry(){let e=`var(--ts-ui-tab-indicator-thickness, 2px)`;return this._side===`west`||this._side===`east`?(this.setTranslate(0,this._mainPos),this.setElementStyles({top:`0`,bottom:`auto`,left:this._side===`east`?`0`:`auto`,right:this._side===`west`?`0`:`auto`,width:e,height:this._mainExtent+`px`})):(this.setTranslate(this._mainPos,0),this.setElementStyles({left:`0`,right:`auto`,top:this._side===`south`?`0`:`auto`,bottom:this._side===`north`?`0`:`auto`,width:this._mainExtent+`px`,height:e}))}},we=class TabReorderBar extends l{static THICKNESS=2;constructor(){super(),this.setBackgroundColor(`var(--ts-ui-drag-reorder-color, #1a73e8)`),this.setPointerEvents(`none`),this.setZIndex(2),this.setVisible(!1)}placeAt(e,t,n){return n?(this.setX(0),this.setY(e),this.setWidth(t),this.setHeight(TabReorderBar.THICKNESS)):(this.setX(e),this.setY(0),this.setWidth(TabReorderBar.THICKNESS),this.setHeight(t)),this.setVisible(!0),this}hide(){return this.setVisible(!1),this}},TabDropTint=class extends l{constructor(){super(),this.setBackgroundColor(`var(--ts-ui-drag-dropzone-bg)`),this.setPointerEvents(`none`),this.setZIndex(1),this.setVisible(!1)}showOver(e){return this.setX(0),this.setY(0),this.setWidth(e.getWidth()),this.setHeight(e.getHeight()),this.setVisible(!0),this}hide(){return this.setVisible(!1),this}},Te={backgroundColor:`var(--ts-ui-tab-toolbar-bg, #eee)`,preferredSize:{width:0,height:Y}},TabBar=class extends m{_tabClip=new q({scrollable:!1});_entries=[];_buttonGroup=new P;_rovingTabIndex=new _({preventScroll:!0});_activeId=null;_listeners=new d;_widthMode=`equal`;_maxWidth=null;_fixedWidth=120;_underBorderFullWidth=!0;_underBorderFromTheme=!0;_indicator=new TabIndicator;_side=`north`;_align=`start`;_orientation=`horizontal`;_scrollable=!1;_compact=!1;_textAlign=`center`;_contextMenu=new fe;_tools=[];_toolMenuItems=new Map;_toolGroup=new g;_leadGroup=new g;_leadWidget=null;_scrollToSelected=!1;_reorderable=!1;_reorderBar=new we;_dropTint=new TabDropTint;_dndTeardowns=[];_dragMouseTarget=null;_moveTriggerTeardown=null;_dragShiftHeld=!1;_dragInsertIndex=-1;_springRaiseTimer=null;constructor(e,t){super(e,{...Te,...t??{}}),this.setLayoutManager(new S({mode:`equal`,spacing:0,stretching:!0})),this._underBorderFullWidth=c.getTheme().tab.underBorderFullWidth,this.applyUnderBorder(e),this.getAria().setRole(`tablist`),this._tabClip.setArrowBackground(`var(--ts-ui-tab-toolbar-bg, #eee)`),this._tabClip.setStepProvider(()=>this.scrollStepExtent()),this._toolGroup.setLayoutManager(new S({spacing:0,stretching:!0})),this._toolGroup.setBackgroundColor(`var(--ts-ui-tab-toolbar-bg, #eee)`),this._toolGroup.clearInsets(),this._toolGroup.setZIndex(1),this._leadGroup.setLayoutManager(new S({spacing:0,stretching:!0})),this._leadGroup.setBackgroundColor(`transparent`),this._leadGroup.clearInsets(),this._leadGroup.setZIndex(1),this._leadGroup.setPointerEvents(`none`),this.subscribeTheme(()=>{this._underBorderFromTheme&&(this._underBorderFullWidth=c.getTheme().tab.underBorderFullWidth,this.applyUnderBorder())}),this.dispatchBarOptions(e)}dispatchBarOptions(e){if(e){if(e.widthMode!==void 0&&this.setWidthMode(e.widthMode),e.maxWidth!==void 0&&this.setMaxWidth(e.maxWidth),e.fixedWidth!==void 0&&this.setFixedWidth(e.fixedWidth),e.underBorderFullWidth!==void 0&&this.setUnderBorderFullWidth(e.underBorderFullWidth),e.side!==void 0&&this.setSide(e.side),e.align!==void 0&&this.setAlign(e.align),e.orientation!==void 0&&this.setOrientation(e.orientation),e.scrollable!==void 0&&this.setScrollable(e.scrollable),e.compact!==void 0&&this.setCompact(e.compact),e.reorderable!==void 0&&this.setReorderable(e.reorderable),e.textAlign!==void 0&&this.setTextAlign(e.textAlign),e.tools!==void 0)for(let t of e.tools)t instanceof l,this.addTool(t);this.applyListeners(e?.listeners)}}setBarSurfaceColor(e){return this.setBackgroundColor(e),this._toolGroup.setBackgroundColor(e),this._tabClip.setArrowBackground(e),this}init(t){super.init(t);let n=t??this.getElement(!0);e.sink.appendChild(n,this._tabClip.getElement(!0)),e.sink.appendChild(n,this._toolGroup.getElement(!0)),e.sink.appendChild(n,this._leadGroup.getElement(!0));let i=this._tabClip.getClipElement(!0);return e.sink.appendChild(i,this._indicator.getElement(!0)),e.sink.appendChild(i,this._dropTint.getElement(!0)),e.sink.appendChild(i,this._reorderBar.getElement(!0)),r.addSubtreeListener(this,`keydown`,this.onToolbarKeyDown),this._reorderable&&this.installTabDnD(),this}destructor(){this.teardownTabDnD(),this.clearSpringRaise(),this._moveTriggerTeardown?.(),this._moveTriggerTeardown=null,this._tabClip.dispose(),this._toolGroup.dispose(),this._leadGroup.dispose(),this._indicator.dispose(),this._dropTint.dispose(),this._reorderBar.dispose(),this._contextMenu.dispose(),super.destructor()}applyUnderBorder(e){if(e?.border!==void 0){this.setBorder(e.border);return}if(!this._underBorderFullWidth){this.clearBorder();return}let t=`1px solid var(--ts-ui-tab-toolbar-border, #e1e1e8)`;this.setBorder({borderTop:this._side===`south`?t:`none`,borderBottom:this._side===`north`?t:`none`,borderLeft:this._side===`east`?t:`none`,borderRight:this._side===`west`?t:`none`})}setWidthMode(e){return this._widthMode=e,this.scheduleLayout(),this}getWidthMode(){return this._widthMode}setMaxWidth(e){return this._maxWidth=e,this.scheduleLayout(),this}getMaxWidth(){return this._maxWidth}setFixedWidth(e){return this._fixedWidth=e,this.scheduleLayout(),this}getFixedWidth(){return this._fixedWidth}setUnderBorderFullWidth(e){return this._underBorderFromTheme=!1,this._underBorderFullWidth=e,this.applyUnderBorder(),this.scheduleLayout(),this}isUnderBorderFullWidth(){return this._underBorderFullWidth}setSide(e){return this._side=e,this._tabClip.resetScroll(),this._scrollable&&(this._scrollToSelected=!0),this.applyUnderBorder(),this.scheduleLayout(),this}getSide(){return this._side}setAlign(e){return this._align=e,this.scheduleLayout(),this}getAlign(){return this._align}setOrientation(e){return this._orientation=e,this.scheduleLayout(),this}getOrientation(){return this._orientation}setTextAlign(e){return this._textAlign=e,this.scheduleLayout(),this}getTextAlign(){return this._textAlign}setScrollable(e){return e&&!this._scrollable&&(this._scrollToSelected=!0),this._scrollable=e,this._tabClip.setScrollable(e),this.scheduleLayout(),this}isScrollable(){return this._scrollable}setCompact(e){return this._compact=e,this._scrollable&&(this._scrollToSelected=!0),this.scheduleLayout(),this}isCompact(){return this._compact}setReorderable(e){return this._reorderable===e||(this._reorderable=e,!this.getElement())||(e?this.installTabDnD():this.teardownTabDnD()),this}isReorderable(){return this._reorderable}addTool(e){let t=e instanceof l?e:this.buildDescriptorTool(e);return this._tools.push(t),this._toolGroup.addComponent(t),this.scheduleLayout(),this}buildDescriptorTool(e){let t=new j({glyph:e.glyph});return t.setFlat(!0),y.attach(t,e.label),t.on(`action`,e.action),this._toolMenuItems.set(t,e),t}removeTool(e){let t=this._tools.indexOf(e);return t<0?this:(this._tools.splice(t,1),this._toolMenuItems.delete(e),this._toolGroup.removeComponent(e),this.scheduleLayout(),this)}setLeadingWidget(e){return this._leadWidget&&this._leadGroup.removeComponent(this._leadWidget),this._leadWidget=e,e&&this._leadGroup.addComponent(e),this.scheduleLayout(),this}getLeadingWidget(){return this._leadWidget}isBarChromeTarget(t){if(!e.source.isNode(t))return!1;let n=e.source.intern(t);for(let t of this._entries){let r=t.button.getElement();if(r&&e.source.contains(r,n))return!0}let r=this._toolGroup.getElement();return!!(r&&e.source.contains(r,n)||this._tabClip.containsArrow(t))}installMoveTrigger(e,t){this._moveTriggerTeardown?.(),this._moveTriggerTeardown=null;let onBarMouseDown=t=>{t.shiftKey||this.isBarChromeTarget(t.target)||e(t)};r.addSubtreeListener(this,`mousedown`,onBarMouseDown);let n=[()=>r.removeSubtreeListener(this,`mousedown`,onBarMouseDown)];if(t){let onBarDoubleClick=e=>{this.isBarChromeTarget(e.target)||t(e)};r.addSubtreeListener(this,`dblclick`,onBarDoubleClick),n.push(()=>r.removeSubtreeListener(this,`dblclick`,onBarDoubleClick))}return this._moveTriggerTeardown=()=>{for(let e of n)e()},this}getEntryIds(){return this._entries.map(e=>e.id)}getActiveEntryId(){return this._activeId}isEntryCloseable(e){return this.entryById(e)?.constraints?.closeable===!0}getEntryName(e){return this.entryById(e)?.name??``}setEntryContentId(e,t){let n=this.entryById(e);return n&&(n.contentId=t,n.button.getAria().setControls(t)),this}setEntryBusy(e,t){return this.entryById(e)?.button.setBusy(t),this}isEntryBusy(e){return this.entryById(e)?.button.isBusy()??!1}getEntryButtonId(e){return this.entryById(e)?.button.getId()??``}entryById(e){return this._entries.find(t=>t.id===e)??null}activeEntry(){return this._activeId===null?null:this.entryById(this._activeId)}createBarEntry(e,t,n){let i=new oe(t,{glyph:n?.glyph??void 0,closeable:n?.closeable});i.setInsets(this.computeTabButtonInsets(n)),n?.tooltip&&y.attach(i,n.tooltip),i.on(`action`,()=>this.onTabPressed(i));let a=i.getCloseButton()??void 0,onContextMenu=e=>{this.openTabMenu(o,e.clientX,e.clientY)},o={id:e,button:i,closeButton:a,name:t,constraints:n,contextMenuListener:onContextMenu,contentId:``};a&&a.on(`action`,()=>this.emit(`tabclose`,e)),r.addSubtreeListener(i,`contextmenu`,{prevent:!0,handler:onContextMenu}),this._entries.push(o);let s=this._activeId===null;return s&&(i.setSelected(!0),this._activeId=e),this._buttonGroup.addButton(i),this._rovingTabIndex.add(i),this._tabClip.addItem(i),i.getAria().setRole(`tab`),i.getAria().setSelected(s),this._reorderable&&this.getElement()&&this._dndTeardowns.push(this.makeTabDragSource(o)),this}removeBarEntry(e){let t=this._entries.findIndex(t=>t.id===e);if(t<0)return this;let n=this._entries[t];return this._buttonGroup.removeButton(n.button),this._rovingTabIndex.remove(n.button),this._entries.splice(t,1),this._tabClip.removeItem(n.button),y.detach(n.button),this._activeId===e&&(this._activeId=null),n.button.dispose(),this}moveBarEntry(e,t){let n=this._entries.findIndex(t=>t.id===e);if(n<0)return this;let r=Math.max(0,Math.min(t,this._entries.length-1));if(r===n)return this;let i=this._entries.splice(n,1)[0];return this._entries.splice(r,0,i),this._tabClip.moveItem(i.button,r),this}setActiveEntry(e){let t=this._entries.findIndex(t=>t.id===e);return t<0?this:(this._entries.forEach(e=>e.button.setSelected(!1)),this._entries[t].button.setSelected(!0),this.onTabPressed(this._entries[t].button),this)}setActiveVisual(e){let t=this._entries.findIndex(t=>t.id===e);return t<0?this:(this._entries.forEach(e=>e.button.setSelected(!1)),this._entries[t].button.setSelected(!0),this._activeId=e,this)}openTabMenu(e,t,n){let r=this.activeEntry(),i=this.getEntryIds(),a=i.indexOf(e.id),closeable=e=>this.isEntryCloseable(e),o=this._entries.map(e=>({text:e.name,enabled:e!==r,action:()=>this.setActiveEntry(e.id)})),s=this._side===`west`||this._side===`east`,c=s?`Close all above`:`Close all to the left`,l=s?`Close all below`:`Close all to the right`,u=[{text:`Switch to`,submenu:{label:`Switch to`,items:o}},{separator:!0},{text:`Close`,enabled:e.constraints?.closeable===!0,action:()=>this.emit(`tabclose`,e.id)},this.bulkCloseItem(`Close others`,i,a,closeable,`others`),this.bulkCloseItem(c,i,a,closeable,`left`),this.bulkCloseItem(l,i,a,closeable,`right`),this.bulkCloseItem(`Close all`,i,a,closeable,`all`)],d=this._tools.filter(e=>this._toolMenuItems.has(e)).map(e=>{let t=this._toolMenuItems.get(e);return{text:t.label,glyph:t.glyph,action:t.action}});d.length>0&&(u.push({separator:!0}),u.push({text:`Tools`,submenu:{label:`Tools`,items:d}})),this._contextMenu.show(t,n,u)}bulkCloseItem(e,t,n,r,i){let a=computeBulkCloseIds(t,n,r,i);return{text:e,enabled:a.length>0,action:()=>{for(let e of a)this.emit(`tabclose`,e)}}}onTabPressed(e){let t=this._entries.findIndex(t=>t.button===e);t>=0&&(this._activeId=this._entries[t].id,this._rovingTabIndex.moveTo(t),this._scrollable&&(this._scrollToSelected=!0),this.emit(`tabpressed`,this._entries[t].id))}computeTabButtonInsets(e){let t=c.getResolvedScale(),r=this._compact?Math.round(t.tabButtonInset/2):t.tabButtonInset,i=e?.closeable?t.tabClose:0;return this.isRotatedText()?this._orientation===`vertical-ccw`?new n(i+r*2,r*2,r*2,r*2):new n(r*2,r*2,i+r*2,r*2):this.isVertical()?new n(r*2,i+r*2,r*2,r*2):new n(0,i+r*2,0,r*2)}computeToolButtonInsets(){let e=c.getResolvedScale().tabButtonInset,t=this._compact?Math.round(e/2):e;return this.isVertical()?new n(t*2,0,t*2,0):new n(0,t*2,0,t*2)}clampWrapperMain(e,t,n){this.isVertical()?(e.setMinSize({width:0,height:t}),e.setMaxSize({width:Number.MAX_VALUE,height:n})):(e.setMinSize({width:t,height:0}),e.setMaxSize({width:n,height:Number.MAX_VALUE}))}isRotatedText(){return this.isVertical()&&this._orientation!==`horizontal`}buttonMainExtent(e){let t=e.getPreferredSize();return t?this.isVertical()?t.height:t.width:0}buttonCrossExtent(e){let t=e.getPreferredSize();return t?this.isVertical()?t.width:t.height:0}stripThickness(){let e=this._compact?xe:Y;if(!this.isVertical()){let t=e;for(let e of this._entries)t=Math.max(t,this.buttonCrossExtent(e.button)+this.stripChrome());return t}if(this._widthMode===`fixed`&&!this.isRotatedText())return Math.max(e,this._fixedWidth);let t=e;for(let e of this._entries)t=Math.max(t,this.buttonCrossExtent(e.button));let n=this._tools.length>0?this._toolGroup.getPreferredSize():null;return n&&(t=Math.max(t,n.width)),t}stripChrome(){let e=c.getResolvedScale().tabButtonInset;return(this._compact?Math.round(e/2):e)*2*2}tabModeExtent(e){switch(this._widthMode){case`fixed`:return this.isVertical()&&!this.isRotatedText()?0:this._fixedWidth;case`equal`:{let e=0;for(let t of this._entries)e=Math.max(e,this.buttonMainExtent(t.button));return Math.min(e,this._maxWidth??Number.MAX_VALUE)}case`content`:return Math.min(this.buttonMainExtent(e),this._maxWidth??Number.MAX_VALUE);default:return 0}}applyTabWidths(e){let t=this._tabClip.getContentBox();if(this._scrollable){t.setMode(`preferred`),t.setOverflowing(!this.isVertical(),this.isVertical());for(let e of this._entries){let t=this.tabModeExtent(e.button);if(t>0)this.clampWrapperMain(e.button,t,t);else{let t=this.isRotatedText()?this.buttonMainExtent(e.button):0;this.clampWrapperMain(e.button,t,Number.MAX_VALUE)}}return}if(t.setOverflowing(!1,!1),this._widthMode===`fill`){t.setMode(`equal`);for(let e of this._entries)this.clampWrapperMain(e.button,0,Number.MAX_VALUE);return}if(t.setMode(`preferred`),this._widthMode===`content`){let e=this._maxWidth??Number.MAX_VALUE;for(let t of this._entries)if(this.isRotatedText()){let n=Math.min(this.buttonMainExtent(t.button),e);this.clampWrapperMain(t.button,n,n)}else this.clampWrapperMain(t.button,0,e);return}let n=this._entries.length>0?this.tabModeExtent(this._entries[0].button):0;if(n<=0){for(let e of this._entries)this.clampWrapperMain(e.button,0,Number.MAX_VALUE);return}if(this._widthMode===`equal`&&this._entries.length>0&&n*this._entries.length>e){t.setMode(`equal`);for(let e of this._entries)this.clampWrapperMain(e.button,0,Number.MAX_VALUE);return}for(let e of this._entries)this.clampWrapperMain(e.button,n,n)}isVertical(){return this._side===`west`||this._side===`east`}syncToolbarOrientation(){let e=this.isVertical();this._tabClip.setOrientation(e?`vertical`:`horizontal`),this._toolGroup.getLayoutManager()instanceof x!==e&&this._toolGroup.setLayoutManager(e?new x({spacing:0,stretching:!0}):new S({spacing:0,stretching:!0})),this._leadGroup.getLayoutManager()instanceof x!==e&&this._leadGroup.setLayoutManager(e?new x({spacing:0,stretching:!0}):new S({spacing:0,stretching:!0}))}toolGroupMainExtent(){let e=this._toolGroup.getPreferredSize();return e?this.isVertical()?e.height:e.width:0}leadWidgetMainExtent(){if(!this._leadWidget)return 0;let e=this._leadGroup.getPreferredSize();return e?(this.isVertical()?e.height:e.width)+Se:0}predictTabsExtent(){let e=0;for(let t of this._entries)e+=this.predictedTabExtent(t.button);return e}predictedTabExtent(e){let t=this.tabModeExtent(e);return t>0?t:this.buttonMainExtent(e)}positionClipFrame(e,t,n,r,i,a){let o=this._align===`end`,s=t+(o?e:0),c=o?0:e,l=r-s-c;this.isVertical()?(this._tabClip.setX(i),this._tabClip.setY(s+a),this._tabClip.setWidth(n),this._tabClip.setHeight(l)):(this._tabClip.setX(s+a),this._tabClip.setY(i),this._tabClip.setWidth(l),this._tabClip.setHeight(n))}applyTabButtonStyles(){let e=this._orientation===`vertical-cw`?`sideways-rl`:this._orientation===`vertical-ccw`?`sideways-lr`:null;for(let t of this._entries)t.button.setInsets(this.computeTabButtonInsets(t.constraints)),this.isVertical()&&e?t.button.setWritingMode(e):t.button.clearWritingMode(),t.button.setTextAlign(this._textAlign);let t=this.computeToolButtonInsets();for(let e of this._tools)e.setInsets(t);this._leadWidget&&this._leadWidget.setInsets(t)}endAlignGap(e){return this._align!==`end`||this._widthMode===`fill`||this._entries.length===0?0:Math.max(0,e-this.predictTabsExtent())}positionToolGroup(e,t,n,r,i){if(this._tools.length===0||t<=0){this._toolGroup.setVisible(!1);return}this._toolGroup.setVisible(!0);let a=(this._align===`end`?0:e-t)+i;this.isVertical()?(this._toolGroup.setX(r),this._toolGroup.setY(a),this._toolGroup.setWidth(n),this._toolGroup.setHeight(t)):(this._toolGroup.setX(a),this._toolGroup.setY(r),this._toolGroup.setWidth(t),this._toolGroup.setHeight(n)),this._toolGroup.doLayout()}positionLeadGroup(e,t,n){let r=this._leadWidget?this._leadGroup.getPreferredSize():null,i=r?this.isVertical()?r.height:r.width:0;if(i<=0){this._leadGroup.setVisible(!1);return}this._leadGroup.setVisible(!0),this.isVertical()?(this._leadGroup.setX(t),this._leadGroup.setY(n),this._leadGroup.setWidth(e),this._leadGroup.setHeight(i)):(this._leadGroup.setX(n),this._leadGroup.setY(t),this._leadGroup.setWidth(i),this._leadGroup.setHeight(e)),this._leadGroup.doLayout()}positionIndicator(){let e=this.activeEntry()?.button;if(!e)return;let t=this.isVertical(),n=t?e.getHeight():e.getWidth();if(n<=0)return;let r=t?e.getY():e.getX();this._indicator.slideTo(r,n,this._side)}positionCloseButtons(){let e=this.isRotatedText(),t=c.getResolvedScale(),n=t.tabClose,r=t.tabCloseGlyph;for(let t of this._entries){let i=t.closeButton;!i||t.button.getWidth()<=0||(i.setWidth(n),i.setHeight(n),i.pinGlyphSize(r),e?(i.setX(Math.round((t.button.getWidth()-n)/2)),i.setY(this._orientation===`vertical-ccw`?2:t.button.getHeight()-n-2)):(i.setX(t.button.getWidth()-n-2),i.setY(Math.round((t.button.getHeight()-n)/2))))}}scrollStepExtent(){return this._entries.length>0&&this.predictedTabExtent(this._entries[0].button)||Ce}revealSelectedIfRequested(){if(!this._scrollToSelected||(this._scrollToSelected=!1,!this._scrollable))return;let e=this.activeEntry()?.button.getElement();e&&this._tabClip.revealItem(e)}prepareStrip(){this.syncToolbarOrientation(),this.applyTabButtonStyles();for(let e of this._entries)e.button.getAria().setSelected(e.id===this._activeId);return this}placeStrip(e,t,n,r){return this.setX(e),this.setY(t),this.setWidth(n),this.setHeight(r),this.layoutChrome(n,r),this}layoutChrome(e,t){let n=this.getContentInsets(),r=this.isVertical(),i=r?n.getLeft():n.getTop(),a=r?n.getTop():n.getLeft(),o=r?n.getBottom():n.getRight(),s=this._tools.length>0?this.toolGroupMainExtent():0,c=this.stripThickness(),l=this.leadWidgetMainExtent(),u=(r?t:e)-a-o,d=this._tabClip.arrowReserve(this.predictTabsExtent(),u-s-l),f=u-s-l-2*d,p=this.endAlignGap(f);this.positionClipFrame(s,l,c,u,i,a),this.applyTabWidths(f),this._tabClip.layoutContent(d,p),this.revealSelectedIfRequested(),this.positionToolGroup(u,s,c,i,a),this.positionLeadGroup(c,i,a),this.positionIndicator(),this.positionCloseButtons()}installTabDnD(){this.teardownTabDnD();let recordMouseTarget=e=>{this._dragMouseTarget=e.target,this._dragShiftHeld=e.shiftKey};r.addSubtreeListener(this,`mousedown`,recordMouseTarget),this._dndTeardowns.push(()=>r.removeSubtreeListener(this,`mousedown`,recordMouseTarget));for(let e of this._entries)this._dndTeardowns.push(this.makeTabDragSource(e));this._dndTeardowns.push(this.makeTabDropTarget())}makeTabDragSource(t){return t.constraints?.transient?()=>{}:E.makeDragSource(t.button,{dragData:()=>({tabDrag:!0,sourceTabId:this.stripId(),componentId:t.contentId,label:t.name}),onDragStart:()=>{let n=this._dragMouseTarget;this._dragMouseTarget=null;let r=t.closeButton?.getElement();if(r&&e.source.isNode(n)&&e.source.contains(r,e.source.intern(n)))return!1;this.emit(`tabdragstart`,t.id)},onDragEnd:(e,n)=>this.onTabDragEnd(t,e,n)})}makeTabDropTarget(){return E.makeDropTarget(this._tabClip,{suppressValidityTint:!0,accepts:e=>this.isTabHeaderDrag(e),onDragOver:e=>(this._dropTint.showOver(this._tabClip),this.updateReorderSlot(e),e.dragData.sourceTabId!==this.stripId()&&this.scheduleSpringRaise(),null),onDragLeave:()=>{this.clearSpringRaise(),this.hideDropAffordance()},onDrop:e=>{this.clearSpringRaise(),this.dropTabHeader(e)}})}scheduleSpringRaise(){this._springRaiseTimer===null&&(this._springRaiseTimer=setTimeout(()=>{this._springRaiseTimer=null,E.isDragging()&&this.emit(`dockhover`)},te))}clearSpringRaise(){this._springRaiseTimer!==null&&(clearTimeout(this._springRaiseTimer),this._springRaiseTimer=null)}hideDropAffordance(){this._reorderBar.hide(),this._dropTint.hide()}isTabHeaderDrag(e){return e.dragData.tabDrag===!0}dropTabHeader(e){if(e.dragData.sourceTabId===this.stripId()){this.dropReorder(e);return}this.emit(`dockrequested`,e.dragData.componentId,this._dragInsertIndex),this.hideDropAffordance(),this._dragInsertIndex=-1}stripId(){return this.getId()}onTabDragEnd(e,t,n){if(!n){this.emit(`tearoffrequested`,e.id,t.clientX,t.clientY,this._dragShiftHeld);return}this.emit(`detach`,e.id)}updateReorderSlot(t){let n=this._tabClip.getClipElement();if(!n)return;let r=e.source.getElementRect(n),i=this.isVertical(),a=(i?t.clientY-r.top:t.clientX-r.left)+this._tabClip.mainScroll(),o=this._entries.length;for(let e=0;e<this._entries.length;e++){let t=this._entries[e].button;if(a<(i?t.getY():t.getX())+(i?t.getHeight():t.getWidth())/2){o=e;break}}this._dragInsertIndex=o;let s=this.slotBoundary(o,i),c=i?this._tabClip.getWidth():this._tabClip.getHeight();this._reorderBar.placeAt(s,c,i)}slotBoundary(e,t){if(e<this._entries.length){let n=this._entries[e].button;return t?n.getY():n.getX()}if(this._entries.length>0){let e=this._entries[this._entries.length-1].button;return t?e.getY()+e.getHeight():e.getX()+e.getWidth()}return 0}dropReorder(e){this.hideDropAffordance();let t=this._entries.findIndex(t=>t.button.getId()===e.sourceId);t<0||this._dragInsertIndex<0||(this.reorderTab(t,this._dragInsertIndex),this._dragInsertIndex=-1)}reorderTab(e,t){if(e<0||e>=this._entries.length)return;let n=t>e?t-1:t;if(n=Math.max(0,Math.min(n,this._entries.length-1)),n===e)return;let r=this._entries[e].id,i=this._entries[e];this._entries.splice(e,1),this._entries.splice(n,0,i),this._tabClip.moveItem(i.button,n),this.emit(`reorder`,r,n)}teardownTabDnD(){for(let e of this._dndTeardowns)e();this._dndTeardowns=[],this.hideDropAffordance()}onToolbarKeyDown(e){if(e.key!==`ArrowLeft`&&e.key!==`ArrowRight`)return;let t=this._entries.length;if(t===0)return;let n=this._entries.findIndex(e=>e.id===this._activeId),r=n>=0?n:0,i=e.key===`ArrowRight`?(r+1)%t:(r-1+t)%t,a=this._entries[i].button;return this._entries.forEach(e=>e.button.setSelected(!1)),a.setSelected(!0),this.onTabPressed(a),{prevent:!0}}on(e,t){return this._listeners.add(e,t),this}off(e,t){return this._listeners.remove(e,t),this}emit(e,...t){this._listeners.fire(e,...t)}},X=a(TabBar),Z=480,Ee=360,De=120,Tab=class extends i{_bar=new X;_barVisible=!0;_contents=[];_selectedTabIndex=0;_pendingActiveContent=null;_lastFadedTabIndex=-1;_tabFadeAnimation=null;_listeners=new d;_barIgnoreParentInsets=!1;_detachWindowMode=`strip`;_closeHostWindowWhenEmpty=!1;_idSeq=0;_themeCleanup=null;constructor(e){super(),this._themeCleanup=c.onThemeChange(()=>{this.getContainer()?.scheduleLayout()}),e&&this.applyOptions(e)}applyOptions(e){if(super.applyOptions(e),e.listeners!==void 0){let t=e.listeners;for(let e of Object.keys(t)){let n=t[e];n!==void 0&&this.on(e,n)}}if(e.widthMode!==void 0&&this.setWidthMode(e.widthMode),e.maxWidth!==void 0&&this.setMaxWidth(e.maxWidth),e.fixedWidth!==void 0&&this.setFixedWidth(e.fixedWidth),e.underBorderFullWidth!==void 0&&this.setUnderBorderFullWidth(e.underBorderFullWidth),e.side!==void 0&&this.setSide(e.side),e.align!==void 0&&this.setAlign(e.align),e.orientation!==void 0&&this.setOrientation(e.orientation),e.scrollable!==void 0&&this.setScrollable(e.scrollable),e.compact!==void 0&&this.setCompact(e.compact),e.reorderable!==void 0&&this.setReorderable(e.reorderable),e.barIgnoreParentInsets!==void 0&&this.setBarIgnoreParentInsets(e.barIgnoreParentInsets),e.detachWindowMode!==void 0&&this.setDetachWindowMode(e.detachWindowMode),e.textAlign!==void 0&&this.setTextAlign(e.textAlign),e.tools!==void 0)for(let t of e.tools)t instanceof l,this.addTool(t)}setWidthMode(e){return this._bar.setWidthMode(e),this.getContainer()?.scheduleLayout(),this}getWidthMode(){return this._bar.getWidthMode()}setMaxWidth(e){return this._bar.setMaxWidth(e),this.getContainer()?.scheduleLayout(),this}getMaxWidth(){return this._bar.getMaxWidth()}setFixedWidth(e){return this._bar.setFixedWidth(e),this.getContainer()?.scheduleLayout(),this}getFixedWidth(){return this._bar.getFixedWidth()}setUnderBorderFullWidth(e){return this._bar.setUnderBorderFullWidth(e),this.getContainer()?.scheduleLayout(),this}isUnderBorderFullWidth(){return this._bar.isUnderBorderFullWidth()}setSide(e){return this._bar.setSide(e),this.getContainer()?.scheduleLayout(),this}getSide(){return this._bar.getSide()}setAlign(e){return this._bar.setAlign(e),this.getContainer()?.scheduleLayout(),this}getAlign(){return this._bar.getAlign()}setOrientation(e){return this._bar.setOrientation(e),this.getContainer()?.scheduleLayout(),this}getOrientation(){return this._bar.getOrientation()}setTextAlign(e){return this._bar.setTextAlign(e),this.getContainer()?.scheduleLayout(),this}getTextAlign(){return this._bar.getTextAlign()}setScrollable(e){return this._bar.setScrollable(e),this.getContainer()?.scheduleLayout(),this}isScrollable(){return this._bar.isScrollable()}setCompact(e){return this._bar.setCompact(e),this.getContainer()?.scheduleLayout(),this}isCompact(){return this._bar.isCompact()}setReorderable(e){return this._bar.setReorderable(e),this}isReorderable(){return this._bar.isReorderable()}setBarVisible(e){return this._barVisible===e?this:(this._barVisible=e,this.getContainer()?.scheduleLayout(),this)}isBarVisible(){return this._barVisible}isEmpty(){return this._contents.length===0}setBarIgnoreParentInsets(e){return this._barIgnoreParentInsets=e,this.getContainer()?.scheduleLayout(),this}isBarIgnoreParentInsets(){return this._barIgnoreParentInsets}setDetachWindowMode(e){return this._detachWindowMode=e,this}getDetachWindowMode(){return this._detachWindowMode}setCloseHostWindowWhenEmpty(e){return this._closeHostWindowWhenEmpty=e,this}addTool(e){return e instanceof l&&e instanceof j&&e.setFlat(!0),this._bar.addTool(e),this.getContainer()?.scheduleLayout(),this}removeTool(e){return this._bar.removeTool(e),this.getContainer()?.scheduleLayout(),this}setBarLeadingWidget(e){return this._bar.setLeadingWidget(e),this.getContainer()?.scheduleLayout(),this}setBarBackgroundColor(e){return this._bar.setBarSurfaceColor(e),this}installBarMoveTrigger(e,t){return this._bar.installMoveTrigger(e,t),this}mintId(){return`tab-`+this._idSeq++}attach(t){return super.attach(t),e.sink.appendChild(t.getElement(!0),this._bar.getElement(!0)),this._bar.on(`tabpressed`,this._onBarTabPressed),this._bar.on(`reorder`,this._onBarReordered),this._bar.on(`tabclose`,this._onBarTabClose),this._bar.on(`dockrequested`,this._onBarDockRequested),this._bar.on(`tabdragstart`,this._onBarTabDragStart),this._bar.on(`tearoffrequested`,this._onBarTearOffRequested),this._bar.on(`detach`,this._onBarDetached),this._bar.on(`dockhover`,this._onBarDockHover),this}detach(){this._tabFadeAnimation?.cancel(),this._tabFadeAnimation=null;for(let e of this._contents)e.materializeAnimation?.cancel(),e.materializeAnimation=null;return super.detach(),this._themeCleanup&&=(this._themeCleanup(),null),this._bar.off(`tabpressed`,this._onBarTabPressed),this._bar.off(`reorder`,this._onBarReordered),this._bar.off(`tabclose`,this._onBarTabClose),this._bar.off(`dockrequested`,this._onBarDockRequested),this._bar.off(`tabdragstart`,this._onBarTabDragStart),this._bar.off(`tearoffrequested`,this._onBarTearOffRequested),this._bar.off(`detach`,this._onBarDetached),this._bar.off(`dockhover`,this._onBarDockHover),this._bar.dispose(),this}_onBarTabPressed=e=>{let t=this._contents.findIndex(t=>t.id===e);if(t>=0){this._selectedTabIndex=t;let e=this._contents[t];this.emit(`select`,t,this._bar.getEntryName(e.id)),e.state===`lazy`&&this.materializeAsync(t),e.component?this.emit(`activate`,e.component,t):e.announceActivation=!0}this.getContainer()?.scheduleLayout()};_onBarReordered=(e,t)=>{let n=this._bar.getEntryIds(),r=this._contents[this._selectedTabIndex]??null;if(this._contents.sort((e,t)=>n.indexOf(e.id)-n.indexOf(t.id)),r){let e=this._contents.indexOf(r);e>=0&&(this._selectedTabIndex=e)}this.getContainer()?.scheduleLayout()};_onBarTabClose=e=>{this.closeEntry(e)};closeEntry(e){let t=this.getContainer();if(!t)return;let n=this._contents.findIndex(t=>t.id===e);if(n<0)return;let r=this._selectedTabIndex===n,i=this._contents[n].component,a=this._contents[n].spinner;this._contents[n].materializeAnimation?.cancel(),this._bar.removeBarEntry(e),this._contents.splice(n,1);let o;i&&(o=t.removeComponent(i)),a&&(t.removeComponent(a),a.dispose()),i&&(this.emit(`tabclose`,i),o?.disposeOnClose!==!1&&i.getParentComponent()===null&&i.dispose()),this.selectNextContent(n,r),this.getContainer()?.scheduleLayout(),this.syncHostWindowCloseable(),this.closeHostWindowIfEmpty(),this._contents.length===0&&this.emit(`empty`)}closeTab(e){let t=this._contents.find(t=>t.component===e);return t?(this.closeEntry(t.id),!0):!1}setTabBusy(e,t){let n=this._contents.find(t=>t.component===e);return n?(this.setEntryBusy(n,t),!0):!1}isTabBusy(e){let t=this._contents.find(t=>t.component===e);return t?this._bar.isEntryBusy(t.id):!1}_onBarDockRequested=(e,t)=>{let n=T.get(e);n&&(this.dockComponent(n,t),this.ancestorWindow()?.bringToFront(),this.emit(`dock`,n))};_onBarDockHover=()=>{this.ancestorWindow()?.bringToFront()};_onBarTabDragStart=e=>{let t=this._contents.find(t=>t.id===e);t&&t.state===`ready`&&t.component&&T.set(t.component.getId(),t.component)};_onBarTearOffRequested=(e,t,n,r)=>{let i=this._contents.find(t=>t.id===e);i&&(i.component&&T.delete(i.component.getId()),!(i.state!==`ready`||!i.component)&&this.detachTabToWindow(e,i.component,t,n,r))};_onBarDetached=e=>{let t=this._contents.find(t=>t.id===e);if(!t)return;let n=t.component;n&&T.delete(n.getId()),!(t.state!==`ready`||!n)&&((this.getContainer()?.getComponents().includes(n)??!1)||this.removeEntryKeepingContent(e))};getVisibleComponent(){let e=this.getContainer();if(!e)return null;let t=this._contents[this._selectedTabIndex];return t?t.state===`building`&&t.spinner?t.spinner:t.component?t.component:null:e.getComponents()[this._selectedTabIndex]??null}getPreferredSize(){return this.composeSize(this.getVisibleComponent()?.getPreferredSize())}getMinSize(){return this.composeSize(this.getVisibleComponent()?.getMinSize())}getMaxSize(){return this.composeSize(this.getVisibleComponent()?.getMaxSize())}isVertical(){let e=this._bar.getSide();return e===`west`||e===`east`}composeSize(e){let t=this.getContainer();if(!t||!e)return null;let n=t.getPerimeterSize(),r=n.left+n.right,i=n.top+n.bottom,a=this._bar.stripThickness();return this.isVertical()?{width:e.width+a+r,height:e.height+i}:{width:e.width+r,height:e.height+a+i}}createTab(e){let t=this.getLayoutConstraints(e),n=t?.name??e.getName()??e.getId(),r=this.mintId();this._bar.createBarEntry(r,n,t),this._contents.push({id:r,component:e,factory:null,spinner:null,state:`ready`,materializeAnimation:null,announceActivation:!1}),this.wireComponentAria(r,e),this.syncHostWindowCloseable()}wireComponentAria(e,t){this._bar.setEntryContentId(e,t.getId()),t.getAria().setRole(`tabpanel`),t.getAria().setTabIndex(-1),t.getAria().setLabelledBy(this._bar.getEntryButtonId(e))}addDeferredComponent(e,t){if(t?.lazy===!1)return!1;this.syncUntabbedChildren();let n=this.mintId();return this._bar.createBarEntry(n,t?.name??n,t),this._contents.push({id:n,component:null,factory:e,spinner:null,state:`lazy`,materializeAnimation:null,announceActivation:!1}),this.getContainer()?.scheduleLayout(),!0}addLazyTab(e,t,n){this.addDeferredComponent(e,Object.assign(new O,n,{name:t,lazy:!0}))}syncUntabbedChildren(){let e=this.getContainer();if(!e)return;let t=new Set;for(let e of this._contents)e.component&&t.add(e.component),e.spinner&&t.add(e.spinner);for(let n of e.getComponents())t.has(n)||this.createTab(n)}setEntryBusy(e,t){this._bar.isEntryBusy(e.id)!==t&&(this._bar.setEntryBusy(e.id,t),this.emit(`busychange`,t,this._bar.getEntryName(e.id)))}materializeAsync(e){let t=this._contents[e];if(!t||t.state!==`lazy`)return;let n=t.factory;if(!n)return;let r=this.getContainer();if(!r)return;let i=createSpinnerWrap();t.spinner=i,t.state=`building`,this.setEntryBusy(t,!0),t.materializeAnimation?.cancel(),t.materializeAnimation=u.materialize({host:r,factory:()=>{let e=n();return e instanceof Promise?e.then(e=>(t.component=e,e)):(t.component=e,e)},spinnerComponent:i,isStale:()=>!this._contents.includes(t),onError:e=>this.failEntry(t,e),onReady:e=>{this.setEntryBusy(t,!1),t.component=e,t.factory=null,t.spinner=null,t.state=`ready`,this.wireComponentAria(t.id,e),r.scheduleLayout(),this.announcePendingActivation(t)}})}announcePendingActivation(e){!e.announceActivation||!e.component||(e.announceActivation=!1,this._contents[this._selectedTabIndex]===e&&this.emit(`activate`,e.component,this._selectedTabIndex))}failEntry(e,t){let n=this._bar.getEntryName(e.id);e.spinner=null,e.factory=null,this.closeEntry(e.id),this.emit(`exception`,t,n)}computeTotalMinSize(){let e=this.getContainer();return e?(this.getVisibleComponent()??e.getComponents()[0])?.getMinSize()??{width:0,height:0}:{width:0,height:0}}doLayout(){let e=this.getContainer();if(!e)return;let t=e.getComponents(),r=e.getInnerSize(),i=e.getContentInsets();if(this.syncUntabbedChildren(),this._pendingActiveContent){let e=this.indexOfContent(this._pendingActiveContent);e>=0&&(this._pendingActiveContent=null,this.setActiveTabIndex(e))}let a=this._contents[this._selectedTabIndex];a&&a.state===`lazy`&&this.materializeAsync(this._selectedTabIndex);for(let e of t)e.setVisible(!1),e.getAria().setHidden(!0);let s=this.getVisibleComponent();!s&&t.length>0&&(s=t[0]),this._bar.setVisible(this._barVisible),this._barVisible&&this._bar.prepareStrip();let c=r??{width:0,height:0},l=i.getLeft(),d=i.getTop(),f=this._barVisible?this._bar.stripThickness():0,p=l,m=d,h=c.width,g=f,_=l,v=d,y=c.width,b=c.height;switch(this._bar.getSide()){case`north`:v=d+f,b=c.height-f;break;case`south`:m=d+c.height-f,b=c.height-f;break;case`west`:h=f,g=c.height,_=l+f,y=c.width-f;break;case`east`:p=l+c.width-f,h=f,g=c.height,y=c.width-f}if(this._barIgnoreParentInsets){let e=i.getLeft(),t=i.getTop(),r=i.getRight(),a=i.getBottom();switch(this._bar.getSide()){case`north`:p=0,m=0,h=c.width+e+r,g=f+t,this._bar.setInsets(new n(t,r,0,e));break;case`south`:p=0,m=d+c.height-f,h=c.width+e+r,g=f+a,this._bar.setInsets(new n(0,r,a,e));break;case`west`:p=0,m=0,h=f+e,g=c.height+t+a,this._bar.setInsets(new n(t,0,a,e));break;case`east`:p=l+c.width-f,m=0,h=f+r,g=c.height+t+a,this._bar.setInsets(new n(t,r,a,0))}}else this._bar.clearInsets();if(this._barVisible&&this._bar.placeStrip(p,m,h,g),!s)return;s.setVisible(!0),s.getAria().setHidden(!1);let x=this.inflateForOverflow({width:y,height:b}),S=x.width,C=x.height;if(this.placeComponent(s,_,v,S,C,o.BOTH),this._contents[this._selectedTabIndex]?.state===`ready`&&this._lastFadedTabIndex!==this._selectedTabIndex){this._lastFadedTabIndex=this._selectedTabIndex;let e=s.getElement();e&&(this._tabFadeAnimation?.cancel(),this._tabFadeAnimation=u.play(e,{from:{opacity:`0`},to:{opacity:`1`},durationMs:De,properties:[`opacity`]}))}}getActiveTabIndex(){return this._selectedTabIndex}getActiveContent(){return this._contents[this._selectedTabIndex]?.component??null}indexOfContent(e){return this._contents.findIndex(t=>t.component===e)}getActiveTabLabel(){let e=this._bar.getActiveEntryId();return e===null?null:this._bar.getEntryName(e)}setActiveContent(e){let t=this.indexOfContent(e);return t>=0?(this._pendingActiveContent=null,this.setActiveTabIndex(t)):this._pendingActiveContent=e,this}setActiveTabIndex(e){if(this._contents.length===0)return this;let n=t.clamp(e,0,this._contents.length-1);return this._bar.setActiveEntry(this._contents[n].id),this}dockComponent(e,n){let r=this.getContainer();if(!r)return;r.moveComponent(e,n),this.createTab(e);let i=this._contents.length-1,a=t.clamp(n,0,i);if(a!==i){let e=this._contents[i];this._contents.splice(i,1),this._contents.splice(a,0,e),this._bar.moveBarEntry(e.id,a)}this.setActiveTabIndex(a),r.scheduleLayout()}removeEntryKeepingContent(e){let t=this._contents.findIndex(t=>t.id===e);if(t<0)return;let n=this._selectedTabIndex===t;this._contents[t].materializeAnimation?.cancel(),this._bar.removeBarEntry(e),this._contents.splice(t,1),this.selectNextContent(t,n),this.getContainer()?.scheduleLayout(),this.syncHostWindowCloseable(),this.closeHostWindowIfEmpty(),this._contents.length===0&&this.emit(`empty`)}detachTabToWindow(e,t,n,r,i){let a=!i&&this._detachWindowMode===`strip`,o=a?new $({closeable:this._bar.isEntryCloseable(e)}):new K(this._bar.getEntryName(e),{closeable:this._bar.isEntryCloseable(e)});o.setX(n),o.setY(r),o.setSize({width:Z,height:Ee}),o.clampPositionToViewport(),a?this.fillWindowWithStrip(o,t):(o.moveComponent(t),o.show()),this.removeEntryKeepingContent(e),o.bringToFront(),this.emit(`detach`,o)}fillWindowWithStrip(e,t){e.createTab(t),e.show()}hostWindow(){if(!this._closeHostWindowWhenEmpty)return null;let e=this.getContainer();for(;e&&!(e instanceof W);)e=e.getParentComponent();return e instanceof W?e:null}ancestorWindow(){for(let e=this.getContainer();e;e=e.getParentComponent())if(e instanceof W)return e;return null}closeHostWindowIfEmpty(){this._contents.length>0||this.hostWindow()?.requestClose()}syncHostWindowCloseable(){let e=this.hostWindow();e&&e.setCloseable(this._bar.getEntryIds().every(e=>this._bar.isEntryCloseable(e)))}selectNextContent(e,t){if(this._contents.length===0){this._selectedTabIndex=0;return}if(!t){this._selectedTabIndex>e&&--this._selectedTabIndex;return}let n=e>0?e-1:0;this._selectedTabIndex=n,this._bar.setActiveVisual(this._contents[n].id)}on(e,t){return this._listeners.add(e,t),this}off(e,t){return this._listeners.remove(e,t),this}emit(e,...t){this._listeners.fire(e,...t)}},Q=a(Tab),Oe=30,ke=120,TabWindow=class extends W{_tab;_closeTool;_minTool;_maxTool;_leadGlyphBtn;constructor(e){super(e),this._tab=new Q({reorderable:!0,widthMode:`fixed`,textAlign:`start`,compact:!0,barIgnoreParentInsets:!0}),this._tab.setCloseHostWindowWhenEmpty(!0),this.setLayoutManager(this._tab),this._minTool=createWindowControlButton(`window-minimize`),this._maxTool=createWindowControlButton(`window-maximize`),this._closeTool=createWindowControlButton(`xmark`),this._minTool.on(`action`,()=>this.toggleMinimize()),this._maxTool.on(`action`,()=>this.toggleMaximize()),this._closeTool.on(`action`,()=>this.requestClose()),this._tab.addTool(this._minTool),this._tab.addTool(this._maxTool),this._tab.addTool(this._closeTool),this._leadGlyphBtn=createWindowLeadGlyphButton(this._options.glyph??`window-maximize`),this._tab.setBarLeadingWidget(this._leadGlyphBtn),this.initChrome(e)}createTab(e){return this.addContent(e),this}setGlyph(e){return this._leadGlyphBtn.setGlyph(e),this}wireMoveTrigger(){this._tab.installBarMoveTrigger(e=>this.startMoveFrom(e),()=>this.onBarDoubleClick())}onBarDoubleClick(){if(this.getWindowState()===`minimized`){this.setWindowState(this._preMinimizeState);return}this.isMaximizable()&&this.toggleMaximize()}reflectCloseable(e){this._closeTool.setEnabled(e)}reflectMinimizable(e){this._minTool.setVisible(e)}reflectMaximizable(e){this._maxTool.setVisible(e)}reflectMaximizeState(e){}paintActive(e){this._tab.setBarBackgroundColor(e?`var(--ts-ui-tab-toolbar-bg, #eee)`:`var(--ts-ui-gutter-bg, rgb(200, 200, 200))`),this.setControlsActive(e)}setControlsActive(e){setWindowControlsActive([this._minTool,this._maxTool,this._closeTool],e)}getTitle(){return this._tab.getActiveTabLabel()??``}minContentWidthSeed(){return ke}chromeHeight(){return Oe}addContent(e){this.moveComponent(e),this._tab.createTab(e)}isChromeComponent(e){return!1}},$=a(TabWindow);function toLayoutSizes(e,t){let clean=e=>Number.isFinite(e)&&e>0?e:0,n=e.filter(e=>e===`ratio`).length,r=0;for(let n=0;n<e.length;n+=1)e[n]===`ratio`&&(r+=clean(t[n]));return e.map((e,i)=>e===`px`?{unit:e,value:clean(t[i])}:{unit:e,value:r>0?clean(t[i])/r:1/n})}function fromLayoutSizes(e,t){let n=0,r=0,i=0;for(let t of e)t.unit===`px`?n+=t.value:(r+=t.value,i+=1);let a=t>0?Math.max(0,t-n):0,o=a>0?a:1;return e.map(e=>e.unit===`px`?e.value:r>0?e.value/r*o:o/i)}function isRestorableSizes(e,t){return t.length===0||e.length!==t.length?!1:e.every((e,n)=>e!=null&&e.unit===t[n]&&Number.isFinite(e.value)&&e.value>=0)&&e.some(e=>e.value>0)}function normalizeRatios(e,t){let n=[];for(let r=0;r<t;r+=1){let t=e[r];n.push(Number.isFinite(t)&&t>0?t:0)}let r=n.reduce((e,t)=>e+t,0);return r>0?n.map(e=>e/r):n.map(()=>1/t)}var Ae=.5,RadioMenuRow=class extends de{_radio;_iconStart=null;_checkZone=null;_onMouseOver;_onMouseOut;_onClick;constructor(e,t){super(e,t),this._radio=new C(e?.text??``,{selected:e?.checked??!1,enabled:e?.enabled??!0}),this._radio.setPointerEvents(`none`),this.addComponent(this._radio),e?.enabled===!1&&(this.setPointerEvents(`none`),this.setOpacity(Ae)),this._onMouseOver=()=>{this.setFocused(!0)},this._onMouseOut=()=>{this.setFocused(!1)},this._onClick=()=>{this.activate()},r.addListener(this,`mouseover`,this._onMouseOver),r.addListener(this,`mouseout`,this._onMouseOut),r.addListener(this,`click`,this._onClick),this.applyListeners(e?.listeners)}isChecked(){return this._radio.isSelected()}setChecked(e){return this._radio.setSelected(e),this}isNavigable(){return!0}isEnabled(){return this._radio.isEnabled()}activate(){this.isEnabled()&&this.setChecked(!0)}getContentWidth(){return Math.ceil(this._radio.getPreferredSize()?.width??0)+N.RIGHT_PAD}setColumns(e,t,n){this._checkZone=e,this._iconStart=t,this.scheduleLayout()}doLayout(){super.doLayout();let e=this.getContentBounds();if(!e)return this;let t=this._radio.getPreferredSize()??{width:0,height:0},n=this._checkZone??0,r=this._iconStart!==null&&this._iconStart-n===N.ICON_ZONE?n+4:this._iconStart??N.TEXT_INSET,i=Math.max(0,Math.floor((e.height-t.height)/2));return this._radio.setX(e.x+r),this._radio.setY(e.y+i),this._radio.setWidth(Math.max(0,e.width-r-N.RIGHT_PAD)),this._radio.setHeight(t.height),this}on(e,t){return r.addListener(this,`click`,t),this}off(e,t){return r.removeListener(this,`click`,t),this}},je=a(RadioMenuRow);export{toLayoutSizes as a,X as c,G as d,W as f,P as h,normalizeRatios as i,q as l,R as m,fromLayoutSizes as n,$ as o,F as p,isRestorableSizes as r,Q as s,je as t,K as u};
|
|
2
|
-
//# sourceMappingURL=RadioMenuRow-DP5qPyFR.js.map
|