@indielayer/ui 1.8.4 → 1.9.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (119) hide show
  1. package/docs/pages/component/select/usage.vue +17 -5
  2. package/docs/pages/component/table/index.vue +7 -0
  3. package/docs/pages/component/table/usage.vue +5 -1
  4. package/docs/pages/component/table/virtual.vue +53 -0
  5. package/docs/pages/typography.vue +14 -12
  6. package/lib/components/accordion/Accordion.vue.d.ts +4 -4
  7. package/lib/components/accordion/AccordionItem.vue.d.ts +6 -6
  8. package/lib/components/accordion/AccordionItem.vue.js +51 -51
  9. package/lib/components/alert/Alert.vue.d.ts +8 -8
  10. package/lib/components/alert/Alert.vue2.js +20 -20
  11. package/lib/components/avatar/Avatar.vue.d.ts +4 -4
  12. package/lib/components/badge/Badge.vue.d.ts +4 -4
  13. package/lib/components/breadcrumbs/Breadcrumbs.vue.d.ts +4 -4
  14. package/lib/components/button/Button.vue.d.ts +5 -5
  15. package/lib/components/button/ButtonGroup.vue.d.ts +4 -4
  16. package/lib/components/card/Card.vue.d.ts +4 -4
  17. package/lib/components/carousel/Carousel.vue.d.ts +7 -7
  18. package/lib/components/carousel/CarouselSlide.vue.d.ts +4 -4
  19. package/lib/components/checkbox/Checkbox.vue.d.ts +6 -6
  20. package/lib/components/checkbox/Checkbox.vue2.js +60 -60
  21. package/lib/components/container/Container.vue.d.ts +4 -4
  22. package/lib/components/datepicker/Datepicker.vue.d.ts +6 -6
  23. package/lib/components/datepicker/Datepicker.vue.js +3 -3
  24. package/lib/components/divider/Divider.vue.d.ts +4 -4
  25. package/lib/components/drawer/Drawer.vue.d.ts +6 -6
  26. package/lib/components/drawer/Drawer.vue.js +1 -1
  27. package/lib/components/form/Form.vue.d.ts +5 -5
  28. package/lib/components/formGroup/FormGroup.vue.d.ts +6 -6
  29. package/lib/components/formGroup/FormGroup.vue.js +7 -7
  30. package/lib/components/icon/Icon.vue.d.ts +4 -4
  31. package/lib/components/image/Image.vue.d.ts +3 -3
  32. package/lib/components/input/Input.vue.d.ts +6 -6
  33. package/lib/components/inputFooter/InputFooter.vue.d.ts +3 -3
  34. package/lib/components/label/Label.vue.d.ts +4 -4
  35. package/lib/components/link/Link.vue.d.ts +4 -4
  36. package/lib/components/loader/Loader.vue.d.ts +4 -4
  37. package/lib/components/menu/Menu.vue.d.ts +5 -5
  38. package/lib/components/menu/MenuItem.vue.d.ts +5 -5
  39. package/lib/components/menu/MenuItem.vue2.js +1 -1
  40. package/lib/components/modal/Modal.vue.d.ts +6 -6
  41. package/lib/components/modal/Modal.vue.js +1 -1
  42. package/lib/components/notifications/Notifications.vue.d.ts +5 -5
  43. package/lib/components/pagination/Pagination.vue.d.ts +5 -5
  44. package/lib/components/pagination/Pagination.vue.js +41 -41
  45. package/lib/components/pagination/PaginationItem.vue.d.ts +6 -6
  46. package/lib/components/popover/Popover.vue.d.ts +8 -8
  47. package/lib/components/popover/Popover.vue.js +1 -1
  48. package/lib/components/popover/PopoverContainer.vue.d.ts +4 -4
  49. package/lib/components/progress/Progress.vue.d.ts +4 -4
  50. package/lib/components/qrCode/QrCode.vue.d.ts +4 -4
  51. package/lib/components/radio/Radio.vue.d.ts +6 -6
  52. package/lib/components/radio/Radio.vue2.js +63 -63
  53. package/lib/components/scroll/Scroll.vue.d.ts +6 -6
  54. package/lib/components/scroll/Scroll.vue2.js +1 -1
  55. package/lib/components/select/Select.vue.d.ts +42 -6
  56. package/lib/components/select/Select.vue.js +224 -201
  57. package/lib/components/select/theme/Select.base.theme.js +1 -1
  58. package/lib/components/skeleton/Skeleton.vue.d.ts +4 -4
  59. package/lib/components/skeleton/Skeleton.vue.js +17 -17
  60. package/lib/components/slider/Slider.vue.d.ts +6 -6
  61. package/lib/components/spacer/Spacer.d.ts +1 -1
  62. package/lib/components/spinner/Spinner.vue.d.ts +4 -4
  63. package/lib/components/stepper/Stepper.vue.d.ts +5 -5
  64. package/lib/components/tab/Tab.vue.d.ts +5 -5
  65. package/lib/components/tab/Tab.vue.js +1 -1
  66. package/lib/components/tab/TabGroup.vue.d.ts +5 -5
  67. package/lib/components/tab/TabGroup.vue.js +2 -2
  68. package/lib/components/table/Table.vue.d.ts +119 -24
  69. package/lib/components/table/Table.vue.js +226 -188
  70. package/lib/components/table/TableBody.d.ts +1 -1
  71. package/lib/components/table/TableCell.vue.d.ts +4 -4
  72. package/lib/components/table/TableHead.vue.d.ts +10 -2
  73. package/lib/components/table/TableHead.vue.js +16 -13
  74. package/lib/components/table/TableHeader.vue.d.ts +4 -8
  75. package/lib/components/table/TableHeader.vue.js +40 -41
  76. package/lib/components/table/TableRow.vue.d.ts +8 -4
  77. package/lib/components/table/TableRow.vue.js +3 -2
  78. package/lib/components/table/theme/TableHead.base.theme.js +7 -4
  79. package/lib/components/table/theme/TableHead.carbon.theme.js +7 -4
  80. package/lib/components/table/theme/TableHeader.base.theme.js +3 -3
  81. package/lib/components/table/theme/TableHeader.carbon.theme.js +1 -1
  82. package/lib/components/table/theme/TableRow.base.theme.js +1 -1
  83. package/lib/components/tag/Tag.vue.d.ts +5 -5
  84. package/lib/components/textarea/Textarea.vue.d.ts +6 -6
  85. package/lib/components/textarea/Textarea.vue.js +6 -6
  86. package/lib/components/themeProvider/ThemeProvider.vue.d.ts +3 -3
  87. package/lib/components/toggle/Toggle.vue.d.ts +6 -6
  88. package/lib/components/tooltip/ToggleTip.vue.d.ts +3 -3
  89. package/lib/components/tooltip/Tooltip.vue.d.ts +4 -4
  90. package/lib/components/tooltip/Tooltip.vue.js +1 -1
  91. package/lib/composables/index.d.ts +1 -0
  92. package/lib/composables/useInputtable.d.ts +26 -6
  93. package/lib/composables/useVirtualList.d.ts +48 -0
  94. package/lib/composables/useVirtualList.js +123 -0
  95. package/lib/index.js +35 -33
  96. package/lib/index.umd.js +4 -4
  97. package/lib/node_modules/.pnpm/@vueuse_core@10.2.0_vue@3.5.10_typescript@5.2.2_/node_modules/@vueuse/core/index.js +412 -0
  98. package/lib/version.d.ts +1 -1
  99. package/lib/version.js +1 -1
  100. package/package.json +3 -3
  101. package/src/components/select/Select.vue +56 -26
  102. package/src/components/select/theme/Select.base.theme.ts +1 -1
  103. package/src/components/table/Table.vue +158 -114
  104. package/src/components/table/TableHead.vue +6 -2
  105. package/src/components/table/TableHeader.vue +0 -1
  106. package/src/components/table/TableRow.vue +1 -0
  107. package/src/components/table/theme/TableHead.base.theme.ts +7 -1
  108. package/src/components/table/theme/TableHead.carbon.theme.ts +7 -1
  109. package/src/components/table/theme/TableHeader.base.theme.ts +0 -2
  110. package/src/components/table/theme/TableHeader.carbon.theme.ts +0 -2
  111. package/src/components/table/theme/TableRow.base.theme.ts +4 -0
  112. package/src/composables/index.ts +1 -0
  113. package/src/composables/useVirtualList.ts +286 -0
  114. package/src/version.ts +1 -1
  115. package/lib/node_modules/.pnpm/@vueuse_core@10.2.0_vue@3.3.9_typescript@5.2.2_/node_modules/@vueuse/core/index.js +0 -379
  116. /package/lib/node_modules/.pnpm/{@vuepic_vue-datepicker@8.3.2_vue@3.3.9_typescript@5.2.2_ → @vuepic_vue-datepicker@8.3.2_vue@3.5.10_typescript@5.2.2_}/node_modules/@vuepic/vue-datepicker/dist/main.css.js +0 -0
  117. /package/lib/node_modules/.pnpm/{@vuepic_vue-datepicker@8.3.2_vue@3.3.9_typescript@5.2.2_ → @vuepic_vue-datepicker@8.3.2_vue@3.5.10_typescript@5.2.2_}/node_modules/@vuepic/vue-datepicker/dist/vue-datepicker.js +0 -0
  118. /package/lib/node_modules/.pnpm/{@vueuse_shared@10.2.0_vue@3.3.9_typescript@5.2.2_ → @vueuse_shared@10.2.0_vue@3.5.10_typescript@5.2.2_}/node_modules/@vueuse/shared/index.js +0 -0
  119. /package/lib/node_modules/.pnpm/{floating-vue@5.2.2_@nuxt_kit@3.10.1_rollup@3.29.4__vue@3.3.9_typescript@5.2.2_ → floating-vue@5.2.2_@nuxt_kit@3.10.1_rollup@3.29.4__vue@3.5.10_typescript@5.2.2_}/node_modules/floating-vue/dist/floating-vue.js +0 -0
