@getlupa/client 1.10.3 → 1.11.0

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.
@@ -106,6 +106,10 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
106
106
  const n = parseFloat(val);
107
107
  return isNaN(n) ? val : n;
108
108
  };
109
+ const toNumber = (val) => {
110
+ const n = isString(val) ? Number(val) : NaN;
111
+ return isNaN(n) ? val : n;
112
+ };
109
113
  let _globalThis;
110
114
  const getGlobalThis = () => {
111
115
  return _globalThis || (_globalThis = typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : {});
@@ -2004,6 +2008,319 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
2004
2008
  }
2005
2009
  }
2006
2010
  }
2011
+ function useTransitionState() {
2012
+ const state = {
2013
+ isMounted: false,
2014
+ isLeaving: false,
2015
+ isUnmounting: false,
2016
+ leavingVNodes: /* @__PURE__ */ new Map()
2017
+ };
2018
+ onMounted(() => {
2019
+ state.isMounted = true;
2020
+ });
2021
+ onBeforeUnmount(() => {
2022
+ state.isUnmounting = true;
2023
+ });
2024
+ return state;
2025
+ }
2026
+ const TransitionHookValidator = [Function, Array];
2027
+ const BaseTransitionPropsValidators = {
2028
+ mode: String,
2029
+ appear: Boolean,
2030
+ persisted: Boolean,
2031
+ // enter
2032
+ onBeforeEnter: TransitionHookValidator,
2033
+ onEnter: TransitionHookValidator,
2034
+ onAfterEnter: TransitionHookValidator,
2035
+ onEnterCancelled: TransitionHookValidator,
2036
+ // leave
2037
+ onBeforeLeave: TransitionHookValidator,
2038
+ onLeave: TransitionHookValidator,
2039
+ onAfterLeave: TransitionHookValidator,
2040
+ onLeaveCancelled: TransitionHookValidator,
2041
+ // appear
2042
+ onBeforeAppear: TransitionHookValidator,
2043
+ onAppear: TransitionHookValidator,
2044
+ onAfterAppear: TransitionHookValidator,
2045
+ onAppearCancelled: TransitionHookValidator
2046
+ };
2047
+ const BaseTransitionImpl = {
2048
+ name: `BaseTransition`,
2049
+ props: BaseTransitionPropsValidators,
2050
+ setup(props, { slots }) {
2051
+ const instance = getCurrentInstance();
2052
+ const state = useTransitionState();
2053
+ let prevTransitionKey;
2054
+ return () => {
2055
+ const children = slots.default && getTransitionRawChildren(slots.default(), true);
2056
+ if (!children || !children.length) {
2057
+ return;
2058
+ }
2059
+ let child = children[0];
2060
+ if (children.length > 1) {
2061
+ for (const c2 of children) {
2062
+ if (c2.type !== Comment) {
2063
+ child = c2;
2064
+ break;
2065
+ }
2066
+ }
2067
+ }
2068
+ const rawProps = toRaw(props);
2069
+ const { mode } = rawProps;
2070
+ if (state.isLeaving) {
2071
+ return emptyPlaceholder(child);
2072
+ }
2073
+ const innerChild = getKeepAliveChild(child);
2074
+ if (!innerChild) {
2075
+ return emptyPlaceholder(child);
2076
+ }
2077
+ const enterHooks = resolveTransitionHooks(
2078
+ innerChild,
2079
+ rawProps,
2080
+ state,
2081
+ instance
2082
+ );
2083
+ setTransitionHooks(innerChild, enterHooks);
2084
+ const oldChild = instance.subTree;
2085
+ const oldInnerChild = oldChild && getKeepAliveChild(oldChild);
2086
+ let transitionKeyChanged = false;
2087
+ const { getTransitionKey } = innerChild.type;
2088
+ if (getTransitionKey) {
2089
+ const key = getTransitionKey();
2090
+ if (prevTransitionKey === void 0) {
2091
+ prevTransitionKey = key;
2092
+ } else if (key !== prevTransitionKey) {
2093
+ prevTransitionKey = key;
2094
+ transitionKeyChanged = true;
2095
+ }
2096
+ }
2097
+ if (oldInnerChild && oldInnerChild.type !== Comment && (!isSameVNodeType(innerChild, oldInnerChild) || transitionKeyChanged)) {
2098
+ const leavingHooks = resolveTransitionHooks(
2099
+ oldInnerChild,
2100
+ rawProps,
2101
+ state,
2102
+ instance
2103
+ );
2104
+ setTransitionHooks(oldInnerChild, leavingHooks);
2105
+ if (mode === "out-in") {
2106
+ state.isLeaving = true;
2107
+ leavingHooks.afterLeave = () => {
2108
+ state.isLeaving = false;
2109
+ if (instance.update.active !== false) {
2110
+ instance.update();
2111
+ }
2112
+ };
2113
+ return emptyPlaceholder(child);
2114
+ } else if (mode === "in-out" && innerChild.type !== Comment) {
2115
+ leavingHooks.delayLeave = (el, earlyRemove, delayedLeave) => {
2116
+ const leavingVNodesCache = getLeavingNodesForType(
2117
+ state,
2118
+ oldInnerChild
2119
+ );
2120
+ leavingVNodesCache[String(oldInnerChild.key)] = oldInnerChild;
2121
+ el._leaveCb = () => {
2122
+ earlyRemove();
2123
+ el._leaveCb = void 0;
2124
+ delete enterHooks.delayedLeave;
2125
+ };
2126
+ enterHooks.delayedLeave = delayedLeave;
2127
+ };
2128
+ }
2129
+ }
2130
+ return child;
2131
+ };
2132
+ }
2133
+ };
2134
+ const BaseTransition = BaseTransitionImpl;
2135
+ function getLeavingNodesForType(state, vnode) {
2136
+ const { leavingVNodes } = state;
2137
+ let leavingVNodesCache = leavingVNodes.get(vnode.type);
2138
+ if (!leavingVNodesCache) {
2139
+ leavingVNodesCache = /* @__PURE__ */ Object.create(null);
2140
+ leavingVNodes.set(vnode.type, leavingVNodesCache);
2141
+ }
2142
+ return leavingVNodesCache;
2143
+ }
2144
+ function resolveTransitionHooks(vnode, props, state, instance) {
2145
+ const {
2146
+ appear,
2147
+ mode,
2148
+ persisted = false,
2149
+ onBeforeEnter,
2150
+ onEnter,
2151
+ onAfterEnter,
2152
+ onEnterCancelled,
2153
+ onBeforeLeave,
2154
+ onLeave,
2155
+ onAfterLeave,
2156
+ onLeaveCancelled,
2157
+ onBeforeAppear,
2158
+ onAppear,
2159
+ onAfterAppear,
2160
+ onAppearCancelled
2161
+ } = props;
2162
+ const key = String(vnode.key);
2163
+ const leavingVNodesCache = getLeavingNodesForType(state, vnode);
2164
+ const callHook2 = (hook, args) => {
2165
+ hook && callWithAsyncErrorHandling(
2166
+ hook,
2167
+ instance,
2168
+ 9,
2169
+ args
2170
+ );
2171
+ };
2172
+ const callAsyncHook = (hook, args) => {
2173
+ const done = args[1];
2174
+ callHook2(hook, args);
2175
+ if (isArray(hook)) {
2176
+ if (hook.every((hook2) => hook2.length <= 1))
2177
+ done();
2178
+ } else if (hook.length <= 1) {
2179
+ done();
2180
+ }
2181
+ };
2182
+ const hooks = {
2183
+ mode,
2184
+ persisted,
2185
+ beforeEnter(el) {
2186
+ let hook = onBeforeEnter;
2187
+ if (!state.isMounted) {
2188
+ if (appear) {
2189
+ hook = onBeforeAppear || onBeforeEnter;
2190
+ } else {
2191
+ return;
2192
+ }
2193
+ }
2194
+ if (el._leaveCb) {
2195
+ el._leaveCb(
2196
+ true
2197
+ /* cancelled */
2198
+ );
2199
+ }
2200
+ const leavingVNode = leavingVNodesCache[key];
2201
+ if (leavingVNode && isSameVNodeType(vnode, leavingVNode) && leavingVNode.el._leaveCb) {
2202
+ leavingVNode.el._leaveCb();
2203
+ }
2204
+ callHook2(hook, [el]);
2205
+ },
2206
+ enter(el) {
2207
+ let hook = onEnter;
2208
+ let afterHook = onAfterEnter;
2209
+ let cancelHook = onEnterCancelled;
2210
+ if (!state.isMounted) {
2211
+ if (appear) {
2212
+ hook = onAppear || onEnter;
2213
+ afterHook = onAfterAppear || onAfterEnter;
2214
+ cancelHook = onAppearCancelled || onEnterCancelled;
2215
+ } else {
2216
+ return;
2217
+ }
2218
+ }
2219
+ let called = false;
2220
+ const done = el._enterCb = (cancelled) => {
2221
+ if (called)
2222
+ return;
2223
+ called = true;
2224
+ if (cancelled) {
2225
+ callHook2(cancelHook, [el]);
2226
+ } else {
2227
+ callHook2(afterHook, [el]);
2228
+ }
2229
+ if (hooks.delayedLeave) {
2230
+ hooks.delayedLeave();
2231
+ }
2232
+ el._enterCb = void 0;
2233
+ };
2234
+ if (hook) {
2235
+ callAsyncHook(hook, [el, done]);
2236
+ } else {
2237
+ done();
2238
+ }
2239
+ },
2240
+ leave(el, remove2) {
2241
+ const key2 = String(vnode.key);
2242
+ if (el._enterCb) {
2243
+ el._enterCb(
2244
+ true
2245
+ /* cancelled */
2246
+ );
2247
+ }
2248
+ if (state.isUnmounting) {
2249
+ return remove2();
2250
+ }
2251
+ callHook2(onBeforeLeave, [el]);
2252
+ let called = false;
2253
+ const done = el._leaveCb = (cancelled) => {
2254
+ if (called)
2255
+ return;
2256
+ called = true;
2257
+ remove2();
2258
+ if (cancelled) {
2259
+ callHook2(onLeaveCancelled, [el]);
2260
+ } else {
2261
+ callHook2(onAfterLeave, [el]);
2262
+ }
2263
+ el._leaveCb = void 0;
2264
+ if (leavingVNodesCache[key2] === vnode) {
2265
+ delete leavingVNodesCache[key2];
2266
+ }
2267
+ };
2268
+ leavingVNodesCache[key2] = vnode;
2269
+ if (onLeave) {
2270
+ callAsyncHook(onLeave, [el, done]);
2271
+ } else {
2272
+ done();
2273
+ }
2274
+ },
2275
+ clone(vnode2) {
2276
+ return resolveTransitionHooks(vnode2, props, state, instance);
2277
+ }
2278
+ };
2279
+ return hooks;
2280
+ }
2281
+ function emptyPlaceholder(vnode) {
2282
+ if (isKeepAlive(vnode)) {
2283
+ vnode = cloneVNode(vnode);
2284
+ vnode.children = null;
2285
+ return vnode;
2286
+ }
2287
+ }
2288
+ function getKeepAliveChild(vnode) {
2289
+ return isKeepAlive(vnode) ? vnode.children ? vnode.children[0] : void 0 : vnode;
2290
+ }
2291
+ function setTransitionHooks(vnode, hooks) {
2292
+ if (vnode.shapeFlag & 6 && vnode.component) {
2293
+ setTransitionHooks(vnode.component.subTree, hooks);
2294
+ } else if (vnode.shapeFlag & 128) {
2295
+ vnode.ssContent.transition = hooks.clone(vnode.ssContent);
2296
+ vnode.ssFallback.transition = hooks.clone(vnode.ssFallback);
2297
+ } else {
2298
+ vnode.transition = hooks;
2299
+ }
2300
+ }
2301
+ function getTransitionRawChildren(children, keepComment = false, parentKey) {
2302
+ let ret = [];
2303
+ let keyedFragmentCount = 0;
2304
+ for (let i = 0; i < children.length; i++) {
2305
+ let child = children[i];
2306
+ const key = parentKey == null ? child.key : String(parentKey) + String(child.key != null ? child.key : i);
2307
+ if (child.type === Fragment) {
2308
+ if (child.patchFlag & 128)
2309
+ keyedFragmentCount++;
2310
+ ret = ret.concat(
2311
+ getTransitionRawChildren(child.children, keepComment, key)
2312
+ );
2313
+ } else if (keepComment || child.type !== Comment) {
2314
+ ret.push(key != null ? cloneVNode(child, { key }) : child);
2315
+ }
2316
+ }
2317
+ if (keyedFragmentCount > 1) {
2318
+ for (let i = 0; i < ret.length; i++) {
2319
+ ret[i].patchFlag = -2;
2320
+ }
2321
+ }
2322
+ return ret;
2323
+ }
2007
2324
  function defineComponent(options, extraOptions) {
2008
2325
  return isFunction(options) ? (
2009
2326
  // #8326: extend call and options.name access are considered side-effects
@@ -2375,7 +2692,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
2375
2692
  const ctx = instance.ctx;
2376
2693
  shouldCacheAccess = false;
2377
2694
  if (options.beforeCreate) {
2378
- callHook(options.beforeCreate, instance, "bc");
2695
+ callHook$1(options.beforeCreate, instance, "bc");
2379
2696
  }
2380
2697
  const {
2381
2698
  // state
@@ -2462,7 +2779,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
2462
2779
  });
2463
2780
  }
