@hina-ui/vue 1.7.4 → 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 +2251 -992
- 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/Anchor.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 +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/composables/useLightboxHint.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/prev-next/PrevNextLink.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/Anchor.vue +13 -9
- package/src/components/anchor/composables/useAnchor.ts +3 -12
- package/src/components/anchor/composables/useAnchorFollow.ts +10 -63
- 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/composables/useLightboxHint.ts +6 -1
- 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/prev-next/PrevNext.vue +1 -1
- package/src/components/prev-next/PrevNextLink.vue +1 -1
- 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,23 +1 @@
|
|
|
1
|
-
|
|
2
|
-
return Object.prototype.toString.call(value) === '[object Object]'
|
|
3
|
-
}
|
|
4
|
-
|
|
5
|
-
export function snapshot(value: unknown): unknown {
|
|
6
|
-
if (Array.isArray(value)) return value.map(snapshot)
|
|
7
|
-
if (isPlain(value)) {
|
|
8
|
-
return Object.fromEntries(Object.entries(value).map(([key, item]) => [key, snapshot(item)]))
|
|
9
|
-
}
|
|
10
|
-
return value
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export function same(a: unknown, b: unknown): boolean {
|
|
14
|
-
if (a === b) return true
|
|
15
|
-
if (Array.isArray(a) && Array.isArray(b)) {
|
|
16
|
-
return a.length === b.length && a.every((item, index) => same(item, b[index]))
|
|
17
|
-
}
|
|
18
|
-
if (isPlain(a) && isPlain(b)) {
|
|
19
|
-
const keys = Object.keys(a)
|
|
20
|
-
return keys.length === Object.keys(b).length && keys.every(key => same(a[key], b[key]))
|
|
21
|
-
}
|
|
22
|
-
return false
|
|
23
|
-
}
|
|
1
|
+
export * from '../../../../../shared/src/lib/form/values'
|
|
@@ -39,7 +39,8 @@
|
|
|
39
39
|
const form = injectForm()
|
|
40
40
|
|
|
41
41
|
const root = shallowRef<HTMLElement | null>(null)
|
|
42
|
-
const
|
|
42
|
+
const body = shallowRef<HTMLElement | null>(null)
|
|
43
|
+
const hooks = collapseHooks('y', () => body.value)
|
|
43
44
|
|
|
44
45
|
const id = useId()
|
|
45
46
|
const labelId = useId()
|
|
@@ -111,7 +112,7 @@
|
|
|
111
112
|
<slot name="description">{{ props.description }}</slot>
|
|
112
113
|
</p>
|
|
113
114
|
</div>
|
|
114
|
-
<div data-hn-form-field-body :class="formFieldContent()">
|
|
115
|
+
<div ref="body" data-hn-form-field-body :class="formFieldContent()">
|
|
115
116
|
<div
|
|
116
117
|
data-hn-form-field-control
|
|
117
118
|
:class="formFieldControl({ orientation: contentOrientation })"
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { useTransform } from 'motion-v'
|
|
1
|
+
import { useMotionValue, useTransform } from 'motion-v'
|
|
2
2
|
import type { useLightboxMotion } from './useLightboxMotion'
|
|
3
3
|
import type { useLightboxFrames } from './useLightboxFrames'
|
|
4
4
|
import type { useLightboxPaging } from './useLightboxPaging'
|
|
@@ -10,6 +10,11 @@ export function useLightboxHint(options: {
|
|
|
10
10
|
paging: ReturnType<typeof useLightboxPaging>
|
|
11
11
|
current: () => LightboxItem | undefined
|
|
12
12
|
}) {
|
|
13
|
+
// useTransform's subscription refresh queues frame callbacks even during SSR.
|
|
14
|
+
// Node never drains that queue, retaining the request through these closures.
|
|
15
|
+
// The hint is only rendered inside the client-mounted lightbox.
|
|
16
|
+
if (typeof window === 'undefined') return { x: useMotionValue(0), y: useMotionValue(0) }
|
|
17
|
+
|
|
13
18
|
const { motion, frames, paging } = options
|
|
14
19
|
|
|
15
20
|
function corner() {
|
|
@@ -1,14 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import type { Rect } from './utils/pose'
|
|
3
|
-
|
|
4
|
-
export type LightboxSource = HTMLImageElement | Rect
|
|
5
|
-
|
|
6
|
-
export interface LightboxItem {
|
|
7
|
-
id: string
|
|
8
|
-
src: string
|
|
9
|
-
preview?: string
|
|
10
|
-
previewSize?: { width: number; height: number }
|
|
11
|
-
alt: string
|
|
12
|
-
fit?: ImageVariants['fit']
|
|
13
|
-
source?: () => LightboxSource | null | undefined
|
|
14
|
-
}
|
|
1
|
+
export * from '../../../../shared/src/lib/lightbox/types'
|
|
@@ -1,117 +1 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
export interface Corner {
|
|
4
|
-
x: number
|
|
5
|
-
y: number
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
export type Corners = [Corner, Corner, Corner, Corner]
|
|
9
|
-
|
|
10
|
-
function emptyCorners(): Corners {
|
|
11
|
-
return [
|
|
12
|
-
{ x: 0, y: 0 },
|
|
13
|
-
{ x: 0, y: 0 },
|
|
14
|
-
{ x: 0, y: 0 },
|
|
15
|
-
{ x: 0, y: 0 },
|
|
16
|
-
]
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
function length(value: string, size: number): number {
|
|
20
|
-
const number = Number.parseFloat(value) || 0
|
|
21
|
-
return value.endsWith('%') ? (number * size) / 100 : number
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
function cornersOf(style: CSSStyleDeclaration, width: number, height: number): Corners {
|
|
25
|
-
const corners = [
|
|
26
|
-
style.borderTopLeftRadius,
|
|
27
|
-
style.borderTopRightRadius,
|
|
28
|
-
style.borderBottomRightRadius,
|
|
29
|
-
style.borderBottomLeftRadius,
|
|
30
|
-
].map(value => {
|
|
31
|
-
const [x = '0', y = x] = value.split(/\s+/)
|
|
32
|
-
return { x: length(x, width), y: length(y, height) }
|
|
33
|
-
}) as Corners
|
|
34
|
-
const [tl, tr, br, bl] = corners
|
|
35
|
-
const factor = Math.min(
|
|
36
|
-
1,
|
|
37
|
-
width / (tl.x + tr.x || 1),
|
|
38
|
-
width / (bl.x + br.x || 1),
|
|
39
|
-
height / (tl.y + bl.y || 1),
|
|
40
|
-
height / (tr.y + br.y || 1),
|
|
41
|
-
)
|
|
42
|
-
return corners.map(corner => ({ x: corner.x * factor, y: corner.y * factor })) as Corners
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
function paddingBox(node: Element, style: CSSStyleDeclaration) {
|
|
46
|
-
const box = node.getBoundingClientRect()
|
|
47
|
-
const width = node instanceof HTMLElement ? node.offsetWidth : box.width
|
|
48
|
-
const height = node instanceof HTMLElement ? node.offsetHeight : box.height
|
|
49
|
-
const sx = width ? box.width / width : 1
|
|
50
|
-
const sy = height ? box.height / height : 1
|
|
51
|
-
const left = Number.parseFloat(style.borderLeftWidth) || 0
|
|
52
|
-
const right = Number.parseFloat(style.borderRightWidth) || 0
|
|
53
|
-
const top = Number.parseFloat(style.borderTopWidth) || 0
|
|
54
|
-
const bottom = Number.parseFloat(style.borderBottomWidth) || 0
|
|
55
|
-
const corners = cornersOf(style, width, height)
|
|
56
|
-
const borders = [
|
|
57
|
-
[left, top],
|
|
58
|
-
[right, top],
|
|
59
|
-
[right, bottom],
|
|
60
|
-
[left, bottom],
|
|
61
|
-
]
|
|
62
|
-
return {
|
|
63
|
-
rect: {
|
|
64
|
-
x: box.x + left * sx,
|
|
65
|
-
y: box.y + top * sy,
|
|
66
|
-
width: Math.max(0, box.width - (left + right) * sx),
|
|
67
|
-
height: Math.max(0, box.height - (top + bottom) * sy),
|
|
68
|
-
},
|
|
69
|
-
corners: corners.map((corner, index) => ({
|
|
70
|
-
x: Math.max(0, corner.x - borders[index]![0]!) * sx,
|
|
71
|
-
y: Math.max(0, corner.y - borders[index]![1]!) * sy,
|
|
72
|
-
})) as Corners,
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
function points(rect: Rect) {
|
|
77
|
-
return [
|
|
78
|
-
[rect.x, rect.y],
|
|
79
|
-
[rect.x + rect.width, rect.y],
|
|
80
|
-
[rect.x + rect.width, rect.y + rect.height],
|
|
81
|
-
[rect.x, rect.y + rect.height],
|
|
82
|
-
]
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
export function clipOf(el: Element | null | undefined, box: Rect) {
|
|
86
|
-
let rect = { x: box.x, y: box.y, width: box.width, height: box.height }
|
|
87
|
-
const clips: ReturnType<typeof paddingBox>[] = []
|
|
88
|
-
for (let node = el; node; node = node.parentElement) {
|
|
89
|
-
const style = getComputedStyle(node)
|
|
90
|
-
const clipX = node === el || /^(hidden|clip|scroll|auto)$/.test(style.overflowX)
|
|
91
|
-
const clipY = node === el || /^(hidden|clip|scroll|auto)$/.test(style.overflowY)
|
|
92
|
-
if (!clipX && !clipY) continue
|
|
93
|
-
const clip = paddingBox(node, style)
|
|
94
|
-
const x = clipX ? Math.max(rect.x, clip.rect.x) : rect.x
|
|
95
|
-
const y = clipY ? Math.max(rect.y, clip.rect.y) : rect.y
|
|
96
|
-
const right = clipX
|
|
97
|
-
? Math.min(rect.x + rect.width, clip.rect.x + clip.rect.width)
|
|
98
|
-
: rect.x + rect.width
|
|
99
|
-
const bottom = clipY
|
|
100
|
-
? Math.min(rect.y + rect.height, clip.rect.y + clip.rect.height)
|
|
101
|
-
: rect.y + rect.height
|
|
102
|
-
rect = { x, y, width: Math.max(0, right - x), height: Math.max(0, bottom - y) }
|
|
103
|
-
if (clipX && clipY) clips.push(clip)
|
|
104
|
-
}
|
|
105
|
-
const corners = emptyCorners()
|
|
106
|
-
const visible = points(rect)
|
|
107
|
-
for (const clip of clips) {
|
|
108
|
-
const edges = points(clip.rect)
|
|
109
|
-
for (let index = 0; index < 4; index += 1) {
|
|
110
|
-
if (visible[index]!.some((value, axis) => Math.abs(value - edges[index]![axis]!) > 0.5))
|
|
111
|
-
continue
|
|
112
|
-
corners[index]!.x = Math.max(corners[index]!.x, clip.corners[index]!.x)
|
|
113
|
-
corners[index]!.y = Math.max(corners[index]!.y, clip.corners[index]!.y)
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
return { rect, corners }
|
|
117
|
-
}
|
|
1
|
+
export * from '../../../../../shared/src/lib/lightbox/clip'
|
|
@@ -1,29 +1 @@
|
|
|
1
|
-
export
|
|
2
|
-
try {
|
|
3
|
-
const parsed = new URL(url, 'http://localhost')
|
|
4
|
-
if (parsed.protocol !== 'http:' && parsed.protocol !== 'https:') return fallback
|
|
5
|
-
const name = decodeURIComponent(parsed.pathname.split('/').filter(Boolean).pop() ?? '')
|
|
6
|
-
return name || fallback
|
|
7
|
-
} catch {
|
|
8
|
-
return fallback
|
|
9
|
-
}
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export async function saveImage(url: string): Promise<'saved' | 'opened'> {
|
|
13
|
-
try {
|
|
14
|
-
const response = await fetch(url, { mode: 'cors' })
|
|
15
|
-
if (!response.ok) throw new Error(String(response.status))
|
|
16
|
-
const blob = await response.blob()
|
|
17
|
-
const href = URL.createObjectURL(blob)
|
|
18
|
-
const anchor = Object.assign(document.createElement('a'), {
|
|
19
|
-
href,
|
|
20
|
-
download: fileNameOf(url),
|
|
21
|
-
})
|
|
22
|
-
anchor.click()
|
|
23
|
-
setTimeout(() => URL.revokeObjectURL(href), 0)
|
|
24
|
-
return 'saved'
|
|
25
|
-
} catch {
|
|
26
|
-
window.open(url, '_blank', 'noopener')
|
|
27
|
-
return 'opened'
|
|
28
|
-
}
|
|
29
|
-
}
|
|
1
|
+
export * from '../../../../../shared/src/lib/lightbox/download'
|
|
@@ -1,54 +1 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
export interface Touch extends Point {
|
|
4
|
-
time: number
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
export const DRAG_THRESHOLD = 4
|
|
8
|
-
export const TAP_MAX_DISTANCE = 10
|
|
9
|
-
export const TAP_MAX_MS = 300
|
|
10
|
-
export const DOUBLE_TAP_MS = 300
|
|
11
|
-
export const DOUBLE_TAP_DISTANCE = 25
|
|
12
|
-
export const WHEEL_LINE = 16
|
|
13
|
-
export const TRACKPAD_INTENSITY = 0.01
|
|
14
|
-
|
|
15
|
-
export const FLING = {
|
|
16
|
-
power: 0.8,
|
|
17
|
-
timeConstant: 750,
|
|
18
|
-
bounceStiffness: 200,
|
|
19
|
-
bounceDamping: 40,
|
|
20
|
-
restDelta: 1,
|
|
21
|
-
restSpeed: 10,
|
|
22
|
-
} as const
|
|
23
|
-
|
|
24
|
-
export function midpoint(a: Point, b: Point): Point {
|
|
25
|
-
return { x: (a.x + b.x) / 2, y: (a.y + b.y) / 2 }
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
export function distance(a: Point, b: Point): number {
|
|
29
|
-
return Math.hypot(b.x - a.x, b.y - a.y)
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
export function dragAxis(start: Point, current: Point): 'x' | 'y' | null {
|
|
33
|
-
const dx = Math.abs(current.x - start.x)
|
|
34
|
-
const dy = Math.abs(current.y - start.y)
|
|
35
|
-
if (Math.max(dx, dy) < DRAG_THRESHOLD) return null
|
|
36
|
-
return dx > dy ? 'x' : 'y'
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
export function isTap(start: Touch, end: Touch): boolean {
|
|
40
|
-
return distance(start, end) <= TAP_MAX_DISTANCE && end.time - start.time <= TAP_MAX_MS
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
export function isDoubleTap(previous: Touch | null, next: Touch): boolean {
|
|
44
|
-
if (!previous) return false
|
|
45
|
-
return (
|
|
46
|
-
next.time - previous.time <= DOUBLE_TAP_MS && distance(previous, next) <= DOUBLE_TAP_DISTANCE
|
|
47
|
-
)
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
export function wheelDelta(deltaY: number, deltaMode: number, stageHeight: number): number {
|
|
51
|
-
if (deltaMode === 1) return deltaY * WHEEL_LINE
|
|
52
|
-
if (deltaMode === 2) return deltaY * stageHeight
|
|
53
|
-
return deltaY
|
|
54
|
-
}
|
|
1
|
+
export * from '../../../../../shared/src/lib/lightbox/gesture'
|
|
@@ -1,33 +1 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
export const PAGE_COMMIT = 0.2
|
|
4
|
-
export const PAGE_VELOCITY = 400
|
|
5
|
-
export const PAGE_PROJECTION = 0.25
|
|
6
|
-
|
|
7
|
-
export function pageSteps(offset: number, velocity: number, width: number): number {
|
|
8
|
-
if (width <= 0) return 0
|
|
9
|
-
if (Math.abs(offset) < width * PAGE_COMMIT && Math.abs(velocity) < PAGE_VELOCITY) return 0
|
|
10
|
-
const projected = offset + velocity * PAGE_PROJECTION
|
|
11
|
-
if (projected === 0) return 0
|
|
12
|
-
return projected < 0 ? 1 : -1
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export function clampIndex(index: number, count: number): number {
|
|
16
|
-
if (count <= 0) return 0
|
|
17
|
-
return Math.min(Math.max(index, 0), count - 1)
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
export function wrapIndex(index: number, count: number): number {
|
|
21
|
-
if (count <= 0) return 0
|
|
22
|
-
return ((index % count) + count) % count
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
export function shortestDelta(delta: number, count: number): number {
|
|
26
|
-
if (count <= 0) return 0
|
|
27
|
-
const forward = wrapIndex(delta, count)
|
|
28
|
-
return forward > count / 2 ? forward - count : forward
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
export function edgePosition(raw: number, count: number, width: number): number {
|
|
32
|
-
return rubberBand(raw, -Math.max(0, count - 1) * width, 0, width)
|
|
33
|
-
}
|
|
1
|
+
export * from '../../../../../shared/src/lib/lightbox/paging'
|
|
@@ -1,142 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import type { Corners } from './clip'
|
|
3
|
-
import { fitSize, rotatedSize, type Size } from './zoom'
|
|
4
|
-
|
|
5
|
-
export interface Rect {
|
|
6
|
-
x: number
|
|
7
|
-
y: number
|
|
8
|
-
width: number
|
|
9
|
-
height: number
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export interface Pose {
|
|
13
|
-
x: number
|
|
14
|
-
y: number
|
|
15
|
-
scale: number
|
|
16
|
-
rotate: number
|
|
17
|
-
clipPath: string
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
export const REST_POSE: Pose = {
|
|
21
|
-
x: 0,
|
|
22
|
-
y: 0,
|
|
23
|
-
scale: 1,
|
|
24
|
-
rotate: 0,
|
|
25
|
-
clipPath: 'inset(0px 0px 0px 0px round 0px 0px 0px 0px / 0px 0px 0px 0px)',
|
|
26
|
-
}
|
|
27
|
-
export const TRAVEL_SPRING = { type: 'spring', visualDuration: 0.3, bounce: 0 } as const
|
|
28
|
-
export const RETURN_SPRING = { ...TRAVEL_SPRING, visualDuration: 0.22 } as const
|
|
29
|
-
export const DISMISS_SCALE = 0.7
|
|
30
|
-
export const DISMISS_TRAVEL = 0.3
|
|
31
|
-
export const DISMISS_COMMIT = 0.5
|
|
32
|
-
export const DISMISS_VELOCITY = 600
|
|
33
|
-
|
|
34
|
-
function px(value: number): string {
|
|
35
|
-
return `${Math.round(value * 100) / 100}px`
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
export function fitRect(
|
|
39
|
-
natural: Size,
|
|
40
|
-
stage: Size & Partial<Pick<Rect, 'x' | 'y'>>,
|
|
41
|
-
rotation = 0,
|
|
42
|
-
): Rect {
|
|
43
|
-
const size = fitSize(natural, stage, rotation)
|
|
44
|
-
return {
|
|
45
|
-
x: (stage.x ?? 0) + (stage.width - size.width) / 2,
|
|
46
|
-
y: (stage.y ?? 0) + (stage.height - size.height) / 2,
|
|
47
|
-
width: size.width,
|
|
48
|
-
height: size.height,
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
export function renderedRect(box: Rect, natural: Size, fit: ImageVariants['fit'] = 'cover'): Rect {
|
|
53
|
-
if (fit === 'fill' || natural.width <= 0 || natural.height <= 0) return { ...box }
|
|
54
|
-
const contain = Math.min(box.width / natural.width, box.height / natural.height)
|
|
55
|
-
const cover = Math.max(box.width / natural.width, box.height / natural.height)
|
|
56
|
-
const scale =
|
|
57
|
-
fit === 'cover'
|
|
58
|
-
? cover
|
|
59
|
-
: fit === 'contain'
|
|
60
|
-
? contain
|
|
61
|
-
: fit === 'none'
|
|
62
|
-
? 1
|
|
63
|
-
: Math.min(contain, 1)
|
|
64
|
-
const width = natural.width * scale
|
|
65
|
-
const height = natural.height * scale
|
|
66
|
-
return {
|
|
67
|
-
x: box.x + (box.width - width) / 2,
|
|
68
|
-
y: box.y + (box.height - height) / 2,
|
|
69
|
-
width,
|
|
70
|
-
height,
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
function intersect(a: Rect, b: Rect): Rect {
|
|
75
|
-
const x = Math.max(a.x, b.x)
|
|
76
|
-
const y = Math.max(a.y, b.y)
|
|
77
|
-
const right = Math.min(a.x + a.width, b.x + b.width)
|
|
78
|
-
const bottom = Math.min(a.y + a.height, b.y + b.height)
|
|
79
|
-
return { x, y, width: Math.max(0, right - x), height: Math.max(0, bottom - y) }
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
export function openPose(
|
|
83
|
-
frame: Rect,
|
|
84
|
-
box: Rect,
|
|
85
|
-
natural: Size,
|
|
86
|
-
fit?: ImageVariants['fit'],
|
|
87
|
-
radius: number | Corners = 0,
|
|
88
|
-
clipBox = box,
|
|
89
|
-
): Pose {
|
|
90
|
-
const rendered = renderedRect(box, natural, fit)
|
|
91
|
-
if (frame.width <= 0 || frame.height <= 0 || rendered.width <= 0) return REST_POSE
|
|
92
|
-
const scale = rendered.width / frame.width
|
|
93
|
-
const visible = intersect(intersect(box, clipBox), rendered)
|
|
94
|
-
const top = (visible.y - rendered.y) / scale
|
|
95
|
-
const left = (visible.x - rendered.x) / scale
|
|
96
|
-
const right = (rendered.x + rendered.width - visible.x - visible.width) / scale
|
|
97
|
-
const bottom = (rendered.y + rendered.height - visible.y - visible.height) / scale
|
|
98
|
-
const corners =
|
|
99
|
-
typeof radius === 'number'
|
|
100
|
-
? Array.from({ length: 4 }, () => ({ x: radius, y: radius }))
|
|
101
|
-
: radius
|
|
102
|
-
const leftEdge = Math.abs(visible.x - clipBox.x) <= 0.5
|
|
103
|
-
const topEdge = Math.abs(visible.y - clipBox.y) <= 0.5
|
|
104
|
-
const rightEdge = Math.abs(visible.x + visible.width - clipBox.x - clipBox.width) <= 0.5
|
|
105
|
-
const bottomEdge = Math.abs(visible.y + visible.height - clipBox.y - clipBox.height) <= 0.5
|
|
106
|
-
const touches = [
|
|
107
|
-
leftEdge && topEdge,
|
|
108
|
-
rightEdge && topEdge,
|
|
109
|
-
rightEdge && bottomEdge,
|
|
110
|
-
leftEdge && bottomEdge,
|
|
111
|
-
]
|
|
112
|
-
const clipped = corners.map((corner, index) => (touches[index] ? corner : { x: 0, y: 0 }))
|
|
113
|
-
const horizontal = clipped.map(corner => px(Math.max(0, corner.x) / scale)).join(' ')
|
|
114
|
-
const vertical = clipped.map(corner => px(Math.max(0, corner.y) / scale)).join(' ')
|
|
115
|
-
return {
|
|
116
|
-
x: rendered.x + rendered.width / 2 - (frame.x + frame.width / 2),
|
|
117
|
-
y: rendered.y + rendered.height / 2 - (frame.y + frame.height / 2),
|
|
118
|
-
scale,
|
|
119
|
-
rotate: 0,
|
|
120
|
-
clipPath: `inset(${px(top)} ${px(right)} ${px(bottom)} ${px(left)} round ${horizontal} / ${vertical})`,
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
export function baseScale(frame: Size, stage: Size, rotation: number, natural: Size): number {
|
|
125
|
-
const visual = rotatedSize(frame, rotation)
|
|
126
|
-
if (visual.width <= 0 || visual.height <= 0) return 1
|
|
127
|
-
return Math.min(
|
|
128
|
-
stage.width / visual.width,
|
|
129
|
-
stage.height / visual.height,
|
|
130
|
-
natural.width / frame.width,
|
|
131
|
-
)
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
export function dismissProgress(offsetY: number, stageHeight: number): number {
|
|
135
|
-
if (stageHeight <= 0) return 0
|
|
136
|
-
return Math.min(1, Math.max(0, offsetY) / (stageHeight * DISMISS_TRAVEL))
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
export function shouldDismiss(offsetY: number, velocityY: number, stageHeight: number): boolean {
|
|
140
|
-
if (offsetY <= 0) return false
|
|
141
|
-
return dismissProgress(offsetY, stageHeight) >= DISMISS_COMMIT || velocityY >= DISMISS_VELOCITY
|
|
142
|
-
}
|
|
1
|
+
export * from '../../../../../shared/src/lib/lightbox/pose'
|
|
@@ -1,17 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import type { Rect } from './pose'
|
|
3
|
-
|
|
4
|
-
export function sourceRect(source: LightboxSource | null | undefined): Rect | null {
|
|
5
|
-
if (!source) return null
|
|
6
|
-
const isElement = 'getBoundingClientRect' in source
|
|
7
|
-
if (isElement && !source.isConnected) return null
|
|
8
|
-
const rect = isElement ? source.getBoundingClientRect() : source
|
|
9
|
-
if (
|
|
10
|
-
![rect.x, rect.y, rect.width, rect.height].every(Number.isFinite) ||
|
|
11
|
-
rect.width <= 0 ||
|
|
12
|
-
rect.height <= 0
|
|
13
|
-
) {
|
|
14
|
-
return null
|
|
15
|
-
}
|
|
16
|
-
return { x: rect.x, y: rect.y, width: rect.width, height: rect.height }
|
|
17
|
-
}
|
|
1
|
+
export * from '../../../../../shared/src/lib/lightbox/source'
|
|
@@ -1,127 +1 @@
|
|
|
1
|
-
export
|
|
2
|
-
width: number
|
|
3
|
-
height: number
|
|
4
|
-
}
|
|
5
|
-
|
|
6
|
-
export interface Point {
|
|
7
|
-
x: number
|
|
8
|
-
y: number
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export interface Bounds {
|
|
12
|
-
minX: number
|
|
13
|
-
maxX: number
|
|
14
|
-
minY: number
|
|
15
|
-
maxY: number
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export const ZOOM_MIN = 1
|
|
19
|
-
export const ZOOM_MAX = 2
|
|
20
|
-
export const ZOOM_STEP = 1.5
|
|
21
|
-
export const OVERSHOOT = 0.55
|
|
22
|
-
export const WHEEL_INTENSITY = 0.002
|
|
23
|
-
|
|
24
|
-
export const ZOOM_EPSILON = 0.001
|
|
25
|
-
|
|
26
|
-
export function isZoomed(zoom: number): boolean {
|
|
27
|
-
return zoom > ZOOM_MIN + ZOOM_EPSILON
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
export function rotatedSize(size: Size, rotation: number): Size {
|
|
31
|
-
const quarter = Math.round(rotation / 90) % 2
|
|
32
|
-
return quarter === 0 ? size : { width: size.height, height: size.width }
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
export function fitSize(natural: Size, stage: Size, rotation = 0): Size {
|
|
36
|
-
const upright = rotatedSize(natural, rotation)
|
|
37
|
-
if (upright.width <= 0 || upright.height <= 0) return { width: 0, height: 0 }
|
|
38
|
-
const scale = Math.min(1, stage.width / upright.width, stage.height / upright.height)
|
|
39
|
-
return { width: upright.width * scale, height: upright.height * scale }
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
export function panBounds(displayed: Size, stage: Size): Bounds {
|
|
43
|
-
const x = Math.max(0, (displayed.width - stage.width) / 2)
|
|
44
|
-
const y = Math.max(0, (displayed.height - stage.height) / 2)
|
|
45
|
-
return { minX: x ? -x : 0, maxX: x, minY: y ? -y : 0, maxY: y }
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
export function clampOffset(offset: Point, bounds: Bounds): Point {
|
|
49
|
-
return {
|
|
50
|
-
x: Math.min(Math.max(offset.x, bounds.minX), bounds.maxX),
|
|
51
|
-
y: Math.min(Math.max(offset.y, bounds.minY), bounds.maxY),
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
export function zoomAbout(offset: Point, zoom: number, next: number, focal: Point): Point {
|
|
56
|
-
const ratio = next / zoom
|
|
57
|
-
return {
|
|
58
|
-
x: focal.x - (focal.x - offset.x) * ratio,
|
|
59
|
-
y: focal.y - (focal.y - offset.y) * ratio,
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
function resist(over: number, span: number, coefficient: number): number {
|
|
64
|
-
return (1 - 1 / ((over * coefficient) / span + 1)) * span
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
export function rubberBand(
|
|
68
|
-
value: number,
|
|
69
|
-
min: number,
|
|
70
|
-
max: number,
|
|
71
|
-
span: number,
|
|
72
|
-
coefficient = OVERSHOOT,
|
|
73
|
-
): number {
|
|
74
|
-
if (span <= 0) return Math.min(Math.max(value, min), max)
|
|
75
|
-
if (value > max) return max + resist(value - max, span, coefficient)
|
|
76
|
-
if (value < min) return min - resist(min - value, span, coefficient)
|
|
77
|
-
return value
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
export function elasticOffset(offset: Point, bounds: Bounds, stage: Size): Point {
|
|
81
|
-
return {
|
|
82
|
-
x: rubberBand(offset.x, bounds.minX, bounds.maxX, stage.width),
|
|
83
|
-
y: rubberBand(offset.y, bounds.minY, bounds.maxY, stage.height),
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
export function clampZoom(zoom: number, min = ZOOM_MIN, max = ZOOM_MAX): number {
|
|
88
|
-
return Math.min(Math.max(zoom, min), max)
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
export function elasticZoom(zoom: number, min = ZOOM_MIN, max = ZOOM_MAX): number {
|
|
92
|
-
const lo = Math.log(min)
|
|
93
|
-
const hi = Math.log(max)
|
|
94
|
-
return Math.exp(rubberBand(Math.log(zoom), lo, hi, hi - lo))
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
export function pinchZoom(startZoom: number, startDistance: number, distance: number): number {
|
|
98
|
-
if (startDistance <= 0) return startZoom
|
|
99
|
-
return startZoom * (distance / startDistance)
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
export function wheelZoom(zoom: number, deltaY: number, intensity = WHEEL_INTENSITY): number {
|
|
103
|
-
return zoom * Math.exp(-deltaY * intensity)
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
export function zoomLevels(natural: Size, fit: Size, stage: Size) {
|
|
107
|
-
const original = fit.width > 0 ? Math.max(ZOOM_MIN, natural.width / fit.width) : ZOOM_MIN
|
|
108
|
-
const secondary =
|
|
109
|
-
natural.height > natural.width * 2
|
|
110
|
-
? Math.min(original, stage.width / fit.width)
|
|
111
|
-
: natural.width > natural.height * 2
|
|
112
|
-
? Math.min(original, stage.height / fit.height)
|
|
113
|
-
: original
|
|
114
|
-
return {
|
|
115
|
-
original,
|
|
116
|
-
secondary: Number.isFinite(secondary) ? Math.max(ZOOM_MIN, secondary) : ZOOM_MIN,
|
|
117
|
-
max: original * ZOOM_MAX,
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
export function doubleTapZoom(zoom: number, secondary: number): number {
|
|
122
|
-
return isZoomed(zoom) ? ZOOM_MIN : secondary
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
export function stepZoom(zoom: number, direction: 1 | -1, max = ZOOM_MAX): number {
|
|
126
|
-
return clampZoom(zoom * ZOOM_STEP ** direction, ZOOM_MIN, max)
|
|
127
|
-
}
|
|
1
|
+
export * from '../../../../../shared/src/lib/lightbox/zoom'
|
|
@@ -1,14 +1 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
export const METER_TONES: MeterTone[] = [
|
|
4
|
-
'accent',
|
|
5
|
-
'info',
|
|
6
|
-
'success',
|
|
7
|
-
'warning',
|
|
8
|
-
'danger',
|
|
9
|
-
'neutral',
|
|
10
|
-
]
|
|
11
|
-
|
|
12
|
-
export function toneAt(index: number): MeterTone {
|
|
13
|
-
return METER_TONES[index % METER_TONES.length]!
|
|
14
|
-
}
|
|
1
|
+
export * from '../../../../../shared/src/lib/meter-group'
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
<script setup lang="ts" generic="T extends SelectOption = SelectOption">
|
|
2
2
|
import { computed, ref } from 'vue'
|
|
3
|
-
import { SelectRoot, SelectTrigger } from 'reka-ui'
|
|
3
|
+
import { SelectRoot, SelectTrigger, VisuallyHidden } from 'reka-ui'
|
|
4
4
|
import { cn } from '../../lib/cn'
|
|
5
5
|
import type { VirtualizeOptions } from '../../lib/virtual/types'
|
|
6
6
|
import { useUiLocale } from '../../locale'
|
|
7
7
|
import Chip from '../chip/Chip.vue'
|
|
8
|
-
import VisuallyHidden from '../visually-hidden/VisuallyHidden.vue'
|
|
9
8
|
import { X } from '@lucide/vue'
|
|
10
9
|
import InputAction from '../input/InputAction.vue'
|
|
11
10
|
import DisclosureIcon from '../disclosure-icon/DisclosureIcon.vue'
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
import { computed } from 'vue'
|
|
3
3
|
import { ChevronDown, ChevronUp } from '@lucide/vue'
|
|
4
|
+
import { useForwardPropsEmits } from 'reka-ui'
|
|
4
5
|
import {
|
|
5
6
|
NumberFieldDecrement,
|
|
6
7
|
NumberFieldIncrement,
|
|
7
8
|
NumberFieldInput,
|
|
8
9
|
NumberFieldRoot,
|
|
9
|
-
useForwardPropsEmits,
|
|
10
10
|
type NumberFieldRootEmits,
|
|
11
|
-
} from '
|
|
11
|
+
} from '../../primitives/number-field'
|
|
12
12
|
import { cn } from '../../lib/cn'
|
|
13
13
|
import { useUiLocale } from '../../locale'
|
|
14
14
|
import { useFieldControl } from '../form-field/context'
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { computed, watch, type Ref } from 'vue'
|
|
2
|
+
import { paginationInteger } from '../../../../../shared/src/lib/pagination'
|
|
2
3
|
import type { PaginationChange, PaginationState } from '../types'
|
|
3
4
|
|
|
4
5
|
interface PaginationOptions {
|
|
@@ -10,9 +11,7 @@ interface PaginationOptions {
|
|
|
10
11
|
pending?: boolean
|
|
11
12
|
}
|
|
12
13
|
|
|
13
|
-
export
|
|
14
|
-
return Number.isFinite(value) ? Math.max(minimum, Math.floor(value)) : fallback
|
|
15
|
-
}
|
|
14
|
+
export { paginationInteger }
|
|
16
15
|
|
|
17
16
|
export function usePagination(
|
|
18
17
|
props: PaginationOptions,
|