@mono-lit/helper 0.0.0-stage → 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +55 -0
- package/README.md +34 -2
- 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-search-Bwo5bg8K.js +573 -0
- package/dist/data-source-controller-C50Qyfzh.js +178 -0
- package/dist/data-source-options-BTpfrOZ_.js +535 -0
- package/dist/data-source-options-CQSTZHPE.js +537 -0
- package/dist/data-source-read-CUX-lgrQ.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-BvlBx_GZ.js +2302 -0
- package/dist/export.d.ts +1 -0
- package/dist/export.js +2302 -0
- package/dist/field-icons-BoOG6KrL.js +51 -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-DjvYOL-J.js +395 -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-CoVnBLav.js +873 -0
- package/dist/mono-button.shadow-FfP_hMH4.js +784 -0
- package/dist/mono-data-chart-ChU4Ii3p.js +738 -0
- package/dist/mono-data-dropdown-BAUl58kW.js +357 -0
- package/dist/mono-data-grid-CLBK8clE.js +4140 -0
- package/dist/mono-data-grid-Db80FzdZ.js +4142 -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/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-BHsqVjRh.js +789 -0
- package/dist/reactive-D3EERqgO.js +47 -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 +74 -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 +337 -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 +258 -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 +394 -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 +84 -0
- package/dist/src/composables/element-props.d.ts +46 -0
- package/dist/src/composables/field-icons.d.ts +7 -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 +60 -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-CysgRgBi.js +760 -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 +511 -0
- package/dist/ui/chart.d.ts +1 -0
- package/dist/ui/chart.js +808 -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 +21826 -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 +995 -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 +2066 -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 +524 -0
- package/dist/ui/shadow/chart.js +1569 -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 +1193 -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 +2033 -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 +2846 -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 +2819 -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
package/dist/ui/chart.js
ADDED
|
@@ -0,0 +1,808 @@
|
|
|
1
|
+
import { f as monoPendingGrace } from "../mono-ui-CPV7rrdo.js";
|
|
2
|
+
import { n as detachEventHandlers, t as applyProps } from "../element-props-CLB6yvbm.js";
|
|
3
|
+
import { i as composeApply, n as buildChartApply, r as buildChartOdataRequest, t as monoChart } from "../mono-data-chart-ChU4Ii3p.js";
|
|
4
|
+
import { t as customElement } from "../mono-element-B0kP_96P.js";
|
|
5
|
+
import { a as defineHybridPropAliases, i as defineHybridPropAlias, o as numberStringConverter, r as booleanStringConverter, t as __decorate } from "../decorate-DEXtNagw.js";
|
|
6
|
+
import { n as toCssSize } from "../css-size-DhHSVZJK.js";
|
|
7
|
+
import { LitElement, html, isServer, nothing, unsafeCSS } from "lit";
|
|
8
|
+
import { property, query, state } from "lit/decorators.js";
|
|
9
|
+
import { styleMap } from "lit/directives/style-map.js";
|
|
10
|
+
//#region src/components/chart/chart-core.ts
|
|
11
|
+
/**
|
|
12
|
+
* The mono color names a chart accepts wherever a color is expected. They map to
|
|
13
|
+
* the `--_mono-chart-<name>` resolvers in chart.css, which chain through the
|
|
14
|
+
* public `--mono-chart-*` overrides to the Basecoat tokens — `chart-1` … `chart-5`
|
|
15
|
+
* are Basecoat's own chart palette (`--chart-1` … `--chart-5`), the roles are the
|
|
16
|
+
* page's. `surface` is internal: the hairline between slices.
|
|
17
|
+
*/
|
|
18
|
+
var MONO_COLOR_NAMES = new Set([
|
|
19
|
+
"chart-1",
|
|
20
|
+
"chart-2",
|
|
21
|
+
"chart-3",
|
|
22
|
+
"chart-4",
|
|
23
|
+
"chart-5",
|
|
24
|
+
"primary",
|
|
25
|
+
"secondary",
|
|
26
|
+
"accent",
|
|
27
|
+
"success",
|
|
28
|
+
"warning",
|
|
29
|
+
"danger",
|
|
30
|
+
"info",
|
|
31
|
+
"surface"
|
|
32
|
+
]);
|
|
33
|
+
/** Used before the element is in the DOM (SSR) or if a token resolves empty — ONE, light. */
|
|
34
|
+
var MONO_COLOR_FALLBACK = {
|
|
35
|
+
"chart-1": "oklch(0.859 0.069 267.7)",
|
|
36
|
+
"chart-2": "oklch(0.735 0.12 268.04)",
|
|
37
|
+
"chart-3": "oklch(0.61 0.12 267.95)",
|
|
38
|
+
"chart-4": "oklch(0.485 0.119 267.92)",
|
|
39
|
+
"chart-5": "oklch(0.36 0.12 268.21)",
|
|
40
|
+
primary: "oklch(0.299 0.119 267.96)",
|
|
41
|
+
secondary: "oklch(0.554 0.041 257.42)",
|
|
42
|
+
accent: "oklch(0.735 0.12 268.04)",
|
|
43
|
+
success: "oklch(0.5239 0.0917 180.004)",
|
|
44
|
+
warning: "oklch(0.5423 0.1066 70.504)",
|
|
45
|
+
danger: "oklch(0.561 0.202 26.71)",
|
|
46
|
+
info: "oklch(0.431 0.163 267.72)",
|
|
47
|
+
surface: "oklch(0.973 0.007 268.55)"
|
|
48
|
+
};
|
|
49
|
+
/** The tooltip lines come from the data (labels, formatted values) — never markup. */
|
|
50
|
+
function escapeHtml(s) {
|
|
51
|
+
return s.replace(/[&<>"']/g, (c) => ({
|
|
52
|
+
"&": "&",
|
|
53
|
+
"<": "<",
|
|
54
|
+
">": ">",
|
|
55
|
+
"\"": """,
|
|
56
|
+
"'": "'"
|
|
57
|
+
})[c]);
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Cached loader for the OPTIONAL `chart.js` peer.
|
|
61
|
+
*
|
|
62
|
+
* `chart.js/auto` self-registers every controller/scale/element — the right
|
|
63
|
+
* trade here because the library is externalized, so the consumer's bundler
|
|
64
|
+
* owns the cost and tree-shaking on our side would buy nothing.
|
|
65
|
+
*/
|
|
66
|
+
var _chartPromise = null;
|
|
67
|
+
function loadChartJs() {
|
|
68
|
+
_chartPromise ??= import("chart.js/auto").then((m) => m?.default ?? m).catch((err) => {
|
|
69
|
+
_chartPromise = null;
|
|
70
|
+
throw new Error("[mono-chart] needs the optional peer dependency \"chart.js\". Install it in your app: pnpm add chart.js@4.5.1" + (err?.message ? ` (original error: ${err.message})` : ""));
|
|
71
|
+
});
|
|
72
|
+
return _chartPromise;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* `MonoChartCore` — render-mode-agnostic logic for the chart elements.
|
|
76
|
+
*
|
|
77
|
+
* It owns the imperative Chart.js lifecycle, following the same shape as the
|
|
78
|
+
* flatpickr wrapper in `date-core.ts`: create in `firstUpdated` behind an
|
|
79
|
+
* `isServer` guard and a dynamic import, split `updated()` into a cheap data
|
|
80
|
+
* update vs a full rebuild, and destroy in `disconnectedCallback` BEFORE
|
|
81
|
+
* `super`. A `ResizeObserver` is added on top because, unlike flatpickr, a
|
|
82
|
+
* canvas needs to be told when its box changes.
|
|
83
|
+
*/
|
|
84
|
+
var MonoChartCore = (superClass) => {
|
|
85
|
+
class MonoChartCoreClass extends superClass {
|
|
86
|
+
constructor(...args) {
|
|
87
|
+
super(...args);
|
|
88
|
+
this.aspectRatio = 2;
|
|
89
|
+
this.legend = true;
|
|
90
|
+
this.title = "";
|
|
91
|
+
this.stacked = false;
|
|
92
|
+
this.cssClass = {};
|
|
93
|
+
this.cssClassName = "";
|
|
94
|
+
this._error = "";
|
|
95
|
+
this._chart = null;
|
|
96
|
+
this._buildToken = 0;
|
|
97
|
+
this._onThemeChanged = () => {
|
|
98
|
+
if (isServer || !this._chart) return;
|
|
99
|
+
requestAnimationFrame(() => {
|
|
100
|
+
if (!this._chart) return;
|
|
101
|
+
const palette = this._colors;
|
|
102
|
+
if (palette?.length) this.dataChart?.setColors(palette);
|
|
103
|
+
else this.dataChart?._setColorResolver((c) => this._resolveColor(c));
|
|
104
|
+
this.rebuild();
|
|
105
|
+
});
|
|
106
|
+
};
|
|
107
|
+
this._applyQueued = false;
|
|
108
|
+
this._externalTooltip = (context) => {
|
|
109
|
+
const el = this._tooltipEl;
|
|
110
|
+
if (!el) return;
|
|
111
|
+
const tip = context.tooltip;
|
|
112
|
+
if (!tip || tip.opacity === 0) {
|
|
113
|
+
el.removeAttribute("data-open");
|
|
114
|
+
el.setAttribute("aria-hidden", "true");
|
|
115
|
+
return;
|
|
116
|
+
}
|
|
117
|
+
const title = tip.title ?? [];
|
|
118
|
+
const bodies = (tip.body ?? []).map((b) => b.lines ?? []);
|
|
119
|
+
const colors = tip.labelColors ?? [];
|
|
120
|
+
const parts = [];
|
|
121
|
+
for (const t of title) parts.push(`<div class="mono-chart-tooltip-title">${escapeHtml(String(t))}</div>`);
|
|
122
|
+
bodies.forEach((lines, i) => {
|
|
123
|
+
const swatch = colors[i]?.backgroundColor ?? colors[i]?.borderColor;
|
|
124
|
+
for (const line of lines) {
|
|
125
|
+
const m = /^(.*?):\s*(.+)$/.exec(String(line));
|
|
126
|
+
const text = m ? `<span class="mono-chart-tooltip-label">${escapeHtml(m[1])}</span><span class="mono-chart-tooltip-value">${escapeHtml(m[2])}</span>` : `<span class="mono-chart-tooltip-label">${escapeHtml(String(line))}</span>`;
|
|
127
|
+
parts.push(`<div class="mono-chart-tooltip-row">${swatch ? `<span class="mono-chart-tooltip-swatch" style="background:${escapeHtml(String(swatch))}"></span>` : ""}${text}</div>`);
|
|
128
|
+
}
|
|
129
|
+
});
|
|
130
|
+
el.innerHTML = parts.join("");
|
|
131
|
+
const width = el.parentElement?.clientWidth ?? context.chart.width;
|
|
132
|
+
const gap = 8;
|
|
133
|
+
el.setAttribute("data-open", "");
|
|
134
|
+
el.setAttribute("aria-hidden", "false");
|
|
135
|
+
const h = el.offsetHeight;
|
|
136
|
+
const w = el.offsetWidth;
|
|
137
|
+
const side = tip.caretY - h - gap < 0 ? "bottom" : "top";
|
|
138
|
+
el.setAttribute("data-side", side);
|
|
139
|
+
const x = Math.min(Math.max(tip.caretX, w / 2), Math.max(width - w / 2, w / 2));
|
|
140
|
+
el.style.left = `${x}px`;
|
|
141
|
+
el.style.top = `${tip.caretY}px`;
|
|
142
|
+
};
|
|
143
|
+
defineHybridPropAliases(this, [
|
|
144
|
+
"dataChart",
|
|
145
|
+
"chartOptions",
|
|
146
|
+
"aspectRatio",
|
|
147
|
+
"cssClass"
|
|
148
|
+
]);
|
|
149
|
+
defineHybridPropAlias(this, "controlChart", "dataChart");
|
|
150
|
+
for (const alias of ["css-class", "cssclass"]) Object.defineProperty(this, alias, {
|
|
151
|
+
get: () => this.cssClass,
|
|
152
|
+
set: (value) => this._setCssClass(value),
|
|
153
|
+
configurable: true,
|
|
154
|
+
enumerable: false
|
|
155
|
+
});
|
|
156
|
+
}
|
|
157
|
+
static {
|
|
158
|
+
this.monoPendingAuto = "data";
|
|
159
|
+
}
|
|
160
|
+
_monoPendingReady() {
|
|
161
|
+
const ctrl = this.dataChart;
|
|
162
|
+
if (!ctrl) return this.data != null || monoPendingGrace(this);
|
|
163
|
+
if (ctrl.loading) return false;
|
|
164
|
+
return monoPendingGrace(this) || ctrl.data().datasets.length > 0;
|
|
165
|
+
}
|
|
166
|
+
static {
|
|
167
|
+
this._rebuildKeys = [
|
|
168
|
+
"type",
|
|
169
|
+
"chartOptions",
|
|
170
|
+
"legend",
|
|
171
|
+
"title",
|
|
172
|
+
"stacked",
|
|
173
|
+
"aspectRatio"
|
|
174
|
+
];
|
|
175
|
+
}
|
|
176
|
+
static get observedAttributes() {
|
|
177
|
+
return [
|
|
178
|
+
...super.observedAttributes ?? [],
|
|
179
|
+
"aspectratio",
|
|
180
|
+
"chartoptions",
|
|
181
|
+
"css-class",
|
|
182
|
+
"cssclass",
|
|
183
|
+
"colors"
|
|
184
|
+
];
|
|
185
|
+
}
|
|
186
|
+
attributeChangedCallback(name, old, value) {
|
|
187
|
+
super.attributeChangedCallback(name, old, value);
|
|
188
|
+
if (old === value) return;
|
|
189
|
+
if (name === "css-class" || name === "cssclass") this._setCssClass(value);
|
|
190
|
+
else if (name === "colors") this.colors = value ?? void 0;
|
|
191
|
+
}
|
|
192
|
+
_setCssClass(value) {
|
|
193
|
+
if (value == null) {
|
|
194
|
+
this.cssClass = {};
|
|
195
|
+
this.cssClassName = "";
|
|
196
|
+
return;
|
|
197
|
+
}
|
|
198
|
+
if (typeof value === "object") {
|
|
199
|
+
this.cssClass = value;
|
|
200
|
+
return;
|
|
201
|
+
}
|
|
202
|
+
const trimmed = String(value).trim();
|
|
203
|
+
if (!trimmed) {
|
|
204
|
+
this.cssClass = {};
|
|
205
|
+
this.cssClassName = "";
|
|
206
|
+
return;
|
|
207
|
+
}
|
|
208
|
+
if (trimmed.startsWith("{") && trimmed.endsWith("}")) try {
|
|
209
|
+
this.cssClass = JSON.parse(trimmed);
|
|
210
|
+
return;
|
|
211
|
+
} catch {}
|
|
212
|
+
this.cssClassName = trimmed;
|
|
213
|
+
}
|
|
214
|
+
/** The live chart.js instance, or null before it mounts. */
|
|
215
|
+
get chart() {
|
|
216
|
+
return this._chart;
|
|
217
|
+
}
|
|
218
|
+
connectedCallback() {
|
|
219
|
+
super.connectedCallback();
|
|
220
|
+
this._subscribe();
|
|
221
|
+
if (!isServer) {
|
|
222
|
+
window.addEventListener("theme-changed", this._onThemeChanged);
|
|
223
|
+
this._watchMode();
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
disconnectedCallback() {
|
|
227
|
+
this._off?.();
|
|
228
|
+
this._off = void 0;
|
|
229
|
+
if (!isServer) {
|
|
230
|
+
window.removeEventListener("theme-changed", this._onThemeChanged);
|
|
231
|
+
this._modeObserver?.disconnect();
|
|
232
|
+
this._modeObserver = void 0;
|
|
233
|
+
this._modeQuery?.removeEventListener("change", this._onThemeChanged);
|
|
234
|
+
this._modeQuery = void 0;
|
|
235
|
+
}
|
|
236
|
+
this._destroyChart();
|
|
237
|
+
super.disconnectedCallback();
|
|
238
|
+
}
|
|
239
|
+
/**
|
|
240
|
+
* Dark mode is the same tokens flipped by the `.dark` class on `<html>` /
|
|
241
|
+
* `<body>` (or the OS, under `color-scheme: system`) — and nothing fires
|
|
242
|
+
* `theme-changed` for that: VitePress's appearance toggle and a consumer's
|
|
243
|
+
* own switch just swap the class. Watch the class and the media query and
|
|
244
|
+
* treat a flip exactly like a theme change.
|
|
245
|
+
*/
|
|
246
|
+
_watchMode() {
|
|
247
|
+
if (typeof MutationObserver === "undefined") return;
|
|
248
|
+
let dark = document.documentElement.classList.contains("dark") || document.body?.classList.contains("dark");
|
|
249
|
+
this._modeObserver = new MutationObserver(() => {
|
|
250
|
+
const next = document.documentElement.classList.contains("dark") || document.body?.classList.contains("dark");
|
|
251
|
+
if (next === dark) return;
|
|
252
|
+
dark = next;
|
|
253
|
+
this._onThemeChanged();
|
|
254
|
+
});
|
|
255
|
+
this._modeObserver.observe(document.documentElement, {
|
|
256
|
+
attributes: true,
|
|
257
|
+
attributeFilter: ["class"]
|
|
258
|
+
});
|
|
259
|
+
if (document.body) this._modeObserver.observe(document.body, {
|
|
260
|
+
attributes: true,
|
|
261
|
+
attributeFilter: ["class"]
|
|
262
|
+
});
|
|
263
|
+
this._modeQuery = window.matchMedia?.("(prefers-color-scheme: dark)");
|
|
264
|
+
this._modeQuery?.addEventListener?.("change", this._onThemeChanged);
|
|
265
|
+
}
|
|
266
|
+
willUpdate(changed) {
|
|
267
|
+
super.willUpdate?.(changed);
|
|
268
|
+
if (changed.has("dataChart")) this._subscribe();
|
|
269
|
+
}
|
|
270
|
+
_subscribe() {
|
|
271
|
+
this._off?.();
|
|
272
|
+
detachEventHandlers(this);
|
|
273
|
+
this._off = this.dataChart?.subscribe(() => {
|
|
274
|
+
this._scheduleApplyProps();
|
|
275
|
+
this.requestUpdate();
|
|
276
|
+
});
|
|
277
|
+
if (!isServer) this.dataChart?._setColorResolver((c) => this._resolveColor(c));
|
|
278
|
+
this._scheduleApplyProps();
|
|
279
|
+
}
|
|
280
|
+
/**
|
|
281
|
+
* Drive the apply from `update()` as well as `_subscribe()` — every render
|
|
282
|
+
* reaches here, so a controller that arrives late (or a `setProps` between
|
|
283
|
+
* subscriptions) can't be missed. Same arrangement as
|
|
284
|
+
* `table-controller-core`, which documents why `_subscribe` alone is fragile.
|
|
285
|
+
*/
|
|
286
|
+
update(changed) {
|
|
287
|
+
this._scheduleApplyProps();
|
|
288
|
+
super.update(changed);
|
|
289
|
+
}
|
|
290
|
+
/**
|
|
291
|
+
* Deferred + de-duplicated: the apply writes reactive props, and doing that
|
|
292
|
+
* inside the update cycle would trip Lit's change-in-update warning.
|
|
293
|
+
*/
|
|
294
|
+
_scheduleApplyProps() {
|
|
295
|
+
if (isServer) return;
|
|
296
|
+
if (this._applyQueued) return;
|
|
297
|
+
if (typeof queueMicrotask !== "function") {
|
|
298
|
+
this._applyControllerProps();
|
|
299
|
+
return;
|
|
300
|
+
}
|
|
301
|
+
this._applyQueued = true;
|
|
302
|
+
queueMicrotask(() => {
|
|
303
|
+
this._applyQueued = false;
|
|
304
|
+
this._applyControllerProps();
|
|
305
|
+
});
|
|
306
|
+
}
|
|
307
|
+
/**
|
|
308
|
+
* Pull `controlMonoChart({ props })` onto this element, so the template needs
|
|
309
|
+
* nothing but the controller binding.
|
|
310
|
+
*
|
|
311
|
+
* The CONTROLLER WINS for keys it declares (matching `controlMonoTable` and
|
|
312
|
+
* `controlMonoForm`); keys it doesn't mention are left to whatever the
|
|
313
|
+
* template set. `applyProps` supplies the skip-undefined, read-only and
|
|
314
|
+
* equality guards. `?.props` is optional-called so a controller built before
|
|
315
|
+
* this option existed simply contributes nothing.
|
|
316
|
+
*/
|
|
317
|
+
_applyControllerProps() {
|
|
318
|
+
applyProps(this, this.dataChart?.props?.());
|
|
319
|
+
}
|
|
320
|
+
/**
|
|
321
|
+
* Effective type. A preset's locked type wins (a `<mono-chart-pie>` is a pie),
|
|
322
|
+
* then an explicit element `type`, then the controller's, then `'bar'`.
|
|
323
|
+
*/
|
|
324
|
+
get _type() {
|
|
325
|
+
return this._presetType ?? this.type ?? this.dataChart?.type ?? "bar";
|
|
326
|
+
}
|
|
327
|
+
/** Effective data: the element's raw `data` wins, else the controller's. */
|
|
328
|
+
get _data() {
|
|
329
|
+
return this.data ?? this.dataChart?.data() ?? {
|
|
330
|
+
labels: [],
|
|
331
|
+
datasets: []
|
|
332
|
+
};
|
|
333
|
+
}
|
|
334
|
+
get _loading() {
|
|
335
|
+
return !!this.dataChart?.loading;
|
|
336
|
+
}
|
|
337
|
+
get _empty() {
|
|
338
|
+
const d = this._data;
|
|
339
|
+
return !d.datasets?.length || d.datasets.every((s) => !s.data?.length);
|
|
340
|
+
}
|
|
341
|
+
/** Palette from the `colors` prop, as an array. */
|
|
342
|
+
/** The raw `colors` prop as a list, before name resolution. */
|
|
343
|
+
get _colorList() {
|
|
344
|
+
const c = this.colors;
|
|
345
|
+
if (!c) return null;
|
|
346
|
+
if (Array.isArray(c)) return c.filter(Boolean);
|
|
347
|
+
return String(c).split(",").map((s) => s.trim()).filter(Boolean);
|
|
348
|
+
}
|
|
349
|
+
/**
|
|
350
|
+
* The palette handed to Chart.js: the `colors` list if given, else the single
|
|
351
|
+
* `color` accent, else null (the controller keeps its own default).
|
|
352
|
+
* Mono color NAMES are resolved to real values here — see `_resolveColor`.
|
|
353
|
+
*/
|
|
354
|
+
get _colors() {
|
|
355
|
+
const list = this._colorList ?? (this.color ? [this.color] : null);
|
|
356
|
+
if (!list?.length) return null;
|
|
357
|
+
return list.map((c) => this._resolveColor(c));
|
|
358
|
+
}
|
|
359
|
+
/**
|
|
360
|
+
* The element's own computed style scope.
|
|
361
|
+
*
|
|
362
|
+
* Read from the inner `.mono-chart` wrapper, not the host: in the shadow
|
|
363
|
+
* build the custom properties are declared inside the shadow root, so the
|
|
364
|
+
* host would return empty strings.
|
|
365
|
+
*/
|
|
366
|
+
_styleScope() {
|
|
367
|
+
if (isServer) return null;
|
|
368
|
+
return this.renderRoot?.querySelector?.(".mono-chart") ?? this;
|
|
369
|
+
}
|
|
370
|
+
/**
|
|
371
|
+
* Turn a mono color NAME into the value the canvas needs.
|
|
372
|
+
*
|
|
373
|
+
* Chart.js paints onto a bitmap and never resolves `var()`, so `success` (or
|
|
374
|
+
* a literal `var(--x)`) would render as transparent. Names map to the
|
|
375
|
+
* component's `--_mono-chart-*` resolvers, which chain through the public
|
|
376
|
+
* `--mono-chart-*` overrides down to the Basecoat tokens — so a consumer
|
|
377
|
+
* who re-themes the app gets re-themed charts for free. Anything that isn't
|
|
378
|
+
* a known name (a hex, `rgb()`, `hsl()`) is passed through untouched.
|
|
379
|
+
*/
|
|
380
|
+
_resolveColor(value) {
|
|
381
|
+
const name = value.trim();
|
|
382
|
+
if (!MONO_COLOR_NAMES.has(name)) return name;
|
|
383
|
+
const scope = this._styleScope();
|
|
384
|
+
if (!scope) return MONO_COLOR_FALLBACK[name] ?? name;
|
|
385
|
+
const prop = name.startsWith("chart-") ? `--_mono-chart-${name.slice(6)}` : `--_mono-chart-${name}`;
|
|
386
|
+
return getComputedStyle(scope).getPropertyValue(prop).trim() || MONO_COLOR_FALLBACK[name] || name;
|
|
387
|
+
}
|
|
388
|
+
/**
|
|
389
|
+
* The inks and type Chart.js paints the chrome with — read off the element's
|
|
390
|
+
* own box, where chart.css resolved them from the Basecoat tokens: legend
|
|
391
|
+
* and title in `--foreground`, ticks in `--muted-foreground`, the grid in
|
|
392
|
+
* `--border`, the tooltip as a popover, the page font at text-xs.
|
|
393
|
+
*/
|
|
394
|
+
_themeColors() {
|
|
395
|
+
const fallback = {
|
|
396
|
+
text: "oklch(0.372 0.039 257.29)",
|
|
397
|
+
muted: "oklch(0.554 0.041 257.42)",
|
|
398
|
+
grid: "oklch(0.929 0.013 255.51)",
|
|
399
|
+
tooltipBg: "oklch(1 0 0)",
|
|
400
|
+
tooltipColor: "oklch(0.372 0.039 257.29)",
|
|
401
|
+
tooltipBorder: "oklch(0.929 0.013 255.51)",
|
|
402
|
+
fontFamily: "ui-sans-serif, system-ui, sans-serif",
|
|
403
|
+
fontSize: 12,
|
|
404
|
+
radius: 8,
|
|
405
|
+
barRadius: 8
|
|
406
|
+
};
|
|
407
|
+
const scope = this._styleScope();
|
|
408
|
+
if (!scope) return fallback;
|
|
409
|
+
const cs = getComputedStyle(scope);
|
|
410
|
+
const read = (name, fb) => cs.getPropertyValue(name).trim() || fb;
|
|
411
|
+
const px = (v, fb, min = 1) => {
|
|
412
|
+
const n = parseFloat(v);
|
|
413
|
+
return Number.isFinite(n) && n >= min ? n : fb;
|
|
414
|
+
};
|
|
415
|
+
return {
|
|
416
|
+
text: read("--_mono-chart-text", fallback.text),
|
|
417
|
+
muted: read("--_mono-chart-muted", fallback.muted),
|
|
418
|
+
grid: read("--_mono-chart-grid", fallback.grid),
|
|
419
|
+
tooltipBg: read("--_mono-chart-tooltip-bg", fallback.tooltipBg),
|
|
420
|
+
tooltipColor: read("--_mono-chart-tooltip-color", fallback.tooltipColor),
|
|
421
|
+
tooltipBorder: read("--_mono-chart-tooltip-border", fallback.tooltipBorder),
|
|
422
|
+
fontFamily: cs.fontFamily || fallback.fontFamily,
|
|
423
|
+
fontSize: px(cs.fontSize, fallback.fontSize),
|
|
424
|
+
radius: px(cs.borderTopLeftRadius, fallback.radius, 0),
|
|
425
|
+
barRadius: px(getComputedStyle(this.renderRoot?.querySelector?.(".mono-chart-canvas-wrap") ?? scope).borderTopLeftRadius, fallback.barRadius, 0)
|
|
426
|
+
};
|
|
427
|
+
}
|
|
428
|
+
/** Merge the element's presentational props with the consumer's raw options. */
|
|
429
|
+
_buildOptions() {
|
|
430
|
+
const theme = this._themeColors();
|
|
431
|
+
const legendOn = this.legend !== false && this.legend !== "false";
|
|
432
|
+
const legendPos = typeof this.legend === "string" && this.legend !== "true" ? this.legend : "top";
|
|
433
|
+
const scaled = this._type !== "pie" && this._type !== "doughnut" && this._type !== "polarArea";
|
|
434
|
+
const base = {
|
|
435
|
+
responsive: true,
|
|
436
|
+
maintainAspectRatio: !this.height,
|
|
437
|
+
aspectRatio: this.aspectRatio,
|
|
438
|
+
font: {
|
|
439
|
+
family: theme.fontFamily,
|
|
440
|
+
size: theme.fontSize
|
|
441
|
+
},
|
|
442
|
+
color: theme.text,
|
|
443
|
+
plugins: {
|
|
444
|
+
legend: {
|
|
445
|
+
display: legendOn,
|
|
446
|
+
position: legendPos,
|
|
447
|
+
labels: {
|
|
448
|
+
color: theme.text,
|
|
449
|
+
font: {
|
|
450
|
+
family: theme.fontFamily,
|
|
451
|
+
size: theme.fontSize
|
|
452
|
+
},
|
|
453
|
+
boxWidth: theme.fontSize,
|
|
454
|
+
boxHeight: theme.fontSize,
|
|
455
|
+
useBorderRadius: true,
|
|
456
|
+
borderRadius: Math.round(theme.fontSize / 4)
|
|
457
|
+
}
|
|
458
|
+
},
|
|
459
|
+
title: this.title ? {
|
|
460
|
+
display: true,
|
|
461
|
+
text: this.title,
|
|
462
|
+
color: theme.text,
|
|
463
|
+
font: {
|
|
464
|
+
family: theme.fontFamily,
|
|
465
|
+
size: theme.fontSize + 2,
|
|
466
|
+
weight: 500
|
|
467
|
+
}
|
|
468
|
+
} : { display: false },
|
|
469
|
+
tooltip: {
|
|
470
|
+
enabled: false,
|
|
471
|
+
external: this._externalTooltip,
|
|
472
|
+
backgroundColor: theme.tooltipBg,
|
|
473
|
+
titleColor: theme.tooltipColor,
|
|
474
|
+
bodyColor: theme.tooltipColor,
|
|
475
|
+
borderColor: theme.tooltipBorder,
|
|
476
|
+
borderWidth: 1,
|
|
477
|
+
cornerRadius: theme.radius,
|
|
478
|
+
padding: {
|
|
479
|
+
x: 12,
|
|
480
|
+
y: 6
|
|
481
|
+
},
|
|
482
|
+
titleFont: {
|
|
483
|
+
family: theme.fontFamily,
|
|
484
|
+
size: theme.fontSize,
|
|
485
|
+
weight: 500
|
|
486
|
+
},
|
|
487
|
+
bodyFont: {
|
|
488
|
+
family: theme.fontFamily,
|
|
489
|
+
size: theme.fontSize
|
|
490
|
+
},
|
|
491
|
+
boxPadding: 4,
|
|
492
|
+
usePointStyle: true
|
|
493
|
+
}
|
|
494
|
+
},
|
|
495
|
+
onClick: (_e, els) => {
|
|
496
|
+
const hit = els?.[0];
|
|
497
|
+
if (!hit) return;
|
|
498
|
+
this.dataChart?._emitPoint?.(hit.datasetIndex, hit.index);
|
|
499
|
+
}
|
|
500
|
+
};
|
|
501
|
+
if (scaled) {
|
|
502
|
+
base.elements = { bar: { borderRadius: theme.barRadius } };
|
|
503
|
+
base.interaction = {
|
|
504
|
+
mode: "index",
|
|
505
|
+
intersect: false
|
|
506
|
+
};
|
|
507
|
+
base.scales = {
|
|
508
|
+
x: {
|
|
509
|
+
stacked: this.stacked,
|
|
510
|
+
ticks: {
|
|
511
|
+
color: theme.muted,
|
|
512
|
+
font: {
|
|
513
|
+
family: theme.fontFamily,
|
|
514
|
+
size: theme.fontSize
|
|
515
|
+
}
|
|
516
|
+
},
|
|
517
|
+
grid: { color: theme.grid },
|
|
518
|
+
border: { color: theme.grid }
|
|
519
|
+
},
|
|
520
|
+
y: {
|
|
521
|
+
stacked: this.stacked,
|
|
522
|
+
ticks: {
|
|
523
|
+
color: theme.muted,
|
|
524
|
+
font: {
|
|
525
|
+
family: theme.fontFamily,
|
|
526
|
+
size: theme.fontSize
|
|
527
|
+
}
|
|
528
|
+
},
|
|
529
|
+
grid: { color: theme.grid },
|
|
530
|
+
border: { color: theme.grid }
|
|
531
|
+
}
|
|
532
|
+
};
|
|
533
|
+
}
|
|
534
|
+
return deepMerge(deepMerge(base, this.dataChart?.options() ?? {}), this.chartOptions ?? {});
|
|
535
|
+
}
|
|
536
|
+
async firstUpdated(changed) {
|
|
537
|
+
super.firstUpdated?.(changed);
|
|
538
|
+
if (isServer) return;
|
|
539
|
+
this.dataChart?._setColorResolver((c) => this._resolveColor(c));
|
|
540
|
+
const palette = this._colors;
|
|
541
|
+
if (palette?.length) this.dataChart?.setColors(palette);
|
|
542
|
+
this._syncTypeToController();
|
|
543
|
+
await this._createChart();
|
|
544
|
+
}
|
|
545
|
+
updated(changed) {
|
|
546
|
+
super.updated?.(changed);
|
|
547
|
+
if (isServer) return;
|
|
548
|
+
if (changed.has("colors") || changed.has("color")) {
|
|
549
|
+
const palette = this._colors;
|
|
550
|
+
if (palette?.length) this.dataChart?.setColors(palette);
|
|
551
|
+
}
|
|
552
|
+
this._syncTypeToController();
|
|
553
|
+
if (!this._chart) {
|
|
554
|
+
if (!this._error && !this._empty) this._createChart();
|
|
555
|
+
return;
|
|
556
|
+
}
|
|
557
|
+
if (MonoChartCoreClass._rebuildKeys.some((k) => changed.has(k))) {
|
|
558
|
+
this.rebuild();
|
|
559
|
+
return;
|
|
560
|
+
}
|
|
561
|
+
if (this._chart.config?.type !== this._type) {
|
|
562
|
+
this.rebuild();
|
|
563
|
+
return;
|
|
564
|
+
}
|
|
565
|
+
this._applyData();
|
|
566
|
+
}
|
|
567
|
+
/**
|
|
568
|
+
* Tell the controller which type actually won.
|
|
569
|
+
*
|
|
570
|
+
* The projection depends on it: pie-family charts colour every SLICE, bar
|
|
571
|
+
* and line colour each DATASET. A preset (`<mono-chart-pie>`) fixes its type
|
|
572
|
+
* on the element, so without this the controller would still think it was
|
|
573
|
+
* projecting for the default `bar` and every slice would come out the same
|
|
574
|
+
* colour. `setType` early-returns when unchanged, so this settles in one
|
|
575
|
+
* extra update rather than looping.
|
|
576
|
+
*
|
|
577
|
+
* NOTE: the type is controller state, so pointing a bar element and a pie
|
|
578
|
+
* element at ONE shared controller makes them fight — give each its own.
|
|
579
|
+
*/
|
|
580
|
+
_syncTypeToController() {
|
|
581
|
+
const grid = this.dataChart;
|
|
582
|
+
if (grid && grid.type !== this._type) grid.setType(this._type);
|
|
583
|
+
}
|
|
584
|
+
async _createChart() {
|
|
585
|
+
if (isServer || this._chart) return;
|
|
586
|
+
if (!this._canvas) return;
|
|
587
|
+
const token = ++this._buildToken;
|
|
588
|
+
let Chart;
|
|
589
|
+
try {
|
|
590
|
+
Chart = await loadChartJs();
|
|
591
|
+
} catch (err) {
|
|
592
|
+
this._error = err?.message ?? String(err);
|
|
593
|
+
return;
|
|
594
|
+
}
|
|
595
|
+
if (token !== this._buildToken || !this.isConnected || !this._canvas) return;
|
|
596
|
+
try {
|
|
597
|
+
this._chart = new Chart(this._canvas, {
|
|
598
|
+
type: this._type,
|
|
599
|
+
data: this._cloneData(),
|
|
600
|
+
options: this._buildOptions()
|
|
601
|
+
});
|
|
602
|
+
this._error = "";
|
|
603
|
+
this.dataChart?._attachInstance(this._chart);
|
|
604
|
+
this._observeResize();
|
|
605
|
+
} catch (err) {
|
|
606
|
+
this._error = err?.message ?? String(err);
|
|
607
|
+
}
|
|
608
|
+
}
|
|
609
|
+
/**
|
|
610
|
+
* Hand chart.js its own copy. It mutates `data` in place (adding computed
|
|
611
|
+
* metadata), so sharing the controller's projected object would corrupt it.
|
|
612
|
+
*/
|
|
613
|
+
_cloneData() {
|
|
614
|
+
const d = this._data;
|
|
615
|
+
return {
|
|
616
|
+
labels: [...d.labels ?? []],
|
|
617
|
+
datasets: (d.datasets ?? []).map((s) => ({
|
|
618
|
+
...s,
|
|
619
|
+
data: [...s.data ?? []]
|
|
620
|
+
}))
|
|
621
|
+
};
|
|
622
|
+
}
|
|
623
|
+
_applyData() {
|
|
624
|
+
if (!this._chart) return;
|
|
625
|
+
const next = this._cloneData();
|
|
626
|
+
this._chart.data.labels = next.labels;
|
|
627
|
+
this._chart.data.datasets = next.datasets;
|
|
628
|
+
this._chart.update();
|
|
629
|
+
}
|
|
630
|
+
/** Destroy + recreate. Needed for `type` and structural option changes. */
|
|
631
|
+
rebuild() {
|
|
632
|
+
if (isServer) return;
|
|
633
|
+
this._destroyChart();
|
|
634
|
+
this._createChart();
|
|
635
|
+
}
|
|
636
|
+
_destroyChart() {
|
|
637
|
+
this._buildToken++;
|
|
638
|
+
this._ro?.disconnect();
|
|
639
|
+
this._ro = void 0;
|
|
640
|
+
try {
|
|
641
|
+
this._chart?.destroy();
|
|
642
|
+
} catch {}
|
|
643
|
+
this._chart = null;
|
|
644
|
+
this.dataChart?._attachInstance(null);
|
|
645
|
+
this._tooltipEl?.removeAttribute("data-open");
|
|
646
|
+
}
|
|
647
|
+
/**
|
|
648
|
+
* Chart.js `responsive` already listens for window resizes, but not for a
|
|
649
|
+
* container that changes size on its own (a sidebar opening, a flex reflow).
|
|
650
|
+
*/
|
|
651
|
+
_observeResize() {
|
|
652
|
+
if (this._ro || typeof ResizeObserver === "undefined") return;
|
|
653
|
+
const wrap = this.renderRoot?.querySelector?.(".mono-chart-canvas-wrap");
|
|
654
|
+
if (!wrap) return;
|
|
655
|
+
this._ro = new ResizeObserver(() => this._chart?.resize());
|
|
656
|
+
this._ro.observe(wrap);
|
|
657
|
+
}
|
|
658
|
+
_cls(base, key) {
|
|
659
|
+
const extra = this.cssClass?.[key];
|
|
660
|
+
return extra ? `${base} ${extra}` : base;
|
|
661
|
+
}
|
|
662
|
+
get _rootClasses() {
|
|
663
|
+
return [
|
|
664
|
+
"mono-chart",
|
|
665
|
+
this._loading ? "loading" : "",
|
|
666
|
+
this.cssClassName,
|
|
667
|
+
this.cssClass?.root
|
|
668
|
+
].filter(Boolean).join(" ");
|
|
669
|
+
}
|
|
670
|
+
_wrapStyle() {
|
|
671
|
+
const s = {};
|
|
672
|
+
const w = toCssSize(this.width);
|
|
673
|
+
const h = toCssSize(this.height);
|
|
674
|
+
if (w) s.width = w;
|
|
675
|
+
if (h) s.height = h;
|
|
676
|
+
return s;
|
|
677
|
+
}
|
|
678
|
+
renderChart() {
|
|
679
|
+
return html`
|
|
680
|
+
<div class=${this._rootClasses}>
|
|
681
|
+
${this._error ? html`<div class=${this._cls("mono-chart-message error", "message")} role="alert">
|
|
682
|
+
${this._error}
|
|
683
|
+
</div>` : nothing}
|
|
684
|
+
<div class="mono-chart-canvas-wrap" style=${styleMap(this._wrapStyle())}>
|
|
685
|
+
<canvas class=${this._cls("", "canvas")} role="img"></canvas>
|
|
686
|
+
<div class="mono-chart-tooltip" role="tooltip" aria-hidden="true"></div>
|
|
687
|
+
</div>
|
|
688
|
+
</div>
|
|
689
|
+
`;
|
|
690
|
+
}
|
|
691
|
+
}
|
|
692
|
+
__decorate([property({ attribute: false })], MonoChartCoreClass.prototype, "dataChart", void 0);
|
|
693
|
+
__decorate([property({ type: String })], MonoChartCoreClass.prototype, "type", void 0);
|
|
694
|
+
__decorate([property({ attribute: false })], MonoChartCoreClass.prototype, "data", void 0);
|
|
695
|
+
__decorate([property({ attribute: false })], MonoChartCoreClass.prototype, "chartOptions", void 0);
|
|
696
|
+
__decorate([property({ type: String })], MonoChartCoreClass.prototype, "width", void 0);
|
|
697
|
+
__decorate([property({ type: String })], MonoChartCoreClass.prototype, "height", void 0);
|
|
698
|
+
__decorate([property({
|
|
699
|
+
attribute: "aspect-ratio",
|
|
700
|
+
converter: numberStringConverter
|
|
701
|
+
})], MonoChartCoreClass.prototype, "aspectRatio", void 0);
|
|
702
|
+
__decorate([property()], MonoChartCoreClass.prototype, "legend", void 0);
|
|
703
|
+
__decorate([property({ type: String })], MonoChartCoreClass.prototype, "title", void 0);
|
|
704
|
+
__decorate([property({ converter: booleanStringConverter })], MonoChartCoreClass.prototype, "stacked", void 0);
|
|
705
|
+
__decorate([property({ type: String })], MonoChartCoreClass.prototype, "color", void 0);
|
|
706
|
+
__decorate([property({ attribute: false })], MonoChartCoreClass.prototype, "colors", void 0);
|
|
707
|
+
__decorate([property({ attribute: false })], MonoChartCoreClass.prototype, "cssClass", void 0);
|
|
708
|
+
__decorate([property({ attribute: false })], MonoChartCoreClass.prototype, "cssClassName", void 0);
|
|
709
|
+
__decorate([state()], MonoChartCoreClass.prototype, "_error", void 0);
|
|
710
|
+
__decorate([query("canvas")], MonoChartCoreClass.prototype, "_canvas", void 0);
|
|
711
|
+
__decorate([query(".mono-chart-tooltip")], MonoChartCoreClass.prototype, "_tooltipEl", void 0);
|
|
712
|
+
return MonoChartCoreClass;
|
|
713
|
+
};
|
|
714
|
+
/** Shallow-recursive merge; arrays and non-plain values are replaced wholesale. */
|
|
715
|
+
function deepMerge(base, over) {
|
|
716
|
+
const out = { ...base };
|
|
717
|
+
for (const [k, v] of Object.entries(over)) {
|
|
718
|
+
const prev = out[k];
|
|
719
|
+
if (v && typeof v === "object" && !Array.isArray(v) && prev && typeof prev === "object" && !Array.isArray(prev)) out[k] = deepMerge(prev, v);
|
|
720
|
+
else out[k] = v;
|
|
721
|
+
}
|
|
722
|
+
return out;
|
|
723
|
+
}
|
|
724
|
+
//#endregion
|
|
725
|
+
//#region src/components/chart/chart.css?raw
|
|
726
|
+
var chart_default = "/* ============================================================================\r\n mono-chart — a Chart.js canvas driven by `monoChart(...)` (or a raw chart.js\r\n `data` object). The library is an OPTIONAL peer, loaded on demand; until it\r\n resolves the element renders an empty, correctly-sized box so nothing jumps.\r\n\r\n NOT attribute-styled, on purpose: the chart is a bitmap. This sheet declares\r\n the palette and the inks as custom properties over the Basecoat tokens, and\r\n the ELEMENT reads them back at mount (`_resolveColor`, `_themeColors`) and\r\n hands Chart.js real values — a canvas cannot resolve `var()`. The two boxes\r\n this sheet does paint (the message, the loading veil) keep their classes.\r\n\r\n Tokens (ours → Basecoat):\r\n --_mono-chart-1 … -5 ≡ --chart-1 … --chart-5 (the default palette, in that order)\r\n --_mono-chart-primary ≡ --primary\r\n --_mono-chart-secondary ≡ --muted-foreground (the \"secondary\" ink every field uses)\r\n --_mono-chart-accent ≡ --chart-2 (Basecoat's --accent is a surface, not a series colour)\r\n --_mono-chart-success/warning/danger/info ≡ --success / --warning / --destructive / --info\r\n --_mono-chart-text ≡ --foreground (legend, title)\r\n --_mono-chart-muted ≡ --muted-foreground (axis ticks, the empty message)\r\n --_mono-chart-grid ≡ --border\r\n --_mono-chart-surface ≡ --background (the hairline between slices)\r\n --_mono-chart-tooltip-* ≡ the select panel's popover: --mono-select-dropdown-{bg,color,radius,ring,shadow} → --popover … (the tooltip IS an element, painted here)\r\n --_mono-chart-font ≡ text-xs, in the page font (inherited)\r\n --_mono-chart-radius ≡ --mono-radius-md (tooltip corner, message box)\r\n --_mono-chart-bar-radius ≡ the field's corner chain (--mono-input-outline-radius → --mono-input-radius → --mono-radius-md)\r\n\r\n Every `--mono-chart-<k>` is a public override; the flavours carry nothing —\r\n the tokens they retune (border, foreground, popover, chart-n) reach the chart\r\n through these chains. Dark mode is the same tokens flipped; the element\r\n watches the mode class and repaints.\r\n ============================================================================ */\r\n\r\nmono-chart,\r\nmono-chart-bar,\r\nmono-chart-line,\r\nmono-chart-pie,\r\nmono-chart-doughnut {\r\n display: block;\r\n width: 100%;\r\n}\r\n\r\nmono-chart *,\r\nmono-chart-bar *,\r\nmono-chart-line *,\r\nmono-chart-pie *,\r\nmono-chart-doughnut * {\r\n box-sizing: border-box;\r\n}\r\n\r\n.mono-chart {\r\n position: relative;\r\n width: 100%;\r\n color: var(--_mono-chart-text);\r\n /* the canvas inherits nothing; the element READS these two off this box */\r\n font-family: var(--_mono-chart-font-family);\r\n font-size: var(--_mono-chart-font);\r\n\r\n /* Public customization API → private resolvers. The ELEMENT also reads these\r\n at mount time and hands the resolved colors to Chart.js: canvas painting\r\n can't resolve `var()`, so the palette has to cross into JS as real values. */\r\n --_mono-chart-1: var(--mono-chart-1, var(--chart-1));\r\n --_mono-chart-2: var(--mono-chart-2, var(--chart-2));\r\n --_mono-chart-3: var(--mono-chart-3, var(--chart-3));\r\n --_mono-chart-4: var(--mono-chart-4, var(--chart-4));\r\n --_mono-chart-5: var(--mono-chart-5, var(--chart-5));\r\n\r\n --_mono-chart-primary: var(--mono-chart-primary, var(--primary));\r\n --_mono-chart-secondary: var(--mono-chart-secondary, var(--muted-foreground));\r\n --_mono-chart-accent: var(--mono-chart-accent, var(--chart-2));\r\n --_mono-chart-success: var(--mono-chart-success, var(--success));\r\n --_mono-chart-warning: var(--mono-chart-warning, var(--warning));\r\n --_mono-chart-danger: var(--mono-chart-danger, var(--destructive));\r\n --_mono-chart-info: var(--mono-chart-info, var(--info));\r\n\r\n --_mono-chart-text: var(--mono-chart-text, var(--foreground));\r\n --_mono-chart-muted: var(--mono-chart-muted, var(--muted-foreground));\r\n --_mono-chart-grid: var(--mono-chart-grid, var(--border));\r\n --_mono-chart-surface: var(--mono-chart-surface, var(--background));\r\n\r\n /* basecoat@1.0.2 styles/vega.css .combobox [data-popover] — bg-popover text-popover-foreground ring-foreground/10 rounded-md shadow-md ring-1\r\n (a tooltip is a popover: the same chrome, at text-xs). It is the FLAVOUR's\r\n popover: the corner, ring and shadow read the select panel's public knobs,\r\n which every flavour writes (luma 3xl + shadow-lg, lyra 0, maia 2xl …). */\r\n --_mono-chart-tooltip-bg: var(--mono-chart-tooltip-bg, var(--mono-select-dropdown-bg, var(--popover)));\r\n --_mono-chart-tooltip-color: var(--mono-chart-tooltip-color, var(--mono-select-dropdown-color, var(--popover-foreground)));\r\n --_mono-chart-tooltip-border: var(--mono-chart-tooltip-border, var(--border));\r\n --_mono-chart-tooltip-radius: var(--mono-chart-tooltip-radius, var(--mono-select-dropdown-radius, var(--mono-radius-md)));\r\n --_mono-chart-tooltip-ring: var(--mono-chart-tooltip-ring, var(--mono-select-dropdown-ring, 0 0 0 1px color-mix(in oklab, var(--foreground) 10%, transparent)));\r\n --_mono-chart-tooltip-shadow: var(--mono-chart-tooltip-shadow, var(--mono-select-dropdown-shadow, var(--mono-shadow-md)));\r\n\r\n --_mono-chart-font: var(--mono-chart-font, var(--mono-text-xs));\r\n /* INHERIT, not --font-sans: every other mono control inherits the page font\r\n for its labels, and a chart sits among them */\r\n --_mono-chart-font-family: var(--mono-chart-font-family, inherit);\r\n --_mono-chart-radius: var(--mono-chart-radius, var(--mono-radius-md));\r\n /* The bars' corner IS the flavour's field corner — lyra squares a field through\r\n `--mono-input-radius`, sera through `--mono-input-outline-radius`, maia and\r\n luma pill it through the same knob — so bars are square where the fields are\r\n and round where they are, with nothing set. Chart.js clamps it to half a bar. */\r\n --_mono-chart-bar-radius: var(--mono-chart-bar-radius, var(--mono-input-outline-radius, var(--mono-input-radius, var(--mono-radius-md))));\r\n\r\n /* Chart.js wants PIXELS and a custom property's computed value is still the\r\n token string (`calc(…)`, `2rem`), so the two radii are painted onto real,\r\n invisible border-radius properties here and read back computed. */\r\n border-radius: var(--_mono-chart-radius);\r\n}\r\n\r\n/* The canvas box. Chart.js sets the canvas' intrinsic width/height itself; this\r\n wrapper owns the LAYOUT size so `responsive: true` has something to measure. */\r\n.mono-chart-canvas-wrap {\r\n position: relative;\r\n width: 100%;\r\n /* the bar corner, in px — see the root */\r\n border-radius: var(--_mono-chart-bar-radius);\r\n}\r\n\r\n.mono-chart canvas {\r\n display: block;\r\n width: 100%;\r\n max-width: 100%;\r\n}\r\n\r\n/* The tooltip — an HTML popover placed over the canvas by the element\r\n (Chart.js's `tooltip.external`), not the bitmap one: a canvas can take a\r\n colour and a corner, not the flavour's ring and shadow. Positioned from the\r\n caret; `data-side` says which way it opened. */\r\n.mono-chart-tooltip {\r\n position: absolute;\r\n left: 0;\r\n top: 0;\r\n z-index: 2;\r\n display: none;\r\n flex-direction: column;\r\n gap: calc(var(--mono-spacing) * 0.5);\r\n /* basecoat@1.0.2 styles/vega.css .combobox [data-popover] — bg-popover text-popover-foreground ring-foreground/10 rounded-md shadow-md ring-1; px-3 py-1.5 text-xs */\r\n padding: calc(var(--mono-spacing) * 1.5) calc(var(--mono-spacing) * 3);\r\n border-radius: var(--_mono-chart-tooltip-radius);\r\n background: var(--_mono-chart-tooltip-bg);\r\n color: var(--_mono-chart-tooltip-color);\r\n box-shadow: var(--_mono-chart-tooltip-ring), var(--_mono-chart-tooltip-shadow);\r\n font-size: var(--_mono-chart-font);\r\n line-height: var(--mono-text-xs--lh);\r\n white-space: nowrap;\r\n pointer-events: none;\r\n transform: translate(-50%, calc(-100% - calc(var(--mono-spacing) * 2)));\r\n opacity: 0;\r\n transition: opacity var(--mono-duration-fast, 100ms) var(--mono-ease);\r\n}\r\n\r\n.mono-chart-tooltip[data-open] {\r\n display: flex;\r\n opacity: 1;\r\n}\r\n\r\n/* no room above the point: open below it */\r\n.mono-chart-tooltip[data-side='bottom'] {\r\n transform: translate(-50%, calc(var(--mono-spacing) * 2));\r\n}\r\n\r\n.mono-chart-tooltip-title {\r\n font-weight: var(--mono-font-weight-medium);\r\n}\r\n\r\n.mono-chart-tooltip-row {\r\n display: flex;\r\n align-items: center;\r\n gap: calc(var(--mono-spacing) * 2);\r\n}\r\n\r\n/* the series swatch — a rounded chip, like the legend's */\r\n.mono-chart-tooltip-swatch {\r\n flex: 0 0 auto;\r\n width: calc(var(--mono-spacing) * 2.5);\r\n height: calc(var(--mono-spacing) * 2.5);\r\n border-radius: var(--mono-radius-sm);\r\n}\r\n\r\n.mono-chart-tooltip-value {\r\n margin-inline-start: auto;\r\n font-variant-numeric: tabular-nums;\r\n padding-inline-start: calc(var(--mono-spacing) * 3);\r\n}\r\n\r\n@media (prefers-reduced-motion: reduce) {\r\n .mono-chart-tooltip {\r\n transition: none;\r\n }\r\n}\r\n\r\n/* Shown while the optional peer loads, when there is no data, or on error —\r\n basecoat's empty-state idiom: a dashed hairline, muted text. */\r\n.mono-chart-message {\r\n display: flex;\r\n align-items: center;\r\n justify-content: center;\r\n min-height: 6rem;\r\n padding: calc(var(--mono-spacing) * 4);\r\n font-size: var(--mono-text-sm);\r\n line-height: var(--mono-text-sm--lh);\r\n color: var(--_mono-chart-muted);\r\n text-align: center;\r\n border: var(--mono-border-width) dashed var(--_mono-chart-grid);\r\n border-radius: var(--_mono-chart-radius);\r\n}\r\n\r\n.mono-chart-message.error {\r\n color: var(--_mono-chart-danger);\r\n border-color: color-mix(in oklab, var(--_mono-chart-danger) 45%, var(--_mono-chart-grid));\r\n}\r\n\r\n/* Loading veil — the canvas stays mounted so Chart.js keeps its size. */\r\n.mono-chart.loading .mono-chart-canvas-wrap {\r\n opacity: 0.55;\r\n transition: opacity var(--mono-duration) var(--mono-ease);\r\n}\r\n\r\n@media (prefers-reduced-motion: reduce) {\r\n .mono-chart.loading .mono-chart-canvas-wrap {\r\n transition: none;\r\n }\r\n}\r\n";
|
|
727
|
+
//#endregion
|
|
728
|
+
//#region src/components/chart/mono-chart.ts
|
|
729
|
+
var MonoChart = class MonoChart extends MonoChartCore(LitElement) {
|
|
730
|
+
static {
|
|
731
|
+
this.styles = [unsafeCSS(chart_default)];
|
|
732
|
+
}
|
|
733
|
+
createRenderRoot() {
|
|
734
|
+
return this;
|
|
735
|
+
}
|
|
736
|
+
render() {
|
|
737
|
+
return this.renderChart();
|
|
738
|
+
}
|
|
739
|
+
};
|
|
740
|
+
MonoChart = __decorate([customElement("mono-chart")], MonoChart);
|
|
741
|
+
//#endregion
|
|
742
|
+
//#region src/components/chart/mono-chart-presets.ts
|
|
743
|
+
var MonoChartBar = class MonoChartBar extends MonoChartCore(LitElement) {
|
|
744
|
+
constructor(..._args) {
|
|
745
|
+
super(..._args);
|
|
746
|
+
this._presetType = "bar";
|
|
747
|
+
}
|
|
748
|
+
static {
|
|
749
|
+
this.styles = [unsafeCSS(chart_default)];
|
|
750
|
+
}
|
|
751
|
+
createRenderRoot() {
|
|
752
|
+
return this;
|
|
753
|
+
}
|
|
754
|
+
render() {
|
|
755
|
+
return this.renderChart();
|
|
756
|
+
}
|
|
757
|
+
};
|
|
758
|
+
MonoChartBar = __decorate([customElement("mono-chart-bar")], MonoChartBar);
|
|
759
|
+
var MonoChartLine = class MonoChartLine extends MonoChartCore(LitElement) {
|
|
760
|
+
constructor(..._args2) {
|
|
761
|
+
super(..._args2);
|
|
762
|
+
this._presetType = "line";
|
|
763
|
+
}
|
|
764
|
+
static {
|
|
765
|
+
this.styles = [unsafeCSS(chart_default)];
|
|
766
|
+
}
|
|
767
|
+
createRenderRoot() {
|
|
768
|
+
return this;
|
|
769
|
+
}
|
|
770
|
+
render() {
|
|
771
|
+
return this.renderChart();
|
|
772
|
+
}
|
|
773
|
+
};
|
|
774
|
+
MonoChartLine = __decorate([customElement("mono-chart-line")], MonoChartLine);
|
|
775
|
+
var MonoChartPie = class MonoChartPie extends MonoChartCore(LitElement) {
|
|
776
|
+
constructor(..._args3) {
|
|
777
|
+
super(..._args3);
|
|
778
|
+
this._presetType = "pie";
|
|
779
|
+
}
|
|
780
|
+
static {
|
|
781
|
+
this.styles = [unsafeCSS(chart_default)];
|
|
782
|
+
}
|
|
783
|
+
createRenderRoot() {
|
|
784
|
+
return this;
|
|
785
|
+
}
|
|
786
|
+
render() {
|
|
787
|
+
return this.renderChart();
|
|
788
|
+
}
|
|
789
|
+
};
|
|
790
|
+
MonoChartPie = __decorate([customElement("mono-chart-pie")], MonoChartPie);
|
|
791
|
+
var MonoChartDoughnut = class MonoChartDoughnut extends MonoChartCore(LitElement) {
|
|
792
|
+
constructor(..._args4) {
|
|
793
|
+
super(..._args4);
|
|
794
|
+
this._presetType = "doughnut";
|
|
795
|
+
}
|
|
796
|
+
static {
|
|
797
|
+
this.styles = [unsafeCSS(chart_default)];
|
|
798
|
+
}
|
|
799
|
+
createRenderRoot() {
|
|
800
|
+
return this;
|
|
801
|
+
}
|
|
802
|
+
render() {
|
|
803
|
+
return this.renderChart();
|
|
804
|
+
}
|
|
805
|
+
};
|
|
806
|
+
MonoChartDoughnut = __decorate([customElement("mono-chart-doughnut")], MonoChartDoughnut);
|
|
807
|
+
//#endregion
|
|
808
|
+
export { MonoChart, MonoChartBar, MonoChartCore, MonoChartDoughnut, MonoChartLine, MonoChartPie, buildChartApply, buildChartOdataRequest, composeApply, monoChart as controlMonoChart, monoChart, loadChartJs };
|