lew-ui 1.3.8 → 1.3.11

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/dist/lew.es.ts CHANGED
@@ -4,7 +4,7 @@ var __publicField = (obj, key, value) => {
4
4
  __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
5
5
  return value;
6
6
  };
7
- import { defineComponent, computed, openBlock, createElementBlock, normalizeClass, unref, normalizeStyle, renderSlot, onMounted, getCurrentInstance, onUnmounted, h, watch, ref, readonly, getCurrentScope, onScopeDispose, nextTick, shallowRef, reactive, createElementVNode, Fragment, renderList, toDisplayString, createCommentVNode, pushScopeId, popScopeId, resolveComponent, createBlock, withCtx, resolveDirective, withDirectives, createVNode, createTextVNode, isRef, vModelDynamic, withModifiers, vShow, Transition, vModelText, TransitionGroup, toRaw, mergeProps, toRefs, vModelCheckbox, isVNode, onActivated, Teleport, createApp } from "vue";
7
+ import { defineComponent, computed, openBlock, createElementBlock, normalizeClass, unref, normalizeStyle, renderSlot, onMounted, getCurrentInstance, onUnmounted, h, watch, ref, getCurrentScope, onScopeDispose, shallowRef, reactive, createElementVNode, Fragment, renderList, toDisplayString, createCommentVNode, pushScopeId, popScopeId, resolveComponent, createBlock, withCtx, resolveDirective, withDirectives, createVNode, createTextVNode, isRef, vModelDynamic, withModifiers, vShow, Transition, vModelText, TransitionGroup, nextTick, toRaw, mergeProps, toRefs, vModelCheckbox, isVNode, onActivated, Teleport, createApp } from "vue";
8
8
  function _mergeNamespaces(n, m) {
9
9
  m.forEach(function(e) {
10
10
  e && typeof e !== "string" && !Array.isArray(e) && Object.keys(e).forEach(function(k) {
@@ -1855,66 +1855,54 @@ const tabsProps = {
1855
1855
  default: "block"
1856
1856
  }
1857
1857
  };
1858
- var _a;
1859
- const isClient = typeof window !== "undefined";
1858
+ var _a$1;
1859
+ const isClient$1 = typeof window !== "undefined";
1860
1860
  const isDef = (val) => typeof val !== "undefined";
1861
1861
  const isFunction = (val) => typeof val === "function";
1862
- const isString = (val) => typeof val === "string";
1863
- const noop = () => {
1862
+ const noop$1 = () => {
1864
1863
  };
1865
- const isIOS = isClient && ((_a = window == null ? void 0 : window.navigator) == null ? void 0 : _a.userAgent) && /iP(ad|hone|od)/.test(window.navigator.userAgent);
1866
- function resolveUnref(r) {
1864
+ isClient$1 && ((_a$1 = window == null ? void 0 : window.navigator) == null ? void 0 : _a$1.userAgent) && /iP(ad|hone|od)/.test(window.navigator.userAgent);
1865
+ function resolveUnref$1(r) {
1867
1866
  return typeof r === "function" ? r() : unref(r);
1868
1867
  }
1869
- function createFilterWrapper(filter, fn2) {
1868
+ function createFilterWrapper$1(filter, fn2) {
1870
1869
  function wrapper(...args) {
1871
- return new Promise((resolve, reject) => {
1872
- Promise.resolve(filter(() => fn2.apply(this, args), { fn: fn2, thisArg: this, args })).then(resolve).catch(reject);
1873
- });
1870
+ filter(() => fn2.apply(this, args), { fn: fn2, thisArg: this, args });
1874
1871
  }
1875
1872
  return wrapper;
1876
1873
  }
1877
1874
  const bypassFilter = (invoke) => {
1878
1875
  return invoke();
1879
1876
  };
1880
- function debounceFilter(ms, options = {}) {
1877
+ function debounceFilter$1(ms, options = {}) {
1881
1878
  let timer2;
1882
1879
  let maxTimer;
1883
- let lastRejector = noop;
1884
- const _clearTimeout = (timer22) => {
1885
- clearTimeout(timer22);
1886
- lastRejector();
1887
- lastRejector = noop;
1888
- };
1889
1880
  const filter = (invoke) => {
1890
- const duration = resolveUnref(ms);
1891
- const maxDuration = resolveUnref(options.maxWait);
1881
+ const duration = resolveUnref$1(ms);
1882
+ const maxDuration = resolveUnref$1(options.maxWait);
1892
1883
  if (timer2)
1893
- _clearTimeout(timer2);
1884
+ clearTimeout(timer2);
1894
1885
  if (duration <= 0 || maxDuration !== void 0 && maxDuration <= 0) {
1895
1886
  if (maxTimer) {
1896
- _clearTimeout(maxTimer);
1887
+ clearTimeout(maxTimer);
1897
1888
  maxTimer = null;
1898
1889
  }
1899
- return Promise.resolve(invoke());
1890
+ return invoke();
1900
1891
  }
1901
- return new Promise((resolve, reject) => {
1902
- lastRejector = options.rejectOnCancel ? reject : resolve;
1903
- if (maxDuration && !maxTimer) {
1904
- maxTimer = setTimeout(() => {
1905
- if (timer2)
1906
- _clearTimeout(timer2);
1907
- maxTimer = null;
1908
- resolve(invoke());
1909
- }, maxDuration);
1910
- }
1911
- timer2 = setTimeout(() => {
1912
- if (maxTimer)
1913
- _clearTimeout(maxTimer);
1892
+ if (maxDuration && !maxTimer) {
1893
+ maxTimer = setTimeout(() => {
1894
+ if (timer2)
1895
+ clearTimeout(timer2);
1914
1896
  maxTimer = null;
1915
- resolve(invoke());
1916
- }, duration);
1917
- });
1897
+ invoke();
1898
+ }, maxDuration);
1899
+ }
1900
+ timer2 = setTimeout(() => {
1901
+ if (maxTimer)
1902
+ clearTimeout(maxTimer);
1903
+ maxTimer = null;
1904
+ invoke();
1905
+ }, duration);
1918
1906
  };
1919
1907
  return filter;
1920
1908
  }
@@ -1926,29 +1914,18 @@ function promiseTimeout(ms, throwOnTimeout = false, reason = "Timeout") {
1926
1914
  setTimeout(resolve, ms);
1927
1915
  });
1928
1916
  }
1929
- function identity(arg) {
1917
+ function identity$1(arg) {
1930
1918
  return arg;
1931
1919
  }
1932
- function tryOnScopeDispose(fn2) {
1920
+ function tryOnScopeDispose$1(fn2) {
1933
1921
  if (getCurrentScope()) {
1934
1922
  onScopeDispose(fn2);
1935
1923
  return true;
1936
1924
  }
1937
1925
  return false;
1938
1926
  }
1939
- function useDebounceFn(fn2, ms = 200, options = {}) {
1940
- return createFilterWrapper(debounceFilter(ms, options), fn2);
1941
- }
1942
- function resolveRef(r) {
1943
- return typeof r === "function" ? computed(r) : ref(r);
1944
- }
1945
- function tryOnMounted(fn2, sync = true) {
1946
- if (getCurrentInstance())
1947
- onMounted(fn2);
1948
- else if (sync)
1949
- fn2();
1950
- else
1951
- nextTick(fn2);
1927
+ function useDebounceFn$1(fn2, ms = 200, options = {}) {
1928
+ return createFilterWrapper$1(debounceFilter$1(ms, options), fn2);
1952
1929
  }
1953
1930
  function useTimeoutFn(cb, interval, options = {}) {
1954
1931
  const {
@@ -1973,16 +1950,16 @@ function useTimeoutFn(cb, interval, options = {}) {
1973
1950
  isPending.value = false;
1974
1951
  timer2 = null;
1975
1952
  cb(...args);
1976
- }, resolveUnref(interval));
1953
+ }, resolveUnref$1(interval));
1977
1954
  }
1978
1955
  if (immediate) {
1979
1956
  isPending.value = true;
1980
- if (isClient)
1957
+ if (isClient$1)
1981
1958
  start2();
1982
1959
  }
1983
- tryOnScopeDispose(stop);
1960
+ tryOnScopeDispose$1(stop);
1984
1961
  return {
1985
- isPending: readonly(isPending),
1962
+ isPending,
1986
1963
  start: start2,
1987
1964
  stop
1988
1965
  };
@@ -2032,7 +2009,7 @@ function watchWithFilter(source, cb, options = {}) {
2032
2009
  } = _a2, watchOptions = __objRest$5(_a2, [
2033
2010
  "eventFilter"
2034
2011
  ]);
2035
- return watch(source, createFilterWrapper(eventFilter, cb), watchOptions);
2012
+ return watch(source, createFilterWrapper$1(eventFilter, cb), watchOptions);
2036
2013
  }
2037
2014
  var __defProp$4 = Object.defineProperty;
2038
2015
  var __defProps$4 = Object.defineProperties;
@@ -2074,21 +2051,14 @@ function watchDebounced(source, cb, options = {}) {
2074
2051
  "maxWait"
2075
2052
  ]);
2076
2053
  return watchWithFilter(source, cb, __spreadProps$4(__spreadValues$4({}, watchOptions), {
2077
- eventFilter: debounceFilter(debounce2, { maxWait })
2054
+ eventFilter: debounceFilter$1(debounce2, { maxWait })
2078
2055
  }));
2079
2056
  }
2080
- function unrefElement$1(elRef) {
2081
- var _a2;
2082
- const plain = resolveUnref(elRef);
2083
- return (_a2 = plain == null ? void 0 : plain.$el) != null ? _a2 : plain;
2084
- }
2085
- const defaultWindow$1 = isClient ? window : void 0;
2086
2057
  function useAsyncState(promise, initialState, options) {
2087
2058
  const {
2088
2059
  immediate = true,
2089
2060
  delay = 0,
2090
- onError = noop,
2091
- onSuccess = noop,
2061
+ onError = noop$1,
2092
2062
  resetOnExecute = true,
2093
2063
  shallow = true,
2094
2064
  throwError
@@ -2110,7 +2080,6 @@ function useAsyncState(promise, initialState, options) {
2110
2080
  const data = await _promise;
2111
2081
  state.value = data;
2112
2082
  isReady.value = true;
2113
- onSuccess(data);
2114
2083
  } catch (e) {
2115
2084
  error2.value = e;
2116
2085
  onError(e);
@@ -2131,112 +2100,26 @@ function useAsyncState(promise, initialState, options) {
2131
2100
  execute
2132
2101
  };
2133
2102
  }
2134
- function useSupported(callback, sync = false) {
2135
- const isSupported = ref();
2136
- const update = () => isSupported.value = Boolean(callback());
2137
- update();
2138
- tryOnMounted(update, sync);
2139
- return isSupported;
2140
- }
2141
2103
  function cloneFnJSON(source) {
2142
2104
  return JSON.parse(JSON.stringify(source));
2143
2105
  }
2144
- const _global$1 = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
2145
- const globalKey$1 = "__vueuse_ssr_handlers__";
2146
- _global$1[globalKey$1] = _global$1[globalKey$1] || {};
2147
- _global$1[globalKey$1];
2148
- var __getOwnPropSymbols$g = Object.getOwnPropertySymbols;
2149
- var __hasOwnProp$g = Object.prototype.hasOwnProperty;
2150
- var __propIsEnum$g = Object.prototype.propertyIsEnumerable;
2151
- var __objRest$2 = (source, exclude) => {
2152
- var target = {};
2153
- for (var prop in source)
2154
- if (__hasOwnProp$g.call(source, prop) && exclude.indexOf(prop) < 0)
2155
- target[prop] = source[prop];
2156
- if (source != null && __getOwnPropSymbols$g)
2157
- for (var prop of __getOwnPropSymbols$g(source)) {
2158
- if (exclude.indexOf(prop) < 0 && __propIsEnum$g.call(source, prop))
2159
- target[prop] = source[prop];
2160
- }
2161
- return target;
2162
- };
2163
- function useResizeObserver(target, callback, options = {}) {
2164
- const _a2 = options, { window: window2 = defaultWindow$1 } = _a2, observerOptions = __objRest$2(_a2, ["window"]);
2165
- let observer;
2166
- const isSupported = useSupported(() => window2 && "ResizeObserver" in window2);
2167
- const cleanup = () => {
2168
- if (observer) {
2169
- observer.disconnect();
2170
- observer = void 0;
2171
- }
2172
- };
2173
- const stopWatch = watch(() => unrefElement$1(target), (el) => {
2174
- cleanup();
2175
- if (isSupported.value && window2 && el) {
2176
- observer = new ResizeObserver(callback);
2177
- observer.observe(el, observerOptions);
2178
- }
2179
- }, { immediate: true, flush: "post" });
2180
- const stop = () => {
2181
- cleanup();
2182
- stopWatch();
2183
- };
2184
- tryOnScopeDispose(stop);
2185
- return {
2186
- isSupported,
2187
- stop
2188
- };
2189
- }
2190
- function useElementSize(target, initialSize = { width: 0, height: 0 }, options = {}) {
2191
- const { window: window2 = defaultWindow$1, box = "content-box" } = options;
2192
- const isSVG = computed(() => {
2193
- var _a2, _b;
2194
- return (_b = (_a2 = unrefElement$1(target)) == null ? void 0 : _a2.namespaceURI) == null ? void 0 : _b.includes("svg");
2195
- });
2196
- const width = ref(initialSize.width);
2197
- const height = ref(initialSize.height);
2198
- useResizeObserver(target, ([entry]) => {
2199
- const boxSize = box === "border-box" ? entry.borderBoxSize : box === "content-box" ? entry.contentBoxSize : entry.devicePixelContentBoxSize;
2200
- if (window2 && isSVG.value) {
2201
- const $elem = unrefElement$1(target);
2202
- if ($elem) {
2203
- const styles = window2.getComputedStyle($elem);
2204
- width.value = parseFloat(styles.width);
2205
- height.value = parseFloat(styles.height);
2206
- }
2207
- } else {
2208
- if (boxSize) {
2209
- const formatBoxSize = Array.isArray(boxSize) ? boxSize : [boxSize];
2210
- width.value = formatBoxSize.reduce((acc, { inlineSize }) => acc + inlineSize, 0);
2211
- height.value = formatBoxSize.reduce((acc, { blockSize }) => acc + blockSize, 0);
2212
- } else {
2213
- width.value = entry.contentRect.width;
2214
- height.value = entry.contentRect.height;
2215
- }
2216
- }
2217
- }, options);
2218
- watch(() => unrefElement$1(target), (ele) => {
2219
- width.value = ele ? initialSize.width : 0;
2220
- height.value = ele ? initialSize.height : 0;
2221
- });
2222
- return {
2223
- width,
2224
- height
2225
- };
2226
- }
2227
- var __defProp$a = Object.defineProperty;
2228
- var __getOwnPropSymbols$b = Object.getOwnPropertySymbols;
2229
- var __hasOwnProp$b = Object.prototype.hasOwnProperty;
2230
- var __propIsEnum$b = Object.prototype.propertyIsEnumerable;
2231
- var __defNormalProp$a = (obj, key, value) => key in obj ? __defProp$a(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
2232
- var __spreadValues$a = (a, b) => {
2106
+ const _global$2 = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
2107
+ const globalKey$2 = "__vueuse_ssr_handlers__";
2108
+ _global$2[globalKey$2] = _global$2[globalKey$2] || {};
2109
+ _global$2[globalKey$2];
2110
+ var __defProp$9 = Object.defineProperty;
2111
+ var __getOwnPropSymbols$a$1 = Object.getOwnPropertySymbols;
2112
+ var __hasOwnProp$a$1 = Object.prototype.hasOwnProperty;
2113
+ var __propIsEnum$a$1 = Object.prototype.propertyIsEnumerable;
2114
+ var __defNormalProp$9 = (obj, key, value) => key in obj ? __defProp$9(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
2115
+ var __spreadValues$9 = (a, b) => {
2233
2116
  for (var prop in b || (b = {}))
2234
- if (__hasOwnProp$b.call(b, prop))
2235
- __defNormalProp$a(a, prop, b[prop]);
2236
- if (__getOwnPropSymbols$b)
2237
- for (var prop of __getOwnPropSymbols$b(b)) {
2238
- if (__propIsEnum$b.call(b, prop))
2239
- __defNormalProp$a(a, prop, b[prop]);
2117
+ if (__hasOwnProp$a$1.call(b, prop))
2118
+ __defNormalProp$9(a, prop, b[prop]);
2119
+ if (__getOwnPropSymbols$a$1)
2120
+ for (var prop of __getOwnPropSymbols$a$1(b)) {
2121
+ if (__propIsEnum$a$1.call(b, prop))
2122
+ __defNormalProp$9(a, prop, b[prop]);
2240
2123
  }
2241
2124
  return a;
2242
2125
  };
@@ -2254,37 +2137,37 @@ async function loadImage(options) {
2254
2137
  });
2255
2138
  }
2256
2139
  const useImage = (options, asyncStateOptions = {}) => {
2257
- const state = useAsyncState(() => loadImage(resolveUnref(options)), void 0, __spreadValues$a({
2140
+ const state = useAsyncState(() => loadImage(resolveUnref$1(options)), void 0, __spreadValues$9({
2258
2141
  resetOnExecute: true
2259
2142
  }, asyncStateOptions));
2260
- watch(() => resolveUnref(options), () => state.execute(asyncStateOptions.delay), { deep: true });
2143
+ watch(() => resolveUnref$1(options), () => state.execute(asyncStateOptions.delay), { deep: true });
2261
2144
  return state;
2262
2145
  };
2263
- var SwipeDirection;
2146
+ var SwipeDirection$1;
2264
2147
  (function(SwipeDirection2) {
2265
2148
  SwipeDirection2["UP"] = "UP";
2266
2149
  SwipeDirection2["RIGHT"] = "RIGHT";
2267
2150
  SwipeDirection2["DOWN"] = "DOWN";
2268
2151
  SwipeDirection2["LEFT"] = "LEFT";
2269
2152
  SwipeDirection2["NONE"] = "NONE";
2270
- })(SwipeDirection || (SwipeDirection = {}));
2271
- var __defProp$1 = Object.defineProperty;
2272
- var __getOwnPropSymbols$1 = Object.getOwnPropertySymbols;
2273
- var __hasOwnProp$1 = Object.prototype.hasOwnProperty;
2274
- var __propIsEnum$1 = Object.prototype.propertyIsEnumerable;
2275
- var __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$1(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
2276
- var __spreadValues$1 = (a, b) => {
2153
+ })(SwipeDirection$1 || (SwipeDirection$1 = {}));
2154
+ var __defProp$2 = Object.defineProperty;
2155
+ var __getOwnPropSymbols$2 = Object.getOwnPropertySymbols;
2156
+ var __hasOwnProp$2 = Object.prototype.hasOwnProperty;
2157
+ var __propIsEnum$2 = Object.prototype.propertyIsEnumerable;
2158
+ var __defNormalProp$2 = (obj, key, value) => key in obj ? __defProp$2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
2159
+ var __spreadValues$2 = (a, b) => {
2277
2160
  for (var prop in b || (b = {}))
2278
- if (__hasOwnProp$1.call(b, prop))
2279
- __defNormalProp$1(a, prop, b[prop]);
2280
- if (__getOwnPropSymbols$1)
2281
- for (var prop of __getOwnPropSymbols$1(b)) {
2282
- if (__propIsEnum$1.call(b, prop))
2283
- __defNormalProp$1(a, prop, b[prop]);
2161
+ if (__hasOwnProp$2.call(b, prop))
2162
+ __defNormalProp$2(a, prop, b[prop]);
2163
+ if (__getOwnPropSymbols$2)
2164
+ for (var prop of __getOwnPropSymbols$2(b)) {
2165
+ if (__propIsEnum$2.call(b, prop))
2166
+ __defNormalProp$2(a, prop, b[prop]);
2284
2167
  }
2285
2168
  return a;
2286
2169
  };
2287
- const _TransitionPresets = {
2170
+ const _TransitionPresets$1 = {
2288
2171
  easeInSine: [0.12, 0, 0.39, 0],
2289
2172
  easeOutSine: [0.61, 1, 0.88, 1],
2290
2173
  easeInOutSine: [0.37, 0, 0.63, 1],
@@ -2310,9 +2193,9 @@ const _TransitionPresets = {
2310
2193
  easeOutBack: [0.34, 1.56, 0.64, 1],
2311
2194
  easeInOutBack: [0.68, -0.6, 0.32, 1.6]
2312
2195
  };
2313
- __spreadValues$1({
2314
- linear: identity
2315
- }, _TransitionPresets);
2196
+ __spreadValues$2({
2197
+ linear: identity$1
2198
+ }, _TransitionPresets$1);
2316
2199
  function useVModel(props, key, emit, options = {}) {
2317
2200
  var _a2, _b, _c;
2318
2201
  const {
@@ -2359,200 +2242,27 @@ function useVModels(props, emit, options = {}) {
2359
2242
  ret[key] = useVModel(props, key, emit, options);
2360
2243
  return ret;
2361
2244
  }
2362
- function useVirtualList(list, options) {
2363
- const { containerStyle, wrapperProps, scrollTo, calculateRange, currentList, containerRef } = "itemHeight" in options ? useVerticalVirtualList(options, list) : useHorizontalVirtualList(options, list);
2364
- return {
2365
- list: currentList,
2366
- scrollTo,
2367
- containerProps: {
2368
- ref: containerRef,
2369
- onScroll: () => {
2370
- calculateRange();
2371
- },
2372
- style: containerStyle
2373
- },
2374
- wrapperProps
2375
- };
2376
- }
2377
- function useVirtualListResources(list) {
2378
- const containerRef = ref(null);
2379
- const size = useElementSize(containerRef);
2380
- const currentList = ref([]);
2381
- const source = shallowRef(list);
2382
- const state = ref({ start: 0, end: 10 });
2383
- return { state, source, currentList, size, containerRef };
2384
- }
2385
- function createGetViewCapacity(state, source, itemSize) {
2386
- return (containerSize) => {
2387
- if (typeof itemSize === "number")
2388
- return Math.ceil(containerSize / itemSize);
2389
- const { start: start2 = 0 } = state.value;
2390
- let sum = 0;
2391
- let capacity = 0;
2392
- for (let i = start2; i < source.value.length; i++) {
2393
- const size = itemSize(i);
2394
- sum += size;
2395
- capacity = i;
2396
- if (sum > containerSize)
2397
- break;
2398
- }
2399
- return capacity - start2;
2400
- };
2401
- }
2402
- function createGetOffset(source, itemSize) {
2403
- return (scrollDirection) => {
2404
- if (typeof itemSize === "number")
2405
- return Math.floor(scrollDirection / itemSize) + 1;
2406
- let sum = 0;
2407
- let offset2 = 0;
2408
- for (let i = 0; i < source.value.length; i++) {
2409
- const size = itemSize(i);
2410
- sum += size;
2411
- if (sum >= scrollDirection) {
2412
- offset2 = i;
2413
- break;
2414
- }
2415
- }
2416
- return offset2 + 1;
2417
- };
2418
- }
2419
- function createCalculateRange(type, overscan, getOffset, getViewCapacity, { containerRef, state, currentList, source }) {
2420
- return () => {
2421
- const element = containerRef.value;
2422
- if (element) {
2423
- const offset2 = getOffset(type === "vertical" ? element.scrollTop : element.scrollLeft);
2424
- const viewCapacity = getViewCapacity(type === "vertical" ? element.clientHeight : element.clientWidth);
2425
- const from = offset2 - overscan;
2426
- const to = offset2 + viewCapacity + overscan;
2427
- state.value = {
2428
- start: from < 0 ? 0 : from,
2429
- end: to > source.value.length ? source.value.length : to
2430
- };
2431
- currentList.value = source.value.slice(state.value.start, state.value.end).map((ele, index2) => ({
2432
- data: ele,
2433
- index: index2 + state.value.start
2434
- }));
2435
- }
2436
- };
2437
- }
2438
- function createGetDistance(itemSize, source) {
2439
- return (index2) => {
2440
- if (typeof itemSize === "number") {
2441
- const size2 = index2 * itemSize;
2442
- return size2;
2443
- }
2444
- const size = source.value.slice(0, index2).reduce((sum, _, i) => sum + itemSize(i), 0);
2445
- return size;
2446
- };
2447
- }
2448
- function useWatchForSizes(size, list, calculateRange) {
2449
- watch([size.width, size.height, list], () => {
2450
- calculateRange();
2451
- });
2452
- }
2453
- function createComputedTotalSize(itemSize, source) {
2454
- return computed(() => {
2455
- if (typeof itemSize === "number")
2456
- return source.value.length * itemSize;
2457
- return source.value.reduce((sum, _, index2) => sum + itemSize(index2), 0);
2458
- });
2459
- }
2460
- const scrollToDictionaryForElementScrollKey = {
2461
- horizontal: "scrollLeft",
2462
- vertical: "scrollTop"
2463
- };
2464
- function createScrollTo(type, calculateRange, getDistance, containerRef) {
2465
- return (index2) => {
2466
- if (containerRef.value) {
2467
- containerRef.value[scrollToDictionaryForElementScrollKey[type]] = getDistance(index2);
2468
- calculateRange();
2469
- }
2470
- };
2471
- }
2472
- function useHorizontalVirtualList(options, list) {
2473
- const resources = useVirtualListResources(list);
2474
- const { state, source, currentList, size, containerRef } = resources;
2475
- const containerStyle = { overflowX: "auto" };
2476
- const { itemWidth, overscan = 5 } = options;
2477
- const getViewCapacity = createGetViewCapacity(state, source, itemWidth);
2478
- const getOffset = createGetOffset(source, itemWidth);
2479
- const calculateRange = createCalculateRange("horizontal", overscan, getOffset, getViewCapacity, resources);
2480
- const getDistanceLeft = createGetDistance(itemWidth, source);
2481
- const offsetLeft = computed(() => getDistanceLeft(state.value.start));
2482
- const totalWidth = createComputedTotalSize(itemWidth, source);
2483
- useWatchForSizes(size, list, calculateRange);
2484
- const scrollTo = createScrollTo("horizontal", calculateRange, getDistanceLeft, containerRef);
2485
- const wrapperProps = computed(() => {
2486
- return {
2487
- style: {
2488
- height: "100%",
2489
- width: `${totalWidth.value - offsetLeft.value}px`,
2490
- marginLeft: `${offsetLeft.value}px`,
2491
- display: "flex"
2492
- }
2493
- };
2494
- });
2495
- return {
2496
- scrollTo,
2497
- calculateRange,
2498
- wrapperProps,
2499
- containerStyle,
2500
- currentList,
2501
- containerRef
2502
- };
2503
- }
2504
- function useVerticalVirtualList(options, list) {
2505
- const resources = useVirtualListResources(list);
2506
- const { state, source, currentList, size, containerRef } = resources;
2507
- const containerStyle = { overflowY: "auto" };
2508
- const { itemHeight, overscan = 5 } = options;
2509
- const getViewCapacity = createGetViewCapacity(state, source, itemHeight);
2510
- const getOffset = createGetOffset(source, itemHeight);
2511
- const calculateRange = createCalculateRange("vertical", overscan, getOffset, getViewCapacity, resources);
2512
- const getDistanceTop = createGetDistance(itemHeight, source);
2513
- const offsetTop = computed(() => getDistanceTop(state.value.start));
2514
- const totalHeight = createComputedTotalSize(itemHeight, source);
2515
- useWatchForSizes(size, list, calculateRange);
2516
- const scrollTo = createScrollTo("vertical", calculateRange, getDistanceTop, containerRef);
2517
- const wrapperProps = computed(() => {
2518
- return {
2519
- style: {
2520
- width: "100%",
2521
- height: `${totalHeight.value - offsetTop.value}px`,
2522
- marginTop: `${offsetTop.value}px`
2523
- }
2524
- };
2525
- });
2526
- return {
2527
- calculateRange,
2528
- scrollTo,
2529
- containerStyle,
2530
- wrapperProps,
2531
- currentList,
2532
- containerRef
2533
- };
2534
- }
2535
- var LewTabs_vue_vue_type_style_index_0_scoped_true_lang = "";
2536
- const _hoisted_1$v = ["onClick"];
2537
- const _sfc_main$B = /* @__PURE__ */ defineComponent({
2538
- __name: "LewTabs",
2539
- props: tabsProps,
2540
- emits: ["change", "update:modelValue"],
2541
- setup(__props, { emit }) {
2542
- const props = __props;
2543
- const tabsValue = useVModel(props, "modelValue", emit);
2544
- const tabsRef = ref();
2545
- const itemRef = ref([]);
2546
- const state = reactive({
2547
- activeItemStyle: {},
2548
- curIndex: props.options.findIndex((e) => tabsValue.value === e.value),
2549
- hidLine: "",
2550
- isInit: false
2551
- });
2552
- watch(
2553
- () => tabsValue.value,
2554
- (v) => {
2555
- selectItem(v, "watch");
2245
+ var LewTabs_vue_vue_type_style_index_0_scoped_true_lang = "";
2246
+ const _hoisted_1$v = ["onClick"];
2247
+ const _sfc_main$B = /* @__PURE__ */ defineComponent({
2248
+ __name: "LewTabs",
2249
+ props: tabsProps,
2250
+ emits: ["change", "update:modelValue"],
2251
+ setup(__props, { emit }) {
2252
+ const props = __props;
2253
+ const tabsValue = useVModel(props, "modelValue", emit);
2254
+ const tabsRef = ref();
2255
+ const itemRef = ref([]);
2256
+ const state = reactive({
2257
+ activeItemStyle: {},
2258
+ curIndex: props.options.findIndex((e) => tabsValue.value === e.value),
2259
+ hidLine: "",
2260
+ isInit: false
2261
+ });
2262
+ watch(
2263
+ () => tabsValue.value,
2264
+ (v) => {
2265
+ selectItem(v, "watch");
2556
2266
  }
2557
2267
  );
2558
2268
  const init = () => {
@@ -3083,10 +2793,10 @@ const _sfc_main$x = /* @__PURE__ */ defineComponent({
3083
2793
  }
3084
2794
  });
3085
2795
  const getInputClassNames = computed(() => {
3086
- const { size, readonly: readonly2, disabled, align, autoWidth } = props;
2796
+ const { size, readonly, disabled, align, autoWidth } = props;
3087
2797
  return object2class$1("lew-input-view", {
3088
2798
  size,
3089
- readonly: readonly2,
2799
+ readonly,
3090
2800
  disabled,
3091
2801
  align,
3092
2802
  autoWidth
@@ -3373,10 +3083,10 @@ const _sfc_main$w = /* @__PURE__ */ defineComponent({
3373
3083
  return false;
3374
3084
  });
3375
3085
  const getTextareaClassNames = computed(() => {
3376
- const { size, readonly: readonly2, disabled } = props;
3086
+ const { size, readonly, disabled } = props;
3377
3087
  return object2class$1("lew-textarea-view", {
3378
3088
  size,
3379
- readonly: readonly2,
3089
+ readonly,
3380
3090
  disabled
3381
3091
  });
3382
3092
  });
@@ -6204,57 +5914,1097 @@ const _sfc_main$p = /* @__PURE__ */ defineComponent({
6204
5914
  }
6205
5915
  });
6206
5916
  var LewRadioGroup = /* @__PURE__ */ _export_sfc(_sfc_main$p, [["__scopeId", "data-v-642e37a4"], ["__file", "/Users/kamtao/Documents/lew_worksplace/lew-ui/packages/components/radio/src/LewRadioGroup.vue"]]);
6207
- function unrefElement(elRef) {
6208
- var _a2;
6209
- const plain = resolveUnref(elRef);
6210
- return (_a2 = plain == null ? void 0 : plain.$el) != null ? _a2 : plain;
5917
+ var _a;
5918
+ const isClient = typeof window !== "undefined";
5919
+ const isString = (val) => typeof val === "string";
5920
+ const noop = () => {
5921
+ };
5922
+ const isIOS = isClient && ((_a = window == null ? void 0 : window.navigator) == null ? void 0 : _a.userAgent) && /iP(ad|hone|od)/.test(window.navigator.userAgent);
5923
+ function resolveUnref(r) {
5924
+ return typeof r === "function" ? r() : unref(r);
6211
5925
  }
6212
- const defaultWindow = isClient ? window : void 0;
6213
- function useEventListener(...args) {
6214
- let target;
6215
- let events;
6216
- let listeners;
6217
- let options;
6218
- if (isString(args[0]) || Array.isArray(args[0])) {
6219
- [events, listeners, options] = args;
6220
- target = defaultWindow;
6221
- } else {
6222
- [target, events, listeners, options] = args;
5926
+ function createFilterWrapper(filter, fn2) {
5927
+ function wrapper(...args) {
5928
+ return new Promise((resolve, reject) => {
5929
+ Promise.resolve(filter(() => fn2.apply(this, args), { fn: fn2, thisArg: this, args })).then(resolve).catch(reject);
5930
+ });
6223
5931
  }
6224
- if (!target)
6225
- return noop;
6226
- if (!Array.isArray(events))
6227
- events = [events];
6228
- if (!Array.isArray(listeners))
6229
- listeners = [listeners];
6230
- const cleanups = [];
6231
- const cleanup = () => {
6232
- cleanups.forEach((fn2) => fn2());
6233
- cleanups.length = 0;
5932
+ return wrapper;
5933
+ }
5934
+ function debounceFilter(ms, options = {}) {
5935
+ let timer2;
5936
+ let maxTimer;
5937
+ let lastRejector = noop;
5938
+ const _clearTimeout = (timer22) => {
5939
+ clearTimeout(timer22);
5940
+ lastRejector();
5941
+ lastRejector = noop;
6234
5942
  };
6235
- const register = (el, event, listener, options2) => {
6236
- el.addEventListener(event, listener, options2);
6237
- return () => el.removeEventListener(event, listener, options2);
5943
+ const filter = (invoke) => {
5944
+ const duration = resolveUnref(ms);
5945
+ const maxDuration = resolveUnref(options.maxWait);
5946
+ if (timer2)
5947
+ _clearTimeout(timer2);
5948
+ if (duration <= 0 || maxDuration !== void 0 && maxDuration <= 0) {
5949
+ if (maxTimer) {
5950
+ _clearTimeout(maxTimer);
5951
+ maxTimer = null;
5952
+ }
5953
+ return Promise.resolve(invoke());
5954
+ }
5955
+ return new Promise((resolve, reject) => {
5956
+ lastRejector = options.rejectOnCancel ? reject : resolve;
5957
+ if (maxDuration && !maxTimer) {
5958
+ maxTimer = setTimeout(() => {
5959
+ if (timer2)
5960
+ _clearTimeout(timer2);
5961
+ maxTimer = null;
5962
+ resolve(invoke());
5963
+ }, maxDuration);
5964
+ }
5965
+ timer2 = setTimeout(() => {
5966
+ if (maxTimer)
5967
+ _clearTimeout(maxTimer);
5968
+ maxTimer = null;
5969
+ resolve(invoke());
5970
+ }, duration);
5971
+ });
6238
5972
  };
6239
- const stopWatch = watch(() => [unrefElement(target), resolveUnref(options)], ([el, options2]) => {
6240
- cleanup();
6241
- if (!el)
6242
- return;
6243
- cleanups.push(...events.flatMap((event) => {
6244
- return listeners.map((listener) => register(el, event, listener, options2));
6245
- }));
6246
- }, { immediate: true, flush: "post" });
6247
- const stop = () => {
6248
- stopWatch();
6249
- cleanup();
5973
+ return filter;
5974
+ }
5975
+ function throttleFilter(ms, trailing = true, leading = true, rejectOnCancel = false) {
5976
+ let lastExec = 0;
5977
+ let timer2;
5978
+ let isLeading = true;
5979
+ let lastRejector = noop;
5980
+ let lastValue;
5981
+ const clear2 = () => {
5982
+ if (timer2) {
5983
+ clearTimeout(timer2);
5984
+ timer2 = void 0;
5985
+ lastRejector();
5986
+ lastRejector = noop;
5987
+ }
6250
5988
  };
6251
- tryOnScopeDispose(stop);
6252
- return stop;
5989
+ const filter = (_invoke) => {
5990
+ const duration = resolveUnref(ms);
5991
+ const elapsed = Date.now() - lastExec;
5992
+ const invoke = () => {
5993
+ return lastValue = _invoke();
5994
+ };
5995
+ clear2();
5996
+ if (duration <= 0) {
5997
+ lastExec = Date.now();
5998
+ return invoke();
5999
+ }
6000
+ if (elapsed > duration && (leading || !isLeading)) {
6001
+ lastExec = Date.now();
6002
+ invoke();
6003
+ } else if (trailing) {
6004
+ lastValue = new Promise((resolve, reject) => {
6005
+ lastRejector = rejectOnCancel ? reject : resolve;
6006
+ timer2 = setTimeout(() => {
6007
+ lastExec = Date.now();
6008
+ isLeading = true;
6009
+ resolve(invoke());
6010
+ clear2();
6011
+ }, Math.max(0, duration - elapsed));
6012
+ });
6013
+ }
6014
+ if (!leading && !timer2)
6015
+ timer2 = setTimeout(() => isLeading = true, duration);
6016
+ isLeading = false;
6017
+ return lastValue;
6018
+ };
6019
+ return filter;
6253
6020
  }
6254
- const _global = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
6255
- const globalKey = "__vueuse_ssr_handlers__";
6256
- _global[globalKey] = _global[globalKey] || {};
6257
- _global[globalKey];
6021
+ const directiveHooks = {
6022
+ mounted: "mounted",
6023
+ updated: "updated",
6024
+ unmounted: "unmounted"
6025
+ };
6026
+ function identity(arg) {
6027
+ return arg;
6028
+ }
6029
+ function tryOnScopeDispose(fn2) {
6030
+ if (getCurrentScope()) {
6031
+ onScopeDispose(fn2);
6032
+ return true;
6033
+ }
6034
+ return false;
6035
+ }
6036
+ function useDebounceFn(fn2, ms = 200, options = {}) {
6037
+ return createFilterWrapper(debounceFilter(ms, options), fn2);
6038
+ }
6039
+ function useThrottleFn(fn2, ms = 200, trailing = false, leading = true, rejectOnCancel = false) {
6040
+ return createFilterWrapper(throttleFilter(ms, trailing, leading, rejectOnCancel), fn2);
6041
+ }
6042
+ function resolveRef(r) {
6043
+ return typeof r === "function" ? computed(r) : ref(r);
6044
+ }
6045
+ function tryOnMounted(fn2, sync = true) {
6046
+ if (getCurrentInstance())
6047
+ onMounted(fn2);
6048
+ else if (sync)
6049
+ fn2();
6050
+ else
6051
+ nextTick(fn2);
6052
+ }
6053
+ function unrefElement$1(elRef) {
6054
+ var _a2;
6055
+ const plain = resolveUnref(elRef);
6056
+ return (_a2 = plain == null ? void 0 : plain.$el) != null ? _a2 : plain;
6057
+ }
6058
+ const defaultWindow$1 = isClient ? window : void 0;
6059
+ function useSupported$1(callback, sync = false) {
6060
+ const isSupported = ref();
6061
+ const update = () => isSupported.value = Boolean(callback());
6062
+ update();
6063
+ tryOnMounted(update, sync);
6064
+ return isSupported;
6065
+ }
6066
+ const _global$1 = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
6067
+ const globalKey$1 = "__vueuse_ssr_handlers__";
6068
+ _global$1[globalKey$1] = _global$1[globalKey$1] || {};
6069
+ _global$1[globalKey$1];
6070
+ var __getOwnPropSymbols$g = Object.getOwnPropertySymbols;
6071
+ var __hasOwnProp$g = Object.prototype.hasOwnProperty;
6072
+ var __propIsEnum$g = Object.prototype.propertyIsEnumerable;
6073
+ var __objRest$2 = (source, exclude) => {
6074
+ var target = {};
6075
+ for (var prop in source)
6076
+ if (__hasOwnProp$g.call(source, prop) && exclude.indexOf(prop) < 0)
6077
+ target[prop] = source[prop];
6078
+ if (source != null && __getOwnPropSymbols$g)
6079
+ for (var prop of __getOwnPropSymbols$g(source)) {
6080
+ if (exclude.indexOf(prop) < 0 && __propIsEnum$g.call(source, prop))
6081
+ target[prop] = source[prop];
6082
+ }
6083
+ return target;
6084
+ };
6085
+ function useResizeObserver$1(target, callback, options = {}) {
6086
+ const _a2 = options, { window: window2 = defaultWindow$1 } = _a2, observerOptions = __objRest$2(_a2, ["window"]);
6087
+ let observer;
6088
+ const isSupported = useSupported$1(() => window2 && "ResizeObserver" in window2);
6089
+ const cleanup = () => {
6090
+ if (observer) {
6091
+ observer.disconnect();
6092
+ observer = void 0;
6093
+ }
6094
+ };
6095
+ const stopWatch = watch(() => unrefElement$1(target), (el) => {
6096
+ cleanup();
6097
+ if (isSupported.value && window2 && el) {
6098
+ observer = new ResizeObserver(callback);
6099
+ observer.observe(el, observerOptions);
6100
+ }
6101
+ }, { immediate: true, flush: "post" });
6102
+ const stop = () => {
6103
+ cleanup();
6104
+ stopWatch();
6105
+ };
6106
+ tryOnScopeDispose(stop);
6107
+ return {
6108
+ isSupported,
6109
+ stop
6110
+ };
6111
+ }
6112
+ function useElementSize$1(target, initialSize = { width: 0, height: 0 }, options = {}) {
6113
+ const { window: window2 = defaultWindow$1, box = "content-box" } = options;
6114
+ const isSVG = computed(() => {
6115
+ var _a2, _b;
6116
+ return (_b = (_a2 = unrefElement$1(target)) == null ? void 0 : _a2.namespaceURI) == null ? void 0 : _b.includes("svg");
6117
+ });
6118
+ const width = ref(initialSize.width);
6119
+ const height = ref(initialSize.height);
6120
+ useResizeObserver$1(target, ([entry]) => {
6121
+ const boxSize = box === "border-box" ? entry.borderBoxSize : box === "content-box" ? entry.contentBoxSize : entry.devicePixelContentBoxSize;
6122
+ if (window2 && isSVG.value) {
6123
+ const $elem = unrefElement$1(target);
6124
+ if ($elem) {
6125
+ const styles = window2.getComputedStyle($elem);
6126
+ width.value = parseFloat(styles.width);
6127
+ height.value = parseFloat(styles.height);
6128
+ }
6129
+ } else {
6130
+ if (boxSize) {
6131
+ const formatBoxSize = Array.isArray(boxSize) ? boxSize : [boxSize];
6132
+ width.value = formatBoxSize.reduce((acc, { inlineSize }) => acc + inlineSize, 0);
6133
+ height.value = formatBoxSize.reduce((acc, { blockSize }) => acc + blockSize, 0);
6134
+ } else {
6135
+ width.value = entry.contentRect.width;
6136
+ height.value = entry.contentRect.height;
6137
+ }
6138
+ }
6139
+ }, options);
6140
+ watch(() => unrefElement$1(target), (ele) => {
6141
+ width.value = ele ? initialSize.width : 0;
6142
+ height.value = ele ? initialSize.height : 0;
6143
+ });
6144
+ return {
6145
+ width,
6146
+ height
6147
+ };
6148
+ }
6149
+ var SwipeDirection;
6150
+ (function(SwipeDirection2) {
6151
+ SwipeDirection2["UP"] = "UP";
6152
+ SwipeDirection2["RIGHT"] = "RIGHT";
6153
+ SwipeDirection2["DOWN"] = "DOWN";
6154
+ SwipeDirection2["LEFT"] = "LEFT";
6155
+ SwipeDirection2["NONE"] = "NONE";
6156
+ })(SwipeDirection || (SwipeDirection = {}));
6157
+ var __defProp$1 = Object.defineProperty;
6158
+ var __getOwnPropSymbols$1 = Object.getOwnPropertySymbols;
6159
+ var __hasOwnProp$1 = Object.prototype.hasOwnProperty;
6160
+ var __propIsEnum$1 = Object.prototype.propertyIsEnumerable;
6161
+ var __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$1(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
6162
+ var __spreadValues$1 = (a, b) => {
6163
+ for (var prop in b || (b = {}))
6164
+ if (__hasOwnProp$1.call(b, prop))
6165
+ __defNormalProp$1(a, prop, b[prop]);
6166
+ if (__getOwnPropSymbols$1)
6167
+ for (var prop of __getOwnPropSymbols$1(b)) {
6168
+ if (__propIsEnum$1.call(b, prop))
6169
+ __defNormalProp$1(a, prop, b[prop]);
6170
+ }
6171
+ return a;
6172
+ };
6173
+ const _TransitionPresets = {
6174
+ easeInSine: [0.12, 0, 0.39, 0],
6175
+ easeOutSine: [0.61, 1, 0.88, 1],
6176
+ easeInOutSine: [0.37, 0, 0.63, 1],
6177
+ easeInQuad: [0.11, 0, 0.5, 0],
6178
+ easeOutQuad: [0.5, 1, 0.89, 1],
6179
+ easeInOutQuad: [0.45, 0, 0.55, 1],
6180
+ easeInCubic: [0.32, 0, 0.67, 0],
6181
+ easeOutCubic: [0.33, 1, 0.68, 1],
6182
+ easeInOutCubic: [0.65, 0, 0.35, 1],
6183
+ easeInQuart: [0.5, 0, 0.75, 0],
6184
+ easeOutQuart: [0.25, 1, 0.5, 1],
6185
+ easeInOutQuart: [0.76, 0, 0.24, 1],
6186
+ easeInQuint: [0.64, 0, 0.78, 0],
6187
+ easeOutQuint: [0.22, 1, 0.36, 1],
6188
+ easeInOutQuint: [0.83, 0, 0.17, 1],
6189
+ easeInExpo: [0.7, 0, 0.84, 0],
6190
+ easeOutExpo: [0.16, 1, 0.3, 1],
6191
+ easeInOutExpo: [0.87, 0, 0.13, 1],
6192
+ easeInCirc: [0.55, 0, 1, 0.45],
6193
+ easeOutCirc: [0, 0.55, 0.45, 1],
6194
+ easeInOutCirc: [0.85, 0, 0.15, 1],
6195
+ easeInBack: [0.36, 0, 0.66, -0.56],
6196
+ easeOutBack: [0.34, 1.56, 0.64, 1],
6197
+ easeInOutBack: [0.68, -0.6, 0.32, 1.6]
6198
+ };
6199
+ __spreadValues$1({
6200
+ linear: identity
6201
+ }, _TransitionPresets);
6202
+ function useVirtualList(list, options) {
6203
+ const { containerStyle, wrapperProps, scrollTo, calculateRange, currentList, containerRef } = "itemHeight" in options ? useVerticalVirtualList(options, list) : useHorizontalVirtualList(options, list);
6204
+ return {
6205
+ list: currentList,
6206
+ scrollTo,
6207
+ containerProps: {
6208
+ ref: containerRef,
6209
+ onScroll: () => {
6210
+ calculateRange();
6211
+ },
6212
+ style: containerStyle
6213
+ },
6214
+ wrapperProps
6215
+ };
6216
+ }
6217
+ function useVirtualListResources(list) {
6218
+ const containerRef = ref(null);
6219
+ const size = useElementSize$1(containerRef);
6220
+ const currentList = ref([]);
6221
+ const source = shallowRef(list);
6222
+ const state = ref({ start: 0, end: 10 });
6223
+ return { state, source, currentList, size, containerRef };
6224
+ }
6225
+ function createGetViewCapacity(state, source, itemSize) {
6226
+ return (containerSize) => {
6227
+ if (typeof itemSize === "number")
6228
+ return Math.ceil(containerSize / itemSize);
6229
+ const { start: start2 = 0 } = state.value;
6230
+ let sum = 0;
6231
+ let capacity = 0;
6232
+ for (let i = start2; i < source.value.length; i++) {
6233
+ const size = itemSize(i);
6234
+ sum += size;
6235
+ capacity = i;
6236
+ if (sum > containerSize)
6237
+ break;
6238
+ }
6239
+ return capacity - start2;
6240
+ };
6241
+ }
6242
+ function createGetOffset(source, itemSize) {
6243
+ return (scrollDirection) => {
6244
+ if (typeof itemSize === "number")
6245
+ return Math.floor(scrollDirection / itemSize) + 1;
6246
+ let sum = 0;
6247
+ let offset2 = 0;
6248
+ for (let i = 0; i < source.value.length; i++) {
6249
+ const size = itemSize(i);
6250
+ sum += size;
6251
+ if (sum >= scrollDirection) {
6252
+ offset2 = i;
6253
+ break;
6254
+ }
6255
+ }
6256
+ return offset2 + 1;
6257
+ };
6258
+ }
6259
+ function createCalculateRange(type, overscan, getOffset, getViewCapacity, { containerRef, state, currentList, source }) {
6260
+ return () => {
6261
+ const element = containerRef.value;
6262
+ if (element) {
6263
+ const offset2 = getOffset(type === "vertical" ? element.scrollTop : element.scrollLeft);
6264
+ const viewCapacity = getViewCapacity(type === "vertical" ? element.clientHeight : element.clientWidth);
6265
+ const from = offset2 - overscan;
6266
+ const to = offset2 + viewCapacity + overscan;
6267
+ state.value = {
6268
+ start: from < 0 ? 0 : from,
6269
+ end: to > source.value.length ? source.value.length : to
6270
+ };
6271
+ currentList.value = source.value.slice(state.value.start, state.value.end).map((ele, index2) => ({
6272
+ data: ele,
6273
+ index: index2 + state.value.start
6274
+ }));
6275
+ }
6276
+ };
6277
+ }
6278
+ function createGetDistance(itemSize, source) {
6279
+ return (index2) => {
6280
+ if (typeof itemSize === "number") {
6281
+ const size2 = index2 * itemSize;
6282
+ return size2;
6283
+ }
6284
+ const size = source.value.slice(0, index2).reduce((sum, _, i) => sum + itemSize(i), 0);
6285
+ return size;
6286
+ };
6287
+ }
6288
+ function useWatchForSizes(size, list, calculateRange) {
6289
+ watch([size.width, size.height, list], () => {
6290
+ calculateRange();
6291
+ });
6292
+ }
6293
+ function createComputedTotalSize(itemSize, source) {
6294
+ return computed(() => {
6295
+ if (typeof itemSize === "number")
6296
+ return source.value.length * itemSize;
6297
+ return source.value.reduce((sum, _, index2) => sum + itemSize(index2), 0);
6298
+ });
6299
+ }
6300
+ const scrollToDictionaryForElementScrollKey = {
6301
+ horizontal: "scrollLeft",
6302
+ vertical: "scrollTop"
6303
+ };
6304
+ function createScrollTo(type, calculateRange, getDistance, containerRef) {
6305
+ return (index2) => {
6306
+ if (containerRef.value) {
6307
+ containerRef.value[scrollToDictionaryForElementScrollKey[type]] = getDistance(index2);
6308
+ calculateRange();
6309
+ }
6310
+ };
6311
+ }
6312
+ function useHorizontalVirtualList(options, list) {
6313
+ const resources = useVirtualListResources(list);
6314
+ const { state, source, currentList, size, containerRef } = resources;
6315
+ const containerStyle = { overflowX: "auto" };
6316
+ const { itemWidth, overscan = 5 } = options;
6317
+ const getViewCapacity = createGetViewCapacity(state, source, itemWidth);
6318
+ const getOffset = createGetOffset(source, itemWidth);
6319
+ const calculateRange = createCalculateRange("horizontal", overscan, getOffset, getViewCapacity, resources);
6320
+ const getDistanceLeft = createGetDistance(itemWidth, source);
6321
+ const offsetLeft = computed(() => getDistanceLeft(state.value.start));
6322
+ const totalWidth = createComputedTotalSize(itemWidth, source);
6323
+ useWatchForSizes(size, list, calculateRange);
6324
+ const scrollTo = createScrollTo("horizontal", calculateRange, getDistanceLeft, containerRef);
6325
+ const wrapperProps = computed(() => {
6326
+ return {
6327
+ style: {
6328
+ height: "100%",
6329
+ width: `${totalWidth.value - offsetLeft.value}px`,
6330
+ marginLeft: `${offsetLeft.value}px`,
6331
+ display: "flex"
6332
+ }
6333
+ };
6334
+ });
6335
+ return {
6336
+ scrollTo,
6337
+ calculateRange,
6338
+ wrapperProps,
6339
+ containerStyle,
6340
+ currentList,
6341
+ containerRef
6342
+ };
6343
+ }
6344
+ function useVerticalVirtualList(options, list) {
6345
+ const resources = useVirtualListResources(list);
6346
+ const { state, source, currentList, size, containerRef } = resources;
6347
+ const containerStyle = { overflowY: "auto" };
6348
+ const { itemHeight, overscan = 5 } = options;
6349
+ const getViewCapacity = createGetViewCapacity(state, source, itemHeight);
6350
+ const getOffset = createGetOffset(source, itemHeight);
6351
+ const calculateRange = createCalculateRange("vertical", overscan, getOffset, getViewCapacity, resources);
6352
+ const getDistanceTop = createGetDistance(itemHeight, source);
6353
+ const offsetTop = computed(() => getDistanceTop(state.value.start));
6354
+ const totalHeight = createComputedTotalSize(itemHeight, source);
6355
+ useWatchForSizes(size, list, calculateRange);
6356
+ const scrollTo = createScrollTo("vertical", calculateRange, getDistanceTop, containerRef);
6357
+ const wrapperProps = computed(() => {
6358
+ return {
6359
+ style: {
6360
+ width: "100%",
6361
+ height: `${totalHeight.value - offsetTop.value}px`,
6362
+ marginTop: `${offsetTop.value}px`
6363
+ }
6364
+ };
6365
+ });
6366
+ return {
6367
+ calculateRange,
6368
+ scrollTo,
6369
+ containerStyle,
6370
+ wrapperProps,
6371
+ currentList,
6372
+ containerRef
6373
+ };
6374
+ }
6375
+ function unrefElement(elRef) {
6376
+ var _a2;
6377
+ const plain = resolveUnref(elRef);
6378
+ return (_a2 = plain == null ? void 0 : plain.$el) != null ? _a2 : plain;
6379
+ }
6380
+ const defaultWindow = isClient ? window : void 0;
6381
+ function useEventListener(...args) {
6382
+ let target;
6383
+ let events;
6384
+ let listeners;
6385
+ let options;
6386
+ if (isString(args[0]) || Array.isArray(args[0])) {
6387
+ [events, listeners, options] = args;
6388
+ target = defaultWindow;
6389
+ } else {
6390
+ [target, events, listeners, options] = args;
6391
+ }
6392
+ if (!target)
6393
+ return noop;
6394
+ if (!Array.isArray(events))
6395
+ events = [events];
6396
+ if (!Array.isArray(listeners))
6397
+ listeners = [listeners];
6398
+ const cleanups = [];
6399
+ const cleanup = () => {
6400
+ cleanups.forEach((fn2) => fn2());
6401
+ cleanups.length = 0;
6402
+ };
6403
+ const register = (el, event, listener, options2) => {
6404
+ el.addEventListener(event, listener, options2);
6405
+ return () => el.removeEventListener(event, listener, options2);
6406
+ };
6407
+ const stopWatch = watch(() => [unrefElement(target), resolveUnref(options)], ([el, options2]) => {
6408
+ cleanup();
6409
+ if (!el)
6410
+ return;
6411
+ cleanups.push(...events.flatMap((event) => {
6412
+ return listeners.map((listener) => register(el, event, listener, options2));
6413
+ }));
6414
+ }, { immediate: true, flush: "post" });
6415
+ const stop = () => {
6416
+ stopWatch();
6417
+ cleanup();
6418
+ };
6419
+ tryOnScopeDispose(stop);
6420
+ return stop;
6421
+ }
6422
+ let _iOSWorkaround = false;
6423
+ function onClickOutside(target, handler, options = {}) {
6424
+ const { window: window2 = defaultWindow, ignore = [], capture = true, detectIframe = false } = options;
6425
+ if (!window2)
6426
+ return;
6427
+ if (isIOS && !_iOSWorkaround) {
6428
+ _iOSWorkaround = true;
6429
+ Array.from(window2.document.body.children).forEach((el) => el.addEventListener("click", noop));
6430
+ }
6431
+ let shouldListen = true;
6432
+ const shouldIgnore = (event) => {
6433
+ return ignore.some((target2) => {
6434
+ if (typeof target2 === "string") {
6435
+ return Array.from(window2.document.querySelectorAll(target2)).some((el) => el === event.target || event.composedPath().includes(el));
6436
+ } else {
6437
+ const el = unrefElement(target2);
6438
+ return el && (event.target === el || event.composedPath().includes(el));
6439
+ }
6440
+ });
6441
+ };
6442
+ const listener = (event) => {
6443
+ const el = unrefElement(target);
6444
+ if (!el || el === event.target || event.composedPath().includes(el))
6445
+ return;
6446
+ if (event.detail === 0)
6447
+ shouldListen = !shouldIgnore(event);
6448
+ if (!shouldListen) {
6449
+ shouldListen = true;
6450
+ return;
6451
+ }
6452
+ handler(event);
6453
+ };
6454
+ const cleanup = [
6455
+ useEventListener(window2, "click", listener, { passive: true, capture }),
6456
+ useEventListener(window2, "pointerdown", (e) => {
6457
+ const el = unrefElement(target);
6458
+ if (el)
6459
+ shouldListen = !e.composedPath().includes(el) && !shouldIgnore(e);
6460
+ }, { passive: true }),
6461
+ detectIframe && useEventListener(window2, "blur", (event) => {
6462
+ var _a2;
6463
+ const el = unrefElement(target);
6464
+ if (((_a2 = window2.document.activeElement) == null ? void 0 : _a2.tagName) === "IFRAME" && !(el == null ? void 0 : el.contains(window2.document.activeElement)))
6465
+ handler(event);
6466
+ })
6467
+ ].filter(Boolean);
6468
+ const stop = () => cleanup.forEach((fn2) => fn2());
6469
+ return stop;
6470
+ }
6471
+ ({
6472
+ [directiveHooks.mounted](el, binding) {
6473
+ const capture = !binding.modifiers.bubble;
6474
+ if (typeof binding.value === "function") {
6475
+ el.__onClickOutside_stop = onClickOutside(el, binding.value, { capture });
6476
+ } else {
6477
+ const [handler, options] = binding.value;
6478
+ el.__onClickOutside_stop = onClickOutside(el, handler, Object.assign({ capture }, options));
6479
+ }
6480
+ },
6481
+ [directiveHooks.unmounted](el) {
6482
+ el.__onClickOutside_stop();
6483
+ }
6484
+ });
6485
+ const createKeyPredicate = (keyFilter) => {
6486
+ if (typeof keyFilter === "function")
6487
+ return keyFilter;
6488
+ else if (typeof keyFilter === "string")
6489
+ return (event) => event.key === keyFilter;
6490
+ else if (Array.isArray(keyFilter))
6491
+ return (event) => keyFilter.includes(event.key);
6492
+ return () => true;
6493
+ };
6494
+ function onKeyStroke(...args) {
6495
+ let key;
6496
+ let handler;
6497
+ let options = {};
6498
+ if (args.length === 3) {
6499
+ key = args[0];
6500
+ handler = args[1];
6501
+ options = args[2];
6502
+ } else if (args.length === 2) {
6503
+ if (typeof args[1] === "object") {
6504
+ key = true;
6505
+ handler = args[0];
6506
+ options = args[1];
6507
+ } else {
6508
+ key = args[0];
6509
+ handler = args[1];
6510
+ }
6511
+ } else {
6512
+ key = true;
6513
+ handler = args[0];
6514
+ }
6515
+ const { target = defaultWindow, eventName = "keydown", passive: passive2 = false } = options;
6516
+ const predicate = createKeyPredicate(key);
6517
+ const listener = (e) => {
6518
+ if (predicate(e))
6519
+ handler(e);
6520
+ };
6521
+ return useEventListener(target, eventName, listener, passive2);
6522
+ }
6523
+ var __defProp$d = Object.defineProperty;
6524
+ var __getOwnPropSymbols$e = Object.getOwnPropertySymbols;
6525
+ var __hasOwnProp$e = Object.prototype.hasOwnProperty;
6526
+ var __propIsEnum$e = Object.prototype.propertyIsEnumerable;
6527
+ var __defNormalProp$d = (obj, key, value) => key in obj ? __defProp$d(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
6528
+ var __spreadValues$d = (a, b) => {
6529
+ for (var prop in b || (b = {}))
6530
+ if (__hasOwnProp$e.call(b, prop))
6531
+ __defNormalProp$d(a, prop, b[prop]);
6532
+ if (__getOwnPropSymbols$e)
6533
+ for (var prop of __getOwnPropSymbols$e(b)) {
6534
+ if (__propIsEnum$e.call(b, prop))
6535
+ __defNormalProp$d(a, prop, b[prop]);
6536
+ }
6537
+ return a;
6538
+ };
6539
+ ({
6540
+ [directiveHooks.mounted](el, binding) {
6541
+ var _a2, _b;
6542
+ const keys = (_b = (_a2 = binding.arg) == null ? void 0 : _a2.split(",")) != null ? _b : true;
6543
+ if (typeof binding.value === "function") {
6544
+ onKeyStroke(keys, binding.value, {
6545
+ target: el
6546
+ });
6547
+ } else {
6548
+ const [handler, options] = binding.value;
6549
+ onKeyStroke(keys, handler, __spreadValues$d({
6550
+ target: el
6551
+ }, options));
6552
+ }
6553
+ }
6554
+ });
6555
+ const DEFAULT_DELAY = 500;
6556
+ function onLongPress(target, handler, options) {
6557
+ var _a2, _b;
6558
+ const elementRef = computed(() => unrefElement(target));
6559
+ let timeout;
6560
+ function clear2() {
6561
+ if (timeout) {
6562
+ clearTimeout(timeout);
6563
+ timeout = void 0;
6564
+ }
6565
+ }
6566
+ function onDown(ev) {
6567
+ var _a22, _b2, _c, _d;
6568
+ if (((_a22 = options == null ? void 0 : options.modifiers) == null ? void 0 : _a22.self) && ev.target !== elementRef.value)
6569
+ return;
6570
+ clear2();
6571
+ if ((_b2 = options == null ? void 0 : options.modifiers) == null ? void 0 : _b2.prevent)
6572
+ ev.preventDefault();
6573
+ if ((_c = options == null ? void 0 : options.modifiers) == null ? void 0 : _c.stop)
6574
+ ev.stopPropagation();
6575
+ timeout = setTimeout(() => handler(ev), (_d = options == null ? void 0 : options.delay) != null ? _d : DEFAULT_DELAY);
6576
+ }
6577
+ const listenerOptions = {
6578
+ capture: (_a2 = options == null ? void 0 : options.modifiers) == null ? void 0 : _a2.capture,
6579
+ once: (_b = options == null ? void 0 : options.modifiers) == null ? void 0 : _b.once
6580
+ };
6581
+ useEventListener(elementRef, "pointerdown", onDown, listenerOptions);
6582
+ useEventListener(elementRef, "pointerup", clear2, listenerOptions);
6583
+ useEventListener(elementRef, "pointerleave", clear2, listenerOptions);
6584
+ }
6585
+ ({
6586
+ [directiveHooks.mounted](el, binding) {
6587
+ if (typeof binding.value === "function")
6588
+ onLongPress(el, binding.value, { modifiers: binding.modifiers });
6589
+ else
6590
+ onLongPress(el, ...binding.value);
6591
+ }
6592
+ });
6593
+ const _global = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
6594
+ const globalKey = "__vueuse_ssr_handlers__";
6595
+ _global[globalKey] = _global[globalKey] || {};
6596
+ _global[globalKey];
6597
+ function useSupported(callback, sync = false) {
6598
+ const isSupported = ref();
6599
+ const update = () => isSupported.value = Boolean(callback());
6600
+ update();
6601
+ tryOnMounted(update, sync);
6602
+ return isSupported;
6603
+ }
6604
+ function useElementHover(el, options = {}) {
6605
+ const delayEnter = options ? options.delayEnter : 0;
6606
+ const delayLeave = options ? options.delayLeave : 0;
6607
+ const isHovered = ref(false);
6608
+ let timer2;
6609
+ const toggle = (entering) => {
6610
+ const delay = entering ? delayEnter : delayLeave;
6611
+ if (timer2) {
6612
+ clearTimeout(timer2);
6613
+ timer2 = void 0;
6614
+ }
6615
+ if (delay)
6616
+ timer2 = setTimeout(() => isHovered.value = entering, delay);
6617
+ else
6618
+ isHovered.value = entering;
6619
+ };
6620
+ if (!window)
6621
+ return isHovered;
6622
+ useEventListener(el, "mouseenter", () => toggle(true), { passive: true });
6623
+ useEventListener(el, "mouseleave", () => toggle(false), { passive: true });
6624
+ return isHovered;
6625
+ }
6626
+ ({
6627
+ [directiveHooks.mounted](el, binding) {
6628
+ if (typeof binding.value === "function") {
6629
+ const isHovered = useElementHover(el);
6630
+ watch(isHovered, (v) => binding.value(v));
6631
+ }
6632
+ }
6633
+ });
6634
+ var __getOwnPropSymbols$a = Object.getOwnPropertySymbols;
6635
+ var __hasOwnProp$a = Object.prototype.hasOwnProperty;
6636
+ var __propIsEnum$a = Object.prototype.propertyIsEnumerable;
6637
+ var __objRest = (source, exclude) => {
6638
+ var target = {};
6639
+ for (var prop in source)
6640
+ if (__hasOwnProp$a.call(source, prop) && exclude.indexOf(prop) < 0)
6641
+ target[prop] = source[prop];
6642
+ if (source != null && __getOwnPropSymbols$a)
6643
+ for (var prop of __getOwnPropSymbols$a(source)) {
6644
+ if (exclude.indexOf(prop) < 0 && __propIsEnum$a.call(source, prop))
6645
+ target[prop] = source[prop];
6646
+ }
6647
+ return target;
6648
+ };
6649
+ function useResizeObserver(target, callback, options = {}) {
6650
+ const _a2 = options, { window: window2 = defaultWindow } = _a2, observerOptions = __objRest(_a2, ["window"]);
6651
+ let observer;
6652
+ const isSupported = useSupported(() => window2 && "ResizeObserver" in window2);
6653
+ const cleanup = () => {
6654
+ if (observer) {
6655
+ observer.disconnect();
6656
+ observer = void 0;
6657
+ }
6658
+ };
6659
+ const stopWatch = watch(() => unrefElement(target), (el) => {
6660
+ cleanup();
6661
+ if (isSupported.value && window2 && el) {
6662
+ observer = new ResizeObserver(callback);
6663
+ observer.observe(el, observerOptions);
6664
+ }
6665
+ }, { immediate: true, flush: "post" });
6666
+ const stop = () => {
6667
+ cleanup();
6668
+ stopWatch();
6669
+ };
6670
+ tryOnScopeDispose(stop);
6671
+ return {
6672
+ isSupported,
6673
+ stop
6674
+ };
6675
+ }
6676
+ function useElementSize(target, initialSize = { width: 0, height: 0 }, options = {}) {
6677
+ const { window: window2 = defaultWindow, box = "content-box" } = options;
6678
+ const isSVG = computed(() => {
6679
+ var _a2, _b;
6680
+ return (_b = (_a2 = unrefElement(target)) == null ? void 0 : _a2.namespaceURI) == null ? void 0 : _b.includes("svg");
6681
+ });
6682
+ const width = ref(initialSize.width);
6683
+ const height = ref(initialSize.height);
6684
+ useResizeObserver(target, ([entry]) => {
6685
+ const boxSize = box === "border-box" ? entry.borderBoxSize : box === "content-box" ? entry.contentBoxSize : entry.devicePixelContentBoxSize;
6686
+ if (window2 && isSVG.value) {
6687
+ const $elem = unrefElement(target);
6688
+ if ($elem) {
6689
+ const styles = window2.getComputedStyle($elem);
6690
+ width.value = parseFloat(styles.width);
6691
+ height.value = parseFloat(styles.height);
6692
+ }
6693
+ } else {
6694
+ if (boxSize) {
6695
+ const formatBoxSize = Array.isArray(boxSize) ? boxSize : [boxSize];
6696
+ width.value = formatBoxSize.reduce((acc, { inlineSize }) => acc + inlineSize, 0);
6697
+ height.value = formatBoxSize.reduce((acc, { blockSize }) => acc + blockSize, 0);
6698
+ } else {
6699
+ width.value = entry.contentRect.width;
6700
+ height.value = entry.contentRect.height;
6701
+ }
6702
+ }
6703
+ }, options);
6704
+ watch(() => unrefElement(target), (ele) => {
6705
+ width.value = ele ? initialSize.width : 0;
6706
+ height.value = ele ? initialSize.height : 0;
6707
+ });
6708
+ return {
6709
+ width,
6710
+ height
6711
+ };
6712
+ }
6713
+ ({
6714
+ [directiveHooks.mounted](el, binding) {
6715
+ var _a2;
6716
+ const handler = typeof binding.value === "function" ? binding.value : (_a2 = binding.value) == null ? void 0 : _a2[0];
6717
+ const options = typeof binding.value === "function" ? [] : binding.value.slice(1);
6718
+ const { width, height } = useElementSize(el, ...options);
6719
+ watch([width, height], ([width2, height2]) => handler({ width: width2, height: height2 }));
6720
+ }
6721
+ });
6722
+ function useElementVisibility(element, { window: window2 = defaultWindow, scrollTarget } = {}) {
6723
+ const elementIsVisible = ref(false);
6724
+ const testBounding = () => {
6725
+ if (!window2)
6726
+ return;
6727
+ const document2 = window2.document;
6728
+ const el = unrefElement(element);
6729
+ if (!el) {
6730
+ elementIsVisible.value = false;
6731
+ } else {
6732
+ const rect = el.getBoundingClientRect();
6733
+ elementIsVisible.value = rect.top <= (window2.innerHeight || document2.documentElement.clientHeight) && rect.left <= (window2.innerWidth || document2.documentElement.clientWidth) && rect.bottom >= 0 && rect.right >= 0;
6734
+ }
6735
+ };
6736
+ watch(() => unrefElement(element), () => testBounding(), { immediate: true, flush: "post" });
6737
+ if (window2) {
6738
+ useEventListener(scrollTarget || window2, "scroll", testBounding, {
6739
+ capture: false,
6740
+ passive: true
6741
+ });
6742
+ }
6743
+ return elementIsVisible;
6744
+ }
6745
+ ({
6746
+ [directiveHooks.mounted](el, binding) {
6747
+ if (typeof binding.value === "function") {
6748
+ const handler = binding.value;
6749
+ const isVisible = useElementVisibility(el);
6750
+ watch(isVisible, (v) => handler(v), { immediate: true });
6751
+ } else {
6752
+ const [handler, options] = binding.value;
6753
+ const isVisible = useElementVisibility(el, options);
6754
+ watch(isVisible, (v) => handler(v), { immediate: true });
6755
+ }
6756
+ }
6757
+ });
6758
+ const ARRIVED_STATE_THRESHOLD_PIXELS = 1;
6759
+ function useScroll(element, options = {}) {
6760
+ const {
6761
+ throttle: throttle2 = 0,
6762
+ idle = 200,
6763
+ onStop = noop,
6764
+ onScroll = noop,
6765
+ offset: offset2 = {
6766
+ left: 0,
6767
+ right: 0,
6768
+ top: 0,
6769
+ bottom: 0
6770
+ },
6771
+ eventListenerOptions = {
6772
+ capture: false,
6773
+ passive: true
6774
+ },
6775
+ behavior = "auto"
6776
+ } = options;
6777
+ const internalX = ref(0);
6778
+ const internalY = ref(0);
6779
+ const x = computed({
6780
+ get() {
6781
+ return internalX.value;
6782
+ },
6783
+ set(x2) {
6784
+ scrollTo(x2, void 0);
6785
+ }
6786
+ });
6787
+ const y = computed({
6788
+ get() {
6789
+ return internalY.value;
6790
+ },
6791
+ set(y2) {
6792
+ scrollTo(void 0, y2);
6793
+ }
6794
+ });
6795
+ function scrollTo(_x, _y) {
6796
+ var _a2, _b, _c;
6797
+ const _element = resolveUnref(element);
6798
+ if (!_element)
6799
+ return;
6800
+ (_c = _element instanceof Document ? document.body : _element) == null ? void 0 : _c.scrollTo({
6801
+ top: (_a2 = resolveUnref(_y)) != null ? _a2 : y.value,
6802
+ left: (_b = resolveUnref(_x)) != null ? _b : x.value,
6803
+ behavior: resolveUnref(behavior)
6804
+ });
6805
+ }
6806
+ const isScrolling = ref(false);
6807
+ const arrivedState = reactive({
6808
+ left: true,
6809
+ right: false,
6810
+ top: true,
6811
+ bottom: false
6812
+ });
6813
+ const directions = reactive({
6814
+ left: false,
6815
+ right: false,
6816
+ top: false,
6817
+ bottom: false
6818
+ });
6819
+ const onScrollEnd = (e) => {
6820
+ if (!isScrolling.value)
6821
+ return;
6822
+ isScrolling.value = false;
6823
+ directions.left = false;
6824
+ directions.right = false;
6825
+ directions.top = false;
6826
+ directions.bottom = false;
6827
+ onStop(e);
6828
+ };
6829
+ const onScrollEndDebounced = useDebounceFn(onScrollEnd, throttle2 + idle);
6830
+ const onScrollHandler = (e) => {
6831
+ const eventTarget = e.target === document ? e.target.documentElement : e.target;
6832
+ const scrollLeft = eventTarget.scrollLeft;
6833
+ directions.left = scrollLeft < internalX.value;
6834
+ directions.right = scrollLeft > internalY.value;
6835
+ arrivedState.left = scrollLeft <= 0 + (offset2.left || 0);
6836
+ arrivedState.right = scrollLeft + eventTarget.clientWidth >= eventTarget.scrollWidth - (offset2.right || 0) - ARRIVED_STATE_THRESHOLD_PIXELS;
6837
+ internalX.value = scrollLeft;
6838
+ let scrollTop = eventTarget.scrollTop;
6839
+ if (e.target === document && !scrollTop)
6840
+ scrollTop = document.body.scrollTop;
6841
+ directions.top = scrollTop < internalY.value;
6842
+ directions.bottom = scrollTop > internalY.value;
6843
+ arrivedState.top = scrollTop <= 0 + (offset2.top || 0);
6844
+ arrivedState.bottom = scrollTop + eventTarget.clientHeight >= eventTarget.scrollHeight - (offset2.bottom || 0) - ARRIVED_STATE_THRESHOLD_PIXELS;
6845
+ internalY.value = scrollTop;
6846
+ isScrolling.value = true;
6847
+ onScrollEndDebounced(e);
6848
+ onScroll(e);
6849
+ };
6850
+ useEventListener(element, "scroll", throttle2 ? useThrottleFn(onScrollHandler, throttle2, true, false) : onScrollHandler, eventListenerOptions);
6851
+ useEventListener(element, "scrollend", onScrollEnd, eventListenerOptions);
6852
+ return {
6853
+ x,
6854
+ y,
6855
+ isScrolling,
6856
+ arrivedState,
6857
+ directions
6858
+ };
6859
+ }
6860
+ var __defProp$8 = Object.defineProperty;
6861
+ var __defProps$7 = Object.defineProperties;
6862
+ var __getOwnPropDescs$7 = Object.getOwnPropertyDescriptors;
6863
+ var __getOwnPropSymbols$8 = Object.getOwnPropertySymbols;
6864
+ var __hasOwnProp$8 = Object.prototype.hasOwnProperty;
6865
+ var __propIsEnum$8 = Object.prototype.propertyIsEnumerable;
6866
+ var __defNormalProp$8 = (obj, key, value) => key in obj ? __defProp$8(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
6867
+ var __spreadValues$8 = (a, b) => {
6868
+ for (var prop in b || (b = {}))
6869
+ if (__hasOwnProp$8.call(b, prop))
6870
+ __defNormalProp$8(a, prop, b[prop]);
6871
+ if (__getOwnPropSymbols$8)
6872
+ for (var prop of __getOwnPropSymbols$8(b)) {
6873
+ if (__propIsEnum$8.call(b, prop))
6874
+ __defNormalProp$8(a, prop, b[prop]);
6875
+ }
6876
+ return a;
6877
+ };
6878
+ var __spreadProps$7 = (a, b) => __defProps$7(a, __getOwnPropDescs$7(b));
6879
+ function useInfiniteScroll(element, onLoadMore, options = {}) {
6880
+ var _a2, _b;
6881
+ const direction = (_a2 = options.direction) != null ? _a2 : "bottom";
6882
+ const state = reactive(useScroll(element, __spreadProps$7(__spreadValues$8({}, options), {
6883
+ offset: __spreadValues$8({
6884
+ [direction]: (_b = options.distance) != null ? _b : 0
6885
+ }, options.offset)
6886
+ })));
6887
+ watch(() => state.arrivedState[direction], async (v) => {
6888
+ var _a22, _b2;
6889
+ if (v) {
6890
+ const elem = resolveUnref(element);
6891
+ const previous = {
6892
+ height: (_a22 = elem == null ? void 0 : elem.scrollHeight) != null ? _a22 : 0,
6893
+ width: (_b2 = elem == null ? void 0 : elem.scrollWidth) != null ? _b2 : 0
6894
+ };
6895
+ await onLoadMore(state);
6896
+ if (options.preserveScrollPosition && elem) {
6897
+ nextTick(() => {
6898
+ elem.scrollTo({
6899
+ top: elem.scrollHeight - previous.height,
6900
+ left: elem.scrollWidth - previous.width
6901
+ });
6902
+ });
6903
+ }
6904
+ }
6905
+ });
6906
+ }
6907
+ ({
6908
+ [directiveHooks.mounted](el, binding) {
6909
+ if (typeof binding.value === "function")
6910
+ useInfiniteScroll(el, binding.value);
6911
+ else
6912
+ useInfiniteScroll(el, ...binding.value);
6913
+ }
6914
+ });
6915
+ function useIntersectionObserver(target, callback, options = {}) {
6916
+ const {
6917
+ root: root2,
6918
+ rootMargin = "0px",
6919
+ threshold = 0.1,
6920
+ window: window2 = defaultWindow
6921
+ } = options;
6922
+ const isSupported = useSupported(() => window2 && "IntersectionObserver" in window2);
6923
+ let cleanup = noop;
6924
+ const stopWatch = isSupported.value ? watch(() => ({
6925
+ el: unrefElement(target),
6926
+ root: unrefElement(root2)
6927
+ }), ({ el, root: root22 }) => {
6928
+ cleanup();
6929
+ if (!el)
6930
+ return;
6931
+ const observer = new IntersectionObserver(callback, {
6932
+ root: root22,
6933
+ rootMargin,
6934
+ threshold
6935
+ });
6936
+ observer.observe(el);
6937
+ cleanup = () => {
6938
+ observer.disconnect();
6939
+ cleanup = noop;
6940
+ };
6941
+ }, { immediate: true, flush: "post" }) : noop;
6942
+ const stop = () => {
6943
+ cleanup();
6944
+ stopWatch();
6945
+ };
6946
+ tryOnScopeDispose(stop);
6947
+ return {
6948
+ isSupported,
6949
+ stop
6950
+ };
6951
+ }
6952
+ ({
6953
+ [directiveHooks.mounted](el, binding) {
6954
+ if (typeof binding.value === "function")
6955
+ useIntersectionObserver(el, binding.value);
6956
+ else
6957
+ useIntersectionObserver(el, ...binding.value);
6958
+ }
6959
+ });
6960
+ var __defProp$3 = Object.defineProperty;
6961
+ var __defProps$2 = Object.defineProperties;
6962
+ var __getOwnPropDescs$2 = Object.getOwnPropertyDescriptors;
6963
+ var __getOwnPropSymbols$3 = Object.getOwnPropertySymbols;
6964
+ var __hasOwnProp$3 = Object.prototype.hasOwnProperty;
6965
+ var __propIsEnum$3 = Object.prototype.propertyIsEnumerable;
6966
+ var __defNormalProp$3 = (obj, key, value) => key in obj ? __defProp$3(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
6967
+ var __spreadValues$3 = (a, b) => {
6968
+ for (var prop in b || (b = {}))
6969
+ if (__hasOwnProp$3.call(b, prop))
6970
+ __defNormalProp$3(a, prop, b[prop]);
6971
+ if (__getOwnPropSymbols$3)
6972
+ for (var prop of __getOwnPropSymbols$3(b)) {
6973
+ if (__propIsEnum$3.call(b, prop))
6974
+ __defNormalProp$3(a, prop, b[prop]);
6975
+ }
6976
+ return a;
6977
+ };
6978
+ var __spreadProps$2 = (a, b) => __defProps$2(a, __getOwnPropDescs$2(b));
6979
+ ({
6980
+ [directiveHooks.mounted](el, binding) {
6981
+ if (typeof binding.value === "function") {
6982
+ const handler = binding.value;
6983
+ const state = useScroll(el, {
6984
+ onScroll() {
6985
+ handler(state);
6986
+ },
6987
+ onStop() {
6988
+ handler(state);
6989
+ }
6990
+ });
6991
+ } else {
6992
+ const [handler, options] = binding.value;
6993
+ const state = useScroll(el, __spreadProps$2(__spreadValues$3({}, options), {
6994
+ onScroll(e) {
6995
+ var _a2;
6996
+ (_a2 = options.onScroll) == null ? void 0 : _a2.call(options, e);
6997
+ handler(state);
6998
+ },
6999
+ onStop(e) {
7000
+ var _a2;
7001
+ (_a2 = options.onStop) == null ? void 0 : _a2.call(options, e);
7002
+ handler(state);
7003
+ }
7004
+ }));
7005
+ }
7006
+ }
7007
+ });
6258
7008
  function checkOverflowScroll(ele) {
6259
7009
  const style = window.getComputedStyle(ele);
6260
7010
  if (style.overflowX === "scroll" || style.overflowY === "scroll" || style.overflowX === "auto" && ele.clientHeight < ele.scrollHeight || style.overflowY === "auto" && ele.clientWidth < ele.scrollWidth) {
@@ -6500,7 +7250,7 @@ const _sfc_main$o = /* @__PURE__ */ defineComponent({
6500
7250
  const hide2 = () => {
6501
7251
  lewPopverRef.value.hide();
6502
7252
  };
6503
- const searchDebounce = useDebounceFn(async (e) => {
7253
+ const searchDebounce = useDebounceFn$1(async (e) => {
6504
7254
  search(e);
6505
7255
  }, props.searchDelay);
6506
7256
  const search = async (e) => {
@@ -6562,9 +7312,9 @@ const _sfc_main$o = /* @__PURE__ */ defineComponent({
6562
7312
  return object2class$1("lew-select-body", { size, disabled });
6563
7313
  });
6564
7314
  const getSelectViewClassName = computed(() => {
6565
- const { disabled, readonly: readonly2 } = props;
7315
+ const { disabled, readonly } = props;
6566
7316
  const focus = state.visible;
6567
- return object2class$1("lew-select-view", { focus, disabled, readonly: readonly2 });
7317
+ return object2class$1("lew-select-view", { focus, disabled, readonly });
6568
7318
  });
6569
7319
  const getSelectItemClassName = (e) => {
6570
7320
  const { disabled } = e;
@@ -6859,7 +7609,7 @@ const _sfc_main$n = /* @__PURE__ */ defineComponent({
6859
7609
  const hide2 = () => {
6860
7610
  lewPopverRef.value.hide();
6861
7611
  };
6862
- const searchDebounce = useDebounceFn(async (e) => {
7612
+ const searchDebounce = useDebounceFn$1(async (e) => {
6863
7613
  search(e);
6864
7614
  }, props.searchDelay);
6865
7615
  const search = async (e) => {
@@ -6927,9 +7677,9 @@ const _sfc_main$n = /* @__PURE__ */ defineComponent({
6927
7677
  return object2class$1("lew-select-body", { size, disabled });
6928
7678
  });
6929
7679
  const getSelectViewClassName = computed(() => {
6930
- const { disabled, readonly: readonly2 } = props;
7680
+ const { disabled, readonly } = props;
6931
7681
  const focus = state.visible;
6932
- return object2class$1("lew-select-view", { focus, disabled, readonly: readonly2 });
7682
+ return object2class$1("lew-select-view", { focus, disabled, readonly });
6933
7683
  });
6934
7684
  const getSelectItemClassName = (e) => {
6935
7685
  const { disabled } = e;
@@ -12021,7 +12771,7 @@ var defaultProps = Object.assign({
12021
12771
  },
12022
12772
  onUntrigger: function onUntrigger() {
12023
12773
  },
12024
- onClickOutside: function onClickOutside() {
12774
+ onClickOutside: function onClickOutside2() {
12025
12775
  },
12026
12776
  placement: "top",
12027
12777
  plugins: [],