pxd 0.0.64 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +21 -10
- package/dist/components/_internal/calendar-day.d.vue.ts +33 -0
- package/dist/components/_internal/calendar-day.vue +85 -0
- package/dist/components/_internal/dismiss-container.vue +68 -121
- package/dist/components/_internal/fragment-container.vue +3 -3
- package/dist/components/_internal/loading-mask.d.vue.ts +8 -0
- package/dist/components/_internal/loading-mask.vue +25 -0
- package/dist/components/_internal/mention-editor.d.vue.ts +42 -0
- package/dist/components/_internal/mention-editor.vue +114 -0
- package/dist/components/_internal/popover-arrow.vue +8 -5
- package/dist/components/_internal/tree-node.d.vue.ts +72 -0
- package/dist/components/_internal/tree-node.vue +260 -0
- package/dist/components/active-graph/index.d.vue.ts +2 -2
- package/dist/components/active-graph/index.vue +381 -239
- package/dist/components/active-graph/types.d.ts +2 -1
- package/dist/components/approval-card/index.d.vue.ts +28 -0
- package/dist/components/approval-card/index.vue +235 -0
- package/dist/components/approval-card/types.d.ts +37 -0
- package/dist/components/avatar/index.d.vue.ts +2 -2
- package/dist/components/avatar/index.vue +43 -72
- package/dist/components/avatar-group/index.d.vue.ts +1 -1
- package/dist/components/avatar-group/index.vue +38 -25
- package/dist/components/backtop/index.d.vue.ts +10 -3
- package/dist/components/backtop/index.vue +97 -54
- package/dist/components/backtop/types.d.ts +10 -3
- package/dist/components/badge/index.d.vue.ts +6 -3
- package/dist/components/badge/index.vue +126 -79
- package/dist/components/badge/types.d.ts +3 -2
- package/dist/components/book/index.vue +57 -162
- package/dist/components/border-beam/index.d.vue.ts +18 -0
- package/dist/components/border-beam/index.vue +64 -0
- package/dist/components/border-beam/types.d.ts +8 -0
- package/dist/components/{resizable-panel → breadcrumb}/index.d.vue.ts +3 -4
- package/dist/components/breadcrumb/index.vue +32 -0
- package/dist/components/breadcrumb/types.d.ts +6 -0
- package/dist/components/breadcrumb-item/index.d.vue.ts +16 -0
- package/dist/components/breadcrumb-item/index.vue +50 -0
- package/dist/components/breadcrumb-item/types.d.ts +4 -0
- package/dist/components/browser/index.d.vue.ts +2 -2
- package/dist/components/browser/index.vue +13 -28
- package/dist/components/bubble/index.d.vue.ts +6 -3
- package/dist/components/bubble/index.vue +85 -18
- package/dist/components/bubble/types.d.ts +3 -1
- package/dist/components/bubble-group/index.d.vue.ts +19 -0
- package/dist/components/bubble-group/index.vue +86 -0
- package/dist/components/bubble-group/types.d.ts +6 -0
- package/dist/components/bubble-group/types.js +0 -0
- package/dist/components/button/index.d.vue.ts +2 -1
- package/dist/components/button/index.vue +121 -86
- package/dist/components/button-group/index.vue +20 -7
- package/dist/components/calendar/index.d.vue.ts +41 -0
- package/dist/components/calendar/index.vue +247 -0
- package/dist/components/calendar/types.d.ts +37 -0
- package/dist/components/card/index.d.vue.ts +21 -0
- package/dist/components/card/index.vue +47 -0
- package/dist/components/card/types.d.ts +6 -0
- package/dist/components/carousel/index.d.vue.ts +8 -4
- package/dist/components/carousel/index.vue +232 -283
- package/dist/components/carousel/types.d.ts +15 -1
- package/dist/components/checkbox/index.d.vue.ts +6 -5
- package/dist/components/checkbox/index.vue +107 -90
- package/dist/components/checkbox/types.d.ts +6 -4
- package/dist/components/checkbox-group/index.d.vue.ts +6 -6
- package/dist/components/checkbox-group/index.vue +26 -11
- package/dist/components/checkbox-group/types.d.ts +3 -1
- package/dist/components/checkerboard/index.d.vue.ts +14 -0
- package/dist/components/checkerboard/index.vue +37 -0
- package/dist/components/checkerboard/types.d.ts +5 -0
- package/dist/components/chip/index.d.vue.ts +3 -1
- package/dist/components/chip/index.vue +49 -46
- package/dist/components/choicebox/index.d.vue.ts +7 -7
- package/dist/components/choicebox/index.vue +52 -30
- package/dist/components/choicebox-item/index.d.vue.ts +7 -5
- package/dist/components/choicebox-item/index.vue +172 -53
- package/dist/components/choicebox-item/types.d.ts +3 -7
- package/dist/components/collapse/index.d.vue.ts +2 -2
- package/dist/components/collapse/index.vue +72 -98
- package/dist/components/collapse-group/index.vue +43 -32
- package/dist/components/color-selector/index.vue +45 -41
- package/dist/components/command-menu/index.d.vue.ts +10 -7
- package/dist/components/command-menu/index.vue +103 -45
- package/dist/components/command-menu/types.d.ts +3 -2
- package/dist/components/config-provider/index.d.vue.ts +77 -3
- package/dist/components/config-provider/index.vue +54 -11
- package/dist/components/config-provider/types.d.ts +5 -3
- package/dist/components/copy-button/index.d.vue.ts +24 -0
- package/dist/components/copy-button/index.vue +40 -0
- package/dist/components/copy-button/types.d.ts +7 -0
- package/dist/components/countdown/index.d.vue.ts +1 -1
- package/dist/components/countdown/index.vue +77 -29
- package/dist/components/dash-line/index.d.vue.ts +2 -1
- package/dist/components/dash-line/index.vue +78 -76
- package/dist/components/date-picker/index.d.vue.ts +16 -0
- package/dist/components/date-picker/index.vue +295 -0
- package/dist/components/date-picker/types.d.ts +20 -0
- package/dist/components/description/index.vue +16 -7
- package/dist/components/drawer/index.d.vue.ts +5 -5
- package/dist/components/drawer/index.vue +138 -67
- package/dist/components/drawer/types.d.ts +1 -0
- package/dist/components/effort-slider/index.d.vue.ts +10 -0
- package/dist/components/effort-slider/index.vue +347 -0
- package/dist/components/effort-slider/types.d.ts +14 -0
- package/dist/components/ellipsis-text/index.d.vue.ts +1 -1
- package/dist/components/ellipsis-text/index.vue +208 -165
- package/dist/components/empty-state/index.vue +11 -4
- package/dist/components/error/index.d.vue.ts +3 -1
- package/dist/components/error/index.vue +42 -28
- package/dist/components/error/types.d.ts +1 -0
- package/dist/components/fader/index.d.vue.ts +1 -1
- package/dist/components/fader/index.vue +56 -112
- package/dist/components/fader/types.d.ts +2 -1
- package/dist/components/feedback-bar/index.d.vue.ts +12 -0
- package/dist/components/feedback-bar/index.vue +81 -0
- package/dist/components/feedback-bar/types.d.ts +9 -0
- package/dist/components/gauge/index.vue +89 -69
- package/dist/components/grid/index.vue +58 -52
- package/dist/components/grid-item/index.vue +44 -39
- package/dist/components/hold-button/index.vue +111 -115
- package/dist/components/hue-text/index.d.vue.ts +16 -0
- package/dist/components/hue-text/index.vue +48 -0
- package/dist/components/hue-text/types.d.ts +4 -0
- package/dist/components/index.d.ts +40 -5
- package/dist/components/index.js +40 -5
- package/dist/components/input/index.d.vue.ts +5 -4
- package/dist/components/input/index.vue +250 -134
- package/dist/components/input/types.d.ts +9 -6
- package/dist/components/intersection-observer/index.vue +65 -42
- package/dist/components/kbd/index.vue +45 -23
- package/dist/components/label/index.vue +7 -3
- package/dist/components/link-button/index.vue +49 -32
- package/dist/components/list/index.d.vue.ts +22 -14
- package/dist/components/list/index.vue +238 -77
- package/dist/components/list/types.d.ts +39 -11
- package/dist/components/list-group/index.d.vue.ts +4 -0
- package/dist/components/list-group/index.vue +22 -0
- package/dist/components/list-group/types.d.ts +5 -0
- package/dist/components/list-item/index.d.vue.ts +7 -7
- package/dist/components/list-item/index.vue +78 -76
- package/dist/components/list-item/types.d.ts +7 -4
- package/dist/components/loading-bar/index.vue +152 -145
- package/dist/components/loading-dots/index.d.vue.ts +1 -13
- package/dist/components/loading-dots/index.vue +13 -15
- package/dist/components/marching-ants/index.d.vue.ts +25 -0
- package/dist/components/marching-ants/index.vue +486 -0
- package/dist/components/marching-ants/types.d.ts +9 -0
- package/dist/components/marquee/index.d.vue.ts +37 -0
- package/dist/components/marquee/index.vue +242 -0
- package/dist/components/marquee/types.d.ts +18 -0
- package/dist/components/material/index.vue +22 -28
- package/dist/components/mention/index.d.vue.ts +38 -0
- package/dist/components/mention/index.vue +251 -0
- package/dist/components/mention/types.d.ts +35 -0
- package/dist/components/menu/index.d.vue.ts +17 -10
- package/dist/components/menu/index.vue +98 -27
- package/dist/components/menu/types.d.ts +7 -5
- package/dist/components/message/composables/use-group-expand.js +1 -1
- package/dist/components/message/composables/use-message-timer.js +2 -1
- package/dist/components/message/composables/use-promise-message.js +4 -4
- package/dist/components/message/index.d.vue.ts +7 -7
- package/dist/components/message/index.vue +141 -234
- package/dist/components/message-item/index.vue +50 -62
- package/dist/components/modal/index.d.vue.ts +4 -4
- package/dist/components/modal/index.vue +125 -63
- package/dist/components/modal/types.d.ts +1 -3
- package/dist/components/more-button/index.vue +25 -13
- package/dist/components/noise-background/index.d.vue.ts +0 -16
- package/dist/components/noise-background/index.vue +70 -9
- package/dist/components/noise-background/types.d.ts +4 -0
- package/dist/components/note/index.d.vue.ts +1 -1
- package/dist/components/note/index.vue +108 -98
- package/dist/components/note/types.d.ts +1 -0
- package/dist/components/number-input/index.d.vue.ts +1 -3
- package/dist/components/number-input/index.vue +196 -161
- package/dist/components/number-input/types.d.ts +1 -2
- package/dist/components/overlay/index.d.vue.ts +2 -2
- package/dist/components/overlay/index.vue +110 -68
- package/dist/components/page-number/index.d.vue.ts +18 -0
- package/dist/components/page-number/index.vue +232 -0
- package/dist/components/page-number/types.d.ts +18 -0
- package/dist/components/pagination/index.vue +14 -7
- package/dist/components/pin-input/index.d.vue.ts +2 -2
- package/dist/components/pin-input/index.vue +191 -173
- package/dist/components/placeholder/index.vue +22 -32
- package/dist/components/popover/index.d.vue.ts +0 -47
- package/dist/components/popover/index.vue +528 -345
- package/dist/components/popover/types.d.ts +7 -0
- package/dist/components/progress/index.d.vue.ts +2 -8
- package/dist/components/progress/index.vue +84 -62
- package/dist/components/progress/types.d.ts +0 -5
- package/dist/components/project-banner/index.d.vue.ts +3 -1
- package/dist/components/project-banner/index.vue +36 -34
- package/dist/components/project-banner/types.d.ts +1 -1
- package/dist/components/questionnaire/index.d.vue.ts +10 -0
- package/dist/components/questionnaire/index.vue +353 -0
- package/dist/components/questionnaire/types.d.ts +30 -0
- package/dist/components/radial-burst/index.d.vue.ts +14 -0
- package/dist/components/radial-burst/index.vue +53 -0
- package/dist/components/radial-burst/types.d.ts +5 -0
- package/dist/components/radio/index.d.vue.ts +4 -4
- package/dist/components/radio/index.vue +56 -74
- package/dist/components/radio-group/index.d.vue.ts +4 -4
- package/dist/components/radio-group/index.vue +26 -12
- package/dist/components/rating/index.d.vue.ts +17 -0
- package/dist/components/rating/index.vue +253 -0
- package/dist/components/rating/types.d.ts +18 -0
- package/dist/components/reasoning/index.d.vue.ts +16 -0
- package/dist/components/reasoning/index.vue +68 -0
- package/dist/components/reasoning/types.d.ts +3 -0
- package/dist/components/resizable/index.d.vue.ts +27 -4
- package/dist/components/resizable/index.vue +404 -158
- package/dist/components/resizable/types.d.ts +20 -13
- package/dist/components/resizable/utils.d.ts +4 -0
- package/dist/components/resizable/utils.js +10 -0
- package/dist/components/reveal/index.d.vue.ts +22 -0
- package/dist/components/reveal/index.vue +100 -0
- package/dist/components/reveal/types.d.ts +15 -0
- package/dist/components/rolling-number/index.d.vue.ts +17 -0
- package/dist/components/rolling-number/index.vue +252 -0
- package/dist/components/rolling-number/types.d.ts +11 -0
- package/dist/components/scalable-text/index.vue +113 -110
- package/dist/components/scroll-progress/index.d.vue.ts +22 -0
- package/dist/components/scroll-progress/index.vue +75 -0
- package/dist/components/scroll-progress/types.d.ts +9 -0
- package/dist/components/scroll-text/index.d.vue.ts +18 -0
- package/dist/components/scroll-text/index.vue +123 -0
- package/dist/components/scroll-text/types.d.ts +7 -0
- package/dist/components/scrollable/index.d.vue.ts +3 -3
- package/dist/components/scrollable/index.vue +281 -222
- package/dist/components/search-input/index.d.vue.ts +152 -0
- package/dist/components/search-input/index.vue +55 -0
- package/dist/components/search-input/types.d.ts +7 -0
- package/dist/components/select/index.d.vue.ts +33 -0
- package/dist/components/select/index.vue +134 -0
- package/dist/components/select/types.d.ts +23 -0
- package/dist/components/separator/index.vue +9 -6
- package/dist/components/shimmer-text/index.d.vue.ts +18 -0
- package/dist/components/shimmer-text/index.vue +216 -0
- package/dist/components/shimmer-text/types.d.ts +14 -0
- package/dist/components/skeleton/index.d.vue.ts +2 -2
- package/dist/components/skeleton/index.vue +59 -51
- package/dist/components/slider/index.d.vue.ts +2 -2
- package/dist/components/slider/index.vue +391 -261
- package/dist/components/slider/types.d.ts +3 -1
- package/dist/components/snippet/index.d.vue.ts +2 -1
- package/dist/components/snippet/index.vue +80 -69
- package/dist/components/snippet/types.d.ts +3 -3
- package/dist/components/spinner/index.vue +9 -8
- package/dist/components/spinner-dots/index.d.vue.ts +7 -0
- package/dist/components/spinner-dots/index.vue +232 -0
- package/dist/components/spinner-dots/types.d.ts +9 -0
- package/dist/components/split-button/index.d.vue.ts +31 -0
- package/dist/components/split-button/index.vue +93 -0
- package/dist/components/split-button/types.d.ts +18 -0
- package/dist/components/stack/index.d.vue.ts +1 -1
- package/dist/components/stack/index.vue +98 -84
- package/dist/components/status-dot/index.d.vue.ts +1 -1
- package/dist/components/status-dot/index.vue +34 -20
- package/dist/components/steps/index.d.vue.ts +28 -0
- package/dist/components/steps/index.vue +143 -0
- package/dist/components/steps/step-item.d.vue.ts +24 -0
- package/dist/components/steps/step-item.vue +86 -0
- package/dist/components/steps/types.d.ts +25 -0
- package/dist/components/stick-to-bottom/index.d.vue.ts +35 -0
- package/dist/components/stick-to-bottom/index.vue +78 -0
- package/dist/components/stick-to-bottom/types.d.ts +13 -0
- package/dist/components/swipe-cell/index.d.vue.ts +53 -0
- package/dist/components/swipe-cell/index.vue +412 -0
- package/dist/components/swipe-cell/instances.d.ts +7 -0
- package/dist/components/swipe-cell/instances.js +17 -0
- package/dist/components/swipe-cell/types.d.ts +52 -0
- package/dist/components/switch/index.d.vue.ts +1 -1
- package/dist/components/switch/index.vue +42 -21
- package/dist/components/switch-item/index.vue +36 -37
- package/dist/components/tabs/index.d.vue.ts +8 -6
- package/dist/components/tabs/index.vue +242 -196
- package/dist/components/tabs/tab-slot.d.ts +24 -0
- package/dist/components/tabs/tab-slot.js +13 -0
- package/dist/components/tabs/types.d.ts +11 -5
- package/dist/components/teleport/index.vue +69 -60
- package/dist/components/text/index.d.vue.ts +1 -1
- package/dist/components/text/index.vue +68 -57
- package/dist/components/textarea/index.d.vue.ts +7 -5
- package/dist/components/textarea/index.vue +148 -71
- package/dist/components/textarea/types.d.ts +5 -2
- package/dist/components/theme-switcher/index.d.vue.ts +2 -2
- package/dist/components/theme-switcher/index.vue +8 -12
- package/dist/components/time-picker/index.d.vue.ts +7 -8
- package/dist/components/time-picker/index.vue +246 -183
- package/dist/components/time-picker/types.d.ts +7 -7
- package/dist/components/timeline/index.d.vue.ts +6 -0
- package/dist/components/timeline/index.vue +52 -0
- package/dist/components/timeline/types.d.ts +6 -0
- package/dist/components/timeline-item/index.d.vue.ts +22 -0
- package/dist/components/timeline-item/index.vue +110 -0
- package/dist/components/timeline-item/types.d.ts +16 -0
- package/dist/components/toc/index.d.vue.ts +37 -0
- package/dist/components/toc/index.vue +199 -0
- package/dist/components/toc/types.d.ts +28 -0
- package/dist/components/todo-list/index.d.vue.ts +64 -0
- package/dist/components/todo-list/index.vue +357 -0
- package/dist/components/todo-list/types.d.ts +53 -0
- package/dist/components/toggle/index.d.vue.ts +6 -6
- package/dist/components/toggle/index.vue +92 -41
- package/dist/components/toggle/types.d.ts +1 -1
- package/dist/components/toggle-button/index.d.vue.ts +5 -5
- package/dist/components/toggle-button/index.vue +120 -84
- package/dist/components/toggle-button/types.d.ts +6 -4
- package/dist/components/toggle-button-group/index.d.vue.ts +7 -6
- package/dist/components/toggle-button-group/index.vue +63 -43
- package/dist/components/tool-call/index.d.vue.ts +6 -0
- package/dist/components/tool-call/index.vue +209 -0
- package/dist/components/tool-call/types.d.ts +8 -0
- package/dist/components/tooltip/index.d.vue.ts +5 -2
- package/dist/components/tooltip/index.vue +105 -50
- package/dist/components/tooltip/types.d.ts +1 -0
- package/dist/components/tree/index.d.vue.ts +108 -0
- package/dist/components/tree/index.vue +684 -0
- package/dist/components/tree/types.d.ts +126 -0
- package/dist/components/virtual-list/index.d.vue.ts +7 -9
- package/dist/components/virtual-list/index.vue +120 -54
- package/dist/components/virtual-list/types.d.ts +0 -1
- package/dist/composables/_internal/use-collapse-motion.d.ts +6 -0
- package/dist/composables/_internal/use-collapse-motion.js +85 -0
- package/dist/composables/{use-focus-trap.d.ts → _internal/use-focus-trap.d.ts} +2 -2
- package/dist/composables/_internal/use-focus-trap.js +64 -0
- package/dist/composables/{use-forward-ref-expose.js → _internal/use-forward-ref-expose.js} +1 -1
- package/dist/composables/_internal/use-list-filter.d.ts +15 -0
- package/dist/composables/_internal/use-list-filter.js +48 -0
- package/dist/composables/_internal/use-list-keyboard-controller.d.ts +21 -0
- package/dist/composables/_internal/use-list-keyboard-controller.js +27 -0
- package/dist/composables/_internal/use-list-navigation.d.ts +25 -0
- package/dist/composables/_internal/use-list-navigation.js +141 -0
- package/dist/composables/_internal/use-list-rows.d.ts +29 -0
- package/dist/composables/_internal/use-list-rows.js +58 -0
- package/dist/composables/_internal/use-list-selection.d.ts +23 -0
- package/dist/composables/_internal/use-list-selection.js +41 -0
- package/dist/composables/_internal/use-lock-scroll.js +57 -0
- package/dist/composables/_internal/use-mention-editor.d.ts +35 -0
- package/dist/composables/_internal/use-mention-editor.js +508 -0
- package/dist/composables/_internal/use-mention-suggest.d.ts +23 -0
- package/dist/composables/_internal/use-mention-suggest.js +113 -0
- package/dist/composables/{use-model-value.d.ts → _internal/use-model-value.d.ts} +1 -1
- package/dist/composables/_internal/use-model-value.js +13 -0
- package/dist/composables/_internal/use-motion-reduce.d.ts +6 -0
- package/dist/composables/_internal/use-motion-reduce.js +40 -0
- package/dist/composables/_internal/use-overlay-dialog.d.ts +25 -0
- package/dist/composables/_internal/use-overlay-dialog.js +25 -0
- package/dist/composables/{use-overlay-manager.js → _internal/use-overlay-manager.js} +2 -2
- package/dist/composables/{use-popover-responsive.js → _internal/use-popover-responsive.js} +1 -1
- package/dist/composables/_internal/use-selected-list-item.d.ts +6 -0
- package/dist/composables/_internal/use-selected-list-item.js +36 -0
- package/dist/composables/_internal/use-swipe-gesture.d.ts +88 -0
- package/dist/composables/_internal/use-swipe-gesture.js +345 -0
- package/dist/composables/_internal/use-tailwind-variant.d.ts +31 -0
- package/dist/composables/_internal/use-tailwind-variant.js +62 -0
- package/dist/composables/_internal/use-tree-drag.d.ts +23 -0
- package/dist/composables/_internal/use-tree-drag.js +196 -0
- package/dist/composables/_internal/use-tree-move.d.ts +20 -0
- package/dist/composables/_internal/use-tree-move.js +96 -0
- package/dist/composables/_internal/use-tree-rows.d.ts +46 -0
- package/dist/composables/_internal/use-tree-rows.js +101 -0
- package/dist/composables/_internal/use-tree-selection.d.ts +22 -0
- package/dist/composables/_internal/use-tree-selection.js +87 -0
- package/dist/composables/_internal/use-word-limit.d.ts +24 -0
- package/dist/composables/_internal/use-word-limit.js +36 -0
- package/dist/composables/index.d.ts +7 -10
- package/dist/composables/index.js +7 -10
- package/dist/composables/use-backoff-retry.d.ts +51 -0
- package/dist/composables/use-backoff-retry.js +116 -0
- package/dist/composables/use-color-scheme.js +28 -25
- package/dist/composables/use-copy-click.d.ts +2 -1
- package/dist/composables/use-copy-click.js +21 -18
- package/dist/composables/use-countdown.d.ts +0 -9
- package/dist/composables/use-countdown.js +12 -4
- package/dist/composables/use-deferred-value.js +1 -1
- package/dist/composables/use-delay-change.js +6 -2
- package/dist/composables/use-delay-destroy.d.ts +1 -1
- package/dist/composables/use-delay-destroy.js +16 -9
- package/dist/composables/use-intersection-observer.d.ts +6 -0
- package/dist/composables/use-intersection-observer.js +38 -0
- package/dist/composables/use-media-query.d.ts +0 -3
- package/dist/composables/use-media-query.js +19 -19
- package/dist/composables/use-mutation-observer.d.ts +6 -0
- package/dist/composables/use-mutation-observer.js +42 -0
- package/dist/composables/use-outside-click.d.ts +6 -4
- package/dist/composables/use-outside-click.js +18 -10
- package/dist/composables/use-repeat-action.js +31 -20
- package/dist/composables/use-resize-observer.d.ts +6 -0
- package/dist/composables/use-resize-observer.js +22 -0
- package/dist/composables/use-scrollspy.d.ts +15 -0
- package/dist/composables/use-scrollspy.js +98 -0
- package/dist/composables/use-stick-to-bottom.d.ts +32 -0
- package/dist/composables/use-stick-to-bottom.js +106 -0
- package/dist/composables/use-view-transition.d.ts +20 -0
- package/dist/composables/use-view-transition.js +79 -0
- package/dist/composables/use-virtual-list.d.ts +8 -5
- package/dist/composables/use-virtual-list.js +86 -19
- package/dist/contexts/breadcrumb.d.ts +2 -0
- package/dist/contexts/breadcrumb.js +2 -0
- package/dist/contexts/choicebox.d.ts +1 -0
- package/dist/contexts/config-provider.d.ts +3 -2
- package/dist/contexts/config-provider.js +4 -3
- package/dist/contexts/list.d.ts +4 -25
- package/dist/contexts/list.js +0 -8
- package/dist/locales/en-us.d.ts +56 -28
- package/dist/locales/en-us.js +56 -28
- package/dist/locales/index.d.ts +1 -0
- package/dist/locales/zh-cn.d.ts +55 -28
- package/dist/locales/zh-cn.js +69 -28
- package/dist/plugins/dayjs-millisecond-token.d.ts +2 -4
- package/dist/plugins/dayjs-millisecond-token.js +1 -2
- package/dist/styles/source.css +55 -20
- package/dist/styles/styles.css +2 -2
- package/dist/styles/tw.css +54 -20
- package/dist/types/shared/props.d.ts +5 -3
- package/dist/types/shared/utils.d.ts +7 -0
- package/dist/utils/context.js +2 -1
- package/dist/utils/date.d.ts +1 -15
- package/dist/utils/date.js +2 -11
- package/dist/utils/dom.d.ts +19 -21
- package/dist/utils/dom.js +57 -28
- package/dist/utils/event.d.ts +14 -2
- package/dist/utils/event.js +65 -27
- package/dist/utils/format.d.ts +5 -4
- package/dist/utils/format.js +33 -13
- package/dist/utils/fuzzy-match.d.ts +2 -0
- package/dist/utils/fuzzy-match.js +182 -0
- package/dist/utils/helper.d.ts +17 -0
- package/dist/utils/helper.js +57 -0
- package/dist/utils/is.d.ts +5 -1
- package/dist/utils/is.js +10 -2
- package/dist/utils/mention-html.d.ts +33 -0
- package/dist/utils/mention-html.js +146 -0
- package/dist/utils/merge.d.ts +1 -0
- package/dist/utils/merge.js +19 -0
- package/dist/utils/observer.d.ts +42 -0
- package/dist/utils/observer.js +173 -0
- package/dist/utils/timing.d.ts +19 -6
- package/dist/utils/timing.js +74 -16
- package/package.json +48 -37
- package/volar.d.ts +40 -5
- package/dist/components/carousel-item/index.d.vue.ts +0 -13
- package/dist/components/carousel-item/index.vue +0 -54
- package/dist/components/command-menu-group/index.d.vue.ts +0 -14
- package/dist/components/command-menu-group/index.vue +0 -31
- package/dist/components/command-menu-group/types.d.ts +0 -5
- package/dist/components/resizable-handle/index.d.vue.ts +0 -6
- package/dist/components/resizable-handle/index.vue +0 -116
- package/dist/components/resizable-panel/index.vue +0 -57
- package/dist/components/resizable-panel/types.d.ts +0 -4
- package/dist/components/tabs-item/index.d.vue.ts +0 -4
- package/dist/components/tabs-item/index.vue +0 -16
- package/dist/components/tabs-item/types.d.ts +0 -10
- package/dist/composables/use-browser-observer.d.ts +0 -12
- package/dist/composables/use-browser-observer.js +0 -74
- package/dist/composables/use-focus-trap.js +0 -54
- package/dist/composables/use-list-filter.d.ts +0 -11
- package/dist/composables/use-list-filter.js +0 -56
- package/dist/composables/use-list-navigation.d.ts +0 -27
- package/dist/composables/use-list-navigation.js +0 -159
- package/dist/composables/use-lock-scroll.js +0 -37
- package/dist/composables/use-model-value.js +0 -13
- package/dist/composables/use-swipe-gesture.d.ts +0 -65
- package/dist/composables/use-swipe-gesture.js +0 -98
- package/dist/contexts/carousel.d.ts +0 -14
- package/dist/contexts/carousel.js +0 -2
- package/dist/contexts/resizable.d.ts +0 -27
- package/dist/contexts/resizable.js +0 -2
- package/dist/contexts/tabs.d.ts +0 -15
- package/dist/contexts/tabs.js +0 -2
- package/dist/plugins/any-touch.d.ts +0 -213
- package/dist/plugins/any-touch.js +0 -592
- package/dist/utils/fuzzy-search.d.ts +0 -7
- package/dist/utils/fuzzy-search.js +0 -61
- package/dist/utils/get.d.ts +0 -9
- package/dist/utils/get.js +0 -55
- package/dist/utils/index.d.ts +0 -10
- package/dist/utils/index.js +0 -10
- package/dist/utils/ref.d.ts +0 -5
- package/dist/utils/ref.js +0 -8
- package/dist/utils/uid.d.ts +0 -1
- package/dist/utils/uid.js +0 -4
- /package/dist/composables/{use-forward-ref-expose.d.ts → _internal/use-forward-ref-expose.d.ts} +0 -0
- /package/dist/composables/{use-lock-scroll.d.ts → _internal/use-lock-scroll.d.ts} +0 -0
- /package/dist/composables/{use-overlay-manager.d.ts → _internal/use-overlay-manager.d.ts} +0 -0
- /package/dist/composables/{use-popover-responsive.d.ts → _internal/use-popover-responsive.d.ts} +0 -0
package/dist/utils/date.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import dayjs from "dayjs/esm/index.js";
|
|
2
2
|
import dayjsDurationPlugin from "dayjs/esm/plugin/duration/index.js";
|
|
3
|
-
import dayjsMillisecondTokenPlugin from "../plugins/dayjs-millisecond-token.js";
|
|
3
|
+
import { dayjsMillisecondTokenPlugin } from "../plugins/dayjs-millisecond-token.js";
|
|
4
4
|
export { dayjs, dayjsDurationPlugin, dayjsMillisecondTokenPlugin };
|
|
5
5
|
export function getAllDatesBetween(startDate, endDate, format = "string") {
|
|
6
6
|
const start = dayjs(startDate);
|
|
7
7
|
const end = dayjs(endDate);
|
|
8
8
|
if (!start.isValid() || !end.isValid()) {
|
|
9
|
-
throw new TypeError("
|
|
9
|
+
throw new TypeError("Invalid date input");
|
|
10
10
|
}
|
|
11
11
|
const startDateNormalized = start.isAfter(end) ? end : start;
|
|
12
12
|
const endDateNormalized = start.isAfter(end) ? start : end;
|
|
@@ -34,12 +34,3 @@ export function getAllDatesBetween(startDate, endDate, format = "string") {
|
|
|
34
34
|
dates: formattedDates
|
|
35
35
|
};
|
|
36
36
|
}
|
|
37
|
-
export function getMonthDays(year, month) {
|
|
38
|
-
const firstDay = dayjs().year(year).month(month - 1).date(1);
|
|
39
|
-
const lastDay = firstDay.endOf("month");
|
|
40
|
-
return {
|
|
41
|
-
days: lastDay.date(),
|
|
42
|
-
firstDay: firstDay.day(),
|
|
43
|
-
lastDay: lastDay.day()
|
|
44
|
-
};
|
|
45
|
-
}
|
package/dist/utils/dom.d.ts
CHANGED
|
@@ -1,16 +1,14 @@
|
|
|
1
|
-
|
|
1
|
+
import type { ComponentPublicInstance, MaybeRefOrGetter } from 'vue';
|
|
2
|
+
type ElementType = null | string | object | SVGElement | HTMLElement | ComponentPublicInstance;
|
|
3
|
+
export declare function getStyle(el: HTMLElement): CSSStyleDeclaration;
|
|
4
|
+
export declare function getElement(el?: MaybeRefOrGetter<ElementType>, from?: MaybeRefOrGetter<HTMLElement>): HTMLElement | null;
|
|
5
|
+
/** Whether the element scrolls with the viewport instead of scrolling on its own. */
|
|
6
|
+
export declare function isViewportScroll(el: HTMLElement): boolean;
|
|
7
|
+
/** Viewport-relative top offset for scrollspy */
|
|
8
|
+
export declare function getElementOffsetFromScrollContainer(element: Element, scrollContainer: HTMLElement): {
|
|
2
9
|
top: number;
|
|
3
|
-
bottom: number;
|
|
4
10
|
left: number;
|
|
5
|
-
right: number;
|
|
6
|
-
width: number;
|
|
7
|
-
height: number;
|
|
8
|
-
scrollTop: number;
|
|
9
|
-
scrollBottom: number;
|
|
10
|
-
scrollLeft: number;
|
|
11
|
-
scrollRight: number;
|
|
12
11
|
};
|
|
13
|
-
export declare function getStyle(el: HTMLElement): CSSStyleDeclaration;
|
|
14
12
|
export declare function isScrollable(el: HTMLElement): {
|
|
15
13
|
x: boolean;
|
|
16
14
|
y: boolean;
|
|
@@ -19,24 +17,24 @@ export declare function hasScrollbar(el: HTMLElement): {
|
|
|
19
17
|
x: boolean;
|
|
20
18
|
y: boolean;
|
|
21
19
|
};
|
|
22
|
-
export declare function
|
|
23
|
-
export declare function
|
|
20
|
+
export declare function getScrollTarget(el: HTMLElement, isHorizontal?: boolean): Window | HTMLElement;
|
|
21
|
+
export declare function getScrollElement(target?: Window | Document | HTMLElement | null): HTMLElement;
|
|
22
|
+
/** Event target for scroll listeners. Document scrolling fires on `window`, not `documentElement`. */
|
|
23
|
+
export declare function getScrollListener(target?: Window | Document | HTMLElement | null): HTMLElement | (Window & typeof globalThis);
|
|
24
|
+
export declare function getScrollPosition(el: HTMLElement | Window | Document): {
|
|
24
25
|
scrollTop: number;
|
|
25
26
|
scrollLeft: number;
|
|
26
27
|
scrollWidth: number;
|
|
27
28
|
scrollHeight: number;
|
|
29
|
+
clientWidth: number;
|
|
30
|
+
clientHeight: number;
|
|
28
31
|
};
|
|
29
|
-
export declare function
|
|
30
|
-
export interface ScrollbarSize {
|
|
32
|
+
export declare function getScrollbarSize(element?: HTMLElement): {
|
|
31
33
|
width: number;
|
|
32
34
|
height: number;
|
|
33
|
-
}
|
|
34
|
-
/**
|
|
35
|
-
* 获取滚动条尺寸(宽度和高度)
|
|
36
|
-
* @param element - 要测量的元素,默认为document.body
|
|
37
|
-
* @returns 包含滚动条宽度和高度的对象
|
|
38
|
-
*/
|
|
39
|
-
export declare function getScrollbarSize(element?: HTMLElement): ScrollbarSize;
|
|
35
|
+
};
|
|
40
36
|
export declare function getViewportRect(): DOMRect;
|
|
41
37
|
export declare function isOverflowScrollable(ele: Element): boolean;
|
|
42
38
|
export declare function awaitAnimationEnd(element?: Element): Promise<void>;
|
|
39
|
+
export declare function resolveScrollBehavior(behavior: ScrollBehavior, prefersMotionReduce?: MaybeRefOrGetter<boolean>): ScrollBehavior;
|
|
40
|
+
export {};
|
package/dist/utils/dom.js
CHANGED
|
@@ -1,29 +1,44 @@
|
|
|
1
|
+
import { toValue } from "./helper.js";
|
|
1
2
|
import { isServer } from "./is.js";
|
|
2
3
|
function getWindowTop() {
|
|
3
4
|
return [window, document, document.documentElement];
|
|
4
5
|
}
|
|
5
|
-
export function getElementRectFromContainer(elementOrRect, viewportOrRect) {
|
|
6
|
-
const selfRect = elementOrRect instanceof Element ? elementOrRect.getBoundingClientRect() : elementOrRect;
|
|
7
|
-
const wrapRect = viewportOrRect instanceof Element ? viewportOrRect.getBoundingClientRect() : viewportOrRect;
|
|
8
|
-
return {
|
|
9
|
-
top: selfRect.top,
|
|
10
|
-
bottom: selfRect.bottom,
|
|
11
|
-
left: selfRect.left,
|
|
12
|
-
right: selfRect.right,
|
|
13
|
-
width: selfRect.width,
|
|
14
|
-
height: selfRect.height,
|
|
15
|
-
scrollTop: selfRect.top - wrapRect.top,
|
|
16
|
-
scrollBottom: selfRect.bottom - wrapRect.top,
|
|
17
|
-
scrollLeft: selfRect.left - wrapRect.left,
|
|
18
|
-
scrollRight: selfRect.right - wrapRect.left
|
|
19
|
-
};
|
|
20
|
-
}
|
|
21
6
|
export function getStyle(el) {
|
|
22
7
|
if (isServer() || !el) {
|
|
23
8
|
return {};
|
|
24
9
|
}
|
|
25
10
|
return document.defaultView?.getComputedStyle(el, null) || el.style;
|
|
26
11
|
}
|
|
12
|
+
export function getElement(el, from) {
|
|
13
|
+
el = toValue(el);
|
|
14
|
+
if (!el || isServer()) {
|
|
15
|
+
return null;
|
|
16
|
+
}
|
|
17
|
+
if (typeof el === "string") {
|
|
18
|
+
return (toValue(from) || document).querySelector(el);
|
|
19
|
+
}
|
|
20
|
+
if (el instanceof Element) {
|
|
21
|
+
return el;
|
|
22
|
+
}
|
|
23
|
+
return el?.$el ?? el;
|
|
24
|
+
}
|
|
25
|
+
export function isViewportScroll(el) {
|
|
26
|
+
return getWindowTop().includes(el) || el === document.body;
|
|
27
|
+
}
|
|
28
|
+
export function getElementOffsetFromScrollContainer(element, scrollContainer) {
|
|
29
|
+
const elementRect = element.getBoundingClientRect();
|
|
30
|
+
if (isViewportScroll(scrollContainer)) {
|
|
31
|
+
return {
|
|
32
|
+
top: elementRect.top,
|
|
33
|
+
left: elementRect.left
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
const containerRect = scrollContainer.getBoundingClientRect();
|
|
37
|
+
return {
|
|
38
|
+
top: elementRect.top - containerRect.top,
|
|
39
|
+
left: elementRect.left - containerRect.left
|
|
40
|
+
};
|
|
41
|
+
}
|
|
27
42
|
export function isScrollable(el) {
|
|
28
43
|
const { overflowX, overflowY } = getStyle(el);
|
|
29
44
|
const allowValues = ["scroll", "auto", "overlay"];
|
|
@@ -42,7 +57,7 @@ export function hasScrollbar(el) {
|
|
|
42
57
|
y: scrollHeight > clientHeight
|
|
43
58
|
};
|
|
44
59
|
}
|
|
45
|
-
export function
|
|
60
|
+
export function getScrollTarget(el, isHorizontal) {
|
|
46
61
|
const windowTop = getWindowTop();
|
|
47
62
|
let parent = el;
|
|
48
63
|
const direction = isHorizontal ? "x" : "y";
|
|
@@ -50,28 +65,36 @@ export function getScrollContainer(el, isHorizontal) {
|
|
|
50
65
|
if (windowTop.includes(parent)) {
|
|
51
66
|
return window;
|
|
52
67
|
}
|
|
53
|
-
if (isScrollable(parent)[direction]
|
|
68
|
+
if (isScrollable(parent)[direction]) {
|
|
54
69
|
return parent;
|
|
55
70
|
}
|
|
56
71
|
parent = parent.parentNode;
|
|
57
72
|
}
|
|
58
73
|
return parent;
|
|
59
74
|
}
|
|
60
|
-
export function
|
|
61
|
-
const targetEl = el instanceof HTMLElement ? el : document.documentElement;
|
|
62
|
-
return {
|
|
63
|
-
scrollTop: targetEl.scrollTop,
|
|
64
|
-
scrollLeft: targetEl.scrollLeft,
|
|
65
|
-
scrollWidth: targetEl.scrollWidth,
|
|
66
|
-
scrollHeight: targetEl.scrollHeight
|
|
67
|
-
};
|
|
68
|
-
}
|
|
69
|
-
export function getScrollElByContainer(target) {
|
|
75
|
+
export function getScrollElement(target) {
|
|
70
76
|
if (!target || getWindowTop().includes(target)) {
|
|
71
77
|
return document.documentElement;
|
|
72
78
|
}
|
|
73
79
|
return target;
|
|
74
80
|
}
|
|
81
|
+
export function getScrollListener(target) {
|
|
82
|
+
if (!target || getWindowTop().includes(target)) {
|
|
83
|
+
return window;
|
|
84
|
+
}
|
|
85
|
+
return target;
|
|
86
|
+
}
|
|
87
|
+
export function getScrollPosition(el) {
|
|
88
|
+
const target = el instanceof HTMLElement ? el : document.documentElement;
|
|
89
|
+
return {
|
|
90
|
+
scrollTop: target.scrollTop,
|
|
91
|
+
scrollLeft: target.scrollLeft,
|
|
92
|
+
scrollWidth: target.scrollWidth,
|
|
93
|
+
scrollHeight: target.scrollHeight,
|
|
94
|
+
clientWidth: target.clientWidth,
|
|
95
|
+
clientHeight: target.clientHeight
|
|
96
|
+
};
|
|
97
|
+
}
|
|
75
98
|
export function getScrollbarSize(element) {
|
|
76
99
|
if (!element) {
|
|
77
100
|
const div = document.createElement("div");
|
|
@@ -117,3 +140,9 @@ export async function awaitAnimationEnd(element) {
|
|
|
117
140
|
const animations = element?.getAnimations?.() ?? [];
|
|
118
141
|
await Promise.allSettled(animations.map((a) => a.finished));
|
|
119
142
|
}
|
|
143
|
+
export function resolveScrollBehavior(behavior, prefersMotionReduce) {
|
|
144
|
+
if (behavior === "auto") {
|
|
145
|
+
return toValue(prefersMotionReduce) ? "instant" : "smooth";
|
|
146
|
+
}
|
|
147
|
+
return behavior;
|
|
148
|
+
}
|
package/dist/utils/event.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Nullable } from '../types/shared';
|
|
1
|
+
import type { Callback, Nullable } from '../types/shared';
|
|
2
2
|
export declare function NOOP(): void;
|
|
3
3
|
type EventHandler<E extends Event = Event> = (event: E) => void;
|
|
4
4
|
export declare function on<E extends Event = Event>(el: Nullable<EventTarget>, event: string, handler: EventHandler<E>, options?: AddEventListenerOptions): () => void;
|
|
@@ -6,9 +6,21 @@ export declare function off<E extends Event = Event>(el: Nullable<EventTarget>,
|
|
|
6
6
|
export declare function once<E extends Event = Event>(el: Nullable<EventTarget>, event: string, handler: EventHandler<E>, options?: AddEventListenerOptions): void;
|
|
7
7
|
export declare function cachedOn<E extends Event = Event>(el: Nullable<EventTarget>, event: string, handler: EventHandler<E>, options?: AddEventListenerOptions): () => void;
|
|
8
8
|
export declare function cachedOff<E extends Event = Event>(el: Nullable<EventTarget>, event: string, handler: EventHandler<E>, options?: AddEventListenerOptions): void;
|
|
9
|
-
export declare function sleep(ms: number): Promise<unknown>;
|
|
10
9
|
export declare function preventDefaultScroll(ev: Event): boolean;
|
|
11
10
|
export declare function raf(fn: FrameRequestCallback): number;
|
|
12
11
|
export declare function caf(id: number): void;
|
|
13
12
|
export declare function doubleRaf(fn: FrameRequestCallback): number;
|
|
13
|
+
interface ThrottleByRafReturnType<T extends Callback> {
|
|
14
|
+
(...args: Parameters<T>): void;
|
|
15
|
+
cancel: () => void;
|
|
16
|
+
}
|
|
17
|
+
interface ScheduleByRafOptions {
|
|
18
|
+
defer?: boolean;
|
|
19
|
+
}
|
|
20
|
+
interface ScheduleByRafReturnType {
|
|
21
|
+
(): void;
|
|
22
|
+
cancel: () => void;
|
|
23
|
+
}
|
|
24
|
+
export declare function scheduleByRaf(callback: Callback, options?: ScheduleByRafOptions): ScheduleByRafReturnType;
|
|
25
|
+
export declare function throttleByRaf<T extends Callback>(callback: T): ThrottleByRafReturnType<T>;
|
|
14
26
|
export {};
|
package/dist/utils/event.js
CHANGED
|
@@ -1,8 +1,12 @@
|
|
|
1
|
+
import { nextTick } from "vue";
|
|
1
2
|
import { isOverflowScrollable } from "./dom.js";
|
|
2
3
|
import { isServer } from "./is.js";
|
|
3
4
|
export function NOOP() {
|
|
4
5
|
}
|
|
5
6
|
const eventCache = /* @__PURE__ */ new WeakMap();
|
|
7
|
+
function getCacheKey(event, options) {
|
|
8
|
+
return `${event}__${options?.capture ? "capture" : "bubble"}`;
|
|
9
|
+
}
|
|
6
10
|
export function on(el, event, handler, options) {
|
|
7
11
|
if (!el) {
|
|
8
12
|
return () => {
|
|
@@ -33,25 +37,23 @@ export function cachedOn(el, event, handler, options) {
|
|
|
33
37
|
return () => {
|
|
34
38
|
};
|
|
35
39
|
}
|
|
36
|
-
const cacheKey =
|
|
40
|
+
const cacheKey = getCacheKey(event, options);
|
|
37
41
|
let elementCache = eventCache.get(el);
|
|
38
42
|
if (!elementCache) {
|
|
39
|
-
elementCache =
|
|
43
|
+
elementCache = /* @__PURE__ */ new Map();
|
|
40
44
|
eventCache.set(el, elementCache);
|
|
41
45
|
}
|
|
42
|
-
|
|
43
|
-
if (
|
|
44
|
-
|
|
45
|
-
cachedEventHandlers.push(handler);
|
|
46
|
-
}
|
|
46
|
+
let entry = elementCache.get(cacheKey);
|
|
47
|
+
if (entry) {
|
|
48
|
+
entry.handlers.add(handler);
|
|
47
49
|
return () => cachedOff(el, event, handler, options);
|
|
48
50
|
}
|
|
51
|
+
const handlers = /* @__PURE__ */ new Set([handler]);
|
|
49
52
|
const scheduler = (ev) => {
|
|
50
|
-
|
|
51
|
-
list?.slice(1).forEach((h) => h(ev));
|
|
53
|
+
handlers.forEach((h) => h(ev));
|
|
52
54
|
};
|
|
53
|
-
|
|
54
|
-
elementCache
|
|
55
|
+
entry = { scheduler, handlers };
|
|
56
|
+
elementCache.set(cacheKey, entry);
|
|
55
57
|
el.addEventListener(event, scheduler, options);
|
|
56
58
|
return () => cachedOff(el, event, handler, options);
|
|
57
59
|
}
|
|
@@ -59,34 +61,26 @@ export function cachedOff(el, event, handler, options) {
|
|
|
59
61
|
if (!el) {
|
|
60
62
|
return;
|
|
61
63
|
}
|
|
62
|
-
const cacheKey = `__cached_${event}`;
|
|
63
64
|
const elementCache = eventCache.get(el);
|
|
64
65
|
if (!elementCache) {
|
|
65
66
|
return;
|
|
66
67
|
}
|
|
67
|
-
const
|
|
68
|
-
|
|
68
|
+
const cacheKey = getCacheKey(event, options);
|
|
69
|
+
const entry = elementCache.get(cacheKey);
|
|
70
|
+
if (!entry) {
|
|
69
71
|
return;
|
|
70
72
|
}
|
|
71
|
-
|
|
72
|
-
if (index === -1) {
|
|
73
|
+
if (!entry.handlers.delete(handler)) {
|
|
73
74
|
return;
|
|
74
75
|
}
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
if (
|
|
79
|
-
el.removeEventListener(event, scheduler, options);
|
|
80
|
-
}
|
|
81
|
-
delete elementCache[cacheKey];
|
|
82
|
-
if (Object.keys(elementCache).length === 0) {
|
|
76
|
+
if (entry.handlers.size === 0) {
|
|
77
|
+
el.removeEventListener(event, entry.scheduler, options);
|
|
78
|
+
elementCache.delete(cacheKey);
|
|
79
|
+
if (elementCache.size === 0) {
|
|
83
80
|
eventCache.delete(el);
|
|
84
81
|
}
|
|
85
82
|
}
|
|
86
83
|
}
|
|
87
|
-
export function sleep(ms) {
|
|
88
|
-
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
89
|
-
}
|
|
90
84
|
export function preventDefaultScroll(ev) {
|
|
91
85
|
const _target = ev.target;
|
|
92
86
|
if (_target instanceof Element && isOverflowScrollable(_target)) {
|
|
@@ -112,3 +106,47 @@ export function caf(id) {
|
|
|
112
106
|
export function doubleRaf(fn) {
|
|
113
107
|
return raf(() => raf(fn));
|
|
114
108
|
}
|
|
109
|
+
export function scheduleByRaf(callback, options = {}) {
|
|
110
|
+
let animationFrameId = 0;
|
|
111
|
+
const schedule = () => {
|
|
112
|
+
if (isServer() || animationFrameId) {
|
|
113
|
+
return;
|
|
114
|
+
}
|
|
115
|
+
animationFrameId = raf(() => {
|
|
116
|
+
animationFrameId = 0;
|
|
117
|
+
if (options.defer) {
|
|
118
|
+
void nextTick(callback);
|
|
119
|
+
return;
|
|
120
|
+
}
|
|
121
|
+
callback();
|
|
122
|
+
});
|
|
123
|
+
};
|
|
124
|
+
schedule.cancel = () => {
|
|
125
|
+
if (!animationFrameId) {
|
|
126
|
+
return;
|
|
127
|
+
}
|
|
128
|
+
caf(animationFrameId);
|
|
129
|
+
animationFrameId = 0;
|
|
130
|
+
};
|
|
131
|
+
return schedule;
|
|
132
|
+
}
|
|
133
|
+
export function throttleByRaf(callback) {
|
|
134
|
+
let animationFrameId = 0;
|
|
135
|
+
const throttle = (...args) => {
|
|
136
|
+
if (animationFrameId) {
|
|
137
|
+
return;
|
|
138
|
+
}
|
|
139
|
+
animationFrameId = raf(() => {
|
|
140
|
+
animationFrameId = 0;
|
|
141
|
+
callback(...args);
|
|
142
|
+
});
|
|
143
|
+
};
|
|
144
|
+
throttle.cancel = () => {
|
|
145
|
+
if (!animationFrameId) {
|
|
146
|
+
return;
|
|
147
|
+
}
|
|
148
|
+
caf(animationFrameId);
|
|
149
|
+
animationFrameId = 0;
|
|
150
|
+
};
|
|
151
|
+
return throttle;
|
|
152
|
+
}
|
package/dist/utils/format.d.ts
CHANGED
|
@@ -1,10 +1,6 @@
|
|
|
1
1
|
import type { Nullable } from '../types/shared/utils';
|
|
2
2
|
/** string -> String */
|
|
3
3
|
export declare function capitalize(text: string): string;
|
|
4
|
-
/** kabab-case -> kababCase */
|
|
5
|
-
export declare function camelize(str: string): string;
|
|
6
|
-
/** kabab-case -> KababCase */
|
|
7
|
-
export declare function pascalize(text: string): string;
|
|
8
4
|
/** KababCase -> kabab-case */
|
|
9
5
|
export declare function uncapitalize(text: string): string;
|
|
10
6
|
/** 'kabab-case' -> 'Kabab Case' */
|
|
@@ -13,7 +9,12 @@ export declare function isTruthyProp(value: unknown): boolean;
|
|
|
13
9
|
export declare function clampValue(n: number, min: number, max: number): number;
|
|
14
10
|
export declare function isExternalLink(href: string): boolean;
|
|
15
11
|
export declare function toArray(value: unknown): any[];
|
|
12
|
+
export declare function toNumber(value: unknown): number;
|
|
16
13
|
export declare function getCssUnitValue(value: Nullable<string | number>, fallbackValue?: string): string;
|
|
14
|
+
export declare function parseUnitValue(target: string | number): {
|
|
15
|
+
number: number;
|
|
16
|
+
unit: string;
|
|
17
|
+
};
|
|
17
18
|
/**
|
|
18
19
|
* Increase string a value with unit
|
|
19
20
|
*
|
package/dist/utils/format.js
CHANGED
|
@@ -1,15 +1,9 @@
|
|
|
1
|
+
import { isNil } from "../utils/is.js";
|
|
1
2
|
const INTEGER_REGEX = /^-?\d+$/;
|
|
2
3
|
const FLOATING_REGEX = /^-?\d+\.?\d*/;
|
|
3
4
|
export function capitalize(text) {
|
|
4
5
|
return text.charAt(0).toUpperCase() + text.slice(1).toLowerCase();
|
|
5
6
|
}
|
|
6
|
-
const camelizeRE = /-(\w)/g;
|
|
7
|
-
export function camelize(str) {
|
|
8
|
-
return str.replace(camelizeRE, (_, c) => c ? c.toUpperCase() : "");
|
|
9
|
-
}
|
|
10
|
-
export function pascalize(text) {
|
|
11
|
-
return text.charAt(0).toUpperCase() + text.slice(1).replace(camelizeRE, (_, c) => c ? c.toUpperCase() : "");
|
|
12
|
-
}
|
|
13
7
|
export function uncapitalize(text) {
|
|
14
8
|
return text.charAt(0).toLowerCase() + text.slice(1).replace(/([A-Z])/g, "-$1").toLowerCase();
|
|
15
9
|
}
|
|
@@ -20,9 +14,12 @@ export function isTruthyProp(value) {
|
|
|
20
14
|
return Boolean(value) || value === "";
|
|
21
15
|
}
|
|
22
16
|
export function clampValue(n, min, max) {
|
|
23
|
-
return
|
|
17
|
+
return Math.min(Math.max(n, min), max);
|
|
24
18
|
}
|
|
25
19
|
export function isExternalLink(href) {
|
|
20
|
+
if (href.startsWith("//")) {
|
|
21
|
+
return true;
|
|
22
|
+
}
|
|
26
23
|
const firstChar = href.slice(0, 1);
|
|
27
24
|
if (["#", "/"].includes(firstChar)) {
|
|
28
25
|
return false;
|
|
@@ -30,7 +27,7 @@ export function isExternalLink(href) {
|
|
|
30
27
|
return true;
|
|
31
28
|
}
|
|
32
29
|
export function toArray(value) {
|
|
33
|
-
if (value
|
|
30
|
+
if (isNil(value)) {
|
|
34
31
|
return [];
|
|
35
32
|
}
|
|
36
33
|
if (Array.isArray(value)) {
|
|
@@ -44,8 +41,17 @@ export function toArray(value) {
|
|
|
44
41
|
}
|
|
45
42
|
return [value];
|
|
46
43
|
}
|
|
44
|
+
export function toNumber(value) {
|
|
45
|
+
if (isNil(value)) {
|
|
46
|
+
return 0;
|
|
47
|
+
}
|
|
48
|
+
if (typeof value === "number") {
|
|
49
|
+
return value;
|
|
50
|
+
}
|
|
51
|
+
return Number(value);
|
|
52
|
+
}
|
|
47
53
|
export function getCssUnitValue(value, fallbackValue) {
|
|
48
|
-
if (value
|
|
54
|
+
if (isNil(value) || value === "") {
|
|
49
55
|
return fallbackValue;
|
|
50
56
|
}
|
|
51
57
|
if (typeof value === "number" || INTEGER_REGEX.test(String(value))) {
|
|
@@ -53,13 +59,27 @@ export function getCssUnitValue(value, fallbackValue) {
|
|
|
53
59
|
}
|
|
54
60
|
return String(value);
|
|
55
61
|
}
|
|
62
|
+
export function parseUnitValue(target) {
|
|
63
|
+
if (typeof target === "string") {
|
|
64
|
+
const string = String(target);
|
|
65
|
+
const value = string.match(FLOATING_REGEX)?.[0] || "";
|
|
66
|
+
const unit = string.slice(value.length);
|
|
67
|
+
return {
|
|
68
|
+
number: Number.parseFloat(value),
|
|
69
|
+
unit
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
return {
|
|
73
|
+
number: target,
|
|
74
|
+
unit: ""
|
|
75
|
+
};
|
|
76
|
+
}
|
|
56
77
|
export function increaseWithUnit(target, delta) {
|
|
57
78
|
if (typeof target === "number") {
|
|
58
79
|
return target + delta;
|
|
59
80
|
}
|
|
60
|
-
const
|
|
61
|
-
const
|
|
62
|
-
const result = Number.parseFloat(value) + delta;
|
|
81
|
+
const { number, unit } = parseUnitValue(target);
|
|
82
|
+
const result = number + delta;
|
|
63
83
|
if (Number.isNaN(result)) {
|
|
64
84
|
return target;
|
|
65
85
|
}
|
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
const whitespacePattern = /\s/;
|
|
2
|
+
const whitespaceReplacePattern = /\s+/g;
|
|
3
|
+
let cachedSearch = null;
|
|
4
|
+
let cachedPreparedSearch = null;
|
|
5
|
+
const HAYSTACK_CACHE_MAX = 4096;
|
|
6
|
+
const HAYSTACK_CACHE_MAX_LENGTH = 128;
|
|
7
|
+
const haystackCache = /* @__PURE__ */ new Map();
|
|
8
|
+
function getPreparedHaystack(text) {
|
|
9
|
+
const cached = haystackCache.get(text);
|
|
10
|
+
if (cached) {
|
|
11
|
+
return cached;
|
|
12
|
+
}
|
|
13
|
+
const lower = text.toLowerCase();
|
|
14
|
+
const prepared = {
|
|
15
|
+
lower,
|
|
16
|
+
compact: whitespacePattern.test(lower) ? lower.replace(whitespaceReplacePattern, "") : lower
|
|
17
|
+
};
|
|
18
|
+
if (text.length <= HAYSTACK_CACHE_MAX_LENGTH) {
|
|
19
|
+
if (haystackCache.size >= HAYSTACK_CACHE_MAX) {
|
|
20
|
+
haystackCache.clear();
|
|
21
|
+
}
|
|
22
|
+
haystackCache.set(text, prepared);
|
|
23
|
+
}
|
|
24
|
+
return prepared;
|
|
25
|
+
}
|
|
26
|
+
export function isFuzzyMatch(text, search, keywords) {
|
|
27
|
+
if (!search) {
|
|
28
|
+
return true;
|
|
29
|
+
}
|
|
30
|
+
const { needle, compactNeedle } = prepareSearch(search);
|
|
31
|
+
if (!needle) {
|
|
32
|
+
return true;
|
|
33
|
+
}
|
|
34
|
+
if (text && matchesOne(getPreparedHaystack(text), needle, compactNeedle)) {
|
|
35
|
+
return true;
|
|
36
|
+
}
|
|
37
|
+
if (keywords && keywords.length > 0) {
|
|
38
|
+
for (const kw of keywords) {
|
|
39
|
+
if (kw && matchesOne(getPreparedHaystack(kw), needle, compactNeedle)) {
|
|
40
|
+
return true;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
return false;
|
|
45
|
+
}
|
|
46
|
+
export function getFuzzyMatchScore(text, search, keywords) {
|
|
47
|
+
if (!search) {
|
|
48
|
+
return 0;
|
|
49
|
+
}
|
|
50
|
+
const { needle, compactNeedle } = prepareSearch(search);
|
|
51
|
+
if (!needle) {
|
|
52
|
+
return 0;
|
|
53
|
+
}
|
|
54
|
+
let score = getMatchScore(getPreparedHaystack(text), needle, compactNeedle);
|
|
55
|
+
if (score === 1e3) {
|
|
56
|
+
return score;
|
|
57
|
+
}
|
|
58
|
+
if (keywords && keywords.length > 0) {
|
|
59
|
+
for (const keyword of keywords) {
|
|
60
|
+
score = Math.max(score, getMatchScore(getPreparedHaystack(keyword), needle, compactNeedle));
|
|
61
|
+
if (score === 1e3) {
|
|
62
|
+
return score;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
return score;
|
|
67
|
+
}
|
|
68
|
+
function scoreBase(haystack, needle) {
|
|
69
|
+
if (!haystack) {
|
|
70
|
+
return 0;
|
|
71
|
+
}
|
|
72
|
+
if (haystack === needle) {
|
|
73
|
+
return 1e3;
|
|
74
|
+
}
|
|
75
|
+
const contiguousIndex = haystack.indexOf(needle);
|
|
76
|
+
if (contiguousIndex !== -1) {
|
|
77
|
+
return getContiguousMatchScore(haystack, needle, contiguousIndex);
|
|
78
|
+
}
|
|
79
|
+
const subsequence = getSubsequenceMatch(haystack, needle);
|
|
80
|
+
if (subsequence) {
|
|
81
|
+
return getSubsequenceMatchScore(haystack, needle, subsequence);
|
|
82
|
+
}
|
|
83
|
+
return 0;
|
|
84
|
+
}
|
|
85
|
+
function getMatchScore(prepared, needle, compactNeedle) {
|
|
86
|
+
const score = scoreBase(prepared.lower, needle);
|
|
87
|
+
if (score > 0 || prepared.compact === prepared.lower && compactNeedle === needle) {
|
|
88
|
+
return score;
|
|
89
|
+
}
|
|
90
|
+
return scoreBase(prepared.compact, compactNeedle);
|
|
91
|
+
}
|
|
92
|
+
function matchesBase(haystack, needle) {
|
|
93
|
+
if (!haystack) {
|
|
94
|
+
return false;
|
|
95
|
+
}
|
|
96
|
+
if (haystack === needle) {
|
|
97
|
+
return true;
|
|
98
|
+
}
|
|
99
|
+
if (haystack.startsWith(needle)) {
|
|
100
|
+
return true;
|
|
101
|
+
}
|
|
102
|
+
if (haystack.includes(needle)) {
|
|
103
|
+
return true;
|
|
104
|
+
}
|
|
105
|
+
return hasFuzzySubsequenceMatch(haystack, needle);
|
|
106
|
+
}
|
|
107
|
+
function matchesOne(prepared, needle, compactNeedle) {
|
|
108
|
+
if (matchesBase(prepared.lower, needle)) {
|
|
109
|
+
return true;
|
|
110
|
+
}
|
|
111
|
+
if (prepared.compact !== prepared.lower || compactNeedle !== needle) {
|
|
112
|
+
return matchesBase(prepared.compact, compactNeedle);
|
|
113
|
+
}
|
|
114
|
+
return false;
|
|
115
|
+
}
|
|
116
|
+
function prepareSearch(search) {
|
|
117
|
+
if (search === cachedSearch && cachedPreparedSearch) {
|
|
118
|
+
return cachedPreparedSearch;
|
|
119
|
+
}
|
|
120
|
+
const needle = search.toLowerCase().trim();
|
|
121
|
+
const preparedSearch = {
|
|
122
|
+
needle,
|
|
123
|
+
compactNeedle: whitespacePattern.test(needle) ? needle.replace(whitespaceReplacePattern, "") : needle
|
|
124
|
+
};
|
|
125
|
+
cachedSearch = search;
|
|
126
|
+
cachedPreparedSearch = preparedSearch;
|
|
127
|
+
return preparedSearch;
|
|
128
|
+
}
|
|
129
|
+
function getContiguousMatchScore(haystack, needle, index) {
|
|
130
|
+
const boundaryBonus = index === 0 || /\W/.test(haystack[index - 1]) ? 30 : 0;
|
|
131
|
+
const positionBonus = (haystack.length - index) / haystack.length * 20;
|
|
132
|
+
return 700 + boundaryBonus + getLengthScore(haystack, needle) + positionBonus;
|
|
133
|
+
}
|
|
134
|
+
function getLengthScore(haystack, needle) {
|
|
135
|
+
return needle.length / haystack.length * 100;
|
|
136
|
+
}
|
|
137
|
+
function hasFuzzySubsequenceMatch(haystack, needle) {
|
|
138
|
+
let ni = 0;
|
|
139
|
+
if (needle.length > haystack.length) {
|
|
140
|
+
return false;
|
|
141
|
+
}
|
|
142
|
+
for (let hi = 0; hi < haystack.length && ni < needle.length; hi++) {
|
|
143
|
+
if (haystack[hi] === needle[ni]) {
|
|
144
|
+
ni++;
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
return ni >= needle.length;
|
|
148
|
+
}
|
|
149
|
+
function getSubsequenceMatchScore(haystack, needle, match) {
|
|
150
|
+
const span = match.lastIndex - match.firstIndex + 1;
|
|
151
|
+
const gapPenalty = span - needle.length;
|
|
152
|
+
const positionBonus = (haystack.length - match.firstIndex) / haystack.length * 20;
|
|
153
|
+
const continuityBonus = match.longestRun / needle.length * 100;
|
|
154
|
+
return 200 + continuityBonus + getLengthScore(haystack, needle) + positionBonus - gapPenalty * 5;
|
|
155
|
+
}
|
|
156
|
+
function getSubsequenceMatch(haystack, needle) {
|
|
157
|
+
if (needle.length > haystack.length) {
|
|
158
|
+
return null;
|
|
159
|
+
}
|
|
160
|
+
let needleIndex = 0;
|
|
161
|
+
let firstIndex = -1;
|
|
162
|
+
let lastIndex = -1;
|
|
163
|
+
let currentRun = 0;
|
|
164
|
+
let longestRun = 0;
|
|
165
|
+
for (let haystackIndex = 0; haystackIndex < haystack.length; haystackIndex++) {
|
|
166
|
+
if (haystack[haystackIndex] !== needle[needleIndex]) {
|
|
167
|
+
currentRun = 0;
|
|
168
|
+
continue;
|
|
169
|
+
}
|
|
170
|
+
if (firstIndex === -1) {
|
|
171
|
+
firstIndex = haystackIndex;
|
|
172
|
+
}
|
|
173
|
+
lastIndex = haystackIndex;
|
|
174
|
+
needleIndex++;
|
|
175
|
+
currentRun++;
|
|
176
|
+
longestRun = Math.max(longestRun, currentRun);
|
|
177
|
+
if (needleIndex === needle.length) {
|
|
178
|
+
return { firstIndex, lastIndex, longestRun };
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
return null;
|
|
182
|
+
}
|