yuyeon 0.0.0 → 0.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/style.css +1 -0
- package/dist/yuyeon.mjs +3607 -0
- package/dist/yuyeon.umd.js +1 -0
- package/lib/components/app/YApp.mjs +30 -0
- package/lib/components/app/YApp.mjs.map +1 -0
- package/lib/components/app/YApp.scss +14 -0
- package/lib/components/app/index.mjs +2 -0
- package/lib/components/app/index.mjs.map +1 -0
- package/lib/components/bench/YBench.mjs +44 -0
- package/lib/components/bench/YBench.mjs.map +1 -0
- package/lib/components/bench/index.mjs +2 -0
- package/lib/components/bench/index.mjs.map +1 -0
- package/lib/components/button/YButton.mjs +138 -0
- package/lib/components/button/YButton.mjs.map +1 -0
- package/{src/components/button/y-btn.scss → lib/components/button/YButton.scss} +67 -29
- package/lib/components/button/index.mjs +2 -0
- package/lib/components/button/index.mjs.map +1 -0
- package/lib/components/card/YCard.mjs +18 -0
- package/lib/components/card/YCard.mjs.map +1 -0
- package/lib/components/card/YCardBody.mjs +10 -0
- package/lib/components/card/YCardBody.mjs.map +1 -0
- package/lib/components/card/YCardFooter.mjs +10 -0
- package/lib/components/card/YCardFooter.mjs.map +1 -0
- package/lib/components/card/YCardHeader.mjs +10 -0
- package/lib/components/card/YCardHeader.mjs.map +1 -0
- package/lib/components/card/index.mjs +6 -0
- package/lib/components/card/index.mjs.map +1 -0
- package/lib/components/checkbox/YCheckbox.mjs +154 -0
- package/lib/components/checkbox/YCheckbox.mjs.map +1 -0
- package/lib/components/checkbox/YInputCheckbox.mjs +113 -0
- package/lib/components/checkbox/YInputCheckbox.mjs.map +1 -0
- package/{src/components/checkbox/y-input-checkbox.scss → lib/components/checkbox/YInputCheckbox.scss} +19 -19
- package/lib/components/checkbox/index.mjs +5 -0
- package/lib/components/checkbox/index.mjs.map +1 -0
- package/{src/components/chip/y-chip.vue → lib/components/chip/YChip.mjs} +26 -27
- package/lib/components/chip/YChip.mjs.map +1 -0
- package/{src/components/chip/y-chip.scss → lib/components/chip/YChip.scss} +0 -4
- package/lib/components/chip/index.mjs +3 -0
- package/lib/components/chip/index.mjs.map +1 -0
- package/lib/components/dialog/YDialog.mjs +97 -0
- package/lib/components/dialog/YDialog.mjs.map +1 -0
- package/lib/components/dialog/index.mjs +2 -0
- package/lib/components/dialog/index.mjs.map +1 -0
- package/lib/components/field-input/YFieldInput.mjs +218 -0
- package/lib/components/field-input/YFieldInput.mjs.map +1 -0
- package/{src/components/field-input/y-field-input.scss → lib/components/field-input/YFieldInput.scss} +2 -4
- package/lib/components/field-input/index.mjs +2 -0
- package/lib/components/field-input/index.mjs.map +1 -0
- package/lib/components/form/YForm.mjs +79 -0
- package/lib/components/form/YForm.mjs.map +1 -0
- package/lib/components/form/index.mjs +4 -0
- package/lib/components/form/index.mjs.map +1 -0
- package/lib/components/icons/YIconCheckbox.mjs +21 -0
- package/lib/components/icons/YIconCheckbox.mjs.map +1 -0
- package/lib/components/icons/YIconClear.mjs +16 -0
- package/lib/components/icons/YIconClear.mjs.map +1 -0
- package/lib/components/icons/YIconExpand.mjs +20 -0
- package/lib/components/icons/YIconExpand.mjs.map +1 -0
- package/lib/components/icons/index.mjs +4 -0
- package/lib/components/icons/index.mjs.map +1 -0
- package/lib/components/index.mjs +24 -0
- package/lib/components/index.mjs.map +1 -0
- package/lib/components/input/YInput.mjs +346 -0
- package/lib/components/input/YInput.mjs.map +1 -0
- package/{src/components/input/y-input.scss → lib/components/input/YInput.scss} +12 -4
- package/lib/components/input/index.mjs +2 -0
- package/lib/components/input/index.mjs.map +1 -0
- package/lib/components/input/index.scss +2 -0
- package/lib/components/layer/YLayer.mjs +193 -0
- package/lib/components/layer/YLayer.mjs.map +1 -0
- package/lib/components/layer/index.mjs +2 -0
- package/lib/components/layer/index.mjs.map +1 -0
- package/lib/components/layer/scroll-strategies.mjs +132 -0
- package/lib/components/layer/scroll-strategies.mjs.map +1 -0
- package/lib/components/list/YList.mjs +16 -0
- package/lib/components/list/YList.mjs.map +1 -0
- package/lib/components/list/YList.scss +3 -0
- package/lib/components/list/YListItem.mjs +37 -0
- package/lib/components/list/YListItem.mjs.map +1 -0
- package/lib/components/list/YListItem.scss +59 -0
- package/lib/components/list/index.mjs +3 -0
- package/lib/components/list/index.mjs.map +1 -0
- package/lib/components/loading/YSpinnerRing.mjs +25 -0
- package/lib/components/loading/YSpinnerRing.mjs.map +1 -0
- package/{src/components/ring-spinner/y-ring-spinner.scss → lib/components/loading/YSpinnerRing.scss} +3 -3
- package/lib/components/loading/index.mjs +2 -0
- package/lib/components/loading/index.mjs.map +1 -0
- package/lib/components/menu/YMenu.mjs +239 -0
- package/lib/components/menu/YMenu.mjs.map +1 -0
- package/lib/components/menu/YMenu.scss +7 -0
- package/lib/components/menu/index.mjs +2 -0
- package/lib/components/menu/index.mjs.map +1 -0
- package/lib/components/navigation/YNavigation.mjs +17 -0
- package/lib/components/navigation/YNavigation.mjs.map +1 -0
- package/lib/components/navigation/index.mjs +2 -0
- package/lib/components/navigation/index.mjs.map +1 -0
- package/lib/components/pagination/YPagination.mjs +61 -0
- package/lib/components/pagination/YPagination.mjs.map +1 -0
- package/lib/components/pagination/YPagination.scss +5 -0
- package/lib/components/pagination/index.mjs +2 -0
- package/lib/components/pagination/index.mjs.map +1 -0
- package/lib/components/panel/YDividePanel.mjs +89 -0
- package/lib/components/panel/YDividePanel.mjs.map +1 -0
- package/lib/components/panel/YDividePanel.scss +43 -0
- package/lib/components/panel/index.mjs +2 -0
- package/lib/components/panel/index.mjs.map +1 -0
- package/lib/components/plate/YPlate.mjs +27 -0
- package/lib/components/plate/YPlate.mjs.map +1 -0
- package/lib/components/plate/YPlate.scss +9 -0
- package/lib/components/plate/index.mjs +2 -0
- package/lib/components/plate/index.mjs.map +1 -0
- package/lib/components/progress-bar/YProgressBar.mjs +110 -0
- package/lib/components/progress-bar/YProgressBar.mjs.map +1 -0
- package/lib/components/progress-bar/YProgressBar.scss +40 -0
- package/lib/components/progress-bar/index.mjs +2 -0
- package/lib/components/progress-bar/index.mjs.map +1 -0
- package/lib/components/snackbar/YSnackbar.mjs +187 -0
- package/lib/components/snackbar/YSnackbar.mjs.map +1 -0
- package/lib/components/snackbar/YSnackbar.scss +38 -0
- package/lib/components/snackbar/index.mjs +2 -0
- package/lib/components/snackbar/index.mjs.map +1 -0
- package/lib/components/switch/YSwitch.mjs +228 -0
- package/lib/components/switch/YSwitch.mjs.map +1 -0
- package/{src/components/switch/y-switch.scss → lib/components/switch/YSwitch.scss} +18 -26
- package/lib/components/switch/index.mjs +2 -0
- package/lib/components/switch/index.mjs.map +1 -0
- package/lib/components/table/YDataTable.mjs +46 -0
- package/lib/components/table/YDataTable.mjs.map +1 -0
- package/lib/components/table/YDataTableBody.mjs +12 -0
- package/lib/components/table/YDataTableBody.mjs.map +1 -0
- package/lib/components/table/YDataTableCell.mjs +55 -0
- package/lib/components/table/YDataTableCell.mjs.map +1 -0
- package/lib/components/table/YDataTableControl.mjs +37 -0
- package/lib/components/table/YDataTableControl.mjs.map +1 -0
- package/lib/components/table/YDataTableControl.scss +6 -0
- package/lib/components/table/YDataTableHead.mjs +12 -0
- package/lib/components/table/YDataTableHead.mjs.map +1 -0
- package/lib/components/table/YDataTableLayer.mjs +14 -0
- package/lib/components/table/YDataTableLayer.mjs.map +1 -0
- package/lib/components/table/YDataTableRow.mjs +12 -0
- package/lib/components/table/YDataTableRow.mjs.map +1 -0
- package/lib/components/table/YDataTableServer.mjs +54 -0
- package/lib/components/table/YDataTableServer.mjs.map +1 -0
- package/lib/components/table/YTable.mjs +53 -0
- package/lib/components/table/YTable.mjs.map +1 -0
- package/lib/components/table/YTable.scss +61 -0
- package/lib/components/table/index.mjs +4 -0
- package/lib/components/table/index.mjs.map +1 -0
- package/lib/components/table/pagination.mjs +21 -0
- package/lib/components/table/pagination.mjs.map +1 -0
- package/lib/components/text-highlighter/YTextHighlighter.mjs +94 -0
- package/lib/components/text-highlighter/YTextHighlighter.mjs.map +1 -0
- package/lib/components/text-highlighter/index.mjs +3 -0
- package/lib/components/text-highlighter/index.mjs.map +1 -0
- package/lib/components/tooltip/YTooltip.mjs +209 -0
- package/lib/components/tooltip/YTooltip.mjs.map +1 -0
- package/lib/components/tooltip/YTooltip.scss +19 -0
- package/lib/components/tooltip/index.mjs +2 -0
- package/lib/components/tooltip/index.mjs.map +1 -0
- package/lib/components/transitions/expand-transition.mjs +88 -0
- package/lib/components/transitions/expand-transition.mjs.map +1 -0
- package/lib/components/transitions/index.mjs +4 -0
- package/lib/components/transitions/index.mjs.map +1 -0
- package/lib/components/tree-view/YTreeView.mjs +92 -0
- package/lib/components/tree-view/YTreeView.mjs.map +1 -0
- package/lib/components/tree-view/YTreeView.scss +46 -0
- package/lib/components/tree-view/YTreeViewNode.mjs +122 -0
- package/lib/components/tree-view/YTreeViewNode.mjs.map +1 -0
- package/lib/components/tree-view/index.mjs +3 -0
- package/lib/components/tree-view/index.mjs.map +1 -0
- package/lib/composables/collections.mjs +2 -0
- package/lib/composables/collections.mjs.map +1 -0
- package/lib/composables/communication.mjs +46 -0
- package/lib/composables/communication.mjs.map +1 -0
- package/lib/composables/component.mjs +8 -0
- package/lib/composables/component.mjs.map +1 -0
- package/{src/composables/layer-group.ts → lib/composables/layer-group.mjs} +8 -10
- package/lib/composables/layer-group.mjs.map +1 -0
- package/lib/composables/layout.mjs +13 -0
- package/lib/composables/layout.mjs.map +1 -0
- package/lib/composables/levitation.mjs +135 -0
- package/lib/composables/levitation.mjs.map +1 -0
- package/{src/composables/progress.ts → lib/composables/progress.mjs} +6 -5
- package/lib/composables/progress.mjs.map +1 -0
- package/lib/composables/resize-observer.mjs +34 -0
- package/lib/composables/resize-observer.mjs.map +1 -0
- package/lib/composables/scope.mjs +27 -0
- package/lib/composables/scope.mjs.map +1 -0
- package/lib/composables/theme/index.mjs +49 -0
- package/lib/composables/theme/index.mjs.map +1 -0
- package/lib/composables/theme/setting.mjs +46 -0
- package/lib/composables/theme/setting.mjs.map +1 -0
- package/lib/composables/timing.mjs +77 -0
- package/lib/composables/timing.mjs.map +1 -0
- package/lib/composables/transition.mjs +50 -0
- package/lib/composables/transition.mjs.map +1 -0
- package/lib/directives/complement-click/index.mjs +78 -0
- package/lib/directives/complement-click/index.mjs.map +1 -0
- package/{src/directives/plate-wave/index.ts → lib/directives/plate-wave/index.mjs} +25 -42
- package/lib/directives/plate-wave/index.mjs.map +1 -0
- package/{src → lib}/directives/plate-wave/plate-wave.scss +1 -1
- package/lib/directives/theme-class.mjs +24 -0
- package/lib/directives/theme-class.mjs.map +1 -0
- package/lib/etc/index.mjs +6 -0
- package/lib/etc/index.mjs.map +1 -0
- package/lib/index.mjs +55 -0
- package/lib/index.mjs.map +1 -0
- package/{src/mixins/di.ts → lib/mixins/di.mjs} +7 -8
- package/lib/mixins/di.mjs.map +1 -0
- package/{src/mixins/rebind-attrs.ts → lib/mixins/rebind-attrs.mjs} +9 -8
- package/lib/mixins/rebind-attrs.mjs.map +1 -0
- package/{src/styles/palette.scss → lib/styles/_palette.scss} +0 -4
- package/lib/styles/base.scss +95 -0
- package/lib/styles/settings/_variables.scss +14 -0
- package/lib/styles/settings/provided.scss +35 -0
- package/lib/styles/theme/dark.scss +21 -0
- package/{src → lib}/styles/theme/index.scss +0 -3
- package/lib/styles/theme/light.scss +21 -0
- package/lib/util/FrameScheduler.mjs +29 -0
- package/lib/util/FrameScheduler.mjs.map +1 -0
- package/lib/util/Rect.mjs +27 -0
- package/lib/util/Rect.mjs.map +1 -0
- package/lib/util/common.mjs +66 -0
- package/lib/util/common.mjs.map +1 -0
- package/lib/util/dom.mjs +8 -0
- package/lib/util/dom.mjs.map +1 -0
- package/lib/util/scroll.mjs +28 -0
- package/lib/util/scroll.mjs.map +1 -0
- package/lib/util/string.mjs +33 -0
- package/lib/util/string.mjs.map +1 -0
- package/lib/util/ui.mjs +83 -0
- package/lib/util/ui.mjs.map +1 -0
- package/lib/util/validation.mjs +5 -0
- package/lib/util/validation.mjs.map +1 -0
- package/lib/util/vue-component.mjs +64 -0
- package/lib/util/vue-component.mjs.map +1 -0
- package/package.json +62 -22
- package/types/components/app/YApp.d.ts +7 -0
- package/types/components/app/index.d.ts +1 -0
- package/types/components/button/YButton.d.ts +122 -0
- package/types/components/button/index.d.ts +1 -0
- package/types/components/card/YCard.d.ts +11 -0
- package/types/components/card/YCardBody.d.ts +2 -0
- package/types/components/card/YCardFooter.d.ts +2 -0
- package/types/components/card/YCardHeader.d.ts +2 -0
- package/types/components/card/index.d.ts +5 -0
- package/types/components/checkbox/YCheckbox.d.ts +46 -0
- package/types/components/checkbox/YInputCheckbox.d.ts +42 -0
- package/types/components/checkbox/index.d.ts +4 -0
- package/types/components/chip/YChip.d.ts +34 -0
- package/types/components/chip/index.d.ts +2 -0
- package/types/components/dialog/YDialog.d.ts +120 -0
- package/types/components/dialog/index.d.ts +1 -0
- package/types/components/field-input/YFieldInput.d.ts +118 -0
- package/types/components/field-input/index.d.ts +1 -0
- package/types/components/form/YForm.d.ts +32 -0
- package/types/components/form/index.d.ts +3 -0
- package/types/components/icons/YIconCheckbox.d.ts +1 -0
- package/types/components/icons/YIconClear.d.ts +1 -0
- package/types/components/icons/YIconExpand.d.ts +1 -0
- package/types/components/icons/index.d.ts +3 -0
- package/types/components/index.d.ts +23 -0
- package/types/components/input/YInput.d.ts +166 -0
- package/types/components/input/index.d.ts +1 -0
- package/types/components/layer/YLayer.d.ts +99 -0
- package/types/components/layer/index.d.ts +1 -0
- package/types/components/list/YList.d.ts +2 -0
- package/types/components/list/YListItem.d.ts +28 -0
- package/types/components/list/index.d.ts +2 -0
- package/types/components/loading/YSpinnerRing.d.ts +1 -0
- package/types/components/loading/index.d.ts +1 -0
- package/types/components/menu/YMenu.d.ts +236 -0
- package/types/components/menu/index.d.ts +1 -0
- package/types/components/pagination/YPagination.d.ts +106 -0
- package/types/components/pagination/index.d.ts +1 -0
- package/types/components/panel/YDividePanel.d.ts +3 -0
- package/types/components/panel/index.d.ts +1 -0
- package/types/components/plate/YPlate.d.ts +10 -0
- package/types/components/plate/index.d.ts +1 -0
- package/types/components/progress-bar/YProgressBar.d.ts +59 -0
- package/types/components/progress-bar/index.d.ts +1 -0
- package/types/components/snackbar/YSnackbar.d.ts +77 -0
- package/types/components/snackbar/index.d.ts +1 -0
- package/types/components/switch/YSwitch.d.ts +106 -0
- package/types/components/switch/index.d.ts +1 -0
- package/types/components/table/YDataTable.d.ts +63 -0
- package/types/components/table/YDataTableBody.d.ts +2 -0
- package/types/components/table/YDataTableControl.d.ts +2 -0
- package/types/components/table/YDataTableHead.d.ts +2 -0
- package/types/components/table/YDataTableLayer.d.ts +2 -0
- package/types/components/table/YDataTableServer.d.ts +82 -0
- package/types/components/table/YTable.d.ts +32 -0
- package/types/components/table/index.d.ts +3 -0
- package/types/components/table/pagination.d.ts +38 -0
- package/types/components/tooltip/YTooltip.d.ts +188 -0
- package/types/components/tooltip/index.d.ts +1 -0
- package/types/components/transitions/expand-transition.d.ts +16 -0
- package/types/components/transitions/index.d.ts +32 -0
- package/types/components/tree-view/YTreeView.d.ts +37 -0
- package/types/components/tree-view/YTreeViewNode.d.ts +51 -0
- package/types/components/tree-view/index.d.ts +2 -0
- package/types/composables/communication.d.ts +1 -0
- package/types/composables/component.d.ts +2 -0
- package/types/composables/layer-group.d.ts +5 -0
- package/types/composables/progress.d.ts +3 -0
- package/types/composables/resize-observer.d.ts +14 -0
- package/types/composables/scope.d.ts +2 -0
- package/types/composables/theme/index.d.ts +15 -0
- package/types/composables/theme/setting.d.ts +12 -0
- package/types/composables/timing.d.ts +15 -0
- package/types/composables/transition.d.ts +21 -0
- package/types/directives/complement-click/index.d.ts +25 -0
- package/types/directives/plate-wave/index.d.ts +13 -0
- package/types/directives/theme-class.d.ts +3 -0
- package/types/etc/index.d.ts +1 -0
- package/types/globals.d.ts +11 -0
- package/types/index.d.ts +9 -0
- package/types/mixins/di.d.ts +2 -0
- package/types/mixins/rebind-attrs.d.ts +5 -0
- package/types/shims.d.ts +71 -0
- package/types/util/common.d.ts +8 -0
- package/types/util/dom.d.ts +1 -0
- package/types/util/string.d.ts +3 -0
- package/types/util/ui.d.ts +9 -0
- package/types/util/vue-component.d.ts +33 -0
- package/types/vite-env.d.ts +1 -0
- package/src/components/button/index.ts +0 -3
- package/src/components/button/y-btn.ts +0 -104
- package/src/components/card/index.ts +0 -6
- package/src/components/card/y-card-body.ts +0 -8
- package/src/components/card/y-card-footer.ts +0 -8
- package/src/components/card/y-card-header.ts +0 -8
- package/src/components/card/y-card.ts +0 -16
- package/src/components/checkbox/IconCheckbox.vue +0 -24
- package/src/components/checkbox/YCheckbox.vue +0 -113
- package/src/components/checkbox/YInputCheckbox.vue +0 -108
- package/src/components/checkbox/index.ts +0 -8
- package/src/components/chip/index.ts +0 -3
- package/src/components/dialog/index.ts +0 -3
- package/src/components/dialog/y-dialog.vue +0 -46
- package/src/components/field-input/index.scss +0 -5
- package/src/components/field-input/index.ts +0 -11
- package/src/components/field-input/y-field-input.ts +0 -214
- package/src/components/form/index.ts +0 -9
- package/src/components/form/y-form.ts +0 -93
- package/src/components/icons/icon-clearable.ts +0 -6
- package/src/components/index.ts +0 -17
- package/src/components/input/index.scss +0 -5
- package/src/components/input/index.ts +0 -9
- package/src/components/input/y-input.ts +0 -368
- package/src/components/layer/index.ts +0 -3
- package/src/components/layer/y-layer.vue +0 -146
- package/src/components/lottie-player.ts +0 -41
- package/src/components/progress-bar/index.ts +0 -3
- package/src/components/progress-bar/y-progress-bar.vue +0 -144
- package/src/components/ring-spinner/y-ring-spinner.vue +0 -31
- package/src/components/switch/YSwitch.vue +0 -217
- package/src/components/switch/index.scss +0 -5
- package/src/components/switch/index.ts +0 -11
- package/src/components/text-highlighter/index.scss +0 -5
- package/src/components/text-highlighter/index.ts +0 -3
- package/src/components/text-highlighter/y-text-highlighter.ts +0 -89
- package/src/composables/lazy.ts +0 -30
- package/src/composables/theme.ts +0 -25
- package/src/directives/complement-click/index.ts +0 -123
- package/src/directives/theme-class.ts +0 -14
- package/src/file-extension.d.ts +0 -14
- package/src/index.ts +0 -21
- package/src/styles/base.scss +0 -28
- package/src/styles/theme/dark.scss +0 -35
- package/src/styles/theme/light.scss +0 -32
- package/src/util/common.ts +0 -59
- package/src/util/date-time.ts +0 -41
- package/src/util/dom.ts +0 -6
- package/src/util/string.ts +0 -9
- package/src/util/ui.ts +0 -39
- package/src/util/validation.ts +0 -9
- package/src/util/vue-component.ts +0 -18
- /package/{src/components/card/y-card.scss → lib/components/card/YCard.scss} +0 -0
- /package/{src/components/checkbox/y-checkbox.scss → lib/components/checkbox/YCheckbox.scss} +0 -0
- /package/{src/components/dialog/y-dialog.scss → lib/components/dialog/YDialog.scss} +0 -0
- /package/{src/components/layer/y-layer.scss → lib/components/layer/YLayer.scss} +0 -0
- /package/{src/components/text-highlighter/y-text-highlighter.scss → lib/components/text-highlighter/YTextHighlighter.scss} +0 -0
- /package/{src/styles/variables.scss → lib/styles/_variables.scss} +0 -0
- /package/{src → lib}/styles/util/helper.scss +0 -0
- /package/{src → lib}/styles/util/theme.scss +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"YTreeViewNode.mjs","names":["computed","defineComponent","h","inject","useRender","getObjectValueByPath","YIconExpand","YTreeViewNode","name","props","item","type","Object","itemKey","String","default","textKey","childrenKey","level","Number","setup","_ref","slots","treeView","children","imLeaf","value","length","classes","styles","contentText","slotProps","leaves","map","indentSpacer","i","push","class","style","width","height","leading","text","trailing","role","undefined","myKey","created","register"],"sources":["../../../src/components/tree-view/YTreeViewNode.ts"],"sourcesContent":["import {\r\n PropType,\r\n VNodeArrayChildren,\r\n computed,\r\n defineComponent,\r\n h,\r\n inject,\r\n} from 'vue';\r\n\r\nimport { useRender } from '../../composables/component';\r\nimport { getObjectValueByPath } from '../../util/common';\r\nimport { YIconExpand } from '../icons';\r\n\r\nexport const YTreeViewNode = defineComponent({\r\n name: 'YTreeNode',\r\n props: {\r\n item: {\r\n type: Object as PropType<any>,\r\n },\r\n itemKey: {\r\n type: String as PropType<string>,\r\n default: 'id',\r\n },\r\n textKey: {\r\n type: String as PropType<string>,\r\n default: 'text',\r\n },\r\n childrenKey: {\r\n type: String as PropType<string>,\r\n default: 'children',\r\n },\r\n level: {\r\n type: Number as PropType<number>,\r\n default: 0,\r\n },\r\n },\r\n setup(props, { slots }) {\r\n const treeView = inject<any>('tree-view');\r\n\r\n const children = computed(() => {\r\n return props.item?.[props.childrenKey] ?? [];\r\n });\r\n\r\n const imLeaf = computed(() => children.value.length < 1);\r\n\r\n const classes = computed(() => {\r\n return {\r\n 'y-tree-view-node': true,\r\n 'y-tree-view-node--leaf': imLeaf.value,\r\n };\r\n });\r\n\r\n const styles = computed(() => {\r\n return {\r\n '--tree-view-node--level': props.level,\r\n };\r\n });\r\n\r\n const contentText = computed(() => {\r\n return getObjectValueByPath(props.item, props.textKey) ?? '';\r\n });\r\n\r\n const slotProps = computed(() => {\r\n return {\r\n level: props.level,\r\n imLeaf: imLeaf.value,\r\n }\r\n })\r\n\r\n useRender(() => {\r\n const leaves = children.value.map((item: any) => {\r\n return h(\r\n YTreeViewNode,\r\n { ...props, level: (props.level ?? 0) + 1, item },\r\n slots,\r\n );\r\n });\r\n const indentSpacer: VNodeArrayChildren = [];\r\n for (let i = 0; i < props.level; i += 1) {\r\n indentSpacer.push(\r\n h('div', { class: 'y-tree-view-node__indent-spacer' }),\r\n );\r\n }\r\n return h(\r\n 'div',\r\n {\r\n class: classes.value,\r\n style: styles.value,\r\n '.role': 'treeitem',\r\n 'data-level': props.level,\r\n },\r\n [\r\n h('div', { class: 'y-tree-view-node__container' }, [\r\n h('div', { class: 'y-tree-view-node__indents' }, indentSpacer),\r\n /* EXPAND */\r\n !imLeaf.value\r\n ? h('i', { class: 'y-tree-view-node__expand-icon' }, [\r\n slots['expand-icon']\r\n ? slots['expand-icon']()\r\n : h(YIconExpand, {\r\n style: { width: '12px', height: '12px' },\r\n }),\r\n ])\r\n : h('i', { class: 'y-tree-view-node__no-expand-icon' }),\r\n /* CONTENT */\r\n h('div', { class: 'y-tree-view-node__content' }, [\r\n slots.leading &&\r\n h(\r\n 'div',\r\n { class: 'y-tree-view-node__leading' },\r\n slots.leading(slotProps.value),\r\n ),\r\n h(\r\n 'div',\r\n { class: 'y-tree-view-node__text' },\r\n slots.default\r\n ? slots.default?.({\r\n text: contentText.value,\r\n item: props.item,\r\n })\r\n : contentText.value,\r\n ),\r\n slots.trailing &&\r\n h(\r\n 'div',\r\n { class: 'y-tree-view-node__trailing' },\r\n slots.trailing(),\r\n ),\r\n ]),\r\n ]),\r\n /* CHILDREN */\r\n children.value.length > 0\r\n ? h(\r\n 'div',\r\n { class: { 'y-tree-view-node__leaves': true }, role: 'tree' },\r\n leaves,\r\n )\r\n : undefined,\r\n ],\r\n );\r\n });\r\n\r\n const myKey = computed(() => {\r\n return getObjectValueByPath(props.item, props.itemKey);\r\n });\r\n\r\n return {\r\n treeView,\r\n myKey,\r\n };\r\n },\r\n created() {\r\n this.treeView?.register?.(this.myKey, this);\r\n },\r\n});\r\n\r\nexport type YTreeNode = InstanceType<typeof YTreeViewNode>;\r\n"],"mappings":"AAAA,SAGEA,QAAQ,EACRC,eAAe,EACfC,CAAC,EACDC,MAAM,QACD,KAAK;AAAC,SAEJC,SAAS;AAAA,SACTC,oBAAoB;AAAA,SACpBC,WAAW;AAEpB,OAAO,MAAMC,aAAa,GAAGN,eAAe,CAAC;EAC3CO,IAAI,EAAE,WAAW;EACjBC,KAAK,EAAE;IACLC,IAAI,EAAE;MACJC,IAAI,EAAEC;IACR,CAAC;IACDC,OAAO,EAAE;MACPF,IAAI,EAAEG,MAA0B;MAChCC,OAAO,EAAE;IACX,CAAC;IACDC,OAAO,EAAE;MACPL,IAAI,EAAEG,MAA0B;MAChCC,OAAO,EAAE;IACX,CAAC;IACDE,WAAW,EAAE;MACXN,IAAI,EAAEG,MAA0B;MAChCC,OAAO,EAAE;IACX,CAAC;IACDG,KAAK,EAAE;MACLP,IAAI,EAAEQ,MAA0B;M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AACL,KAAK,CAC/B,CAAC,EACHxB,CAAC,CACC,KAAK,EACL;QAAEmC,KAAK,EAAE;MAAyB,CAAC,EACnCf,KAAK,CAACP,OAAO,GACTO,KAAK,CAACP,OAAO,GAAG;QACd2B,IAAI,EAAEZ,WAAW,CAACJ,KAAK;QACvBhB,IAAI,EAAED,KAAK,CAACC;MACd,CAAC,CAAC,GACFoB,WAAW,CAACJ,KAClB,CAAC,EACDJ,KAAK,CAACqB,QAAQ,IACdzC,CAAC,CACC,KAAK,EACL;QAAEmC,KAAK,EAAE;MAA6B,CAAC,EACvCf,KAAK,CAACqB,QAAQ,CAAC,CACjB,CAAC,CACF,CAAC,CACH,CAAC,EACF;MACAnB,QAAQ,CAACE,KAAK,CAACC,MAAM,GAAG,CAAC,GACrBzB,CAAC,CACC,KAAK,EACL;QAAEmC,KAAK,EAAE;UAAE,0BAA0B,EAAE;QAAK,CAAC;QAAEO,IAAI,EAAE;MAAO,CAAC,EAC7DZ,MACF,CAAC,GACDa,SAAS,CAEjB,CAAC;IACH,CAAC,CAAC;IAEF,MAAMC,KAAK,GAAG9C,QAAQ,CAAC,MAAM;MAC3B,OAAOK,oBAAoB,CAACI,KAAK,CAACC,IAAI,EAAED,KAAK,CAACI,OAAO,CAAC;IACxD,CAAC,CAAC;IAEF,OAAO;MACLU,QAAQ;MACRuB;IACF,CAAC;EACH,CAAC;EACDC,OAAOA,CAAA,EAAG;IACR,IAAI,CAACxB,QAAQ,EAAEyB,QAAQ,GAAG,IAAI,CAACF,KAAK,EAAE,IAAI,CAAC;EAC7C;AACF,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","names":[],"sources":["../../../src/components/tree-view/index.ts"],"sourcesContent":["export * from './YTreeViewNode';\r\nexport * from './YTreeView';\r\n"],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"collections.mjs","names":[],"sources":["../../src/composables/collections.ts"],"sourcesContent":["export {};\r\n"],"mappings":"AAAA"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { computed, getCurrentInstance, ref, toRaw, watch } from 'vue';
|
|
2
|
+
import { hasOwnProperty } from "../util/common.mjs";
|
|
3
|
+
import { kebabToCamel, toKebabCase } from "../util/string.mjs";
|
|
4
|
+
import { useToggleScope } from "./scope.mjs";
|
|
5
|
+
export function useModelDuplex(props) {
|
|
6
|
+
let prop = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'modelValue';
|
|
7
|
+
let defaultValue = arguments.length > 2 ? arguments[2] : undefined;
|
|
8
|
+
let getIn = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : v => v;
|
|
9
|
+
let setOut = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : v => v;
|
|
10
|
+
const vm = getCurrentInstance();
|
|
11
|
+
const kebabProp = toKebabCase(prop);
|
|
12
|
+
const property = kebabProp === prop ? kebabToCamel(prop) : prop;
|
|
13
|
+
const txValue = ref(props[property] !== undefined ? props[property] : defaultValue);
|
|
14
|
+
function getProp() {
|
|
15
|
+
return props[property];
|
|
16
|
+
}
|
|
17
|
+
const isDefinedProp = computed(() => {
|
|
18
|
+
getProp();
|
|
19
|
+
const registeredProps = vm.vnode.props;
|
|
20
|
+
return (hasOwnProperty(registeredProps, kebabProp) || hasOwnProperty(registeredProps, property)) && (hasOwnProperty(registeredProps, `onUpdate:${kebabProp}`) || hasOwnProperty(registeredProps, `onUpdate:${property}`));
|
|
21
|
+
});
|
|
22
|
+
useToggleScope(() => !isDefinedProp.value, () => {
|
|
23
|
+
watch(() => getProp(), value => {
|
|
24
|
+
txValue.value = value;
|
|
25
|
+
});
|
|
26
|
+
});
|
|
27
|
+
const model = computed({
|
|
28
|
+
get() {
|
|
29
|
+
return getIn(isDefinedProp.value ? getProp() : txValue.value);
|
|
30
|
+
},
|
|
31
|
+
set(value) {
|
|
32
|
+
const neo = setOut(value);
|
|
33
|
+
const current = toRaw(isDefinedProp.value ? getProp() : txValue.value);
|
|
34
|
+
if (current === neo || setOut(current) === value) {
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
txValue.value = neo;
|
|
38
|
+
vm?.emit(`update:${property}`, neo);
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
Object.defineProperty(model, 'rxValue', {
|
|
42
|
+
get: () => isDefinedProp.value ? getProp() : txValue.value
|
|
43
|
+
});
|
|
44
|
+
return model;
|
|
45
|
+
}
|
|
46
|
+
//# sourceMappingURL=communication.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"communication.mjs","names":["computed","getCurrentInstance","ref","toRaw","watch","hasOwnProperty","kebabToCamel","toKebabCase","useToggleScope","useModelDuplex","props","prop","arguments","length","undefined","defaultValue","getIn","v","setOut","vm","kebabProp","property","txValue","getProp","isDefinedProp","registeredProps","vnode","value","model","get","set","neo","current","emit","Object","defineProperty"],"sources":["../../src/composables/communication.ts"],"sourcesContent":["import { computed, getCurrentInstance, ref, toRaw, watch } from 'vue';\n\nimport { hasOwnProperty } from '../util/common';\nimport { kebabToCamel, toKebabCase } from '../util/string';\nimport { useToggleScope } from './scope';\n\nexport function useModelDuplex(\n props: any,\n prop: string = 'modelValue',\n defaultValue?: any,\n getIn: (value?: any) => any = (v: any) => v,\n setOut: (value: any) => any = (v: any) => v,\n) {\n const vm = getCurrentInstance()!;\n const kebabProp = toKebabCase(prop);\n const property = kebabProp === prop ? kebabToCamel(prop) : prop;\n const txValue = ref(\n props[property] !== undefined ? props[property] : defaultValue,\n );\n\n function getProp() {\n return props[property];\n }\n\n const isDefinedProp = computed(() => {\n getProp();\n const registeredProps = vm.vnode.props;\n return (\n (hasOwnProperty(registeredProps, kebabProp) ||\n hasOwnProperty(registeredProps, property)) &&\n (hasOwnProperty(registeredProps, `onUpdate:${kebabProp}`) ||\n hasOwnProperty(registeredProps, `onUpdate:${property}`))\n );\n });\n\n useToggleScope(\n () => !isDefinedProp.value,\n () => {\n watch(\n () => getProp(),\n (value) => {\n txValue.value = value;\n },\n );\n },\n );\n\n const model = computed({\n get(): any {\n return getIn(isDefinedProp.value ? getProp() : txValue.value);\n },\n set(value) {\n const neo = setOut(value);\n const current = toRaw(isDefinedProp.value ? getProp() : txValue.value);\n if (current === neo || setOut(current) === value) {\n return;\n }\n txValue.value = neo;\n vm?.emit(`update:${property}`, neo);\n },\n });\n\n Object.defineProperty(model, 'rxValue', {\n get: () => (isDefinedProp.value ? getProp() : txValue.value),\n });\n\n return model;\n}\n"],"mappings":"AAAA,SAASA,QAAQ,EAAEC,kBAAkB,EAAEC,GAAG,EAAEC,KAAK,EAAEC,KAAK,QAAQ,KAAK;AAAC,SAE7DC,cAAc;AAAA,SACdC,YAAY,EAAEC,WAAW;AAAA,SACzBC,cAAc;AAEvB,OAAO,SAASC,cAAcA,CAC5BC,KAAU,EAKV;EAAA,IAJAC,IAAY,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,YAAY;EAAA,IAC3BG,YAAkB,GAAAH,SAAA,CAAAC,MAAA,OAAAD,SAAA,MAAAE,SAAA;EAAA,IAClBE,KAA2B,GAAAJ,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAIK,CAAM,IAAKA,CAAC;EAAA,IAC3CC,MAA2B,GAAAN,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAIK,CAAM,IAAKA,CAAC;EAE3C,MAAME,EAAE,GAAGlB,kBAAkB,CAAC,CAAE;EAChC,MAAMmB,SAAS,GAAGb,WAAW,CAACI,IAAI,CAAC;EACnC,MAAMU,QAAQ,GAAGD,SAAS,KAAKT,IAAI,GAAGL,YAAY,CAACK,IAAI,CAAC,GAAGA,IAAI;EAC/D,MAAMW,OAAO,GAAGpB,GAAG,CACjBQ,KAAK,CAACW,QAAQ,CAAC,KAAKP,SAAS,GAAGJ,KAAK,CAACW,QAA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AS,EAAC,EAAEU,GAAG,CAAC;IACrC;EACF,CAAC,CAAC;EAEFG,MAAM,CAACC,cAAc,CAACP,KAAK,EAAE,SAAS,EAAE;IACtCC,GAAG,EAAEA,CAAA,KAAOL,aAAa,CAACG,KAAK,GAAGJ,OAAO,CAAC,CAAC,GAAGD,OAAO,CAACK;EACxD,CAAC,CAAC;EAEF,OAAOC,KAAK;AACd"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"component.mjs","names":["getCurrentInstance","useRender","render","vm"],"sources":["../../src/composables/component.ts"],"sourcesContent":["import { ComponentInternalInstance } from '@vue/runtime-core';\nimport { ComponentPublicInstance, VNode, getCurrentInstance } from 'vue';\n\ninterface RedefinedComponentInternalInstance extends ComponentInternalInstance {\n render: () => VNode;\n}\n\nexport function useRender(render: () => VNode) {\n const vm = getCurrentInstance() as RedefinedComponentInternalInstance | null;\n if (vm) {\n vm.render = render;\n }\n}\n"],"mappings":"AACA,SAAyCA,kBAAkB,QAAQ,KAAK;AAMxE,OAAO,SAASC,SAASA,CAACC,MAAmB,EAAE;EAC7C,MAAMC,EAAE,GAAGH,kBAAkB,CAAC,CAA8C;EAC5E,IAAIG,EAAE,EAAE;IACNA,EAAE,CAACD,MAAM,GAAGA,MAAM;EACpB;AACF"}
|
|
@@ -1,21 +1,17 @@
|
|
|
1
1
|
import { computed } from 'vue';
|
|
2
|
-
|
|
3
|
-
import type { Ref } from 'vue';
|
|
4
|
-
|
|
5
2
|
export const Y_LAYER_GROUP_CLASS_NAME = 'y-layer-group';
|
|
6
|
-
|
|
7
|
-
export function useLayerGroup(target?: Ref<string | Element>) {
|
|
3
|
+
export function useLayerGroup(target) {
|
|
8
4
|
const layerGroup = computed(() => {
|
|
9
5
|
const refTarget = target?.value;
|
|
10
|
-
let targetEl
|
|
6
|
+
let targetEl = document.body;
|
|
11
7
|
if (typeof refTarget === 'string') {
|
|
12
8
|
const el = document.querySelector(refTarget);
|
|
13
9
|
if (el) {
|
|
14
10
|
targetEl = el;
|
|
15
11
|
}
|
|
16
12
|
}
|
|
17
|
-
if (refTarget &&
|
|
18
|
-
targetEl = refTarget
|
|
13
|
+
if (refTarget && refTarget.nodeType === 1) {
|
|
14
|
+
targetEl = refTarget;
|
|
19
15
|
}
|
|
20
16
|
//
|
|
21
17
|
let layerEl = targetEl.querySelector(`.${Y_LAYER_GROUP_CLASS_NAME}`);
|
|
@@ -26,6 +22,8 @@ export function useLayerGroup(target?: Ref<string | Element>) {
|
|
|
26
22
|
}
|
|
27
23
|
return layerEl;
|
|
28
24
|
});
|
|
29
|
-
|
|
30
|
-
|
|
25
|
+
return {
|
|
26
|
+
layerGroup
|
|
27
|
+
};
|
|
31
28
|
}
|
|
29
|
+
//# sourceMappingURL=layer-group.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"layer-group.mjs","names":["computed","Y_LAYER_GROUP_CLASS_NAME","useLayerGroup","target","layerGroup","refTarget","value","targetEl","document","body","el","querySelector","nodeType","layerEl","createElement","className","appendChild"],"sources":["../../src/composables/layer-group.ts"],"sourcesContent":["import { computed } from 'vue';\r\nimport type { Ref } from 'vue';\r\n\r\nexport const Y_LAYER_GROUP_CLASS_NAME = 'y-layer-group';\r\n\r\nexport function useLayerGroup(target?: Ref<string | Element>) {\r\n const layerGroup = computed<string | HTMLElement>(() => {\r\n const refTarget = target?.value;\r\n let targetEl: Element = document.body;\r\n if (typeof refTarget === 'string') {\r\n const el = document.querySelector(refTarget);\r\n if (el) {\r\n targetEl = el;\r\n }\r\n }\r\n if (refTarget && (refTarget as Element).nodeType === 1) {\r\n targetEl = refTarget as Element;\r\n }\r\n //\r\n let layerEl = targetEl.querySelector(`.${Y_LAYER_GROUP_CLASS_NAME}`);\r\n if (!layerEl) {\r\n layerEl = document.createElement('div');\r\n layerEl.className = Y_LAYER_GROUP_CLASS_NAME;\r\n targetEl.appendChild(layerEl);\r\n }\r\n return layerEl as HTMLElement;\r\n });\r\n\r\n return { layerGroup };\r\n}\r\n"],"mappings":"AAAA,SAASA,QAAQ,QAAQ,KAAK;AAG9B,OAAO,MAAMC,wBAAwB,GAAG,eAAe;AAEvD,OAAO,SAASC,aAAaA,CAACC,MAA8B,EAAE;EAC5D,MAAMC,UAAU,GAAGJ,QAAQ,CAAuB,MAAM;IACtD,MAAMK,SAAS,GAAGF,MAAM,EAAEG,KAAK;IAC/B,IAAIC,QAAiB,GAAGC,QAAQ,CAACC,IAAI;IACrC,IAAI,OAAOJ,SAAS,KAAK,QAAQ,EAAE;MACjC,MAAMK,EAAE,GAAGF,QAAQ,CAACG,aAAa,CAACN,SAAS,CAAC;MAC5C,IAAIK,EAAE,EAAE;QACNH,QAAQ,GAAGG,EAAE;MACf;IACF;IACA,IAAIL,SAAS,IAAKA,SAAS,CAAaO,QAAQ,KAAK,CAAC,EAAE;MACtDL,QAAQ,GAAGF,SAAoB;IACjC;IACA;IACA,IAAIQ,OAAO,GAAGN,QAAQ,CAACI,aAAa,CAAE,IAAGV,wBAAyB,EAAC,CAAC;IACpE,IAAI,CAACY,OAAO,EAAE;MACZA,OAAO,GAAGL,QAAQ,CAACM,aAAa,CAAC,KAAK,CAAC;MACvCD,OAAO,CAACE,SAAS,GAAGd,wBAAwB;MAC5CM,QAAQ,CAACS,WAAW,CAACH,OAAO,CAAC;IAC/B;IACA,OAAOA,OAAO;EAChB,CAAC,CAAC;EAEF,OAAO;IAAET;EAAW,CAAC;AACvB"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { provide } from "vue";
|
|
2
|
+
export const YUYEON_LAYOUT_KEY = Symbol.for('yuyeon.layout');
|
|
3
|
+
export function initLayoutSystem() {
|
|
4
|
+
provide(YUYEON_LAYOUT_KEY, {
|
|
5
|
+
register: () => {
|
|
6
|
+
return;
|
|
7
|
+
},
|
|
8
|
+
unregister: () => {
|
|
9
|
+
return;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=layout.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"layout.mjs","names":["provide","YUYEON_LAYOUT_KEY","Symbol","for","initLayoutSystem","register","unregister"],"sources":["../../src/composables/layout.ts"],"sourcesContent":["import { InjectionKey, provide } from \"vue\";\r\n\r\ndeclare function register(): void;\r\n\r\ninterface LayoutProvide {\r\n register: typeof register;\r\n unregister: (id: string) => void;\r\n}\r\n\r\nexport const YUYEON_LAYOUT_KEY: InjectionKey<LayoutProvide> = Symbol.for('yuyeon.layout');\r\n\r\nexport function initLayoutSystem() {\r\n provide(YUYEON_LAYOUT_KEY, {\r\n register: () => {\r\n return;\r\n },\r\n unregister: () => {\r\n return;\r\n }\r\n })\r\n}\r\n"],"mappings":"AAAA,SAAuBA,OAAO,QAAQ,KAAK;AAS3C,OAAO,MAAMC,iBAA8C,GAAGC,MAAM,CAACC,GAAG,CAAC,eAAe,CAAC;AAEzF,OAAO,SAASC,gBAAgBA,CAAA,EAAG;EACjCJ,OAAO,CAACC,iBAAiB,EAAE;IACzBI,QAAQ,EAAEA,CAAA,KAAM;MACd;IACF,CAAC;IACDC,UAAU,EAAEA,CAAA,KAAM;MAChB;IACF;EACF,CAAC,CAAC;AACJ"}
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
import { computed, nextTick, onScopeDispose, ref, watch } from 'vue';
|
|
2
|
+
import { getScrollParents } from "../util/scroll.mjs";
|
|
3
|
+
import { getBoundingPureRect, toStyleSizeValue } from "../util/ui.mjs";
|
|
4
|
+
import { useToggleScope } from "./scope.mjs";
|
|
5
|
+
const levitationStrategies = {
|
|
6
|
+
levitation: applyLevitation
|
|
7
|
+
};
|
|
8
|
+
export function useLevitation(props, state) {
|
|
9
|
+
const updateLevitation = ref();
|
|
10
|
+
const coordinate = ref();
|
|
11
|
+
const coordinateStyles = computed(() => {
|
|
12
|
+
if (coordinate.value) {
|
|
13
|
+
return {
|
|
14
|
+
top: toStyleSizeValue(coordinate.value.y),
|
|
15
|
+
left: toStyleSizeValue(coordinate.value.x)
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
return {};
|
|
19
|
+
});
|
|
20
|
+
useToggleScope(() => !!(state.active.value && props.levitationStrategy), reset => {
|
|
21
|
+
watch(() => props.levitationStrategy, reset);
|
|
22
|
+
onScopeDispose(() => {
|
|
23
|
+
updateLevitation.value = undefined;
|
|
24
|
+
});
|
|
25
|
+
if (typeof props.levitationStrategy === 'function') {
|
|
26
|
+
updateLevitation.value = props.levitationStrategy(props, state, coordinate)?.updateLevitation;
|
|
27
|
+
} else {
|
|
28
|
+
const strategy = levitationStrategies[props.levitationStrategy];
|
|
29
|
+
updateLevitation.value = strategy?.(props, state, coordinate)?.updateLevitation;
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
window.addEventListener('resize', onResize, {
|
|
33
|
+
passive: true
|
|
34
|
+
});
|
|
35
|
+
onScopeDispose(() => {
|
|
36
|
+
window.removeEventListener('resize', onResize);
|
|
37
|
+
updateLevitation.value = undefined;
|
|
38
|
+
});
|
|
39
|
+
function onResize(e) {
|
|
40
|
+
updateLevitation.value?.(e);
|
|
41
|
+
}
|
|
42
|
+
return {
|
|
43
|
+
coordinate,
|
|
44
|
+
coordinateStyles,
|
|
45
|
+
updateLevitation
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
function applyLevitation(props, state, coordinate) {
|
|
49
|
+
const {
|
|
50
|
+
contentEl,
|
|
51
|
+
baseEl,
|
|
52
|
+
active
|
|
53
|
+
} = state;
|
|
54
|
+
|
|
55
|
+
/* Content Limitations */
|
|
56
|
+
const [minWidth, minHeight, maxWidth, maxHeight] = ['minWidth', 'minHeight', 'maxWidth', 'maxHeight'].map(key => {
|
|
57
|
+
return computed(() => {
|
|
58
|
+
const val = parseFloat(props[key]);
|
|
59
|
+
return isNaN(val) ? Infinity : val;
|
|
60
|
+
});
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
/* Offset */
|
|
64
|
+
const offset = computed(() => {
|
|
65
|
+
if (Array.isArray(props.offset)) {
|
|
66
|
+
return props.offset;
|
|
67
|
+
}
|
|
68
|
+
if (typeof props.offset === 'string') {
|
|
69
|
+
const offset = props.offset.split(' ').map(parseFloat);
|
|
70
|
+
if (offset.length < 2) offset.push(0);
|
|
71
|
+
return offset;
|
|
72
|
+
}
|
|
73
|
+
return typeof props.offset === 'number' ? [props.offset, 0] : [0, 0];
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
/* Observing Update */
|
|
77
|
+
let observe = false;
|
|
78
|
+
const resizeObserver = new ResizeObserver(() => {
|
|
79
|
+
if (observe) updateLevitation();
|
|
80
|
+
});
|
|
81
|
+
watch([state.baseEl, state.contentEl], (_ref, _ref2) => {
|
|
82
|
+
let [neoBaseEl, neoContentEl] = _ref;
|
|
83
|
+
let [oldBaseEl, oldContentEl] = _ref2;
|
|
84
|
+
if (oldBaseEl) resizeObserver.unobserve(oldBaseEl);
|
|
85
|
+
if (neoBaseEl) resizeObserver.observe(neoBaseEl);
|
|
86
|
+
if (oldContentEl) resizeObserver.unobserve(oldContentEl);
|
|
87
|
+
if (neoContentEl) resizeObserver.observe(neoContentEl);
|
|
88
|
+
}, {
|
|
89
|
+
immediate: true
|
|
90
|
+
});
|
|
91
|
+
onScopeDispose(() => {
|
|
92
|
+
resizeObserver.disconnect();
|
|
93
|
+
});
|
|
94
|
+
function updateLevitation() {
|
|
95
|
+
observe = false;
|
|
96
|
+
requestAnimationFrame(() => {
|
|
97
|
+
requestAnimationFrame(() => observe = true);
|
|
98
|
+
});
|
|
99
|
+
if (!baseEl.value || !contentEl.value) return;
|
|
100
|
+
const $base = baseEl.value;
|
|
101
|
+
const $content = contentEl.value;
|
|
102
|
+
const {
|
|
103
|
+
viewportMargin
|
|
104
|
+
} = props;
|
|
105
|
+
const baseRect = $base.getBoundingClientRect();
|
|
106
|
+
const contentRect = getBoundingPureRect($content);
|
|
107
|
+
const scrollParents = getScrollParents($content);
|
|
108
|
+
if (scrollParents.length < 1) {
|
|
109
|
+
scrollParents.push(document.documentElement);
|
|
110
|
+
}
|
|
111
|
+
let x = baseRect.top;
|
|
112
|
+
let y = baseRect.left + baseRect.width / 2;
|
|
113
|
+
}
|
|
114
|
+
watch(() => [props.offset, props.minWidth, props.minHeight, props.maxWidth, props.maxHeight], () => updateLevitation());
|
|
115
|
+
nextTick(() => {
|
|
116
|
+
const result = updateLevitation();
|
|
117
|
+
if (!result) return;
|
|
118
|
+
const {
|
|
119
|
+
available,
|
|
120
|
+
contentBox
|
|
121
|
+
} = result;
|
|
122
|
+
if (contentBox.height > available.y) {
|
|
123
|
+
requestAnimationFrame(() => {
|
|
124
|
+
updateLevitation();
|
|
125
|
+
requestAnimationFrame(() => {
|
|
126
|
+
updateLevitation();
|
|
127
|
+
});
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
});
|
|
131
|
+
return {
|
|
132
|
+
updateLevitation
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
//# sourceMappingURL=levitation.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"levitation.mjs","names":["computed","nextTick","onScopeDispose","ref","watch","getScrollParents","getBoundingPureRect","toStyleSizeValue","useToggleScope","levitationStrategies","levitation","applyLevitation","useLevitation","props","state","updateLevitation","coordinate","coordinateStyles","value","top","y","left","x","active","levitationStrategy","reset","undefined","strategy","window","addEventListener","onResize","passive","removeEventListener","e","contentEl","baseEl","minWidth","minHeight","maxWidth","maxHeight","map","key","val","parseFloat","isNaN","Infinity","offset","Array","isArray","split","length","push","observe","resizeObserver","ResizeObserver","_ref","_ref2","neoBaseEl","neoContentEl","oldBaseEl","oldContentEl","unobserve","immediate","disconnect","requestAnimationFrame","$base","$content","viewportMargin","baseRect","getBoundingClientRect","contentRect","scrollParents","document","documentElement","width","result","available","contentBox","height"],"sources":["../../src/composables/levitation.ts"],"sourcesContent":["import type { Ref } from 'vue';\nimport {\n CSSProperties,\n computed,\n nextTick,\n onScopeDispose,\n ref,\n watch,\n} from 'vue';\n\nimport { getScrollParents } from '../util/scroll';\nimport { getBoundingPureRect, toStyleSizeValue } from '../util/ui';\nimport { useToggleScope } from './scope';\nimport { Rect } from \"../util/Rect\";\n\nexport interface LevitationState {\n contentEl: Ref<HTMLElement | undefined>;\n baseEl: Ref<HTMLElement | undefined>;\n active: Ref<boolean>;\n}\n\nconst levitationStrategies = {\n levitation: applyLevitation,\n};\n\nexport function useLevitation(props: any, state: LevitationState) {\n const updateLevitation = ref<(e: Event) => void>();\n const coordinate = ref<Rect | undefined>();\n const coordinateStyles = computed<CSSProperties>(() => {\n if (coordinate.value) {\n return {\n top: toStyleSizeValue(coordinate.value.y),\n left: toStyleSizeValue(coordinate.value.x),\n };\n }\n return {};\n });\n\n useToggleScope(\n () => !!(state.active.value && props.levitationStrategy),\n (reset) => {\n watch(() => props.levitationStrategy, reset);\n onScopeDispose(() => {\n updateLevitation.value = undefined;\n });\n\n if (typeof props.levitationStrategy === 'function') {\n updateLevitation.value = props.levitationStrategy(\n props,\n state,\n coordinate,\n )?.updateLevitation;\n } else {\n const strategy =\n levitationStrategies[\n props.levitationStrategy as keyof typeof levitationStrategies\n ];\n updateLevitation.value = strategy?.(\n props,\n state,\n coordinate,\n )?.updateLevitation;\n }\n },\n );\n\n window.addEventListener('resize', onResize, { passive: true });\n\n onScopeDispose(() => {\n window.removeEventListener('resize', onResize);\n updateLevitation.value = undefined;\n });\n\n function onResize(e: Event) {\n updateLevitation.value?.(e);\n }\n\n return {\n coordinate,\n coordinateStyles,\n updateLevitation,\n };\n}\n\nfunction applyLevitation(\n props: any,\n state: LevitationState,\n coordinate: Ref<Rect | undefined>,\n) {\n const { contentEl, baseEl, active } = state;\n\n /* Content Limitations */\n const [minWidth, minHeight, maxWidth, maxHeight] = (\n ['minWidth', 'minHeight', 'maxWidth', 'maxHeight'] as const\n ).map((key) => {\n return computed(() => {\n const val = parseFloat(props[key]!);\n return isNaN(val) ? Infinity : val;\n });\n });\n\n /* Offset */\n const offset = computed(() => {\n if (Array.isArray(props.offset)) {\n return props.offset;\n }\n if (typeof props.offset === 'string') {\n const offset = props.offset.split(' ').map(parseFloat);\n if (offset.length < 2) offset.push(0);\n return offset;\n }\n return typeof props.offset === 'number' ? [props.offset, 0] : [0, 0];\n });\n\n /* Observing Update */\n let observe = false;\n const resizeObserver = new ResizeObserver(() => {\n if (observe) updateLevitation();\n });\n watch(\n [state.baseEl, state.contentEl],\n ([neoBaseEl, neoContentEl], [oldBaseEl, oldContentEl]) => {\n if (oldBaseEl) resizeObserver.unobserve(oldBaseEl);\n if (neoBaseEl) resizeObserver.observe(neoBaseEl);\n\n if (oldContentEl) resizeObserver.unobserve(oldContentEl);\n if (neoContentEl) resizeObserver.observe(neoContentEl);\n },\n { immediate: true },\n );\n onScopeDispose(() => {\n resizeObserver.disconnect();\n });\n\n function updateLevitation(): any {\n observe = false;\n requestAnimationFrame(() => {\n requestAnimationFrame(() => (observe = true));\n });\n if (!baseEl.value || !contentEl.value) return;\n\n const $base = baseEl.value;\n const $content = contentEl.value;\n const { viewportMargin } = props;\n\n const baseRect = $base.getBoundingClientRect();\n const contentRect = getBoundingPureRect($content);\n const scrollParents = getScrollParents($content);\n\n if (scrollParents.length < 1) {\n scrollParents.push(document.documentElement);\n }\n\n let x = baseRect.top;\n let y = baseRect.left + baseRect.width / 2;\n }\n\n watch(\n () => [\n props.offset,\n props.minWidth,\n props.minHeight,\n props.maxWidth,\n props.maxHeight,\n ],\n () => updateLevitation(),\n );\n\n nextTick(() => {\n const result = updateLevitation();\n if (!result) return;\n const { available, contentBox } = result;\n if (contentBox.height > available.y) {\n requestAnimationFrame(() => {\n updateLevitation();\n requestAnimationFrame(() => {\n updateLevitation();\n });\n });\n }\n });\n\n return {\n updateLevitation,\n };\n}\n"],"mappings":"AACA,SAEEA,QAAQ,EACRC,QAAQ,EACRC,cAAc,EACdC,GAAG,EACHC,KAAK,QACA,KAAK;AAAC,SAEJC,gBAAgB;AAAA,SAChBC,mBAA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IACJ;EACF,CAAC,CAAC;EAEF,OAAO;IACLA;EACF,CAAC;AACH"}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { computed } from 'vue';
|
|
2
|
-
|
|
3
|
-
export function useProgress(props: any) {
|
|
2
|
+
export function useProgress(props) {
|
|
4
3
|
const numValue = computed(() => {
|
|
5
|
-
const {
|
|
4
|
+
const {
|
|
5
|
+
value
|
|
6
|
+
} = props;
|
|
6
7
|
const numValue = Number(value);
|
|
7
8
|
if (Number.isNaN(numValue) || numValue < 0) {
|
|
8
9
|
return 0;
|
|
@@ -12,8 +13,8 @@ export function useProgress(props: any) {
|
|
|
12
13
|
}
|
|
13
14
|
return numValue;
|
|
14
15
|
});
|
|
15
|
-
|
|
16
16
|
return {
|
|
17
|
-
numValue
|
|
17
|
+
numValue
|
|
18
18
|
};
|
|
19
19
|
}
|
|
20
|
+
//# sourceMappingURL=progress.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"progress.mjs","names":["computed","useProgress","props","numValue","value","Number","isNaN"],"sources":["../../src/composables/progress.ts"],"sourcesContent":["import { computed } from 'vue';\n\nexport function useProgress(props: any) {\n const numValue = computed(() => {\n const { value } = props;\n const numValue = Number(value);\n if (Number.isNaN(numValue) || numValue < 0) {\n return 0;\n }\n if (numValue > 100) {\n return 100;\n }\n return numValue;\n });\n\n return {\n numValue,\n };\n}\n"],"mappings":"AAAA,SAASA,QAAQ,QAAQ,KAAK;AAE9B,OAAO,SAASC,WAAWA,CAACC,KAAU,EAAE;EACtC,MAAMC,QAAQ,GAAGH,QAAQ,CAAC,MAAM;IAC9B,MAAM;MAAEI;IAAM,CAAC,GAAGF,KAAK;IACvB,MAAMC,QAAQ,GAAGE,MAAM,CAACD,KAAK,CAAC;IAC9B,IAAIC,MAAM,CAACC,KAAK,CAACH,QAAQ,CAAC,IAAIA,QAAQ,GAAG,CAAC,EAAE;MAC1C,OAAO,CAAC;IACV;IACA,IAAIA,QAAQ,GAAG,GAAG,EAAE;MAClB,OAAO,GAAG;IACZ;IACA,OAAOA,QAAQ;EACjB,CAAC,CAAC;EAEF,OAAO;IACLA;EACF,CAAC;AACH"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { readonly, ref } from 'vue';
|
|
2
|
+
import { onBeforeUnmount } from 'vue';
|
|
3
|
+
import { watch } from 'vue';
|
|
4
|
+
import { getHtmlElement } from "../util/vue-component.mjs";
|
|
5
|
+
export function useResizeObserver(callback) {
|
|
6
|
+
const resizeObservedRef = ref();
|
|
7
|
+
const contentRect = ref();
|
|
8
|
+
if (window) {
|
|
9
|
+
const observer = new ResizeObserver((entries, observer) => {
|
|
10
|
+
callback?.(entries, observer);
|
|
11
|
+
if (!entries.length) return;
|
|
12
|
+
contentRect.value = entries[0].contentRect;
|
|
13
|
+
});
|
|
14
|
+
onBeforeUnmount(() => {
|
|
15
|
+
observer.disconnect();
|
|
16
|
+
});
|
|
17
|
+
watch(resizeObservedRef, (neo, old) => {
|
|
18
|
+
if (old) {
|
|
19
|
+
observer.unobserve(old);
|
|
20
|
+
contentRect.value = undefined;
|
|
21
|
+
}
|
|
22
|
+
if (neo) {
|
|
23
|
+
observer.observe(getHtmlElement(neo));
|
|
24
|
+
}
|
|
25
|
+
}, {
|
|
26
|
+
flush: 'post'
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
return {
|
|
30
|
+
resizeObservedRef,
|
|
31
|
+
contentRect: readonly(contentRect)
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=resize-observer.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resize-observer.mjs","names":["readonly","ref","onBeforeUnmount","watch","getHtmlElement","useResizeObserver","callback","resizeObservedRef","contentRect","window","observer","ResizeObserver","entries","length","value","disconnect","neo","old","unobserve","undefined","observe","flush"],"sources":["../../src/composables/resize-observer.ts"],"sourcesContent":["import { readonly, ref } from 'vue';\r\nimport { onBeforeUnmount } from 'vue';\r\nimport { watch } from 'vue';\r\n\r\nimport { getHtmlElement } from '../util/vue-component';\r\n\r\nexport function useResizeObserver(callback?: ResizeObserverCallback) {\r\n const resizeObservedRef = ref<HTMLElement>();\r\n const contentRect = ref<DOMRectReadOnly>();\r\n if (window) {\r\n const observer = new ResizeObserver((entries, observer) => {\r\n callback?.(entries, observer);\r\n if (!entries.length) return;\r\n contentRect.value = entries[0].contentRect;\r\n });\r\n\r\n onBeforeUnmount(() => {\r\n observer.disconnect();\r\n });\r\n\r\n watch(\r\n resizeObservedRef,\r\n (neo, old) => {\r\n if (old) {\r\n observer.unobserve(old);\r\n contentRect.value = undefined;\r\n }\r\n if (neo) {\r\n observer.observe(getHtmlElement(neo));\r\n }\r\n },\r\n { flush: 'post' },\r\n );\r\n }\r\n\r\n return {\r\n resizeObservedRef,\r\n contentRect: readonly(contentRect),\r\n };\r\n}\r\n"],"mappings":"AAAA,SAASA,QAAQ,EAAEC,GAAG,QAAQ,KAAK;AACnC,SAASC,eAAe,QAAQ,KAAK;AACrC,SAASC,KAAK,QAAQ,KAAK;AAAC,SAEnBC,cAAc;AAEvB,OAAO,SAASC,iBAAiBA,CAACC,QAAiC,EAAE;EACnE,MAAMC,iBAAiB,GAAGN,GAAG,CAAc,CAAC;EAC5C,MAAMO,WAAW,GAAGP,GAAG,CAAkB,CAAC;EAC1C,IAAIQ,MAAM,EAAE;IACV,MAAMC,QAAQ,GAAG,IAAIC,cAAc,CAAC,CAACC,OAAO,EAAEF,QAAQ,KAAK;MACzDJ,QAAQ,GAAGM,OAAO,EAAEF,QAAQ,CAAC;MAC7B,IAAI,CAACE,OAAO,CAACC,MAAM,EAAE;MACrBL,WAAW,CAACM,KAAK,GAAGF,OAAO,CAAC,CAAC,CAAC,CAACJ,WAAW;IAC5C,CAAC,CAAC;IAEFN,eAAe,CAAC,MAAM;MACpBQ,QAAQ,CAACK,UAAU,CAAC,CAAC;IACvB,CAAC,CAAC;IAEFZ,KAAK,CACDI,iBAAiB,EACjB,CAACS,GAAG,EAAEC,GAAG,KAAK;MACZ,IAAIA,GAAG,EAAE;QACPP,QAAQ,CAACQ,SAAS,CAACD,GAAG,CAAC;QACvBT,WAAW,CAACM,KAAK,GAAGK,SAAS;MAC/B;MACA,IAAIH,GAAG,EAAE;QACPN,QAAQ,CAACU,OAAO,CAAChB,cAAc,CAACY,GAAG,CAAC,CAAC;MACvC;IACF,CAAC,EACD;MAAEK,KAAK,EAAE;IAAO,CACpB,CAAC;EACH;EAEA,OAAO;IACLd,iBAAiB;IACjBC,WAAW,EAAER,QAAQ,CAACQ,WAAW;EACnC,CAAC;AACH"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
// vuetify/packages/vuetify/src/composables/toggleScope.ts
|
|
2
|
+
|
|
3
|
+
import { effectScope, onScopeDispose, watch } from 'vue';
|
|
4
|
+
export function useToggleScope(source, fn) {
|
|
5
|
+
let scope;
|
|
6
|
+
function start() {
|
|
7
|
+
scope = effectScope();
|
|
8
|
+
scope.run(() => fn.length ? fn(() => {
|
|
9
|
+
scope?.stop();
|
|
10
|
+
start();
|
|
11
|
+
}) : fn());
|
|
12
|
+
}
|
|
13
|
+
watch(source, active => {
|
|
14
|
+
if (active && !scope) {
|
|
15
|
+
start();
|
|
16
|
+
} else if (!active) {
|
|
17
|
+
scope?.stop();
|
|
18
|
+
scope = undefined;
|
|
19
|
+
}
|
|
20
|
+
}, {
|
|
21
|
+
immediate: true
|
|
22
|
+
});
|
|
23
|
+
onScopeDispose(() => {
|
|
24
|
+
scope?.stop();
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=scope.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scope.mjs","names":["effectScope","onScopeDispose","watch","useToggleScope","source","fn","scope","start","run","length","stop","active","undefined","immediate"],"sources":["../../src/composables/scope.ts"],"sourcesContent":["// vuetify/packages/vuetify/src/composables/toggleScope.ts\n\nimport { effectScope, onScopeDispose, watch } from 'vue';\nimport type { EffectScope, WatchSource } from 'vue';\n\nexport function useToggleScope(\n source: WatchSource<boolean>,\n fn: (reset: () => void) => void,\n) {\n let scope: EffectScope | undefined;\n function start() {\n scope = effectScope();\n scope.run(() =>\n fn.length\n ? fn(() => {\n scope?.stop();\n start();\n })\n : (fn as any)(),\n );\n }\n\n watch(\n source,\n (active) => {\n if (active && !scope) {\n start();\n } else if (!active) {\n scope?.stop();\n scope = undefined;\n }\n },\n { immediate: true },\n );\n\n onScopeDispose(() => {\n scope?.stop();\n });\n}\n"],"mappings":"AAAA;;AAEA,SAASA,WAAW,EAAEC,cAAc,EAAEC,KAAK,QAAQ,KAAK;AAGxD,OAAO,SAASC,cAAcA,CAC5BC,MAA4B,EAC5BC,EAA+B,EAC/B;EACA,IAAIC,KAA8B;EAClC,SAASC,KAAKA,CAAA,EAAG;IACfD,KAAK,GAAGN,WAAW,CAAC,CAAC;IACrBM,KAAK,CAACE,GAAG,CAAC,MACRH,EAAE,CAACI,MAAM,GACLJ,EAAE,CAAC,MAAM;MACPC,KAAK,EAAEI,IAAI,CAAC,CAAC;MACbH,KAAK,CAAC,CAAC;IACT,CAAC,CAAC,GACDF,EAAE,CAAS,CAClB,CAAC;EACH;EAEAH,KAAK,CACHE,MAAM,EACLO,MAAM,IAAK;IACV,IAAIA,MAAM,IAAI,CAACL,KAAK,EAAE;MACpBC,KAAK,CAAC,CAAC;IACT,CAAC,MAAM,IAAI,CAACI,MAAM,EAAE;MAClBL,KAAK,EAAEI,IAAI,CAAC,CAAC;MACbJ,KAAK,GAAGM,SAAS;IACnB;EACF,CAAC,EACD;IAAEC,SAAS,EAAE;EAAK,CACpB,CAAC;EAEDZ,cAAc,CAAC,MAAM;IACnBK,KAAK,EAAEI,IAAI,CAAC,CAAC;EACf,CAAC,CAAC;AACJ"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { effectScope, reactive, ref, toRaw, watch } from "vue";
|
|
2
|
+
import bindThemeClass from "../../directives/theme-class.mjs";
|
|
3
|
+
import { configureOptions } from "./setting.mjs";
|
|
4
|
+
export const Y_THEME_PREFIX = 'y-theme';
|
|
5
|
+
export const YUYEON_THEME_KEY = Symbol.for('yuyeon.theme');
|
|
6
|
+
export function createThemeModule(options) {
|
|
7
|
+
const appMountedScope = effectScope();
|
|
8
|
+
const config = reactive(configureOptions(options));
|
|
9
|
+
const scheme = ref(config.scheme);
|
|
10
|
+
const mode = ref(config.mode);
|
|
11
|
+
const theme = ref(config.theme);
|
|
12
|
+
const themes = ref(config.themes);
|
|
13
|
+
const themeState = reactive({
|
|
14
|
+
scheme: scheme,
|
|
15
|
+
theme: theme,
|
|
16
|
+
themes: themes,
|
|
17
|
+
mode: mode
|
|
18
|
+
});
|
|
19
|
+
function install(app) {
|
|
20
|
+
app.directive('theme', bindThemeClass);
|
|
21
|
+
}
|
|
22
|
+
function bindTheme(yuyeon) {
|
|
23
|
+
console.log(toRaw(yuyeon.theme));
|
|
24
|
+
watch(theme, neo => {
|
|
25
|
+
const [lightTheme, darkTheme] = neo;
|
|
26
|
+
yuyeon.root.dataset.lightTheme = lightTheme;
|
|
27
|
+
yuyeon.root.dataset.darkTheme = darkTheme;
|
|
28
|
+
}, {
|
|
29
|
+
immediate: true
|
|
30
|
+
});
|
|
31
|
+
watch(scheme, neo => {
|
|
32
|
+
yuyeon.root.setAttribute('data-theme-scheme', neo);
|
|
33
|
+
}, {
|
|
34
|
+
immediate: true
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
function init(yuyeon) {
|
|
38
|
+
appMountedScope.run(() => {
|
|
39
|
+
bindTheme(yuyeon);
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
return {
|
|
43
|
+
install,
|
|
44
|
+
init,
|
|
45
|
+
scope: appMountedScope,
|
|
46
|
+
instance: themeState
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","names":["effectScope","reactive","ref","toRaw","watch","bindThemeClass","configureOptions","Y_THEME_PREFIX","YUYEON_THEME_KEY","Symbol","for","createThemeModule","options","appMountedScope","config","scheme","mode","theme","themes","themeState","install","app","directive","bindTheme","yuyeon","console","log","neo","lightTheme","darkTheme","root","dataset","immediate","setAttribute","init","run","scope","instance"],"sources":["../../../src/composables/theme/index.ts"],"sourcesContent":["import type { App } from 'vue';\r\nimport { effectScope, reactive, ref, toRaw, watch } from \"vue\";\r\n\r\nimport bindThemeClass from '../../directives/theme-class';\r\nimport { configureOptions, ThemeScheme } from \"./setting\";\r\nimport type { ThemeOptions } from \"./setting\";\r\n\r\nexport const Y_THEME_PREFIX = 'y-theme';\r\n\r\ninterface ThemeProvide {\r\n //\r\n}\r\n\r\nexport const YUYEON_THEME_KEY = Symbol.for('yuyeon.theme');\r\n\r\nexport function createThemeModule(options: ThemeOptions) {\r\n const appMountedScope = effectScope();\r\n const config = reactive(configureOptions(options));\r\n const scheme = ref(config.scheme);\r\n const mode = ref(config.mode);\r\n const theme = ref<[string, string]>(config.theme);\r\n const themes = ref(config.themes);\r\n const themeState = reactive({\r\n scheme: scheme,\r\n theme: theme,\r\n themes: themes,\r\n mode: mode,\r\n });\r\n\r\n function install(app: App) {\r\n app.directive('theme', bindThemeClass);\r\n }\r\n\r\n function bindTheme(yuyeon: any) {\r\n console.log(toRaw(yuyeon.theme))\r\n watch(\r\n theme,\r\n (neo) => {\r\n const [lightTheme, darkTheme] = neo;\r\n yuyeon.root.dataset.lightTheme = lightTheme;\r\n yuyeon.root.dataset.darkTheme = darkTheme;\r\n },\r\n { immediate: true },\r\n );\r\n watch(\r\n scheme,\r\n (neo: string) => {\r\n yuyeon.root.setAttribute('data-theme-scheme', neo);\r\n },\r\n { immediate: true },\r\n );\r\n }\r\n\r\n function init(yuyeon: any) {\r\n appMountedScope.run(() => {\r\n bindTheme(yuyeon);\r\n });\r\n }\r\n\r\n return {\r\n install,\r\n init,\r\n scope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UAAU;MAC3CJ,MAAM,CAACM,IAAI,CAACC,OAAO,CAACF,SAAS,GAAGA,SAAS;IAC3C,CAAC,EACD;MAAEG,SAAS,EAAE;IAAK,CACpB,CAAC;IACD5B,KAAK,CACHW,MAAM,EACLY,GAAW,IAAK;MACfH,MAAM,CAACM,IAAI,CAACG,YAAY,CAAC,mBAAmB,EAAEN,GAAG,CAAC;IACpD,CAAC,EACD;MAAEK,SAAS,EAAE;IAAK,CACpB,CAAC;EACH;EAEA,SAASE,IAAIA,CAACV,MAAW,EAAE;IACzBX,eAAe,CAACsB,GAAG,CAAC,MAAM;MACxBZ,SAAS,CAACC,MAAM,CAAC;IACnB,CAAC,CAAC;EACJ;EAEA,OAAO;IACLJ,OAAO;IACPc,IAAI;IACJE,KAAK,EAAEvB,eAAe;IACtBwB,QAAQ,EAAElB;EACZ,CAAC;AACH"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { mergeDeep } from "../../util/common.mjs";
|
|
2
|
+
export const ThemeScheme = {
|
|
3
|
+
light: 'light',
|
|
4
|
+
dark: 'dark'
|
|
5
|
+
};
|
|
6
|
+
export const defaultThemesValues = {
|
|
7
|
+
light: {
|
|
8
|
+
scheme: ThemeScheme.light,
|
|
9
|
+
colors: {
|
|
10
|
+
'app-background': '#ffffff',
|
|
11
|
+
'base-font': '#141414'
|
|
12
|
+
},
|
|
13
|
+
variables: {
|
|
14
|
+
'base-shadow-opacity': 0.14
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
dark: {
|
|
18
|
+
scheme: ThemeScheme.dark,
|
|
19
|
+
colors: {
|
|
20
|
+
'app-background': '#1e1e1e',
|
|
21
|
+
'base-font': '#fff'
|
|
22
|
+
},
|
|
23
|
+
variables: {
|
|
24
|
+
'base-shadow-opacity': 0.14
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
export function configureOptions(options) {
|
|
29
|
+
if (!options) {
|
|
30
|
+
return {
|
|
31
|
+
scheme: 'normal',
|
|
32
|
+
theme: ['light', 'dark'],
|
|
33
|
+
themes: {
|
|
34
|
+
...mergeDeep(defaultThemesValues)
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
return {
|
|
39
|
+
scheme: ThemeScheme.light,
|
|
40
|
+
theme: ['light', 'dark'],
|
|
41
|
+
themes: {
|
|
42
|
+
...mergeDeep(defaultThemesValues, options.themes)
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
//# sourceMappingURL=setting.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"setting.mjs","names":["mergeDeep","ThemeScheme","light","dark","defaultThemesValues","scheme","colors","variables","configureOptions","options","theme","themes"],"sources":["../../../src/composables/theme/setting.ts"],"sourcesContent":["import { mergeDeep } from \"../../util/common\";\r\n\r\nexport const ThemeScheme = {\r\n light: 'light',\r\n dark: 'dark',\r\n} as const;\r\n\r\nexport interface ThemeOptions {\r\n mode: 'manual';\r\n scheme: keyof typeof ThemeScheme | 'normal';\r\n theme: string | [string, string];\r\n themes: any;\r\n}\r\n\r\nexport const defaultThemesValues: any = {\r\n light: {\r\n scheme: ThemeScheme.light,\r\n colors: {\r\n 'app-background': '#ffffff',\r\n 'base-font': '#141414',\r\n },\r\n variables: {\r\n 'base-shadow-opacity': 0.14\r\n },\r\n },\r\n dark: {\r\n scheme: ThemeScheme.dark,\r\n colors: {\r\n 'app-background': '#1e1e1e',\r\n 'base-font': '#fff',\r\n },\r\n variables: {\r\n 'base-shadow-opacity': 0.14\r\n },\r\n },\r\n};\r\n\r\nexport function configureOptions (options?: ThemeOptions): any {\r\n if (!options) {\r\n return {\r\n scheme: 'normal',\r\n theme: ['light', 'dark'],\r\n themes: {...mergeDeep(defaultThemesValues)},\r\n }\r\n }\r\n return {\r\n scheme: ThemeScheme.light,\r\n theme: ['light', 'dark'],\r\n themes: {...mergeDeep(defaultThemesValues, options.themes)},\r\n }\r\n}\r\n"],"mappings":"SAASA,SAAS;AAElB,OAAO,MAAMC,WAAW,GAAG;EACzBC,KAAK,EAAE,OAAO;EACdC,IAAI,EAAE;AACR,CAAU;AASV,OAAO,MAAMC,mBAAwB,GAAG;EACtCF,KAAK,EAAE;IACLG,MAAM,EAAEJ,WAAW,CAACC,KAAK;IACzBI,MAAM,EAAE;MACN,gBAAgB,EAAE,SAAS;MAC3B,WAAW,EAAE;IACf,CAAC;IACDC,SAAS,EAAE;MACT,qBAAqB,EAAE;IACzB;EACF,CAAC;EACDJ,IAAI,EAAE;IACJE,MAAM,EAAEJ,WAAW,CAACE,IAAI;IACxBG,MAAM,EAAE;MACN,gBAAgB,EAAE,SAAS;MAC3B,WAAW,EAAE;IACf,CAAC;IACDC,SAAS,EAAE;MACT,qBAAqB,EAAE;IACzB;EACF;AACF,CAAC;AAED,OAAO,SAASC,gBAAgBA,CAAEC,OAAsB,EAAO;EAC7D,IAAI,CAACA,OAAO,EAAE;IACZ,OAAO;MACLJ,MAAM,EAAE,QAAQ;MAChBK,KAAK,EAAE,CAAC,OAAO,EAAE,MAAM,CAAC;MACxBC,MAAM,EAAE;QAAC,GAAGX,SAAS,CAACI,mBAAmB;MAAC;IAC5C,CAAC;EACH;EACA,OAAO;IACLC,MAAM,EAAEJ,WAAW,CAACC,KAAK;IACzBQ,KAAK,EAAE,CAAC,OAAO,EAAE,MAAM,CAAC;IACxBC,MAAM,EAAE;MAAC,GAAGX,SAAS,CAACI,mBAAmB,EAAEK,OAAO,CAACE,MAAM;IAAC;EAC5D,CAAC;AACH"}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { computed, ref, watch } from 'vue';
|
|
2
|
+
export function useLazy(eager, updated) {
|
|
3
|
+
const tick = ref(false);
|
|
4
|
+
const tack = ref();
|
|
5
|
+
tack.value = updated.value;
|
|
6
|
+
const lazyValue = computed(() => {
|
|
7
|
+
if (eager) return updated.value;
|
|
8
|
+
return tack.value;
|
|
9
|
+
});
|
|
10
|
+
watch(updated, () => {
|
|
11
|
+
if (!tick.value) {
|
|
12
|
+
tack.value = updated.value;
|
|
13
|
+
}
|
|
14
|
+
if (!eager) {
|
|
15
|
+
tick.value = true;
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
function onAfterUpdate() {
|
|
19
|
+
tack.value = updated.value;
|
|
20
|
+
if (!eager) {
|
|
21
|
+
tick.value = false;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
return {
|
|
25
|
+
entered: tick,
|
|
26
|
+
lazyValue,
|
|
27
|
+
onAfterUpdate
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
export function useTimer(cb) {
|
|
31
|
+
let duration = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1000;
|
|
32
|
+
let options = arguments.length > 2 ? arguments[2] : undefined;
|
|
33
|
+
const {
|
|
34
|
+
tickDuration
|
|
35
|
+
} = options ?? {};
|
|
36
|
+
let tickInterval = tickDuration ?? 100;
|
|
37
|
+
let timer = -1;
|
|
38
|
+
const tickStart = ref(0);
|
|
39
|
+
const drift = ref(duration);
|
|
40
|
+
const isWork = ref(false);
|
|
41
|
+
function tick() {
|
|
42
|
+
const now = Date.now();
|
|
43
|
+
const realTick = now - tickStart.value;
|
|
44
|
+
drift.value = drift.value - realTick;
|
|
45
|
+
if (drift.value < 1) {
|
|
46
|
+
cb();
|
|
47
|
+
} else {
|
|
48
|
+
const tickDrift = now - tickStart.value + tickInterval;
|
|
49
|
+
const nextInterval = tickDrift >= 1 ? tickDrift : tickInterval;
|
|
50
|
+
tickStart.value = now;
|
|
51
|
+
timer = window.setTimeout(tick, nextInterval);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
function start() {
|
|
55
|
+
if (isWork.value) return;
|
|
56
|
+
isWork.value = true;
|
|
57
|
+
tickStart.value = Date.now();
|
|
58
|
+
timer = window.setTimeout(tick, tickInterval);
|
|
59
|
+
}
|
|
60
|
+
function stop() {
|
|
61
|
+
window.clearTimeout(timer);
|
|
62
|
+
timer = -1;
|
|
63
|
+
isWork.value = false;
|
|
64
|
+
}
|
|
65
|
+
function reset() {
|
|
66
|
+
stop();
|
|
67
|
+
drift.value = duration;
|
|
68
|
+
}
|
|
69
|
+
return {
|
|
70
|
+
start,
|
|
71
|
+
stop,
|
|
72
|
+
reset,
|
|
73
|
+
drift,
|
|
74
|
+
isWork
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
//# sourceMappingURL=timing.mjs.map
|