2464
2781
  if (created) {
2465
- callHook(created, instance, "c");
2782
+ callHook$1(created, instance, "c");
2466
2783
  }
2467
2784
  function registerLifecycleHook(register, hook) {
2468
2785
  if (isArray(hook)) {
@@ -2540,7 +2857,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
2540
2857
  }
2541
2858
  }
2542
2859
  }
2543
- function callHook(hook, instance, type) {
2860
+ function callHook$1(hook, instance, type) {
2544
2861
  callWithAsyncErrorHandling(
2545
2862
  isArray(hook) ? hook.map((h2) => h2.bind(instance.proxy)) : hook.bind(instance.proxy),
2546
2863
  instance,
@@ -5042,6 +5359,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
5042
5359
  return instance;
5043
5360
  }
5044
5361
  let currentInstance = null;
5362
+ const getCurrentInstance = () => currentInstance || currentRenderingInstance;
5045
5363
  let internalSetCurrentInstance;
5046
5364
  let globalCurrentInstanceSetters;
5047
5365
  let settersKey = "__VUE_INSTANCE_SETTERS__";
@@ -5572,6 +5890,268 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
5572
5890
  }
5573
5891
  return key in el;
5574
5892
  }
5893
+ const TRANSITION = "transition";
5894
+ const ANIMATION = "animation";
5895
+ const Transition = (props, { slots }) => h$1(BaseTransition, resolveTransitionProps(props), slots);
5896
+ Transition.displayName = "Transition";
5897
+ const DOMTransitionPropsValidators = {
5898
+ name: String,
5899
+ type: String,
5900
+ css: {
5901
+ type: Boolean,
5902
+ default: true
5903
+ },
5904
+ duration: [String, Number, Object],
5905
+ enterFromClass: String,
5906
+ enterActiveClass: String,
5907
+ enterToClass: String,
5908
+ appearFromClass: String,
5909
+ appearActiveClass: String,
5910
+ appearToClass: String,
5911
+ leaveFromClass: String,
5912
+ leaveActiveClass: String,
5913
+ leaveToClass: String
5914
+ };
5915
+ Transition.props = /* @__PURE__ */ extend(
5916
+ {},
5917
+ BaseTransitionPropsValidators,
5918
+ DOMTransitionPropsValidators
5919
+ );
5920
+ const callHook = (hook, args = []) => {
5921
+ if (isArray(hook)) {
5922
+ hook.forEach((h2) => h2(...args));
5923
+ } else if (hook) {
5924
+ hook(...args);
5925
+ }
5926
+ };
5927
+ const hasExplicitCallback = (hook) => {
5928
+ return hook ? isArray(hook) ? hook.some((h2) => h2.length > 1) : hook.length > 1 : false;
5929
+ };
5930
+ function resolveTransitionProps(rawProps) {
5931
+ const baseProps = {};
5932
+ for (const key in rawProps) {
5933
+ if (!(key in DOMTransitionPropsValidators)) {
5934
+ baseProps[key] = rawProps[key];
5935
+ }
5936
+ }
5937
+ if (rawProps.css === false) {
5938
+ return baseProps;
5939
+ }
5940
+ const {
5941
+ name = "v",
5942
+ type,
5943
+ duration,
5944
+ enterFromClass = `${name}-enter-from`,
5945
+ enterActiveClass = `${name}-enter-active`,
5946
+ enterToClass = `${name}-enter-to`,
5947
+ appearFromClass = enterFromClass,
5948
+ appearActiveClass = enterActiveClass,
5949
+ appearToClass = enterToClass,
5950
+ leaveFromClass = `${name}-leave-from`,
5951
+ leaveActiveClass = `${name}-leave-active`,
5952
+ leaveToClass = `${name}-leave-to`
5953
+ } = rawProps;
5954
+ const durations = normalizeDuration(duration);
5955
+ const enterDuration = durations && durations[0];
5956
+ const leaveDuration = durations && durations[1];
5957
+ const {
5958
+ onBeforeEnter,
5959
+ onEnter,
5960
+ onEnterCancelled,
5961
+ onLeave,
5962
+ onLeaveCancelled,
5963
+ onBeforeAppear = onBeforeEnter,
5964
+ onAppear = onEnter,
5965
+ onAppearCancelled = onEnterCancelled
5966
+ } = baseProps;
5967
+ const finishEnter = (el, isAppear, done) => {
5968
+ removeTransitionClass(el, isAppear ? appearToClass : enterToClass);
5969
+ removeTransitionClass(el, isAppear ? appearActiveClass : enterActiveClass);
5970
+ done && done();
5971
+ };
5972
+ const finishLeave = (el, done) => {
5973
+ el._isLeaving = false;
5974
+ removeTransitionClass(el, leaveFromClass);
5975
+ removeTransitionClass(el, leaveToClass);
5976
+ removeTransitionClass(el, leaveActiveClass);
5977
+ done && done();
5978
+ };
5979
+ const makeEnterHook = (isAppear) => {
5980
+ return (el, done) => {
5981
+ const hook = isAppear ? onAppear : onEnter;
5982
+ const resolve2 = () => finishEnter(el, isAppear, done);
5983
+ callHook(hook, [el, resolve2]);
5984
+ nextFrame(() => {
5985
+ removeTransitionClass(el, isAppear ? appearFromClass : enterFromClass);
5986
+ addTransitionClass(el, isAppear ? appearToClass : enterToClass);
5987
+ if (!hasExplicitCallback(hook)) {
5988
+ whenTransitionEnds(el, type, enterDuration, resolve2);
5989
+ }
5990
+ });
5991
+ };
5992
+ };
5993
+ return extend(baseProps, {
5994
+ onBeforeEnter(el) {
5995
+ callHook(onBeforeEnter, [el]);
5996
+ addTransitionClass(el, enterFromClass);
5997
+ addTransitionClass(el, enterActiveClass);
5998
+ },
5999
+ onBeforeAppear(el) {
6000
+ callHook(onBeforeAppear, [el]);
6001
+ addTransitionClass(el, appearFromClass);
6002
+ addTransitionClass(el, appearActiveClass);
6003
+ },
6004
+ onEnter: makeEnterHook(false),
6005
+ onAppear: makeEnterHook(true),
6006
+ onLeave(el, done) {
6007
+ el._isLeaving = true;
6008
+ const resolve2 = () => finishLeave(el, done);
6009
+ addTransitionClass(el, leaveFromClass);
6010
+ forceReflow();
6011
+ addTransitionClass(el, leaveActiveClass);
6012
+ nextFrame(() => {
6013
+ if (!el._isLeaving) {
6014
+ return;
6015
+ }
6016
+ removeTransitionClass(el, leaveFromClass);
6017
+ addTransitionClass(el, leaveToClass);
6018
+ if (!hasExplicitCallback(onLeave)) {
6019
+ whenTransitionEnds(el, type, leaveDuration, resolve2);
6020
+ }
6021
+ });
6022
+ callHook(onLeave, [el, resolve2]);
6023
+ },
6024
+ onEnterCancelled(el) {
6025
+ finishEnter(el, false);
6026
+ callHook(onEnterCancelled, [el]);
6027
+ },
6028
+ onAppearCancelled(el) {
6029
+ finishEnter(el, true);
6030
+ callHook(onAppearCancelled, [el]);
6031
+ },
6032
+ onLeaveCancelled(el) {
6033
+ finishLeave(el);
6034
+ callHook(onLeaveCancelled, [el]);
6035
+ }
6036
+ });
6037
+ }
6038
+ function normalizeDuration(duration) {
6039
+ if (duration == null) {
6040
+ return null;
6041
+ } else if (isObject(duration)) {
6042
+ return [NumberOf(duration.enter), NumberOf(duration.leave)];
6043
+ } else {
6044
+ const n = NumberOf(duration);
6045
+ return [n, n];
6046
+ }
6047
+ }
6048
+ function NumberOf(val) {
6049
+ const res = toNumber(val);
6050
+ return res;
6051
+ }
6052
+ function addTransitionClass(el, cls) {
6053
+ cls.split(/\s+/).forEach((c2) => c2 && el.classList.add(c2));
6054
+ (el._vtc || (el._vtc = /* @__PURE__ */ new Set())).add(cls);
6055
+ }
6056
+ function removeTransitionClass(el, cls) {
6057
+ cls.split(/\s+/).forEach((c2) => c2 && el.classList.remove(c2));
6058
+ const { _vtc } = el;
6059
+ if (_vtc) {
6060
+ _vtc.delete(cls);
6061
+ if (!_vtc.size) {
6062
+ el._vtc = void 0;
6063
+ }
6064
+ }
6065
+ }
6066
+ function nextFrame(cb) {
6067
+ requestAnimationFrame(() => {
6068
+ requestAnimationFrame(cb);
6069
+ });
6070
+ }
6071
+ let endId = 0;
6072
+ function whenTransitionEnds(el, expectedType, explicitTimeout, resolve2) {
6073
+ const id = el._endId = ++endId;
6074
+ const resolveIfNotStale = () => {
6075
+ if (id === el._endId) {
6076
+ resolve2();
6077
+ }
6078
+ };
6079
+ if (explicitTimeout) {
6080
+ return setTimeout(resolveIfNotStale, explicitTimeout);
6081
+ }
6082
+ const { type, timeout, propCount } = getTransitionInfo(el, expectedType);
6083
+ if (!type) {
6084
+ return resolve2();
6085
+ }
6086
+ const endEvent = type + "end";
6087
+ let ended = 0;
6088
+ const end = () => {
6089
+ el.removeEventListener(endEvent, onEnd);
6090
+ resolveIfNotStale();
6091
+ };
6092
+ const onEnd = (e) => {
6093
+ if (e.target === el && ++ended >= propCount) {
6094
+ end();
6095
+ }
6096
+ };
6097
+ setTimeout(() => {
6098
+ if (ended < propCount) {
6099
+ end();
6100
+ }
6101
+ }, timeout + 1);
6102
+ el.addEventListener(endEvent, onEnd);
6103
+ }
6104
+ function getTransitionInfo(el, expectedType) {
6105
+ const styles = window.getComputedStyle(el);
6106
+ const getStyleProperties = (key) => (styles[key] || "").split(", ");
6107
+ const transitionDelays = getStyleProperties(`${TRANSITION}Delay`);
6108
+ const transitionDurations = getStyleProperties(`${TRANSITION}Duration`);
6109
+ const transitionTimeout = getTimeout(transitionDelays, transitionDurations);
6110
+ const animationDelays = getStyleProperties(`${ANIMATION}Delay`);
6111
+ const animationDurations = getStyleProperties(`${ANIMATION}Duration`);
6112
+ const animationTimeout = getTimeout(animationDelays, animationDurations);
6113
+ let type = null;
6114
+ let timeout = 0;
6115
+ let propCount = 0;
6116
+ if (expectedType === TRANSITION) {
6117
+ if (transitionTimeout > 0) {
6118
+ type = TRANSITION;
6119
+ timeout = transitionTimeout;
6120
+ propCount = transitionDurations.length;
6121
+ }
6122
+ } else if (expectedType === ANIMATION) {
6123
+ if (animationTimeout > 0) {
6124
+ type = ANIMATION;
6125
+ timeout = animationTimeout;
6126
+ propCount = animationDurations.length;
6127
+ }
6128
+ } else {
6129
+ timeout = Math.max(transitionTimeout, animationTimeout);
6130
+ type = timeout > 0 ? transitionTimeout > animationTimeout ? TRANSITION : ANIMATION : null;
6131
+ propCount = type ? type === TRANSITION ? transitionDurations.length : animationDurations.length : 0;
6132
+ }
6133
+ const hasTransform = type === TRANSITION && /\b(transform|all)(,|$)/.test(
6134
+ getStyleProperties(`${TRANSITION}Property`).toString()
6135
+ );
6136
+ return {
6137
+ type,
6138
+ timeout,
6139
+ propCount,
6140
+ hasTransform
6141
+ };
6142
+ }
6143
+ function getTimeout(delays, durations) {
6144
+ while (delays.length < durations.length) {
6145
+ delays = delays.concat(delays);
6146
+ }
6147
+ return Math.max(...durations.map((d2, i) => toMs(d2) + toMs(delays[i])));
6148
+ }
6149
+ function toMs(s) {
6150
+ return Number(s.slice(0, -1).replace(",", ".")) * 1e3;
6151
+ }
6152
+ function forceReflow() {
6153
+ return document.body.offsetHeight;
6154
+ }
5575
6155
  const getModelAssigner = (vnode) => {
5576
6156
  const fn = vnode.props["onUpdate:modelValue"] || false;
5577
6157
  return isArray(fn) ? (value) => invokeArrayFns(fn, value) : fn;
@@ -8426,6 +9006,21 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
8426
9006
  }
