@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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Header-Dql3Zxc6.js","names":[],"sources":["../../src/typescript/lib/component/display/Header.ts"],"sourcesContent":["// SPDX-License-Identifier: PolyForm-Noncommercial-1.0.0\n\nimport { Border as BorderLayout } from \"~/layout/Border.js\";\nimport { Text, TextOptions } from \"~/component/input/Text.js\";\nimport { Insets } from \"~/primitive/Insets.js\";\nimport { AnchorType } from \"~/layout/AnchorType.js\";\nimport { FillType } from \"~/layout/FillType.js\";\nimport { Placement } from \"~/primitive/Placement.js\";\nimport { Container } from \"~/core/Container.js\";\nimport { callable } from \"~/core/Callable.js\";\n\n/**\n * Construction-time options for {@link Header}. Text and font fields target\n * the inner header label, not the header bar itself.\n *\n * @category Components\n */\nexport interface HeaderOptions extends TextOptions {\n}\n\n/**\n * User-overridable defaults forwarded to `super` via the options bag. The\n * cascade in `Container`/`Component` dispatches each present setter once with the\n * final value. Font fields are handled in the constructor body once the inner\n * `text` child exists — they're written into `_options` by `applyOptions` and\n * dispatched from there.\n */\nconst _defaultHeaderOptions: Partial<HeaderOptions> = {\n // Static content padding around the header label — the single source of the\n // bar's padding (WindowHeader subclasses Header without passing its own\n // insets). 4px matches the spacing headers carried implicitly from Panel\n // before the Container reparent; it is not theme-derived, so headers do not\n // reflow their padding on a theme change.\n insets: new Insets(4, 4, 4, 4),\n};\n\n/**\n * A header bar component containing a left-aligned text label.\n *\n * Renders a `<header>` element with a Border layout manager and a bold label\n * anchored to the west side.\n *\n * @category Components\n */\nclass Header<TOptions extends HeaderOptions = HeaderOptions> extends Container<TOptions> {\n\n private _text!: Text;\n\n /**\n * @param text - The header's label text.\n * @param options - Optional construction-time options.\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?: TOptions, subclassDefaults?: Partial<TOptions>) {\n super(\n options,\n {\n ..._defaultHeaderOptions,\n tag: \"header\",\n ...(subclassDefaults ?? {}),\n } as Partial<TOptions>,\n );\n\n this.setLayoutManager(new BorderLayout());\n\n // Build the inner text label. Font defaults are applied here when the\n // caller didn't supply an override — the cascade can't reach `this.text`\n // because it doesn't exist yet during `super`.\n this._text = new Text(text);\n if (this._options.fontWeight === undefined) {\n this._text.setFontWeight(\"bold\");\n }\n if (this._options.fontSize === undefined) {\n this._text.setFontSize(\"--ts-ui-header-font-size\");\n }\n this._text.setPointerEvents(\"none\");\n\n this.addComponent(this._text, {\n placement: Placement.WEST,\n anchor: AnchorType.WEST,\n fill: FillType.HORIZONTAL\n });\n\n // Recompute the preferred height on theme change: the header font size\n // is theme-bound, so a theme swap can change the label's measured height.\n // The insets are static (see `_defaultHeaderOptions`), so padding is not\n // re-derived here.\n this.subscribeTheme(() => {\n this.updatePreferredSize();\n });\n\n if (this._options.preferredSize === undefined) {\n this.updatePreferredSize();\n }\n\n // Late-built state: font/text fields written pure into `_options` by\n // the super-time cascade. Dispatch them now that `this.text` exists.\n if (this._options.text !== undefined) {\n this._text.setText(this._options.text);\n }\n if (this._options.textAlign !== undefined) {\n this._text.setTextAlign(this._options.textAlign);\n }\n if (this._options.textShadow !== undefined) {\n this._text.setTextShadow(this._options.textShadow);\n }\n if (this._options.fontFamily !== undefined) {\n this._text.setFontFamily(this._options.fontFamily);\n }\n if (this._options.fontSize !== undefined) {\n this._text.setFontSize(this._options.fontSize);\n }\n if (this._options.fontWeight !== undefined) {\n this._text.setFontWeight(this._options.fontWeight);\n }\n if (this._options.fontStyle !== undefined) {\n this._text.setFontStyle(this._options.fontStyle);\n }\n if (this._options.fontVariant !== undefined) {\n this._text.setFontVariant(this._options.fontVariant);\n }\n if (this._options.fontStretch !== undefined) {\n this._text.setFontStretch(this._options.fontStretch);\n }\n if (this._options.fontKerning !== undefined) {\n this._text.setFontKerning(this._options.fontKerning);\n }\n if (this._options.fontSizeAdjust !== undefined) {\n this._text.setFontSizeAdjust(this._options.fontSizeAdjust);\n }\n if (this._options.lineHeight !== undefined) {\n this._text.setLineHeight(this._options.lineHeight);\n }\n if (this._options.textOverflow !== undefined) {\n this._text.setTextOverflow(this._options.textOverflow);\n }\n }\n\n /**\n * Applies a {@link HeaderOptions} bag. Inherited Container/Component fields\n * cascade through `super.applyOptions`; text-targeting fields are written\n * pure into `_options` here and dispatched from the constructor body once\n * `this.text` exists.\n *\n * @param options - The options bag carrying the values to apply.\n */\n protected applyOptions(options: TOptions): this {\n super.applyOptions(options);\n\n if (options.text !== undefined) this._options.text = options.text;\n if (options.textAlign !== undefined) this._options.textAlign = options.textAlign;\n if (options.textShadow !== undefined) this._options.textShadow = options.textShadow;\n if (options.fontFamily !== undefined) this._options.fontFamily = options.fontFamily;\n if (options.fontSize !== undefined) this._options.fontSize = options.fontSize;\n if (options.fontWeight !== undefined) this._options.fontWeight = options.fontWeight;\n if (options.fontStyle !== undefined) this._options.fontStyle = options.fontStyle;\n if (options.fontVariant !== undefined) this._options.fontVariant = options.fontVariant;\n if (options.fontStretch !== undefined) this._options.fontStretch = options.fontStretch;\n if (options.fontKerning !== undefined) this._options.fontKerning = options.fontKerning;\n if (options.fontSizeAdjust !== undefined) this._options.fontSizeAdjust = options.fontSizeAdjust;\n if (options.lineHeight !== undefined) this._options.lineHeight = options.lineHeight;\n if (options.textOverflow !== undefined) this._options.textOverflow = options.textOverflow;\n\n return this;\n }\n\n /**\n * Recalculates the preferred height from the text component's measured preferred size.\n *\n * Called at construction time and after each theme change so that font-size\n * adjustments propagate to the header's layout hint automatically. `protected`\n * so a subclass can override the derivation — `WindowHeader` substitutes a\n * chrome-band thickness so its stretched controls fill the bar.\n */\n protected updatePreferredSize(): void {\n const textSize = this._text.getPreferredSize();\n const insets = this.getInsets();\n const textHeight = textSize ? textSize.height : 20;\n const preferredHeight = textHeight\n + insets.getTop()\n + insets.getBottom();\n\n this.setPreferredSize({ width: 100, height: preferredHeight });\n }\n\n /**\n * Returns the Text child used to display the header text.\n *\n * @returns The internal Text instance.\n */\n getText() {\n return this._text;\n }\n\n /**\n * Returns the offset from the top of the header to the label's text baseline.\n *\n * @returns The baseline offset in pixels, or `null` when the label has no baseline.\n */\n getBaseline(): number | null {\n return this.wrapInnerBaseline(this._text.getBaseline());\n }\n}\n\nconst HeaderCallable = callable(Header);\ntype HeaderCallable<TOptions extends HeaderOptions = HeaderOptions> = Header<TOptions>;\nexport {\n Header as _Header,\n HeaderCallable as Header\n};\n"],"mappings":"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aAAiB,EAAQ,cAE1E,IACX,CAUA,qBAAsC,CAClC,IAAM,EAAW,KAAK,MAAM,iBAAiB,EACvC,EAAS,KAAK,UAAU,EAExB,GADa,EAAW,EAAS,OAAS,IAElB,EAAO,OAAO,EACd,EAAO,UAAU,EAE/C,KAAK,iBAAiB,CAAE,MAAO,IAAK,OAAQ,CAAgB,CAAC,CACjE,CAOA,SAAU,CACN,OAAO,KAAK,KAChB,CAOA,aAA6B,CACzB,OAAO,KAAK,kBAAkB,KAAK,MAAM,YAAY,CAAC,CAC1D,CACJ,EAEM,EAAiB,EAAS,MAAM"}
|
|
1
|
+
{"version":3,"file":"Header-Cj33ABP1.js","names":[],"sources":["../../src/typescript/lib/component/display/Header.ts"],"sourcesContent":["// SPDX-License-Identifier: PolyForm-Noncommercial-1.0.0\n\nimport { Border as BorderLayout } from \"~/layout/Border.js\";\nimport { Text, TextOptions } from \"~/component/input/Text.js\";\nimport { Insets } from \"~/primitive/Insets.js\";\nimport { AnchorType } from \"~/layout/AnchorType.js\";\nimport { FillType } from \"~/layout/FillType.js\";\nimport { Placement } from \"~/primitive/Placement.js\";\nimport { Container } from \"~/core/Container.js\";\nimport { callable } from \"~/core/Callable.js\";\n\n/**\n * Construction-time options for {@link Header}. Text and font fields target\n * the inner header label, not the header bar itself.\n *\n * @category Components\n */\nexport interface HeaderOptions extends TextOptions {\n}\n\n/**\n * User-overridable defaults forwarded to `super` via the options bag. The\n * cascade in `Container`/`Component` dispatches each present setter once with the\n * final value. Font fields are handled in the constructor body once the inner\n * `text` child exists — they're written into `_options` by `applyOptions` and\n * dispatched from there.\n */\nconst _defaultHeaderOptions: Partial<HeaderOptions> = {\n // Static content padding around the header label — the single source of the\n // bar's padding (WindowHeader subclasses Header without passing its own\n // insets). 4px matches the spacing headers carried implicitly from Panel\n // before the Container reparent; it is not theme-derived, so headers do not\n // reflow their padding on a theme change.\n insets: new Insets(4, 4, 4, 4),\n};\n\n/**\n * A header bar component containing a left-aligned text label.\n *\n * Renders a `<header>` element with a Border layout manager and a bold label\n * anchored to the west side.\n *\n * @category Components\n */\nclass Header<TOptions extends HeaderOptions = HeaderOptions> extends Container<TOptions> {\n\n private _text!: Text;\n\n /**\n * @param text - The header's label text.\n * @param options - Optional construction-time options.\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?: TOptions, subclassDefaults?: Partial<TOptions>) {\n super(\n options,\n {\n ..._defaultHeaderOptions,\n tag: \"header\",\n ...(subclassDefaults ?? {}),\n } as Partial<TOptions>,\n );\n\n this.setLayoutManager(new BorderLayout());\n\n // Build the inner text label. Font defaults are applied here when the\n // caller didn't supply an override — the cascade can't reach `this.text`\n // because it doesn't exist yet during `super`.\n this._text = new Text(text);\n if (this._options.fontWeight === undefined) {\n this._text.setFontWeight(\"bold\");\n }\n if (this._options.fontSize === undefined) {\n this._text.setFontSize(\"--ts-ui-header-font-size\");\n }\n this._text.setPointerEvents(\"none\");\n\n this.addComponent(this._text, {\n placement: Placement.WEST,\n anchor: AnchorType.WEST,\n fill: FillType.HORIZONTAL\n });\n\n // Recompute the preferred height on theme change: the header font size\n // is theme-bound, so a theme swap can change the label's measured height.\n // The insets are static (see `_defaultHeaderOptions`), so padding is not\n // re-derived here.\n this.subscribeTheme(() => {\n this.updatePreferredSize();\n });\n\n if (this._options.preferredSize === undefined) {\n this.updatePreferredSize();\n }\n\n // Late-built state: font/text fields written pure into `_options` by\n // the super-time cascade. Dispatch them now that `this.text` exists.\n if (this._options.text !== undefined) {\n this._text.setText(this._options.text);\n }\n if (this._options.textAlign !== undefined) {\n this._text.setTextAlign(this._options.textAlign);\n }\n if (this._options.textShadow !== undefined) {\n this._text.setTextShadow(this._options.textShadow);\n }\n if (this._options.fontFamily !== undefined) {\n this._text.setFontFamily(this._options.fontFamily);\n }\n if (this._options.fontSize !== undefined) {\n this._text.setFontSize(this._options.fontSize);\n }\n if (this._options.fontWeight !== undefined) {\n this._text.setFontWeight(this._options.fontWeight);\n }\n if (this._options.fontStyle !== undefined) {\n this._text.setFontStyle(this._options.fontStyle);\n }\n if (this._options.fontVariant !== undefined) {\n this._text.setFontVariant(this._options.fontVariant);\n }\n if (this._options.fontStretch !== undefined) {\n this._text.setFontStretch(this._options.fontStretch);\n }\n if (this._options.fontKerning !== undefined) {\n this._text.setFontKerning(this._options.fontKerning);\n }\n if (this._options.fontSizeAdjust !== undefined) {\n this._text.setFontSizeAdjust(this._options.fontSizeAdjust);\n }\n if (this._options.lineHeight !== undefined) {\n this._text.setLineHeight(this._options.lineHeight);\n }\n if (this._options.textOverflow !== undefined) {\n this._text.setTextOverflow(this._options.textOverflow);\n }\n }\n\n /**\n * Applies a {@link HeaderOptions} bag. Inherited Container/Component fields\n * cascade through `super.applyOptions`; text-targeting fields are written\n * pure into `_options` here and dispatched from the constructor body once\n * `this.text` exists.\n *\n * @param options - The options bag carrying the values to apply.\n */\n protected applyOptions(options: TOptions): this {\n super.applyOptions(options);\n\n if (options.text !== undefined) this._options.text = options.text;\n if (options.textAlign !== undefined) this._options.textAlign = options.textAlign;\n if (options.textShadow !== undefined) this._options.textShadow = options.textShadow;\n if (options.fontFamily !== undefined) this._options.fontFamily = options.fontFamily;\n if (options.fontSize !== undefined) this._options.fontSize = options.fontSize;\n if (options.fontWeight !== undefined) this._options.fontWeight = options.fontWeight;\n if (options.fontStyle !== undefined) this._options.fontStyle = options.fontStyle;\n if (options.fontVariant !== undefined) this._options.fontVariant = options.fontVariant;\n if (options.fontStretch !== undefined) this._options.fontStretch = options.fontStretch;\n if (options.fontKerning !== undefined) this._options.fontKerning = options.fontKerning;\n if (options.fontSizeAdjust !== undefined) this._options.fontSizeAdjust = options.fontSizeAdjust;\n if (options.lineHeight !== undefined) this._options.lineHeight = options.lineHeight;\n if (options.textOverflow !== undefined) this._options.textOverflow = options.textOverflow;\n\n return this;\n }\n\n /**\n * Recalculates the preferred height from the text component's measured preferred size.\n *\n * Called at construction time and after each theme change so that font-size\n * adjustments propagate to the header's layout hint automatically. `protected`\n * so a subclass can override the derivation — `WindowHeader` substitutes a\n * chrome-band thickness so its stretched controls fill the bar.\n */\n protected updatePreferredSize(): void {\n const textSize = this._text.getPreferredSize();\n const insets = this.getInsets();\n const textHeight = textSize ? textSize.height : 20;\n const preferredHeight = textHeight\n + insets.getTop()\n + insets.getBottom();\n\n this.setPreferredSize({ width: 100, height: preferredHeight });\n }\n\n /**\n * Returns the Text child used to display the header text.\n *\n * @returns The internal Text instance.\n */\n getText() {\n return this._text;\n }\n\n /**\n * Returns the offset from the top of the header to the label's text baseline.\n *\n * @returns The baseline offset in pixels, or `null` when the label has no baseline.\n */\n getBaseline(): number | null {\n return this.wrapInnerBaseline(this._text.getBaseline());\n }\n}\n\nconst HeaderCallable = callable(Header);\ntype HeaderCallable<TOptions extends HeaderOptions = HeaderOptions> = Header<TOptions>;\nexport {\n Header as _Header,\n HeaderCallable as Header\n};\n"],"mappings":"6QA2BA,IAAM,EAAgD,CAMlD,OAAQ,IAAI,EAAO,EAAG,EAAG,EAAG,CAAC,CACjC,EAUM,OAAN,cAAqE,CAAoB,CAErF,MASA,YAAY,EAAc,EAAoB,EAAsC,CAChF,MACI,EACA,CACI,GAAG,EACH,IAAK,SACL,GAAI,GAAoB,CAAC,CAC7B,CACJ,EAEA,KAAK,iBAAiB,IAAI,CAAc,EAKxC,KAAK,MAAQ,IAAI,EAAK,CAAI,EACtB,KAAK,SAAS,aAAe,IAAA,IAC7B,KAAK,MAAM,cAAc,MAAM,EAE/B,KAAK,SAAS,WAAa,IAAA,IAC3B,KAAK,MAAM,YAAY,0BAA0B,EAErD,KAAK,MAAM,iBAAiB,MAAM,EAElC,KAAK,aAAa,KAAK,MAAO,CAC1B,UAAW,EAAU,KACrB,OAAQ,EAAW,KACnB,KAAM,EAAS,UACnB,CAAC,EAMD,KAAK,mBAAqB,CACtB,KAAK,oBAAoB,CAC7B,CAAC,EAEG,KAAK,SAAS,gBAAkB,IAAA,IAChC,K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Q,YAC7E,EAAQ,aAAmB,IAAA,KAAW,KAAK,SAAS,WAAiB,EAAQ,YAC7E,EAAQ,WAAmB,IAAA,KAAW,KAAK,SAAS,SAAiB,EAAQ,UAC7E,EAAQ,aAAmB,IAAA,KAAW,KAAK,SAAS,WAAiB,EAAQ,YAC7E,EAAQ,YAAmB,IAAA,KAAW,KAAK,SAAS,UAAiB,EAAQ,WAC7E,EAAQ,cAAmB,IAAA,KAAW,KAAK,SAAS,YAAiB,EAAQ,aAC7E,EAAQ,cAAmB,IAAA,KAAW,KAAK,SAAS,YAAiB,EAAQ,aAC7E,EAAQ,cAAmB,IAAA,KAAW,KAAK,SAAS,YAAiB,EAAQ,aAC7E,EAAQ,iBAAmB,IAAA,KAAW,KAAK,SAAS,eAAiB,EAAQ,gBAC7E,EAAQ,aAAmB,IAAA,KAAW,KAAK,SAAS,WAAiB,EAAQ,YAC7E,EAAQ,eAAmB,IAAA,KAAW,KAAK,SAAS,aAAiB,EAAQ,cAE1E,IACX,CAUA,qBAAsC,CAClC,IAAM,EAAW,KAAK,MAAM,iBAAiB,EACvC,EAAS,KAAK,UAAU,EAExB,GADa,EAAW,EAAS,OAAS,IAElB,EAAO,OAAO,EACd,EAAO,UAAU,EAE/C,KAAK,iBAAiB,CAAE,MAAO,IAAK,OAAQ,CAAgB,CAAC,CACjE,CAOA,SAAU,CACN,OAAO,KAAK,KAChB,CAOA,aAA6B,CACzB,OAAO,KAAK,kBAAkB,KAAK,MAAM,YAAY,CAAC,CAC1D,CACJ,EAEM,EAAiB,EAAS,MAAM"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{n as e}from"./Position-
|
|
2
|
-
//# sourceMappingURL=IconText-
|
|
1
|
+
import{n as e}from"./Position-DWR1nIpA.js";import{g as t,t as n}from"./Component-YrLXKJZS.js";import{t as r}from"./Glyph-Cof7BxfJ.js";import{t as i}from"./Text-CGFXPhHD.js";import{r as a}from"./VBox-hFIZAEpT.js";var o={gap:2,insets:new e(0,0,0,0)},IconText=class extends n{_glyph;_text;constructor(e,t,n,s){super(n,{...o,layoutManager:new a,...s??{}}),this._glyph=new r(e),this._text=new i(t),this.addComponent(this._glyph),this.addComponent(this._text),this.getLayoutManager().setComponentSpacing(this.getGap()),this._options.glyph!==void 0&&this.setGlyph(this._options.glyph),this._options.text!==void 0&&this.setText(this._options.text)}applyOptions(e){return super.applyOptions(e),e.gap!==void 0&&(this._options.gap=e.gap),e.glyph!==void 0&&(this._options.glyph=e.glyph),e.text!==void 0&&(this._options.text=e.text),this}setGlyph(e){return this.removeComponent(this._glyph),this._glyph=new r(e),this.insertComponent(this._glyph,0),this}setText(e){return this._text.setText(e),this}setGap(e){return this._options.gap=e,this.getLayoutManager().setComponentSpacing(e),this}getGap(){return this._options.gap??this._defaultOptions.gap}getGlyphComponent(){return this._glyph}getTextComponent(){return this._text}},s=t(IconText);export{s as t};
|
|
2
|
+
//# sourceMappingURL=IconText-Dp64iq_q.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IconText-
|
|
1
|
+
{"version":3,"file":"IconText-Dp64iq_q.js","names":[],"sources":["../../src/typescript/lib/component/display/IconText.ts"],"sourcesContent":["// SPDX-License-Identifier: PolyForm-Noncommercial-1.0.0\n\nimport { Component, ComponentOptions } from \"~/core/Component.js\";\nimport { HBox } from \"~/layout/HBox.js\";\nimport { Insets } from \"~/primitive/Insets.js\";\nimport { Text } from \"~/component/input/Text.js\";\nimport { Glyph } from \"~/component/display/Glyph.js\";\nimport { callable } from \"~/core/Callable.js\";\n\n/**\n * Construction-time options for {@link IconText}.\n *\n * @category Components\n */\nexport interface IconTextOptions extends ComponentOptions {\n glyph?: string;\n text?: string;\n gap?: number;\n}\n\n/**\n * User-overridable defaults forwarded to `super` via the options bag. The\n * cascade dispatches each present setter once with the final value. `gap`\n * is included even though its setter touches `getLayoutManager()`: it is\n * pure-bag-written by `applyOptions` and dispatched after the HBox is built.\n * `layoutManager` is *not* listed because each instance needs its own fresh\n * HBox — sharing one instance across components would corrupt layout state.\n */\nconst _defaultIconTextOptions: Partial<IconTextOptions> = {\n gap: 2,\n insets: new Insets(0, 0, 0, 0),\n};\n\n/**\n * A small composite pairing a leading [`Glyph`](/api/component/display/classes/Glyph)\n * with a trailing standalone [`Text`](/api/component/input/classes/Text), laid out\n * horizontally with a configurable gap (default 2).\n *\n * For form-control labels that need to be associated with an input element, use\n * [`IconLabel`](/api/component/display/classes/IconLabel) instead — its trailing\n * text is a real `<label for=\"…\">`.\n *\n * @example\n * ```typescript\n * import { IconText } from '@jimka/typescript-ui/component/display';\n *\n * panel.addComponent(new IconText('times', 'Close'));\n * ```\n *\n * @category Components\n */\nclass IconText extends Component<IconTextOptions> {\n\n private _glyph!: Glyph;\n private _text!: Text;\n\n /**\n * Constructs an `IconText` pairing the named glyph with the given label text.\n *\n * @param glyph - Registry glyph name. Must be present in the internal `Glyphs` registry.\n * @param text - Label text shown to the right of the glyph.\n * @param options - Optional configuration bag (gap override, common Component fields).\n * @param subclassDefaults - Per-subclass default bag layered over this\n * class's defaults; subclasses forward their `_defaultXxxOptions`\n * constant here.\n */\n constructor(\n glyph: string,\n text: string,\n options?: IconTextOptions,\n subclassDefaults?: Partial<IconTextOptions>,\n ) {\n // The HBox sits in the defaults bag (under user options) so a caller\n // that wants a different layoutManager can still override it.\n super(options, {\n ..._defaultIconTextOptions,\n layoutManager: new HBox(),\n ...(subclassDefaults ?? {}),\n });\n\n this._glyph = new Glyph(glyph);\n this._text = new Text(text);\n\n this.addComponent(this._glyph);\n this.addComponent(this._text);\n\n // Late-built state: `gap` and `glyph`/`text` setters reach into\n // children that didn't exist during `super`'s cascade. Dispatch from\n // `_options` now that the row is built. `gap` always applies its\n // effective value (caller override, else the class default) since the\n // HBox is seeded without spacing.\n (this.getLayoutManager() as HBox).setComponentSpacing(this.getGap());\n if (this._options.glyph !== undefined) {\n this.setGlyph(this._options.glyph);\n }\n if (this._options.text !== undefined) {\n this.setText(this._options.text);\n }\n }\n\n /**\n * Applies an {@link IconTextOptions} bag. Inherited Component fields cascade\n * through `super.applyOptions`; the gap/glyph/text fields are written pure\n * to `_options` here and dispatched from the constructor body once children\n * exist.\n *\n * @param options - The options bag carrying the values to apply.\n */\n protected applyOptions(options: IconTextOptions): this {\n super.applyOptions(options);\n\n if (options.gap !== undefined) this._options.gap = options.gap;\n if (options.glyph !== undefined) this._options.glyph = options.glyph;\n if (options.text !== undefined) this._options.text = options.text;\n\n return this;\n }\n\n /**\n * Replaces the leading glyph with a fresh instance for the given registry name.\n *\n * @param name - Registry glyph name. Must be present in the internal registry.\n *\n * @returns This component, for method chaining.\n */\n setGlyph(name: string): this {\n this.removeComponent(this._glyph);\n\n this._glyph = new Glyph(name);\n this.insertComponent(this._glyph, 0);\n\n return this;\n }\n\n /**\n * Updates the trailing label text.\n *\n * @param text - The new label string.\n *\n * @returns This component, for method chaining.\n */\n setText(text: string): this {\n this._text.setText(text);\n\n return this;\n }\n\n /**\n * Sets the pixel gap between the glyph and the text.\n *\n * @param px - Gap in pixels.\n *\n * @returns This component, for method chaining.\n */\n setGap(px: number): this {\n this._options.gap = px;\n (this.getLayoutManager() as HBox).setComponentSpacing(px);\n\n return this;\n }\n\n /**\n * Returns the effective gap between the glyph and the text — the\n * caller/setter value, else the class default (2).\n *\n * @returns The gap in pixels.\n */\n getGap(): number {\n return (this._options.gap ?? this._defaultOptions.gap)!;\n }\n\n /**\n * Returns the leading glyph component.\n *\n * @returns The [`Glyph`](/api/component/display/classes/Glyph) instance.\n */\n getGlyphComponent(): Glyph {\n return this._glyph;\n }\n\n /**\n * Returns the trailing text component.\n *\n * @returns The [`Text`](/api/component/input/classes/Text) instance.\n */\n getTextComponent(): Text {\n return this._text;\n }\n}\n\nconst IconTextCallable = callable(IconText);\ntype IconTextCallable = IconText;\nexport {\n IconText as _IconText,\n IconTextCallable as IconText\n};\n"],"mappings":"oNA4BA,IAAM,EAAoD,CACtD,IAAQ,EACR,OAAQ,IAAI,EAAO,EAAG,EAAG,E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EAAS,QAAQ"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{g as e,t}from"./Component-YrLXKJZS.js";import{t as n}from"./Container-C5cxnioS.js";import{t as r}from"./Tooltip-DgRHQZhL.js";import{t as i}from"./Text-CGFXPhHD.js";import{t as a}from"./Grid-BQZ4UIUH.js";import{t as o}from"./GridConstraints-BkXa62z0.js";var s=8,LabeledGrid=class extends n{_columns;_grid;_flowCol=0;_rowCount=0;_tooltipTargets=[];constructor(e){super(e),this._columns=e?.columns??1,this._grid=new a({baselineAlign:!0,columns:2*this._columns,spacing:e?.fieldSpacing??s,columnTracks:this.buildColumnTracks(),rows:0,rowTracks:[]}),this.setLayoutManager(this._grid),e?.rows&&this.applyRows(e.rows)}addField(e,t,n){this.openRow();let a=new i(e);return this.addComponent(a),this.addComponent(t),n&&(r.attach(a,n),r.attach(t,n),this._tooltipTargets.push(a,t)),this._flowCol+=2,this._flowCol>=2*this._columns&&(this._flowCol=0),this}addRow(e){this.finishRow();for(let t of e)this.addField(t.title,t.component,t.description);return this.finishRow(),this}addFullWidthRow(e){this.finishRow(),this.openRow();let t=new o;return t.colSpan=2*this._columns,this.addComponent(e,t),this}getColumns(){return this._columns}buildColumnTracks(){let e=[];for(let t=0;t<this._columns;t++)e.push({mode:`content`}),e.push({mode:`weight`,value:1});return e}applyRows(e){for(let t of e)Array.isArray(t)?this.addRow(t):this.addFullWidthRow(t.component)}openRow(){this._flowCol===0&&(this._rowCount++,this.growRows())}finishRow(){if(this._flowCol===0)return;let e=2*this._columns-this._flowCol;for(let n=0;n<e;n++)this.addComponent(new t);this._flowCol=0}growRows(){this._grid.setRows(this._rowCount),this._grid.setRowTracks(Array.from({length:this._rowCount},()=>({mode:`content`})))}destructor(){for(let e of this._tooltipTargets)r.detach(e);this._tooltipTargets=[],super.destructor()}},c=e(LabeledGrid);export{c as t};
|
|
2
|
+
//# sourceMappingURL=LabeledGrid-Dpelrc1k.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LabeledGrid-Dpelrc1k.js","names":[],"sources":["../../src/typescript/lib/component/container/LabeledGrid.ts"],"sourcesContent":["// SPDX-License-Identifier: PolyForm-Noncommercial-1.0.0\n\nimport { Component } from \"~/core/Component.js\";\nimport { Container, ContainerOptions } from \"~/core/Container.js\";\nimport { Grid } from \"~/layout/Grid.js\";\nimport { GridConstraints } from \"~/layout/GridConstraints.js\";\nimport { GridTrack } from \"~/layout/GridTrack.js\";\nimport { Text } from \"~/component/input/Text.js\";\nimport { Tooltip } from \"~/overlay/Tooltip.js\";\nimport { callable } from \"~/core/Callable.js\";\n\n/**\n * Default inter-cell spacing (px) for the internal form grid. Mirrors the\n * hand-rolled Binding demo's `spacing: 8` so a {@link LabeledGrid} matches the\n * reference labelled-form look without the caller restating it.\n */\nconst FIELD_SPACING_DEFAULT = 8;\n\n/**\n * A title/field pair: a label and the input it labels.\n *\n * @category Components\n */\nexport interface LabeledFieldDescriptor {\n\n /** Label text rendered as a baseline-aligned `Text`. */\n title: string;\n\n /** The input/component placed beside the label. */\n component: Component;\n\n /** Optional hover explanation, attached to both the label and the component. */\n description?: string;\n}\n\n/**\n * One row of a {@link LabeledGrid}: either an array of pairs (one per logical\n * column, left-to-right; a short array leaves trailing columns empty), or a\n * single component that spans every column (status lines, button bars).\n *\n * @category Components\n */\nexport type LabeledRowDescriptor =\n | LabeledFieldDescriptor[]\n | { component: Component; fullWidth: true };\n\n/**\n * Construction-time options for {@link LabeledGrid}.\n *\n * @category Components\n */\nexport interface LabeledGridOptions extends ContainerOptions {\n\n /** Logical title/field columns laid side by side. Default `1`. */\n columns?: number;\n\n /** Inter-cell spacing in px for the grid. Default mirrors the demo's `8`. */\n fieldSpacing?: number;\n\n /** Declarative rows, applied in order at construction via the same path as `addRow`. */\n rows?: LabeledRowDescriptor[];\n}\n\n/**\n * A chrome-less baseline-aligned title/field grid, rendered in a plain `<div>`\n * with no border and no legend. {@link LabeledFieldSet} composes one of these\n * inside its `<fieldset>` chrome; use `LabeledGrid` directly wherever the\n * baseline-aligned form layout is wanted without the fieldset border/legend.\n *\n * The body is a single [`Grid`](/api/layout/classes/Grid) in\n * `baselineAlign` mode with `2 × columns` grid-columns: each logical column is\n * a content-sized title track followed by a weight-sized input track, so titles\n * hug their text while inputs share a common right edge per column. Pairs flow\n * left-to-right and wrap to a new row when the current one fills; a full-width\n * row spans every column via [`GridConstraints`](/api/layout/classes/GridConstraints)\n * `colSpan`.\n *\n * @category Components\n */\nclass LabeledGrid extends Container<LabeledGridOptions> {\n\n /** Logical title/field column count (the grid has `2 ×` this many grid-columns). */\n private _columns: number;\n\n /** The internal baseline grid; its `rows`/`rowTracks` grow as rows are added. */\n private _grid: Grid;\n\n /** Next free grid-column on the current flow row (0-based, in grid-columns). */\n private _flowCol: number = 0;\n\n /** Running grid-row count, pushed into the grid's `rows` + `rowTracks`. */\n private _rowCount: number = 0;\n\n /** Components a description tooltip was attached to, detached on teardown. */\n private _tooltipTargets: Component[] = [];\n\n /**\n * Builds the grid, installs the internal baseline grid, and replays any\n * declarative `rows`.\n *\n * @param options - Grid structure: `columns`, `fieldSpacing`, `rows`.\n */\n constructor(options?: LabeledGridOptions) {\n super(options);\n\n this._columns = options?.columns ?? 1;\n\n this._grid = new Grid({\n baselineAlign: true,\n columns: 2 * this._columns,\n spacing: options?.fieldSpacing ?? FIELD_SPACING_DEFAULT,\n columnTracks: this.buildColumnTracks(),\n rows: 0,\n rowTracks: [],\n });\n\n this.setLayoutManager(this._grid);\n\n if (options?.rows) {\n this.applyRows(options.rows);\n }\n }\n\n /**\n * Appends one title/field pair into the next free logical column, flowing to\n * a new row when the current one fills.\n *\n * @param title - Label text placed in the content (title) column.\n * @param component - The input placed in the weight (field) column.\n * @param description - Optional hover explanation, attached to both the\n * label and `component`. Omitted (or an empty string) attaches nothing.\n * @returns This component, for method chaining.\n */\n addField(title: string, component: Component, description?: string): this {\n this.openRow();\n\n const label = new Text(title);\n\n this.addComponent(label);\n this.addComponent(component);\n\n if (description) {\n Tooltip.attach(label, description);\n Tooltip.attach(component, description);\n\n this._tooltipTargets.push(label, component);\n }\n\n this._flowCol += 2;\n\n if (this._flowCol >= 2 * this._columns) {\n this._flowCol = 0;\n }\n\n return this;\n }\n\n /**\n * Appends a full row of pairs (one per logical column; trailing columns are\n * left empty for a short array).\n *\n * @param fields - The pairs to place across the row, left-to-right.\n * @returns This component, for method chaining.\n */\n addRow(fields: LabeledFieldDescriptor[]): this {\n this.finishRow();\n\n for (const field of fields) {\n this.addField(field.title, field.component, field.description);\n }\n\n this.finishRow();\n\n return this;\n }\n\n /**\n * Appends a component spanning every column on its own row.\n *\n * @param component - The component to span the full grid width.\n * @returns This component, for method chaining.\n */\n addFullWidthRow(component: Component): this {\n this.finishRow();\n this.openRow();\n\n const constraints = new GridConstraints();\n constraints.colSpan = 2 * this._columns;\n\n this.addComponent(component, constraints);\n\n return this;\n }\n\n /**\n * Returns the configured logical column count.\n *\n * @returns The number of side-by-side title/field columns.\n */\n getColumns(): number {\n return this._columns;\n }\n\n /**\n * Builds the `2 × columns` grid-column tracks: for each logical column a\n * content-sized title track (hugs its text) followed by a weight-sized input\n * track (takes the slack so inputs share a right edge).\n *\n * @returns The column tracks for the internal grid.\n */\n private buildColumnTracks(): GridTrack[] {\n const tracks: GridTrack[] = [];\n\n for (let column = 0; column < this._columns; column++) {\n tracks.push({ mode: \"content\" });\n tracks.push({ mode: \"weight\", value: 1 });\n }\n\n return tracks;\n }\n\n /**\n * Replays the declarative `rows` option through the same add path as the\n * imperative API, so construction and runtime calls share one code path.\n *\n * @param rows - The declarative row descriptors to apply, in order.\n */\n private applyRows(rows: LabeledRowDescriptor[]): void {\n for (const row of rows) {\n if (Array.isArray(row)) {\n this.addRow(row);\n } else {\n this.addFullWidthRow(row.component);\n }\n }\n }\n\n /**\n * Opens a new flow row when the first cell of one is about to be added,\n * bumping the running row count and growing the grid so its baseline\n * auto-flow does not stop short of the new row.\n */\n private openRow(): void {\n if (this._flowCol === 0) {\n this._rowCount++;\n this.growRows();\n }\n }\n\n /**\n * Pads any partially-filled flow row with empty spacer cells so the next row\n * starts at grid-column 0. The spacers carry no preferred size, contributing\n * 0 to the grid's content measurement.\n */\n private finishRow(): void {\n if (this._flowCol === 0) {\n return;\n }\n\n const remaining = 2 * this._columns - this._flowCol;\n\n for (let cell = 0; cell < remaining; cell++) {\n this.addComponent(new Component());\n }\n\n this._flowCol = 0;\n }\n\n /**\n * Re-sizes the grid's row count and row tracks to the running row total.\n * Every row track is `content`-sized so inputs keep their natural height.\n */\n private growRows(): void {\n this._grid.setRows(this._rowCount);\n this._grid.setRowTracks(Array.from({ length: this._rowCount }, () => ({ mode: \"content\" as const })));\n }\n\n /**\n * Detaches every description tooltip this grid attached, so a component it\n * hover-wired does not stay pinned in `Tooltip`'s attachment registry after\n * the grid itself is torn down.\n */\n protected destructor(): void {\n for (const target of this._tooltipTargets) {\n Tooltip.detach(target);\n }\n\n this._tooltipTargets = [];\n\n super.destructor();\n }\n}\n\nconst LabeledGridCallable = callable(LabeledGrid);\ntype LabeledGridCallable = LabeledGrid;\nexport {\n LabeledGrid as _LabeledGrid,\n LabeledGridCallable as LabeledGrid\n};\n"],"mappings":"oQAgBA,IAAM,EAAwB,EA+DxB,YAAN,cAA0B,CAA8B,CAGpD,SAGA,MAGA,SAA2B,EAG3B,UAA4B,EAG5B,gBAAuC,CAAC,EAQxC,YAAY,EAA8B,CACtC,MAAM,CAAO,EAEb,KAAK,SAAW,GAAS,SAAW,EAEpC,KAAK,MAAQ,IAAI,EAAK,CAClB,cAAe,GACf,QAAe,EAAI,KAAK,SACxB,QAAe,GAAS,cAAgB,EACxC,aAAe,KAAK,kBAAkB,EACtC,KAAe,EACf,UAAe,CAAC,CACpB,CAAC,EAED,KAAK,iBAAiB,KAAK,KAAK,EAE5B,GAAS,MACT,KAAK,UAAU,EAAQ,IAAI,CAEnC,CAYA,SAAS,EAAe,EAAsB,EAA4B,CACtE,KAAK,QAAQ,EAEb,IAAM,EAAQ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,QAAQ,KAAK,SAAS,EACjC,KAAK,MAAM,aAAa,MAAM,KAAK,CAAE,OAAQ,KAAK,SAAU,OAAU,CAAE,KAAM,SAAmB,EAAE,CAAC,CACxG,CAOA,YAA6B,CACzB,IAAK,IAAM,KAAU,KAAK,gBACtB,EAAQ,OAAO,CAAM,EAGzB,KAAK,gBAAkB,CAAC,EAExB,MAAM,WAAW,CACrB,CACJ,EAEM,EAAsB,EAAS,WAAW"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{t as e}from"./DOM-DDhDN8lQ.js";import{a as t,l as n,t as r}from"./Position-DWR1nIpA.js";import{g as i,h as a,p as o,t as s}from"./Component-YrLXKJZS.js";import{t as c}from"./ListenerBag-DYRl4TSb.js";import{t as l}from"./Container-C5cxnioS.js";import{a as u}from"./Tooltip-DgRHQZhL.js";import{a as d,i as f,n as p,r as m,s as h,t as g}from"./RadioMenuRow-B2bthoxj.js";import{o as _,t as v}from"./Window-CQ14_65z.js";import{n as y,r as b,s as x,t as S}from"./DragManager-D5pBaPPg.js";import{t as C}from"./Menu-BCQISKiQ.js";import{t as w}from"./LayoutConstraints-LIHYYd2F.js";import{i as T,n as E}from"./Border-BELbqMDJ.js";var D=4,O=1,Split=class extends o{_orientation=`horizontal`;_collapseTrigger=`dblclick`;_sizes=new Map;_gutters=[];_collapsed=new Map;_weights=new Map;_pendingCollapsed=[];_listeners=this.registerListenerBag(new c);_contextMenu=null;_pendingSizes=null;_dragOriginPointer=0;_dragOriginLhsSize=0;_dragOriginRhsSize=0;_lastAvailableMain=0;_collapseAnimation=null;_pendingCollapseTransitions=[];constructor(e){super(),e&&this.applyOptions(e)}applyOptions(e){if(super.applyOptions(e),e.orientation!==void 0&&this.setOrientation(e.orientation),e.collapseTrigger!==void 0&&(this._collapseTrigger=e.collapseTrigger),e.collapsedPanes!==void 0&&(this._pendingCollapsed=[...e.collapsedPanes]),e.paneSizes!==void 0&&(this._pendingSizes=e.paneSizes.map(e=>({...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)}}}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)}isPaneCollapsed(e){let t=this.getContainer();if(!t)return!1;let n=t.getLaidOutComponents()[e];return n?this._collapsed.get(n)??!1:!1}collapsesTowardStart(e){return e===`west`||e===`north`}paneDirection(e){return this.getLayoutConstraints(e)?.collapseDirection??(this._orientation===`horizontal`?`west`:`north`)}paneCollapsible(e){return this.getLayoutConstraints(e)?.collapsible!==!1}gutterTargetPane(e,t){let n=t[e+1];if(n&&this.paneCollapsible(n)&&!this.collapsesTowardStart(this.paneDirection(n)))return e+1;let r=t[e];return r&&this.paneCollapsible(r)&&this.collapsesTowardStart(this.paneDirection(r))?e:-1}paneServingGutter(e,t){let n=this.paneDirection(t[e]);return this.collapsesTowardStart(n)?e<t.length-1&&this.gutterTargetPane(e,t)===e?e:-1:e>0&&this.gutterTargetPane(e-1,t)===e?e-1:-1}setPaneCollapsed(e,t){let n=this.getContainer();if(!n)return this;let r=n.getLaidOutComponents(),i=r[e];if(!i||this.paneServingGutter(e,r)<0||(this._collapsed.get(i)??!1)===t)return this;this._collapsed.set(i,t),this.emit(`panecollapse`,e,t);let a=[...r.map(e=>({component:e,relayout:!0})),...this._gutters.map(e=>({component:e,relayout:!1}))];return this._collapseAnimation=T(n,i,a,this._collapseAnimation,this._pendingCollapseTransitions,()=>{this._collapseAnimation=null}),this}getOrientation(){return this._orientation}setOrientation(e){return this._orientation=e,this}setPaneSize(e,t){return this._sizes.set(e,t),this}getPaneSize(e){return this._sizes.get(e)}setPaneResizeWeight(e,t){return t===void 0?this._weights.delete(e):this._weights.set(e,t),this}getPaneResizeWeight(e){return this._weights.get(e)}effectiveResizeWeight(e,t){return this._weights.get(e)??this.getLayoutConstraints(e)?.weight??t}clampMain(e,t,r){let i=e.getMinSize(),a=e.getMaxSize(),o=i?r?i.width:i.height:0,s=a?r?a.width:a.height:1/0;return n.clamp(t,o,s)}isPinnedMain(e,t){let n=e.getMinSize(),r=e.getMaxSize();return(n?t?n.width:n.height:0)===(r?t?r.width:r.height:1/0)}isResizePinnedMain(e){return this.effectiveResizeWeight(e,O)===0}seedFromPreferred(e,t){for(let n of e){if(this._sizes.has(n))continue;let e=n.getPreferredSizeConstraint();if(!e)continue;let r=t?e.width:e.height;this._sizes.set(n,this.clampMain(n,r,t))}}transferPaneSize(e,t){let n=this._sizes.get(e);if(n===void 0)return this;this._sizes.set(t,n),this._sizes.delete(e);let r=this._collapsed.get(e);r!==void 0&&(this._collapsed.set(t,r),this._collapsed.delete(e));let i=this._weights.get(e);return i!==void 0&&(this._weights.set(t,i),this._weights.delete(e)),this}getPaneRatios(){let e=this.getContainer();if(!e)return[];let t=e.getComponents();if(t.length===0)return[];let n=t.map(e=>this._sizes.get(e)??0);return f(n,t.length)}getPreferredSize(){return this.computeContentSize(e=>e.getPreferredSize())}getMinSize(){return this.computeContentSize(e=>e.getMinSize())}getMaxSize(){return{width:t,height:t}}computeContentSize(e){let t=this.getContainer();if(!t)return null;let n=t.getLaidOutComponents(),r=t.getPerimeterSize(),i=this._orientation===`horizontal`,a=0,o=0;for(let t=0;t<n.length;t+=1){let r=e(n[t]);r&&(a+=i?r.width:r.height,o=Math.max(o,i?r.height:r.width))}return a+=this.gutterTotal(n.length),i?{width:a+r.left+r.right,height:o+r.top+r.bottom}:{width:o+r.left+r.right,height:a+r.top+r.bottom}}applyPaneRatios(e){let t=this.getContainer();if(!t)return this;let n=t.getComponents(),r=n.length;if(r===0)return this;let i=f(e,r),a=t.getInnerSize(),o=a?this._orientation===`horizontal`?a.width:a.height:0,s=Math.max(0,o-this.gutterTotal(r)),c=s>0?s:1;return n.forEach((e,t)=>{this._sizes.set(e,i[t]*c)}),this._lastAvailableMain=c,t.scheduleLayout(),this}paneSizeUnits(e){return e.map(e=>this.isResizePinnedMain(e)?`px`:`ratio`)}getPaneSizes(){let e=this.getContainer();if(!e)return[];let t=e.getComponents();if(t.length===0)return[];let n=this.paneSizeUnits(t);return this._pendingSizes!==null&&m(this._pendingSizes,n)?this._pendingSizes.map(e=>({...e})):d(n,t.map(e=>this._sizes.get(e)??0))}applyPaneSizes(e){let t=this.getContainer();if(!t)return this;let n=t.getComponents(),r=this.paneSizeUnits(n);if(!m(e,r))return this;let i=t.getInnerSize(),a=i?this._orientation===`horizontal`?i.width:i.height:0,o=Math.max(0,a-this.gutterTotal(n.length)),s=p(e,o);return n.forEach((e,t)=>this.setPaneSize(e,s[t])),this._lastAvailableMain=o>0?o:1,t.scheduleLayout(),this}setPaneCollapsedImmediate(e,t){let n=this.getContainer();if(!n)return this;let r=n.getLaidOutComponents(),i=r[e];return!i||t&&this.paneServingGutter(e,r)<0?this:(this._collapsed.set(i,t),this.emit(`panecollapse`,e,t),n.scheduleLayout(),this)}onDragStart(e,t,n){let r=this._gutters.indexOf(t),i=e.getLaidOutComponents()[r],a=e.getLaidOutComponents()[r+1];this._dragOriginPointer=n,this._orientation===`horizontal`?(this._dragOriginLhsSize=i.getWidth(),this._dragOriginRhsSize=a.getWidth()):(this._dragOriginLhsSize=i.getHeight(),this._dragOriginRhsSize=a.getHeight())}onDrag(e,t,n){let r=this._gutters.indexOf(t),i=e.getLaidOutComponents()[r],a=e.getLaidOutComponents()[r+1],o=this._orientation===`horizontal`,s=this._dragOriginLhsSize+this._dragOriginRhsSize,c=i.getMinSize(),l=a.getMinSize(),u=i.getMaxSize(),d=a.getMaxSize(),f=c?o?c.width:c.height:0,p=l?o?l.width:l.height:0,m=u?o?u.width:u.height:1/0,h=d?o?d.width:d.height:1/0,g=n-this._dragOriginPointer,_=Math.max(f,s-h),v=Math.min(m,s-p),y=this._dragOriginLhsSize+g;y=Math.max(_,Math.min(v,y));let b=s-y,x=y-(o?i.getWidth():i.getHeight());o?(i.setWidth(y),t.setX(t.getX()+x),a.setX(a.getX()+x),a.setWidth(b)):(i.setHeight(y),t.setY(t.getY()+x),a.setY(a.getY()+x),a.setHeight(b)),this._sizes.set(i,y),this._sizes.set(a,b),i.doLayout(),a.doLayout()}onDragEnd(){this.emit(`paneresize`,this.getPaneSizes())}openGutterMenu(e,t,n,r){let i=this.getContainer();if(!i)return;let a=i.getLaidOutComponents(),o=a[t],s=a[t+1];if(!o||!s)return;let c=this._orientation===`horizontal`,l=c?`left`:`top`,u=c?`right`:`bottom`,d=c?`width`:`height`,f=this.gutterTargetPane(t,a),p=null,m=null,syncCollapseRows=()=>{let e=this.gutterTargetPane(t,a);p?.setChecked(e===t),m?.setChecked(e===t+1)},h=[{row:()=>{let t=new x({text:`Lock gutter`,checked:!e.isMovable()});return t.on(`action`,()=>{e.setMovable(!e.isMovable())}),t}},{separator:!0},{row:()=>{let e=new x({text:`Fix ${l} pane ${d}`,checked:this.getPaneResizeWeight(o)===0});return e.on(`action`,()=>{this.togglePaneResizePin(o)}),e}},{row:()=>{let e=new x({text:`Fix ${u} pane ${d}`,checked:this.getPaneResizeWeight(s)===0});return e.on(`action`,()=>{this.togglePaneResizePin(s)}),e}},{separator:!0},{row:()=>{let n=new g({text:`Collapse ${l} pane`,checked:f===t,enabled:!e.isOpaque()&&this.paneCollapsible(o)});return n.on(`action`,()=>{this.retargetGutterCollapse(t,t),syncCollapseRows()}),p=n,n}},{row:()=>{let n=new g({text:`Collapse ${u} pane`,checked:f===t+1,enabled:!e.isOpaque()&&this.paneCollapsible(s)});return n.on(`action`,()=>{this.retargetGutterCollapse(t,t+1),syncCollapseRows()}),m=n,n}}];this._contextMenu??=new C,this._contextMenu.show(n,r,h)}togglePaneResizePin(e){this.setPaneResizeWeight(e,this.getPaneResizeWeight(e)===0?void 0:0)}retargetGutterCollapse(e,t){let n=this.getContainer();if(!n)return;let r=n.getLaidOutComponents(),i=r[e],a=r[e+1];if(!i||!a)return;let o=this._orientation===`horizontal`?`west`:`north`,s=this._orientation===`horizontal`?`east`:`south`;t===e?(this.setPaneCollapseDirection(i,o),this.setPaneCollapseDirection(a,o)):this.setPaneCollapseDirection(a,s),n.scheduleLayout()}setPaneCollapseDirection(e,t){let n=this.getLayoutConstraints(e)??new w;n.collapseDirection=t,this.setLayoutConstraints(e,n)}detach(){this._collapseAnimation?.(),this._collapseAnimation=null;let t=(this.getContainer()?.getComponents().length??0)>0;for(let e of this._pendingCollapseTransitions)t?e.settle():e.cancel();this._pendingCollapseTransitions.length=0,super.detach();for(let t of this._gutters){let n=t.getElement();e.sink.removeChild(e.source.getParentNode(n),n),t.dispose()}return this._gutters=[],this._contextMenu?.dispose(),this._contextMenu=null,this}gutterTotal(e){return Math.max(0,e-1)*D}computeTotalMinSize(){let e=this.getContainer();if(!e)return{width:0,height:0};let t=e.getLaidOutComponents();if(t.length===0)return{width:0,height:0};let n=t.length-1,r=0,i=0;for(let e=0;e<t.length;e+=1){let a=t[e],o=this._sizes.get(a),s=this._collapsed.get(a)??!1,c=e<n;if(s&&c)r+=18;else{if(!s){if(o!=null)r+=o;else{let e=a.getMinSize();e&&(r+=this._orientation===`horizontal`?e.width:e.height)}}c&&(r+=D)}let l=a.getMinSize();l&&(i=Math.max(i,this._orientation===`horizontal`?l.height:l.width))}return this._orientation===`horizontal`?{width:r,height:i}:{width:i,height:r}}doLayout(){let t=this,n=this.getContainer();if(!n)return;let r=n.getInnerSize();if(!r)return;let i=this._orientation===`horizontal`?r.width:r.height;r=this.inflateForOverflow(r);let o=n.getElement(),s=n.getLaidOutComponents(),c=n.getContentInsets(),l=s.length-1;for(let r=this._gutters.length;r<l;r+=1){let i=new E(this._orientation,{expandedBackground:`transparent`,collapseTrigger:this._collapseTrigger}),a=r;i.on(`dragstart`,function(e){t.onDragStart(n,i,e)}),i.on(`drag`,function(e){t.onDrag(n,i,e)}),i.on(`dragend`,()=>this.onDragEnd()),i.on(`collapse`,function(){let e=t.gutterTargetPane(a,n.getLaidOutComponents());e>=0&&t.setPaneCollapsed(e,!t.isPaneCollapsed(e))}),i.on(`contextmenu`,function(e,n){t.openGutterMenu(i,a,e,n)}),this._gutters.push(i),e.sink.appendChild(o,i.getElement(!0))}let u=c.getLeft(),d=c.getTop();this.recalculateSizes(),this.applyPendingSizes(),this.applyPendingCollapsed(s);let f=this._orientation===`horizontal`,p=f?r.height:r.width,m=this.computeMainAxisSizes(s,i),h=new Set,g=[];for(let e=0;e<s.length;e+=1){let t=s[e],n=this.paneServingGutter(e,s);if((this._collapsed.get(t)??!1)&&n>=0){let e=this._gutters[n];e.setCollapseDirection(this.paneDirection(t)),e.setCollapsible(!0),g.push(this.placeGutterAsStrip(e,t,u,d,p,f,this.paneDirection(t))),h.add(n),f?u+=18:d+=18;continue}let r=m.get(t);if(t.setVisible(!0),g.push({component:t,...this.resolveBounds(t,u,d,f?r:p,f?p:r,a.BOTH),clipPath:n>=0?`inset(0 0 0 0)`:null}),f?u+=r:d+=r,e<l){let t=this._gutters[e],n=this.gutterTargetPane(e,s);!(n>=0&&(this._collapsed.get(s[n])??!1)&&this.paneServingGutter(n,s)===e)&&!h.has(e)&&(t.setOpaque(!1),t.setVisible(!0),t.setCollapsible(n>=0),n>=0&&t.setCollapseDirection(this.paneDirection(s[n])),t.setX(u),t.setY(d),f?(t.setWidth(D),t.setHeight(p),u+=D):(t.setWidth(p),t.setHeight(D),d+=D),h.add(e))}}this.commitPanes(g);for(let e=0;e<this._gutters.length;e+=1)h.has(e)||this._gutters[e].setVisible(!1)}placeGutterAsStrip(e,t,n,r,i,o,s){e.setOpaque(!0),e.setVisible(!0),e.setX(n),e.setY(r),o?(e.setWidth(18),e.setHeight(i)):(e.setWidth(i),e.setHeight(18));let c=this._sizes.get(t)??18,l=this.collapsesTowardStart(s);t.setVisible(!0);let u;if(o){let e=l?n:n+18-c;u={component:t,...this.resolveBounds(t,e,r,c,i,a.BOTH),clipPath:this.paneClipInset(s)}}else{let e=l?r:r+18-c;u={component:t,...this.resolveBounds(t,n,e,i,c,a.BOTH),clipPath:this.paneClipInset(s)}}return u}commitPanes(e){for(let t of e)this.commitBounds(t.component,t.x,t.y,t.width,t.height),t.component.setClipPath(t.clipPath)}paneClipInset(e){switch(e){case`east`:return`inset(0 0 0 100%)`;case`north`:return`inset(0 0 100% 0)`;case`south`:return`inset(100% 0 0 0)`;default:return`inset(0 100% 0 0)`}}applyPendingSizes(){let e=this._pendingSizes;e!==null&&(this._pendingSizes=null,this.applyPaneSizes(e))}applyPendingCollapsed(e){if(this._pendingCollapsed.length!==0){for(let t of this._pendingCollapsed){let n=e[t];n&&this.paneServingGutter(t,e)>=0&&this._collapsed.set(n,!0)}this._pendingCollapsed=[]}}computeMainAxisSizes(e,t){let n=e.length-1,r=0,i=0,a=0;for(let t=0;t<e.length;t+=1){let o=e[t];(this._collapsed.get(o)??!1)&&this.paneServingGutter(t,e)>=0?(i+=1,!this.collapsesTowardStart(this.paneDirection(o))&&t<n&&(a+=1)):r+=this._sizes.get(o)??0}let o=Math.max(0,t-this.gutterTotal(e.length)),s=Math.max(0,o-i*(18-D)+a*D),c=r>0?s/r:0,l=new Map;for(let t=0;t<e.length;t+=1){let n=e[t],r=(this._collapsed.get(n)??!1)&&this.paneServingGutter(t,e)>=0;l.set(n,r?0:(this._sizes.get(n)??0)*c)}return l}recalculateSizes(){let e=this.getContainer();if(!e)return;let t=e.getInnerSize();if(!t)return;let n=e.getComponents();for(let e of[...this._sizes.keys()])n.indexOf(e)<0&&(this._sizes.delete(e),this._collapsed.delete(e));for(let e of[...this._weights.keys()])n.indexOf(e)<0&&this._weights.delete(e);let r=this._orientation===`horizontal`?t.width:t.height,i=Math.max(0,r-this.gutterTotal(n.length)),a=this._orientation===`horizontal`;this.seedFromPreferred(n,a);for(let e of n){let t=this._sizes.get(e);t!==void 0&&this._sizes.set(e,this.clampMain(e,t,a))}if(this._lastAvailableMain>0&&i>0&&i!==this._lastAvailableMain&&this._sizes.size>0){let e=i-this._lastAvailableMain,t=0;for(let e=0;e<n.length;e+=1){let r=n[e];t+=this.effectiveResizeWeight(r,this._sizes.get(r)??0)}if(t>0)for(let r=0;r<n.length;r+=1){let i=n[r],a=this._sizes.get(i);if(a!=null){let n=this.effectiveResizeWeight(i,a);this._sizes.set(i,Math.max(0,a+n/t*e))}}}if(this._lastAvailableMain===0&&i>0&&this._sizes.size>0){let e=0;for(let t=0;t<n.length;t+=1){let r=this.effectiveResizeWeight(n[t],0);r>0&&(e+=r)}if(e>0){let t=0;for(let e=0;e<n.length;e+=1)t+=this._sizes.get(n[e])??0;let r=i-t;for(let t=0;t<n.length;t+=1){let i=n[t],o=this.effectiveResizeWeight(i,0);if(o>0){let t=this._sizes.get(i)??0;this._sizes.set(i,this.clampMain(i,t+o/e*r,a))}}}}let o=0;for(let e=0;e<n.length;e+=1){let t=n[e];this._sizes.has(t)&&(o+=1)}for(let e=0;e<n.length;e+=1){let t=n[e],r=this._sizes.get(t);if(r==null){if(this._sizes.size!=0){r=0;for(let e=0;e<n.length;e+=1){let t=n[e],i=this._sizes.get(t);if(i==null)continue;let a=i*(1/(o+1));r+=a,i-=a,this._sizes.set(t,i)}}else r=i;this._sizes.set(t,r),o+=1}}let s=0,c=0,l=0;for(let e=0;e<n.length;e+=1){let t=n[e],r=this._sizes.get(t)??0;this.isPinnedMain(t,a)?s+=r:this.isResizePinnedMain(t)?c+=r:l+=r}if(i>0){let e=Math.max(0,i-s),t=1,r=1,o=1;l>0&&e>=c?o=(e-c)/l:c>0?(o=0,r=e/c):s>0&&(t=i/s);for(let e=0;e<n.length;e+=1){let i=n[e],s=this._sizes.get(i);if(s==null)continue;let c=this.isPinnedMain(i,a)?t:this.isResizePinnedMain(i)?r:o;c!==1&&this._sizes.set(i,s*c)}}i>0&&(this._lastAvailableMain=i)}},k=i(Split),A=.25,DropZoneHighlight=class extends s{_valid=!0;constructor(){super(),this.setPosition(r.ABSOLUTE),this.setPointerEvents(`none`),this.setBackgroundColor(`var(--ts-ui-drag-dropzone-active-bg)`),this.setVisible(!1)}placeBand(e,t,n,r){this.setX(e),this.setY(t),this.setWidth(n),this.setHeight(r),this.setVisible(!0)}setValid(e){this._valid!==e&&(this._valid=e,this.setBackgroundColor(e?`var(--ts-ui-drag-dropzone-active-bg)`:`var(--ts-ui-drag-dropzone-invalid-bg)`))}hide(){this.setVisible(!1)}},j=u.Band.Window-1,DropZoneOverlay=class extends s{_highlight=new DropZoneHighlight;_zone=null;_valid=!0;constructor(){super(),this.setPosition(r.ABSOLUTE),this.setZIndex(j),this.setPointerEvents(`none`),this.setBackgroundColor(`var(--ts-ui-drag-dropzone-bg)`),this.setBorder({border:`1px solid var(--ts-ui-drag-dropzone-border)`})}attachTo(t){let n=this.getElement(!0);this.setX(0),this.setY(0),this.setWidth(t.getWidth()),this.setHeight(t.getHeight());let r=t.getElement(!0);e.source.getParentElement(n)!==r&&e.sink.appendChild(r,n);let i=this._highlight.getElement(!0);e.source.getParentElement(i)!==n&&e.sink.appendChild(n,i)}setHighlight(e,t=!0){if(e===this._zone&&t===this._valid)return;if(this._zone=e,this._valid=t,e===null){this._highlight.hide();return}this._highlight.setValid(t);let n=this.getWidth(),r=this.getHeight(),i=A,a=0,o=0,s=n,c=r;switch(e){case`top`:a=0,o=0,s=n,c=r*i;break;case`bottom`:a=0,o=r*.75,s=n,c=r*i;break;case`left`:a=0,o=0,s=n*i,c=r;break;case`right`:a=n*.75,o=0,s=n*i,c=r;break;case`center`:a=n*i,o=r*i,s=n*(1-2*i),c=r*(1-2*i)}this._highlight.placeBand(a,o,s,c)}highlightFull(){this._zone=null,this._valid=!0,this._highlight.setValid(!0),this._highlight.placeBand(0,0,this.getWidth(),this.getHeight())}detach(){this._zone=null,this._valid=!0,this.removeElement()}destructor(){this._highlight.dispose(),super.destructor()}},M=i(DropZoneOverlay),DockRegion=class{_region;_overlay=new M;_teardown;_onStructureChanged;_raiseTimer=null;constructor(e,t){this._region=e,this._onStructureChanged=t??null,this._teardown=S.makeDropTarget(e,{accepts:e=>e.dragData.tabDrag===!0,suppressValidityTint:!0,onDragOver:e=>{let t=e.dragData.componentId,n=this.dropZone(e.clientX,e.clientY);return this._overlay.attachTo(this._region),this._overlay.setHighlight(n,this.isLegalDrop(t,n)),this.scheduleSpringRaise(),null},onDragLeave:()=>{this._overlay.detach(),this.clearSpringRaise()},onDrop:e=>{let t=e.dragData.componentId,n=this.dropZone(e.clientX,e.clientY);if(this._overlay.detach(),this.clearSpringRaise(),!this.isLegalDrop(t,n))return!1;let r=b.get(t);if(!r)return!1;n===`center`?this.dockAsTab(r):this.splitOnEdge(r,n),this.raiseHostWindow(),this._onStructureChanged?.()}})}destroy(){this._teardown(),this._overlay.dispose(),this.clearSpringRaise()}hostWindow(){for(let e=this._region;e;e=e.getParentComponent())if(e instanceof _)return e;return null}raiseHostWindow(){this.hostWindow()?.bringToFront()}scheduleSpringRaise(){this._raiseTimer===null&&(this._raiseTimer=setTimeout(()=>{this._raiseTimer=null,S.isDragging()&&this.raiseHostWindow()},y))}clearSpringRaise(){this._raiseTimer!==null&&(clearTimeout(this._raiseTimer),this._raiseTimer=null)}dropZone(e,t){return this.isSeedRegion()?`center`:this.computeZone(e,t)}isSeedRegion(){return this._region.getComponents().every(e=>this._region.getLayoutConstraints(e)?.transient===!0)}computeZone(t,n){let r=e.source.getViewportRect(this._region),i=(t-r.left)/r.width,a=(n-r.top)/r.height,o=A,s=i,c=1-i,l=a,u=1-a,d=Math.min(s,c,l,u);return d>=o?`center`:d===s?`left`:d===c?`right`:d===l?`top`:`bottom`}isLegalDrop(e,t){for(let t=this._region;t;t=t.getParentComponent())if(t.getId()===e)return!1;let n=this._region.getComponents();return n.length===1&&n[0].getId()===e?!1:t===`center`?!this.isRedundantCenterDrop(e):!this.isRedundantEdgeDrop(e,t)}isRedundantCenterDrop(e){let t=b.get(e);if(!t)return!1;let n=t.getParentComponent();if(this._region.getLayoutManager()instanceof h)return n===this._region;let r=this._region.getParentComponent();return r?.getLayoutManager()instanceof h&&n===r}isRedundantEdgeDrop(e,t){let n=b.get(e);if(!n)return!1;let r=n.getParentComponent();if(!r||r.getComponents().length!==1)return!1;let i=t===`left`||t===`right`?`horizontal`:`vertical`,a=t===`top`||t===`left`,o=this._region.getLayoutManager();if(o instanceof k&&String(o.getOrientation())===i){if(r.getParentComponent()!==this._region)return!1;let e=this._region.getComponents();return a?e[0]===r:e[e.length-1]===r}let s=this._region.getParentComponent(),c=s?.getLayoutManager()instanceof h?s:this._region,l=c?.getParentComponent();if(!l)return!1;let u=l.getLayoutManager();if(!(u instanceof k&&String(u.getOrientation())===i)||r.getParentComponent()!==l)return!1;let d=l.getComponents(),f=d.indexOf(c),p=d.indexOf(r);return a?p===f-1:p===f+1}splitOnEdge(e,t){let n=t===`left`||t===`right`?`horizontal`:`vertical`,r=t===`top`||t===`left`,i=this.newStack();i.moveComponent(e);let a=this._region.getLayoutManager();if(a instanceof k&&String(a.getOrientation())===n){this._region.moveComponent(i,r?0:this._region.getComponents().length);return}let o=this._region.getParentComponent(),s=o?.getLayoutManager()instanceof h?o:this._region,c=s.getParentComponent();if(!c)return;let u=c.getLayoutManager(),d=c.getComponents().indexOf(s);if(u instanceof k&&String(u.getOrientation())===n){c.moveComponent(i,r?d:d+1);return}let f=new l({layoutManager:new k({orientation:n})});c.moveComponent(f,d);let p=this.ensureStacked(s);f.moveComponent(i,+!r),f.moveComponent(p,+!!r),u instanceof k&&u.transferPaneSize(s,f)}ensureStacked(e){let t=e.getLayoutManager();if(t instanceof h||t instanceof k)return e;let n=this.newStack();return n.moveComponent(e),n}newStack(){let e=new l({layoutManager:new h({reorderable:!0,compact:!0})});return e.getLayoutManager().on(`empty`,()=>this.pruneEmptyStack(e)),e}pruneEmptyStack(e){let t=e.getParentComponent();t&&t.getLayoutManager()instanceof k&&(t.removeComponent(e),this.collapseIfSinglePaneSplit(t))}collapseIfSinglePaneSplit(e){if(!(e.getLayoutManager()instanceof k))return;let t=e.getComponents();if(t.length!==1)return;let n=e.getParentComponent();if(!n)return;let r=n.getComponents().indexOf(e),i=n.getLayoutManager();i instanceof k&&i.transferPaneSize(e,t[0]),n.moveComponent(t[0],r),n.removeComponent(e)}dockAsTab(e){if(this._region.getLayoutManager()instanceof h){this._region.moveComponent(e),this._region.scheduleLayout();return}let t=this._region.getParentComponent();if(!t)return;if(t.getLayoutManager()instanceof h){t.moveComponent(e),t.scheduleLayout();return}let n=t.getComponents().indexOf(this._region),r=this.newStack();t.moveComponent(r,n),r.moveComponent(this._region),r.moveComponent(e),r.scheduleLayout()}};function managerKind(e){let t=e.getLayoutManager();return t?t.getClassName().replace(/^_/,``):``}function panelIdOf(e){return e.getId()}function serializableChildren(e){return e.getComponents().filter(t=>e.getLayoutConstraints(t)?.transient!==!0)}function nodeFor(e){let t=managerKind(e);if(t===`Split`){let t=e.getLayoutManager(),n=e.getComponents().map(nodeFor);return{kind:`split`,orientation:t.getOrientation()===`vertical`?`vertical`:`horizontal`,children:n,ratios:t.getPaneRatios(),collapsed:n.map((e,n)=>t.isPaneCollapsed(n))}}if(t===`Tab`){let t=e.getLayoutManager();return{kind:`tab`,children:serializableChildren(e).map(nodeFor),activeIndex:t.getActiveTabIndex()}}let n=e.getParentComponent()?.getLayoutConstraints(e),r=n?.glyph??null,i=n?.tooltip??null;return{kind:`panel`,panelId:panelIdOf(e),glyph:r,tooltip:i,closeable:n?.closeable,disposeOnClose:n?.disposeOnClose}}function windowContentOf(e){return e.getComponents().find(t=>!e.isChromeComponent(t))??null}function windowNodeFor(e){let t=windowContentOf(e);return t?{kind:`window`,content:nodeFor(t),header:e.getTitle(),rect:e.getRect(),state:e.getWindowState(),restoreRect:e.getRestoreRect()}:null}function serializeLayout(e){let t=v.getOpenWindows().map(windowNodeFor).filter(e=>e!==null);return{version:1,root:nodeFor(e),windows:t}}function collectLeaves(e,t){e.getComponents().slice().forEach(n=>{if(e.getLayoutConstraints(n)?.transient===!0){e.removeComponent(n);return}let r=managerKind(n);r===`Split`||r===`Tab`?collectLeaves(n,t):t.push(n)})}function parkLeaves(e,t,n){let r=[];collectLeaves(e,r),t.forEach(e=>{let t=windowContentOf(e);if(!t)return;let n=managerKind(t);n===`Split`||n===`Tab`?collectLeaves(t,r):r.push(t)});let i=new Map;return r.forEach(e=>{let t=panelIdOf(e);n(t)===e&&(i.set(t,e),e.getParentComponent()?.removeComponent(e))}),i}function hostsComponent(e,t){for(let n=t;n;n=n.getParentComponent())if(n===e)return!0;return!1}function constraintsFor(e){if(e.kind!==`panel`||e.glyph==null&&e.tooltip==null&&e.closeable===void 0&&e.disposeOnClose===void 0)return;let t=new w;return t.glyph=e.glyph??null,t.tooltip=e.tooltip??null,t.closeable=e.closeable,t.disposeOnClose=e.disposeOnClose,t}function materializeNode(e,t,n){if(e.kind===`panel`){let r=t.get(e.panelId)??n(e.panelId);return r||console.warn(`restoreLayout: no component for panelId "${e.panelId}"; skipping.`),r}let r=new s;return populateContainer(r,e,t,n),r}function populateContainer(e,t,n,r){if(t.kind===`split`){let i=new k({orientation:t.orientation});e.setLayoutManager(i);let a=[];t.children.forEach((i,o)=>{let s=materializeNode(i,n,r);s&&(e.moveComponent(s,void 0,constraintsFor(i)),a.push({ratio:t.ratios[o]??0,collapsed:t.collapsed[o]??!1}))}),i.applyPaneRatios(a.map(e=>e.ratio)),a.forEach((e,t)=>{e.collapsed&&i.setPaneCollapsedImmediate(t,!0)})}else{let i=new h({reorderable:!0,compact:!0});e.setLayoutManager(i),t.children.forEach(t=>{let a=materializeNode(t,n,r);a&&(e.moveComponent(a,void 0,constraintsFor(t)),i.createTab(a))}),i.setActiveTabIndex(t.activeIndex)}}function applyWindow(e,t,n){let r=e.content??(e.panelId?{kind:`panel`,panelId:e.panelId,glyph:null}:null);if(!r){console.warn(`restoreLayout: window node has neither content nor panelId; skipping.`);return}let i=materializeNode(r,t,n);if(!i)return;let a=new v(e.header);a.moveComponent(i,void 0,constraintsFor(r));let o=e.state===`normal`?e.rect:e.restoreRect??e.rect;a.applyRect(o),a.show(),e.state!==`normal`&&a.setWindowState(e.state)}function restoreLayout(e,t,n){let r=v.getOpenWindows().filter(t=>!hostsComponent(t,e)),i=parkLeaves(e,r,n);if(r.forEach(e=>e.onExitAction()),e.disposeAllComponents(),t.root.kind===`panel`){let r=materializeNode(t.root,i,n);r&&e.moveComponent(r,void 0,constraintsFor(t.root))}else populateContainer(e,t.root,i,n);t.windows.forEach(e=>applyWindow(e,i,n))}export{k as a,M as i,serializeLayout as n,DockRegion as r,restoreLayout as t};
|
|
2
|
+
//# sourceMappingURL=LayoutSerialization-DgLJSuew.js.map
|