@mono-lit/helper 0.0.0-stage → 0.0.2
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/LICENSE.md +55 -0
- package/README.md +35 -3
- package/dist/breakpoints-CAbhDUht.js +84 -0
- package/dist/checkbox-Cqpie9Ap.js +4 -0
- package/dist/chip-DBUUa2eB.js +4 -0
- package/dist/chip-limits-BMoO31JM.js +213 -0
- package/dist/chip-strip-Cw3gyz0q.js +213 -0
- package/dist/color-DHYrfXsX.js +253 -0
- package/dist/css-class-BRKRzHx-.js +60 -0
- package/dist/css-size-DhHSVZJK.js +37 -0
- package/dist/data/theme/presets.json.d.ts +140 -0
- package/dist/data-source-controller-B_rgHCjw.js +241 -0
- package/dist/data-source-controller-Dbb4fd8I.js +241 -0
- package/dist/data-source-options-CP-X62Pa.js +535 -0
- package/dist/data-source-options-Jqj7LU3Z.js +537 -0
- package/dist/data-source-read-B4DGp6UQ.js +216 -0
- package/dist/data-source-read-DL88aH8t.js +217 -0
- package/dist/decorate-DEXtNagw.js +141 -0
- package/dist/element-props-CLB6yvbm.js +114 -0
- package/dist/esm-Ptok4SQZ.js +2026 -0
- package/dist/excel-CY6zGkcx.js +608 -0
- package/dist/excel-DopRbEMK.js +608 -0
- package/dist/export-BiGVyxt6.js +2302 -0
- package/dist/export.d.ts +1 -0
- package/dist/export.js +2302 -0
- package/dist/field-icons-DELrSdqJ.js +86 -0
- package/dist/field-path-C92eGLg3.js +251 -0
- package/dist/filter-builder-Bke3qOgJ.js +205 -0
- package/dist/filter-builder-CE4zE0V5.js +205 -0
- package/dist/filter-eval-DIfU2EAn.js +173 -0
- package/dist/filter-odata-C1vSGZaY.js +591 -0
- package/dist/form-control-core-B8d7k6vk.js +223 -0
- package/dist/form-control-core-eeRr0zLU.js +223 -0
- package/dist/hydration-flush-RB5Tz5nl.js +1001 -0
- package/dist/icon-CJkTlmTb.js +55 -0
- package/dist/icon-dVhYJUIH.js +17 -0
- package/dist/import-BgJdkwBI.js +606 -0
- package/dist/import.d.ts +1 -0
- package/dist/import.js +606 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +16 -0
- package/dist/index.node-BIqEGehH.js +396 -0
- package/dist/index.node.d.ts +1 -0
- package/dist/index.node.js +16 -0
- package/dist/input-zGOULADt.js +4 -0
- package/dist/layout-var-CZnzMC0s.js +73 -0
- package/dist/light-slots-BVJwyg_2.js +244 -0
- package/dist/light-slots-DW1WgfgT.js +254 -0
- package/dist/markdown-DfqrfOJN.js +20146 -0
- package/dist/mono-button-simcTQdW.js +873 -0
- package/dist/mono-button.shadow-B_rKOY9N.js +784 -0
- package/dist/mono-data-chart-CEv29_NS.js +779 -0
- package/dist/mono-data-dropdown-Wnoke6zO.js +357 -0
- package/dist/mono-data-grid-CjkEqxgE.js +3913 -0
- package/dist/mono-data-grid-YjR3n9Ar.js +3915 -0
- package/dist/mono-element-B0kP_96P.js +232 -0
- package/dist/mono-event-Bi1qP9uN.js +129 -0
- package/dist/mono-form-controller-5PfsU4qa.js +409 -0
- package/dist/mono-modal-controller-BMO3n3rP.js +223 -0
- package/dist/mono-ui-CPV7rrdo.js +358 -0
- package/dist/normalize-error-Gcgmgh5i.js +871 -0
- package/dist/notifier-CE4yxMUQ.js +88 -0
- package/dist/nuxt.d.ts +1 -0
- package/dist/nuxt.js +130 -0
- package/dist/popup-portal-BziRX1yG.js +465 -0
- package/dist/popup-stack-CEEMib__.js +189 -0
- package/dist/rate-limit-BBa2PO79.js +521 -0
- package/dist/reactive-D3EERqgO.js +47 -0
- package/dist/reactive-Di3mTMnV.js +1087 -0
- package/dist/search.d.ts +1 -0
- package/dist/search.js +97 -0
- package/dist/src/components/accordion/accordion-core.d.ts +62 -0
- package/dist/src/components/accordion/accordion-types.d.ts +62 -0
- package/dist/src/components/accordion/index.d.ts +3 -0
- package/dist/src/components/accordion/index.shadow.d.ts +5 -0
- package/dist/src/components/accordion/mono-accordion.d.ts +55 -0
- package/dist/src/components/accordion/mono-accordion.shadow.d.ts +56 -0
- package/dist/src/components/alert/alert-core.d.ts +46 -0
- package/dist/src/components/alert/alert-types.d.ts +44 -0
- package/dist/src/components/alert/index.d.ts +3 -0
- package/dist/src/components/alert/index.shadow.d.ts +5 -0
- package/dist/src/components/alert/mono-alert.d.ts +44 -0
- package/dist/src/components/alert/mono-alert.shadow.d.ts +34 -0
- package/dist/src/components/breadcrumb/breadcrumb-core.d.ts +61 -0
- package/dist/src/components/breadcrumb/breadcrumb-list-core.d.ts +49 -0
- package/dist/src/components/breadcrumb/breadcrumb-render.d.ts +31 -0
- package/dist/src/components/breadcrumb/breadcrumb-types.d.ts +117 -0
- package/dist/src/components/breadcrumb/breadcrumb-utils.d.ts +43 -0
- package/dist/src/components/breadcrumb/index.d.ts +6 -0
- package/dist/src/components/breadcrumb/index.shadow.d.ts +8 -0
- package/dist/src/components/breadcrumb/mono-breadcrumb-list.d.ts +29 -0
- package/dist/src/components/breadcrumb/mono-breadcrumb-list.shadow.d.ts +48 -0
- package/dist/src/components/breadcrumb/mono-breadcrumb.d.ts +38 -0
- package/dist/src/components/breadcrumb/mono-breadcrumb.shadow.d.ts +73 -0
- package/dist/src/components/button/button-core.d.ts +90 -0
- package/dist/src/components/button/button-dropdown-core.d.ts +57 -0
- package/dist/src/components/button/button-dropdown-types.d.ts +129 -0
- package/dist/src/components/button/button-types.d.ts +219 -0
- package/dist/src/components/button/button-utils.d.ts +18 -0
- package/dist/src/components/button/index.button-dropdown.d.ts +4 -0
- package/dist/src/components/button/index.button-dropdown.shadow.d.ts +4 -0
- package/dist/src/components/button/index.d.ts +8 -0
- package/dist/src/components/button/index.shadow.d.ts +5 -0
- package/dist/src/components/button/mono-button-dropdown.d.ts +35 -0
- package/dist/src/components/button/mono-button-dropdown.shadow.d.ts +45 -0
- package/dist/src/components/button/mono-button.d.ts +123 -0
- package/dist/src/components/button/mono-button.shadow.d.ts +56 -0
- package/dist/src/components/card/card-core.d.ts +75 -0
- package/dist/src/components/card/card-types.d.ts +137 -0
- package/dist/src/components/card/card-utils.d.ts +23 -0
- package/dist/src/components/card/index.d.ts +4 -0
- package/dist/src/components/card/index.shadow.d.ts +6 -0
- package/dist/src/components/card/mono-card.d.ts +56 -0
- package/dist/src/components/card/mono-card.shadow.d.ts +52 -0
- package/dist/src/components/chart/chart-core.d.ts +43 -0
- package/dist/src/components/chart/chart-odata.d.ts +52 -0
- package/dist/src/components/chart/chart-types.d.ts +356 -0
- package/dist/src/components/chart/index.d.ts +8 -0
- package/dist/src/components/chart/index.shadow.d.ts +7 -0
- package/dist/src/components/chart/mono-chart-presets.d.ts +43 -0
- package/dist/src/components/chart/mono-chart-presets.shadow.d.ts +43 -0
- package/dist/src/components/chart/mono-chart.d.ts +30 -0
- package/dist/src/components/chart/mono-chart.shadow.d.ts +22 -0
- package/dist/src/components/chart/mono-data-chart.d.ts +27 -0
- package/dist/src/components/checkbox/checkbox-core.d.ts +53 -0
- package/dist/src/components/checkbox/checkbox-types.d.ts +69 -0
- package/dist/src/components/checkbox/checkbox-utils.d.ts +35 -0
- package/dist/src/components/checkbox/index.d.ts +4 -0
- package/dist/src/components/checkbox/index.shadow.d.ts +5 -0
- package/dist/src/components/checkbox/mono-checkbox.d.ts +34 -0
- package/dist/src/components/checkbox/mono-checkbox.shadow.d.ts +45 -0
- package/dist/src/components/chip/chip-core.d.ts +58 -0
- package/dist/src/components/chip/chip-types.d.ts +142 -0
- package/dist/src/components/chip/chip-utils.d.ts +24 -0
- package/dist/src/components/chip/index.d.ts +8 -0
- package/dist/src/components/chip/index.shadow.d.ts +6 -0
- package/dist/src/components/chip/mono-chip.d.ts +48 -0
- package/dist/src/components/chip/mono-chip.shadow.d.ts +33 -0
- package/dist/src/components/chip/mono-status-dot.d.ts +34 -0
- package/dist/src/components/date/date-core.d.ts +80 -0
- package/dist/src/components/date/date-types.d.ts +163 -0
- package/dist/src/components/date/index.d.ts +3 -0
- package/dist/src/components/date/index.shadow.d.ts +4 -0
- package/dist/src/components/date/mono-date.d.ts +22 -0
- package/dist/src/components/date/mono-date.shadow.d.ts +31 -0
- package/dist/src/components/drawer/drawer-core.d.ts +99 -0
- package/dist/src/components/drawer/drawer-types.d.ts +153 -0
- package/dist/src/components/drawer/index.d.ts +3 -0
- package/dist/src/components/drawer/index.shadow.d.ts +4 -0
- package/dist/src/components/drawer/mono-drawer.d.ts +45 -0
- package/dist/src/components/drawer/mono-drawer.shadow.d.ts +46 -0
- package/dist/src/components/dropdown/dropdown-core.d.ts +33 -0
- package/dist/src/components/dropdown/dropdown-types.d.ts +88 -0
- package/dist/src/components/dropdown/index.d.ts +3 -0
- package/dist/src/components/dropdown/index.shadow.d.ts +4 -0
- package/dist/src/components/dropdown/mono-dropdown.d.ts +34 -0
- package/dist/src/components/dropdown/mono-dropdown.shadow.d.ts +28 -0
- package/dist/src/components/dropdown-table/dropdown-table-core.d.ts +65 -0
- package/dist/src/components/dropdown-table/dropdown-table-types.d.ts +278 -0
- package/dist/src/components/dropdown-table/index.d.ts +5 -0
- package/dist/src/components/dropdown-table/index.shadow.d.ts +6 -0
- package/dist/src/components/dropdown-table/mono-data-dropdown.d.ts +152 -0
- package/dist/src/components/dropdown-table/mono-dropdown-table.d.ts +46 -0
- package/dist/src/components/dropdown-table/mono-dropdown-table.shadow.d.ts +22 -0
- package/dist/src/components/file-upload/file-upload-core.d.ts +60 -0
- package/dist/src/components/file-upload/file-upload-types.d.ts +145 -0
- package/dist/src/components/file-upload/file-upload-utils.d.ts +16 -0
- package/dist/src/components/file-upload/index.d.ts +4 -0
- package/dist/src/components/file-upload/index.shadow.d.ts +5 -0
- package/dist/src/components/file-upload/mono-file-upload.d.ts +33 -0
- package/dist/src/components/file-upload/mono-file-upload.shadow.d.ts +50 -0
- package/dist/src/components/filter/filter-builder-core.d.ts +36 -0
- package/dist/src/components/filter/filter-builder.d.ts +23 -0
- package/dist/src/components/filter/filter-odata.d.ts +27 -0
- package/dist/src/components/filter/filter-operators.d.ts +13 -0
- package/dist/src/components/filter/filter-types.d.ts +253 -0
- package/dist/src/components/filter/index.d.ts +6 -0
- package/dist/src/components/filter/index.shadow.d.ts +7 -0
- package/dist/src/components/filter/mono-filter-builder.d.ts +21 -0
- package/dist/src/components/filter/mono-filter-builder.shadow.d.ts +17 -0
- package/dist/src/components/form/form-control-core.d.ts +37 -0
- package/dist/src/components/form/form-rules.d.ts +25 -0
- package/dist/src/components/form/form-types.d.ts +307 -0
- package/dist/src/components/form/index.d.ts +6 -0
- package/dist/src/components/form/mono-form-controller.d.ts +16 -0
- package/dist/src/components/input/index.d.ts +6 -0
- package/dist/src/components/input/index.shadow.d.ts +8 -0
- package/dist/src/components/input/input-core.d.ts +91 -0
- package/dist/src/components/input/input-format.d.ts +118 -0
- package/dist/src/components/input/input-types.d.ts +179 -0
- package/dist/src/components/input/input-utils.d.ts +10 -0
- package/dist/src/components/input/mono-input.d.ts +46 -0
- package/dist/src/components/input/mono-input.shadow.d.ts +34 -0
- package/dist/src/components/menu/index.d.ts +6 -0
- package/dist/src/components/menu/index.shadow.d.ts +7 -0
- package/dist/src/components/menu/menu-core.d.ts +65 -0
- package/dist/src/components/menu/menu-render.d.ts +55 -0
- package/dist/src/components/menu/menu-types.d.ts +195 -0
- package/dist/src/components/menu/menu-utils.d.ts +53 -0
- package/dist/src/components/menu/mono-menu-list.d.ts +118 -0
- package/dist/src/components/menu/mono-menu.d.ts +39 -0
- package/dist/src/components/menu/mono-menu.shadow.d.ts +40 -0
- package/dist/src/components/modal/index.d.ts +4 -0
- package/dist/src/components/modal/index.shadow.d.ts +5 -0
- package/dist/src/components/modal/modal-core.d.ts +110 -0
- package/dist/src/components/modal/modal-types.d.ts +304 -0
- package/dist/src/components/modal/mono-modal-controller.d.ts +4 -0
- package/dist/src/components/modal/mono-modal.d.ts +45 -0
- package/dist/src/components/modal/mono-modal.shadow.d.ts +50 -0
- package/dist/src/components/nav/index.d.ts +4 -0
- package/dist/src/components/nav/index.shadow.d.ts +6 -0
- package/dist/src/components/nav/mono-nav.d.ts +41 -0
- package/dist/src/components/nav/mono-nav.shadow.d.ts +21 -0
- package/dist/src/components/nav/nav-core.d.ts +34 -0
- package/dist/src/components/nav/nav-types.d.ts +48 -0
- package/dist/src/components/nav/nav-utils.d.ts +12 -0
- package/dist/src/components/radio/index.d.ts +4 -0
- package/dist/src/components/radio/index.shadow.d.ts +5 -0
- package/dist/src/components/radio/mono-radio.d.ts +31 -0
- package/dist/src/components/radio/mono-radio.shadow.d.ts +35 -0
- package/dist/src/components/radio/radio-core.d.ts +45 -0
- package/dist/src/components/radio/radio-types.d.ts +58 -0
- package/dist/src/components/radio/radio-utils.d.ts +12 -0
- package/dist/src/components/rich-text-editor/index.d.ts +5 -0
- package/dist/src/components/rich-text-editor/index.shadow.d.ts +6 -0
- package/dist/src/components/rich-text-editor/mono-rich-text-editor.d.ts +31 -0
- package/dist/src/components/rich-text-editor/mono-rich-text-editor.shadow.d.ts +34 -0
- package/dist/src/components/rich-text-editor/rich-text-editor-core.d.ts +100 -0
- package/dist/src/components/rich-text-editor/rich-text-editor-loader.d.ts +17 -0
- package/dist/src/components/rich-text-editor/rich-text-editor-toolbar.d.ts +65 -0
- package/dist/src/components/rich-text-editor/rich-text-editor-types.d.ts +231 -0
- package/dist/src/components/select/index.d.ts +4 -0
- package/dist/src/components/select/index.shadow.d.ts +5 -0
- package/dist/src/components/select/mono-select.d.ts +69 -0
- package/dist/src/components/select/mono-select.shadow.d.ts +48 -0
- package/dist/src/components/select/select-core.d.ts +98 -0
- package/dist/src/components/select/select-types.d.ts +284 -0
- package/dist/src/components/select/select-utils.d.ts +7 -0
- package/dist/src/components/sidebar/index.d.ts +4 -0
- package/dist/src/components/sidebar/index.shadow.d.ts +6 -0
- package/dist/src/components/sidebar/mono-sidebar.d.ts +34 -0
- package/dist/src/components/sidebar/mono-sidebar.shadow.d.ts +27 -0
- package/dist/src/components/sidebar/sidebar-core.d.ts +51 -0
- package/dist/src/components/sidebar/sidebar-types.d.ts +119 -0
- package/dist/src/components/sidebar/sidebar-utils.d.ts +55 -0
- package/dist/src/components/switch/index.d.ts +4 -0
- package/dist/src/components/switch/index.shadow.d.ts +5 -0
- package/dist/src/components/switch/mono-switch.d.ts +31 -0
- package/dist/src/components/switch/mono-switch.shadow.d.ts +36 -0
- package/dist/src/components/switch/switch-core.d.ts +49 -0
- package/dist/src/components/switch/switch-types.d.ts +64 -0
- package/dist/src/components/switch/switch-utils.d.ts +12 -0
- package/dist/src/components/table/array-source.d.ts +44 -0
- package/dist/src/components/table/date-filter-tree.d.ts +93 -0
- package/dist/src/components/table/grouping.d.ts +55 -0
- package/dist/src/components/table/index.d.ts +33 -0
- package/dist/src/components/table/index.shadow.d.ts +47 -0
- package/dist/src/components/table/mono-data-grid.d.ts +1756 -0
- package/dist/src/components/table/mono-table-checkbox-core.d.ts +76 -0
- package/dist/src/components/table/mono-table-checkbox.d.ts +34 -0
- package/dist/src/components/table/mono-table-checkbox.shadow.d.ts +26 -0
- package/dist/src/components/table/mono-table-detail-core.d.ts +87 -0
- package/dist/src/components/table/mono-table-detail.d.ts +32 -0
- package/dist/src/components/table/mono-table-detail.shadow.d.ts +31 -0
- package/dist/src/components/table/mono-table-empty-core.d.ts +60 -0
- package/dist/src/components/table/mono-table-empty.d.ts +35 -0
- package/dist/src/components/table/mono-table-empty.shadow.d.ts +40 -0
- package/dist/src/components/table/mono-table-error-core.d.ts +84 -0
- package/dist/src/components/table/mono-table-error.d.ts +28 -0
- package/dist/src/components/table/mono-table-error.shadow.d.ts +21 -0
- package/dist/src/components/table/mono-table-info-core.d.ts +13 -0
- package/dist/src/components/table/mono-table-info.d.ts +19 -0
- package/dist/src/components/table/mono-table-info.shadow.d.ts +14 -0
- package/dist/src/components/table/mono-table-loading-core.d.ts +41 -0
- package/dist/src/components/table/mono-table-loading.d.ts +50 -0
- package/dist/src/components/table/mono-table-loading.shadow.d.ts +14 -0
- package/dist/src/components/table/mono-table-page-size-core.d.ts +14 -0
- package/dist/src/components/table/mono-table-page-size.d.ts +16 -0
- package/dist/src/components/table/mono-table-page-size.shadow.d.ts +11 -0
- package/dist/src/components/table/mono-table-paging-core.d.ts +22 -0
- package/dist/src/components/table/mono-table-paging-group-core.d.ts +18 -0
- package/dist/src/components/table/mono-table-paging-group.d.ts +20 -0
- package/dist/src/components/table/mono-table-paging-group.shadow.d.ts +13 -0
- package/dist/src/components/table/mono-table-paging.d.ts +16 -0
- package/dist/src/components/table/mono-table-paging.shadow.d.ts +11 -0
- package/dist/src/components/table/mono-table-search-core.d.ts +74 -0
- package/dist/src/components/table/mono-table-search.d.ts +34 -0
- package/dist/src/components/table/mono-table-search.shadow.d.ts +21 -0
- package/dist/src/components/table/mono-table-sort-core.d.ts +35 -0
- package/dist/src/components/table/mono-table-sort.d.ts +38 -0
- package/dist/src/components/table/mono-table-sort.shadow.d.ts +20 -0
- package/dist/src/components/table/mono-table-summary-core.d.ts +26 -0
- package/dist/src/components/table/mono-table-summary.d.ts +24 -0
- package/dist/src/components/table/mono-table-summary.shadow.d.ts +14 -0
- package/dist/src/components/table/mono-table-th-core.d.ts +56 -0
- package/dist/src/components/table/mono-table-th.d.ts +41 -0
- package/dist/src/components/table/mono-table-th.shadow.d.ts +19 -0
- package/dist/src/components/table/store-group-source.d.ts +24 -0
- package/dist/src/components/table/table-controller-core.d.ts +40 -0
- package/dist/src/components/table/table-filter-icons.d.ts +3 -0
- package/dist/src/components/table/table-menu-core.d.ts +65 -0
- package/dist/src/components/table/table-overlay.d.ts +165 -0
- package/dist/src/components/table/table-sort-icons.d.ts +4 -0
- package/dist/src/components/table/table-sort-utils.d.ts +20 -0
- package/dist/src/components/table/table-types.d.ts +475 -0
- package/dist/src/components/tabs/index.d.ts +3 -0
- package/dist/src/components/tabs/index.shadow.d.ts +4 -0
- package/dist/src/components/tabs/mono-tabs.d.ts +33 -0
- package/dist/src/components/tabs/mono-tabs.shadow.d.ts +37 -0
- package/dist/src/components/tabs/tabs-core.d.ts +57 -0
- package/dist/src/components/tabs/tabs-types.d.ts +65 -0
- package/dist/src/components/tag-input/index.d.ts +4 -0
- package/dist/src/components/tag-input/index.shadow.d.ts +5 -0
- package/dist/src/components/tag-input/mono-tag-input.d.ts +66 -0
- package/dist/src/components/tag-input/mono-tag-input.shadow.d.ts +40 -0
- package/dist/src/components/tag-input/tag-input-core.d.ts +108 -0
- package/dist/src/components/tag-input/tag-input-types.d.ts +420 -0
- package/dist/src/components/tag-input/tag-input-utils.d.ts +8 -0
- package/dist/src/components/textarea/index.d.ts +4 -0
- package/dist/src/components/textarea/index.shadow.d.ts +5 -0
- package/dist/src/components/textarea/mono-textarea.d.ts +29 -0
- package/dist/src/components/textarea/mono-textarea.shadow.d.ts +31 -0
- package/dist/src/components/textarea/textarea-core.d.ts +60 -0
- package/dist/src/components/textarea/textarea-types.d.ts +131 -0
- package/dist/src/components/textarea/textarea-utils.d.ts +7 -0
- package/dist/src/components/tooltip/control-tooltip.d.ts +36 -0
- package/dist/src/components/tooltip/index.d.ts +6 -0
- package/dist/src/components/tooltip/tooltip-config.d.ts +27 -0
- package/dist/src/components/tooltip/tooltip-declarative.d.ts +41 -0
- package/dist/src/components/tooltip/tooltip-loader.d.ts +1 -0
- package/dist/src/components/tooltip/tooltip-types.d.ts +110 -0
- package/dist/src/composables/breakpoints.d.ts +59 -0
- package/dist/src/composables/chip-limits.d.ts +48 -0
- package/dist/src/composables/chip-strip.d.ts +93 -0
- package/dist/src/composables/color.d.ts +103 -0
- package/dist/src/composables/css-class.d.ts +27 -0
- package/dist/src/composables/css-size.d.ts +40 -0
- package/dist/src/composables/data-source-controller.d.ts +113 -0
- package/dist/src/composables/element-props.d.ts +46 -0
- package/dist/src/composables/field-icons.d.ts +15 -0
- package/dist/src/composables/hybird-prop.d.ts +79 -0
- package/dist/src/composables/hydration-flush.d.ts +34 -0
- package/dist/src/composables/icon.d.ts +17 -0
- package/dist/src/composables/layout-var.d.ts +34 -0
- package/dist/src/composables/light-slots.d.ts +133 -0
- package/dist/src/composables/mdi-glyphs.d.ts +4 -0
- package/dist/src/composables/mono-element.d.ts +9 -0
- package/dist/src/composables/mono-event.d.ts +55 -0
- package/dist/src/composables/mono-pending.d.ts +8 -0
- package/dist/src/composables/mono-skeleton.d.ts +193 -0
- package/dist/src/composables/mono-ui.d.ts +58 -0
- package/dist/src/composables/notifier.d.ts +46 -0
- package/dist/src/composables/popup-portal.d.ts +226 -0
- package/dist/src/composables/popup-stack.d.ts +70 -0
- package/dist/src/composables/rate-limit.d.ts +108 -0
- package/dist/src/composables/reactive.d.ts +53 -0
- package/dist/src/composables/shadow-css.d.ts +42 -0
- package/dist/src/composables/visibility.d.ts +36 -0
- package/dist/src/data/theme/index.d.ts +30 -0
- package/dist/src/data/theme/presets.d.ts +94 -0
- package/dist/src/entries/index.d.ts +2 -0
- package/dist/src/entries/index.node.d.ts +42 -0
- package/dist/src/entries/search.d.ts +3 -0
- package/dist/src/export/detail.d.ts +29 -0
- package/dist/src/export/download.d.ts +9 -0
- package/dist/src/export/excel/index.d.ts +27 -0
- package/dist/src/export/excel/nodes.d.ts +123 -0
- package/dist/src/export/expression.d.ts +36 -0
- package/dist/src/export/helpers.d.ts +6 -0
- package/dist/src/export/index.d.ts +13 -0
- package/dist/src/export/markdown.d.ts +52 -0
- package/dist/src/export/resolve-data.d.ts +31 -0
- package/dist/src/export/sentinel.d.ts +97 -0
- package/dist/src/export/sheet-name.d.ts +45 -0
- package/dist/src/export/styles.d.ts +33 -0
- package/dist/src/export/template.d.ts +10 -0
- package/dist/src/export/types.d.ts +259 -0
- package/dist/src/import/coerce.d.ts +38 -0
- package/dist/src/import/index.d.ts +16 -0
- package/dist/src/import/match.d.ts +54 -0
- package/dist/src/import/parse.d.ts +15 -0
- package/dist/src/import/types.d.ts +153 -0
- package/dist/src/nuxt/index.d.ts +94 -0
- package/dist/src/search/data-search.d.ts +207 -0
- package/dist/src/search/field-path.d.ts +107 -0
- package/dist/src/search/filter-eval.d.ts +30 -0
- package/dist/src/search/index.d.ts +22 -0
- package/dist/src/search/odata-search.d.ts +18 -0
- package/dist/src/search/search-expr.d.ts +160 -0
- package/dist/src/utils/data-source-apply.d.ts +97 -0
- package/dist/src/utils/data-source-options.d.ts +116 -0
- package/dist/src/utils/data-source-read.d.ts +85 -0
- package/dist/src/utils/data-source-summary.d.ts +55 -0
- package/dist/src/utils/normalize-error.d.ts +90 -0
- package/dist/src/vite/index.d.ts +48 -0
- package/dist/src/vite/mono-client-only.d.ts +35 -0
- package/dist/src/vite/mono-ssr-stub.d.ts +20 -0
- package/dist/src/vite/shadow-manifest.d.ts +8 -0
- package/dist/styles-BIJ31TM4.js +20146 -0
- package/dist/tooltip-DQqNpqk2.js +795 -0
- package/dist/tooltip.d.ts +1 -0
- package/dist/tooltip.js +2 -0
- package/dist/ui/accordion.d.ts +1 -0
- package/dist/ui/accordion.js +466 -0
- package/dist/ui/alert.d.ts +1 -0
- package/dist/ui/alert.js +221 -0
- package/dist/ui/breadcrumb.d.ts +1 -0
- package/dist/ui/breadcrumb.js +902 -0
- package/dist/ui/button-dropdown.d.ts +1 -0
- package/dist/ui/button-dropdown.js +679 -0
- package/dist/ui/button.d.ts +1 -0
- package/dist/ui/button.js +63 -0
- package/dist/ui/card.d.ts +1 -0
- package/dist/ui/card.js +524 -0
- package/dist/ui/chart.d.ts +1 -0
- package/dist/ui/chart.js +885 -0
- package/dist/ui/checkbox.d.ts +1 -0
- package/dist/ui/checkbox.js +413 -0
- package/dist/ui/chip.d.ts +1 -0
- package/dist/ui/chip.js +558 -0
- package/dist/ui/date.d.ts +1 -0
- package/dist/ui/date.js +686 -0
- package/dist/ui/drawer.d.ts +1 -0
- package/dist/ui/drawer.js +901 -0
- package/dist/ui/dropdown-table.d.ts +1 -0
- package/dist/ui/dropdown-table.js +1291 -0
- package/dist/ui/dropdown.d.ts +1 -0
- package/dist/ui/dropdown.js +586 -0
- package/dist/ui/file-upload.d.ts +1 -0
- package/dist/ui/file-upload.js +688 -0
- package/dist/ui/filter.d.ts +1 -0
- package/dist/ui/filter.js +400 -0
- package/dist/ui/font/files/geist-47c091c9.woff2 +0 -0
- package/dist/ui/font/files/geist-8dd77544.woff2 +0 -0
- package/dist/ui/font/files/geist-b9248b1e.woff2 +0 -0
- package/dist/ui/font/files/geist-d40d74b4.woff2 +0 -0
- package/dist/ui/font/files/geist-f493429a.woff2 +0 -0
- package/dist/ui/font/files/geistmono-03737868.woff2 +0 -0
- package/dist/ui/font/files/geistmono-421a7e38.woff2 +0 -0
- package/dist/ui/font/files/geistmono-48ef518d.woff2 +0 -0
- package/dist/ui/font/files/geistmono-5df35d39.woff2 +0 -0
- package/dist/ui/font/files/geistmono-7de289a4.woff2 +0 -0
- package/dist/ui/font/files/geistmono-e976128f.woff2 +0 -0
- package/dist/ui/font/files/inter-05cf802c.woff2 +0 -0
- package/dist/ui/font/files/inter-2b2f25a4.woff2 +0 -0
- package/dist/ui/font/files/inter-467acc7a.woff2 +0 -0
- package/dist/ui/font/files/inter-6e85163c.woff2 +0 -0
- package/dist/ui/font/files/inter-7048add3.woff2 +0 -0
- package/dist/ui/font/files/inter-9be0371e.woff2 +0 -0
- package/dist/ui/font/files/inter-a28b7e31.woff2 +0 -0
- package/dist/ui/font/files/poppins-054df55a.woff2 +0 -0
- package/dist/ui/font/files/poppins-0ee5dc9a.woff2 +0 -0
- package/dist/ui/font/files/poppins-0f44cb18.woff2 +0 -0
- package/dist/ui/font/files/poppins-0ff0d30c.woff2 +0 -0
- package/dist/ui/font/files/poppins-13045147.woff2 +0 -0
- package/dist/ui/font/files/poppins-1db57cd9.woff2 +0 -0
- package/dist/ui/font/files/poppins-2cf2a902.woff2 +0 -0
- package/dist/ui/font/files/poppins-39e7f079.woff2 +0 -0
- package/dist/ui/font/files/poppins-9607042d.woff2 +0 -0
- package/dist/ui/font/files/poppins-9a88fc1f.woff2 +0 -0
- package/dist/ui/font/files/poppins-b8f4f752.woff2 +0 -0
- package/dist/ui/font/files/poppins-f5e57db4.woff2 +0 -0
- package/dist/ui/font/geist-mono.css +104 -0
- package/dist/ui/font/geist.css +168 -0
- package/dist/ui/font/inter.css +232 -0
- package/dist/ui/font/poppins.css +104 -0
- package/dist/ui/form.d.ts +1 -0
- package/dist/ui/form.js +3 -0
- package/dist/ui/index.css +21989 -0
- package/dist/ui/input.d.ts +1 -0
- package/dist/ui/input.js +1176 -0
- package/dist/ui/menu.d.ts +1 -0
- package/dist/ui/menu.js +1289 -0
- package/dist/ui/modal.d.ts +1 -0
- package/dist/ui/modal.js +996 -0
- package/dist/ui/nav.d.ts +1 -0
- package/dist/ui/nav.js +295 -0
- package/dist/ui/radio.d.ts +1 -0
- package/dist/ui/radio.js +379 -0
- package/dist/ui/rich-text-editor.d.ts +1 -0
- package/dist/ui/rich-text-editor.js +1338 -0
- package/dist/ui/select.d.ts +1 -0
- package/dist/ui/select.js +2200 -0
- package/dist/ui/shadow/accordion.js +442 -0
- package/dist/ui/shadow/alert.js +218 -0
- package/dist/ui/shadow/breadcrumb.js +919 -0
- package/dist/ui/shadow/button-dropdown.js +696 -0
- package/dist/ui/shadow/button.js +63 -0
- package/dist/ui/shadow/card.js +538 -0
- package/dist/ui/shadow/chart.js +1685 -0
- package/dist/ui/shadow/checkbox.js +457 -0
- package/dist/ui/shadow/chip.js +559 -0
- package/dist/ui/shadow/date.js +712 -0
- package/dist/ui/shadow/drawer.js +869 -0
- package/dist/ui/shadow/dropdown-table.js +1620 -0
- package/dist/ui/shadow/dropdown.js +547 -0
- package/dist/ui/shadow/file-upload.js +731 -0
- package/dist/ui/shadow/filter.js +402 -0
- package/dist/ui/shadow/input.js +1150 -0
- package/dist/ui/shadow/menu.js +899 -0
- package/dist/ui/shadow/modal.js +1194 -0
- package/dist/ui/shadow/nav.js +240 -0
- package/dist/ui/shadow/radio.js +408 -0
- package/dist/ui/shadow/rich-text-editor.js +1344 -0
- package/dist/ui/shadow/select.js +2167 -0
- package/dist/ui/shadow/sidebar.js +606 -0
- package/dist/ui/shadow/switch.js +428 -0
- package/dist/ui/shadow/table.js +4755 -0
- package/dist/ui/shadow/tabs.js +372 -0
- package/dist/ui/shadow/tag-input.js +2974 -0
- package/dist/ui/shadow/textarea.js +816 -0
- package/dist/ui/sidebar.d.ts +1 -0
- package/dist/ui/sidebar.js +659 -0
- package/dist/ui/switch.d.ts +1 -0
- package/dist/ui/switch.js +398 -0
- package/dist/ui/table.d.ts +1 -0
- package/dist/ui/table.js +4654 -0
- package/dist/ui/tabs.d.ts +1 -0
- package/dist/ui/tabs.js +379 -0
- package/dist/ui/tag-input.d.ts +1 -0
- package/dist/ui/tag-input.js +2947 -0
- package/dist/ui/textarea.d.ts +1 -0
- package/dist/ui/textarea.js +819 -0
- package/dist/ui/theme/legacy.css +293 -0
- package/dist/ui/theme/luma.css +743 -0
- package/dist/ui/theme/lyra.css +754 -0
- package/dist/ui/theme/maia.css +673 -0
- package/dist/ui/theme/mira.css +802 -0
- package/dist/ui/theme/nova.css +662 -0
- package/dist/ui/theme/one.css +699 -0
- package/dist/ui/theme/rhea.css +742 -0
- package/dist/ui/theme/sera.css +845 -0
- package/dist/ui/theme/tokens.css +261 -0
- package/dist/ui/theme/vega.css +467 -0
- package/dist/vite-C5iUK7so.js +329 -0
- package/dist/vite.d.ts +1 -0
- package/dist/vite.js +2 -0
- package/dist/vue.d.ts +282 -0
- package/package.json +411 -3
|
@@ -0,0 +1,1194 @@
|
|
|
1
|
+
import { a as __decorate, c as defineHybridPropAlias, d as optionalNumberConverter, f as customElement, i as withShadowUtilityStyles, l as defineHybridPropAliases, r as toShadowCss, s as booleanStringConverter, t as flushSsrHydration } from "../../hydration-flush-RB5Tz5nl.js";
|
|
2
|
+
import { t as dispatchMonoEvent } from "../../mono-event-Bi1qP9uN.js";
|
|
3
|
+
import { n as detachEventHandlers, t as applyProps } from "../../element-props-CLB6yvbm.js";
|
|
4
|
+
import { n as isBelowBreakpoint, r as resolveAutoFullscreen, t as autoFullscreenConverter } from "../../breakpoints-CAbhDUht.js";
|
|
5
|
+
import { a as unregisterPopupLayer, n as refreshPopupStack, r as registerPopupLayer, t as getOpenPopupLayers } from "../../popup-stack-CEEMib__.js";
|
|
6
|
+
import { i as pathOwnedBy } from "../../popup-portal-BziRX1yG.js";
|
|
7
|
+
import "../../mono-button.shadow-B_rKOY9N.js";
|
|
8
|
+
import { t as createNotifier } from "../../notifier-CE4yxMUQ.js";
|
|
9
|
+
import { LitElement, html, isServer, nothing, unsafeCSS } from "lit";
|
|
10
|
+
import { ref } from "lit/directives/ref.js";
|
|
11
|
+
import { property, query, state } from "lit/decorators.js";
|
|
12
|
+
import { ifDefined } from "lit/directives/if-defined.js";
|
|
13
|
+
import { styleMap } from "lit/directives/style-map.js";
|
|
14
|
+
//#region src/components/modal/modal-core.ts
|
|
15
|
+
/** Per-instance id seed for the light build's heading ids (they live in the
|
|
16
|
+
* document, so they must be unique). The shadow build scopes ids to its own
|
|
17
|
+
* root and uses a constant — see `_headingIdBase`. */
|
|
18
|
+
var modalIdSeq = 0;
|
|
19
|
+
/**
|
|
20
|
+
* Named dimension presets for the sizing props — `width="lg"`, `max-height="sm"`.
|
|
21
|
+
*
|
|
22
|
+
* Deliberately the same six tokens the `size` prop uses, but a different axis:
|
|
23
|
+
* `size` is the CONTENT scale (padding, type, close button, radius) and never
|
|
24
|
+
* touches the panel's box, while these name a MEASURE. `size="sm" width="xl"` is a
|
|
25
|
+
* compact, wide dialog — mixing the two is the point.
|
|
26
|
+
*
|
|
27
|
+
* Widths carry the same viewport clamp as the default `min(90vw, 520px)`, so a
|
|
28
|
+
* preset can never overflow a phone; `md` reproduces that default exactly. Heights
|
|
29
|
+
* are viewport-relative and match the drawer's top/bottom ladder, so one token means
|
|
30
|
+
* the same thing on both components.
|
|
31
|
+
*/
|
|
32
|
+
var WIDTH_PRESETS = {
|
|
33
|
+
xs: "min(90vw, 300px)",
|
|
34
|
+
sm: "min(90vw, 380px)",
|
|
35
|
+
md: "min(90vw, 520px)",
|
|
36
|
+
lg: "min(90vw, 680px)",
|
|
37
|
+
xl: "min(95vw, 880px)",
|
|
38
|
+
xxl: "min(95vw, 1080px)"
|
|
39
|
+
};
|
|
40
|
+
var HEIGHT_PRESETS = {
|
|
41
|
+
xs: "22vh",
|
|
42
|
+
sm: "30vh",
|
|
43
|
+
md: "50vh",
|
|
44
|
+
lg: "70vh",
|
|
45
|
+
xl: "85vh",
|
|
46
|
+
xxl: "95vh"
|
|
47
|
+
};
|
|
48
|
+
/**
|
|
49
|
+
* Normalize a sizing prop to a CSS length string.
|
|
50
|
+
* - a preset token (`"xs"`…`"xxl"`) → the ladder for `axis`
|
|
51
|
+
* - `number` (or numeric string) → `${n}px`
|
|
52
|
+
* - any other non-empty string → passed through verbatim (`"12rem"`, `"80%"`, …)
|
|
53
|
+
* - `null` / `undefined` / `''` → `undefined` (treated as "not set")
|
|
54
|
+
*
|
|
55
|
+
* The token lookup runs before the numeric/passthrough branches, which is safe:
|
|
56
|
+
* no CSS length is spelled `xs`…`xxl`, so there is nothing for it to shadow.
|
|
57
|
+
*/
|
|
58
|
+
function toCssSize(value, axis) {
|
|
59
|
+
if (value === null || value === void 0) return void 0;
|
|
60
|
+
if (typeof value === "number") return Number.isFinite(value) ? `${value}px` : void 0;
|
|
61
|
+
const trimmed = String(value).trim();
|
|
62
|
+
if (trimmed === "") return void 0;
|
|
63
|
+
const preset = (axis === "width" ? WIDTH_PRESETS : HEIGHT_PRESETS)[trimmed.toLowerCase()];
|
|
64
|
+
if (preset) return preset;
|
|
65
|
+
if (/^-?\d+(\.\d+)?$/.test(trimmed)) return `${trimmed}px`;
|
|
66
|
+
return trimmed;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* `MonoModalCore` — render-mode-agnostic logic for `mono-modal`: props/hybrid
|
|
70
|
+
* aliases, the open/close model (`show`/`hide`/`toggle` + `mno-*` events), the
|
|
71
|
+
* `PopupLayer` surface (shared z-stack / scroll-lock / topmost-Escape via the
|
|
72
|
+
* SSR-safe `popup-stack`), draggable-header logic, sizing, and the shared modal
|
|
73
|
+
* markup (`_renderModalBody`). SSR-safe: `popup-stack` no-ops server-side and the
|
|
74
|
+
* `window`/drag access is `isServer`-guarded.
|
|
75
|
+
*
|
|
76
|
+
* Each build supplies the render root + slot/icon strategy:
|
|
77
|
+
* - light (`mono-modal.ts`): renders into a `<body>` portal that IS the
|
|
78
|
+
* `.mono-modal` root, `data-mono-slot` placeholders, UnoCSS `.i-mdi-close`.
|
|
79
|
+
* - shadow (`mono-modal.shadow.ts`): a real shadow root with an inner
|
|
80
|
+
* `.mono-modal` root, native `<slot>`s, inline-SVG ✕ (mirrors dropdown).
|
|
81
|
+
*/
|
|
82
|
+
var MonoModalCore = (superClass) => {
|
|
83
|
+
class MonoModalCoreClass extends superClass {
|
|
84
|
+
static {
|
|
85
|
+
this.monoPendingAuto = "never";
|
|
86
|
+
}
|
|
87
|
+
constructor(...args) {
|
|
88
|
+
super(...args);
|
|
89
|
+
this.size = "md";
|
|
90
|
+
this.color = "primary";
|
|
91
|
+
this.title = "";
|
|
92
|
+
this.subtitle = "";
|
|
93
|
+
this.modelValue = false;
|
|
94
|
+
this.dismissible = true;
|
|
95
|
+
this.persistent = false;
|
|
96
|
+
this.overlay = true;
|
|
97
|
+
this.closeOnEscape = true;
|
|
98
|
+
this.closeOnOverlay = true;
|
|
99
|
+
this.lockScroll = true;
|
|
100
|
+
this.draggable = false;
|
|
101
|
+
this.stackable = false;
|
|
102
|
+
this.autoFullscreen = false;
|
|
103
|
+
this.cssClass = {};
|
|
104
|
+
this.cssClassName = "";
|
|
105
|
+
this._slotsCaptured = false;
|
|
106
|
+
this._hasHeadSlotState = false;
|
|
107
|
+
this._hasTitleSlotState = false;
|
|
108
|
+
this._hasSubtitleSlotState = false;
|
|
109
|
+
this._hasBodySlotState = false;
|
|
110
|
+
this._hasFootSlotState = false;
|
|
111
|
+
this._hasModalAbove = false;
|
|
112
|
+
this._dragging = false;
|
|
113
|
+
this._modalZ = 600;
|
|
114
|
+
this._dragX = 0;
|
|
115
|
+
this._dragY = 0;
|
|
116
|
+
this._dragStartX = 0;
|
|
117
|
+
this._dragStartY = 0;
|
|
118
|
+
this._dragOriginX = 0;
|
|
119
|
+
this._dragOriginY = 0;
|
|
120
|
+
this._rootEl = null;
|
|
121
|
+
this.bindRoot = (el) => {
|
|
122
|
+
this._rootEl = el ?? null;
|
|
123
|
+
this._applyRootAttrs(this._rootEl);
|
|
124
|
+
};
|
|
125
|
+
this._outsideBound = false;
|
|
126
|
+
this._outsideArm = null;
|
|
127
|
+
this._openedAt = 0;
|
|
128
|
+
this._onOutsideClick = (event) => {
|
|
129
|
+
if (!this.modelValue || this.overlay) return;
|
|
130
|
+
if (!this.closeOnOverlay || !this.dismissible || this.persistent) return;
|
|
131
|
+
if (event.timeStamp <= this._openedAt) return;
|
|
132
|
+
const layers = getOpenPopupLayers();
|
|
133
|
+
if (layers[layers.length - 1] !== this) return;
|
|
134
|
+
const root = this.renderRoot instanceof Element ? this.renderRoot : null;
|
|
135
|
+
if (pathOwnedBy(event.composedPath(), root ? [this, root] : [this])) return;
|
|
136
|
+
this.hide("overlay", event);
|
|
137
|
+
};
|
|
138
|
+
this._onHeaderPointerDown = (event) => {
|
|
139
|
+
if (isServer || typeof window === "undefined") return;
|
|
140
|
+
if (!this.draggable || this._isFullscreen || this._autoFullscreenActive) return;
|
|
141
|
+
if (event.button !== 0) return;
|
|
142
|
+
if (event.target?.closest?.(".mono-modal-close")) return;
|
|
143
|
+
event.preventDefault();
|
|
144
|
+
this._dragging = true;
|
|
145
|
+
this._dragStartX = event.clientX;
|
|
146
|
+
this._dragStartY = event.clientY;
|
|
147
|
+
this._dragOriginX = this._dragX;
|
|
148
|
+
this._dragOriginY = this._dragY;
|
|
149
|
+
window.addEventListener("pointermove", this._onPointerMove);
|
|
150
|
+
window.addEventListener("pointerup", this._onPointerUp, { once: true });
|
|
151
|
+
window.addEventListener("pointercancel", this._onPointerUp, { once: true });
|
|
152
|
+
};
|
|
153
|
+
this._onPointerMove = (event) => {
|
|
154
|
+
this._dragX = this._dragOriginX + (event.clientX - this._dragStartX);
|
|
155
|
+
this._dragY = this._dragOriginY + (event.clientY - this._dragStartY);
|
|
156
|
+
this._applyDragVars();
|
|
157
|
+
};
|
|
158
|
+
this._onPointerUp = () => {
|
|
159
|
+
if (typeof window !== "undefined") window.removeEventListener("pointermove", this._onPointerMove);
|
|
160
|
+
this._clampIntoViewport();
|
|
161
|
+
this._dragging = false;
|
|
162
|
+
};
|
|
163
|
+
defineHybridPropAliases(this, [
|
|
164
|
+
"modelValue",
|
|
165
|
+
"cssClass",
|
|
166
|
+
"closeOnEscape",
|
|
167
|
+
"closeOnOverlay",
|
|
168
|
+
"lockScroll",
|
|
169
|
+
"autoFullscreen",
|
|
170
|
+
"minWidth",
|
|
171
|
+
"maxWidth",
|
|
172
|
+
"minHeight",
|
|
173
|
+
"maxHeight",
|
|
174
|
+
"zIndex",
|
|
175
|
+
"dataModal"
|
|
176
|
+
]);
|
|
177
|
+
defineHybridPropAlias(this, "controlModal", "dataModal");
|
|
178
|
+
Object.defineProperty(this, "css-class", {
|
|
179
|
+
get: () => this.cssClass,
|
|
180
|
+
set: (value) => this._setCssClass(value),
|
|
181
|
+
configurable: true,
|
|
182
|
+
enumerable: false
|
|
183
|
+
});
|
|
184
|
+
Object.defineProperty(this, "cssclass", {
|
|
185
|
+
get: () => this.cssClass,
|
|
186
|
+
set: (value) => this._setCssClass(value),
|
|
187
|
+
configurable: true,
|
|
188
|
+
enumerable: false
|
|
189
|
+
});
|
|
190
|
+
}
|
|
191
|
+
static get observedAttributes() {
|
|
192
|
+
return [
|
|
193
|
+
...super.observedAttributes ?? [],
|
|
194
|
+
"modelvalue",
|
|
195
|
+
"css-class",
|
|
196
|
+
"cssclass"
|
|
197
|
+
];
|
|
198
|
+
}
|
|
199
|
+
attributeChangedCallback(name, oldValue, newValue) {
|
|
200
|
+
super.attributeChangedCallback(name, oldValue, newValue);
|
|
201
|
+
if (oldValue === newValue) return;
|
|
202
|
+
if (name === "modelvalue") {
|
|
203
|
+
this.modelValue = booleanStringConverter.fromAttribute(newValue);
|
|
204
|
+
return;
|
|
205
|
+
}
|
|
206
|
+
if (name === "css-class" || name === "cssclass") this._setCssClass(newValue);
|
|
207
|
+
}
|
|
208
|
+
_bindController() {
|
|
209
|
+
const next = this.dataModal;
|
|
210
|
+
if (this._boundController === next) return;
|
|
211
|
+
this._unbindController();
|
|
212
|
+
if (!next) return;
|
|
213
|
+
this._boundController = next;
|
|
214
|
+
next._register(this);
|
|
215
|
+
this._controllerUnsub = next.subscribe(() => this._applyControllerProps());
|
|
216
|
+
this._applyControllerProps();
|
|
217
|
+
}
|
|
218
|
+
_unbindController() {
|
|
219
|
+
this._controllerUnsub?.();
|
|
220
|
+
this._controllerUnsub = void 0;
|
|
221
|
+
this._boundController?._unregister(this);
|
|
222
|
+
this._boundController = void 0;
|
|
223
|
+
detachEventHandlers(this);
|
|
224
|
+
}
|
|
225
|
+
_applyControllerProps() {
|
|
226
|
+
const props = this._boundController?.props();
|
|
227
|
+
if (!props) return;
|
|
228
|
+
const { modelValue: _m, "model-value": _mv, modelvalue: _mvl, ...rest } = props;
|
|
229
|
+
applyProps(this, rest);
|
|
230
|
+
this.requestUpdate();
|
|
231
|
+
}
|
|
232
|
+
/** Duck-type marker so the exclusive-close logic targets only OTHER modals in
|
|
233
|
+
* the shared stack (not drawers/dropdowns) without an `instanceof` that the
|
|
234
|
+
* light + shadow builds — distinct classes — would each fail. */
|
|
235
|
+
get _isMonoModal() {
|
|
236
|
+
return true;
|
|
237
|
+
}
|
|
238
|
+
connectedCallback() {
|
|
239
|
+
super.connectedCallback();
|
|
240
|
+
this._bindController();
|
|
241
|
+
if (this.modelValue) this._applyOpenSideEffects();
|
|
242
|
+
}
|
|
243
|
+
disconnectedCallback() {
|
|
244
|
+
this._unbindController();
|
|
245
|
+
this._releaseSideEffects();
|
|
246
|
+
this._teardownDrag();
|
|
247
|
+
super.disconnectedCallback();
|
|
248
|
+
}
|
|
249
|
+
willUpdate(changed) {
|
|
250
|
+
for (const key of [
|
|
251
|
+
"modelValue",
|
|
252
|
+
"dismissible",
|
|
253
|
+
"persistent",
|
|
254
|
+
"overlay",
|
|
255
|
+
"closeOnEscape",
|
|
256
|
+
"closeOnOverlay",
|
|
257
|
+
"lockScroll",
|
|
258
|
+
"draggable",
|
|
259
|
+
"stackable"
|
|
260
|
+
]) if (typeof this[key] === "string") this[key] = this._toBoolean(this[key]);
|
|
261
|
+
if (changed.has("dataModal")) this._bindController();
|
|
262
|
+
if (changed.has("modelValue")) if (this.modelValue) {
|
|
263
|
+
this._resetDrag();
|
|
264
|
+
this._applyOpenSideEffects();
|
|
265
|
+
} else this._releaseSideEffects();
|
|
266
|
+
super.willUpdate?.(changed);
|
|
267
|
+
}
|
|
268
|
+
updated(changed) {
|
|
269
|
+
super.updated?.(changed);
|
|
270
|
+
if (changed.has("zIndex") && this.modelValue) refreshPopupStack();
|
|
271
|
+
if (changed.has("lockScroll") && this.modelValue) refreshPopupStack();
|
|
272
|
+
if (changed.has("overlay") && this.modelValue) {
|
|
273
|
+
this._syncOutsideClick();
|
|
274
|
+
refreshPopupStack();
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
/**
|
|
278
|
+
* Full-screen is value-driven: there's no separate flag. Passing both
|
|
279
|
+
* `width` and `height` as `"100%"` means "fill the viewport", which CSS can't
|
|
280
|
+
* do edge-to-edge on its own (the wrap has padding), so we tag the portal and
|
|
281
|
+
* let the `.fullscreen` rules take over.
|
|
282
|
+
*/
|
|
283
|
+
get _isFullscreen() {
|
|
284
|
+
return toCssSize(this.width, "width") === "100%" && toCssSize(this.height, "height") === "100%";
|
|
285
|
+
}
|
|
286
|
+
/** `auto-fullscreen-<bp>` for the CSS to key its media blocks on, else null. */
|
|
287
|
+
get _autoFullscreenClass() {
|
|
288
|
+
const bp = resolveAutoFullscreen(this.autoFullscreen);
|
|
289
|
+
return bp ? `auto-fullscreen-${bp}` : null;
|
|
290
|
+
}
|
|
291
|
+
/**
|
|
292
|
+
* Whether auto-fullscreen is in force RIGHT NOW. Only for pointer handlers that
|
|
293
|
+
* CSS cannot reach — never for rendering, which would reintroduce the SSR
|
|
294
|
+
* viewport-guess problem the `@media` approach exists to avoid.
|
|
295
|
+
*/
|
|
296
|
+
get _autoFullscreenActive() {
|
|
297
|
+
const bp = resolveAutoFullscreen(this.autoFullscreen);
|
|
298
|
+
return !!bp && isBelowBreakpoint(bp);
|
|
299
|
+
}
|
|
300
|
+
/** Inline sizing for the panel, overriding the `size` preset / default max-height. */
|
|
301
|
+
_panelSizeStyle() {
|
|
302
|
+
if (this._isFullscreen) return {};
|
|
303
|
+
const style = {};
|
|
304
|
+
const width = toCssSize(this.width, "width");
|
|
305
|
+
const height = toCssSize(this.height, "height");
|
|
306
|
+
const minWidth = toCssSize(this.minWidth, "width");
|
|
307
|
+
const maxWidth = toCssSize(this.maxWidth, "width");
|
|
308
|
+
const minHeight = toCssSize(this.minHeight, "height");
|
|
309
|
+
const maxHeight = toCssSize(this.maxHeight, "height");
|
|
310
|
+
if (width) style.width = width;
|
|
311
|
+
if (height) style.height = height;
|
|
312
|
+
if (minWidth) style["min-width"] = minWidth;
|
|
313
|
+
if (maxWidth) style["max-width"] = maxWidth;
|
|
314
|
+
if (minHeight) style["min-height"] = minHeight;
|
|
315
|
+
if (maxHeight) style["max-height"] = maxHeight;
|
|
316
|
+
return style;
|
|
317
|
+
}
|
|
318
|
+
/** The state-class list for the `.mono-modal` root (light: on the portal;
|
|
319
|
+
* shadow: on the inner root). */
|
|
320
|
+
_computeModalClasses() {
|
|
321
|
+
return [
|
|
322
|
+
"mono-modal",
|
|
323
|
+
this.size,
|
|
324
|
+
this.color,
|
|
325
|
+
this.modelValue ? "open" : "closed",
|
|
326
|
+
this.overlay ? null : "no-overlay",
|
|
327
|
+
this.persistent ? "persistent" : null,
|
|
328
|
+
this.dismissible ? null : "no-dismiss",
|
|
329
|
+
this._isFullscreen ? "fullscreen" : null,
|
|
330
|
+
this._autoFullscreenClass,
|
|
331
|
+
this._hasModalAbove ? "has-modal-above" : null,
|
|
332
|
+
this.draggable ? "draggable" : null,
|
|
333
|
+
this._dragging ? "dragging" : null,
|
|
334
|
+
...(this.cssClassName ?? "").split(/\s+/),
|
|
335
|
+
...(this.cssClass?.root ?? "").split(/\s+/)
|
|
336
|
+
].filter((c) => Boolean(c));
|
|
337
|
+
}
|
|
338
|
+
/**
|
|
339
|
+
* The prop mirrors and the states, for the same root the classes go on — the
|
|
340
|
+
* `<body>` portal in the light build, the inner root in the shadow one. Each
|
|
341
|
+
* is omitted at its default so `:not([mono-size])` means "md" for
|
|
342
|
+
* hand-written markup exactly as it does for the element.
|
|
343
|
+
*/
|
|
344
|
+
_computeRootAttrs() {
|
|
345
|
+
return {
|
|
346
|
+
"mono-size": this.size === "md" ? null : this.size,
|
|
347
|
+
"mono-color": this.color === "primary" ? null : this.color,
|
|
348
|
+
"mono-open": this.modelValue ? "" : null,
|
|
349
|
+
"mono-no-overlay": this.overlay ? null : "",
|
|
350
|
+
"mono-persistent": this.persistent ? "" : null,
|
|
351
|
+
"mono-no-dismiss": this.dismissible ? null : "",
|
|
352
|
+
"mono-fullscreen": this._isFullscreen ? "" : null,
|
|
353
|
+
"mono-auto-fullscreen": this._autoFullscreenClass ? this._autoFullscreenClass.replace("auto-fullscreen-", "") : null,
|
|
354
|
+
"mono-has-modal-above": this._hasModalAbove ? "" : null,
|
|
355
|
+
"mono-draggable": this.draggable ? "" : null,
|
|
356
|
+
"mono-dragging": this._dragging ? "" : null,
|
|
357
|
+
"mono-dialog": this.cssClassName?.split(/\s+/).includes("mono-modal-dialog") ? "" : null
|
|
358
|
+
};
|
|
359
|
+
}
|
|
360
|
+
_applyRootAttrs(root) {
|
|
361
|
+
if (!root) return;
|
|
362
|
+
if (!root.hasAttribute("mono-modal")) root.setAttribute("mono-modal", "");
|
|
363
|
+
for (const [name, value] of Object.entries(this._computeRootAttrs())) if (value === null) root.removeAttribute(name);
|
|
364
|
+
else if (root.getAttribute(name) !== value) root.setAttribute(name, value);
|
|
365
|
+
}
|
|
366
|
+
_setCssClass(value) {
|
|
367
|
+
if (value == null) {
|
|
368
|
+
this.cssClass = {};
|
|
369
|
+
this.cssClassName = "";
|
|
370
|
+
return;
|
|
371
|
+
}
|
|
372
|
+
if (typeof value === "object") {
|
|
373
|
+
this.cssClass = value;
|
|
374
|
+
return;
|
|
375
|
+
}
|
|
376
|
+
if (typeof value === "string") {
|
|
377
|
+
const trimmed = value.trim();
|
|
378
|
+
if (!trimmed) {
|
|
379
|
+
this.cssClass = {};
|
|
380
|
+
this.cssClassName = "";
|
|
381
|
+
return;
|
|
382
|
+
}
|
|
383
|
+
if (trimmed.startsWith("{") && trimmed.endsWith("}")) try {
|
|
384
|
+
this.cssClass = JSON.parse(trimmed);
|
|
385
|
+
return;
|
|
386
|
+
} catch {}
|
|
387
|
+
this.cssClassName = trimmed;
|
|
388
|
+
}
|
|
389
|
+
}
|
|
390
|
+
_cls(base, key) {
|
|
391
|
+
const extra = this.cssClass?.[key];
|
|
392
|
+
return extra ? `${base} ${extra}` : base;
|
|
393
|
+
}
|
|
394
|
+
_toBoolean(value) {
|
|
395
|
+
if (typeof value === "boolean") return value;
|
|
396
|
+
if (typeof value === "string") {
|
|
397
|
+
const normalized = value.toLowerCase().trim();
|
|
398
|
+
return normalized === "" || normalized === "true";
|
|
399
|
+
}
|
|
400
|
+
return Boolean(value);
|
|
401
|
+
}
|
|
402
|
+
/**
|
|
403
|
+
* Join the shared stack: assigns z-order, coordinates body-scroll lock, and
|
|
404
|
+
* arms the shared Escape listener. Per-modal scroll-lock / Escape behaviour
|
|
405
|
+
* is owned by the stack manager so nesting works (see composables/popup-stack).
|
|
406
|
+
*/
|
|
407
|
+
_applyOpenSideEffects() {
|
|
408
|
+
if (!this.stackable) {
|
|
409
|
+
for (const other of [...getOpenPopupLayers()]) if (other !== this && other._isMonoModal) other.hide?.("manual");
|
|
410
|
+
}
|
|
411
|
+
registerPopupLayer(this);
|
|
412
|
+
this._syncOutsideClick();
|
|
413
|
+
}
|
|
414
|
+
_releaseSideEffects() {
|
|
415
|
+
unregisterPopupLayer(this);
|
|
416
|
+
this._unbindOutsideClick();
|
|
417
|
+
}
|
|
418
|
+
/** Bind when open without an overlay, unbind otherwise — safe to call repeatedly. */
|
|
419
|
+
_syncOutsideClick() {
|
|
420
|
+
if (isServer) return;
|
|
421
|
+
const wanted = this.modelValue && !this.overlay;
|
|
422
|
+
if (wanted && !this._outsideBound && !this._outsideArm) {
|
|
423
|
+
this._openedAt = performance.now();
|
|
424
|
+
this._outsideArm = setTimeout(() => {
|
|
425
|
+
this._outsideArm = null;
|
|
426
|
+
if (!this.modelValue || this.overlay) return;
|
|
427
|
+
document.addEventListener("click", this._onOutsideClick);
|
|
428
|
+
this._outsideBound = true;
|
|
429
|
+
}, 0);
|
|
430
|
+
} else if (!wanted) this._unbindOutsideClick();
|
|
431
|
+
}
|
|
432
|
+
_unbindOutsideClick() {
|
|
433
|
+
if (this._outsideArm) {
|
|
434
|
+
clearTimeout(this._outsideArm);
|
|
435
|
+
this._outsideArm = null;
|
|
436
|
+
}
|
|
437
|
+
if (this._outsideBound) {
|
|
438
|
+
document.removeEventListener("click", this._onOutsideClick);
|
|
439
|
+
this._outsideBound = false;
|
|
440
|
+
}
|
|
441
|
+
}
|
|
442
|
+
/** Body-scroll lock is wanted while this modal is open and `lockScroll` is set. */
|
|
443
|
+
get lockBodyScroll() {
|
|
444
|
+
return this.lockScroll;
|
|
445
|
+
}
|
|
446
|
+
/**
|
|
447
|
+
* Whether this modal dims what is beneath it — see `isTopBackdrop` in popup-stack.
|
|
448
|
+
* Only while `overlay` is on: an `overlay="false"` modal stacked above another
|
|
449
|
+
* used to count as a backdrop, so the one below hid its overlay and nothing
|
|
450
|
+
* dimmed the page at all.
|
|
451
|
+
*/
|
|
452
|
+
get hasBackdrop() {
|
|
453
|
+
return this.overlay;
|
|
454
|
+
}
|
|
455
|
+
/** Topmost-only Escape from the shared stack — close unless persistent. */
|
|
456
|
+
onStackEscape(event) {
|
|
457
|
+
if (this.closeOnEscape && !this.persistent) this.hide("escape", event);
|
|
458
|
+
}
|
|
459
|
+
/**
|
|
460
|
+
* Called by the stack manager whenever stack order changes. `z` raises this
|
|
461
|
+
* modal above the ones below; when another backdrop layer sits above it
|
|
462
|
+
* (`isTopBackdrop` is false) its own backdrop is hidden so stacked overlays
|
|
463
|
+
* don't compound. A backdrop-less popup above it does not count — nor does an
|
|
464
|
+
* `overlay="false"` modal/drawer (see `hasBackdrop`). Both builds
|
|
465
|
+
* read `_modalZ` into the `.mono-modal` root's `--modal-z`.
|
|
466
|
+
*/
|
|
467
|
+
setStackZ(z, isTopBackdrop) {
|
|
468
|
+
this._modalZ = z;
|
|
469
|
+
this._hasModalAbove = !isTopBackdrop;
|
|
470
|
+
}
|
|
471
|
+
/**
|
|
472
|
+
* PopupLayer hook — the level this modal pins itself to, or `undefined` to take
|
|
473
|
+
* the stack's slot. The stack reads it so layers opened ABOVE a pinned modal
|
|
474
|
+
* clear it instead of landing back at the base (see popup-stack).
|
|
475
|
+
*
|
|
476
|
+
* Coerced through `Number` rather than read directly because the prop can arrive
|
|
477
|
+
* as a numeric STRING — a plain `z-index="1500"` attribute goes through the
|
|
478
|
+
* converter, but `el.zIndex = '1500'` (or a framework binding that stringifies)
|
|
479
|
+
* does not.
|
|
480
|
+
*
|
|
481
|
+
* `null` and `''` are screened out FIRST, and that guard is load-bearing:
|
|
482
|
+
* `Number(null)` and `Number('')` are both `0` and both finite, so `:z-index="null"`
|
|
483
|
+
* — Vue's ordinary spelling for "no value" — used to pin the modal to `z-index: 0`
|
|
484
|
+
* and drop it behind the page. Only the attribute path was safe, because
|
|
485
|
+
* `optionalNumberConverter` maps `''`/`null` to `undefined`; the PROPERTY path,
|
|
486
|
+
* which is what Vue actually uses (the hybrid alias makes `'z-index' in el` true),
|
|
487
|
+
* was not.
|
|
488
|
+
*/
|
|
489
|
+
get pinnedZ() {
|
|
490
|
+
const raw = this.zIndex;
|
|
491
|
+
if (raw === null || raw === void 0) return void 0;
|
|
492
|
+
if (typeof raw === "string" && raw.trim() === "") return void 0;
|
|
493
|
+
const manual = Number(raw);
|
|
494
|
+
return Number.isFinite(manual) ? manual : void 0;
|
|
495
|
+
}
|
|
496
|
+
/**
|
|
497
|
+
* The level actually published to CSS: the `zIndex` prop when the consumer set
|
|
498
|
+
* one, otherwise the stack's slot.
|
|
499
|
+
*/
|
|
500
|
+
get _effectiveZ() {
|
|
501
|
+
return this.pinnedZ ?? this._modalZ;
|
|
502
|
+
}
|
|
503
|
+
/** Push the current offset onto the panel as CSS vars (no Lit re-render). */
|
|
504
|
+
_applyDragVars() {
|
|
505
|
+
const panel = this._panelEl;
|
|
506
|
+
if (!panel) return;
|
|
507
|
+
panel.style.setProperty("--drag-x", `${this._dragX}px`);
|
|
508
|
+
panel.style.setProperty("--drag-y", `${this._dragY}px`);
|
|
509
|
+
}
|
|
510
|
+
/** Recenter the panel — called on each open so drags don't persist. */
|
|
511
|
+
_resetDrag() {
|
|
512
|
+
this._dragX = 0;
|
|
513
|
+
this._dragY = 0;
|
|
514
|
+
this._applyDragVars();
|
|
515
|
+
}
|
|
516
|
+
/**
|
|
517
|
+
* After a drop, pull the panel back so it sits fully inside the viewport
|
|
518
|
+
* ("the maximum location is the inner window"). If the panel is larger than
|
|
519
|
+
* the viewport, pin its top-left corner.
|
|
520
|
+
*/
|
|
521
|
+
_clampIntoViewport() {
|
|
522
|
+
const panel = this._panelEl;
|
|
523
|
+
if (!panel || typeof window === "undefined") return;
|
|
524
|
+
const rect = panel.getBoundingClientRect();
|
|
525
|
+
const vw = window.innerWidth;
|
|
526
|
+
const vh = window.innerHeight;
|
|
527
|
+
let dx = 0;
|
|
528
|
+
if (rect.width >= vw) dx = -rect.left;
|
|
529
|
+
else if (rect.left < 0) dx = -rect.left;
|
|
530
|
+
else if (rect.right > vw) dx = vw - rect.right;
|
|
531
|
+
let dy = 0;
|
|
532
|
+
if (rect.height >= vh) dy = -rect.top;
|
|
533
|
+
else if (rect.top < 0) dy = -rect.top;
|
|
534
|
+
else if (rect.bottom > vh) dy = vh - rect.bottom;
|
|
535
|
+
if (dx === 0 && dy === 0) return;
|
|
536
|
+
this._dragX += dx;
|
|
537
|
+
this._dragY += dy;
|
|
538
|
+
this._applyDragVars();
|
|
539
|
+
}
|
|
540
|
+
_teardownDrag() {
|
|
541
|
+
if (typeof window === "undefined") return;
|
|
542
|
+
window.removeEventListener("pointermove", this._onPointerMove);
|
|
543
|
+
window.removeEventListener("pointerup", this._onPointerUp);
|
|
544
|
+
window.removeEventListener("pointercancel", this._onPointerUp);
|
|
545
|
+
}
|
|
546
|
+
/**
|
|
547
|
+
* Every open-state change emits `toggle` (historically `mno-click`, which is
|
|
548
|
+
* kept), then the transition-specific `open` / `close`. `toggle` rather than
|
|
549
|
+
* a plain `click`: a real click from inside the panel already bubbles to the
|
|
550
|
+
* host on its own, and this is not one — it is a state change.
|
|
551
|
+
* Mirrors mono-drawer's event surface. Note: only programmatic state changes
|
|
552
|
+
* (`show`/`hide`/`toggle` and the overlay/✕/Escape handlers) call this —
|
|
553
|
+
* parent-driven opens via `model-value` go through `willUpdate` and emit
|
|
554
|
+
* nothing, so a controlled parent never gets an echo of its own change.
|
|
555
|
+
*/
|
|
556
|
+
_emitChange(detail) {
|
|
557
|
+
this._boundController?._report(detail.value, detail.source);
|
|
558
|
+
dispatchMonoEvent(this, "click", detail, { alias: "toggle" });
|
|
559
|
+
if (detail.value && !detail.oldValue) dispatchMonoEvent(this, "open", detail);
|
|
560
|
+
else if (!detail.value && detail.oldValue) dispatchMonoEvent(this, "close", detail);
|
|
561
|
+
}
|
|
562
|
+
show(source = "manual", sourceEvent) {
|
|
563
|
+
if (this.modelValue) return;
|
|
564
|
+
const oldValue = this.modelValue;
|
|
565
|
+
this.modelValue = true;
|
|
566
|
+
this._emitChange({
|
|
567
|
+
modelValue: true,
|
|
568
|
+
currentValue: true,
|
|
569
|
+
oldValue,
|
|
570
|
+
value: true,
|
|
571
|
+
source,
|
|
572
|
+
sourceEvent
|
|
573
|
+
});
|
|
574
|
+
}
|
|
575
|
+
hide(source = "manual", sourceEvent) {
|
|
576
|
+
if (!this.modelValue) return;
|
|
577
|
+
const oldValue = this.modelValue;
|
|
578
|
+
this.modelValue = false;
|
|
579
|
+
this._emitChange({
|
|
580
|
+
modelValue: false,
|
|
581
|
+
currentValue: false,
|
|
582
|
+
oldValue,
|
|
583
|
+
value: false,
|
|
584
|
+
source,
|
|
585
|
+
sourceEvent
|
|
586
|
+
});
|
|
587
|
+
}
|
|
588
|
+
toggle(source = "manual", sourceEvent) {
|
|
589
|
+
if (this.modelValue) this.hide(source, sourceEvent);
|
|
590
|
+
else this.show(source, sourceEvent);
|
|
591
|
+
}
|
|
592
|
+
_handleClose(event) {
|
|
593
|
+
if (!this.dismissible) return;
|
|
594
|
+
this.hide("close", event);
|
|
595
|
+
}
|
|
596
|
+
_handleOverlayClick(event) {
|
|
597
|
+
if (!this.closeOnOverlay || !this.dismissible || this.persistent || !this.overlay) return;
|
|
598
|
+
this.hide("overlay", event);
|
|
599
|
+
}
|
|
600
|
+
/** Title / subtitle / heading-column presence, shared by the head render and
|
|
601
|
+
* the dialog's `aria-labelledby` / `aria-describedby`. */
|
|
602
|
+
get _headingState() {
|
|
603
|
+
const title = !!this.title || this._hasTitleSlotState;
|
|
604
|
+
const subtitle = !!this.subtitle || this._hasSubtitleSlotState;
|
|
605
|
+
return {
|
|
606
|
+
title,
|
|
607
|
+
subtitle,
|
|
608
|
+
heading: this._hasHeadSlotState || title || subtitle
|
|
609
|
+
};
|
|
610
|
+
}
|
|
611
|
+
/**
|
|
612
|
+
* Prefix of the heading ids (`<base>-heading` / `-title` / `-subtitle`). The
|
|
613
|
+
* light build's panel lives in the document, so the ids must be unique per
|
|
614
|
+
* instance; the shadow build overrides this with a constant (ids are scoped to
|
|
615
|
+
* its own root, and a counter would differ between server and client).
|
|
616
|
+
*/
|
|
617
|
+
get _headingIdBase() {
|
|
618
|
+
this._idSeq ??= ++modalIdSeq;
|
|
619
|
+
return `mono-modal-${this._idSeq}`;
|
|
620
|
+
}
|
|
621
|
+
/** `aria-labelledby` / `aria-describedby` for the `role="dialog"` root. A
|
|
622
|
+
* `slot="header"` labels the dialog with its whole column; otherwise the
|
|
623
|
+
* title labels it and the subtitle describes it. */
|
|
624
|
+
_headingAria() {
|
|
625
|
+
const s = this._headingState;
|
|
626
|
+
const base = this._headingIdBase;
|
|
627
|
+
if (this._hasHeadSlotState) return { labelledby: `${base}-heading` };
|
|
628
|
+
return {
|
|
629
|
+
labelledby: s.title ? `${base}-title` : void 0,
|
|
630
|
+
describedby: s.subtitle ? `${base}-subtitle` : void 0
|
|
631
|
+
};
|
|
632
|
+
}
|
|
633
|
+
_renderHead() {
|
|
634
|
+
const s = this._headingState;
|
|
635
|
+
const hasDefaultHeader = s.heading || this.dismissible;
|
|
636
|
+
if (!hasDefaultHeader && !this._slotsAlwaysRender) return nothing;
|
|
637
|
+
const base = this._headingIdBase;
|
|
638
|
+
const heading = html`
|
|
639
|
+
<div
|
|
640
|
+
class=${this._cls("mono-modal-title", "title")}
|
|
641
|
+
mono-title
|
|
642
|
+
id=${`${base}-title`}
|
|
643
|
+
?mono-empty=${!s.title}
|
|
644
|
+
>${this._slotOutlet("title", this.title || nothing)}</div>
|
|
645
|
+
<div
|
|
646
|
+
class=${this._cls("mono-modal-subtitle", "subtitle")}
|
|
647
|
+
mono-subtitle
|
|
648
|
+
id=${`${base}-subtitle`}
|
|
649
|
+
?mono-empty=${!s.subtitle}
|
|
650
|
+
>${this._slotOutlet("subtitle", this.subtitle || nothing)}</div>
|
|
651
|
+
`;
|
|
652
|
+
return html`
|
|
653
|
+
<div
|
|
654
|
+
class=${this._cls("mono-modal-head", "head")}
|
|
655
|
+
mono-header
|
|
656
|
+
?mono-empty=${!hasDefaultHeader}
|
|
657
|
+
?mono-no-subtitle=${!s.subtitle && !this._hasHeadSlotState}
|
|
658
|
+
@pointerdown=${this._onHeaderPointerDown}
|
|
659
|
+
>
|
|
660
|
+
<div
|
|
661
|
+
class=${this._cls("mono-modal-heading", "heading")}
|
|
662
|
+
mono-heading
|
|
663
|
+
id=${`${base}-heading`}
|
|
664
|
+
?mono-empty=${!s.heading}
|
|
665
|
+
>
|
|
666
|
+
${this._slotOutlet("head", heading)}
|
|
667
|
+
</div>
|
|
668
|
+
${this.dismissible ? html`
|
|
669
|
+
<button
|
|
670
|
+
type="button"
|
|
671
|
+
class=${this._cls("mono-modal-close", "close")}
|
|
672
|
+
mono-close
|
|
673
|
+
aria-label="Close"
|
|
674
|
+
@click=${this._handleClose}
|
|
675
|
+
>
|
|
676
|
+
${this.renderIcon("close")}
|
|
677
|
+
</button>
|
|
678
|
+
` : nothing}
|
|
679
|
+
</div>
|
|
680
|
+
`;
|
|
681
|
+
}
|
|
682
|
+
_renderFoot() {
|
|
683
|
+
if (!this._hasFootSlotState && !this._slotsAlwaysRender) return nothing;
|
|
684
|
+
return html`
|
|
685
|
+
<div
|
|
686
|
+
class=${this._cls("mono-modal-foot", "foot")}
|
|
687
|
+
mono-footer
|
|
688
|
+
?mono-empty=${!this._hasFootSlotState}
|
|
689
|
+
>
|
|
690
|
+
${this._slotOutlet("foot")}
|
|
691
|
+
</div>
|
|
692
|
+
`;
|
|
693
|
+
}
|
|
694
|
+
/** Shared modal markup (overlay + panel-wrap + panel + head/body/foot). The
|
|
695
|
+
* light build renders this directly into the portal (which IS `.mono-modal`);
|
|
696
|
+
* the shadow build wraps it in an inner `.mono-modal` root. */
|
|
697
|
+
_renderModalBody() {
|
|
698
|
+
return html`
|
|
699
|
+
<div
|
|
700
|
+
class=${this._cls("mono-modal-overlay", "overlay")}
|
|
701
|
+
mono-overlay
|
|
702
|
+
@click=${this._handleOverlayClick}
|
|
703
|
+
></div>
|
|
704
|
+
<div class="mono-modal-panel-wrap" mono-panel-wrap @click=${this._handleOverlayClick}>
|
|
705
|
+
<div
|
|
706
|
+
class=${this._cls("mono-modal-panel", "panel")}
|
|
707
|
+
mono-panel
|
|
708
|
+
style=${styleMap(this._panelSizeStyle())}
|
|
709
|
+
role="document"
|
|
710
|
+
@click=${(e) => e.stopPropagation()}
|
|
711
|
+
>
|
|
712
|
+
${this._renderHead()}
|
|
713
|
+
<div class=${this._cls("mono-modal-body", "body")} mono-body>
|
|
714
|
+
${this._slotOutlet("body")}
|
|
715
|
+
</div>
|
|
716
|
+
${this._renderFoot()}
|
|
717
|
+
</div>
|
|
718
|
+
</div>
|
|
719
|
+
`;
|
|
720
|
+
}
|
|
721
|
+
/** Whether the slot regions render even when empty. Light: no (omit empty
|
|
722
|
+
* regions). Shadow: yes — the native `<slot>`s must exist to project DSD
|
|
723
|
+
* content + be scanned (hidden via `[data-empty]` when empty). */
|
|
724
|
+
get _slotsAlwaysRender() {
|
|
725
|
+
return false;
|
|
726
|
+
}
|
|
727
|
+
_hasSlot(name) {
|
|
728
|
+
return name === "head" ? this._hasHeadSlotState : name === "title" ? this._hasTitleSlotState : name === "subtitle" ? this._hasSubtitleSlotState : name === "body" ? this._hasBodySlotState : this._hasFootSlotState;
|
|
729
|
+
}
|
|
730
|
+
_setSlotState(name, has) {
|
|
731
|
+
if (name === "head") this._hasHeadSlotState = has;
|
|
732
|
+
else if (name === "title") this._hasTitleSlotState = has;
|
|
733
|
+
else if (name === "subtitle") this._hasSubtitleSlotState = has;
|
|
734
|
+
else if (name === "body") this._hasBodySlotState = has;
|
|
735
|
+
else this._hasFootSlotState = has;
|
|
736
|
+
}
|
|
737
|
+
/**
|
|
738
|
+
* Slot outlet. Light build (default): a `data-mono-slot` placeholder the
|
|
739
|
+
* captured light-DOM nodes are re-parented into when present, else the
|
|
740
|
+
* `fallback`. Shadow build overrides this with a native `<slot name>`.
|
|
741
|
+
*/
|
|
742
|
+
_slotOutlet(name, fallback = nothing) {
|
|
743
|
+
return this._hasSlot(name) ? html`<span data-mono-slot=${name}></span>` : html`${fallback}`;
|
|
744
|
+
}
|
|
745
|
+
/** Close ✕. Light (default): UnoCSS icon span. Shadow overrides → inline SVG
|
|
746
|
+
* (global `.i-mdi-close` can't reach a shadow root). */
|
|
747
|
+
renderIcon(_name) {
|
|
748
|
+
return html`<span class="mono-icon i-mdi-close" aria-hidden="true"></span>`;
|
|
749
|
+
}
|
|
750
|
+
}
|
|
751
|
+
__decorate([property({ type: String })], MonoModalCoreClass.prototype, "size", void 0);
|
|
752
|
+
__decorate([property({ type: String })], MonoModalCoreClass.prototype, "color", void 0);
|
|
753
|
+
__decorate([property({ type: String })], MonoModalCoreClass.prototype, "title", void 0);
|
|
754
|
+
__decorate([property({ type: String })], MonoModalCoreClass.prototype, "subtitle", void 0);
|
|
755
|
+
__decorate([property({
|
|
756
|
+
attribute: "model-value",
|
|
757
|
+
reflect: true,
|
|
758
|
+
converter: booleanStringConverter
|
|
759
|
+
})], MonoModalCoreClass.prototype, "modelValue", void 0);
|
|
760
|
+
__decorate([property({
|
|
761
|
+
reflect: true,
|
|
762
|
+
converter: booleanStringConverter
|
|
763
|
+
})], MonoModalCoreClass.prototype, "dismissible", void 0);
|
|
764
|
+
__decorate([property({
|
|
765
|
+
reflect: true,
|
|
766
|
+
converter: booleanStringConverter
|
|
767
|
+
})], MonoModalCoreClass.prototype, "persistent", void 0);
|
|
768
|
+
__decorate([property({
|
|
769
|
+
reflect: true,
|
|
770
|
+
converter: booleanStringConverter
|
|
771
|
+
})], MonoModalCoreClass.prototype, "overlay", void 0);
|
|
772
|
+
__decorate([property({
|
|
773
|
+
attribute: "close-on-escape",
|
|
774
|
+
converter: booleanStringConverter
|
|
775
|
+
})], MonoModalCoreClass.prototype, "closeOnEscape", void 0);
|
|
776
|
+
__decorate([property({
|
|
777
|
+
attribute: "close-on-overlay",
|
|
778
|
+
converter: booleanStringConverter
|
|
779
|
+
})], MonoModalCoreClass.prototype, "closeOnOverlay", void 0);
|
|
780
|
+
__decorate([property({
|
|
781
|
+
attribute: "lock-scroll",
|
|
782
|
+
converter: booleanStringConverter
|
|
783
|
+
})], MonoModalCoreClass.prototype, "lockScroll", void 0);
|
|
784
|
+
__decorate([property({
|
|
785
|
+
reflect: true,
|
|
786
|
+
converter: booleanStringConverter
|
|
787
|
+
})], MonoModalCoreClass.prototype, "draggable", void 0);
|
|
788
|
+
__decorate([property({
|
|
789
|
+
reflect: true,
|
|
790
|
+
converter: booleanStringConverter
|
|
791
|
+
})], MonoModalCoreClass.prototype, "stackable", void 0);
|
|
792
|
+
__decorate([property({
|
|
793
|
+
attribute: "auto-fullscreen",
|
|
794
|
+
converter: autoFullscreenConverter
|
|
795
|
+
})], MonoModalCoreClass.prototype, "autoFullscreen", void 0);
|
|
796
|
+
__decorate([property({ attribute: false })], MonoModalCoreClass.prototype, "cssClass", void 0);
|
|
797
|
+
__decorate([property({ attribute: false })], MonoModalCoreClass.prototype, "cssClassName", void 0);
|
|
798
|
+
__decorate([property({ attribute: false })], MonoModalCoreClass.prototype, "dataModal", void 0);
|
|
799
|
+
__decorate([property({ type: String })], MonoModalCoreClass.prototype, "width", void 0);
|
|
800
|
+
__decorate([property({ type: String })], MonoModalCoreClass.prototype, "height", void 0);
|
|
801
|
+
__decorate([property({
|
|
802
|
+
attribute: "z-index",
|
|
803
|
+
converter: optionalNumberConverter
|
|
804
|
+
})], MonoModalCoreClass.prototype, "zIndex", void 0);
|
|
805
|
+
__decorate([property({
|
|
806
|
+
type: String,
|
|
807
|
+
attribute: "min-width"
|
|
808
|
+
})], MonoModalCoreClass.prototype, "minWidth", void 0);
|
|
809
|
+
__decorate([property({
|
|
810
|
+
type: String,
|
|
811
|
+
attribute: "max-width"
|
|
812
|
+
})], MonoModalCoreClass.prototype, "maxWidth", void 0);
|
|
813
|
+
__decorate([property({
|
|
814
|
+
type: String,
|
|
815
|
+
attribute: "min-height"
|
|
816
|
+
})], MonoModalCoreClass.prototype, "minHeight", void 0);
|
|
817
|
+
__decorate([property({
|
|
818
|
+
type: String,
|
|
819
|
+
attribute: "max-height"
|
|
820
|
+
})], MonoModalCoreClass.prototype, "maxHeight", void 0);
|
|
821
|
+
__decorate([state()], MonoModalCoreClass.prototype, "_slotsCaptured", void 0);
|
|
822
|
+
__decorate([state()], MonoModalCoreClass.prototype, "_hasHeadSlotState", void 0);
|
|
823
|
+
__decorate([state()], MonoModalCoreClass.prototype, "_hasTitleSlotState", void 0);
|
|
824
|
+
__decorate([state()], MonoModalCoreClass.prototype, "_hasSubtitleSlotState", void 0);
|
|
825
|
+
__decorate([state()], MonoModalCoreClass.prototype, "_hasBodySlotState", void 0);
|
|
826
|
+
__decorate([state()], MonoModalCoreClass.prototype, "_hasFootSlotState", void 0);
|
|
827
|
+
__decorate([state()], MonoModalCoreClass.prototype, "_hasModalAbove", void 0);
|
|
828
|
+
__decorate([state()], MonoModalCoreClass.prototype, "_dragging", void 0);
|
|
829
|
+
__decorate([state()], MonoModalCoreClass.prototype, "_modalZ", void 0);
|
|
830
|
+
__decorate([query(".mono-modal-panel")], MonoModalCoreClass.prototype, "_panelEl", void 0);
|
|
831
|
+
return MonoModalCoreClass;
|
|
832
|
+
};
|
|
833
|
+
//#endregion
|
|
834
|
+
//#region src/components/modal/modal.css?raw
|
|
835
|
+
var modal_default = "/* @unocss-include */\r\n\r\n/* =========================================================================\r\n mono-modal — a port of Basecoat's `.dialog` (basecoat-css@1.0.2, vega style).\r\n\r\n Styled by ATTRIBUTE, like Basecoat — and the attributes mirror the element's\r\n props one for one, so hand-written markup reads like the Lit / Vue tag:\r\n\r\n <mono-modal size=\"lg\" color=\"success\" model-value title=\"Settings\">\r\n <div mono-modal mono-size=\"lg\" mono-color=\"success\" mono-open\r\n role=\"dialog\" aria-modal=\"true\">\r\n <div mono-overlay></div>\r\n <div mono-panel-wrap>\r\n <div mono-panel role=\"document\">\r\n <div mono-header>\r\n <div mono-heading>\r\n <div mono-title>Settings</div>\r\n <div mono-subtitle>Manage your account</div>\r\n </div>\r\n <button mono-close type=\"button\" aria-label=\"Close\">…</button>\r\n </div>\r\n <div mono-body>…</div>\r\n <div mono-footer>…</div>\r\n </div>\r\n </div>\r\n </div>\r\n\r\n An absent attribute is the prop's default (`:not([mono-size])` = md,\r\n `:not([mono-color])` = primary). The element writes them on its ROOT — the\r\n `<body>` portal in the light build, an inner root `<div>` in the shadow one —\r\n along with every state below. The old classes (`.mono-modal.md.primary.open`)\r\n are still emitted as inert hooks until 2.0 but no rule here reads them.\r\n\r\n Selector map (ours ≡ upstream):\r\n [mono-modal] ≡ .dialog (the <dialog> itself) — DEVIATION: a fixed\r\n full-viewport wrapper, because this component predates\r\n `<dialog>` support and owns its own stacking through\r\n `composables/popup-stack`\r\n [mono-overlay] ≡ .dialog::backdrop (bg-black/10 backdrop-blur-xs) — the\r\n fill is `--mono-mode-backdrop`, a token, since a\r\n pseudo-element cannot be reached from a shadow sheet\r\n [mono-panel-wrap] ≡ EXTENSION (upstream centres the panel itself with\r\n `fixed top-1/2 left-1/2 -translate-1/2`; a flex wrap\r\n centres a DRAGGED panel correctly, which that cannot)\r\n [mono-panel] ≡ .dialog > * (bg-popover text-popover-foreground ring-1\r\n ring-foreground/10 rounded-xl p-6 gap-6 text-sm\r\n max-w-[calc(100%-2rem)] max-h-[calc(100%-2rem)]\r\n flex flex-col sm:max-w-md)\r\n [mono-header] ≡ .dialog > * > header (flex flex-col gap-2) — DEVIATION:\r\n a ROW, because the ✕ lives inside it (see below)\r\n [mono-heading] ≡ upstream's header column itself (flex flex-col gap-2)\r\n — the ✕'s row-mate; `slot=\"header\"` replaces it\r\n [mono-title] ≡ .dialog > * > header > h2 (leading-none font-medium)\r\n [mono-subtitle] ≡ .dialog > * > header > p (text-muted-foreground text-sm\r\n leading-normal)\r\n [mono-body] ≡ .dialog > * > section (flex-1)\r\n [mono-footer] ≡ .dialog > * > footer (flex flex-col-reverse gap-2,\r\n sm:flex-row sm:justify-end)\r\n [mono-close] ≡ .dialog > * > button (opacity-70 hover:opacity-100,\r\n svg size-4) — DEVIATION: in flow inside the head\r\n rather than `absolute top-4 end-4`, because the head is\r\n also the drag handle; a `slot=\"header\"` replaces only\r\n the heading column, never the ✕\r\n [mono-size] ≡ EXTENSION. Upstream's `data-size` is a WIDTH; ours is\r\n the content scale (padding, type, radius, close box).\r\n Width is its own prop — a compact `sm` can still be\r\n wide — and defaults to `--mono-container-md`, which is\r\n upstream's `sm:max-w-md`.\r\n [mono-color] ≡ EXTENSION (upstream's dialog has no colour)\r\n\r\n THE TINTED HEADER IS GONE. Upstream's dialog is one padded box: the panel\r\n carries `p-6` and `gap-6`, and header / section / footer are unpadded,\r\n unbordered, untinted regions inside it. The gradient head bar, the tinted\r\n footer and both divider rules went with it — `--mono-modal-header-bg` and\r\n `-foot-bg` remain as knobs, defaulting to `transparent`, so a consumer who\r\n wants the bar back sets those two.\r\n\r\n PART NAMES ARE PATH-SCOPED. `[mono-panel]`, `[mono-body]`, `[mono-title]` and\r\n `[mono-close]` are also dropdown's, card's and input's part names, and a modal\r\n BODY is where consumers put all three. Every rule here is written as an\r\n explicit child path from the root, with `:where()` keeping the resting weight\r\n at (0,1,0) so a `cssClass` utility still wins by source order.\r\n\r\n FLAVORS set `--mono-modal-{radius,padding,gap,ring-color,shadow,width,\r\n title-font,overlay-bg,overlay-backdrop-filter,close-*}` (+ the per-size\r\n forms); every fallback here is vega's value\r\n (`node scripts/basecoat-styles.mjs --varying \"dialog\"` prints the matrix).\r\n ========================================================================= */\r\n\r\nmono-modal {\r\n display: contents;\r\n}\r\n\r\n/* =========================================\r\n Root — the layer\r\n ========================================= */\r\n\r\n[mono-modal] {\r\n /* ── the six roles, each a public knob over a Basecoat token ───────────── */\r\n --_mono-modal-primary: var(--mono-modal-primary, var(--primary));\r\n --_mono-modal-secondary: var(--mono-modal-secondary, var(--secondary-foreground));\r\n --_mono-modal-success: var(--mono-modal-success, var(--success));\r\n --_mono-modal-danger: var(--mono-modal-danger, var(--destructive));\r\n --_mono-modal-warning: var(--mono-modal-warning, var(--warning));\r\n --_mono-modal-info: var(--mono-modal-info, var(--info));\r\n --_mono-modal-teal: var(--mono-modal-teal, var(--teal));\r\n --_mono-modal-purple: var(--mono-modal-purple, var(--purple));\r\n --_mono-modal-neutral: var(--mono-modal-neutral, var(--neutral));\r\n --_mono-modal-dark: var(--mono-modal-dark, var(--dark));\r\n /* the colour in play — `primary` unless a [mono-color] rule re-points it */\r\n --_mono-modal-accent: var(--mono-modal-accent, var(--_mono-modal-accent-preset, var(--_mono-modal-primary)));\r\n\r\n /* ── panel paint — `bg-popover text-popover-foreground ring-foreground/10` ── */\r\n --_mono-modal-bg: var(--mono-modal-bg, var(--mono-modal-surface, var(--popover)));\r\n --_mono-modal-text: var(--mono-modal-text, var(--popover-foreground));\r\n --_mono-modal-border: var(--mono-modal-border, var(--border));\r\n --_mono-modal-ring-width: var(--mono-modal-ring-width, var(--mono-border-width));\r\n --_mono-modal-ring-color: var(--mono-modal-ring-color,\r\n color-mix(in oklab, var(--foreground) 10%, transparent));\r\n --_mono-modal-shadow: var(--mono-modal-shadow, var(--mono-shadow-lg));\r\n /* a faint halo of the accent under the elevation — nothing until `color` is set */\r\n --_mono-modal-glow: var(--mono-modal-glow, 0 0 #0000);\r\n\r\n /* The tinted head / foot bars of the pre-port modal. Upstream has neither —\r\n its dialog is ONE padded box — so both default to nothing, and a consumer\r\n who wants the bar back sets the pair (and `-head-border` for the rule). */\r\n --_mono-modal-header-bg: var(--mono-modal-header-bg, var(--mono-modal-head-bg, transparent));\r\n --_mono-modal-footer-bg: var(--mono-modal-footer-bg, transparent);\r\n --_mono-modal-header-border: var(--mono-modal-header-border, transparent);\r\n --_mono-modal-footer-border: var(--mono-modal-footer-border, transparent);\r\n /* 0, not a transparent hairline: upstream has no divider, and a transparent\r\n one would still take a pixel of layout. Restoring the bar means setting the\r\n width with the colour. */\r\n --_mono-modal-header-border-width: var(--mono-modal-header-border-width, 0);\r\n --_mono-modal-footer-border-width: var(--mono-modal-footer-border-width, 0);\r\n\r\n /* ── md metrics live on the unqualified root ON PURPOSE ────────────────────\r\n basecoat@1.0.2 styles/vega.css .dialog > * — rounded-xl p-6 gap-6 text-sm */\r\n --_mono-modal-radius: var(--mono-modal-radius, var(--_mono-modal-radius-preset, var(--mono-modal-radius-md, var(--mono-radius-xl))));\r\n --_mono-modal-pad: var(--mono-modal-pad, var(--_mono-modal-pad-preset, var(--mono-modal-pad-md, calc(var(--mono-spacing) * 6))));\r\n --_mono-modal-gap: var(--mono-modal-gap, var(--_mono-modal-gap-preset, var(--mono-modal-gap-md, calc(var(--mono-spacing) * 6))));\r\n --_mono-modal-header-gap: var(--mono-modal-header-gap, var(--_mono-modal-header-gap-preset, var(--mono-modal-header-gap-md, calc(var(--mono-spacing) * 2))));\r\n --_mono-modal-footer-gap: var(--mono-modal-footer-gap, var(--_mono-modal-footer-gap-preset, var(--mono-modal-footer-gap-md, calc(var(--mono-spacing) * 2))));\r\n --_mono-modal-body-font: var(--mono-modal-body-font, var(--_mono-modal-body-font-preset, var(--mono-modal-body-font-md, var(--mono-text-sm))));\r\n --_mono-modal-body-line-height: var(--mono-modal-body-line-height, var(--_mono-modal-body-line-height-preset, var(--mono-text-sm--lh)));\r\n /* `leading-none font-medium`, at the panel's own size — four of the eight\r\n flavors bump it to `text-base` and sera to `text-lg`. */\r\n --_mono-modal-title-font: var(--mono-modal-title-font, var(--_mono-modal-title-font-preset, var(--mono-modal-title-font-md, var(--mono-text-sm))));\r\n --_mono-modal-title-weight: var(--mono-modal-title-weight, var(--mono-font-weight-medium));\r\n --_mono-modal-title-color: var(--mono-modal-title-color, var(--_mono-modal-text));\r\n /* the description line — `text-muted-foreground text-sm leading-normal`; the\r\n font follows the body's per-size step, which is `text-sm` at md */\r\n --_mono-modal-subtitle-font: var(--mono-modal-subtitle-font, var(--_mono-modal-body-font));\r\n --_mono-modal-subtitle-color: var(--mono-modal-subtitle-color, var(--muted-foreground));\r\n\r\n /* ── the close ✕ — `opacity-70 hover:opacity-100`, glyph `size-4` ───────── */\r\n --_mono-modal-close-size: var(--mono-modal-close-size, var(--_mono-modal-close-size-preset, var(--mono-modal-close-size-md, calc(var(--mono-spacing) * 7))));\r\n --_mono-modal-close-glyph: var(--mono-modal-close-glyph, var(--_mono-modal-close-glyph-preset, calc(var(--mono-spacing) * 4)));\r\n --_mono-modal-close-radius: var(--mono-modal-close-radius, var(--mono-radius-sm));\r\n --_mono-modal-close-bg: var(--mono-modal-close-bg, transparent);\r\n --_mono-modal-close-color: var(--mono-modal-close-color, var(--_mono-modal-text));\r\n --_mono-modal-close-opacity: var(--mono-modal-close-opacity, 0.7);\r\n --_mono-modal-close-hover-opacity: var(--mono-modal-close-hover-opacity, 1);\r\n --_mono-modal-close-hover-bg: var(--mono-modal-close-hover-bg, transparent);\r\n\r\n /* ── the backdrop — `bg-black/10 backdrop-blur-xs` ─────────────────────── */\r\n --_mono-modal-overlay-bg: var(--mono-modal-overlay-bg, var(--mono-mode-backdrop));\r\n /* Public so a flavor can drop the blur; a descendant rule would not reach the\r\n shadow build's overlay. */\r\n --_mono-modal-overlay-backdrop-filter: var(--mono-modal-overlay-backdrop-filter, blur(var(--mono-blur-xs)));\r\n\r\n --_mono-modal-z: var(--mono-modal-z, 600);\r\n\r\n /* `max-w-[calc(100%-2rem)] sm:max-w-md` — the width is a PROP here (a dialog's\r\n measure and its density are independent choices, which is why `size` does\r\n not touch it), so the default is upstream's `md` container. */\r\n --_mono-modal-width: var(--mono-modal-width, min(calc(100% - 2rem), var(--mono-container-md)));\r\n\r\n /* Open/close animation duration. One source of truth for the panel's opacity +\r\n transform AND the delayed `visibility` / `content-visibility` flips, which have\r\n to stay in lockstep with them — they used to be six hand-maintained `0.22s`\r\n literals. Set `--mono-modal-duration: 0s` for an instant, animation-free modal;\r\n worth doing when the modal body holds a lot of components, since that is what\r\n the open/close frames have to re-measure. */\r\n --_mono-modal-duration: var(--mono-modal-duration, var(--mono-duration-slow));\r\n /* The overlay keeps its own default so an explicit `--mono-modal-duration: 0s`\r\n does not leave the scrim fading on its own. */\r\n --_mono-modal-overlay-duration: var(--mono-modal-duration, var(--mono-duration-slow));\r\n\r\n /* Sized in VIEWPORT units, not `inset: 0`/`100%`. Both of those resolve against\r\n the initial containing block, which a horizontally-overflowing page inflates\r\n under mobile emulation (measured: 481x1041 on a 390x844 screen) — the panel\r\n then centres inside an oversized wrap and stops covering the screen. Viewport\r\n units stay correct there. `dvh`/`dvw` additionally track mobile browser chrome,\r\n so the `v*` line below is only the pre-2022 fallback. */\r\n position: fixed;\r\n top: 0;\r\n left: 0;\r\n width: 100vw;\r\n width: 100dvw;\r\n height: 100vh;\r\n height: 100dvh;\r\n z-index: var(--_mono-modal-z);\r\n pointer-events: none;\r\n font-family: inherit;\r\n color: var(--_mono-modal-text);\r\n}\r\n\r\n[mono-modal],\r\n:where([mono-modal]) *,\r\n:where([mono-modal]) *::before,\r\n:where([mono-modal]) *::after {\r\n box-sizing: border-box;\r\n}\r\n\r\n/* =========================================\r\n Sizes — EXTENSION: upstream's `data-size` is a width; this is the density\r\n ========================================= */\r\n\r\n[mono-modal][mono-size=\"xs\"] {\r\n --_mono-modal-radius-preset: var(--mono-modal-radius-xs, var(--mono-radius-md));\r\n --_mono-modal-pad-preset: var(--mono-modal-pad-xs, calc(var(--mono-spacing) * 3));\r\n --_mono-modal-gap-preset: var(--mono-modal-gap-xs, calc(var(--mono-spacing) * 3));\r\n --_mono-modal-header-gap-preset: var(--mono-modal-header-gap-xs, var(--mono-spacing));\r\n --_mono-modal-footer-gap-preset: var(--mono-modal-footer-gap-xs, var(--mono-spacing));\r\n --_mono-modal-title-font-preset: var(--mono-modal-title-font-xs, var(--mono-text-xs));\r\n --_mono-modal-body-font-preset: var(--mono-modal-body-font-xs, var(--mono-text-xs));\r\n --_mono-modal-body-line-height-preset: var(--mono-text-xs--lh);\r\n --_mono-modal-close-size-preset: var(--mono-modal-close-size-xs, calc(var(--mono-spacing) * 5));\r\n --_mono-modal-close-glyph-preset: calc(var(--mono-spacing) * 3);\r\n}\r\n\r\n[mono-modal][mono-size=\"sm\"] {\r\n --_mono-modal-radius-preset: var(--mono-modal-radius-sm, var(--mono-radius-lg));\r\n --_mono-modal-pad-preset: var(--mono-modal-pad-sm, calc(var(--mono-spacing) * 4));\r\n --_mono-modal-gap-preset: var(--mono-modal-gap-sm, calc(var(--mono-spacing) * 4));\r\n --_mono-modal-header-gap-preset: var(--mono-modal-header-gap-sm, calc(var(--mono-spacing) * 1.5));\r\n --_mono-modal-footer-gap-preset: var(--mono-modal-footer-gap-sm, calc(var(--mono-spacing) * 2));\r\n --_mono-modal-title-font-preset: var(--mono-modal-title-font-sm, var(--mono-text-sm));\r\n --_mono-modal-body-font-preset: var(--mono-modal-body-font-sm, var(--mono-text-xs));\r\n --_mono-modal-body-line-height-preset: var(--mono-text-xs--lh);\r\n --_mono-modal-close-size-preset: var(--mono-modal-close-size-sm, calc(var(--mono-spacing) * 6));\r\n --_mono-modal-close-glyph-preset: calc(var(--mono-spacing) * 3.5);\r\n}\r\n\r\n[mono-modal][mono-size=\"lg\"] {\r\n --_mono-modal-radius-preset: var(--mono-modal-radius-lg, var(--mono-radius-2xl));\r\n --_mono-modal-pad-preset: var(--mono-modal-pad-lg, calc(var(--mono-spacing) * 7));\r\n --_mono-modal-gap-preset: var(--mono-modal-gap-lg, calc(var(--mono-spacing) * 7));\r\n --_mono-modal-header-gap-preset: var(--mono-modal-header-gap-lg, calc(var(--mono-spacing) * 2.5));\r\n --_mono-modal-footer-gap-preset: var(--mono-modal-footer-gap-lg, calc(var(--mono-spacing) * 2.5));\r\n --_mono-modal-title-font-preset: var(--mono-modal-title-font-lg, var(--mono-text-base));\r\n --_mono-modal-body-font-preset: var(--mono-modal-body-font-lg, var(--mono-text-sm));\r\n --_mono-modal-close-size-preset: var(--mono-modal-close-size-lg, calc(var(--mono-spacing) * 8));\r\n --_mono-modal-close-glyph-preset: calc(var(--mono-spacing) * 4.5);\r\n}\r\n\r\n[mono-modal][mono-size=\"xl\"] {\r\n --_mono-modal-radius-preset: var(--mono-modal-radius-xl, var(--mono-radius-2xl));\r\n --_mono-modal-pad-preset: var(--mono-modal-pad-xl, calc(var(--mono-spacing) * 8));\r\n --_mono-modal-gap-preset: var(--mono-modal-gap-xl, calc(var(--mono-spacing) * 8));\r\n --_mono-modal-header-gap-preset: var(--mono-modal-header-gap-xl, calc(var(--mono-spacing) * 3));\r\n --_mono-modal-footer-gap-preset: var(--mono-modal-footer-gap-xl, calc(var(--mono-spacing) * 3));\r\n --_mono-modal-title-font-preset: var(--mono-modal-title-font-xl, var(--mono-text-lg));\r\n --_mono-modal-body-font-preset: var(--mono-modal-body-font-xl, var(--mono-text-base));\r\n --_mono-modal-body-line-height-preset: var(--mono-text-base--lh);\r\n --_mono-modal-close-size-preset: var(--mono-modal-close-size-xl, calc(var(--mono-spacing) * 9));\r\n --_mono-modal-close-glyph-preset: calc(var(--mono-spacing) * 5);\r\n}\r\n\r\n[mono-modal][mono-size=\"xxl\"] {\r\n --_mono-modal-radius-preset: var(--mono-modal-radius-xxl, var(--mono-radius-4xl));\r\n --_mono-modal-pad-preset: var(--mono-modal-pad-xxl, calc(var(--mono-spacing) * 9));\r\n --_mono-modal-gap-preset: var(--mono-modal-gap-xxl, calc(var(--mono-spacing) * 9));\r\n --_mono-modal-header-gap-preset: var(--mono-modal-header-gap-xxl, calc(var(--mono-spacing) * 3.5));\r\n --_mono-modal-footer-gap-preset: var(--mono-modal-footer-gap-xxl, calc(var(--mono-spacing) * 3.5));\r\n --_mono-modal-title-font-preset: var(--mono-modal-title-font-xxl, var(--mono-text-xl));\r\n --_mono-modal-body-font-preset: var(--mono-modal-body-font-xxl, var(--mono-text-lg));\r\n --_mono-modal-body-line-height-preset: var(--mono-text-lg--lh);\r\n --_mono-modal-close-size-preset: var(--mono-modal-close-size-xxl, calc(var(--mono-spacing) * 10));\r\n --_mono-modal-close-glyph-preset: calc(var(--mono-spacing) * 5.5);\r\n}\r\n\r\n/* =========================================\r\n Colours — EXTENSION: the role tints the ring and whatever the consumer\r\n turns back on (the head bar, the close hover)\r\n ========================================= */\r\n\r\n[mono-modal][mono-color=\"primary\"] { --_mono-modal-accent-preset: var(--_mono-modal-primary); }\r\n[mono-modal][mono-color=\"secondary\"] { --_mono-modal-accent-preset: var(--_mono-modal-secondary); }\r\n[mono-modal][mono-color=\"success\"] { --_mono-modal-accent-preset: var(--_mono-modal-success); }\r\n[mono-modal][mono-color=\"danger\"] { --_mono-modal-accent-preset: var(--_mono-modal-danger); }\r\n[mono-modal][mono-color=\"warning\"] { --_mono-modal-accent-preset: var(--_mono-modal-warning); }\r\n[mono-modal][mono-color=\"info\"] { --_mono-modal-accent-preset: var(--_mono-modal-info); }\r\n[mono-modal][mono-color=\"teal\"] { --_mono-modal-accent-preset: var(--_mono-modal-teal); }\r\n[mono-modal][mono-color=\"purple\"] { --_mono-modal-accent-preset: var(--_mono-modal-purple); }\r\n[mono-modal][mono-color=\"neutral\"] { --_mono-modal-accent-preset: var(--_mono-modal-neutral); }\r\n[mono-modal][mono-color=\"dark\"] { --_mono-modal-accent-preset: var(--_mono-modal-dark); }\r\n\r\n/* An explicit `color` shows on the panel itself, not only in the ✕ hover: a\r\n thin line of the accent sits ON the ring and a faint halo of it under the\r\n elevation — \"bordered green, glowing green just a little\". Both live in the\r\n glow layer (first in the shadow list, so the translucent foreground/10 ring\r\n does not muddy the line, and a flavour's own `--mono-modal-ring-color` is\r\n left alone). Without `color` the layer is nothing. `--mono-modal-glow`\r\n replaces the whole layer; `--mono-modal-accent-ring` recolours the line. */\r\n[mono-modal][mono-color] {\r\n --_mono-modal-glow: var(--mono-modal-glow,\r\n 0 0 0 var(--_mono-modal-ring-width) var(--mono-modal-accent-ring, color-mix(in oklab, var(--_mono-modal-accent) 35%, var(--_mono-modal-border))),\r\n 0 0 24px -4px color-mix(in oklab, var(--_mono-modal-accent) 45%, transparent));\r\n}\r\n\r\n/* =========================================\r\n Overlay — `::backdrop`\r\n ========================================= */\r\n\r\n/* basecoat@1.0.2 styles/vega.css .dialog::backdrop, .alert-dialog::backdrop, .command-dialog::backdrop\r\n — bg-black/10 backdrop-blur-xs duration-100. A real `::backdrop` cannot be\r\n reached from a shadow sheet and cannot stack with this component's own layer\r\n manager, so it is an element — the fill is upstream's, through the mode token. */\r\n:where([mono-modal]) > [mono-overlay] {\r\n /* Viewport units, not `inset: 0` — see the note on the root. */\r\n position: fixed;\r\n top: 0;\r\n left: 0;\r\n width: 100vw;\r\n width: 100dvw;\r\n height: 100vh;\r\n height: 100dvh;\r\n background: var(--_mono-modal-overlay-bg);\r\n opacity: 0;\r\n pointer-events: none;\r\n\r\n /* The blur is applied only while open; it used to be declared unconditionally with\r\n `opacity: 0` as the only thing hiding it. Hygiene rather than a measured win —\r\n `backdrop-filter` is a paint/composite cost, and the layout+style metrics used to\r\n validate the `content-visibility` change below cannot attribute anything to it\r\n either way. Kept because a filter on a never-shown full-viewport element is work\r\n the browser should never be asked to consider, and the change is free.\r\n\r\n Removal is DELAYED by the fade duration (the same idiom this file already uses\r\n for `visibility` below): drop it immediately and the backdrop snaps sharp while\r\n the scrim is still fading out. `backdrop-filter` is animatable, so a plain\r\n delayed transition does the job — no `allow-discrete` needed. */\r\n backdrop-filter: none;\r\n -webkit-backdrop-filter: none;\r\n transition:\r\n opacity var(--_mono-modal-overlay-duration) var(--mono-ease),\r\n backdrop-filter 0s linear var(--_mono-modal-overlay-duration),\r\n -webkit-backdrop-filter 0s linear var(--_mono-modal-overlay-duration);\r\n}\r\n\r\n[mono-modal][mono-open] > [mono-overlay] {\r\n opacity: 1;\r\n pointer-events: auto;\r\n backdrop-filter: var(--_mono-modal-overlay-backdrop-filter);\r\n -webkit-backdrop-filter: var(--_mono-modal-overlay-backdrop-filter);\r\n transition:\r\n opacity var(--_mono-modal-overlay-duration) var(--mono-ease),\r\n backdrop-filter 0s linear 0s,\r\n -webkit-backdrop-filter 0s linear 0s;\r\n}\r\n\r\n[mono-modal][mono-no-overlay] > [mono-overlay] {\r\n display: none;\r\n}\r\n\r\n/* Stacked modals: when another modal or drawer WITH an overlay is open above\r\n this one, hide this backdrop so dim layers don't compound — the topmost\r\n overlay alone dims everything beneath it. An `overlay=\"false\"` dialog above\r\n does not count, so this one keeps dimming the page. */\r\n[mono-modal][mono-open][mono-has-modal-above] > [mono-overlay] {\r\n opacity: 0;\r\n}\r\n\r\n/* =========================================\r\n Panel — `.dialog > *`\r\n ========================================= */\r\n\r\n/* EXTENSION — the centring box. Upstream centres the panel itself\r\n (`fixed top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2`), which this\r\n component cannot: the drag offset is a `translate` too, and the two would\r\n fight. A flex wrap centres without spending the transform. */\r\n:where([mono-modal]) > [mono-panel-wrap] {\r\n /* Viewport units, not `inset: 0` — see the note on the root. This is the box\r\n the panel centres in, so an inflated one offsets the panel off-screen. */\r\n position: fixed;\r\n top: 0;\r\n left: 0;\r\n width: 100vw;\r\n width: 100dvw;\r\n height: 100vh;\r\n height: 100dvh;\r\n display: flex;\r\n align-items: center;\r\n justify-content: center;\r\n padding: 1rem;\r\n pointer-events: none;\r\n z-index: calc(var(--_mono-modal-z) + 1);\r\n}\r\n\r\n/* basecoat@1.0.2 components/dialog.css .dialog, .alert-dialog >> > * — fixed z-50\r\n flex max-h-[calc(100%_-_2rem)] w-full flex-col transition-all outline-hidden */\r\n/* basecoat@1.0.2 styles/vega.css .dialog > * — bg-popover text-popover-foreground\r\n ring-foreground/10 max-w-[calc(100%-2rem)] gap-6 rounded-xl p-6 text-sm ring-1\r\n duration-100 sm:max-w-md */\r\n:where([mono-modal] > [mono-panel-wrap]) > [mono-panel] {\r\n position: relative;\r\n display: flex;\r\n flex-direction: column;\r\n gap: var(--_mono-modal-gap);\r\n width: var(--_mono-modal-width);\r\n max-width: calc(100% - 2rem);\r\n max-height: calc(100vh - 2rem);\r\n max-height: calc(100dvh - 2rem);\r\n padding: var(--_mono-modal-pad);\r\n border-radius: var(--_mono-modal-radius);\r\n background: var(--_mono-modal-bg);\r\n color: var(--_mono-modal-text);\r\n box-shadow:\r\n var(--_mono-modal-glow),\r\n 0 0 0 var(--_mono-modal-ring-width) var(--_mono-modal-ring-color),\r\n var(--_mono-modal-shadow);\r\n overflow: hidden;\r\n outline: none;\r\n pointer-events: auto;\r\n\r\n /* Closed state: invisible (hides shadow halo) + scaled-down, which is\r\n upstream's `@starting-style` pair (`opacity-0` + `scale-95`) written as a\r\n class transition — a `<dialog>`'s discrete open/close is not available to a\r\n component that manages its own layer. The visibility flip is delayed on\r\n close so the scale-out animation plays first. */\r\n opacity: 0;\r\n transform: translate(var(--drag-x, 0px), var(--drag-y, 0px)) scale(0.95);\r\n visibility: hidden;\r\n transition:\r\n opacity var(--_mono-modal-duration) var(--mono-ease),\r\n transform var(--_mono-modal-duration) var(--mono-ease),\r\n visibility 0s linear var(--_mono-modal-duration);\r\n}\r\n\r\n[mono-modal][mono-open] > [mono-panel-wrap] > [mono-panel] {\r\n opacity: 1;\r\n transform: translate(var(--drag-x, 0px), var(--drag-y, 0px)) scale(1);\r\n visibility: visible;\r\n transition:\r\n opacity var(--_mono-modal-duration) var(--mono-ease),\r\n transform var(--_mono-modal-duration) var(--mono-ease),\r\n visibility 0s linear 0s;\r\n}\r\n\r\n/* Draggable: the head is the drag handle; suppress the transform transition while\r\n dragging so the panel tracks the pointer 1:1 and snaps instantly on drop. */\r\n[mono-modal][mono-draggable] > [mono-panel-wrap] > [mono-panel] > [mono-header] {\r\n cursor: move;\r\n touch-action: none;\r\n user-select: none;\r\n}\r\n\r\n[mono-modal][mono-draggable] > [mono-panel-wrap] > [mono-panel] > [mono-header] [mono-close] {\r\n cursor: pointer;\r\n}\r\n\r\n[mono-modal][mono-dragging] > [mono-panel-wrap] > [mono-panel] {\r\n transition: none;\r\n}\r\n\r\n/* =========================================\r\n Head — `> header`\r\n ========================================= */\r\n\r\n/* basecoat@1.0.2 components/dialog.css .dialog >> > * > header — flex flex-col */\r\n/* basecoat@1.0.2 styles/vega.css .dialog > * > header — gap-2\r\n DEVIATION: a ROW. Upstream's header is a column of title + description with the\r\n ✕ absolutely positioned beside it; ours holds the ✕ because the head is the\r\n drag handle. Upstream's column is `[mono-heading]` below, the ✕'s row-mate —\r\n and all a `slot=\"header\"` replaces. */\r\n:where([mono-modal] > [mono-panel-wrap] > [mono-panel]) > [mono-header] {\r\n display: flex;\r\n align-items: flex-start;\r\n justify-content: space-between;\r\n gap: var(--_mono-modal-header-gap);\r\n flex-shrink: 0;\r\n padding: var(--mono-modal-header-pad, 0);\r\n border-bottom: var(--_mono-modal-header-border-width) solid var(--_mono-modal-header-border);\r\n background: var(--_mono-modal-header-bg);\r\n}\r\n\r\n/* No subtitle: a lone title line sits centred beside the taller ✕ instead of\r\n riding its top edge. With a subtitle the head stays top-aligned. */\r\n:where([mono-modal] > [mono-panel-wrap] > [mono-panel]) > [mono-header][mono-no-subtitle] {\r\n align-items: center;\r\n}\r\n\r\n/* basecoat@1.0.2 styles/vega.css .dialog > * > header > h2, .dialog > * > [data-title]\r\n — leading-none font-medium */\r\n/* basecoat@1.0.2 components/dialog.css .dialog >> > * > header — flex flex-col\r\n (+ vega's gap-2): the title / subtitle column, taking the row beside the ✕. */\r\n:where([mono-modal] > [mono-panel-wrap] > [mono-panel] > [mono-header]) > [mono-heading] {\r\n flex: 1;\r\n min-width: 0;\r\n display: flex;\r\n flex-direction: column;\r\n gap: var(--mono-modal-heading-gap, var(--_mono-modal-header-gap));\r\n}\r\n\r\n:where([mono-modal] > [mono-panel-wrap] > [mono-panel] > [mono-header]) [mono-title] {\r\n min-width: 0;\r\n font-size: var(--_mono-modal-title-font);\r\n font-weight: var(--_mono-modal-title-weight);\r\n line-height: var(--mono-leading-none, 1);\r\n color: var(--_mono-modal-title-color);\r\n}\r\n\r\n/* basecoat@1.0.2 styles/vega.css .dialog > * > header > p, .dialog > * > [data-description]\r\n — text-muted-foreground text-sm leading-normal */\r\n:where([mono-modal] > [mono-panel-wrap] > [mono-panel] > [mono-header]) [mono-subtitle] {\r\n min-width: 0;\r\n font-size: var(--_mono-modal-subtitle-font);\r\n line-height: var(--mono-modal-subtitle-line-height, var(--mono-leading-normal));\r\n color: var(--_mono-modal-subtitle-color);\r\n}\r\n\r\n/* Empty regions. The light build omits them; the shadow build always renders\r\n them (its native `<slot>`s must exist to be scanned) and marks them\r\n [mono-empty]. The heading parts are matched as descendants because the shadow\r\n build nests them inside the `header` slot's fallback. */\r\n:where([mono-modal] > [mono-panel-wrap] > [mono-panel]) > :is([mono-header], [mono-footer])[mono-empty],\r\n:where([mono-modal] > [mono-panel-wrap] > [mono-panel] > [mono-header]) > [mono-heading][mono-empty],\r\n:where([mono-modal] > [mono-panel-wrap] > [mono-panel] > [mono-header] > [mono-heading]) :is([mono-title], [mono-subtitle])[mono-empty] {\r\n display: none;\r\n}\r\n\r\n/* =========================================\r\n Close — `> button`\r\n ========================================= */\r\n\r\n/* basecoat@1.0.2 components/dialog.css .dialog >> > * > :is(button, form[method='dialog'] > button)\r\n — inline-flex items-center justify-center opacity-70 transition-opacity\r\n hover:opacity-100 focus-visible:outline-hidden disabled:pointer-events-none\r\n DEVIATION: in flow inside the head rather than `absolute top-4 end-4` — see\r\n the header note above. */\r\n:where([mono-modal] > [mono-panel-wrap] > [mono-panel] > [mono-header]) [mono-close] {\r\n flex-shrink: 0;\r\n /* stays at the end even when the heading column is empty (hidden) */\r\n margin-inline-start: auto;\r\n display: inline-flex;\r\n align-items: center;\r\n justify-content: center;\r\n width: var(--_mono-modal-close-size);\r\n height: var(--_mono-modal-close-size);\r\n padding: 0;\r\n border: none;\r\n border-radius: var(--_mono-modal-close-radius);\r\n background: var(--_mono-modal-close-bg);\r\n color: var(--_mono-modal-close-color);\r\n opacity: var(--_mono-modal-close-opacity);\r\n cursor: pointer;\r\n appearance: none;\r\n transition:\r\n opacity var(--mono-duration) var(--mono-ease),\r\n background-color var(--mono-duration) var(--mono-ease);\r\n}\r\n\r\n@media (hover: hover) {\r\n [mono-modal] [mono-close]:hover {\r\n opacity: var(--_mono-modal-close-hover-opacity);\r\n background: var(--_mono-modal-close-hover-bg);\r\n }\r\n}\r\n\r\n[mono-modal] [mono-close]:focus-visible {\r\n outline: none;\r\n box-shadow: 0 0 0 var(--mono-ring-width)\r\n color-mix(in oklab, var(--ring) var(--mono-ring-alpha), transparent);\r\n}\r\n\r\n/* basecoat@1.0.2 components/dialog.css .dialog >> > * > :is(button, form[method='dialog'] > button) > svg:not([class*='size-'])\r\n — size-4 */\r\n[mono-modal] [mono-close] > :is(svg, span) {\r\n display: block;\r\n width: var(--_mono-modal-close-glyph);\r\n height: var(--_mono-modal-close-glyph);\r\n}\r\n\r\n/* =========================================\r\n Body — `> section`\r\n ========================================= */\r\n\r\n/* basecoat@1.0.2 components/dialog.css .dialog >> > * > section — flex-1\r\n The panel's own `p-6` is the padding; `--mono-modal-body-pad` restores an\r\n inner one for a body that scrolls under a restored head bar. */\r\n:where([mono-modal] > [mono-panel-wrap] > [mono-panel]) > [mono-body] {\r\n flex: 1;\r\n min-height: 0;\r\n overflow-y: auto;\r\n padding: var(--mono-modal-body-pad, 0);\r\n font-size: var(--_mono-modal-body-font);\r\n line-height: var(--_mono-modal-body-line-height);\r\n color: var(--_mono-modal-text);\r\n}\r\n\r\n/* =========================================\r\n Foot — `> footer`\r\n ========================================= */\r\n\r\n/* basecoat@1.0.2 components/dialog.css .dialog >> > * > footer\r\n — flex flex-col-reverse sm:flex-row sm:justify-end */\r\n/* basecoat@1.0.2 styles/vega.css .alert-dialog > * > footer, .dialog > * > footer — gap-2 */\r\n:where([mono-modal] > [mono-panel-wrap] > [mono-panel]) > [mono-footer] {\r\n display: flex;\r\n flex-direction: column-reverse;\r\n gap: var(--_mono-modal-footer-gap);\r\n flex-shrink: 0;\r\n margin: var(--mono-modal-footer-margin, 0);\r\n padding: var(--mono-modal-footer-pad, 0);\r\n border-top: var(--_mono-modal-footer-border-width) solid var(--_mono-modal-footer-border);\r\n border-end-start-radius: var(--mono-modal-footer-radius, 0);\r\n border-end-end-radius: var(--mono-modal-footer-radius, 0);\r\n background: var(--_mono-modal-footer-bg);\r\n}\r\n\r\n@media (width >= 40rem) {\r\n [mono-modal] > [mono-panel-wrap] > [mono-panel] > [mono-footer] {\r\n flex-direction: row;\r\n align-items: center;\r\n justify-content: flex-end;\r\n }\r\n}\r\n\r\n/* =========================================\r\n Full screen — both width and height passed as \"100%\"\r\n ========================================= */\r\n\r\n[mono-modal][mono-fullscreen] > [mono-panel-wrap] {\r\n padding: 0;\r\n}\r\n\r\n[mono-modal][mono-fullscreen] > [mono-panel-wrap] > [mono-panel] {\r\n width: 100vw;\r\n width: 100dvw;\r\n height: 100vh;\r\n height: 100dvh;\r\n max-width: 100vw;\r\n max-width: 100dvw;\r\n max-height: 100vh;\r\n max-height: 100dvh;\r\n border-radius: 0;\r\n}\r\n\r\n/* A closed modal is hidden with `visibility: hidden`, which skips PAINT but not\r\n LAYOUT — so the panel and everything slotted into it kept generating boxes and\r\n being measured even for a modal the user never opened. That cost is paid at mount:\r\n `mono-modal.ts` builds the <body> portal in `createRenderRoot()`, moves the\r\n consumer's children into it, and forces a synchronous `performUpdate()` from\r\n `connectedCallback`. `content-visibility: hidden` drops the closed subtree\r\n entirely, so a heavy modal costs nothing until it is opened.\r\n\r\n Measured (Chromium, ~400-node panels, 10 modal+drawer pairs, 20k DOM nodes):\r\n layout objects: 12281 → 81 (−99.3%); with a single pair, 1237 → 18\r\n mount layout+style: 94.6ms → 14.9ms, and flat in the number of modals\r\n The trade, same as the accordion's: one open+close costs MORE (2.1ms → 8.0ms),\r\n because an opening panel is laid out from scratch instead of incrementally. Worth\r\n it — you mount once and toggle rarely — and `--mono-modal-duration: 0s` claws the\r\n toggle back if a body is heavy enough to notice.\r\n\r\n `allow-discrete` is what makes it safe to animate. Opening flips the property to\r\n `visible` at 0%, so the scale/opacity animation has something to composite;\r\n closing holds it `visible` until 100%, so the panel scales out instead of\r\n vanishing on the first frame.\r\n\r\n Gated behind @supports deliberately: `content-visibility … allow-discrete` inside\r\n the `transition` SHORTHAND is a parse error to a browser without the feature, and\r\n one bad entry drops the WHOLE declaration — which would take the modal's fade and\r\n scale with it. Inside the guard the shorthand is known to parse, so the list is\r\n restated in full. Browsers without support keep exactly the previous behaviour.\r\n\r\n Must stay ABOVE the reduced-motion block below: that block wins on `!important`,\r\n but @supports adds no specificity, so source order is what keeps it winning. */\r\n@supports (transition-behavior: allow-discrete) {\r\n :where([mono-modal] > [mono-panel-wrap]) > [mono-panel] {\r\n content-visibility: hidden;\r\n contain-intrinsic-size: 0;\r\n transition:\r\n opacity var(--_mono-modal-duration) var(--mono-ease),\r\n transform var(--_mono-modal-duration) var(--mono-ease),\r\n visibility 0s linear var(--_mono-modal-duration),\r\n content-visibility var(--_mono-modal-duration) allow-discrete;\r\n }\r\n\r\n [mono-modal][mono-open] > [mono-panel-wrap] > [mono-panel] {\r\n content-visibility: visible;\r\n }\r\n}\r\n\r\n/* Reduced motion */\r\n@media (prefers-reduced-motion: reduce) {\r\n [mono-modal] > [mono-overlay],\r\n [mono-modal] > [mono-panel-wrap] > [mono-panel] {\r\n transition: opacity 0.01s linear, visibility 0s linear !important;\r\n transform: none !important;\r\n }\r\n}\r\n\r\n/* =========================================\r\n Auto full-screen (`auto-fullscreen` prop)\r\n =========================================\r\n\r\n Fill the screen at a Tailwind breakpoint and below. The boundaries are\r\n `<breakpoint> - 0.02px` so they match Tailwind's `max-*` variants exactly: at\r\n exactly 640px `sm:` applies, so auto-fullscreen must NOT.\r\n\r\n Two things to know before editing:\r\n\r\n 1. `!important` is required here, unlike `[mono-fullscreen]` above.\r\n `_panelSizeStyle()` writes `width`/`height`/`min-*`/`max-*` as INLINE styles\r\n whenever the consumer sets a sizing prop, and inline beats any selector —\r\n without it `<mono-modal auto-fullscreen width=\"720\">` would stay 720px on a\r\n phone. The `min-*` resets matter too: a `min-width` larger than `width` still\r\n wins.\r\n 2. The five near-identical blocks are unavoidable — a media query cannot be\r\n parameterised by an attribute or a custom property, so each breakpoint needs\r\n its own. Keep them in sync.\r\n*/\r\n\r\n@media (max-width: 639.98px) {\r\n [mono-modal][mono-auto-fullscreen=\"sm\"] > [mono-panel-wrap] {\r\n padding: 0;\r\n }\r\n\r\n [mono-modal][mono-auto-fullscreen=\"sm\"] > [mono-panel-wrap] > [mono-panel] {\r\n width: 100vw !important;\r\n width: 100dvw !important;\r\n height: 100vh !important;\r\n height: 100dvh !important;\r\n min-width: 0 !important;\r\n min-height: 0 !important;\r\n max-width: 100vw !important;\r\n max-width: 100dvw !important;\r\n max-height: 100vh !important;\r\n max-height: 100dvh !important;\r\n border-radius: 0;\r\n }\r\n}\r\n\r\n@media (max-width: 767.98px) {\r\n [mono-modal][mono-auto-fullscreen=\"md\"] > [mono-panel-wrap] {\r\n padding: 0;\r\n }\r\n\r\n [mono-modal][mono-auto-fullscreen=\"md\"] > [mono-panel-wrap] > [mono-panel] {\r\n width: 100vw !important;\r\n width: 100dvw !important;\r\n height: 100vh !important;\r\n height: 100dvh !important;\r\n min-width: 0 !important;\r\n min-height: 0 !important;\r\n max-width: 100vw !important;\r\n max-width: 100dvw !important;\r\n max-height: 100vh !important;\r\n max-height: 100dvh !important;\r\n border-radius: 0;\r\n }\r\n}\r\n\r\n@media (max-width: 1023.98px) {\r\n [mono-modal][mono-auto-fullscreen=\"lg\"] > [mono-panel-wrap] {\r\n padding: 0;\r\n }\r\n\r\n [mono-modal][mono-auto-fullscreen=\"lg\"] > [mono-panel-wrap] > [mono-panel] {\r\n width: 100vw !important;\r\n width: 100dvw !important;\r\n height: 100vh !important;\r\n height: 100dvh !important;\r\n min-width: 0 !important;\r\n min-height: 0 !important;\r\n max-width: 100vw !important;\r\n max-width: 100dvw !important;\r\n max-height: 100vh !important;\r\n max-height: 100dvh !important;\r\n border-radius: 0;\r\n }\r\n}\r\n\r\n@media (max-width: 1279.98px) {\r\n [mono-modal][mono-auto-fullscreen=\"xl\"] > [mono-panel-wrap] {\r\n padding: 0;\r\n }\r\n\r\n [mono-modal][mono-auto-fullscreen=\"xl\"] > [mono-panel-wrap] > [mono-panel] {\r\n width: 100vw !important;\r\n width: 100dvw !important;\r\n height: 100vh !important;\r\n height: 100dvh !important;\r\n min-width: 0 !important;\r\n min-height: 0 !important;\r\n max-width: 100vw !important;\r\n max-width: 100dvw !important;\r\n max-height: 100vh !important;\r\n max-height: 100dvh !important;\r\n border-radius: 0;\r\n }\r\n}\r\n\r\n@media (max-width: 1535.98px) {\r\n [mono-modal][mono-auto-fullscreen=\"2xl\"] > [mono-panel-wrap] {\r\n padding: 0;\r\n }\r\n\r\n [mono-modal][mono-auto-fullscreen=\"2xl\"] > [mono-panel-wrap] > [mono-panel] {\r\n width: 100vw !important;\r\n width: 100dvw !important;\r\n height: 100vh !important;\r\n height: 100dvh !important;\r\n min-width: 0 !important;\r\n min-height: 0 !important;\r\n max-width: 100vw !important;\r\n max-width: 100dvw !important;\r\n max-height: 100vh !important;\r\n max-height: 100dvh !important;\r\n border-radius: 0;\r\n }\r\n}\r\n\r\n/* ── Programmatic dialog (`controlMonoModal().dialog`) ─────────────────────────\r\n The compact question box the controller builds by code — upstream's\r\n `.alert-dialog`: the text centred, the actions centred under it, and a lighter\r\n scrim, because what the question is about should stay readable behind it.\r\n `mono-dialog` is set through `cssClassName` on the dialog's own modal, so an\r\n ordinary <mono-modal> is untouched. */\r\n[mono-modal][mono-dialog] {\r\n --_mono-modal-overlay-backdrop-filter: var(--mono-modal-overlay-backdrop-filter, none);\r\n --_mono-modal-overlay-bg: var(--mono-modal-overlay-bg,\r\n color-mix(in oklab, black 22%, transparent));\r\n}\r\n\r\n/* basecoat@1.0.2 components/dialog.css .alert-dialog >> > * > header — grid\r\n place-items-center text-center sm:place-items-start sm:text-start\r\n DEVIATION: centred at EVERY width. This box is one question and two buttons —\r\n upstream's `sm:` left-align belongs to the icon+title+description layout its\r\n alert dialog builds, which the controller does not produce. */\r\n[mono-modal][mono-dialog] > [mono-panel-wrap] > [mono-panel] > [mono-body] {\r\n text-align: center;\r\n}\r\n\r\n/* basecoat@1.0.2 components/dialog.css .alert-dialog >> &:is([data-size='sm']) > * > footer, > [data-size='sm'] > footer\r\n — grid grid-cols-2. The controller's dialog is that `sm` alert: its actions sit\r\n together under the question rather than trailing to the end. */\r\n[mono-modal][mono-dialog] > [mono-panel-wrap] > [mono-panel] > [mono-footer] {\r\n justify-content: center;\r\n flex-wrap: wrap;\r\n}\r\n\r\n/* The light build re-appends slotted nodes into a `[data-mono-slot]` outlet.\r\n Left inline, that outlet is ONE flex child, so the footer's gap and\r\n justification apply to IT rather than to the buttons inside it — while the\r\n shadow build's `<slot>` is `display: contents` per the UA sheet and the\r\n hand-written markup has no wrapper at all. Dissolving the outlet is what\r\n makes the three agree, and it is what a consumer writing\r\n `<button slot=\"footer\">` twice expects. */\r\n:where([mono-modal] > [mono-panel-wrap] > [mono-panel] > [mono-footer]) > [data-mono-slot] {\r\n display: contents;\r\n}\r\n\r\n/* The captured footer lands in an inline `<span data-mono-slot=\"foot\">` outlet, so\r\n the buttons would otherwise sit in a LINE box — baseline-aligned, a solid button\r\n with an icon a few px lower than an outline one beside it, with line-height air\r\n underneath. The outlet becomes the flex row instead, and the actions wrapper\r\n dissolves into it. */\r\n[mono-modal][mono-dialog] > [mono-panel-wrap] > [mono-panel] > [mono-footer] > [data-mono-slot=\"foot\"] {\r\n display: flex;\r\n flex: 1 1 auto;\r\n flex-wrap: wrap;\r\n align-items: center;\r\n justify-content: center;\r\n gap: var(--_mono-modal-footer-gap);\r\n line-height: 1;\r\n}\r\n\r\n[mono-modal][mono-dialog] .mono-modal-dialog-actions {\r\n display: contents;\r\n}\r\n";
|
|
836
|
+
//#endregion
|
|
837
|
+
//#region src/components/modal/mono-modal.shadow.ts
|
|
838
|
+
/**
|
|
839
|
+
* Alias each region also answers to. `header`/`footer` mirror the drawer's slot
|
|
840
|
+
* vocabulary and OUTRANK the original `head`/`foot` when both are supplied.
|
|
841
|
+
*/
|
|
842
|
+
var ALIAS_OF = {
|
|
843
|
+
head: "header",
|
|
844
|
+
foot: "footer"
|
|
845
|
+
};
|
|
846
|
+
var MonoModalShadow = class MonoModalShadow extends withShadowUtilityStyles(MonoModalCore(LitElement)) {
|
|
847
|
+
static {
|
|
848
|
+
this.disableWarning?.("change-in-update");
|
|
849
|
+
}
|
|
850
|
+
static {
|
|
851
|
+
this.styles = [unsafeCSS(toShadowCss(modal_default, { host: "mono-modal" }))];
|
|
852
|
+
}
|
|
853
|
+
get _slotsAlwaysRender() {
|
|
854
|
+
return true;
|
|
855
|
+
}
|
|
856
|
+
connectedCallback() {
|
|
857
|
+
super.connectedCallback();
|
|
858
|
+
if (isServer) return;
|
|
859
|
+
flushSsrHydration(this);
|
|
860
|
+
}
|
|
861
|
+
firstUpdated(changed) {
|
|
862
|
+
super.firstUpdated?.(changed);
|
|
863
|
+
if (isServer) return;
|
|
864
|
+
this._scanSlots();
|
|
865
|
+
}
|
|
866
|
+
updated(changed) {
|
|
867
|
+
super.updated(changed);
|
|
868
|
+
this._applyRootAttrs(this._rootEl);
|
|
869
|
+
if (!isServer) this._scanSlots();
|
|
870
|
+
}
|
|
871
|
+
/** `string`, not `ModalSlotName` — this also resolves the alias names. */
|
|
872
|
+
_slotFor(name) {
|
|
873
|
+
return this.renderRoot.querySelector(`slot[name="${name}"]`);
|
|
874
|
+
}
|
|
875
|
+
_defaultSlot() {
|
|
876
|
+
return this.renderRoot.querySelector("slot:not([name])");
|
|
877
|
+
}
|
|
878
|
+
_slotHasContent(slot) {
|
|
879
|
+
return !!slot && slot.assignedNodes().length > 0 && slot.assignedNodes({ flatten: true }).some((n) => n.nodeType === Node.ELEMENT_NODE || !!(n.textContent ?? "").trim());
|
|
880
|
+
}
|
|
881
|
+
_onSlotChange(name, event) {
|
|
882
|
+
this._setSlotState(name, this._slotHasContent(event.target));
|
|
883
|
+
}
|
|
884
|
+
/**
|
|
885
|
+
* Does this region have content under EITHER of its names? `head`/`foot` each
|
|
886
|
+
* also answer to an alias (`header`/`footer`), so presence is the union.
|
|
887
|
+
*/
|
|
888
|
+
_regionHasContent(name) {
|
|
889
|
+
const alias = ALIAS_OF[name];
|
|
890
|
+
return this._slotHasContent(this._slotFor(name)) || !!alias && this._slotHasContent(this._slotFor(alias));
|
|
891
|
+
}
|
|
892
|
+
/** Reconcile the 4 slot-presence flags from their slots' assigned content.
|
|
893
|
+
* Body is the default (unnamed) slot OR an explicit `slot="body"`. */
|
|
894
|
+
_scanSlots() {
|
|
895
|
+
for (const name of [
|
|
896
|
+
"head",
|
|
897
|
+
"title",
|
|
898
|
+
"subtitle",
|
|
899
|
+
"foot"
|
|
900
|
+
]) {
|
|
901
|
+
const has = this._regionHasContent(name);
|
|
902
|
+
if (has !== this._hasSlot(name)) this._setSlotState(name, has);
|
|
903
|
+
}
|
|
904
|
+
const bodyHas = this._slotHasContent(this._slotFor("body")) || this._slotHasContent(this._defaultSlot());
|
|
905
|
+
if (bodyHas !== this._hasSlot("body")) this._setSlotState("body", bodyHas);
|
|
906
|
+
}
|
|
907
|
+
/**
|
|
908
|
+
* Native `<slot>`. Body accepts both the default (unnamed) slot and an
|
|
909
|
+
* explicit `slot="body"` — matching the light build's capture, which treats
|
|
910
|
+
* unslotted children and `slot="body"` alike.
|
|
911
|
+
*/
|
|
912
|
+
_slotOutlet(name, fallback = nothing) {
|
|
913
|
+
if (name === "body") return html`<slot
|
|
914
|
+
name="body"
|
|
915
|
+
@slotchange=${(e) => this._onSlotChange("body", e)}
|
|
916
|
+
></slot
|
|
917
|
+
><slot @slotchange=${() => this._scanSlots()}>${fallback}</slot>`;
|
|
918
|
+
const alias = ALIAS_OF[name];
|
|
919
|
+
if (alias) {
|
|
920
|
+
const sync = () => this._setSlotState(name, this._regionHasContent(name));
|
|
921
|
+
return html`<slot name=${alias} @slotchange=${sync}
|
|
922
|
+
><slot name=${name} @slotchange=${sync}>${fallback}</slot></slot
|
|
923
|
+
>`;
|
|
924
|
+
}
|
|
925
|
+
return html`<slot
|
|
926
|
+
name=${name}
|
|
927
|
+
@slotchange=${(e) => this._onSlotChange(name, e)}
|
|
928
|
+
>${fallback}</slot
|
|
929
|
+
>`;
|
|
930
|
+
}
|
|
931
|
+
/** Inline SVG — the global `.mono-icon`/`i-mdi-close` UnoCSS icon can't reach
|
|
932
|
+
* a shadow root. */
|
|
933
|
+
renderIcon(_name) {
|
|
934
|
+
return html`<svg
|
|
935
|
+
class="mono-icon"
|
|
936
|
+
viewBox="0 0 24 24"
|
|
937
|
+
width="1em"
|
|
938
|
+
height="1em"
|
|
939
|
+
fill="currentColor"
|
|
940
|
+
aria-hidden="true"
|
|
941
|
+
>
|
|
942
|
+
<path
|
|
943
|
+
d="M19 6.41 17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"
|
|
944
|
+
></path>
|
|
945
|
+
</svg>`;
|
|
946
|
+
}
|
|
947
|
+
/** Ids are scoped to this shadow root, so a constant is unique enough — and,
|
|
948
|
+
* unlike a counter, the same on the server and the client. */
|
|
949
|
+
get _headingIdBase() {
|
|
950
|
+
return "mono-modal";
|
|
951
|
+
}
|
|
952
|
+
render() {
|
|
953
|
+
const aria = this._headingAria();
|
|
954
|
+
return html`
|
|
955
|
+
<div
|
|
956
|
+
class=${this._computeModalClasses().join(" ")}
|
|
957
|
+
mono-modal
|
|
958
|
+
${ref(this.bindRoot)}
|
|
959
|
+
role="dialog"
|
|
960
|
+
title=""
|
|
961
|
+
aria-labelledby=${ifDefined(aria.labelledby)}
|
|
962
|
+
aria-describedby=${ifDefined(aria.describedby)}
|
|
963
|
+
aria-modal=${this.overlay ? "true" : "false"}
|
|
964
|
+
aria-hidden=${this.modelValue ? "false" : "true"}
|
|
965
|
+
style=${styleMap({ "--mono-modal-z": String(this._effectiveZ) })}
|
|
966
|
+
>
|
|
967
|
+
${this._renderModalBody()}
|
|
968
|
+
</div>
|
|
969
|
+
`;
|
|
970
|
+
}
|
|
971
|
+
};
|
|
972
|
+
MonoModalShadow = __decorate([customElement("mono-shadow-modal")], MonoModalShadow);
|
|
973
|
+
//#endregion
|
|
974
|
+
//#region src/components/modal/mono-modal-controller.ts
|
|
975
|
+
/**
|
|
976
|
+
* The dialog's `<mono-modal>` defaults. `dialog.props` is merged over these; the
|
|
977
|
+
* dismissal locks are re-applied after that merge in `buildDialogElement` and
|
|
978
|
+
* cannot be turned off — a dialog is a question, and the only way past it is one
|
|
979
|
+
* of its own buttons.
|
|
980
|
+
*/
|
|
981
|
+
var DIALOG_MODAL_DEFAULTS = {
|
|
982
|
+
size: "xs",
|
|
983
|
+
color: "primary",
|
|
984
|
+
width: "fit-content",
|
|
985
|
+
minWidth: "16rem",
|
|
986
|
+
maxWidth: "min(92vw, 480px)",
|
|
987
|
+
stackable: true,
|
|
988
|
+
draggable: true,
|
|
989
|
+
cssClassName: "mono-modal-dialog"
|
|
990
|
+
};
|
|
991
|
+
/** Everything a dialog must refuse. Applied last, so `dialog.props` cannot undo it. */
|
|
992
|
+
var DIALOG_LOCKS = {
|
|
993
|
+
persistent: true,
|
|
994
|
+
dismissible: false,
|
|
995
|
+
closeOnEscape: false,
|
|
996
|
+
closeOnOverlay: false
|
|
997
|
+
};
|
|
998
|
+
/** How long a closed dialog's element lingers for the close transition (`--mono-modal-duration` is 0.22s). */
|
|
999
|
+
var DIALOG_REMOVE_DELAY = 320;
|
|
1000
|
+
/** Light tag first; the shadow build registers its own name. */
|
|
1001
|
+
var resolveTag = (light, shadow) => {
|
|
1002
|
+
if (typeof customElements === "undefined") return null;
|
|
1003
|
+
if (customElements.get(light)) return light;
|
|
1004
|
+
if (customElements.get(shadow)) return shadow;
|
|
1005
|
+
return null;
|
|
1006
|
+
};
|
|
1007
|
+
function monoModal(options = {}) {
|
|
1008
|
+
const notifier = createNotifier();
|
|
1009
|
+
const notify = notifier.notify;
|
|
1010
|
+
const elementProps = { ...options.props ?? {} };
|
|
1011
|
+
const elements = /* @__PURE__ */ new Set();
|
|
1012
|
+
let wantOpen = false;
|
|
1013
|
+
let isOpen = false;
|
|
1014
|
+
const setOpen = (next) => {
|
|
1015
|
+
wantOpen = next;
|
|
1016
|
+
for (const el of elements) if (next) el.show("manual");
|
|
1017
|
+
else el.hide("manual");
|
|
1018
|
+
if (!elements.size && isOpen !== next) {
|
|
1019
|
+
isOpen = next;
|
|
1020
|
+
notify();
|
|
1021
|
+
}
|
|
1022
|
+
};
|
|
1023
|
+
let dialogDefaults = { ...options.dialog ?? {} };
|
|
1024
|
+
let dialogEl = null;
|
|
1025
|
+
let dialogResolve = null;
|
|
1026
|
+
let dialogOpen = false;
|
|
1027
|
+
/** Resolve the pending `show()` and start the teardown. */
|
|
1028
|
+
const closeDialog = (value) => {
|
|
1029
|
+
const el = dialogEl;
|
|
1030
|
+
const resolve = dialogResolve;
|
|
1031
|
+
dialogEl = null;
|
|
1032
|
+
dialogResolve = null;
|
|
1033
|
+
dialogOpen = false;
|
|
1034
|
+
if (el) {
|
|
1035
|
+
el.hide("manual");
|
|
1036
|
+
setTimeout(() => el.remove(), DIALOG_REMOVE_DELAY);
|
|
1037
|
+
}
|
|
1038
|
+
resolve?.(value ?? false);
|
|
1039
|
+
notify();
|
|
1040
|
+
};
|
|
1041
|
+
const buildButton = (tag, item, owner) => {
|
|
1042
|
+
const el = document.createElement(tag);
|
|
1043
|
+
el.setAttribute("data-mono-dialog-button", "");
|
|
1044
|
+
if (item.className) el.className = item.className;
|
|
1045
|
+
if (item.icon) {
|
|
1046
|
+
const icon = document.createElement("span");
|
|
1047
|
+
icon.setAttribute("slot", "icon");
|
|
1048
|
+
icon.className = `mono-icon ${item.icon}`;
|
|
1049
|
+
el.appendChild(icon);
|
|
1050
|
+
}
|
|
1051
|
+
if (item.label) el.appendChild(document.createTextNode(item.label));
|
|
1052
|
+
const { label: _l, icon: _i, className: _n, onClick, value, ...rest } = item;
|
|
1053
|
+
applyProps(el, {
|
|
1054
|
+
size: "xs",
|
|
1055
|
+
...rest
|
|
1056
|
+
});
|
|
1057
|
+
el.handler = async (event) => {
|
|
1058
|
+
if (onClick) await onClick(event, {
|
|
1059
|
+
dialog,
|
|
1060
|
+
button: el
|
|
1061
|
+
});
|
|
1062
|
+
if (value !== void 0 && dialogEl && dialogEl === owner()) closeDialog(value);
|
|
1063
|
+
};
|
|
1064
|
+
el.addEventListener("mno-click", (e) => e.stopPropagation());
|
|
1065
|
+
el.addEventListener("mnoClick", (e) => e.stopPropagation());
|
|
1066
|
+
return el;
|
|
1067
|
+
};
|
|
1068
|
+
const buildDialogElement = (opts, modalTag, buttonTag) => {
|
|
1069
|
+
const el = document.createElement(modalTag);
|
|
1070
|
+
el.setAttribute("data-mono-dialog", "");
|
|
1071
|
+
const body = document.createElement("div");
|
|
1072
|
+
body.className = "mono-modal-dialog-body";
|
|
1073
|
+
if (opts.body instanceof Node) body.appendChild(opts.body);
|
|
1074
|
+
else if (opts.body != null) body.innerHTML = String(opts.body);
|
|
1075
|
+
el.appendChild(body);
|
|
1076
|
+
const buttons = opts.buttons ?? [];
|
|
1077
|
+
if (buttons.length) {
|
|
1078
|
+
const foot = document.createElement("span");
|
|
1079
|
+
foot.setAttribute("slot", "footer");
|
|
1080
|
+
foot.className = "mono-modal-dialog-actions";
|
|
1081
|
+
for (const item of buttons) foot.appendChild(buildButton(buttonTag, item, () => el));
|
|
1082
|
+
el.appendChild(foot);
|
|
1083
|
+
}
|
|
1084
|
+
applyProps(el, {
|
|
1085
|
+
...DIALOG_MODAL_DEFAULTS,
|
|
1086
|
+
...opts.props ?? {},
|
|
1087
|
+
...opts.title != null ? { title: opts.title } : {},
|
|
1088
|
+
...opts.subtitle != null ? { subtitle: opts.subtitle } : {},
|
|
1089
|
+
...DIALOG_LOCKS
|
|
1090
|
+
});
|
|
1091
|
+
return el;
|
|
1092
|
+
};
|
|
1093
|
+
const focusButton = async (el, index) => {
|
|
1094
|
+
if (index === "none") return;
|
|
1095
|
+
const i = typeof index === "number" ? index : 0;
|
|
1096
|
+
await el.updateComplete;
|
|
1097
|
+
const root = el.renderRoot;
|
|
1098
|
+
const target = el.querySelectorAll("[data-mono-dialog-button]")[i] ?? root?.querySelectorAll("[data-mono-dialog-button]")[i];
|
|
1099
|
+
if (!target) return;
|
|
1100
|
+
await target.updateComplete;
|
|
1101
|
+
await new Promise((r) => requestAnimationFrame(() => r(null)));
|
|
1102
|
+
if (dialogEl === el) target.focus?.();
|
|
1103
|
+
};
|
|
1104
|
+
const dialog = {
|
|
1105
|
+
show(override) {
|
|
1106
|
+
if (typeof document === "undefined") return Promise.reject(/* @__PURE__ */ new Error("[mono-modal] dialog.show() needs a document — call it on the client"));
|
|
1107
|
+
const modalTag = resolveTag("mono-modal", "mono-shadow-modal");
|
|
1108
|
+
const buttonTag = resolveTag("mono-button", "mono-shadow-button");
|
|
1109
|
+
if (!modalTag || !buttonTag) return Promise.reject(/* @__PURE__ */ new Error("[mono-modal] dialog.show(): <mono-modal> and <mono-button> are not registered — import '@mono-lit/helper/ui/modal' (it registers both) before showing a dialog."));
|
|
1110
|
+
if (dialogOpen) closeDialog(false);
|
|
1111
|
+
const opts = {
|
|
1112
|
+
...dialogDefaults,
|
|
1113
|
+
...override ?? {},
|
|
1114
|
+
props: {
|
|
1115
|
+
...dialogDefaults.props ?? {},
|
|
1116
|
+
...override?.props ?? {}
|
|
1117
|
+
}
|
|
1118
|
+
};
|
|
1119
|
+
const el = buildDialogElement(opts, modalTag, buttonTag);
|
|
1120
|
+
dialogEl = el;
|
|
1121
|
+
dialogOpen = true;
|
|
1122
|
+
const promise = new Promise((resolve) => {
|
|
1123
|
+
dialogResolve = resolve;
|
|
1124
|
+
});
|
|
1125
|
+
document.body.appendChild(el);
|
|
1126
|
+
el.show("manual");
|
|
1127
|
+
focusButton(el, opts.focus);
|
|
1128
|
+
notify();
|
|
1129
|
+
return promise;
|
|
1130
|
+
},
|
|
1131
|
+
close(value) {
|
|
1132
|
+
if (!dialogOpen) return;
|
|
1133
|
+
closeDialog(value);
|
|
1134
|
+
},
|
|
1135
|
+
get isOpen() {
|
|
1136
|
+
return dialogOpen;
|
|
1137
|
+
},
|
|
1138
|
+
get element() {
|
|
1139
|
+
return dialogEl;
|
|
1140
|
+
},
|
|
1141
|
+
setProps(patch) {
|
|
1142
|
+
dialogDefaults = {
|
|
1143
|
+
...dialogDefaults,
|
|
1144
|
+
...patch,
|
|
1145
|
+
props: {
|
|
1146
|
+
...dialogDefaults.props ?? {},
|
|
1147
|
+
...patch.props ?? {}
|
|
1148
|
+
}
|
|
1149
|
+
};
|
|
1150
|
+
}
|
|
1151
|
+
};
|
|
1152
|
+
return {
|
|
1153
|
+
props: () => elementProps,
|
|
1154
|
+
setProps(patch) {
|
|
1155
|
+
Object.assign(elementProps, patch);
|
|
1156
|
+
notify();
|
|
1157
|
+
},
|
|
1158
|
+
open: () => setOpen(true),
|
|
1159
|
+
close: () => setOpen(false),
|
|
1160
|
+
toggle: () => setOpen(!isOpen),
|
|
1161
|
+
get isOpen() {
|
|
1162
|
+
return isOpen;
|
|
1163
|
+
},
|
|
1164
|
+
get element() {
|
|
1165
|
+
return elements.values().next().value ?? null;
|
|
1166
|
+
},
|
|
1167
|
+
dialog,
|
|
1168
|
+
subscribe: notifier.subscribe,
|
|
1169
|
+
dispose() {
|
|
1170
|
+
if (dialogOpen) closeDialog(false);
|
|
1171
|
+
notifier.clear();
|
|
1172
|
+
elements.clear();
|
|
1173
|
+
},
|
|
1174
|
+
_register(el) {
|
|
1175
|
+
elements.add(el);
|
|
1176
|
+
if (wantOpen && !el.modelValue) el.show("manual");
|
|
1177
|
+
else if (isOpen !== el.modelValue) {
|
|
1178
|
+
isOpen = el.modelValue;
|
|
1179
|
+
notify();
|
|
1180
|
+
}
|
|
1181
|
+
},
|
|
1182
|
+
_unregister(el) {
|
|
1183
|
+
elements.delete(el);
|
|
1184
|
+
},
|
|
1185
|
+
_report(open, _source) {
|
|
1186
|
+
wantOpen = open;
|
|
1187
|
+
if (isOpen === open) return;
|
|
1188
|
+
isOpen = open;
|
|
1189
|
+
notify();
|
|
1190
|
+
}
|
|
1191
|
+
};
|
|
1192
|
+
}
|
|
1193
|
+
//#endregion
|
|
1194
|
+
export { MonoModalCore, MonoModalShadow, monoModal as controlMonoModal, monoModal };
|