8427
9007
  return (_c = (_b = (_a = parts == null ? void 0 : parts.map((part) => part.replace(/(^\/+|\/+$)/g, ""))) == null ? void 0 : _a.filter((part) => part !== "")) == null ? void 0 : _b.join("/")) != null ? _c : "";
8428
9008
  };
9009
+ const checkHasFullImageUrl = (imageUrl) => typeof imageUrl === "string" && (imageUrl.indexOf("http://") === 0 || imageUrl.indexOf("https://") === 0);
9010
+ const computeImageUrl = (imageUrl, rootImageUrl) => {
9011
+ const mainUrl = Array.isArray(imageUrl) ? imageUrl[0] : imageUrl;
9012
+ if (checkHasFullImageUrl(mainUrl)) {
9013
+ return mainUrl;
9014
+ }
9015
+ return rootImageUrl ? joinUrlParts(rootImageUrl, mainUrl) : `/${mainUrl}`;
9016
+ };
9017
+ const replaceImageWithPlaceholder = (e, placeholder) => {
9018
+ var _a;
9019
+ const targetImage = e == null ? void 0 : e.target;
9020
+ if (targetImage && !((_a = targetImage == null ? void 0 : targetImage.src) == null ? void 0 : _a.includes(placeholder))) {
9021
+ targetImage.src = placeholder;
9022
+ }
9023
+ };
8429
9024
  const _hoisted_1$17 = ["src"];
