@hina-ui/vue 1.7.5 → 1.7.6
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 +37 -0
- package/dist/index.js +2222 -987
- package/dist/index.js.map +1 -1
- package/dist/shared/behavior/anchor-follow.ts +95 -0
- package/dist/shared/behavior/form.ts +187 -0
- package/dist/shared/behavior/ripple.ts +222 -0
- package/dist/shared/behavior/spoiler/painter.ts +197 -0
- package/dist/shared/behavior/spoiler/worklet.ts +199 -0
- package/dist/shared/behavior/toast.ts +243 -0
- package/dist/shared/lib/anchor.ts +83 -0
- package/dist/shared/lib/banner.ts +10 -0
- package/dist/shared/lib/calendar/format.ts +23 -0
- package/dist/shared/lib/caret.ts +48 -0
- package/dist/shared/lib/collapse.ts +29 -0
- package/dist/shared/lib/command-palette/hotkey.ts +27 -0
- package/dist/shared/lib/command-palette/match.ts +92 -0
- package/dist/shared/lib/data-list.ts +40 -0
- package/dist/shared/lib/data-table/column-sizing-styles.ts +41 -0
- package/dist/shared/lib/data-table/column-sizing.ts +101 -0
- package/dist/shared/lib/data-table/csv.ts +51 -0
- package/dist/shared/lib/data-table/layout.ts +199 -0
- package/dist/shared/lib/data-table/resize.ts +66 -0
- package/dist/shared/lib/data-table/state.ts +226 -0
- package/dist/shared/lib/data-table/utils.ts +80 -0
- package/dist/shared/lib/date-range-field/validity.ts +21 -0
- package/dist/shared/lib/date.ts +111 -0
- package/dist/shared/lib/field-focus.ts +36 -0
- package/dist/shared/lib/file-upload/select.ts +58 -0
- package/dist/shared/lib/file-upload/size.ts +16 -0
- package/dist/shared/lib/form/errors.ts +48 -0
- package/dist/shared/lib/form/focus.ts +10 -0
- package/dist/shared/lib/form/standard-schema.ts +26 -0
- package/dist/shared/lib/form/values.ts +23 -0
- package/dist/shared/lib/highlighter.ts +98 -0
- package/dist/shared/lib/iris-origin.ts +40 -0
- package/dist/shared/lib/lightbox/clip.ts +117 -0
- package/dist/shared/lib/lightbox/download.ts +29 -0
- package/dist/shared/lib/lightbox/gesture.ts +54 -0
- package/dist/shared/lib/lightbox/paging.ts +33 -0
- package/dist/shared/lib/lightbox/pose.ts +142 -0
- package/dist/shared/lib/lightbox/source.ts +17 -0
- package/dist/shared/lib/lightbox/types.ts +14 -0
- package/dist/shared/lib/lightbox/zoom.ts +127 -0
- package/dist/shared/lib/meter-group.ts +16 -0
- package/dist/shared/lib/overlay-anchor.ts +42 -0
- package/dist/shared/lib/pagination.ts +16 -0
- package/dist/shared/lib/pointer-corridor.ts +26 -0
- package/dist/shared/lib/qr-code-export.ts +68 -0
- package/dist/shared/lib/range-calendar/limit.ts +11 -0
- package/dist/shared/lib/rating.ts +4 -0
- package/dist/shared/lib/relative-time.ts +20 -0
- package/dist/shared/lib/scroll-area.ts +77 -0
- package/dist/shared/lib/scroll-restore.ts +148 -0
- package/dist/shared/lib/toast-layout.ts +42 -0
- package/dist/shared/lib/tree/selection.ts +131 -0
- package/dist/shared/lib/tree-select/filter.ts +19 -0
- package/dist/shared/lib/virtual/choices.ts +193 -0
- package/dist/shared/lib/virtual/collection.ts +71 -0
- package/dist/shared/lib/virtual/filter.ts +26 -0
- package/dist/shared/lib/virtual/flow.ts +32 -0
- package/dist/shared/lib/virtual/list.ts +63 -0
- package/dist/shared/lib/virtual/navigation.ts +26 -0
- package/dist/shared/lib/virtual/tree.ts +98 -0
- package/dist/shared/locale/en-US.ts +220 -0
- package/dist/shared/locale/index.ts +52 -0
- package/dist/shared/locale/types.ts +225 -0
- package/dist/shared/locale/zh-CN.ts +215 -0
- package/dist/shared/primitives/number-field/LICENSE +21 -0
- package/dist/shared/primitives/number-field/index.ts +407 -0
- package/dist/shared/styles/semantic.css +10 -2
- package/dist/shared/types/autocomplete.ts +16 -0
- package/dist/shared/types/data-table.ts +170 -0
- package/dist/shared/types/pagination.ts +19 -0
- package/dist/shared/types/select.ts +23 -0
- package/dist/shared/types/tree-select.ts +34 -0
- package/dist/shared/types/tree.ts +20 -0
- package/dist/types/shared/src/behavior/anchor-follow.d.ts +13 -0
- package/dist/types/shared/src/behavior/anchor-follow.d.ts.map +1 -0
- package/dist/types/shared/src/behavior/form.d.ts +24 -0
- package/dist/types/shared/src/behavior/form.d.ts.map +1 -0
- package/dist/types/shared/src/behavior/ripple.d.ts +11 -0
- package/dist/types/shared/src/behavior/ripple.d.ts.map +1 -0
- package/dist/types/shared/src/behavior/spoiler/painter.d.ts +35 -0
- package/dist/types/shared/src/behavior/spoiler/painter.d.ts.map +1 -0
- package/dist/types/shared/src/behavior/spoiler/worklet.d.ts +2 -0
- package/dist/types/shared/src/behavior/spoiler/worklet.d.ts.map +1 -0
- package/dist/types/shared/src/behavior/toast.d.ts +72 -0
- package/dist/types/shared/src/behavior/toast.d.ts.map +1 -0
- package/dist/types/shared/src/lib/anchor.d.ts +31 -0
- package/dist/types/shared/src/lib/anchor.d.ts.map +1 -0
- package/dist/types/shared/src/lib/banner.d.ts +3 -0
- package/dist/types/shared/src/lib/banner.d.ts.map +1 -0
- package/dist/types/shared/src/lib/calendar/format.d.ts +7 -0
- package/dist/types/shared/src/lib/calendar/format.d.ts.map +1 -0
- package/dist/types/shared/src/lib/caret.d.ts +2 -0
- package/dist/types/shared/src/lib/caret.d.ts.map +1 -0
- package/dist/types/shared/src/lib/collapse.d.ts +9 -0
- package/dist/types/shared/src/lib/collapse.d.ts.map +1 -0
- package/dist/types/shared/src/lib/command-palette/hotkey.d.ts +9 -0
- package/dist/types/shared/src/lib/command-palette/hotkey.d.ts.map +1 -0
- package/dist/types/shared/src/lib/command-palette/match.d.ts +21 -0
- package/dist/types/shared/src/lib/command-palette/match.d.ts.map +1 -0
- package/dist/types/shared/src/lib/data-list.d.ts +7 -0
- package/dist/types/shared/src/lib/data-list.d.ts.map +1 -0
- package/dist/types/shared/src/lib/data-table/column-sizing-styles.d.ts +8 -0
- package/dist/types/shared/src/lib/data-table/column-sizing-styles.d.ts.map +1 -0
- package/dist/types/shared/src/lib/data-table/column-sizing.d.ts +22 -0
- package/dist/types/shared/src/lib/data-table/column-sizing.d.ts.map +1 -0
- package/dist/types/shared/src/lib/data-table/csv.d.ts +5 -0
- package/dist/types/shared/src/lib/data-table/csv.d.ts.map +1 -0
- package/dist/types/shared/src/lib/data-table/layout.d.ts +28 -0
- package/dist/types/shared/src/lib/data-table/layout.d.ts.map +1 -0
- package/dist/types/shared/src/lib/data-table/resize.d.ts +15 -0
- package/dist/types/shared/src/lib/data-table/resize.d.ts.map +1 -0
- package/dist/types/shared/src/lib/data-table/state.d.ts +103 -0
- package/dist/types/shared/src/lib/data-table/state.d.ts.map +1 -0
- package/dist/types/shared/src/lib/data-table/utils.d.ts +11 -0
- package/dist/types/shared/src/lib/data-table/utils.d.ts.map +1 -0
- package/dist/types/shared/src/lib/date-range-field/validity.d.ts +12 -0
- package/dist/types/shared/src/lib/date-range-field/validity.d.ts.map +1 -0
- package/dist/types/shared/src/lib/date.d.ts +28 -0
- package/dist/types/shared/src/lib/date.d.ts.map +1 -0
- package/dist/types/shared/src/lib/field-focus.d.ts +2 -0
- package/dist/types/shared/src/lib/field-focus.d.ts.map +1 -0
- package/dist/types/shared/src/lib/file-upload/select.d.ts +17 -0
- package/dist/types/shared/src/lib/file-upload/select.d.ts.map +1 -0
- package/dist/types/shared/src/lib/file-upload/size.d.ts +2 -0
- package/dist/types/shared/src/lib/file-upload/size.d.ts.map +1 -0
- package/dist/types/shared/src/lib/form/errors.d.ts +7 -0
- package/dist/types/shared/src/lib/form/errors.d.ts.map +1 -0
- package/dist/types/shared/src/lib/form/focus.d.ts +2 -0
- package/dist/types/shared/src/lib/form/focus.d.ts.map +1 -0
- package/dist/types/shared/src/lib/form/standard-schema.d.ts +23 -0
- package/dist/types/shared/src/lib/form/standard-schema.d.ts.map +1 -0
- package/dist/types/shared/src/lib/form/values.d.ts +3 -0
- package/dist/types/shared/src/lib/form/values.d.ts.map +1 -0
- package/dist/types/shared/src/lib/highlighter.d.ts +4 -0
- package/dist/types/shared/src/lib/highlighter.d.ts.map +1 -0
- package/dist/types/shared/src/lib/iris-origin.d.ts +6 -0
- package/dist/types/shared/src/lib/iris-origin.d.ts.map +1 -0
- package/dist/types/shared/src/lib/lightbox/clip.d.ts +16 -0
- package/dist/types/shared/src/lib/lightbox/clip.d.ts.map +1 -0
- package/dist/types/shared/src/lib/lightbox/download.d.ts +3 -0
- package/dist/types/shared/src/lib/lightbox/download.d.ts.map +1 -0
- package/dist/types/shared/src/lib/lightbox/gesture.d.ts +26 -0
- package/dist/types/shared/src/lib/lightbox/gesture.d.ts.map +1 -0
- package/dist/types/shared/src/lib/lightbox/paging.d.ts +9 -0
- package/dist/types/shared/src/lib/lightbox/paging.d.ts.map +1 -0
- package/dist/types/shared/src/lib/lightbox/pose.d.ts +38 -0
- package/dist/types/shared/src/lib/lightbox/pose.d.ts.map +1 -0
- package/dist/types/shared/src/lib/lightbox/source.d.ts +4 -0
- package/dist/types/shared/src/lib/lightbox/source.d.ts.map +1 -0
- package/dist/types/shared/src/lib/lightbox/types.d.ts +16 -0
- package/dist/types/shared/src/lib/lightbox/types.d.ts.map +1 -0
- package/dist/types/shared/src/lib/lightbox/zoom.d.ts +40 -0
- package/dist/types/shared/src/lib/lightbox/zoom.d.ts.map +1 -0
- package/dist/types/shared/src/lib/meter-group.d.ts +5 -0
- package/dist/types/shared/src/lib/meter-group.d.ts.map +1 -0
- package/dist/types/shared/src/lib/overlay-anchor.d.ts +10 -0
- package/dist/types/shared/src/lib/overlay-anchor.d.ts.map +1 -0
- package/dist/types/shared/src/lib/pagination.d.ts +4 -0
- package/dist/types/shared/src/lib/pagination.d.ts.map +1 -0
- package/dist/types/shared/src/lib/pointer-corridor.d.ts +7 -0
- package/dist/types/shared/src/lib/pointer-corridor.d.ts.map +1 -0
- package/dist/types/shared/src/lib/qr-code-export.d.ts +6 -0
- package/dist/types/shared/src/lib/qr-code-export.d.ts.map +1 -0
- package/dist/types/shared/src/lib/range-calendar/limit.d.ts +3 -0
- package/dist/types/shared/src/lib/range-calendar/limit.d.ts.map +1 -0
- package/dist/types/shared/src/lib/rating.d.ts +2 -0
- package/dist/types/shared/src/lib/rating.d.ts.map +1 -0
- package/dist/types/shared/src/lib/relative-time.d.ts +2 -0
- package/dist/types/shared/src/lib/relative-time.d.ts.map +1 -0
- package/dist/types/shared/src/lib/scroll-area.d.ts +50 -0
- package/dist/types/shared/src/lib/scroll-area.d.ts.map +1 -0
- package/dist/types/shared/src/lib/scroll-restore.d.ts +34 -0
- package/dist/types/shared/src/lib/scroll-restore.d.ts.map +1 -0
- package/dist/types/shared/src/lib/toast-layout.d.ts +13 -0
- package/dist/types/shared/src/lib/toast-layout.d.ts.map +1 -0
- package/dist/types/shared/src/lib/tree/selection.d.ts +23 -0
- package/dist/types/shared/src/lib/tree/selection.d.ts.map +1 -0
- package/dist/types/shared/src/lib/tree-select/filter.d.ts +7 -0
- package/dist/types/shared/src/lib/tree-select/filter.d.ts.map +1 -0
- package/dist/types/shared/src/lib/virtual/choices.d.ts +59 -0
- package/dist/types/shared/src/lib/virtual/choices.d.ts.map +1 -0
- package/dist/types/shared/src/lib/virtual/collection.d.ts +25 -0
- package/dist/types/shared/src/lib/virtual/collection.d.ts.map +1 -0
- package/dist/types/shared/src/lib/virtual/flow.d.ts +18 -0
- package/dist/types/shared/src/lib/virtual/flow.d.ts.map +1 -0
- package/dist/types/shared/src/lib/virtual/list.d.ts +46 -0
- package/dist/types/shared/src/lib/virtual/list.d.ts.map +1 -0
- package/dist/types/shared/src/lib/virtual/navigation.d.ts +3 -0
- package/dist/types/shared/src/lib/virtual/navigation.d.ts.map +1 -0
- package/dist/types/shared/src/lib/virtual/tree.d.ts +31 -0
- package/dist/types/shared/src/lib/virtual/tree.d.ts.map +1 -0
- package/dist/types/shared/src/locale/en-US.d.ts +3 -0
- package/dist/types/shared/src/locale/en-US.d.ts.map +1 -0
- package/dist/types/shared/src/locale/index.d.ts +6 -0
- package/dist/types/shared/src/locale/index.d.ts.map +1 -0
- package/dist/types/shared/src/locale/types.d.ts +235 -0
- package/dist/types/shared/src/locale/types.d.ts.map +1 -0
- package/dist/types/shared/src/locale/zh-CN.d.ts +3 -0
- package/dist/types/shared/src/locale/zh-CN.d.ts.map +1 -0
- package/dist/types/shared/src/primitives/number-field/index.d.ts +155 -0
- package/dist/types/shared/src/primitives/number-field/index.d.ts.map +1 -0
- package/dist/types/shared/src/types/autocomplete.d.ts +14 -0
- package/dist/types/shared/src/types/autocomplete.d.ts.map +1 -0
- package/dist/types/shared/src/types/data-table.d.ts +169 -0
- package/dist/types/shared/src/types/data-table.d.ts.map +1 -0
- package/dist/types/shared/src/types/pagination.d.ts +23 -0
- package/dist/types/shared/src/types/pagination.d.ts.map +1 -0
- package/dist/types/shared/src/types/select.d.ts +14 -0
- package/dist/types/shared/src/types/select.d.ts.map +1 -0
- package/dist/types/shared/src/types/tree-select.d.ts +10 -0
- package/dist/types/shared/src/types/tree-select.d.ts.map +1 -0
- package/dist/types/shared/src/types/tree.d.ts +18 -0
- package/dist/types/shared/src/types/tree.d.ts.map +1 -0
- package/dist/types/shared/src/variants/autocomplete.d.ts +3 -0
- package/dist/types/shared/src/variants/autocomplete.d.ts.map +1 -0
- package/dist/types/shared/src/variants/editable.d.ts +52 -0
- package/dist/types/shared/src/variants/editable.d.ts.map +1 -0
- package/dist/types/shared/src/variants/float-button.d.ts +74 -0
- package/dist/types/shared/src/variants/float-button.d.ts.map +1 -0
- package/dist/types/shared/src/variants/split-button.d.ts +18 -0
- package/dist/types/shared/src/variants/split-button.d.ts.map +1 -0
- package/dist/types/vue/src/components/accordion/AccordionTrigger.vue.d.ts.map +1 -1
- package/dist/types/vue/src/components/anchor/composables/useAnchor.d.ts +2 -7
- package/dist/types/vue/src/components/anchor/composables/useAnchor.d.ts.map +1 -1
- package/dist/types/vue/src/components/anchor/composables/useAnchorFollow.d.ts.map +1 -1
- package/dist/types/vue/src/components/anchor/composables/useScrollSpy.d.ts +2 -5
- package/dist/types/vue/src/components/anchor/composables/useScrollSpy.d.ts.map +1 -1
- package/dist/types/vue/src/components/anchor/types.d.ts +1 -8
- package/dist/types/vue/src/components/anchor/types.d.ts.map +1 -1
- package/dist/types/vue/src/components/autocomplete/autocomplete.variants.d.ts +1 -1
- package/dist/types/vue/src/components/autocomplete/autocomplete.variants.d.ts.map +1 -1
- package/dist/types/vue/src/components/autocomplete/types.d.ts +1 -13
- package/dist/types/vue/src/components/autocomplete/types.d.ts.map +1 -1
- package/dist/types/vue/src/components/banner/utils/direction.d.ts +1 -2
- package/dist/types/vue/src/components/banner/utils/direction.d.ts.map +1 -1
- package/dist/types/vue/src/components/calendar/utils/format.d.ts +1 -6
- package/dist/types/vue/src/components/calendar/utils/format.d.ts.map +1 -1
- package/dist/types/vue/src/components/code-block/highlighter.d.ts +1 -3
- package/dist/types/vue/src/components/code-block/highlighter.d.ts.map +1 -1
- package/dist/types/vue/src/components/collapsible/CollapsibleTrigger.vue.d.ts.map +1 -1
- package/dist/types/vue/src/components/command-palette/composables/useCommandItems.d.ts +1 -1
- package/dist/types/vue/src/components/command-palette/utils/hotkey.d.ts +1 -8
- package/dist/types/vue/src/components/command-palette/utils/hotkey.d.ts.map +1 -1
- package/dist/types/vue/src/components/command-palette/utils/match.d.ts +5 -12
- package/dist/types/vue/src/components/command-palette/utils/match.d.ts.map +1 -1
- package/dist/types/vue/src/components/data-list/composables/useDataList.d.ts.map +1 -1
- package/dist/types/vue/src/components/data-list/utils/scroll.d.ts +1 -2
- package/dist/types/vue/src/components/data-list/utils/scroll.d.ts.map +1 -1
- package/dist/types/vue/src/components/data-table/column-sizing-styles.d.ts +1 -3
- package/dist/types/vue/src/components/data-table/column-sizing-styles.d.ts.map +1 -1
- package/dist/types/vue/src/components/data-table/column-sizing.d.ts +1 -21
- package/dist/types/vue/src/components/data-table/column-sizing.d.ts.map +1 -1
- package/dist/types/vue/src/components/data-table/composables/useDataTable.d.ts.map +1 -1
- package/dist/types/vue/src/components/data-table/composables/useTableColumns.d.ts.map +1 -1
- package/dist/types/vue/src/components/data-table/composables/useTableDrag.d.ts.map +1 -1
- package/dist/types/vue/src/components/data-table/composables/useTableExport.d.ts.map +1 -1
- package/dist/types/vue/src/components/data-table/composables/useTableResize.d.ts.map +1 -1
- package/dist/types/vue/src/components/data-table/composables/useTableResizeHandles.d.ts.map +1 -1
- package/dist/types/vue/src/components/data-table/composables/useTableVirtual.d.ts.map +1 -1
- package/dist/types/vue/src/components/data-table/types.d.ts +3 -153
- package/dist/types/vue/src/components/data-table/types.d.ts.map +1 -1
- package/dist/types/vue/src/components/data-table/utils.d.ts +1 -9
- package/dist/types/vue/src/components/data-table/utils.d.ts.map +1 -1
- package/dist/types/vue/src/components/date-range-field/utils/validity.d.ts +1 -11
- package/dist/types/vue/src/components/date-range-field/utils/validity.d.ts.map +1 -1
- package/dist/types/vue/src/components/editable/editable.variants.d.ts +1 -1
- package/dist/types/vue/src/components/editable/editable.variants.d.ts.map +1 -1
- package/dist/types/vue/src/components/file-upload/utils/select.d.ts +1 -16
- package/dist/types/vue/src/components/file-upload/utils/select.d.ts.map +1 -1
- package/dist/types/vue/src/components/file-upload/utils/size.d.ts +1 -1
- package/dist/types/vue/src/components/file-upload/utils/size.d.ts.map +1 -1
- package/dist/types/vue/src/components/float-button/float-button.variants.d.ts +1 -1
- package/dist/types/vue/src/components/float-button/float-button.variants.d.ts.map +1 -1
- package/dist/types/vue/src/components/form/Form.vue.d.ts +1 -1
- package/dist/types/vue/src/components/form/composables/useForm.d.ts +9 -15
- package/dist/types/vue/src/components/form/composables/useForm.d.ts.map +1 -1
- package/dist/types/vue/src/components/form/standard-schema.d.ts +1 -22
- package/dist/types/vue/src/components/form/standard-schema.d.ts.map +1 -1
- package/dist/types/vue/src/components/form/utils/errors.d.ts +1 -6
- package/dist/types/vue/src/components/form/utils/errors.d.ts.map +1 -1
- package/dist/types/vue/src/components/form/utils/focus.d.ts +1 -1
- package/dist/types/vue/src/components/form/utils/focus.d.ts.map +1 -1
- package/dist/types/vue/src/components/form/utils/values.d.ts +1 -2
- package/dist/types/vue/src/components/form/utils/values.d.ts.map +1 -1
- package/dist/types/vue/src/components/form-field/FormField.vue.d.ts.map +1 -1
- package/dist/types/vue/src/components/lightbox/types.d.ts +1 -15
- package/dist/types/vue/src/components/lightbox/types.d.ts.map +1 -1
- package/dist/types/vue/src/components/lightbox/utils/clip.d.ts +1 -15
- package/dist/types/vue/src/components/lightbox/utils/clip.d.ts.map +1 -1
- package/dist/types/vue/src/components/lightbox/utils/download.d.ts +1 -2
- package/dist/types/vue/src/components/lightbox/utils/download.d.ts.map +1 -1
- package/dist/types/vue/src/components/lightbox/utils/gesture.d.ts +1 -25
- package/dist/types/vue/src/components/lightbox/utils/gesture.d.ts.map +1 -1
- package/dist/types/vue/src/components/lightbox/utils/paging.d.ts +1 -8
- package/dist/types/vue/src/components/lightbox/utils/paging.d.ts.map +1 -1
- package/dist/types/vue/src/components/lightbox/utils/pose.d.ts +1 -37
- package/dist/types/vue/src/components/lightbox/utils/pose.d.ts.map +1 -1
- package/dist/types/vue/src/components/lightbox/utils/source.d.ts +1 -3
- package/dist/types/vue/src/components/lightbox/utils/source.d.ts.map +1 -1
- package/dist/types/vue/src/components/lightbox/utils/zoom.d.ts +1 -39
- package/dist/types/vue/src/components/lightbox/utils/zoom.d.ts.map +1 -1
- package/dist/types/vue/src/components/meter-group/utils/tones.d.ts +1 -3
- package/dist/types/vue/src/components/meter-group/utils/tones.d.ts.map +1 -1
- package/dist/types/vue/src/components/month-grid/MonthGrid.vue.d.ts +1 -1
- package/dist/types/vue/src/components/multi-select/MultiSelect.vue.d.ts.map +1 -1
- package/dist/types/vue/src/components/pagination/composables/usePagination.d.ts +2 -2
- package/dist/types/vue/src/components/pagination/composables/usePagination.d.ts.map +1 -1
- package/dist/types/vue/src/components/pagination/types.d.ts +1 -22
- package/dist/types/vue/src/components/pagination/types.d.ts.map +1 -1
- package/dist/types/vue/src/components/pagination/utils/ranges.d.ts +1 -2
- package/dist/types/vue/src/components/pagination/utils/ranges.d.ts.map +1 -1
- package/dist/types/vue/src/components/password-input/PasswordInput.vue.d.ts +4 -1
- package/dist/types/vue/src/components/password-input/PasswordInput.vue.d.ts.map +1 -1
- package/dist/types/vue/src/components/qr-code/export.d.ts +1 -2
- package/dist/types/vue/src/components/qr-code/export.d.ts.map +1 -1
- package/dist/types/vue/src/components/range-calendar/utils/limit.d.ts +1 -2
- package/dist/types/vue/src/components/range-calendar/utils/limit.d.ts.map +1 -1
- package/dist/types/vue/src/components/range-slider/RangeSlider.vue.d.ts +2 -2
- package/dist/types/vue/src/components/rating/utils/fill.d.ts +1 -1
- package/dist/types/vue/src/components/rating/utils/fill.d.ts.map +1 -1
- package/dist/types/vue/src/components/ripple/useRipple.d.ts.map +1 -1
- package/dist/types/vue/src/components/scroll-area/ScrollArea.vue.d.ts.map +1 -1
- package/dist/types/vue/src/components/scroll-area/composables/useEdgeShadow.d.ts +2 -1
- package/dist/types/vue/src/components/scroll-area/composables/useEdgeShadow.d.ts.map +1 -1
- package/dist/types/vue/src/components/scroll-area/composables/useLayerLock.d.ts.map +1 -1
- package/dist/types/vue/src/components/scroll-area/composables/useWheelRedirect.d.ts.map +1 -1
- package/dist/types/vue/src/components/scroll-area/scroll-restore.d.ts +1 -33
- package/dist/types/vue/src/components/scroll-area/scroll-restore.d.ts.map +1 -1
- package/dist/types/vue/src/components/search-input/SearchInput.vue.d.ts +4 -1
- package/dist/types/vue/src/components/search-input/SearchInput.vue.d.ts.map +1 -1
- package/dist/types/vue/src/components/select/types.d.ts +1 -13
- package/dist/types/vue/src/components/select/types.d.ts.map +1 -1
- package/dist/types/vue/src/components/slider/Slider.vue.d.ts +2 -2
- package/dist/types/vue/src/components/split-button/split-button.variants.d.ts +1 -1
- package/dist/types/vue/src/components/split-button/split-button.variants.d.ts.map +1 -1
- package/dist/types/vue/src/components/spoiler/SpoilerPainter.d.ts +1 -34
- package/dist/types/vue/src/components/spoiler/SpoilerPainter.d.ts.map +1 -1
- package/dist/types/vue/src/components/spoiler/utils/irisOrigin.d.ts +1 -5
- package/dist/types/vue/src/components/spoiler/utils/irisOrigin.d.ts.map +1 -1
- package/dist/types/vue/src/components/spoiler/worklet.d.ts +1 -1
- package/dist/types/vue/src/components/spoiler/worklet.d.ts.map +1 -1
- package/dist/types/vue/src/components/table/Table.vue.d.ts +6 -3
- package/dist/types/vue/src/components/table/Table.vue.d.ts.map +1 -1
- package/dist/types/vue/src/components/tabs/TabsList.vue.d.ts +6 -3
- package/dist/types/vue/src/components/tabs/TabsList.vue.d.ts.map +1 -1
- package/dist/types/vue/src/components/time/utils/relativeTime.d.ts +1 -1
- package/dist/types/vue/src/components/time/utils/relativeTime.d.ts.map +1 -1
- package/dist/types/vue/src/components/toast/composables/useToastLayout.d.ts +4 -11
- package/dist/types/vue/src/components/toast/composables/useToastLayout.d.ts.map +1 -1
- package/dist/types/vue/src/components/toast/store.d.ts +14 -62
- package/dist/types/vue/src/components/toast/store.d.ts.map +1 -1
- package/dist/types/vue/src/components/tree/composables/useTree.d.ts.map +1 -1
- package/dist/types/vue/src/components/tree/types.d.ts +1 -17
- package/dist/types/vue/src/components/tree/types.d.ts.map +1 -1
- package/dist/types/vue/src/components/tree/utils/selection.d.ts +1 -15
- package/dist/types/vue/src/components/tree/utils/selection.d.ts.map +1 -1
- package/dist/types/vue/src/components/tree-select/types.d.ts +1 -9
- package/dist/types/vue/src/components/tree-select/types.d.ts.map +1 -1
- package/dist/types/vue/src/components/tree-select/utils/filterTree.d.ts +1 -6
- package/dist/types/vue/src/components/tree-select/utils/filterTree.d.ts.map +1 -1
- package/dist/types/vue/src/components/virtual-list/composables/useVirtualList.d.ts +1 -1
- package/dist/types/vue/src/components/virtual-list/composables/useVirtualList.d.ts.map +1 -1
- package/dist/types/vue/src/components/visually-hidden/VisuallyHidden.vue.d.ts +4 -1
- package/dist/types/vue/src/components/visually-hidden/VisuallyHidden.vue.d.ts.map +1 -1
- package/dist/types/vue/src/lib/caret.d.ts +1 -1
- package/dist/types/vue/src/lib/caret.d.ts.map +1 -1
- package/dist/types/vue/src/lib/collapse.d.ts +2 -8
- package/dist/types/vue/src/lib/collapse.d.ts.map +1 -1
- package/dist/types/vue/src/lib/date.d.ts +1 -27
- package/dist/types/vue/src/lib/date.d.ts.map +1 -1
- package/dist/types/vue/src/lib/field-focus.d.ts +1 -1
- package/dist/types/vue/src/lib/field-focus.d.ts.map +1 -1
- package/dist/types/vue/src/lib/overlay-anchor.d.ts +2 -7
- package/dist/types/vue/src/lib/overlay-anchor.d.ts.map +1 -1
- package/dist/types/vue/src/lib/pointer-corridor.d.ts +1 -6
- package/dist/types/vue/src/lib/pointer-corridor.d.ts.map +1 -1
- package/dist/types/vue/src/lib/reka/useVirtualChoices.d.ts +3 -11
- package/dist/types/vue/src/lib/reka/useVirtualChoices.d.ts.map +1 -1
- package/dist/types/vue/src/lib/reka/useVirtualTree.d.ts +1 -1
- package/dist/types/vue/src/lib/reka/useVirtualTree.d.ts.map +1 -1
- package/dist/types/vue/src/lib/virtual/navigation.d.ts +1 -2
- package/dist/types/vue/src/lib/virtual/navigation.d.ts.map +1 -1
- package/dist/types/vue/src/lib/virtual/useVirtualCollection.d.ts +1 -1
- package/dist/types/vue/src/lib/virtual/useVirtualCollection.d.ts.map +1 -1
- package/dist/types/vue/src/lib/virtual/useVirtualWindow.d.ts +2 -15
- package/dist/types/vue/src/lib/virtual/useVirtualWindow.d.ts.map +1 -1
- package/dist/types/vue/src/locale/en-US.d.ts +1 -2
- package/dist/types/vue/src/locale/en-US.d.ts.map +1 -1
- package/dist/types/vue/src/locale/index.d.ts +3 -4
- package/dist/types/vue/src/locale/index.d.ts.map +1 -1
- package/dist/types/vue/src/locale/types.d.ts +1 -234
- package/dist/types/vue/src/locale/types.d.ts.map +1 -1
- package/dist/types/vue/src/locale/zh-CN.d.ts +1 -2
- package/dist/types/vue/src/locale/zh-CN.d.ts.map +1 -1
- package/dist/types/vue/src/primitives/number-field/NumberFieldDecrement.vue.d.ts +17 -0
- package/dist/types/vue/src/primitives/number-field/NumberFieldDecrement.vue.d.ts.map +1 -0
- package/dist/types/vue/src/primitives/number-field/NumberFieldIncrement.vue.d.ts +17 -0
- package/dist/types/vue/src/primitives/number-field/NumberFieldIncrement.vue.d.ts.map +1 -0
- package/dist/types/vue/src/primitives/number-field/NumberFieldInput.vue.d.ts +16 -0
- package/dist/types/vue/src/primitives/number-field/NumberFieldInput.vue.d.ts.map +1 -0
- package/dist/types/vue/src/primitives/number-field/NumberFieldRoot.vue.d.ts +47 -0
- package/dist/types/vue/src/primitives/number-field/NumberFieldRoot.vue.d.ts.map +1 -0
- package/dist/types/vue/src/primitives/number-field/context.d.ts +41 -0
- package/dist/types/vue/src/primitives/number-field/context.d.ts.map +1 -0
- package/dist/types/vue/src/primitives/number-field/index.d.ts +5 -0
- package/dist/types/vue/src/primitives/number-field/index.d.ts.map +1 -0
- package/dist/types/vue/src/primitives/utils/timers.d.ts +6 -0
- package/dist/types/vue/src/primitives/utils/timers.d.ts.map +1 -0
- package/dist/types/vue/src/primitives/utils/usePrimitiveElement.d.ts +6 -0
- package/dist/types/vue/src/primitives/utils/usePrimitiveElement.d.ts.map +1 -0
- package/dist/types/vue/src/primitives/utils/useVModel.d.ts +7 -0
- package/dist/types/vue/src/primitives/utils/useVModel.d.ts.map +1 -0
- package/dist/types/vue/src/primitives/visually-hidden/VisuallyHiddenInput.d.ts +66 -0
- package/dist/types/vue/src/primitives/visually-hidden/VisuallyHiddenInput.d.ts.map +1 -0
- package/dist/types/vue/src/primitives/visually-hidden/VisuallyHiddenInputBubble.vue.d.ts +28 -0
- package/dist/types/vue/src/primitives/visually-hidden/VisuallyHiddenInputBubble.vue.d.ts.map +1 -0
- package/package.json +3 -2
- package/src/components/accordion/AccordionTrigger.vue +9 -1
- package/src/components/anchor/composables/useAnchor.ts +3 -12
- package/src/components/anchor/composables/useAnchorFollow.ts +8 -76
- package/src/components/anchor/composables/useScrollSpy.ts +22 -38
- package/src/components/anchor/types.ts +1 -8
- package/src/components/autocomplete/autocomplete.variants.ts +1 -1
- package/src/components/autocomplete/composables/useAutocomplete.ts +1 -1
- package/src/components/autocomplete/types.ts +1 -16
- package/src/components/banner/utils/direction.ts +1 -10
- package/src/components/calendar/utils/format.ts +1 -23
- package/src/components/code-block/highlighter.ts +1 -98
- package/src/components/collapsible/CollapsibleTrigger.vue +8 -1
- package/src/components/command-palette/utils/hotkey.ts +1 -27
- package/src/components/command-palette/utils/match.ts +5 -75
- package/src/components/data-list/composables/useDataList.ts +2 -4
- package/src/components/data-list/utils/scroll.ts +1 -26
- package/src/components/data-table/column-sizing-styles.ts +1 -40
- package/src/components/data-table/column-sizing.ts +1 -101
- package/src/components/data-table/composables/useDataTable.ts +103 -123
- package/src/components/data-table/composables/useTableColumns.ts +38 -113
- package/src/components/data-table/composables/useTableDrag.ts +21 -11
- package/src/components/data-table/composables/useTableExport.ts +8 -32
- package/src/components/data-table/composables/useTableResize.ts +13 -17
- package/src/components/data-table/composables/useTableResizeHandles.ts +6 -21
- package/src/components/data-table/types.ts +15 -155
- package/src/components/data-table/utils.ts +1 -75
- package/src/components/date-range-field/utils/validity.ts +1 -21
- package/src/components/editable/editable.variants.ts +1 -1
- package/src/components/file-upload/utils/select.ts +1 -58
- package/src/components/file-upload/utils/size.ts +1 -16
- package/src/components/float-button/float-button.variants.ts +1 -1
- package/src/components/form/composables/useForm.ts +24 -135
- package/src/components/form/standard-schema.ts +1 -26
- package/src/components/form/utils/errors.ts +1 -48
- package/src/components/form/utils/focus.ts +1 -10
- package/src/components/form/utils/values.ts +1 -23
- package/src/components/form-field/FormField.vue +3 -2
- package/src/components/lightbox/types.ts +1 -14
- package/src/components/lightbox/utils/clip.ts +1 -117
- package/src/components/lightbox/utils/download.ts +1 -29
- package/src/components/lightbox/utils/gesture.ts +1 -54
- package/src/components/lightbox/utils/paging.ts +1 -33
- package/src/components/lightbox/utils/pose.ts +1 -142
- package/src/components/lightbox/utils/source.ts +1 -17
- package/src/components/lightbox/utils/zoom.ts +1 -127
- package/src/components/meter-group/utils/tones.ts +1 -14
- package/src/components/multi-select/MultiSelect.vue +1 -2
- package/src/components/number-input/NumberInput.vue +2 -2
- package/src/components/pagination/composables/usePagination.ts +2 -3
- package/src/components/pagination/types.ts +1 -19
- package/src/components/pagination/utils/ranges.ts +1 -12
- package/src/components/password-input/PasswordInput.vue +6 -0
- package/src/components/qr-code/export.ts +1 -65
- package/src/components/range-calendar/utils/limit.ts +1 -11
- package/src/components/rating/utils/fill.ts +1 -4
- package/src/components/ripple/useRipple.ts +10 -198
- package/src/components/scroll-area/ScrollArea.vue +6 -18
- package/src/components/scroll-area/composables/useEdgeShadow.ts +7 -16
- package/src/components/scroll-area/composables/useLayerLock.ts +2 -9
- package/src/components/scroll-area/composables/useWheelRedirect.ts +2 -10
- package/src/components/scroll-area/scroll-restore.ts +1 -148
- package/src/components/search-input/SearchInput.vue +6 -0
- package/src/components/select/types.ts +1 -23
- package/src/components/split-button/split-button.variants.ts +1 -1
- package/src/components/spoiler/SpoilerPainter.ts +1 -197
- package/src/components/spoiler/utils/irisOrigin.ts +1 -40
- package/src/components/spoiler/worklet.ts +1 -199
- package/src/components/table/Table.vue +9 -0
- package/src/components/tabs/TabsList.vue +9 -0
- package/src/components/time/utils/relativeTime.ts +1 -20
- package/src/components/toast/composables/useToastLayout.ts +12 -24
- package/src/components/toast/store.ts +16 -228
- package/src/components/tree/composables/useTree.ts +17 -33
- package/src/components/tree/types.ts +1 -20
- package/src/components/tree/utils/selection.ts +1 -78
- package/src/components/tree-select/types.ts +1 -34
- package/src/components/tree-select/utils/filterTree.ts +1 -19
- package/src/components/virtual-list/composables/useVirtualList.ts +16 -42
- package/src/components/visually-hidden/VisuallyHidden.vue +21 -3
- package/src/lib/caret.ts +1 -48
- package/src/lib/collapse.ts +6 -29
- package/src/lib/date.ts +1 -111
- package/src/lib/field-focus.ts +1 -36
- package/src/lib/overlay-anchor.ts +11 -37
- package/src/lib/pointer-corridor.ts +1 -26
- package/src/lib/reka/useVirtualChoices.ts +55 -133
- package/src/lib/reka/useVirtualTree.ts +22 -65
- package/src/lib/virtual/navigation.ts +1 -26
- package/src/lib/virtual/useVirtualCollection.ts +28 -47
- package/src/lib/virtual/useVirtualWindow.ts +15 -25
- package/src/locale/en-US.ts +1 -220
- package/src/locale/index.ts +9 -53
- package/src/locale/types.ts +1 -225
- package/src/locale/zh-CN.ts +1 -215
- package/src/primitives/number-field/LICENSE +21 -0
- package/src/primitives/number-field/NumberFieldDecrement.vue +21 -0
- package/src/primitives/number-field/NumberFieldIncrement.vue +21 -0
- package/src/primitives/number-field/NumberFieldInput.vue +114 -0
- package/src/primitives/number-field/NumberFieldRoot.vue +169 -0
- package/src/primitives/number-field/context.ts +111 -0
- package/src/primitives/number-field/index.ts +14 -0
- package/src/primitives/utils/LICENSE +44 -0
- package/src/primitives/utils/timers.ts +6 -0
- package/src/primitives/utils/usePrimitiveElement.ts +12 -0
- package/src/primitives/utils/useVModel.ts +37 -0
- package/src/primitives/visually-hidden/LICENSE +21 -0
- package/src/primitives/visually-hidden/VisuallyHiddenInput.ts +97 -0
- package/src/primitives/visually-hidden/VisuallyHiddenInputBubble.vue +49 -0
|
@@ -1,234 +1,22 @@
|
|
|
1
1
|
import { markRaw, reactive, type Component } from 'vue'
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
createToastStore,
|
|
4
|
+
type ToastItem as SharedToastItem,
|
|
5
|
+
} from '../../../../shared/src/behavior/toast'
|
|
3
6
|
|
|
4
|
-
export type
|
|
7
|
+
export type {
|
|
8
|
+
ToastTone,
|
|
9
|
+
ToasterPosition,
|
|
10
|
+
ToastAction,
|
|
11
|
+
ToastOptions,
|
|
12
|
+
ToastPromiseMessages,
|
|
13
|
+
} from '../../../../shared/src/behavior/toast'
|
|
5
14
|
|
|
6
|
-
export type
|
|
7
|
-
'bottom-end' | 'bottom-start' | 'bottom-center' | 'top-end' | 'top-start' | 'top-center'
|
|
8
|
-
|
|
9
|
-
export interface ToastAction {
|
|
10
|
-
label: string
|
|
11
|
-
onClick?: () => void
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
export interface ToastItem {
|
|
15
|
-
id: number | string
|
|
16
|
-
tone: ToastTone
|
|
17
|
-
message: string
|
|
18
|
-
description?: string
|
|
19
|
-
duration: number
|
|
20
|
-
open: boolean
|
|
21
|
-
action?: ToastAction
|
|
22
|
-
cancel?: ToastAction
|
|
23
|
-
component?: Component
|
|
24
|
-
componentProps?: Record<string, unknown>
|
|
25
|
-
onDismiss?: (id: number | string) => void
|
|
26
|
-
onAutoClose?: (id: number | string) => void
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
export interface ToastOptions {
|
|
30
|
-
id?: number | string
|
|
31
|
-
tone?: ToastTone
|
|
32
|
-
description?: string
|
|
33
|
-
duration?: number
|
|
34
|
-
action?: ToastAction
|
|
35
|
-
cancel?: ToastAction
|
|
36
|
-
onDismiss?: (id: number | string) => void
|
|
37
|
-
onAutoClose?: (id: number | string) => void
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
type MessageInput<T> = string | { message: string; description?: string } | T
|
|
41
|
-
|
|
42
|
-
export interface ToastPromiseMessages<T> {
|
|
43
|
-
loading: string
|
|
44
|
-
success: MessageInput<(value: T) => string | { message: string; description?: string }>
|
|
45
|
-
error: MessageInput<(reason: unknown) => string | { message: string; description?: string }>
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
const MAX_VISIBLE = 5
|
|
49
|
-
const SETTLE_DELAY = (DURATION.exit + 0.06) * 1000
|
|
50
|
-
|
|
51
|
-
let seed = 0
|
|
15
|
+
export type ToastItem = SharedToastItem<Component>
|
|
52
16
|
|
|
53
17
|
export const toastState: { items: ToastItem[] } = reactive({ items: [] })
|
|
54
18
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
const timers = new Map<number | string, Timer>()
|
|
62
|
-
const pauseReasons = new Set<string>()
|
|
63
|
-
|
|
64
|
-
function fire(id: number | string) {
|
|
65
|
-
timers.delete(id)
|
|
66
|
-
const item = toastState.items.find(t => t.id === id)
|
|
67
|
-
if (item) close(item, 'auto')
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
function startTimer(item: ToastItem) {
|
|
71
|
-
stopTimer(item.id)
|
|
72
|
-
if (item.duration <= 0) return
|
|
73
|
-
const timer: Timer = { handle: undefined, remaining: item.duration, startedAt: Date.now() }
|
|
74
|
-
timers.set(item.id, timer)
|
|
75
|
-
if (pauseReasons.size === 0) timer.handle = setTimeout(() => fire(item.id), timer.remaining)
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
function stopTimer(id: number | string) {
|
|
79
|
-
const timer = timers.get(id)
|
|
80
|
-
if (timer?.handle) clearTimeout(timer.handle)
|
|
81
|
-
timers.delete(id)
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
export function pauseTimers(reason: string) {
|
|
85
|
-
if (pauseReasons.has(reason)) return
|
|
86
|
-
const wasRunning = pauseReasons.size === 0
|
|
87
|
-
pauseReasons.add(reason)
|
|
88
|
-
if (!wasRunning) return
|
|
89
|
-
for (const timer of timers.values()) {
|
|
90
|
-
if (!timer.handle) continue
|
|
91
|
-
clearTimeout(timer.handle)
|
|
92
|
-
timer.handle = undefined
|
|
93
|
-
timer.remaining = Math.max(0, timer.remaining - (Date.now() - timer.startedAt))
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
export function resumeTimers(reason: string) {
|
|
98
|
-
pauseReasons.delete(reason)
|
|
99
|
-
if (pauseReasons.size > 0) return
|
|
100
|
-
for (const [id, timer] of timers) {
|
|
101
|
-
if (timer.handle) continue
|
|
102
|
-
timer.startedAt = Date.now()
|
|
103
|
-
timer.handle = setTimeout(() => fire(id), timer.remaining)
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
function settle(item: ToastItem) {
|
|
108
|
-
const index = toastState.items.indexOf(item)
|
|
109
|
-
if (index >= 0) toastState.items.splice(index, 1)
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
function close(item: ToastItem, source: 'manual' | 'auto') {
|
|
113
|
-
if (!item.open) return
|
|
114
|
-
item.open = false
|
|
115
|
-
stopTimer(item.id)
|
|
116
|
-
if (source === 'auto') item.onAutoClose?.(item.id)
|
|
117
|
-
item.onDismiss?.(item.id)
|
|
118
|
-
setTimeout(() => settle(item), SETTLE_DELAY)
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
export function dismiss(id?: number | string) {
|
|
122
|
-
for (const item of toastState.items) {
|
|
123
|
-
if (id !== undefined && item.id !== id) continue
|
|
124
|
-
close(item, 'manual')
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
function defaultDuration(tone: ToastTone) {
|
|
129
|
-
return tone === 'loading' ? 0 : 4000
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
interface InternalOptions extends ToastOptions {
|
|
133
|
-
component?: Component
|
|
134
|
-
componentProps?: Record<string, unknown>
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
function push(message: string, options: InternalOptions = {}) {
|
|
138
|
-
const tone = options.tone ?? 'neutral'
|
|
139
|
-
const existing =
|
|
140
|
-
options.id !== undefined ? toastState.items.find(t => t.id === options.id) : undefined
|
|
141
|
-
|
|
142
|
-
if (existing && existing.open) {
|
|
143
|
-
existing.tone = tone
|
|
144
|
-
existing.message = message
|
|
145
|
-
existing.description = options.description
|
|
146
|
-
existing.duration = options.duration ?? defaultDuration(tone)
|
|
147
|
-
existing.action = options.action
|
|
148
|
-
existing.cancel = options.cancel
|
|
149
|
-
existing.component = options.component ? markRaw(options.component) : undefined
|
|
150
|
-
existing.componentProps = options.componentProps
|
|
151
|
-
if (options.onDismiss) existing.onDismiss = options.onDismiss
|
|
152
|
-
if (options.onAutoClose) existing.onAutoClose = options.onAutoClose
|
|
153
|
-
startTimer(existing)
|
|
154
|
-
return existing.id
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
if (existing) settle(existing)
|
|
158
|
-
|
|
159
|
-
const item: ToastItem = {
|
|
160
|
-
id: options.id ?? ++seed,
|
|
161
|
-
tone,
|
|
162
|
-
message,
|
|
163
|
-
description: options.description,
|
|
164
|
-
duration: options.duration ?? defaultDuration(tone),
|
|
165
|
-
open: true,
|
|
166
|
-
action: options.action,
|
|
167
|
-
cancel: options.cancel,
|
|
168
|
-
component: options.component ? markRaw(options.component) : undefined,
|
|
169
|
-
componentProps: options.componentProps,
|
|
170
|
-
onDismiss: options.onDismiss,
|
|
171
|
-
onAutoClose: options.onAutoClose,
|
|
172
|
-
}
|
|
173
|
-
toastState.items.push(item)
|
|
174
|
-
startTimer(item)
|
|
175
|
-
|
|
176
|
-
const visible = toastState.items.filter(t => t.open)
|
|
177
|
-
for (const stale of visible.slice(0, Math.max(0, visible.length - MAX_VISIBLE))) {
|
|
178
|
-
close(stale, 'manual')
|
|
179
|
-
}
|
|
180
|
-
return item.id
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
function resolveMessage(
|
|
184
|
-
input: MessageInput<(v: never) => string | { message: string; description?: string }>,
|
|
185
|
-
value: unknown,
|
|
186
|
-
): { message: string; description?: string } {
|
|
187
|
-
const raw = typeof input === 'function' ? (input as (v: unknown) => unknown)(value) : input
|
|
188
|
-
if (typeof raw === 'string') return { message: raw }
|
|
189
|
-
return raw as { message: string; description?: string }
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
type TonedOptions = Omit<ToastOptions, 'tone'>
|
|
193
|
-
|
|
194
|
-
function promiseToast<T>(
|
|
195
|
-
promise: Promise<T>,
|
|
196
|
-
messages: ToastPromiseMessages<T>,
|
|
197
|
-
options: TonedOptions = {},
|
|
198
|
-
): Promise<T> {
|
|
199
|
-
const id = push(messages.loading, { ...options, tone: 'loading', duration: 0 })
|
|
200
|
-
promise
|
|
201
|
-
.then(value => {
|
|
202
|
-
const done = resolveMessage(messages.success, value)
|
|
203
|
-
push(done.message, { ...options, id, tone: 'success', description: done.description })
|
|
204
|
-
})
|
|
205
|
-
.catch(reason => {
|
|
206
|
-
const done = resolveMessage(messages.error, reason)
|
|
207
|
-
push(done.message, { ...options, id, tone: 'danger', description: done.description })
|
|
208
|
-
})
|
|
209
|
-
return promise
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
export const toast = Object.assign(
|
|
213
|
-
(message: string, options?: ToastOptions) => push(message, options),
|
|
214
|
-
{
|
|
215
|
-
success: (message: string, options?: TonedOptions) =>
|
|
216
|
-
push(message, { ...options, tone: 'success' }),
|
|
217
|
-
danger: (message: string, options?: TonedOptions) =>
|
|
218
|
-
push(message, { ...options, tone: 'danger' }),
|
|
219
|
-
warning: (message: string, options?: TonedOptions) =>
|
|
220
|
-
push(message, { ...options, tone: 'warning' }),
|
|
221
|
-
info: (message: string, options?: TonedOptions) => push(message, { ...options, tone: 'info' }),
|
|
222
|
-
loading: (message: string, options?: TonedOptions) =>
|
|
223
|
-
push(message, { ...options, tone: 'loading' }),
|
|
224
|
-
custom: (
|
|
225
|
-
component: Component,
|
|
226
|
-
options?: TonedOptions & { props?: Record<string, unknown> },
|
|
227
|
-
) => {
|
|
228
|
-
const { props: componentProps, ...rest } = options ?? {}
|
|
229
|
-
return push('', { ...rest, component, componentProps })
|
|
230
|
-
},
|
|
231
|
-
promise: promiseToast,
|
|
232
|
-
dismiss,
|
|
233
|
-
},
|
|
234
|
-
)
|
|
19
|
+
export const { toast, dismiss, pauseTimers, resumeTimers } = createToastStore<Component>({
|
|
20
|
+
state: toastState,
|
|
21
|
+
raw: component => markRaw(component),
|
|
22
|
+
})
|
|
@@ -1,6 +1,15 @@
|
|
|
1
1
|
import { computed, type Ref } from 'vue'
|
|
2
2
|
import type { TreeNode, TreeNodeState, TreeValue } from '../types'
|
|
3
|
-
import {
|
|
3
|
+
import {
|
|
4
|
+
expandedTreeKeys,
|
|
5
|
+
expandedTreeValues,
|
|
6
|
+
indexTree,
|
|
7
|
+
nextTreeModel,
|
|
8
|
+
selectedTreeNodes,
|
|
9
|
+
treeKey,
|
|
10
|
+
treeKeyMap,
|
|
11
|
+
treeStates,
|
|
12
|
+
} from '../utils/selection'
|
|
4
13
|
|
|
5
14
|
interface Options {
|
|
6
15
|
items: TreeNode[]
|
|
@@ -16,39 +25,18 @@ export function useTree(
|
|
|
16
25
|
) {
|
|
17
26
|
const initialExpanded = [...props.defaultExpanded]
|
|
18
27
|
const index = computed(() => indexTree(props.items))
|
|
19
|
-
const states = computed(() =>
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
return new Map(
|
|
23
|
-
[...index.value.entries].map(([value, entry]) => [
|
|
24
|
-
value,
|
|
25
|
-
{
|
|
26
|
-
selected: value === model.value,
|
|
27
|
-
indeterminate: false,
|
|
28
|
-
disabled: entry.disabled,
|
|
29
|
-
},
|
|
30
|
-
]),
|
|
31
|
-
)
|
|
32
|
-
})
|
|
33
|
-
const selected = computed(() =>
|
|
34
|
-
[...index.value.entries.values()]
|
|
35
|
-
.filter(entry => states.value.get(entry.node.value)?.selected)
|
|
36
|
-
.map(entry => entry.node),
|
|
37
|
-
)
|
|
38
|
-
const keys = computed(
|
|
39
|
-
() => new Map([...index.value.entries].map(([value, entry]) => [key(entry.node), value])),
|
|
40
|
-
)
|
|
28
|
+
const states = computed(() => treeStates(index.value, props.multiple, model.value))
|
|
29
|
+
const selected = computed(() => selectedTreeNodes(index.value, states.value))
|
|
30
|
+
const keys = computed(() => treeKeyMap(index.value))
|
|
41
31
|
const expanded = computed({
|
|
42
|
-
get: () => (expandedModel.value ?? initialExpanded)
|
|
32
|
+
get: () => expandedTreeKeys(expandedModel.value ?? initialExpanded),
|
|
43
33
|
set: value => {
|
|
44
|
-
expandedModel.value = value
|
|
45
|
-
keys.value.has(key) ? [keys.value.get(key)!] : [],
|
|
46
|
-
)
|
|
34
|
+
expandedModel.value = expandedTreeValues(keys.value, value)
|
|
47
35
|
},
|
|
48
36
|
})
|
|
49
37
|
|
|
50
38
|
function key(node: Pick<TreeNode, 'value'>) {
|
|
51
|
-
return
|
|
39
|
+
return treeKey(node)
|
|
52
40
|
}
|
|
53
41
|
function getChildren(node: TreeNode) {
|
|
54
42
|
return node.children?.length ? node.children : undefined
|
|
@@ -61,11 +49,7 @@ export function useTree(
|
|
|
61
49
|
event.preventDefault()
|
|
62
50
|
const node = event.detail.value
|
|
63
51
|
if (!node || state(node).disabled) return
|
|
64
|
-
model.value = props.multiple
|
|
65
|
-
? toggleChecked(index.value, Array.isArray(model.value) ? model.value : [], node.value)
|
|
66
|
-
: model.value === node.value
|
|
67
|
-
? null
|
|
68
|
-
: node.value
|
|
52
|
+
model.value = nextTreeModel(index.value, props.multiple, model.value, node.value)
|
|
69
53
|
}
|
|
70
54
|
function toggle(node: TreeNode) {
|
|
71
55
|
if (state(node).disabled || !getChildren(node)) return
|
|
@@ -1,20 +1 @@
|
|
|
1
|
-
export
|
|
2
|
-
|
|
3
|
-
export interface TreeNode {
|
|
4
|
-
value: TreeValue
|
|
5
|
-
label: string
|
|
6
|
-
description?: string
|
|
7
|
-
disabled?: boolean
|
|
8
|
-
children?: TreeNode[]
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export interface TreeNodeState {
|
|
12
|
-
selected: boolean
|
|
13
|
-
indeterminate: boolean
|
|
14
|
-
disabled: boolean
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
export interface TreeNodeSlot extends TreeNodeState {
|
|
18
|
-
node: TreeNode
|
|
19
|
-
expanded: boolean
|
|
20
|
-
}
|
|
1
|
+
export * from '../../../../shared/src/types/tree'
|
|
@@ -1,78 +1 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
interface Entry {
|
|
4
|
-
node: TreeNode
|
|
5
|
-
parent?: TreeValue
|
|
6
|
-
children: TreeValue[]
|
|
7
|
-
disabled: boolean
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
export interface TreeIndex {
|
|
11
|
-
roots: TreeValue[]
|
|
12
|
-
entries: Map<TreeValue, Entry>
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export function indexTree(nodes: TreeNode[]): TreeIndex {
|
|
16
|
-
const entries = new Map<TreeValue, Entry>()
|
|
17
|
-
function visit(node: TreeNode, parent?: TreeValue, disabled = false) {
|
|
18
|
-
const entry = {
|
|
19
|
-
node,
|
|
20
|
-
parent,
|
|
21
|
-
disabled: disabled || !!node.disabled,
|
|
22
|
-
children: node.children?.map(child => child.value) ?? [],
|
|
23
|
-
}
|
|
24
|
-
entries.set(node.value, entry)
|
|
25
|
-
node.children?.forEach(child => visit(child, node.value, entry.disabled))
|
|
26
|
-
}
|
|
27
|
-
nodes.forEach(node => visit(node))
|
|
28
|
-
return { roots: nodes.map(node => node.value), entries }
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
export function checkedState(tree: TreeIndex, values: TreeValue[]) {
|
|
32
|
-
const checked = new Set(values)
|
|
33
|
-
const states = new Map<TreeValue, TreeNodeState>()
|
|
34
|
-
function visit(value: TreeValue, inherited = false): TreeNodeState {
|
|
35
|
-
const entry = tree.entries.get(value)!
|
|
36
|
-
const own = checked.has(value) || (!entry.disabled && inherited)
|
|
37
|
-
const children = entry.children.map(child => visit(child, !entry.disabled && own))
|
|
38
|
-
const enabled = children.filter(child => !child.disabled)
|
|
39
|
-
const selected =
|
|
40
|
-
entry.disabled || enabled.length === 0 ? own : enabled.every(child => child.selected)
|
|
41
|
-
const indeterminate =
|
|
42
|
-
!entry.disabled && !selected && enabled.some(child => child.selected || child.indeterminate)
|
|
43
|
-
const state = { selected, indeterminate, disabled: entry.disabled }
|
|
44
|
-
states.set(value, state)
|
|
45
|
-
return state
|
|
46
|
-
}
|
|
47
|
-
tree.roots.forEach(value => visit(value))
|
|
48
|
-
return states
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
export function toggleChecked(tree: TreeIndex, values: TreeValue[], value: TreeValue): TreeValue[] {
|
|
52
|
-
const entry = tree.entries.get(value)
|
|
53
|
-
if (!entry || entry.disabled) return values
|
|
54
|
-
const states = checkedState(tree, values)
|
|
55
|
-
const checked = new Set(values.filter(value => !tree.entries.has(value)))
|
|
56
|
-
states.forEach((state, value) => {
|
|
57
|
-
if (state.selected) checked.add(value)
|
|
58
|
-
})
|
|
59
|
-
const selected = !states.get(value)!.selected
|
|
60
|
-
function visit(value: TreeValue) {
|
|
61
|
-
const entry = tree.entries.get(value)!
|
|
62
|
-
if (entry.disabled) return
|
|
63
|
-
if (selected) checked.add(value)
|
|
64
|
-
else checked.delete(value)
|
|
65
|
-
entry.children.forEach(visit)
|
|
66
|
-
}
|
|
67
|
-
visit(value)
|
|
68
|
-
let parent = entry.parent
|
|
69
|
-
while (parent !== undefined) {
|
|
70
|
-
checked.delete(parent)
|
|
71
|
-
parent = tree.entries.get(parent)!.parent
|
|
72
|
-
}
|
|
73
|
-
const next = checkedState(tree, [...checked])
|
|
74
|
-
return [
|
|
75
|
-
...[...checked].filter(value => !tree.entries.has(value)),
|
|
76
|
-
...[...tree.entries.keys()].filter(value => next.get(value)!.selected),
|
|
77
|
-
]
|
|
78
|
-
}
|
|
1
|
+
export * from '../../../../../shared/src/lib/tree/selection'
|
|
@@ -1,34 +1 @@
|
|
|
1
|
-
export
|
|
2
|
-
value: string | number
|
|
3
|
-
label: string
|
|
4
|
-
description?: string
|
|
5
|
-
disabled?: boolean
|
|
6
|
-
children?: TreeSelectNode[]
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
export function findNode(
|
|
10
|
-
nodes: TreeSelectNode[],
|
|
11
|
-
value: string | number | null | undefined,
|
|
12
|
-
): TreeSelectNode | undefined {
|
|
13
|
-
for (const node of nodes) {
|
|
14
|
-
if (node.value === value) return node
|
|
15
|
-
const hit = node.children && findNode(node.children, value)
|
|
16
|
-
if (hit) return hit
|
|
17
|
-
}
|
|
18
|
-
return undefined
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
export function pathTo(
|
|
22
|
-
nodes: TreeSelectNode[],
|
|
23
|
-
value: string | number | null | undefined,
|
|
24
|
-
trail: Array<string | number> = [],
|
|
25
|
-
): Array<string | number> | null {
|
|
26
|
-
for (const node of nodes) {
|
|
27
|
-
if (node.value === value) return trail
|
|
28
|
-
if (node.children) {
|
|
29
|
-
const hit = pathTo(node.children, value, [...trail, node.value])
|
|
30
|
-
if (hit) return hit
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
return null
|
|
34
|
-
}
|
|
1
|
+
export * from '../../../../shared/src/types/tree-select'
|
|
@@ -1,19 +1 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
export function filterTree(nodes: TreeSelectNode[], matches: (node: TreeSelectNode) => boolean) {
|
|
4
|
-
const children = new Map<TreeSelectNode, TreeSelectNode[]>()
|
|
5
|
-
const expanded: string[] = []
|
|
6
|
-
|
|
7
|
-
function visit(items: TreeSelectNode[]): TreeSelectNode[] {
|
|
8
|
-
return items.filter(node => {
|
|
9
|
-
const descendants = visit(node.children ?? [])
|
|
10
|
-
if (descendants.length) {
|
|
11
|
-
children.set(node, descendants)
|
|
12
|
-
expanded.push(String(node.value))
|
|
13
|
-
}
|
|
14
|
-
return descendants.length > 0 || matches(node)
|
|
15
|
-
})
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
return { items: visit(nodes), children, expanded }
|
|
19
|
-
}
|
|
1
|
+
export * from '../../../../../shared/src/lib/tree-select/filter'
|
|
@@ -3,6 +3,15 @@ import { useResizeObserver } from '@vueuse/core'
|
|
|
3
3
|
import { defaultRangeExtractor, type VirtualItem } from '@tanstack/vue-virtual'
|
|
4
4
|
import { useDirection } from '../../../lib/useDirection'
|
|
5
5
|
import { useVirtualWindow, virtualFlow } from '../../../lib/virtual/useVirtualWindow'
|
|
6
|
+
import {
|
|
7
|
+
listContentStyle,
|
|
8
|
+
listEstimator,
|
|
9
|
+
listInitialRect,
|
|
10
|
+
listItemStyle,
|
|
11
|
+
listRootStyle,
|
|
12
|
+
nonnegative,
|
|
13
|
+
retainIndex,
|
|
14
|
+
} from '../../../../../shared/src/lib/virtual/list'
|
|
6
15
|
import { prefersReducedMotion } from '../../../motion'
|
|
7
16
|
import type ScrollArea from '../../scroll-area/ScrollArea.vue'
|
|
8
17
|
import type {
|
|
@@ -12,10 +21,6 @@ import type {
|
|
|
12
21
|
VirtualListScrollOptions,
|
|
13
22
|
} from '../types'
|
|
14
23
|
|
|
15
|
-
function nonnegative(value: number) {
|
|
16
|
-
return Number.isFinite(value) ? Math.max(0, value) : 0
|
|
17
|
-
}
|
|
18
|
-
|
|
19
24
|
export function useVirtualList<T>(
|
|
20
25
|
props: VirtualListProps<T>,
|
|
21
26
|
onRangeChange: (range: VirtualListRange) => void,
|
|
@@ -38,16 +43,11 @@ export function useVirtualList<T>(
|
|
|
38
43
|
const items = props.items
|
|
39
44
|
const itemKeys = keys.value
|
|
40
45
|
const retained = focusedIndex.value
|
|
41
|
-
const estimate = props.estimateSize ?? 48
|
|
42
46
|
return {
|
|
43
47
|
count: items.length,
|
|
44
48
|
getScrollElement: () => viewport.value ?? null,
|
|
45
49
|
getItemKey: (index: number) => itemKeys[index]!,
|
|
46
|
-
estimateSize: (
|
|
47
|
-
Math.max(
|
|
48
|
-
1,
|
|
49
|
-
nonnegative(typeof estimate === 'function' ? estimate(items[index]!, index) : estimate),
|
|
50
|
-
),
|
|
50
|
+
estimateSize: listEstimator(items, props.estimateSize),
|
|
51
51
|
horizontal: horizontal.value,
|
|
52
52
|
isRtl: direction.value === 'rtl',
|
|
53
53
|
overscan: Math.floor(nonnegative(props.overscan ?? 5)),
|
|
@@ -55,15 +55,9 @@ export function useVirtualList<T>(
|
|
|
55
55
|
paddingStart: nonnegative(props.paddingStart ?? 0),
|
|
56
56
|
paddingEnd: nonnegative(props.paddingEnd ?? 0),
|
|
57
57
|
initialOffset: nonnegative(props.initialOffset ?? 0),
|
|
58
|
-
initialRect: props.initialRect
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
},
|
|
62
|
-
rangeExtractor: (range: Parameters<typeof defaultRangeExtractor>[0]) => {
|
|
63
|
-
const indexes = defaultRangeExtractor(range)
|
|
64
|
-
if (retained >= 0 && !indexes.includes(retained)) indexes.push(retained)
|
|
65
|
-
return indexes.sort((a, b) => a - b)
|
|
66
|
-
},
|
|
58
|
+
initialRect: listInitialRect(props.initialRect, props.height),
|
|
59
|
+
rangeExtractor: (range: Parameters<typeof defaultRangeExtractor>[0]) =>
|
|
60
|
+
retainIndex(defaultRangeExtractor(range), retained),
|
|
67
61
|
}
|
|
68
62
|
}),
|
|
69
63
|
)
|
|
@@ -76,31 +70,11 @@ export function useVirtualList<T>(
|
|
|
76
70
|
key: keys.value[entry.index]!,
|
|
77
71
|
})),
|
|
78
72
|
)
|
|
79
|
-
const contentStyle = computed<CSSProperties>(() =>
|
|
80
|
-
|
|
81
|
-
return horizontal.value
|
|
82
|
-
? {
|
|
83
|
-
width: 'max-content',
|
|
84
|
-
height: '100%',
|
|
85
|
-
paddingInlineStart: `${start}px`,
|
|
86
|
-
paddingInlineEnd: `${end}px`,
|
|
87
|
-
}
|
|
88
|
-
: { width: '100%', paddingBlockStart: `${start}px`, paddingBlockEnd: `${end}px` }
|
|
89
|
-
})
|
|
90
|
-
const rootStyle = computed<CSSProperties>(() => ({
|
|
91
|
-
height: typeof props.height === 'string' ? props.height : `${props.height ?? 320}px`,
|
|
92
|
-
}))
|
|
73
|
+
const contentStyle = computed<CSSProperties>(() => listContentStyle(flow.value, horizontal.value))
|
|
74
|
+
const rootStyle = computed<CSSProperties>(() => listRootStyle(props.height))
|
|
93
75
|
|
|
94
76
|
function itemStyle(entry: VirtualItem & { gapBefore: number }): CSSProperties {
|
|
95
|
-
return horizontal.value
|
|
96
|
-
? {
|
|
97
|
-
marginInlineStart: `${entry.gapBefore}px`,
|
|
98
|
-
width: props.dynamic === false ? `${entry.size}px` : undefined,
|
|
99
|
-
}
|
|
100
|
-
: {
|
|
101
|
-
marginBlockStart: `${entry.gapBefore}px`,
|
|
102
|
-
height: props.dynamic === false ? `${entry.size}px` : undefined,
|
|
103
|
-
}
|
|
77
|
+
return listItemStyle(entry, horizontal.value, props.dynamic)
|
|
104
78
|
}
|
|
105
79
|
|
|
106
80
|
function measureElement(element: unknown) {
|
|
@@ -1,11 +1,29 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
-
import {
|
|
2
|
+
import { Primitive, type PrimitiveProps } from 'reka-ui'
|
|
3
3
|
|
|
4
4
|
defineOptions({ name: 'HnVisuallyHidden' })
|
|
5
|
+
|
|
6
|
+
const props = withDefaults(defineProps<PrimitiveProps>(), { as: 'span' })
|
|
7
|
+
|
|
8
|
+
const hidden = {
|
|
9
|
+
position: 'absolute',
|
|
10
|
+
border: 0,
|
|
11
|
+
width: '1px',
|
|
12
|
+
height: '1px',
|
|
13
|
+
padding: 0,
|
|
14
|
+
margin: '-1px',
|
|
15
|
+
overflow: 'hidden',
|
|
16
|
+
clip: 'rect(0, 0, 0, 0)',
|
|
17
|
+
clipPath: 'inset(50%)',
|
|
18
|
+
whiteSpace: 'nowrap',
|
|
19
|
+
wordWrap: 'normal',
|
|
20
|
+
top: '-1px',
|
|
21
|
+
left: '-1px',
|
|
22
|
+
} as const
|
|
5
23
|
</script>
|
|
6
24
|
|
|
7
25
|
<template>
|
|
8
|
-
<
|
|
26
|
+
<Primitive :as="props.as" :as-child="props.asChild" :style="hidden">
|
|
9
27
|
<slot />
|
|
10
|
-
</
|
|
28
|
+
</Primitive>
|
|
11
29
|
</template>
|
package/src/lib/caret.ts
CHANGED
|
@@ -1,48 +1 @@
|
|
|
1
|
-
|
|
2
|
-
'font-family',
|
|
3
|
-
'font-size',
|
|
4
|
-
'font-weight',
|
|
5
|
-
'font-style',
|
|
6
|
-
'font-variant',
|
|
7
|
-
'font-feature-settings',
|
|
8
|
-
'line-height',
|
|
9
|
-
'letter-spacing',
|
|
10
|
-
'word-spacing',
|
|
11
|
-
'text-indent',
|
|
12
|
-
'text-transform',
|
|
13
|
-
'tab-size',
|
|
14
|
-
'direction',
|
|
15
|
-
'padding-top',
|
|
16
|
-
'padding-right',
|
|
17
|
-
'padding-bottom',
|
|
18
|
-
'padding-left',
|
|
19
|
-
'border-top-width',
|
|
20
|
-
'border-right-width',
|
|
21
|
-
'border-bottom-width',
|
|
22
|
-
'border-left-width',
|
|
23
|
-
]
|
|
24
|
-
|
|
25
|
-
export function caretTop(node: HTMLTextAreaElement, at = node.selectionEnd): number {
|
|
26
|
-
const style = getComputedStyle(node)
|
|
27
|
-
const mirror = node.ownerDocument.createElement('div')
|
|
28
|
-
for (const prop of MIRRORED) mirror.style.setProperty(prop, style.getPropertyValue(prop))
|
|
29
|
-
Object.assign(mirror.style, {
|
|
30
|
-
position: 'absolute',
|
|
31
|
-
top: '0',
|
|
32
|
-
insetInlineStart: '-9999px',
|
|
33
|
-
visibility: 'hidden',
|
|
34
|
-
pointerEvents: 'none',
|
|
35
|
-
boxSizing: 'border-box',
|
|
36
|
-
width: `${node.offsetWidth}px`,
|
|
37
|
-
whiteSpace: 'pre-wrap',
|
|
38
|
-
overflowWrap: 'break-word',
|
|
39
|
-
})
|
|
40
|
-
mirror.textContent = node.value.slice(0, at)
|
|
41
|
-
const marker = node.ownerDocument.createElement('span')
|
|
42
|
-
marker.textContent = node.value.slice(at) || ''
|
|
43
|
-
mirror.append(marker)
|
|
44
|
-
node.ownerDocument.body.append(mirror)
|
|
45
|
-
const top = marker.offsetTop
|
|
46
|
-
mirror.remove()
|
|
47
|
-
return top
|
|
48
|
-
}
|
|
1
|
+
export * from '../../../shared/src/lib/caret'
|