@@ -0,0 +1,286 @@
1
+ /**
2
+ * @file useVirtualList composable adapted from https://github.com/vueuse/vueuse/blob/main/packages/core/useVirtualList/index.ts
3
+ */
4
+ import { computed, ref, shallowRef, unref, watch } from 'vue'
5
+ import type { Ref, ShallowRef, StyleValue } from 'vue'
6
+ import type { MaybeRef } from '@vueuse/shared'
7
+ import { useElementSize } from '@vueuse/core'
8
+
9
+ type UseVirtualListItemSize = number | ((index: number) => number)
10
+
11
+ export type UseVirtualListOptions = {
12
+ /**
13
+ * item height, accept a pixel value or a function that returns the height
14
+ *
15
+ * @default 0
16
+ */
17
+ disabled?: boolean;
18
+ itemHeight: UseVirtualListItemSize;
19
+ topOffset: number;
20
+ bottomOffset: number;
21
+ /**
22
+ * the extra buffer items outside of the view area
23
+ *
24
+ * @default 5
25
+ */
26
+ overscan?: number;
27
+ }
28
+
29
+ export interface UseVirtualListItem<T> {
30
+ data: T;
31
+ index: number;
32
+ }
33
+
34
+ export interface UseVirtualListReturn<T> {
35
+ list: Ref<UseVirtualListItem<T>[]>;
36
+ scrollTo: (index: number) => void;
37
+ reset: () => void;
38
+
39
+ containerProps: {
40
+ ref: Ref<HTMLElement | null>;
41
+ style: StyleValue;
42
+ onScroll: () => void;
43
+ };
44
+ wrapperProps: MaybeRef<{
45
+ style?: {
46
+ width: string;
47
+ height: string;
48
+ marginTop: string;
49
+ } | {
50
+ width: string;
51
+ height: string;
52
+ marginLeft: string;
53
+ display: string;
54
+ };
55
+ }>;
56
+ }
57
+
58
+ export function useVirtualList<T = any>(list: MaybeRef<T[]>, options: UseVirtualListOptions): UseVirtualListReturn<T> {
59
+ if (options.disabled) {
60
+ return {
61
+ list: computed(() => unref(list).map((data, index) => ({ data, index }))),
62
+ scrollTo: () => {},
63
+ reset: () => {},
64
+ containerProps: {
65
+ ref: ref(null),
66
+ style: {},
67
+ onScroll: () => {},
68
+ },
69
+ wrapperProps: {},
70
+ }
71
+ }
72
+
73
+ const { containerStyle, wrapperProps, scrollTo, calculateRange, currentList, containerRef } = useVerticalVirtualList(options, list)
74
+
75
+ return {
76
+ list: currentList,
77
+ scrollTo,
78
+ reset: calculateRange,
79
+ containerProps: {
80
+ ref: containerRef,
81
+ onScroll: () => {
82
+ calculateRange()
83
+ },
84
+ style: containerStyle,
85
+ },
86
+ wrapperProps,
87
+ }
88
+ }
89
+
90
+ type UseVirtualListContainerRef = Ref<HTMLElement | null>
91
+
92
+ interface UseVirtualElementSizes {
93
+ width: Ref<number>;
94
+ height: Ref<number>;
95
+ }
96
+
97
+ type UseVirtualListArray<T> = UseVirtualListItem<T>[]
98
+ type UseVirtualListRefArray<T> = Ref<UseVirtualListArray<T>>
99
+
100
+ type UseVirtualListSource<T> = Ref<T[]> | ShallowRef<T[]>
101
+
102
+ interface UseVirtualListState { start: number; end: number; }
103
+
104
+ type RefState = Ref<UseVirtualListState>
105
+
106
+ interface UseVirtualListResources<T> {
107
+ state: RefState;
108
+ source: UseVirtualListSource<T>;
109
+ currentList: UseVirtualListRefArray<T>;
110
+ size: UseVirtualElementSizes;
111
+ containerRef: UseVirtualListContainerRef;
112
+ }
113
+
114
+ function useVirtualListResources<T>(list: MaybeRef<T[]>): UseVirtualListResources<T> {
115
+ const containerRef = ref<HTMLElement | null>(null)
116
+ const size = useElementSize(containerRef)
117
+
118
+ const currentList: Ref<UseVirtualListItem<T>[]> = ref([])
119
+ const source = shallowRef(list)
120
+
121
+ const state: Ref<{ start: number; end: number; }> = ref({ start: 0, end: 10 })
122
+
123
+ return { state, source, currentList, size, containerRef }
124
+ }
125
+
126
+ function createGetViewCapacity<T>(state: UseVirtualListResources<T>['state'], source: UseVirtualListResources<T>['source'], itemSize: UseVirtualListItemSize) {
127
+ return (containerSize: number) => {
128
+ if (typeof itemSize === 'number')
129
+ return Math.ceil(containerSize / itemSize)
130
+
131
+ const { start = 0 } = state.value
132
+ let sum = 0
133
+ let capacity = 0
134
+
135
+ for (let i = start; i < source.value.length; i++) {
136
+ const size = itemSize(i)
137
+
138
+ sum += size
139
+ capacity = i
140
+ if (sum > containerSize)
141
+ break
142
+ }
143
+
144
+ return capacity - start
145
+ }
146
+ }
147
+
148
+ function createGetOffset<T>(source: UseVirtualListResources<T>['source'], itemSize: UseVirtualListItemSize) {
149
+ return (scrollDirection: number) => {
150
+ if (typeof itemSize === 'number')
151
+ return Math.floor(scrollDirection / itemSize) + 1
152
+
153
+ let sum = 0
154
+ let offset = 0
155
+
156
+ for (let i = 0; i < source.value.length; i++) {
157
+ const size = itemSize(i)
158
+
159
+ sum += size
160
+ if (sum >= scrollDirection) {
161
+ offset = i
162
+ break
163
+ }
164
+ }
165
+
166
+ return offset + 1
167
+ }
168
+ }
169
+
170
+ function createCalculateRange<T>(type: 'horizontal' | 'vertical', overscan: number, getOffset: ReturnType<typeof createGetOffset>, getViewCapacity: ReturnType<typeof createGetViewCapacity>, { containerRef, state, currentList, source }: UseVirtualListResources<T>) {
171
+ return () => {
172
+ const element = containerRef.value
173
+
174
+ if (element) {
175
+ const offset = getOffset(type === 'vertical' ? element.scrollTop : element.scrollLeft)
176
+ const viewCapacity = getViewCapacity(type === 'vertical' ? element.clientHeight : element.clientWidth)
177
+
178
+ const from = offset - overscan
179
+ const to = offset + viewCapacity + overscan
180
+
181
+ state.value = {
182
+ start: from < 0 ? 0 : from,
183
+ end: to > source.value.length
184
+ ? source.value.length
185
+ : to,
186
+ }
187
+ currentList.value = source.value
188
+ .slice(state.value.start, state.value.end)
189
+ .map((ele, index) => ({
190
+ data: ele,
191
+ index: index + state.value.start,
192
+ }))
193
+ }
194
+ }
195
+ }
196
+
197
+ function createGetDistance<T>(itemSize: UseVirtualListItemSize, source: UseVirtualListResources<T>['source']) {
198
+ return (index: number) => {
199
+ if (typeof itemSize === 'number') {
200
+ const size = index * itemSize
201
+
202
+ return size
203
+ }
204
+
205
+ const size = source.value
206
+ .slice(0, index)
207
+ .reduce((sum, _, i) => sum + itemSize(i), 0)
208
+
209
+ return size
210
+ }
211
+ }
212
+
213
+ function useWatchForSizes<T>(size: UseVirtualElementSizes, list: MaybeRef<T[]>, containerRef: Ref<HTMLElement | null>, calculateRange: () => void, scrollTo: (index: number) => void) {
214
+ watch([size.width, size.height, list, containerRef], () => {
215
+ calculateRange()
216
+ scrollTo(0)
217
+ })
218
+ }
219
+
220
+ function createComputedTotalSize<T>(itemSize: UseVirtualListItemSize, source: UseVirtualListResources<T>['source']) {
221
+ return computed(() => {
222
+ if (typeof itemSize === 'number')
223
+ return source.value.length * itemSize
224
+
225
+ return source.value.reduce((sum, _, index) => sum + itemSize(index), 0)
226
+ })
227
+ }
228
+
229
+ const scrollToDictionaryForElementScrollKey = {
230
+ horizontal: 'scrollLeft',
231
+ vertical: 'scrollTop',
232
+ } as const
233
+
234
+ function createScrollTo<T>(type: 'horizontal' | 'vertical', calculateRange: () => void, getDistance: ReturnType<typeof createGetDistance>, containerRef: UseVirtualListResources<T>['containerRef']) {
235
+ return (index: number) => {
236
+ if (containerRef.value) {
237
+ containerRef.value[scrollToDictionaryForElementScrollKey[type]] = getDistance(index)
238
+ calculateRange()
239
+ }
240
+ }
241
+ }
242
+
243
+ function useVerticalVirtualList<T>(options: UseVirtualListOptions, list: MaybeRef<T[]>) {
244
+ const resources = useVirtualListResources(list)
245
+
246
+ const { state, source, currentList, size, containerRef } = resources
247
+
248
+ const containerStyle: StyleValue = { overflowY: 'auto' }
249
+
250
+ const { itemHeight, topOffset = 0, bottomOffset = 0, overscan = 5 } = options
251
+
252
+ const getViewCapacity = createGetViewCapacity(state, source, itemHeight)
253
+
254
+ const getOffset = createGetOffset(source, itemHeight)
255
+
256
+ const calculateRange = createCalculateRange('vertical', overscan, getOffset, getViewCapacity, resources)
257
+
258
+ const getDistanceTop = createGetDistance(itemHeight, source)
259
+
260
+ const offsetTop = computed(() => getDistanceTop(state.value.start))
261
+
262
+ const totalHeight = createComputedTotalSize(itemHeight, source)
263
+
264
+ const scrollTo = createScrollTo('vertical', calculateRange, getDistanceTop, containerRef)
265
+
266
+ useWatchForSizes(size, list, containerRef, calculateRange, scrollTo)
267
+
268
+ const wrapperProps = computed(() => {
269
+ return {
270
+ style: {
271
+ width: '100%',
272
+ height: `${totalHeight.value - offsetTop.value + topOffset + bottomOffset}px`,
273
+ marginTop: `${offsetTop.value}px`,
274
+ },
275
+ }
276
+ })
277
+
278
+ return {
279
+ calculateRange,
280
+ scrollTo,
281
+ containerStyle,
282
+ wrapperProps,
283
+ currentList,
284
+ containerRef,
285
+ }
286
+ }
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export default '1.8.4'
1
+ export default '1.9.1'
@@ -1,379 +0,0 @@
1
- import { noop as j, toValue as L, tryOnScopeDispose as k, isIOS as G, useThrottleFn as Q, isClient as N, increaseWithUnit as U, toRef as J, useDebounceFn as K } from "../../../../@vueuse_shared@10.2.0_vue@3.3.9_typescript@5.2.2_/node_modules/@vueuse/shared/index.js";
2
- import { createFilterWrapper as Oe, debounceFilter as ge, throttleFilter as Se } from "../../../../@vueuse_shared@10.2.0_vue@3.3.9_typescript@5.2.2_/node_modules/@vueuse/shared/index.js";
3
- import { watch as F, computed as g, ref as T, reactive as D, watchEffect as Z, getCurrentInstance as ee, onMounted as te } from "vue";
4
- function _(e) {
5
- var o;
6
- const r = L(e);
7
- return (o = r == null ? void 0 : r.$el) != null ? o : r;
8
- }
9
- const P = N ? window : void 0;
10
- function S(...e) {
11
- let o, r, n, s;
12
- if (typeof e[0] == "string" || Array.isArray(e[0]) ? ([r, n, s] = e, o = P) : [o, r, n, s] = e, !o)
13
- return j;
14
- Array.isArray(r) || (r = [r]), Array.isArray(n) || (n = [n]);
15
- const v = [], u = () => {
16
- v.forEach((p) => p()), v.length = 0;
17
- }, t = (p, m, l, a) => (p.addEventListener(m, l, a), () => p.removeEventListener(m, l, a)), i = F(
18
- () => [_(o), L(s)],
19
- ([p, m]) => {
20
- u(), p && v.push(
21
- ...r.flatMap((l) => n.map((a) => t(p, l, a, m)))
22
- );
23
- },
24
- { immediate: !0, flush: "post" }
25
- ), d = () => {
26
- i(), u();
27
- };
28
- return k(d), d;
29
- }
30
- let X = !1;
31
- function de(e, o, r = {}) {
32
- const { window: n = P, ignore: s = [], capture: v = !0, detectIframe: u = !1 } = r;
33
- if (!n)
34
- return;
35
- G && !X && (X = !0, Array.from(n.document.body.children).forEach((l) => l.addEventListener("click", j)));
36
- let t = !0;
37
- const i = (l) => s.some((a) => {
38
- if (typeof a == "string")
39
- return Array.from(n.document.querySelectorAll(a)).some((h) => h === l.target || l.composedPath().includes(h));
40
- {
41
- const h = _(a);
42
- return h && (l.target === h || l.composedPath().includes(h));
43
- }
44
- }), p = [
45
- S(n, "click", (l) => {
46
- const a = _(e);
47
- if (!(!a || a === l.target || l.composedPath().includes(a))) {
48
- if (l.detail === 0 && (t = !i(l)), !t) {
49
- t = !0;
50
- return;
51
- }
52
- o(l);
53
- }
54
- }, { passive: !0, capture: v }),
55
- S(n, "pointerdown", (l) => {
56
- const a = _(e);
57
- a && (t = !l.composedPath().includes(a) && !i(l));
58
- }, { passive: !0 }),
59
- u && S(n, "blur", (l) => {
60
- setTimeout(() => {
61
- var a;
62
- const h = _(e);
63
- ((a = n.document.activeElement) == null ? void 0 : a.tagName) === "IFRAME" && !(h != null && h.contains(n.document.activeElement)) && o(l);
64
- }, 0);
65
- })
66
- ].filter(Boolean);
67
- return () => p.forEach((l) => l());
68
- }
69
- function ne() {
70
- const e = T(!1);
71
- return ee() && te(() => {
72
- e.value = !0;
73
- }), e;
74
- }
75
- function q(e) {
76
- const o = ne();
77
- return g(() => (o.value, !!e()));
78
- }
79
- function W(e, o = {}) {
80
- const { window: r = P } = o, n = q(() => r && "matchMedia" in r && typeof r.matchMedia == "function");
81
- let s;
82
- const v = T(!1), u = () => {
83
- s && ("removeEventListener" in s ? s.removeEventListener("change", t) : s.removeListener(t));
84
- }, t = () => {
85
- n.value && (u(), s = r.matchMedia(J(e).value), v.value = !!(s != null && s.matches), s && ("addEventListener" in s ? s.addEventListener("change", t) : s.addListener(t)));
86
- };
87
- return Z(t), k(() => u()), v;
88
- }
89
- const pe = {
90
- sm: 640,
91
- md: 768,
92
- lg: 1024,
93
- xl: 1280,
94
- "2xl": 1536
95
- };
96
- function ve(e, o = {}) {
97
- function r(t, i) {
98
- let d = e[t];
99
- return i != null && (d = U(d, i)), typeof d == "number" && (d = `${d}px`), d;
100
- }
101
- const { window: n = P } = o;
102
- function s(t) {
103
- return n ? n.matchMedia(t).matches : !1;
104
- }
105
- const v = (t) => W(`(min-width: ${r(t)})`, o), u = Object.keys(e).reduce((t, i) => (Object.defineProperty(t, i, {
106
- get: () => v(i),
107
- enumerable: !0,
108
- configurable: !0
109
- }), t), {});
110
- return Object.assign(u, {
111
- greater(t) {
112
- return W(`(min-width: ${r(t, 0.1)})`, o);
113
- },
114
- greaterOrEqual: v,
115
- smaller(t) {
116
- return W(`(max-width: ${r(t, -0.1)})`, o);
117
- },
118
- smallerOrEqual(t) {
119
- return W(`(max-width: ${r(t)})`, o);
120
- },
121
- between(t, i) {
122
- return W(`(min-width: ${r(t)}) and (max-width: ${r(i, -0.1)})`, o);
123
- },
124
- isGreater(t) {
125
- return s(`(min-width: ${r(t, 0.1)})`);
126
- },
127
- isGreaterOrEqual(t) {
128
- return s(`(min-width: ${r(t)})`);
129
- },
130
- isSmaller(t) {
131
- return s(`(max-width: ${r(t, -0.1)})`);
132
- },
133
- isSmallerOrEqual(t) {
134
- return s(`(max-width: ${r(t)})`);
135
- },
136
- isInBetween(t, i) {
137
- return s(`(min-width: ${r(t)}) and (max-width: ${r(i, -0.1)})`);
138
- },
139
- current() {
140
- const t = Object.keys(e).map((i) => [i, v(i)]);
141
- return g(() => t.filter(([, i]) => i.value).map(([i]) => i));
142
- }
143
- });
144
- }
145
- var Y = Object.getOwnPropertySymbols, re = Object.prototype.hasOwnProperty, oe = Object.prototype.propertyIsEnumerable, se = (e, o) => {
146
- var r = {};
147
- for (var n in e)
148
- re.call(e, n) && o.indexOf(n) < 0 && (r[n] = e[n]);
149
- if (e != null && Y)
150
- for (var n of Y(e))
151
- o.indexOf(n) < 0 && oe.call(e, n) && (r[n] = e[n]);
152
- return r;
153
- };
154
- function me(e, o, r = {}) {
155
- const n = r, { window: s = P } = n, v = se(n, ["window"]);
156
- let u;
157
- const t = q(() => s && "MutationObserver" in s), i = () => {
158
- u && (u.disconnect(), u = void 0);
159
- }, d = F(
160
- () => _(e),
161
- (m) => {
162
- i(), t.value && s && m && (u = new MutationObserver(o), u.observe(m, v));
163
- },
164
- { immediate: !0 }
165
- ), p = () => {
166
- i(), d();
167
- };
168
- return k(p), {
169
- isSupported: t,
170
- stop: p
171
- };
172
- }
173
- var z = Object.getOwnPropertySymbols, ie = Object.prototype.hasOwnProperty, le = Object.prototype.propertyIsEnumerable, ae = (e, o) => {
174
- var r = {};
175
- for (var n in e)
176
- ie.call(e, n) && o.indexOf(n) < 0 && (r[n] = e[n]);
177
- if (e != null && z)
178
- for (var n of z(e))
179
- o.indexOf(n) < 0 && le.call(e, n) && (r[n] = e[n]);
180
- return r;
181
- };
182
- function he(e, o, r = {}) {
183
- const n = r, { window: s = P } = n, v = ae(n, ["window"]);
184
- let u;
185
- const t = q(() => s && "ResizeObserver" in s), i = () => {
186
- u && (u.disconnect(), u = void 0);
187
- }, d = g(
188
- () => Array.isArray(e) ? e.map((l) => _(l)) : [_(e)]
189
- ), p = F(
190
- d,
191
- (l) => {
192
- if (i(), t.value && s) {
193
- u = new ResizeObserver(o);
194
- for (const a of l)
195
- a && u.observe(a, v);
196
- }
197
- },
198
- { immediate: !0, flush: "post", deep: !0 }
199
- ), m = () => {
200
- i(), p();
201
- };
202
- return k(m), {
203
- isSupported: t,
204
- stop: m
205
- };
206
- }
207
- const V = 1;
208
- function be(e, o = {}) {
209
- const {
210
- throttle: r = 0,
211
- idle: n = 200,
212
- onStop: s = j,
213
- onScroll: v = j,
214
- offset: u = {
215
- left: 0,
216
- right: 0,
217
- top: 0,
218
- bottom: 0
219
- },
220
- eventListenerOptions: t = {
221
- capture: !1,
222
- passive: !0
223
- },
224
- behavior: i = "auto"
225
- } = o, d = T(0), p = T(0), m = g({
226
- get() {
227
- return d.value;
228
- },
229
- set(f) {
230
- a(f, void 0);
231
- }
232
- }), l = g({
233
- get() {
234
- return p.value;
235
- },
236
- set(f) {
237
- a(void 0, f);
238
- }
239
- });
240
- function a(f, y) {
241
- var x, A, c;
242
- const w = L(e);
243
- w && ((c = w instanceof Document ? document.body : w) == null || c.scrollTo({
244
- top: (x = L(y)) != null ? x : l.value,
245
- left: (A = L(f)) != null ? A : m.value,
246
- behavior: L(i)
247
- }));
248
- }
249
- const h = T(!1), b = D({
250
- left: !0,
251
- right: !1,
252
- top: !0,
253
- bottom: !1
254
- }), E = D({
255
- left: !1,
256
- right: !1,
257
- top: !1,
258
- bottom: !1
259
- }), I = (f) => {
260
- h.value && (h.value = !1, E.left = !1, E.right = !1, E.top = !1, E.bottom = !1, s(f));
261
- }, C = K(I, r + n), R = (f) => {
262
- const y = f === window ? f.document.documentElement : f === document ? f.documentElement : f, { display: x, flexDirection: A } = getComputedStyle(y), c = y.scrollLeft;
263
- E.left = c < d.value, E.right = c > d.value;
264
- const w = Math.abs(c) <= 0 + (u.left || 0), $ = Math.abs(c) + y.clientWidth >= y.scrollWidth - (u.right || 0) - V;
265
- x === "flex" && A === "row-reverse" ? (b.left = $, b.right = w) : (b.left = w, b.right = $), d.value = c;
266
- let M = y.scrollTop;
267
- f === document && !M && (M = document.body.scrollTop), E.top = M < p.value, E.bottom = M > p.value;
268
- const B = Math.abs(M) <= 0 + (u.top || 0), H = Math.abs(M) + y.clientHeight >= y.scrollHeight - (u.bottom || 0) - V;
269
- x === "flex" && A === "column-reverse" ? (b.top = H, b.bottom = B) : (b.top = B, b.bottom = H), p.value = M;
270
- }, O = (f) => {
271
- const y = f.target === document ? f.target.documentElement : f.target;
272
- R(y), h.value = !0, C(f), v(f);
273
- };
274
- return S(
275
- e,
276
- "scroll",
277
- r ? Q(O, r, !0, !1) : O,
278
- t
279
- ), S(
280
- e,
281
- "scrollend",
282
- I,
283
- t
284
- ), {
285
- x: m,
286
- y: l,
287
- isScrolling: h,
288
- arrivedState: b,
289
- directions: E,
290
- measure() {
291
- const f = L(e);
292
- f && R(f);
293
- }
294
- };
295
- }
296
- function we(e, o = {}) {
297
- const {
298
- threshold: r = 50,
299
- onSwipe: n,
300
- onSwipeEnd: s,
301
- onSwipeStart: v,
302
- passive: u = !0,
303
- window: t = P
304
- } = o, i = D({ x: 0, y: 0 }), d = D({ x: 0, y: 0 }), p = g(() => i.x - d.x), m = g(() => i.y - d.y), { max: l, abs: a } = Math, h = g(() => l(a(p.value), a(m.value)) >= r), b = T(!1), E = g(() => h.value ? a(p.value) > a(m.value) ? p.value > 0 ? "left" : "right" : m.value > 0 ? "up" : "down" : "none"), I = (c) => [c.touches[0].clientX, c.touches[0].clientY], C = (c, w) => {
305
- i.x = c, i.y = w;
306
- }, R = (c, w) => {
307
- d.x = c, d.y = w;
308
- };
309
- let O;
310
- const f = ue(t == null ? void 0 : t.document);
311
- u ? O = f ? { passive: !0 } : { capture: !1 } : O = f ? { passive: !1, capture: !0 } : { capture: !0 };
312
- const y = (c) => {
313
- b.value && (s == null || s(c, E.value)), b.value = !1;
314
- }, x = [
315
- S(e, "touchstart", (c) => {
316
- if (c.touches.length !== 1)
317
- return;
318
- O.capture && !O.passive && c.preventDefault();
319
- const [w, $] = I(c);
320
- C(w, $), R(w, $), v == null || v(c);
321
- }, O),
322
- S(e, "touchmove", (c) => {
323
- if (c.touches.length !== 1)
324
- return;
325
- const [w, $] = I(c);
326
- R(w, $), !b.value && h.value && (b.value = !0), b.value && (n == null || n(c));
327
- }, O),
328
- S(e, "touchend", y, O),
329
- S(e, "touchcancel", y, O)
330
- ];
331
- return {
332
- isPassiveEventSupported: f,
333
- isSwiping: b,
334
- direction: E,
335
- coordsStart: i,
336
- coordsEnd: d,
337
- lengthX: p,
338
- lengthY: m,
339
- stop: () => x.forEach((c) => c())
340
- };
341
- }
342
- function ue(e) {
343
- if (!e)
344
- return !1;
345
- let o = !1;
346
- const r = {
347
- get passive() {
348
- return o = !0, !1;
349
- }
350
- };
351
- return e.addEventListener("x", j, r), e.removeEventListener("x", j), o;
352
- }
353
- export {
354
- pe as breakpointsTailwind,
355
- Oe as createFilterWrapper,
356
- ge as debounceFilter,
357
- P as defaultWindow,
358
- U as increaseWithUnit,
359
- N as isClient,
360
- G as isIOS,
361
- j as noop,
362
- de as onClickOutside,
363
- Se as throttleFilter,
364
- J as toRef,
365
- L as toValue,
366
- k as tryOnScopeDispose,
367
- _ as unrefElement,
368
- ve as useBreakpoints,
369
- K as useDebounceFn,
370
- S as useEventListener,
371
- W as useMediaQuery,
372
- ne as useMounted,
373
- me as useMutationObserver,
374
- he as useResizeObserver,
375
- be as useScroll,
376
- q as useSupported,
377
- we as useSwipe,
378
- Q as useThrottleFn
379
- };