pxd 0.2.0 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +31 -9
- package/dist/agent/allow.d.ts +23 -0
- package/dist/agent/allow.js +98 -0
- package/dist/agent/callers.d.ts +3 -0
- package/dist/agent/callers.js +1 -0
- package/dist/agent/describe.d.ts +14 -0
- package/dist/agent/describe.js +176 -0
- package/dist/agent/history.d.ts +42 -0
- package/dist/agent/history.js +93 -0
- package/dist/agent/index.d.ts +24 -0
- package/dist/agent/index.js +119 -0
- package/dist/agent/items.d.ts +21 -0
- package/dist/agent/items.js +52 -0
- package/dist/agent/label.d.ts +2 -0
- package/dist/agent/label.js +67 -0
- package/dist/agent/marks.d.ts +9 -0
- package/dist/agent/marks.js +45 -0
- package/dist/agent/observe.d.ts +13 -0
- package/dist/agent/observe.js +18 -0
- package/dist/agent/press.d.ts +8 -0
- package/dist/agent/press.js +82 -0
- package/dist/agent/query.d.ts +22 -0
- package/dist/agent/query.js +190 -0
- package/dist/agent/register.d.ts +10 -0
- package/dist/agent/register.js +33 -0
- package/dist/agent/registry.d.ts +42 -0
- package/dist/agent/registry.js +265 -0
- package/dist/agent/report.d.ts +4 -0
- package/dist/agent/report.js +59 -0
- package/dist/agent/run.d.ts +33 -0
- package/dist/agent/run.js +232 -0
- package/dist/agent/stage.d.ts +29 -0
- package/dist/agent/stage.js +39 -0
- package/dist/agent/testing.d.ts +35 -0
- package/dist/agent/testing.js +70 -0
- package/dist/agent/tools.d.ts +2 -0
- package/dist/agent/tools.js +78 -0
- package/dist/agent/types.d.ts +201 -0
- package/dist/agent/types.js +0 -0
- package/dist/agent/values.d.ts +20 -0
- package/dist/agent/values.js +155 -0
- package/dist/components/_internal/calendar-day.d.vue.ts +3 -2
- package/dist/components/_internal/calendar-day.vue +22 -21
- package/dist/components/{teleport/index.d.vue.ts → _internal/client-teleport.d.vue.ts} +6 -4
- package/dist/components/_internal/client-teleport.vue +29 -0
- package/dist/components/_internal/dismiss-container.vue +4 -3
- package/dist/components/_internal/mention-editor.d.vue.ts +13 -4
- package/dist/components/_internal/mention-editor.vue +34 -15
- package/dist/components/_internal/popover-arrow.d.vue.ts +1 -7
- package/dist/components/_internal/popover-arrow.vue +4 -12
- package/dist/components/_internal/popover-trigger.d.vue.ts +22 -0
- package/dist/components/_internal/popover-trigger.vue +60 -0
- package/dist/components/_internal/step-item.vue +1 -1
- package/dist/components/_internal/tree-node.vue +5 -1
- package/dist/components/active-graph/index.d.vue.ts +2 -2
- package/dist/components/active-graph/index.vue +25 -5
- package/dist/components/active-graph/types.d.ts +5 -1
- package/dist/components/approval-card/index.vue +34 -18
- package/dist/components/approval-card/types.d.ts +1 -1
- package/dist/components/avatar/index.vue +16 -8
- package/dist/components/avatar/types.d.ts +2 -2
- package/dist/components/avatar-group/index.d.vue.ts +1 -1
- package/dist/components/avatar-group/index.vue +11 -7
- package/dist/components/avatar-group/types.d.ts +2 -2
- package/dist/components/backtop/index.vue +4 -4
- package/dist/components/badge/index.vue +20 -8
- package/dist/components/book/index.d.vue.ts +1 -1
- package/dist/components/book/index.vue +5 -5
- package/dist/components/book/types.d.ts +1 -1
- package/dist/components/border-beam/index.d.vue.ts +1 -1
- package/dist/components/border-beam/index.vue +6 -7
- package/dist/components/border-beam/types.d.ts +1 -1
- package/dist/components/breadcrumb/index.vue +5 -1
- package/dist/components/breadcrumb-item/index.vue +3 -3
- package/dist/components/breadcrumb-item/types.d.ts +1 -1
- package/dist/components/browser/index.vue +5 -10
- package/dist/components/bubble/index.vue +2 -2
- package/dist/components/bubble/types.d.ts +2 -0
- package/dist/components/bubble-group/index.d.vue.ts +3 -1
- package/dist/components/bubble-group/index.vue +15 -13
- package/dist/components/bubble-group/types.d.ts +1 -0
- package/dist/components/button/index.d.vue.ts +1 -1
- package/dist/components/button/index.vue +41 -33
- package/dist/components/button/types.d.ts +4 -4
- package/dist/components/button-group/types.d.ts +1 -1
- package/dist/components/calendar/index.d.vue.ts +3 -3
- package/dist/components/calendar/index.vue +51 -17
- package/dist/components/calendar/types.d.ts +3 -6
- package/dist/components/card/index.d.vue.ts +1 -1
- package/dist/components/carousel/index.d.vue.ts +7 -7
- package/dist/components/carousel/index.vue +252 -125
- package/dist/components/carousel/types.d.ts +14 -3
- package/dist/components/checkbox/index.d.vue.ts +5 -5
- package/dist/components/checkbox/index.vue +40 -14
- package/dist/components/checkbox/types.d.ts +6 -3
- package/dist/components/checkbox-group/index.d.vue.ts +4 -4
- package/dist/components/checkbox-group/index.vue +45 -6
- package/dist/components/checkbox-group/types.d.ts +9 -2
- package/dist/components/checkerboard/index.vue +2 -2
- package/dist/components/checkerboard/types.d.ts +1 -1
- package/dist/components/chip/index.vue +5 -3
- package/dist/components/chip/types.d.ts +1 -1
- package/dist/components/choicebox/index.d.vue.ts +4 -4
- package/dist/components/choicebox/index.vue +27 -7
- package/dist/components/choicebox/types.d.ts +7 -2
- package/dist/components/choicebox-item/index.vue +15 -13
- package/dist/components/code-block/index.d.vue.ts +1 -2
- package/dist/components/code-block/index.vue +57 -40
- package/dist/components/code-block/types.d.ts +3 -4
- package/dist/components/collapse/index.d.vue.ts +1 -1
- package/dist/components/collapse/index.vue +23 -6
- package/dist/components/collapse/types.d.ts +1 -1
- package/dist/components/color-selector/index.d.vue.ts +2 -2
- package/dist/components/color-selector/index.vue +35 -21
- package/dist/components/color-selector/types.d.ts +7 -2
- package/dist/components/command-menu/index.d.vue.ts +11 -6
- package/dist/components/command-menu/index.vue +52 -24
- package/dist/components/command-menu/types.d.ts +10 -2
- package/dist/components/config-provider/index.d.vue.ts +27 -5
- package/dist/components/confirm-popover/index.d.vue.ts +3 -3
- package/dist/components/confirm-popover/index.vue +22 -22
- package/dist/components/confirm-popover/types.d.ts +2 -2
- package/dist/components/context-usage/index.vue +30 -15
- package/dist/components/copy-button/index.d.vue.ts +5 -1
- package/dist/components/copy-button/index.vue +31 -12
- package/dist/components/copy-button/types.d.ts +1 -1
- package/dist/components/countdown/index.d.vue.ts +2 -3
- package/dist/components/countdown/index.vue +30 -15
- package/dist/components/countdown/types.d.ts +43 -3
- package/dist/components/date-picker/index.d.vue.ts +3 -4
- package/dist/components/date-picker/index.vue +57 -36
- package/dist/components/date-picker/types.d.ts +9 -3
- package/dist/components/description/index.d.vue.ts +1 -1
- package/dist/components/description/index.vue +3 -3
- package/dist/components/description/types.d.ts +1 -1
- package/dist/components/drawer/index.d.vue.ts +11 -8
- package/dist/components/drawer/index.vue +146 -116
- package/dist/components/drawer/types.d.ts +12 -7
- package/dist/components/effort-slider/index.d.vue.ts +2 -2
- package/dist/components/effort-slider/index.vue +89 -72
- package/dist/components/effort-slider/types.d.ts +4 -1
- package/dist/components/ellipsis-text/index.d.vue.ts +1 -1
- package/dist/components/ellipsis-text/index.vue +15 -24
- package/dist/components/ellipsis-text/types.d.ts +1 -1
- package/dist/components/empty-state/index.d.vue.ts +1 -1
- package/dist/components/empty-state/index.vue +3 -3
- package/dist/components/empty-state/types.d.ts +1 -1
- package/dist/components/{error → error-info}/index.d.vue.ts +2 -2
- package/dist/components/{error → error-info}/index.vue +18 -13
- package/dist/components/{error → error-info}/types.d.ts +3 -3
- package/dist/components/fader/index.d.vue.ts +1 -1
- package/dist/components/fader/index.vue +12 -11
- package/dist/components/fader/types.d.ts +1 -1
- package/dist/components/feedback-bar/index.vue +3 -3
- package/dist/components/form/index.d.vue.ts +56 -0
- package/dist/components/form/index.vue +237 -0
- package/dist/components/form/types.d.ts +32 -0
- package/dist/components/form-item/index.d.vue.ts +48 -0
- package/dist/components/form-item/index.vue +391 -0
- package/dist/components/form-item/types.d.ts +20 -0
- package/dist/components/gauge/index.vue +10 -5
- package/dist/components/grid/index.vue +4 -5
- package/dist/components/grid-item/index.vue +6 -15
- package/dist/components/hint/index.vue +0 -1
- package/dist/components/hold-button/index.d.vue.ts +2 -2
- package/dist/components/hold-button/index.vue +44 -71
- package/dist/components/image-compare/index.d.vue.ts +17 -0
- package/dist/components/image-compare/index.vue +205 -0
- package/dist/components/image-cropper/index.d.vue.ts +55 -0
- package/dist/components/image-cropper/index.vue +1200 -0
- package/dist/components/image-cropper/types.d.ts +80 -0
- package/dist/components/image-generate/index.d.vue.ts +27 -0
- package/dist/components/image-generate/index.vue +143 -0
- package/dist/components/image-generate/types.d.ts +13 -0
- package/dist/components/image-preview/index.d.vue.ts +3 -3
- package/dist/components/image-preview/index.vue +88 -73
- package/dist/components/image-preview/types.d.ts +3 -4
- package/dist/components/index.d.ts +11 -4
- package/dist/components/index.js +6 -2
- package/dist/components/input/index.d.vue.ts +6 -5
- package/dist/components/input/index.vue +98 -40
- package/dist/components/input/types.d.ts +9 -3
- package/dist/components/intersection-observer/index.d.vue.ts +1 -1
- package/dist/components/intersection-observer/index.vue +14 -9
- package/dist/components/intersection-observer/types.d.ts +1 -1
- package/dist/components/kbd/index.vue +6 -6
- package/dist/components/kbd/types.d.ts +1 -1
- package/dist/components/link-button/index.d.vue.ts +1 -1
- package/dist/components/link-button/index.vue +34 -27
- package/dist/components/link-button/types.d.ts +0 -1
- package/dist/components/list/index.d.vue.ts +10 -2
- package/dist/components/list/index.vue +72 -8
- package/dist/components/list/types.d.ts +10 -1
- package/dist/components/list-group/types.d.ts +0 -2
- package/dist/components/list-item/index.d.vue.ts +1 -1
- package/dist/components/list-item/index.vue +7 -3
- package/dist/components/loading-bar/index.d.vue.ts +2 -1
- package/dist/components/loading-bar/index.vue +20 -110
- package/dist/components/loading-bar/types.d.ts +1 -1
- package/dist/components/loading-dots/index.vue +4 -11
- package/dist/components/loading-mask/index.d.vue.ts +1 -1
- package/dist/components/loading-mask/index.vue +1 -1
- package/dist/components/loading-mask/types.d.ts +2 -0
- package/dist/components/marching-ants/index.vue +15 -9
- package/dist/components/marquee/index.d.vue.ts +2 -2
- package/dist/components/marquee/index.vue +8 -8
- package/dist/components/marquee/types.d.ts +2 -2
- package/dist/components/material/index.d.vue.ts +1 -1
- package/dist/components/mention/index.d.vue.ts +5 -4
- package/dist/components/mention/index.vue +63 -26
- package/dist/components/mention/types.d.ts +5 -1
- package/dist/components/menu/index.d.vue.ts +2 -3
- package/dist/components/menu/index.vue +43 -18
- package/dist/components/menu/types.d.ts +4 -2
- package/dist/components/message/index.d.vue.ts +7 -7
- package/dist/components/message/index.vue +35 -18
- package/dist/components/message/types.d.ts +1 -1
- package/dist/components/message-item/index.d.vue.ts +3 -1
- package/dist/components/message-item/index.vue +44 -21
- package/dist/components/message-item/types.d.ts +2 -1
- package/dist/components/modal/index.d.vue.ts +10 -7
- package/dist/components/modal/index.vue +143 -97
- package/dist/components/modal/types.d.ts +10 -5
- package/dist/components/more-button/index.d.vue.ts +6 -6
- package/dist/components/more-button/index.vue +24 -10
- package/dist/components/more-button/types.d.ts +9 -2
- package/dist/components/note/index.d.vue.ts +1 -1
- package/dist/components/note/index.vue +12 -15
- package/dist/components/note/types.d.ts +2 -1
- package/dist/components/number-input/index.d.vue.ts +5 -5
- package/dist/components/number-input/index.vue +115 -49
- package/dist/components/number-input/types.d.ts +7 -2
- package/dist/components/overlay/index.d.vue.ts +2 -1
- package/dist/components/overlay/index.vue +18 -30
- package/dist/components/overlay/types.d.ts +2 -1
- package/dist/components/page-number/index.vue +42 -19
- package/dist/components/page-number/types.d.ts +1 -1
- package/dist/components/pagination/index.vue +12 -5
- package/dist/components/pin-input/index.d.vue.ts +3 -3
- package/dist/components/pin-input/index.vue +64 -37
- package/dist/components/pin-input/types.d.ts +19 -10
- package/dist/components/placeholder/index.d.vue.ts +3 -1
- package/dist/components/placeholder/index.vue +7 -5
- package/dist/components/placeholder/types.d.ts +3 -1
- package/dist/components/popover/index.d.vue.ts +64 -0
- package/dist/components/popover/index.vue +224 -525
- package/dist/components/popover/types.d.ts +11 -6
- package/dist/components/progress/index.d.vue.ts +1 -1
- package/dist/components/progress/index.vue +44 -37
- package/dist/components/progress/types.d.ts +2 -1
- package/dist/components/questionnaire/index.vue +115 -22
- package/dist/components/questionnaire/types.d.ts +1 -1
- package/dist/components/radial-burst/index.vue +2 -2
- package/dist/components/radial-burst/types.d.ts +1 -1
- package/dist/components/radio/index.d.vue.ts +4 -4
- package/dist/components/radio/index.vue +25 -11
- package/dist/components/radio/types.d.ts +7 -2
- package/dist/components/radio-group/index.d.vue.ts +4 -4
- package/dist/components/radio-group/index.vue +45 -8
- package/dist/components/radio-group/types.d.ts +9 -2
- package/dist/components/rating/index.d.vue.ts +2 -2
- package/dist/components/rating/index.vue +63 -23
- package/dist/components/rating/types.d.ts +7 -2
- package/dist/components/reactions/index.d.vue.ts +3 -3
- package/dist/components/reactions/index.vue +20 -10
- package/dist/components/reactions/types.d.ts +5 -3
- package/dist/components/reasoning/index.vue +10 -9
- package/dist/components/reasoning/types.d.ts +1 -1
- package/dist/components/resizable/index.d.vue.ts +6 -6
- package/dist/components/resizable/index.vue +23 -10
- package/dist/components/resizable/types.d.ts +7 -1
- package/dist/components/reveal/index.d.vue.ts +3 -3
- package/dist/components/reveal/index.vue +7 -15
- package/dist/components/reveal/types.d.ts +2 -2
- package/dist/components/rolling-number/index.vue +11 -8
- package/dist/components/scroll-progress/index.d.vue.ts +2 -2
- package/dist/components/scroll-progress/index.vue +40 -34
- package/dist/components/scroll-progress/types.d.ts +4 -1
- package/dist/components/scroll-text/index.vue +1 -1
- package/dist/components/scrollable/index.vue +8 -8
- package/dist/components/scrollable/types.d.ts +2 -2
- package/dist/components/search-input/index.d.vue.ts +21 -14
- package/dist/components/search-input/index.vue +57 -9
- package/dist/components/search-input/types.d.ts +7 -1
- package/dist/components/select/index.d.vue.ts +7 -2
- package/dist/components/select/index.vue +267 -116
- package/dist/components/select/types.d.ts +14 -6
- package/dist/components/separator/index.vue +1 -1
- package/dist/components/shimmer-text/index.d.vue.ts +1 -1
- package/dist/components/shimmer-text/index.vue +7 -7
- package/dist/components/shimmer-text/types.d.ts +1 -1
- package/dist/components/skeleton/index.d.vue.ts +1 -1
- package/dist/components/skeleton/index.vue +2 -2
- package/dist/components/slider/index.d.vue.ts +5 -5
- package/dist/components/slider/index.vue +137 -101
- package/dist/components/slider/types.d.ts +9 -2
- package/dist/components/snippet/index.vue +6 -6
- package/dist/components/spinner/index.vue +14 -10
- package/dist/components/spinner-dots/index.d.vue.ts +1 -1
- package/dist/components/spinner-dots/index.vue +1 -1
- package/dist/components/split-button/index.d.vue.ts +2 -2
- package/dist/components/split-button/index.vue +18 -14
- package/dist/components/split-button/types.d.ts +6 -3
- package/dist/components/stack/index.d.vue.ts +2 -2
- package/dist/components/stack/index.vue +2 -5
- package/dist/components/stack/types.d.ts +3 -2
- package/dist/components/status-dot/index.d.vue.ts +2 -2
- package/dist/components/status-dot/index.vue +14 -21
- package/dist/components/status-dot/types.d.ts +3 -2
- package/dist/components/steps/index.d.vue.ts +3 -3
- package/dist/components/steps/index.vue +21 -14
- package/dist/components/steps/types.d.ts +5 -2
- package/dist/components/stick-to-bottom/index.d.vue.ts +3 -2
- package/dist/components/stick-to-bottom/index.vue +40 -3
- package/dist/components/stick-to-bottom/types.d.ts +9 -2
- package/dist/components/swipe-cell/index.d.vue.ts +4 -4
- package/dist/components/swipe-cell/index.vue +37 -14
- package/dist/components/swipe-cell/types.d.ts +2 -10
- package/dist/components/switch/index.d.vue.ts +4 -4
- package/dist/components/switch/index.vue +48 -13
- package/dist/components/switch/types.d.ts +9 -2
- package/dist/components/switch-item/index.d.vue.ts +7 -1
- package/dist/components/switch-item/index.vue +15 -12
- package/dist/components/switch-item/types.d.ts +10 -1
- package/dist/components/tabs/index.d.vue.ts +4 -4
- package/dist/components/tabs/index.vue +58 -25
- package/dist/components/tabs/tab-slot.d.ts +3 -4
- package/dist/components/tabs/types.d.ts +5 -2
- package/dist/components/text/index.d.vue.ts +2 -1
- package/dist/components/text/index.vue +14 -8
- package/dist/components/text/types.d.ts +5 -3
- package/dist/components/textarea/index.d.vue.ts +6 -6
- package/dist/components/textarea/index.vue +67 -26
- package/dist/components/textarea/types.d.ts +10 -3
- package/dist/components/theme-switcher/index.vue +6 -4
- package/dist/components/time-picker/index.d.vue.ts +3 -4
- package/dist/components/time-picker/index.vue +71 -51
- package/dist/components/time-picker/types.d.ts +9 -3
- package/dist/components/timeline/index.vue +1 -1
- package/dist/components/timeline-item/index.d.vue.ts +3 -2
- package/dist/components/timeline-item/index.vue +19 -14
- package/dist/components/timeline-item/types.d.ts +5 -5
- package/dist/components/toc/index.d.vue.ts +1 -1
- package/dist/components/toc/index.vue +19 -7
- package/dist/components/todo-list/index.d.vue.ts +20 -20
- package/dist/components/todo-list/index.vue +38 -32
- package/dist/components/todo-list/types.d.ts +24 -30
- package/dist/components/toggle/index.d.vue.ts +4 -4
- package/dist/components/toggle/index.vue +47 -19
- package/dist/components/toggle/types.d.ts +7 -2
- package/dist/components/toggle-button/index.d.vue.ts +5 -5
- package/dist/components/toggle-button/index.vue +44 -24
- package/dist/components/toggle-button/types.d.ts +9 -5
- package/dist/components/toggle-button-group/index.d.vue.ts +4 -4
- package/dist/components/toggle-button-group/index.vue +19 -6
- package/dist/components/toggle-button-group/types.d.ts +7 -3
- package/dist/components/tool-call/index.vue +12 -12
- package/dist/components/tool-call/types.d.ts +1 -1
- package/dist/components/tooltip/index.d.vue.ts +2 -2
- package/dist/components/tooltip/index.vue +4 -3
- package/dist/components/tour/index.d.vue.ts +3 -3
- package/dist/components/tour/index.vue +48 -30
- package/dist/components/tour/types.d.ts +5 -2
- package/dist/components/tree/index.d.vue.ts +7 -2
- package/dist/components/tree/index.vue +55 -15
- package/dist/components/tree/types.d.ts +6 -1
- package/dist/components/virtual-list/index.d.vue.ts +6 -4
- package/dist/components/virtual-list/index.vue +37 -11
- package/dist/components/virtual-list/types.d.ts +2 -2
- package/dist/composables/_internal/use-agent-change.d.ts +3 -0
- package/dist/composables/_internal/use-agent-change.js +11 -0
- package/dist/composables/_internal/use-agent-node.d.ts +6 -0
- package/dist/composables/_internal/use-agent-node.js +21 -0
- package/dist/composables/_internal/use-change-details.d.ts +12 -0
- package/dist/composables/_internal/use-change-details.js +107 -0
- package/dist/composables/_internal/use-code-highlight.d.ts +7 -4
- package/dist/composables/_internal/use-code-highlight.js +39 -16
- package/dist/composables/_internal/use-dialog-layer.d.ts +25 -0
- package/dist/composables/_internal/use-dialog-layer.js +197 -0
- package/dist/composables/_internal/use-field-attrs.d.ts +4 -0
- package/dist/composables/_internal/use-field-attrs.js +33 -0
- package/dist/composables/_internal/use-focus-trap.d.ts +4 -3
- package/dist/composables/_internal/use-focus-trap.js +24 -15
- package/dist/composables/_internal/use-form-control.d.ts +22 -0
- package/dist/composables/_internal/use-form-control.js +14 -0
- package/dist/composables/_internal/use-forward-ref-expose.d.ts +1 -1
- package/dist/composables/_internal/use-forward-ref-expose.js +1 -1
- package/dist/composables/_internal/use-list-keyboard-controller.d.ts +1 -1
- package/dist/composables/_internal/use-list-keyboard-controller.js +1 -1
- package/dist/composables/_internal/use-list-navigation.d.ts +1 -2
- package/dist/composables/_internal/use-list-navigation.js +1 -2
- package/dist/composables/_internal/use-list-rows.d.ts +0 -2
- package/dist/composables/_internal/use-list-rows.js +0 -17
- package/dist/composables/_internal/use-list-search.d.ts +5 -2
- package/dist/composables/_internal/use-list-search.js +3 -4
- package/dist/composables/_internal/use-list-selection.d.ts +9 -8
- package/dist/composables/_internal/use-list-selection.js +22 -13
- package/dist/composables/_internal/use-loading-bar-progress.d.ts +21 -0
- package/dist/composables/_internal/use-loading-bar-progress.js +112 -0
- package/dist/composables/_internal/use-mention-editor.d.ts +5 -1
- package/dist/composables/_internal/use-mention-editor.js +83 -3
- package/dist/composables/_internal/use-mention-suggest.js +2 -1
- package/dist/composables/_internal/use-message-group.d.ts +2 -1
- package/dist/composables/_internal/use-message-group.js +52 -22
- package/dist/composables/_internal/use-model-commit.d.ts +7 -0
- package/dist/composables/_internal/use-model-commit.js +23 -0
- package/dist/composables/_internal/use-model-ref.d.ts +16 -0
- package/dist/composables/_internal/use-model-ref.js +14 -0
- package/dist/composables/_internal/use-model-value.d.ts +6 -14
- package/dist/composables/_internal/use-model-value.js +25 -10
- package/dist/composables/_internal/use-overlay-manager.d.ts +7 -14
- package/dist/composables/_internal/use-overlay-manager.js +32 -23
- package/dist/composables/_internal/use-popup-engine.d.ts +72 -0
- package/dist/composables/_internal/use-popup-engine.js +642 -0
- package/dist/composables/_internal/use-remote-search.d.ts +5 -2
- package/dist/composables/_internal/use-remote-search.js +17 -4
- package/dist/composables/_internal/use-selected-list-item.d.ts +1 -1
- package/dist/composables/_internal/use-selected-list-item.js +1 -2
- package/dist/composables/_internal/use-swipe-dismiss.d.ts +16 -0
- package/dist/composables/_internal/use-swipe-dismiss.js +193 -0
- package/dist/composables/_internal/use-swipe-gesture.d.ts +3 -1
- package/dist/composables/_internal/use-swipe-gesture.js +11 -6
- package/dist/composables/_internal/use-top-layer.d.ts +11 -0
- package/dist/composables/_internal/use-top-layer.js +30 -0
- package/dist/composables/_internal/use-tour-target.d.ts +1 -1
- package/dist/composables/_internal/use-tour-target.js +1 -2
- package/dist/composables/_internal/use-tree.d.ts +6 -2
- package/dist/composables/_internal/use-tree.js +3 -4
- package/dist/composables/_internal/use-word-limit.d.ts +1 -2
- package/dist/composables/_internal/use-word-limit.js +1 -2
- package/dist/composables/index.d.ts +4 -0
- package/dist/composables/index.js +4 -0
- package/dist/composables/use-color-scheme.js +1 -1
- package/dist/composables/use-countdown.d.ts +22 -15
- package/dist/composables/use-countdown.js +34 -29
- package/dist/composables/use-deferred-value.d.ts +1 -2
- package/dist/composables/use-deferred-value.js +1 -2
- package/dist/composables/use-delay-change.d.ts +1 -2
- package/dist/composables/use-delay-change.js +1 -2
- package/dist/composables/use-delay-destroy.d.ts +2 -2
- package/dist/composables/use-delay-destroy.js +23 -12
- package/dist/composables/use-details-collapse.d.ts +14 -0
- package/dist/composables/use-details-collapse.js +94 -0
- package/dist/composables/use-form-item.d.ts +2 -0
- package/dist/composables/use-form-item.js +4 -0
- package/dist/composables/use-form.d.ts +2 -0
- package/dist/composables/use-form.js +349 -0
- package/dist/composables/use-hold.d.ts +22 -0
- package/dist/composables/use-hold.js +109 -0
- package/dist/composables/use-intersection-observer.d.ts +1 -1
- package/dist/composables/use-intersection-observer.js +1 -1
- package/dist/composables/use-media-query.js +8 -3
- package/dist/composables/use-message.d.ts +3 -3
- package/dist/composables/use-message.js +3 -3
- package/dist/composables/use-mutation-observer.d.ts +1 -1
- package/dist/composables/use-mutation-observer.js +1 -1
- package/dist/composables/use-outside-click.d.ts +2 -1
- package/dist/composables/use-outside-click.js +1 -2
- package/dist/composables/use-repeat-action.d.ts +2 -1
- package/dist/composables/use-repeat-action.js +1 -2
- package/dist/composables/use-resize-observer.d.ts +1 -1
- package/dist/composables/use-scrollspy.d.ts +1 -2
- package/dist/composables/use-scrollspy.js +1 -2
- package/dist/composables/use-stick-to-bottom.d.ts +2 -2
- package/dist/composables/use-stick-to-bottom.js +9 -10
- package/dist/composables/use-view-transition.js +3 -8
- package/dist/composables/use-virtual-list.d.ts +2 -2
- package/dist/composables/use-virtual-list.js +7 -3
- package/dist/constants/focus.d.ts +1 -0
- package/dist/constants/focus.js +9 -0
- package/dist/constants/popover-panel.d.ts +1 -0
- package/dist/constants/popover-panel.js +1 -0
- package/dist/constants/size.d.ts +7 -0
- package/dist/constants/size.js +7 -0
- package/dist/constants/variant-colors.d.ts +7 -0
- package/dist/constants/variant-colors.js +7 -0
- package/dist/contexts/checkbox.d.ts +1 -0
- package/dist/contexts/choicebox.d.ts +1 -0
- package/dist/contexts/form.d.ts +3 -0
- package/dist/contexts/form.js +6 -0
- package/dist/contexts/radio.d.ts +1 -0
- package/dist/contexts/switch.d.ts +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/locales/en-us.d.ts +26 -0
- package/dist/locales/en-us.js +27 -1
- package/dist/locales/zh-cn.d.ts +26 -0
- package/dist/locales/zh-cn.js +27 -1
- package/dist/styles/styles.css +1 -1
- package/dist/styles/tw.css +38 -56
- package/dist/types/components/button.d.ts +3 -0
- package/dist/types/shared/change.d.ts +23 -0
- package/dist/types/shared/change.js +0 -0
- package/dist/types/shared/form.d.ts +109 -0
- package/dist/types/shared/form.js +0 -0
- package/dist/types/shared/props.d.ts +6 -1
- package/dist/types/shared/utils.d.ts +1 -5
- package/dist/utils/_internal/form-path.d.ts +6 -0
- package/dist/utils/_internal/form-path.js +42 -0
- package/dist/utils/_internal/image-cropper.d.ts +43 -0
- package/dist/utils/_internal/image-cropper.js +320 -0
- package/dist/utils/_internal/observer.d.ts +1 -2
- package/dist/utils/_internal/observer.js +1 -2
- package/dist/utils/_internal/promise.d.ts +5 -0
- package/dist/utils/_internal/promise.js +12 -0
- package/dist/utils/_internal/slider.d.ts +8 -0
- package/dist/utils/_internal/slider.js +15 -0
- package/dist/utils/dom.d.ts +1 -7
- package/dist/utils/dom.js +42 -25
- package/dist/utils/helper.d.ts +1 -9
- package/dist/utils/helper.js +1 -16
- package/dist/utils/is.d.ts +0 -2
- package/dist/utils/is.js +4 -10
- package/dist/utils/mention-html.d.ts +49 -2
- package/dist/utils/mention-html.js +211 -11
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +28 -14
- package/volar.d.ts +6 -2
- package/dist/components/teleport/index.vue +0 -96
- package/dist/components/teleport/types.d.ts +0 -9
- package/dist/composables/_internal/use-details-collapse.d.ts +0 -8
- package/dist/composables/_internal/use-details-collapse.js +0 -93
- package/dist/composables/_internal/use-overlay-dialog.d.ts +0 -25
- package/dist/composables/_internal/use-overlay-dialog.js +0 -23
- package/dist/composables/_internal/use-popover-responsive.d.ts +0 -10
- package/dist/composables/_internal/use-popover-responsive.js +0 -18
- package/dist/utils/_internal/mention-html.d.ts +0 -66
- package/dist/utils/_internal/mention-html.js +0 -176
|
@@ -0,0 +1,320 @@
|
|
|
1
|
+
const turned = (rotation) => rotation % 180 !== 0;
|
|
2
|
+
export function clampValue(value, min, max) {
|
|
3
|
+
return Math.min(Math.max(value, min), Math.max(min, max));
|
|
4
|
+
}
|
|
5
|
+
export function shownSize(size, rotation) {
|
|
6
|
+
return turned(rotation) ? { width: size.height, height: size.width } : size;
|
|
7
|
+
}
|
|
8
|
+
export function completeCrop(crop) {
|
|
9
|
+
return {
|
|
10
|
+
x: crop.x,
|
|
11
|
+
y: crop.y,
|
|
12
|
+
width: crop.width,
|
|
13
|
+
height: crop.height,
|
|
14
|
+
rotation: crop.rotation ?? 0,
|
|
15
|
+
flipX: !!crop.flipX,
|
|
16
|
+
flipY: !!crop.flipY
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
export function sameCrop(a, b) {
|
|
20
|
+
return a.x === b.x && a.y === b.y && a.width === b.width && a.height === b.height && a.rotation === b.rotation && a.flipX === b.flipX && a.flipY === b.flipY;
|
|
21
|
+
}
|
|
22
|
+
export function roundCrop(crop) {
|
|
23
|
+
return {
|
|
24
|
+
...crop,
|
|
25
|
+
x: Math.round(crop.x),
|
|
26
|
+
y: Math.round(crop.y),
|
|
27
|
+
width: Math.max(1, Math.round(crop.width)),
|
|
28
|
+
height: Math.max(1, Math.round(crop.height))
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
export function zoomOf(crop, size) {
|
|
32
|
+
const shown = shownSize(size, crop.rotation);
|
|
33
|
+
return Math.min(shown.width / crop.width, shown.height / crop.height);
|
|
34
|
+
}
|
|
35
|
+
export function largestSize(size, aspect) {
|
|
36
|
+
if (!aspect) {
|
|
37
|
+
return { width: size.width, height: size.height };
|
|
38
|
+
}
|
|
39
|
+
const width = Math.min(size.width, size.height * aspect);
|
|
40
|
+
return { width, height: width / aspect };
|
|
41
|
+
}
|
|
42
|
+
export function smallestSize(size, limits) {
|
|
43
|
+
const { aspect, minWidth, minHeight, maxZoom } = limits;
|
|
44
|
+
if (!aspect) {
|
|
45
|
+
return {
|
|
46
|
+
width: Math.max(minWidth, size.width / maxZoom),
|
|
47
|
+
height: Math.max(minHeight, size.height / maxZoom)
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
const width = Math.max(minWidth, minHeight * aspect, largestSize(size, aspect).width / maxZoom);
|
|
51
|
+
return { width, height: width / aspect };
|
|
52
|
+
}
|
|
53
|
+
function centered(size, center, shown) {
|
|
54
|
+
return {
|
|
55
|
+
x: clampValue(center.x - size.width / 2, 0, Math.max(0, shown.width - size.width)),
|
|
56
|
+
y: clampValue(center.y - size.height / 2, 0, Math.max(0, shown.height - size.height)),
|
|
57
|
+
width: size.width,
|
|
58
|
+
height: size.height
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
export function initialCrop(size, limits, mode) {
|
|
62
|
+
const full = largestSize(size, limits.aspect);
|
|
63
|
+
const min = smallestSize(size, limits);
|
|
64
|
+
const inset = mode === "frame" ? 1 : Math.min(1, Math.max(0.8, min.width / full.width, min.height / full.height));
|
|
65
|
+
const box = centered(
|
|
66
|
+
{ width: full.width * inset, height: full.height * inset },
|
|
67
|
+
{ x: size.width / 2, y: size.height / 2 },
|
|
68
|
+
size
|
|
69
|
+
);
|
|
70
|
+
return roundCrop({ ...box, rotation: 0, flipX: false, flipY: false });
|
|
71
|
+
}
|
|
72
|
+
function resizeBox(from, handle, dx, dy, limits) {
|
|
73
|
+
const area = limits.bounds;
|
|
74
|
+
const left = area?.left ?? -Infinity;
|
|
75
|
+
const top = area?.top ?? -Infinity;
|
|
76
|
+
const right = area?.right ?? Infinity;
|
|
77
|
+
const bottom = area?.bottom ?? Infinity;
|
|
78
|
+
if (handle === "move") {
|
|
79
|
+
return {
|
|
80
|
+
...from,
|
|
81
|
+
x: clampValue(from.x + dx, left, Math.max(left, right - from.width)),
|
|
82
|
+
y: clampValue(from.y + dy, top, Math.max(top, bottom - from.height))
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
const min = limits.min ?? { width: 1, height: 1 };
|
|
86
|
+
const max = limits.max ?? { width: Infinity, height: Infinity };
|
|
87
|
+
const west = handle.includes("w");
|
|
88
|
+
const east = handle.includes("e");
|
|
89
|
+
const north = handle.includes("n");
|
|
90
|
+
const south = handle.includes("s");
|
|
91
|
+
const anchorX = west ? from.x + from.width : from.x;
|
|
92
|
+
const anchorY = north ? from.y + from.height : from.y;
|
|
93
|
+
const roomX = Math.min(max.width, west ? anchorX - left : right - anchorX);
|
|
94
|
+
const roomY = Math.min(max.height, north ? anchorY - top : bottom - anchorY);
|
|
95
|
+
let width = west ? from.width - dx : east ? from.width + dx : from.width;
|
|
96
|
+
let height = north ? from.height - dy : south ? from.height + dy : from.height;
|
|
97
|
+
const ratio = limits.aspect;
|
|
98
|
+
if (ratio) {
|
|
99
|
+
if ((west || east) && (north || south)) {
|
|
100
|
+
if (Math.abs(width / from.width - 1) >= Math.abs(height / from.height - 1)) {
|
|
101
|
+
height = width / ratio;
|
|
102
|
+
} else {
|
|
103
|
+
width = height * ratio;
|
|
104
|
+
}
|
|
105
|
+
} else if (west || east) {
|
|
106
|
+
height = width / ratio;
|
|
107
|
+
} else {
|
|
108
|
+
width = height * ratio;
|
|
109
|
+
}
|
|
110
|
+
const middleY = from.y + from.height / 2;
|
|
111
|
+
const middleX = from.x + from.width / 2;
|
|
112
|
+
const fitY = north || south ? roomY : 2 * Math.min(middleY - top, bottom - middleY, max.height / 2);
|
|
113
|
+
const fitX = west || east ? roomX : 2 * Math.min(middleX - left, right - middleX, max.width / 2);
|
|
114
|
+
width = clampValue(width, Math.max(min.width, min.height * ratio), Math.min(fitX, fitY * ratio));
|
|
115
|
+
height = width / ratio;
|
|
116
|
+
} else {
|
|
117
|
+
width = clampValue(width, min.width, Math.max(min.width, roomX));
|
|
118
|
+
height = clampValue(height, min.height, Math.max(min.height, roomY));
|
|
119
|
+
}
|
|
120
|
+
const x = west ? anchorX - width : east ? anchorX : from.x + (from.width - width) / 2;
|
|
121
|
+
const y = north ? anchorY - height : south ? anchorY : from.y + (from.height - height) / 2;
|
|
122
|
+
return { x, y, width, height };
|
|
123
|
+
}
|
|
124
|
+
export function resizeCrop(crop, size, handle, dx, dy, limits, keepRatio = false) {
|
|
125
|
+
const shown = shownSize(size, crop.rotation);
|
|
126
|
+
const aspect = limits.aspect ?? (keepRatio ? crop.width / crop.height : void 0);
|
|
127
|
+
const box = resizeBox(crop, handle, dx, dy, {
|
|
128
|
+
bounds: { left: 0, top: 0, right: shown.width, bottom: shown.height },
|
|
129
|
+
min: smallestSize(shown, { ...limits, aspect }),
|
|
130
|
+
aspect
|
|
131
|
+
});
|
|
132
|
+
return roundCrop({ ...crop, ...box });
|
|
133
|
+
}
|
|
134
|
+
export function zoomCrop(crop, size, zoom, limits, at) {
|
|
135
|
+
const shown = shownSize(size, crop.rotation);
|
|
136
|
+
const ratio = limits.aspect ?? crop.width / crop.height;
|
|
137
|
+
const full = largestSize(shown, ratio);
|
|
138
|
+
const least = smallestSize(shown, { ...limits, aspect: ratio });
|
|
139
|
+
const most = Math.max(1, Math.min(full.width / least.width, full.height / least.height));
|
|
140
|
+
const next = clampValue(zoom, 1, most);
|
|
141
|
+
const width = full.width / next;
|
|
142
|
+
const height = full.height / next;
|
|
143
|
+
const point = at ?? { x: crop.x + crop.width / 2, y: crop.y + crop.height / 2 };
|
|
144
|
+
const k = width / crop.width;
|
|
145
|
+
const box = {
|
|
146
|
+
x: clampValue(point.x - (point.x - crop.x) * k, 0, shown.width - width),
|
|
147
|
+
y: clampValue(point.y - (point.y - crop.y) * (height / crop.height), 0, shown.height - height),
|
|
148
|
+
width,
|
|
149
|
+
height
|
|
150
|
+
};
|
|
151
|
+
return roundCrop({ ...crop, ...box });
|
|
152
|
+
}
|
|
153
|
+
export function rotateCrop(crop, size, direction, limits) {
|
|
154
|
+
const shown = shownSize(size, crop.rotation);
|
|
155
|
+
const box = direction === 1 ? {
|
|
156
|
+
x: shown.height - crop.y - crop.height,
|
|
157
|
+
y: crop.x,
|
|
158
|
+
width: crop.height,
|
|
159
|
+
height: crop.width
|
|
160
|
+
} : {
|
|
161
|
+
x: crop.y,
|
|
162
|
+
y: shown.width - crop.x - crop.width,
|
|
163
|
+
width: crop.height,
|
|
164
|
+
height: crop.width
|
|
165
|
+
};
|
|
166
|
+
const rotation = (crop.rotation + (direction === 1 ? 90 : 270)) % 360;
|
|
167
|
+
const next = { ...box, rotation, flipX: crop.flipY, flipY: crop.flipX };
|
|
168
|
+
if (!limits.aspect) {
|
|
169
|
+
return roundCrop(next);
|
|
170
|
+
}
|
|
171
|
+
const turnedShown = shownSize(size, rotation);
|
|
172
|
+
const full = largestSize(turnedShown, limits.aspect);
|
|
173
|
+
const zoom = Math.min(zoomOf(crop, size), full.width / smallestSize(turnedShown, limits).width);
|
|
174
|
+
const nextSize = { width: full.width / zoom, height: full.height / zoom };
|
|
175
|
+
const center = { x: box.x + box.width / 2, y: box.y + box.height / 2 };
|
|
176
|
+
return roundCrop({ ...next, ...centered(nextSize, center, turnedShown) });
|
|
177
|
+
}
|
|
178
|
+
export function flipCrop(crop, size, direction) {
|
|
179
|
+
const shown = shownSize(size, crop.rotation);
|
|
180
|
+
return direction === "horizontal" ? { ...crop, x: shown.width - crop.x - crop.width, flipX: !crop.flipX } : { ...crop, y: shown.height - crop.y - crop.height, flipY: !crop.flipY };
|
|
181
|
+
}
|
|
182
|
+
export function fitCrop(crop, size, limits) {
|
|
183
|
+
const { aspect } = limits;
|
|
184
|
+
if (!aspect || Math.abs(crop.width / aspect - crop.height) <= 1) {
|
|
185
|
+
return crop;
|
|
186
|
+
}
|
|
187
|
+
const shown = shownSize(size, crop.rotation);
|
|
188
|
+
const full = largestSize(shown, aspect);
|
|
189
|
+
const zoom = Math.min(zoomOf(crop, size), full.width / smallestSize(shown, limits).width);
|
|
190
|
+
const nextSize = { width: full.width / zoom, height: full.height / zoom };
|
|
191
|
+
return roundCrop({
|
|
192
|
+
...crop,
|
|
193
|
+
...centered(nextSize, { x: crop.x + crop.width / 2, y: crop.y + crop.height / 2 }, shown)
|
|
194
|
+
});
|
|
195
|
+
}
|
|
196
|
+
export function layoutOf(crop, size, box, mode, aspect) {
|
|
197
|
+
const shown = shownSize(size, crop.rotation);
|
|
198
|
+
if (mode === "frame") {
|
|
199
|
+
const ratio = aspect ?? crop.width / crop.height;
|
|
200
|
+
const width = Math.min(box.width, box.height * ratio);
|
|
201
|
+
const height = width / ratio;
|
|
202
|
+
const selection2 = {
|
|
203
|
+
left: box.left + (box.width - width) / 2,
|
|
204
|
+
top: box.top + (box.height - height) / 2,
|
|
205
|
+
width,
|
|
206
|
+
height
|
|
207
|
+
};
|
|
208
|
+
const scale2 = width / crop.width;
|
|
209
|
+
const image2 = {
|
|
210
|
+
left: selection2.left - crop.x * scale2,
|
|
211
|
+
top: selection2.top - crop.y * scale2,
|
|
212
|
+
width: shown.width * scale2,
|
|
213
|
+
height: shown.height * scale2
|
|
214
|
+
};
|
|
215
|
+
return { scale: scale2, image: image2, selection: selection2 };
|
|
216
|
+
}
|
|
217
|
+
const scale = Math.min(box.width / shown.width, box.height / shown.height);
|
|
218
|
+
const image = {
|
|
219
|
+
left: box.left + (box.width - shown.width * scale) / 2,
|
|
220
|
+
top: box.top + (box.height - shown.height * scale) / 2,
|
|
221
|
+
width: shown.width * scale,
|
|
222
|
+
height: shown.height * scale
|
|
223
|
+
};
|
|
224
|
+
const selection = {
|
|
225
|
+
left: image.left + crop.x * scale,
|
|
226
|
+
top: image.top + crop.y * scale,
|
|
227
|
+
width: crop.width * scale,
|
|
228
|
+
height: crop.height * scale
|
|
229
|
+
};
|
|
230
|
+
return { scale, image, selection };
|
|
231
|
+
}
|
|
232
|
+
const EXTENSIONS = {
|
|
233
|
+
"image/jpeg": "jpg",
|
|
234
|
+
"image/png": "png",
|
|
235
|
+
"image/webp": "webp"
|
|
236
|
+
};
|
|
237
|
+
const ENCODE_ERROR = 'The image could not be encoded. A cross-origin image needs CORS headers and crossorigin="anonymous".';
|
|
238
|
+
function outputSize(crop, options) {
|
|
239
|
+
const ratio = crop.width / crop.height;
|
|
240
|
+
const width = options.width ?? (options.height === void 0 ? crop.width : options.height * ratio);
|
|
241
|
+
const height = options.height ?? width / ratio;
|
|
242
|
+
return {
|
|
243
|
+
width: Math.max(1, Math.round(width)),
|
|
244
|
+
height: Math.max(1, Math.round(height))
|
|
245
|
+
};
|
|
246
|
+
}
|
|
247
|
+
function drawCrop(context, image, crop, size, circle) {
|
|
248
|
+
const natural = { width: image.naturalWidth, height: image.naturalHeight };
|
|
249
|
+
const rotation = crop.rotation;
|
|
250
|
+
const rotated = turned(rotation);
|
|
251
|
+
const shown = rotated ? { width: natural.height, height: natural.width } : natural;
|
|
252
|
+
context.imageSmoothingQuality = "high";
|
|
253
|
+
if (circle) {
|
|
254
|
+
context.beginPath();
|
|
255
|
+
context.ellipse(
|
|
256
|
+
size.width / 2,
|
|
257
|
+
size.height / 2,
|
|
258
|
+
size.width / 2,
|
|
259
|
+
size.height / 2,
|
|
260
|
+
0,
|
|
261
|
+
0,
|
|
262
|
+
Math.PI * 2
|
|
263
|
+
);
|
|
264
|
+
context.clip();
|
|
265
|
+
}
|
|
266
|
+
context.scale(size.width / crop.width, size.height / crop.height);
|
|
267
|
+
context.translate(shown.width / 2 - crop.x, shown.height / 2 - crop.y);
|
|
268
|
+
context.scale(crop.flipX ? -1 : 1, crop.flipY ? -1 : 1);
|
|
269
|
+
context.rotate(rotation * Math.PI / 180);
|
|
270
|
+
context.drawImage(image, -natural.width / 2, -natural.height / 2);
|
|
271
|
+
}
|
|
272
|
+
function encode(size, draw, type, quality) {
|
|
273
|
+
const canvas = document.createElement("canvas");
|
|
274
|
+
const context = canvas.getContext("2d");
|
|
275
|
+
canvas.width = size.width;
|
|
276
|
+
canvas.height = size.height;
|
|
277
|
+
if (!context) {
|
|
278
|
+
throw new Error("The image could not be drawn.");
|
|
279
|
+
}
|
|
280
|
+
draw(context);
|
|
281
|
+
return new Promise((resolve, reject) => {
|
|
282
|
+
try {
|
|
283
|
+
canvas.toBlob(
|
|
284
|
+
(blob) => {
|
|
285
|
+
if (blob) {
|
|
286
|
+
resolve(blob);
|
|
287
|
+
} else {
|
|
288
|
+
reject(new Error(ENCODE_ERROR));
|
|
289
|
+
}
|
|
290
|
+
},
|
|
291
|
+
type,
|
|
292
|
+
quality
|
|
293
|
+
);
|
|
294
|
+
} catch {
|
|
295
|
+
reject(new Error(ENCODE_ERROR));
|
|
296
|
+
}
|
|
297
|
+
});
|
|
298
|
+
}
|
|
299
|
+
function fileNameOf(src, type, name) {
|
|
300
|
+
if (name) {
|
|
301
|
+
return name;
|
|
302
|
+
}
|
|
303
|
+
const extension = EXTENSIONS[type] ?? type.split("/")[1] ?? "png";
|
|
304
|
+
const base = src.startsWith("data:") ? "image" : (src.split(/[?#]/)[0].split("/").pop() || "image").replace(/\.[^.]*$/, "");
|
|
305
|
+
return `${base}.${extension}`;
|
|
306
|
+
}
|
|
307
|
+
export async function cropImageElement(image, crop, src, shape, options = {}) {
|
|
308
|
+
if (!(crop.width > 0 && crop.height > 0)) {
|
|
309
|
+
throw new RangeError("A crop needs a width and a height above 0.");
|
|
310
|
+
}
|
|
311
|
+
const size = outputSize(crop, options);
|
|
312
|
+
const type = options.type ?? "image/png";
|
|
313
|
+
const blob = await encode(
|
|
314
|
+
size,
|
|
315
|
+
(context) => drawCrop(context, image, crop, size, shape === "circle"),
|
|
316
|
+
type,
|
|
317
|
+
options.quality
|
|
318
|
+
);
|
|
319
|
+
return new File([blob], fileNameOf(src, blob.type, options.name), { type: blob.type });
|
|
320
|
+
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import type { MaybeRefOrGetter } from '../../types/shared/utils';
|
|
2
1
|
import type { Nullable } from '../../types/shared/utils.js';
|
|
3
|
-
import type { Ref } from 'vue';
|
|
2
|
+
import type { Ref, MaybeRefOrGetter } from 'vue';
|
|
4
3
|
export type TargetRef = MaybeRefOrGetter<Nullable<HTMLElement>> | MaybeRefOrGetter<Nullable<HTMLElement>>[] | MaybeRefOrGetter<Nullable<HTMLElement>[]>;
|
|
5
4
|
/**
|
|
6
5
|
* The only native method this factory calls itself. Target bookkeeping goes through
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { onScopeDispose, shallowRef, watch } from "vue";
|
|
1
|
+
import { onScopeDispose, shallowRef, watch, toValue } from "vue";
|
|
2
2
|
import { getElement } from "../dom.js";
|
|
3
3
|
import { toArray } from "../format.js";
|
|
4
|
-
import { toValue } from "../helper.js";
|
|
5
4
|
import { isNotNil, isServer } from "../is.js";
|
|
6
5
|
function resolveTargets(source) {
|
|
7
6
|
return [
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export function withResolvers() {
|
|
2
|
+
if (typeof Promise.withResolvers === "function") {
|
|
3
|
+
return Promise.withResolvers();
|
|
4
|
+
}
|
|
5
|
+
let resolve;
|
|
6
|
+
let reject;
|
|
7
|
+
const promise = new Promise((res, rej) => {
|
|
8
|
+
resolve = res;
|
|
9
|
+
reject = rej;
|
|
10
|
+
});
|
|
11
|
+
return { promise, resolve, reject };
|
|
12
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
interface RectLike {
|
|
2
|
+
left: number;
|
|
3
|
+
width: number;
|
|
4
|
+
}
|
|
5
|
+
export declare function getPercentage(value: number, min: number, max: number): number;
|
|
6
|
+
export declare function getRelativePosition(clientX: number, rect: RectLike): number;
|
|
7
|
+
export declare function getLabelShift(percentage: number, labelWidth: number, trackWidth: number): number;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { clampValue } from "../format.js";
|
|
2
|
+
export function getPercentage(value, min, max) {
|
|
3
|
+
return clampValue((value - min) / (max - min) * 100, 0, 100);
|
|
4
|
+
}
|
|
5
|
+
export function getRelativePosition(clientX, rect) {
|
|
6
|
+
return clampValue((clientX - rect.left) / rect.width, 0, 1);
|
|
7
|
+
}
|
|
8
|
+
export function getLabelShift(percentage, labelWidth, trackWidth) {
|
|
9
|
+
if (!trackWidth || labelWidth > trackWidth) {
|
|
10
|
+
return 0;
|
|
11
|
+
}
|
|
12
|
+
const center = percentage / 100 * trackWidth;
|
|
13
|
+
const half = labelWidth / 2;
|
|
14
|
+
return clampValue(center, half, trackWidth - half) - center;
|
|
15
|
+
}
|
package/dist/utils/dom.d.ts
CHANGED
|
@@ -1,15 +1,9 @@
|
|
|
1
|
-
import type { MaybeRefOrGetter } from '
|
|
2
|
-
import type { ComponentPublicInstance } from 'vue';
|
|
1
|
+
import type { ComponentPublicInstance, MaybeRefOrGetter } from 'vue';
|
|
3
2
|
type ElementType = null | string | object | SVGElement | HTMLElement | ComponentPublicInstance;
|
|
4
3
|
export declare function getStyle(el: HTMLElement): CSSStyleDeclaration;
|
|
5
4
|
export declare function getElement(el?: MaybeRefOrGetter<ElementType>, from?: MaybeRefOrGetter<HTMLElement>): HTMLElement | null;
|
|
6
5
|
/** Whether the element scrolls with the viewport instead of scrolling on its own. */
|
|
7
6
|
export declare function isViewportScroll(el: HTMLElement): boolean;
|
|
8
|
-
/** Viewport-relative top offset for scrollspy */
|
|
9
|
-
export declare function getElementOffsetFromScrollContainer(element: Element, scrollContainer: HTMLElement): {
|
|
10
|
-
top: number;
|
|
11
|
-
left: number;
|
|
12
|
-
};
|
|
13
7
|
/** Whether the element is allowed to scroll on each axis by its computed `overflow`. */
|
|
14
8
|
export declare function isScrollable(el: HTMLElement): {
|
|
15
9
|
x: boolean;
|
package/dist/utils/dom.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { toValue } from "
|
|
1
|
+
import { toValue } from "vue";
|
|
2
2
|
import { isServer } from "./is.js";
|
|
3
3
|
function getWindowTop() {
|
|
4
4
|
return [window, document, document.documentElement];
|
|
@@ -10,8 +10,11 @@ export function getStyle(el) {
|
|
|
10
10
|
return document.defaultView?.getComputedStyle(el, null) || el.style;
|
|
11
11
|
}
|
|
12
12
|
export function getElement(el, from) {
|
|
13
|
+
if (isServer()) {
|
|
14
|
+
return null;
|
|
15
|
+
}
|
|
13
16
|
el = toValue(el);
|
|
14
|
-
if (!el
|
|
17
|
+
if (!el) {
|
|
15
18
|
return null;
|
|
16
19
|
}
|
|
17
20
|
if (typeof el === "string") {
|
|
@@ -20,25 +23,12 @@ export function getElement(el, from) {
|
|
|
20
23
|
if (el instanceof Element) {
|
|
21
24
|
return el;
|
|
22
25
|
}
|
|
23
|
-
|
|
26
|
+
const node = el?.$el;
|
|
27
|
+
return node instanceof HTMLElement ? node : null;
|
|
24
28
|
}
|
|
25
29
|
export function isViewportScroll(el) {
|
|
26
30
|
return getWindowTop().includes(el) || el === document.body;
|
|
27
31
|
}
|
|
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
|
-
}
|
|
42
32
|
export function isScrollable(el) {
|
|
43
33
|
const { overflowX, overflowY } = getStyle(el);
|
|
44
34
|
const allowValues = ["scroll", "auto", "overlay"];
|
|
@@ -84,15 +74,18 @@ export function getScrollListener(target) {
|
|
|
84
74
|
}
|
|
85
75
|
return target;
|
|
86
76
|
}
|
|
77
|
+
function finite(value) {
|
|
78
|
+
return typeof value === "number" && Number.isFinite(value) ? value : 0;
|
|
79
|
+
}
|
|
87
80
|
export function getScrollPosition(el) {
|
|
88
81
|
const target = el instanceof HTMLElement ? el : document.documentElement;
|
|
89
82
|
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
|
|
83
|
+
scrollTop: finite(target.scrollTop),
|
|
84
|
+
scrollLeft: finite(target.scrollLeft),
|
|
85
|
+
scrollWidth: finite(target.scrollWidth),
|
|
86
|
+
scrollHeight: finite(target.scrollHeight),
|
|
87
|
+
clientWidth: finite(target.clientWidth),
|
|
88
|
+
clientHeight: finite(target.clientHeight)
|
|
96
89
|
};
|
|
97
90
|
}
|
|
98
91
|
function isOverflowScroller(ele) {
|
|
@@ -110,9 +103,33 @@ export function isOverflowScrollable(ele) {
|
|
|
110
103
|
}
|
|
111
104
|
return isOverflowScrollable(parent);
|
|
112
105
|
}
|
|
106
|
+
const ANIMATION_WAIT_GRACE = 1e3;
|
|
113
107
|
export async function awaitAnimationEnd(element) {
|
|
114
|
-
const
|
|
115
|
-
|
|
108
|
+
const running = (element?.getAnimations?.() ?? []).flatMap((animation) => {
|
|
109
|
+
const endTime = animation.effect?.getComputedTiming().endTime;
|
|
110
|
+
if (typeof endTime !== "number" || !Number.isFinite(endTime)) {
|
|
111
|
+
return [];
|
|
112
|
+
}
|
|
113
|
+
const currentTime = typeof animation.currentTime === "number" ? animation.currentTime : 0;
|
|
114
|
+
return [{ animation, remaining: Math.max(0, endTime - currentTime) }];
|
|
115
|
+
});
|
|
116
|
+
if (running.length === 0) {
|
|
117
|
+
return;
|
|
118
|
+
}
|
|
119
|
+
const limit = Math.max(...running.map((entry) => entry.remaining)) + ANIMATION_WAIT_GRACE;
|
|
120
|
+
let timer;
|
|
121
|
+
try {
|
|
122
|
+
await Promise.race([
|
|
123
|
+
Promise.allSettled(running.map((entry) => entry.animation.finished)),
|
|
124
|
+
new Promise((resolve) => {
|
|
125
|
+
timer = setTimeout(resolve, limit);
|
|
126
|
+
})
|
|
127
|
+
]);
|
|
128
|
+
} finally {
|
|
129
|
+
if (timer != null) {
|
|
130
|
+
clearTimeout(timer);
|
|
131
|
+
}
|
|
132
|
+
}
|
|
116
133
|
}
|
|
117
134
|
export function resolveScrollBehavior(behavior, prefersMotionReduce) {
|
|
118
135
|
if (behavior === "auto") {
|
package/dist/utils/helper.d.ts
CHANGED
|
@@ -1,14 +1,6 @@
|
|
|
1
1
|
import type { ResponsiveValue } from '../types/shared/props';
|
|
2
|
-
import type { Nullable
|
|
2
|
+
import type { Nullable } from '../types/shared/utils';
|
|
3
3
|
export declare function getUniqueId(prefix?: string): string;
|
|
4
4
|
export declare function getFallbackValue<Variants extends Record<string, any>>(variant: Nullable<string>, variants: Variants, defaultVariant?: keyof Variants): any;
|
|
5
5
|
export declare function getColorByThreshold(value: number, colors: Record<string, string>): string;
|
|
6
6
|
export declare function getResponsiveValue<V extends string | number>(prop: ResponsiveValue<V> | undefined, xsValue: Nullable<V>, valueSetter: (acc: Record<string, V>, bp: any, v: V) => void): Record<string, V>;
|
|
7
|
-
export declare function toValue<T>(source: MaybeRefOrGetter<T>): T;
|
|
8
|
-
type PromiseWithResolvers<T> = {
|
|
9
|
-
promise: Promise<T>;
|
|
10
|
-
resolve: (value: T | PromiseLike<T>) => void;
|
|
11
|
-
reject: (reason?: unknown) => void;
|
|
12
|
-
};
|
|
13
|
-
export declare function withResolvers<T>(): PromiseWithResolvers<T>;
|
|
14
|
-
export {};
|
package/dist/utils/helper.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { getCurrentInstance
|
|
1
|
+
import { getCurrentInstance } from "vue";
|
|
2
2
|
import { isNil } from "./is.js";
|
|
3
3
|
let fallbackId = 0;
|
|
4
4
|
const uniqueIdMap = /* @__PURE__ */ new WeakMap();
|
|
@@ -40,18 +40,3 @@ export function getResponsiveValue(prop, xsValue, valueSetter) {
|
|
|
40
40
|
{}
|
|
41
41
|
);
|
|
42
42
|
}
|
|
43
|
-
export function toValue(source) {
|
|
44
|
-
return typeof source === "function" ? source() : unref(source);
|
|
45
|
-
}
|
|
46
|
-
export function withResolvers() {
|
|
47
|
-
if (typeof Promise.withResolvers === "function") {
|
|
48
|
-
return Promise.withResolvers();
|
|
49
|
-
}
|
|
50
|
-
let resolve;
|
|
51
|
-
let reject;
|
|
52
|
-
const promise = new Promise((res, rej) => {
|
|
53
|
-
resolve = res;
|
|
54
|
-
reject = rej;
|
|
55
|
-
});
|
|
56
|
-
return { promise, resolve, reject };
|
|
57
|
-
}
|
package/dist/utils/is.d.ts
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
export declare const isVue3: () => boolean;
|
|
2
1
|
export declare const isServer: () => boolean;
|
|
3
2
|
export declare const isTouchDevice: () => boolean;
|
|
4
|
-
export declare function isIOS(): boolean;
|
|
5
3
|
export declare const isNil: (value: unknown) => value is null | undefined;
|
|
6
4
|
export declare const isNotNil: <T>(value: T | null | undefined) => value is T;
|
|
7
5
|
export declare const isUndefined: (value: unknown) => value is undefined;
|
package/dist/utils/is.js
CHANGED
|
@@ -1,16 +1,10 @@
|
|
|
1
|
-
import { version } from "vue";
|
|
2
|
-
export const isVue3 = () => version.startsWith("3");
|
|
3
1
|
export const isServer = () => typeof document === "undefined";
|
|
4
|
-
export const isTouchDevice = () =>
|
|
5
|
-
|
|
6
|
-
if (isServer()) {
|
|
2
|
+
export const isTouchDevice = () => {
|
|
3
|
+
if (isServer() || typeof matchMedia !== "function") {
|
|
7
4
|
return false;
|
|
8
5
|
}
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
// https://github.com/vueuse/vueuse/issues/3577
|
|
12
|
-
navigator?.maxTouchPoints > 2 && /iPad|Macintosh/.test(userAgent);
|
|
13
|
-
}
|
|
6
|
+
return matchMedia("(hover: none) and (pointer: coarse)").matches;
|
|
7
|
+
};
|
|
14
8
|
export const isNil = (value) => value == null;
|
|
15
9
|
export const isNotNil = (value) => value != null;
|
|
16
10
|
export const isUndefined = (value) => value === void 0;
|
|
@@ -1,6 +1,53 @@
|
|
|
1
1
|
import type { MentionHtmlToTextOptions, MentionHtmlToken } from '../components/mention/types';
|
|
2
|
-
export
|
|
3
|
-
|
|
2
|
+
export declare const MENTION_TAG_LOWER: string;
|
|
3
|
+
/** The trigger a chip falls back to when its markup carries no `trigger` attribute. */
|
|
4
|
+
export declare const DEFAULT_TRIGGER = "@";
|
|
5
|
+
/**
|
|
6
|
+
* A collapsed selection sitting right after a `contenteditable=false` element is
|
|
7
|
+
* not representable; Android resolves it *into* the element, the IME then finds
|
|
8
|
+
* no editable context and hides the keyboard. A zero-width space after every chip
|
|
9
|
+
* gives the caret a real text node to live in. It is stripped on serialize, so it
|
|
10
|
+
* never reaches the public HTML, the v-model or the server.
|
|
11
|
+
*/
|
|
12
|
+
export declare const CARET_ANCHOR = "\u200B";
|
|
13
|
+
/**
|
|
14
|
+
* The space a chip owns on its right. It must be a no-break space: Chrome
|
|
15
|
+
* normalizes a trailing plain space away as soon as the next character is typed
|
|
16
|
+
* into that text node, and the value loses the separation the chip was picked
|
|
17
|
+
* with. Serialization turns it back into an ordinary space.
|
|
18
|
+
*/
|
|
19
|
+
export declare const CHIP_SEPARATOR = "\u00A0";
|
|
20
|
+
export declare function createCaretAnchor(): Text;
|
|
21
|
+
/**
|
|
22
|
+
* Length of the chip's own prefix — the caret anchor plus at most one separator —
|
|
23
|
+
* at the start of `text`. Zero when the text does not start with an anchor.
|
|
24
|
+
*/
|
|
25
|
+
export declare function chipPrefixLength(text: Text): number;
|
|
26
|
+
export declare function isMentionElement(node: Node | null | undefined): boolean;
|
|
27
|
+
/**
|
|
28
|
+
* Every chip in `root`. Pressing Enter nests content in block elements, so the
|
|
29
|
+
* editor's direct children are not enough.
|
|
30
|
+
*/
|
|
31
|
+
export declare function queryMentionElements(root: ParentNode): HTMLElement[];
|
|
32
|
+
export declare function getMentionLabel(el: HTMLElement): string;
|
|
33
|
+
export declare function createMentionElement(key: string, label: string, trigger?: string): HTMLElement;
|
|
34
|
+
/** Escape plain text for paste fallback (newlines → `<br>`). */
|
|
35
|
+
export declare function escapePlainTextAsHtml(text: string): string;
|
|
36
|
+
/**
|
|
37
|
+
* Serialize an editor DOM tree into the public HTML contract:
|
|
38
|
+
* plain text + `<mention key="...">label</mention>` only.
|
|
39
|
+
*/
|
|
40
|
+
export declare function serializeMentionHtml(root: HTMLElement): string;
|
|
41
|
+
/**
|
|
42
|
+
* Paste sanitizer: keep legal `<mention key>` nodes; everything else becomes text.
|
|
43
|
+
*/
|
|
44
|
+
export declare function sanitizeMentionClipboardHtml(html: string): DocumentFragment;
|
|
45
|
+
/**
|
|
46
|
+
* Our copies carry the editor's edge line breaks as `\n`, so pasting them back would
|
|
47
|
+
* add a blank line on every round trip.
|
|
48
|
+
*/
|
|
49
|
+
export declare function trimMentionEdgeBreaks(fragment: DocumentFragment): DocumentFragment;
|
|
50
|
+
export declare function setMentionEditorContent(root: HTMLElement, html: string): void;
|
|
4
51
|
/**
|
|
5
52
|
* Parse the public mention HTML contract (text + legal `<mention>` only) into a
|
|
6
53
|
* flat token list. Blocks and `<br>` become `\n` text, so joining the text
|