8430
9025
  const _sfc_main$1d = /* @__PURE__ */ defineComponent({
8431
9026
  __name: "ProductImage",
@@ -8437,33 +9032,73 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
8437
9032
  },
8438
9033
  setup(__props) {
8439
9034
  const props = __props;
9035
+ const isHover = ref(false);
9036
+ const hoverImageIndex = ref(0);
9037
+ const hoverInterval = ref(0);
8440
9038
  const rootImageUrl = computed(() => props.options.baseUrl);
8441
9039
  const image = computed(() => props.item[props.options.key]);
8442
9040
  const hasFullImageUrl = computed(() => {
8443
- const imageUrl2 = image.value;
8444
- return typeof imageUrl2 === "string" && (imageUrl2.indexOf("http://") === 0 || imageUrl2.indexOf("https://") === 0);
9041
+ return checkHasFullImageUrl(image.value);
8445
9042
  });
8446
9043
  const imageUrl = computed(() => {
8447
- const imageUrl2 = image.value;
8448
- if (hasFullImageUrl.value) {
8449
- return imageUrl2;
8450
- }
8451
- return rootImageUrl.value ? joinUrlParts(rootImageUrl.value, imageUrl2) : `/${imageUrl2}`;
9044
+ return computeImageUrl(image.value, rootImageUrl.value);
8452
9045
  });
8453
9046
  const hasImage = computed(() => Boolean(hasFullImageUrl.value || image.value));
8454
9047
  const placeholder = computed(() => props.options.placeholder);
8455
- const finalUrl = computed(() => {
9048
+ const finalMainImageUrl = computed(() => {
8456
9049
  if (props.options.customUrl) {
8457
9050
  return props.options.customUrl(props.item);
8458
9051
  }
8459
9052
  return hasImage.value ? imageUrl.value : placeholder.value;
8460
9053
  });
8461
- const replaceWithPlaceholder = (e) => {
9054
+ const hoverImages = computed(() => {
9055
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
9056
+ if ((_a = props.options.hoverImages) == null ? void 0 : _a.key) {
9057
+ return (_g = (_f = (_e = props.item[(_b = props.options.hoverImages) == null ? void 0 : _b.key]) == null ? void 0 : _e.slice(0, (_d = (_c = props.options.hoverImages) == null ? void 0 : _c.maxImages) != null ? _d : 5)) == null ? void 0 : _f.map((i) => computeImageUrl(i, rootImageUrl.value))) != null ? _g : [];
9058
+ }
9059
+ if (props.options.hoverImages) {
9060
+ return (_l = (_k = (_h = props.options.hoverImages) == null ? void 0 : _h.display(props.item)) == null ? void 0 : _k.slice(0, (_j = (_i = props.options.hoverImages) == null ? void 0 : _i.maxImages) != null ? _j : 5)) != null ? _l : [];
9061
+ }
9062
+ return [];
9063
+ });
9064
+ const hasHoverImages = computed(() => {
8462
9065
  var _a;
8463
- const targetImage = e == null ? void 0 : e.target;
8464
- if (targetImage && !((_a = targetImage == null ? void 0 : targetImage.src) == null ? void 0 : _a.includes(placeholder.value))) {
8465
- targetImage.src = placeholder.value;
9066
+ return Boolean((_a = hoverImages.value) == null ? void 0 : _a.length);
9067
+ });
9068
+ const replaceWithPlaceholder = (e) => {
9069
+ replaceImageWithPlaceholder(e, placeholder.value);
9070
+ };
9071
+ const setNextHoverImage = () => {
9072
+ hoverImageIndex.value = (hoverImageIndex.value + 1) % hoverImages.value.length;
9073
+ };
9074
+ const currentHoverImage = computed(() => {
9075
+ return hoverImages.value[hoverImageIndex.value];
9076
+ });
9077
+ const finalUrl = computed(() => {
9078
+ return isHover.value ? currentHoverImage.value : finalMainImageUrl.value;
9079
+ });
9080
+ const handleMouseEnter = () => {
9081
+ var _a, _b;
9082
+ if (!hasHoverImages.value) {
9083
+ return;
8466
9084
  }
9085
+ isHover.value = true;
9086
+ hoverImageIndex.value = 0;
9087
+ if (hoverInterval.value) {
9088
+ return;
9089
+ }
9090
+ hoverInterval.value = setInterval(
9091
+ setNextHoverImage,
9092
+ (_b = (_a = props.options.hoverImages) == null ? void 0 : _a.cycleInterval) != null ? _b : 2e3
9093
+ );
9094
+ };
9095
+ const handleMouseLeave = () => {
9096
+ if (!hasHoverImages.value) {
9097
+ return;
9098
+ }
9099
+ isHover.value = false;
9100
+ clearInterval(hoverInterval.value);
9101
+ hoverInterval.value = 0;
8467
9102
  };
8468
9103
  const imageAlt = computed(() => {
8469
9104
  const alt = props.options.alt;
@@ -8472,16 +9107,44 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
8472
9107
  }
8473
9108
  return "";
8474
9109
  });
9110
+ const preloadImages = (images) => {
9111
+ images.forEach((src) => {
9112
+ const img = new Image();
9113
+ img.src = src;
9114
+ });
9115
+ };
9116
+ onMounted(() => {
9117
+ if (hasHoverImages.value) {
9118
+ preloadImages(hoverImages.value);
9119
+ }
9120
+ });
9121
+ watch(hoverImages, (newImages) => {
9122
+ if (newImages.length) {
9123
+ preloadImages(newImages);
9124
+ }
9125
+ });
9126
+ onBeforeUnmount(() => {
9127
+ clearInterval(hoverInterval.value);
9128
+ });
8475
9129
  return (_ctx, _cache) => {
8476
- var _a, _b;
8477
9130
  return openBlock(), createElementBlock("div", {
8478
- class: normalizeClass((_a = _ctx.wrapperClass) != null ? _a : "")
9131
+ class: normalizeClass({ [_ctx.wrapperClass]: Boolean(_ctx.wrapperClass), "lupa-images-hover": isHover.value }),
9132
+ onMouseenter: handleMouseEnter,
9133
+ onMouseleave: handleMouseLeave
8479
9134
  }, [
8480
- createBaseVNode("img", mergeProps({
8481
- class: (_b = _ctx.imageClass) != null ? _b : "",
8482
- src: finalUrl.value
8483
- }, { alt: imageAlt.value ? imageAlt.value : void 0 }, { onError: replaceWithPlaceholder }), null, 16, _hoisted_1$17)
8484
- ], 2);
9135
+ createVNode(Transition, { name: "lupa-fade" }, {
9136
+ default: withCtx(() => [
9137
+ (openBlock(), createElementBlock("img", mergeProps({
9138
+ class: ["lupa-images-hover-image", { [_ctx.imageClass]: true, "lupa-images-hover-image": isHover.value }],
9139
+ src: finalUrl.value
9140
+ }, { alt: imageAlt.value ? imageAlt.value : void 0 }, {
9141
+ onError: replaceWithPlaceholder,
9142
+ key: finalUrl.value
9143
+ }), null, 16, _hoisted_1$17))
9144
+ ]),
9145
+ _: 1
9146
+ })
9147
+ ], 34);
8485
9148
  };
8486
9149
  }
8487
9150
  });
@@ -17314,8 +17977,8 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
17314
17977
  function createRelationalOperation(operator) {
17315
17978
  return function(value, other) {
17316
17979
  if (!(typeof value == "string" && typeof other == "string")) {
17317
- value = toNumber(value);
17318
- other = toNumber(other);
17980
+ value = toNumber2(value);
17981
+ other = toNumber2(other);
17319
17982
  }
17320
17983
  return operator(value, other);
17321
17984
  };
@@ -17349,7 +18012,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
17349
18012
  function createRound(methodName) {
17350
18013
  var func = Math2[methodName];
17351
18014
  return function(number, precision) {
17352
- number = toNumber(number);
18015
+ number = toNumber2(number);
17353
18016
  precision = precision == null ? 0 : nativeMin(toInteger(precision), 292);
17354
18017
  if (precision && nativeIsFinite(number)) {
17355
18018
  var pair = (toString(number) + "e").split("e"), value = func(pair[0] + "e" + (+pair[1] + precision));
@@ -18707,11 +19370,11 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
18707
19370
  if (typeof func != "function") {
18708
19371
  throw new TypeError2(FUNC_ERROR_TEXT);
18709
19372
  }
18710
- wait = toNumber(wait) || 0;
19373
+ wait = toNumber2(wait) || 0;
18711
19374
  if (isObject2(options)) {
18712
19375
  leading = !!options.leading;
18713
19376
  maxing = "maxWait" in options;
18714
- maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait;
19377
+ maxWait = maxing ? nativeMax(toNumber2(options.maxWait) || 0, wait) : maxWait;
18715
19378
  trailing = "trailing" in options ? !!options.trailing : trailing;
18716
19379
  }
18717
19380
  function invokeFunc(time) {
@@ -18787,7 +19450,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
18787
19450
  return baseDelay(func, 1, args);
18788
19451
  });
18789
19452
  var delay = baseRest(function(func, wait, args) {
18790
- return baseDelay(func, toNumber(wait) || 0, args);
19453
+ return baseDelay(func, toNumber2(wait) || 0, args);
18791
19454
  });
18792
19455
  function flip(func) {
18793
19456
  return createWrap(func, WRAP_FLIP_FLAG);
@@ -19084,7 +19747,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
19084
19747
  if (!value) {
19085
19748
  return value === 0 ? value : 0;
19086
19749
  }
19087
- value = toNumber(value);
19750
+ value = toNumber2(value);
19088
19751
  if (value === INFINITY || value === -INFINITY) {
19089
19752
  var sign = value < 0 ? -1 : 1;
19090
19753
  return sign * MAX_INTEGER;
@@ -19098,7 +19761,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
19098
19761
  function toLength(value) {
19099
19762
  return value ? baseClamp(toInteger(value), 0, MAX_ARRAY_LENGTH) : 0;
19100
19763
  }
19101
- function toNumber(value) {
19764
+ function toNumber2(value) {
19102
19765
  if (typeof value == "number") {
19103
19766
  return value;
19104
19767
  }
@@ -19361,14 +20024,14 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
19361
20024
  lower = undefined$1;
19362
20025
  }
19363
20026
  if (upper !== undefined$1) {
19364
- upper = toNumber(upper);
20027
+ upper = toNumber2(upper);
19365
20028
  upper = upper === upper ? upper : 0;
19366
20029
  }
19367
20030
  if (lower !== undefined$1) {
19368
- lower = toNumber(lower);
20031
+ lower = toNumber2(lower);
19369
20032
  lower = lower === lower ? lower : 0;
19370
20033
  }
19371
- return baseClamp(toNumber(number), lower, upper);
20034
+ return baseClamp(toNumber2(number), lower, upper);
19372
20035
  }
19373
20036
  function inRange(number, start, end) {
19374
20037
  start = toFinite(start);
@@ -19378,7 +20041,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
19378
20041
  } else {
19379
20042
  end = toFinite(end);
19380
20043
  }
19381
- number = toNumber(number);
20044
+ number = toNumber2(number);
19382
20045
  return baseInRange(number, start, end);
19383
20046
  }
19384
20047
  function random(lower, upper, floating) {
@@ -20164,7 +20827,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20164
20827
  lodash2.toInteger = toInteger;
20165
20828
  lodash2.toLength = toLength;
20166
20829
  lodash2.toLower = toLower;
20167
- lodash2.toNumber = toNumber;
20830
+ lodash2.toNumber = toNumber2;
20168
20831
  lodash2.toSafeInteger = toSafeInteger;
20169
20832
  lodash2.toString = toString;
20170
20833
  lodash2.toUpper = toUpper;
@@ -24310,8 +24973,8 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
24310
24973
  function createRelationalOperation(operator) {
24311
24974
  return function(value, other) {
24312
24975
  if (!(typeof value == "string" && typeof other == "string")) {
24313
- value = toNumber(value);
24314
- other = toNumber(other);
24976
+ value = toNumber2(value);
24977
+ other = toNumber2(other);
24315
24978
  }
24316
24979
  return operator(value, other);
24317
24980
  };
@@ -24345,7 +25008,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
24345
25008
  function createRound(methodName) {
24346
25009
  var func = Math2[methodName];
24347
25010
  return function(number, precision) {
24348
- number = toNumber(number);
25011
+ number = toNumber2(number);
24349
25012
  precision = precision == null ? 0 : nativeMin(toInteger(precision), 292);
24350
25013
  if (precision && nativeIsFinite(number)) {
24351
25014
  var pair = (toString(number) + "e").split("e"), value = func(pair[0] + "e" + (+pair[1] + precision));
@@ -25703,11 +26366,11 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
25703
26366
  if (typeof func != "function") {
25704
26367
  throw new TypeError2(FUNC_ERROR_TEXT);
25705
26368
  }
25706
- wait = toNumber(wait) || 0;
26369
+ wait = toNumber2(wait) || 0;
25707
26370
  if (isObject2(options)) {
25708
26371
  leading = !!options.leading;
25709
26372
  maxing = "maxWait" in options;
25710
- maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait;
26373
+ maxWait = maxing ? nativeMax(toNumber2(options.maxWait) || 0, wait) : maxWait;
25711
26374
  trailing = "trailing" in options ? !!options.trailing : trailing;
25712
26375
  }
25713
26376
  function invokeFunc(time) {
@@ -25783,7 +26446,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
25783
26446
  return baseDelay(func, 1, args);
25784
26447
  });
25785
26448
  var delay = baseRest(function(func, wait, args) {
25786
- return baseDelay(func, toNumber(wait) || 0, args);
26449
+ return baseDelay(func, toNumber2(wait) || 0, args);
25787
26450
  });
25788
26451
  function flip(func) {
25789
26452
  return createWrap(func, WRAP_FLIP_FLAG);
@@ -26080,7 +26743,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
26080
26743
  if (!value) {
26081
26744
  return value === 0 ? value : 0;
26082
26745
  }
26083
- value = toNumber(value);
26746
+ value = toNumber2(value);
26084
26747
  if (value === INFINITY || value === -INFINITY) {
26085
26748
  var sign = value < 0 ? -1 : 1;
26086
26749
  return sign * MAX_INTEGER;
@@ -26094,7 +26757,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
26094
26757
  function toLength(value) {
26095
26758
  return value ? baseClamp(toInteger(value), 0, MAX_ARRAY_LENGTH) : 0;
26096
26759
  }
26097
- function toNumber(value) {
26760
+ function toNumber2(value) {
26098
26761
  if (typeof value == "number") {
26099
26762
  return value;
26100
26763
  }
@@ -26357,14 +27020,14 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
26357
27020
  lower = undefined$1;
26358
27021
  }
26359
27022
  if (upper !== undefined$1) {
26360
- upper = toNumber(upper);
27023
+ upper = toNumber2(upper);
26361
27024
  upper = upper === upper ? upper : 0;
26362
27025
  }
26363
27026
  if (lower !== undefined$1) {
26364
- lower = toNumber(lower);
27027
+ lower = toNumber2(lower);
26365
27028
  lower = lower === lower ? lower : 0;
26366
27029
  }
26367
- return baseClamp(toNumber(number), lower, upper);
27030
+ return baseClamp(toNumber2(number), lower, upper);
26368
27031
  }
26369
27032
  function inRange(number, start, end) {
26370
27033
  start = toFinite(start);
@@ -26374,7 +27037,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
26374
27037
  } else {
26375
27038
  end = toFinite(end);
26376
27039
  }
26377
- number = toNumber(number);
27040
+ number = toNumber2(number);
26378
27041
  return baseInRange(number, start, end);
26379
27042
  }
26380
27043
  function random(lower, upper, floating) {
@@ -27160,7 +27823,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
27160
27823
  lodash2.toInteger = toInteger;
27161
27824
  lodash2.toLength = toLength;
27162
27825
  lodash2.toLower = toLower;
27163
- lodash2.toNumber = toNumber;
27826
+ lodash2.toNumber = toNumber2;
27164
27827
  lodash2.toSafeInteger = toSafeInteger;
27165
27828
  lodash2.toString = toString;
27166
27829
  lodash2.toUpper = toUpper;