@getlupa/client 1.10.2 → 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.
@@ -104,6 +104,10 @@ const looseToNumber = (val) => {
104
104
  const n = parseFloat(val);
105
105
  return isNaN(n) ? val : n;
106
106
  };
107
+ const toNumber = (val) => {
108
+ const n = isString(val) ? Number(val) : NaN;
109
+ return isNaN(n) ? val : n;
110
+ };
107
111
  let _globalThis;
108
112
  const getGlobalThis = () => {
109
113
  return _globalThis || (_globalThis = typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : {});
@@ -2002,6 +2006,319 @@ function invokeDirectiveHook(vnode, prevVNode, instance, name) {
2002
2006
  }
2003
2007
  }
2004
2008
  }
2009
+ function useTransitionState() {
2010
+ const state = {
2011
+ isMounted: false,
2012
+ isLeaving: false,
2013
+ isUnmounting: false,
2014
+ leavingVNodes: /* @__PURE__ */ new Map()
2015
+ };
2016
+ onMounted(() => {
2017
+ state.isMounted = true;
2018
+ });
2019
+ onBeforeUnmount(() => {
2020
+ state.isUnmounting = true;
2021
+ });
2022
+ return state;
2023
+ }
2024
+ const TransitionHookValidator = [Function, Array];
2025
+ const BaseTransitionPropsValidators = {
2026
+ mode: String,
2027
+ appear: Boolean,
2028
+ persisted: Boolean,
2029
+ // enter
2030
+ onBeforeEnter: TransitionHookValidator,
2031
+ onEnter: TransitionHookValidator,
2032
+ onAfterEnter: TransitionHookValidator,
2033
+ onEnterCancelled: TransitionHookValidator,
2034
+ // leave
2035
+ onBeforeLeave: TransitionHookValidator,
2036
+ onLeave: TransitionHookValidator,
2037
+ onAfterLeave: TransitionHookValidator,
2038
+ onLeaveCancelled: TransitionHookValidator,
2039
+ // appear
2040
+ onBeforeAppear: TransitionHookValidator,
2041
+ onAppear: TransitionHookValidator,
2042
+ onAfterAppear: TransitionHookValidator,
2043
+ onAppearCancelled: TransitionHookValidator
2044
+ };
2045
+ const BaseTransitionImpl = {
2046
+ name: `BaseTransition`,
2047
+ props: BaseTransitionPropsValidators,
2048
+ setup(props, { slots }) {
2049
+ const instance = getCurrentInstance();
2050
+ const state = useTransitionState();
2051
+ let prevTransitionKey;
2052
+ return () => {
2053
+ const children = slots.default && getTransitionRawChildren(slots.default(), true);
2054
+ if (!children || !children.length) {
2055
+ return;
2056
+ }
2057
+ let child = children[0];
2058
+ if (children.length > 1) {
2059
+ for (const c2 of children) {
2060
+ if (c2.type !== Comment) {
2061
+ child = c2;
2062
+ break;
2063
+ }
2064
+ }
2065
+ }
2066
+ const rawProps = toRaw(props);
2067
+ const { mode } = rawProps;
2068
+ if (state.isLeaving) {
2069
+ return emptyPlaceholder(child);
2070
+ }
2071
+ const innerChild = getKeepAliveChild(child);
2072
+ if (!innerChild) {
2073
+ return emptyPlaceholder(child);
2074
+ }
2075
+ const enterHooks = resolveTransitionHooks(
2076
+ innerChild,
2077
+ rawProps,
2078
+ state,
2079
+ instance
2080
+ );
2081
+ setTransitionHooks(innerChild, enterHooks);
2082
+ const oldChild = instance.subTree;
2083
+ const oldInnerChild = oldChild && getKeepAliveChild(oldChild);
2084
+ let transitionKeyChanged = false;
2085
+ const { getTransitionKey } = innerChild.type;
2086
+ if (getTransitionKey) {
2087
+ const key = getTransitionKey();
2088
+ if (prevTransitionKey === void 0) {
2089
+ prevTransitionKey = key;
2090
+ } else if (key !== prevTransitionKey) {
2091
+ prevTransitionKey = key;
2092
+ transitionKeyChanged = true;
2093
+ }
2094
+ }
2095
+ if (oldInnerChild && oldInnerChild.type !== Comment && (!isSameVNodeType(innerChild, oldInnerChild) || transitionKeyChanged)) {
2096
+ const leavingHooks = resolveTransitionHooks(
2097
+ oldInnerChild,
2098
+ rawProps,
2099
+ state,
2100
+ instance
2101
+ );
2102
+ setTransitionHooks(oldInnerChild, leavingHooks);
2103
+ if (mode === "out-in") {
2104
+ state.isLeaving = true;
2105
+ leavingHooks.afterLeave = () => {
2106
+ state.isLeaving = false;
2107
+ if (instance.update.active !== false) {
2108
+ instance.update();
2109
+ }
2110
+ };
2111
+ return emptyPlaceholder(child);
2112
+ } else if (mode === "in-out" && innerChild.type !== Comment) {
2113
+ leavingHooks.delayLeave = (el, earlyRemove, delayedLeave) => {
2114
+ const leavingVNodesCache = getLeavingNodesForType(
2115
+ state,
2116
+ oldInnerChild
2117
+ );
2118
+ leavingVNodesCache[String(oldInnerChild.key)] = oldInnerChild;
2119
+ el._leaveCb = () => {
2120
+ earlyRemove();
2121
+ el._leaveCb = void 0;
2122
+ delete enterHooks.delayedLeave;
2123
+ };
2124
+ enterHooks.delayedLeave = delayedLeave;
2125
+ };
2126
+ }
2127
+ }
2128
+ return child;
2129
+ };
2130
+ }
2131
+ };
2132
+ const BaseTransition = BaseTransitionImpl;
2133
+ function getLeavingNodesForType(state, vnode) {
2134
+ const { leavingVNodes } = state;
2135
+ let leavingVNodesCache = leavingVNodes.get(vnode.type);
2136
+ if (!leavingVNodesCache) {
2137
+ leavingVNodesCache = /* @__PURE__ */ Object.create(null);
2138
+ leavingVNodes.set(vnode.type, leavingVNodesCache);
2139
+ }
2140
+ return leavingVNodesCache;
2141
+ }
2142
+ function resolveTransitionHooks(vnode, props, state, instance) {
2143
+ const {
2144
+ appear,
2145
+ mode,
2146
+ persisted = false,
2147
+ onBeforeEnter,
2148
+ onEnter,
2149
+ onAfterEnter,
2150
+ onEnterCancelled,
2151
+ onBeforeLeave,
2152
+ onLeave,
2153
+ onAfterLeave,
2154
+ onLeaveCancelled,
2155
+ onBeforeAppear,
2156
+ onAppear,
2157
+ onAfterAppear,
2158
+ onAppearCancelled
2159
+ } = props;
2160
+ const key = String(vnode.key);
2161
+ const leavingVNodesCache = getLeavingNodesForType(state, vnode);
2162
+ const callHook2 = (hook, args) => {
2163
+ hook && callWithAsyncErrorHandling(
2164
+ hook,
2165
+ instance,
2166
+ 9,
2167
+ args
2168
+ );
2169
+ };
2170
+ const callAsyncHook = (hook, args) => {
2171
+ const done = args[1];
2172
+ callHook2(hook, args);
2173
+ if (isArray(hook)) {
2174
+ if (hook.every((hook2) => hook2.length <= 1))
2175
+ done();
2176
+ } else if (hook.length <= 1) {
2177
+ done();
2178
+ }
2179
+ };
2180
+ const hooks = {
2181
+ mode,
2182
+ persisted,
2183
+ beforeEnter(el) {
2184
+ let hook = onBeforeEnter;
2185
+ if (!state.isMounted) {
2186
+ if (appear) {
2187
+ hook = onBeforeAppear || onBeforeEnter;
2188
+ } else {
2189
+ return;
2190
+ }
2191
+ }
2192
+ if (el._leaveCb) {
2193
+ el._leaveCb(
2194
+ true
2195
+ /* cancelled */
2196
+ );
2197
+ }
2198
+ const leavingVNode = leavingVNodesCache[key];
2199
+ if (leavingVNode && isSameVNodeType(vnode, leavingVNode) && leavingVNode.el._leaveCb) {
2200
+ leavingVNode.el._leaveCb();
2201
+ }
2202
+ callHook2(hook, [el]);
2203
+ },
2204
+ enter(el) {
2205
+ let hook = onEnter;
2206
+ let afterHook = onAfterEnter;
2207
+ let cancelHook = onEnterCancelled;
2208
+ if (!state.isMounted) {
2209
+ if (appear) {
2210
+ hook = onAppear || onEnter;
2211
+ afterHook = onAfterAppear || onAfterEnter;
2212
+ cancelHook = onAppearCancelled || onEnterCancelled;
2213
+ } else {
2214
+ return;
2215
+ }
2216
+ }
2217
+ let called = false;
2218
+ const done = el._enterCb = (cancelled) => {
2219
+ if (called)
2220
+ return;
2221
+ called = true;
2222
+ if (cancelled) {
2223
+ callHook2(cancelHook, [el]);
2224
+ } else {
2225
+ callHook2(afterHook, [el]);
2226
+ }
2227
+ if (hooks.delayedLeave) {
2228
+ hooks.delayedLeave();
2229
+ }
2230
+ el._enterCb = void 0;
2231
+ };
2232
+ if (hook) {
2233
+ callAsyncHook(hook, [el, done]);
2234
+ } else {
2235
+ done();
2236
+ }
2237
+ },
2238
+ leave(el, remove2) {
2239
+ const key2 = String(vnode.key);
2240
+ if (el._enterCb) {
2241
+ el._enterCb(
2242
+ true
2243
+ /* cancelled */
2244
+ );
2245
+ }
2246
+ if (state.isUnmounting) {
2247
+ return remove2();
2248
+ }
2249
+ callHook2(onBeforeLeave, [el]);
2250
+ let called = false;
2251
+ const done = el._leaveCb = (cancelled) => {
2252
+ if (called)
2253
+ return;
2254
+ called = true;
2255
+ remove2();
2256
+ if (cancelled) {
2257
+ callHook2(onLeaveCancelled, [el]);
2258
+ } else {
2259
+ callHook2(onAfterLeave, [el]);
2260
+ }
2261
+ el._leaveCb = void 0;
2262
+ if (leavingVNodesCache[key2] === vnode) {
2263
+ delete leavingVNodesCache[key2];
2264
+ }
2265
+ };
2266
+ leavingVNodesCache[key2] = vnode;
2267
+ if (onLeave) {
2268
+ callAsyncHook(onLeave, [el, done]);
2269
+ } else {
2270
+ done();
2271
+ }
2272
+ },
2273
+ clone(vnode2) {
2274
+ return resolveTransitionHooks(vnode2, props, state, instance);
2275
+ }
2276
+ };
2277
+ return hooks;
2278
+ }
2279
+ function emptyPlaceholder(vnode) {
2280
+ if (isKeepAlive(vnode)) {
2281
+ vnode = cloneVNode(vnode);
2282
+ vnode.children = null;
2283
+ return vnode;
2284
+ }
2285
+ }
2286
+ function getKeepAliveChild(vnode) {
2287
+ return isKeepAlive(vnode) ? vnode.children ? vnode.children[0] : void 0 : vnode;
2288
+ }
2289
+ function setTransitionHooks(vnode, hooks) {
2290
+ if (vnode.shapeFlag & 6 && vnode.component) {
2291
+ setTransitionHooks(vnode.component.subTree, hooks);
2292
+ } else if (vnode.shapeFlag & 128) {
2293
+ vnode.ssContent.transition = hooks.clone(vnode.ssContent);
2294
+ vnode.ssFallback.transition = hooks.clone(vnode.ssFallback);
2295
+ } else {
2296
+ vnode.transition = hooks;
2297
+ }
2298
+ }
2299
+ function getTransitionRawChildren(children, keepComment = false, parentKey) {
2300
+ let ret = [];
2301
+ let keyedFragmentCount = 0;
2302
+ for (let i = 0; i < children.length; i++) {
2303
+ let child = children[i];
2304
+ const key = parentKey == null ? child.key : String(parentKey) + String(child.key != null ? child.key : i);
2305
+ if (child.type === Fragment) {
2306
+ if (child.patchFlag & 128)
2307
+ keyedFragmentCount++;
2308
+ ret = ret.concat(
2309
+ getTransitionRawChildren(child.children, keepComment, key)
2310
+ );
2311
+ } else if (keepComment || child.type !== Comment) {
2312
+ ret.push(key != null ? cloneVNode(child, { key }) : child);
2313
+ }
2314
+ }
2315
+ if (keyedFragmentCount > 1) {
2316
+ for (let i = 0; i < ret.length; i++) {
2317
+ ret[i].patchFlag = -2;
2318
+ }
2319
+ }
2320
+ return ret;
2321
+ }
2005
2322
  function defineComponent(options, extraOptions) {
2006
2323
  return isFunction(options) ? (
2007
2324
  // #8326: extend call and options.name access are considered side-effects
@@ -2373,7 +2690,7 @@ function applyOptions(instance) {
2373
2690
  const ctx = instance.ctx;
2374
2691
  shouldCacheAccess = false;
2375
2692
  if (options.beforeCreate) {
2376
- callHook(options.beforeCreate, instance, "bc");
2693
+ callHook$1(options.beforeCreate, instance, "bc");
2377
2694
  }
2378
2695
  const {
2379
2696
  // state
@@ -2460,7 +2777,7 @@ function applyOptions(instance) {
2460
2777
  });
2461
2778
  }
2462
2779
  if (created) {
2463
- callHook(created, instance, "c");
2780
+ callHook$1(created, instance, "c");
2464
2781
  }
2465
2782
  function registerLifecycleHook(register, hook) {
2466
2783
  if (isArray(hook)) {
@@ -2538,7 +2855,7 @@ function resolveInjections(injectOptions, ctx, checkDuplicateProperties = NOOP)
2538
2855
  }
2539
2856
  }
2540
2857
  }
2541
- function callHook(hook, instance, type) {
2858
+ function callHook$1(hook, instance, type) {
2542
2859
  callWithAsyncErrorHandling(
2543
2860
  isArray(hook) ? hook.map((h2) => h2.bind(instance.proxy)) : hook.bind(instance.proxy),
2544
2861
  instance,
@@ -5040,6 +5357,7 @@ function createComponentInstance(vnode, parent, suspense) {
5040
5357
  return instance;
5041
5358
  }
5042
5359
  let currentInstance = null;
5360
+ const getCurrentInstance = () => currentInstance || currentRenderingInstance;
5043
5361
  let internalSetCurrentInstance;
5044
5362
  let globalCurrentInstanceSetters;
5045
5363
  let settersKey = "__VUE_INSTANCE_SETTERS__";
@@ -5570,6 +5888,268 @@ function shouldSetAsProp(el, key, value, isSVG) {
5570
5888
  }
5571
5889
  return key in el;
5572
5890
  }
5891
+ const TRANSITION = "transition";
5892
+ const ANIMATION = "animation";
5893
+ const Transition = (props, { slots }) => h$1(BaseTransition, resolveTransitionProps(props), slots);
5894
+ Transition.displayName = "Transition";
5895
+ const DOMTransitionPropsValidators = {
5896
+ name: String,
5897
+ type: String,
5898
+ css: {
5899
+ type: Boolean,
5900
+ default: true
5901
+ },
5902
+ duration: [String, Number, Object],
5903
+ enterFromClass: String,
5904
+ enterActiveClass: String,
5905
+ enterToClass: String,
5906
+ appearFromClass: String,
5907
+ appearActiveClass: String,
5908
+ appearToClass: String,
5909
+ leaveFromClass: String,
5910
+ leaveActiveClass: String,
5911
+ leaveToClass: String
5912
+ };
5913
+ Transition.props = /* @__PURE__ */ extend(
5914
+ {},
5915
+ BaseTransitionPropsValidators,
5916
+ DOMTransitionPropsValidators
5917
+ );
5918
+ const callHook = (hook, args = []) => {
5919
+ if (isArray(hook)) {
5920
+ hook.forEach((h2) => h2(...args));
5921
+ } else if (hook) {
5922
+ hook(...args);
5923
+ }
5924
+ };
5925
+ const hasExplicitCallback = (hook) => {
5926
+ return hook ? isArray(hook) ? hook.some((h2) => h2.length > 1) : hook.length > 1 : false;
5927
+ };
5928
+ function resolveTransitionProps(rawProps) {
5929
+ const baseProps = {};
5930
+ for (const key in rawProps) {
5931
+ if (!(key in DOMTransitionPropsValidators)) {
5932
+ baseProps[key] = rawProps[key];
5933
+ }
5934
+ }
5935
+ if (rawProps.css === false) {
5936
+ return baseProps;
5937
+ }
5938
+ const {
5939
+ name = "v",
5940
+ type,
5941
+ duration,
5942
+ enterFromClass = `${name}-enter-from`,
5943
+ enterActiveClass = `${name}-enter-active`,
5944
+ enterToClass = `${name}-enter-to`,
5945
+ appearFromClass = enterFromClass,
5946
+ appearActiveClass = enterActiveClass,
5947
+ appearToClass = enterToClass,
5948
+ leaveFromClass = `${name}-leave-from`,
5949
+ leaveActiveClass = `${name}-leave-active`,
5950
+ leaveToClass = `${name}-leave-to`
5951
+ } = rawProps;
5952
+ const durations = normalizeDuration(duration);
5953
+ const enterDuration = durations && durations[0];
5954
+ const leaveDuration = durations && durations[1];
5955
+ const {
5956
+ onBeforeEnter,
5957
+ onEnter,
5958
+ onEnterCancelled,
5959
+ onLeave,
5960
+ onLeaveCancelled,
5961
+ onBeforeAppear = onBeforeEnter,
5962
+ onAppear = onEnter,
5963
+ onAppearCancelled = onEnterCancelled
5964
+ } = baseProps;
5965
+ const finishEnter = (el, isAppear, done) => {
5966
+ removeTransitionClass(el, isAppear ? appearToClass : enterToClass);
5967
+ removeTransitionClass(el, isAppear ? appearActiveClass : enterActiveClass);
5968
+ done && done();
5969
+ };
5970
+ const finishLeave = (el, done) => {
5971
+ el._isLeaving = false;
5972
+ removeTransitionClass(el, leaveFromClass);
5973
+ removeTransitionClass(el, leaveToClass);
5974
+ removeTransitionClass(el, leaveActiveClass);
5975
+ done && done();
5976
+ };
5977
+ const makeEnterHook = (isAppear) => {
5978
+ return (el, done) => {
5979
+ const hook = isAppear ? onAppear : onEnter;
5980
+ const resolve2 = () => finishEnter(el, isAppear, done);
5981
+ callHook(hook, [el, resolve2]);
5982
+ nextFrame(() => {
5983
+ removeTransitionClass(el, isAppear ? appearFromClass : enterFromClass);
5984
+ addTransitionClass(el, isAppear ? appearToClass : enterToClass);
5985
+ if (!hasExplicitCallback(hook)) {
5986
+ whenTransitionEnds(el, type, enterDuration, resolve2);
5987
+ }
5988
+ });
5989
+ };
5990
+ };
5991
+ return extend(baseProps, {
5992
+ onBeforeEnter(el) {
5993
+ callHook(onBeforeEnter, [el]);
5994
+ addTransitionClass(el, enterFromClass);
5995
+ addTransitionClass(el, enterActiveClass);
5996
+ },
5997
+ onBeforeAppear(el) {
5998
+ callHook(onBeforeAppear, [el]);
5999
+ addTransitionClass(el, appearFromClass);
6000
+ addTransitionClass(el, appearActiveClass);
6001
+ },
6002
+ onEnter: makeEnterHook(false),
6003
+ onAppear: makeEnterHook(true),
6004
+ onLeave(el, done) {
6005
+ el._isLeaving = true;
6006
+ const resolve2 = () => finishLeave(el, done);
6007
+ addTransitionClass(el, leaveFromClass);
6008
+ forceReflow();
6009
+ addTransitionClass(el, leaveActiveClass);
6010
+ nextFrame(() => {
6011
+ if (!el._isLeaving) {
6012
+ return;
6013
+ }
6014
+ removeTransitionClass(el, leaveFromClass);
6015
+ addTransitionClass(el, leaveToClass);
6016
+ if (!hasExplicitCallback(onLeave)) {
6017
+ whenTransitionEnds(el, type, leaveDuration, resolve2);
6018
+ }
6019
+ });
6020
+ callHook(onLeave, [el, resolve2]);
6021
+ },
6022
+ onEnterCancelled(el) {
6023
+ finishEnter(el, false);
6024
+ callHook(onEnterCancelled, [el]);
6025
+ },
6026
+ onAppearCancelled(el) {
6027
+ finishEnter(el, true);
6028
+ callHook(onAppearCancelled, [el]);
6029
+ },
6030
+ onLeaveCancelled(el) {
6031
+ finishLeave(el);
6032
+ callHook(onLeaveCancelled, [el]);
6033
+ }
6034
+ });
6035
+ }
6036
+ function normalizeDuration(duration) {
6037
+ if (duration == null) {
6038
+ return null;
6039
+ } else if (isObject(duration)) {
6040
+ return [NumberOf(duration.enter), NumberOf(duration.leave)];
6041
+ } else {
6042
+ const n = NumberOf(duration);
6043
+ return [n, n];
6044
+ }
6045
+ }
6046
+ function NumberOf(val) {
6047
+ const res = toNumber(val);
6048
+ return res;
6049
+ }
6050
+ function addTransitionClass(el, cls) {
6051
+ cls.split(/\s+/).forEach((c2) => c2 && el.classList.add(c2));
6052
+ (el._vtc || (el._vtc = /* @__PURE__ */ new Set())).add(cls);
6053
+ }
6054
+ function removeTransitionClass(el, cls) {
6055
+ cls.split(/\s+/).forEach((c2) => c2 && el.classList.remove(c2));
6056
+ const { _vtc } = el;
6057
+ if (_vtc) {
6058
+ _vtc.delete(cls);
6059
+ if (!_vtc.size) {
6060
+ el._vtc = void 0;
6061
+ }
6062
+ }
6063
+ }
6064
+ function nextFrame(cb) {
6065
+ requestAnimationFrame(() => {
6066
+ requestAnimationFrame(cb);
6067
+ });
6068
+ }
6069
+ let endId = 0;
6070
+ function whenTransitionEnds(el, expectedType, explicitTimeout, resolve2) {
6071
+ const id = el._endId = ++endId;
6072
+ const resolveIfNotStale = () => {
6073
+ if (id === el._endId) {
6074
+ resolve2();
6075
+ }
6076
+ };
6077
+ if (explicitTimeout) {
6078
+ return setTimeout(resolveIfNotStale, explicitTimeout);
6079
+ }
6080
+ const { type, timeout, propCount } = getTransitionInfo(el, expectedType);
6081
+ if (!type) {
6082
+ return resolve2();
6083
+ }
6084
+ const endEvent = type + "end";
6085
+ let ended = 0;
6086
+ const end = () => {
6087
+ el.removeEventListener(endEvent, onEnd);
6088
+ resolveIfNotStale();
6089
+ };
6090
+ const onEnd = (e) => {
6091
+ if (e.target === el && ++ended >= propCount) {
6092
+ end();
6093
+ }
6094
+ };
6095
+ setTimeout(() => {
6096
+ if (ended < propCount) {
6097
+ end();
6098
+ }
6099
+ }, timeout + 1);
6100
+ el.addEventListener(endEvent, onEnd);
6101
+ }
6102
+ function getTransitionInfo(el, expectedType) {
6103
+ const styles = window.getComputedStyle(el);
6104
+ const getStyleProperties = (key) => (styles[key] || "").split(", ");
6105
+ const transitionDelays = getStyleProperties(`${TRANSITION}Delay`);
6106
+ const transitionDurations = getStyleProperties(`${TRANSITION}Duration`);
6107
+ const transitionTimeout = getTimeout(transitionDelays, transitionDurations);
6108
+ const animationDelays = getStyleProperties(`${ANIMATION}Delay`);
6109
+ const animationDurations = getStyleProperties(`${ANIMATION}Duration`);
6110
+ const animationTimeout = getTimeout(animationDelays, animationDurations);
6111
+ let type = null;
6112
+ let timeout = 0;
6113
+ let propCount = 0;
6114
+ if (expectedType === TRANSITION) {
6115
+ if (transitionTimeout > 0) {
6116
+ type = TRANSITION;
6117
+ timeout = transitionTimeout;
6118
+ propCount = transitionDurations.length;
6119
+ }
6120
+ } else if (expectedType === ANIMATION) {
6121
+ if (animationTimeout > 0) {
6122
+ type = ANIMATION;
6123
+ timeout = animationTimeout;
6124
+ propCount = animationDurations.length;
6125
+ }
6126
+ } else {
6127
+ timeout = Math.max(transitionTimeout, animationTimeout);
6128
+ type = timeout > 0 ? transitionTimeout > animationTimeout ? TRANSITION : ANIMATION : null;
6129
+ propCount = type ? type === TRANSITION ? transitionDurations.length : animationDurations.length : 0;
6130
+ }
6131
+ const hasTransform = type === TRANSITION && /\b(transform|all)(,|$)/.test(
6132
+ getStyleProperties(`${TRANSITION}Property`).toString()
6133
+ );
6134
+ return {
6135
+ type,
6136
+ timeout,
6137
+ propCount,
6138
+ hasTransform
6139
+ };
6140
+ }
6141
+ function getTimeout(delays, durations) {
6142
+ while (delays.length < durations.length) {
6143
+ delays = delays.concat(delays);
6144
+ }
6145
+ return Math.max(...durations.map((d2, i) => toMs(d2) + toMs(delays[i])));
6146
+ }
6147
+ function toMs(s) {
6148
+ return Number(s.slice(0, -1).replace(",", ".")) * 1e3;
6149
+ }
6150
+ function forceReflow() {
6151
+ return document.body.offsetHeight;
6152
+ }
5573
6153
  const getModelAssigner = (vnode) => {
5574
6154
  const fn = vnode.props["onUpdate:modelValue"] || false;
5575
6155
  return isArray(fn) ? (value) => invokeArrayFns(fn, value) : fn;
@@ -8424,6 +9004,21 @@ const joinUrlParts = (...parts) => {
8424
9004
  }
8425
9005
  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 : "";
8426
9006
  };
9007
+ const checkHasFullImageUrl = (imageUrl) => typeof imageUrl === "string" && (imageUrl.indexOf("http://") === 0 || imageUrl.indexOf("https://") === 0);
9008
+ const computeImageUrl = (imageUrl, rootImageUrl) => {
9009
+ const mainUrl = Array.isArray(imageUrl) ? imageUrl[0] : imageUrl;
9010
+ if (checkHasFullImageUrl(mainUrl)) {
9011
+ return mainUrl;
9012
+ }
9013
+ return rootImageUrl ? joinUrlParts(rootImageUrl, mainUrl) : `/${mainUrl}`;
9014
+ };
9015
+ const replaceImageWithPlaceholder = (e, placeholder) => {
9016
+ var _a;
9017
+ const targetImage = e == null ? void 0 : e.target;
9018
+ if (targetImage && !((_a = targetImage == null ? void 0 : targetImage.src) == null ? void 0 : _a.includes(placeholder))) {
9019
+ targetImage.src = placeholder;
9020
+ }
9021
+ };
8427
9022
  const _hoisted_1$17 = ["src"];
8428
9023
  const _sfc_main$1d = /* @__PURE__ */ defineComponent({
8429
9024
  __name: "ProductImage",
@@ -8435,33 +9030,73 @@ const _sfc_main$1d = /* @__PURE__ */ defineComponent({
8435
9030
  },
8436
9031
  setup(__props) {
8437
9032
  const props = __props;
9033
+ const isHover = ref(false);
9034
+ const hoverImageIndex = ref(0);
9035
+ const hoverInterval = ref(0);
8438
9036
  const rootImageUrl = computed(() => props.options.baseUrl);
8439
9037
  const image = computed(() => props.item[props.options.key]);
8440
9038
  const hasFullImageUrl = computed(() => {
8441
- const imageUrl2 = image.value;
8442
- return typeof imageUrl2 === "string" && (imageUrl2.indexOf("http://") === 0 || imageUrl2.indexOf("https://") === 0);
9039
+ return checkHasFullImageUrl(image.value);
8443
9040
  });
8444
9041
  const imageUrl = computed(() => {
8445
- const imageUrl2 = image.value;
8446
- if (hasFullImageUrl.value) {
8447
- return imageUrl2;
8448
- }
8449
- return rootImageUrl.value ? joinUrlParts(rootImageUrl.value, imageUrl2) : `/${imageUrl2}`;
9042
+ return computeImageUrl(image.value, rootImageUrl.value);
8450
9043
  });
8451
9044
  const hasImage = computed(() => Boolean(hasFullImageUrl.value || image.value));
8452
9045
  const placeholder = computed(() => props.options.placeholder);
8453
- const finalUrl = computed(() => {
9046
+ const finalMainImageUrl = computed(() => {
8454
9047
  if (props.options.customUrl) {
8455
9048
  return props.options.customUrl(props.item);
8456
9049
  }
8457
9050
  return hasImage.value ? imageUrl.value : placeholder.value;
8458
9051
  });
8459
- const replaceWithPlaceholder = (e) => {
9052
+ const hoverImages = computed(() => {
9053
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
9054
+ if ((_a = props.options.hoverImages) == null ? void 0 : _a.key) {
9055
+ 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 : [];
9056
+ }
9057
+ if (props.options.hoverImages) {
9058
+ 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 : [];
9059
+ }
9060
+ return [];
9061
+ });
9062
+ const hasHoverImages = computed(() => {
8460
9063
  var _a;
8461
- const targetImage = e == null ? void 0 : e.target;
8462
- if (targetImage && !((_a = targetImage == null ? void 0 : targetImage.src) == null ? void 0 : _a.includes(placeholder.value))) {
8463
- targetImage.src = placeholder.value;
9064
+ return Boolean((_a = hoverImages.value) == null ? void 0 : _a.length);
9065
+ });
9066
+ const replaceWithPlaceholder = (e) => {
9067
+ replaceImageWithPlaceholder(e, placeholder.value);
9068
+ };
9069
+ const setNextHoverImage = () => {
9070
+ hoverImageIndex.value = (hoverImageIndex.value + 1) % hoverImages.value.length;
9071
+ };
9072
+ const currentHoverImage = computed(() => {
9073
+ return hoverImages.value[hoverImageIndex.value];
9074
+ });
9075
+ const finalUrl = computed(() => {
9076
+ return isHover.value ? currentHoverImage.value : finalMainImageUrl.value;
9077
+ });
9078
+ const handleMouseEnter = () => {
9079
+ var _a, _b;
9080
+ if (!hasHoverImages.value) {
9081
+ return;
9082
+ }
9083
+ isHover.value = true;
9084
+ hoverImageIndex.value = 0;
9085
+ if (hoverInterval.value) {
9086
+ return;
9087
+ }
9088
+ hoverInterval.value = setInterval(
9089
+ setNextHoverImage,
9090
+ (_b = (_a = props.options.hoverImages) == null ? void 0 : _a.cycleInterval) != null ? _b : 2e3
9091
+ );
9092
+ };
9093
+ const handleMouseLeave = () => {
9094
+ if (!hasHoverImages.value) {
9095
+ return;
8464
9096
  }
9097
+ isHover.value = false;
9098
+ clearInterval(hoverInterval.value);
9099
+ hoverInterval.value = 0;
8465
9100
  };
8466
9101
  const imageAlt = computed(() => {
8467
9102
  const alt = props.options.alt;
@@ -8470,16 +9105,44 @@ const _sfc_main$1d = /* @__PURE__ */ defineComponent({
8470
9105
  }
8471
9106
  return "";
8472
9107
  });
9108
+ const preloadImages = (images) => {
9109
+ images.forEach((src) => {
9110
+ const img = new Image();
9111
+ img.src = src;
9112
+ });
9113
+ };
9114
+ onMounted(() => {
9115
+ if (hasHoverImages.value) {
9116
+ preloadImages(hoverImages.value);
9117
+ }
9118
+ });
9119
+ watch(hoverImages, (newImages) => {
9120
+ if (newImages.length) {
9121
+ preloadImages(newImages);
9122
+ }
9123
+ });
9124
+ onBeforeUnmount(() => {
9125
+ clearInterval(hoverInterval.value);
9126
+ });
8473
9127
  return (_ctx, _cache) => {
8474
- var _a, _b;
8475
9128
  return openBlock(), createElementBlock("div", {
8476
- class: normalizeClass((_a = _ctx.wrapperClass) != null ? _a : "")
9129
+ class: normalizeClass({ [_ctx.wrapperClass]: Boolean(_ctx.wrapperClass), "lupa-images-hover": isHover.value }),
9130
+ onMouseenter: handleMouseEnter,
9131
+ onMouseleave: handleMouseLeave
8477
9132
  }, [
8478
- createBaseVNode("img", mergeProps({
8479
- class: (_b = _ctx.imageClass) != null ? _b : "",
8480
- src: finalUrl.value
8481
- }, { alt: imageAlt.value ? imageAlt.value : void 0 }, { onError: replaceWithPlaceholder }), null, 16, _hoisted_1$17)
8482
- ], 2);
9133
+ createVNode(Transition, { name: "lupa-fade" }, {
9134
+ default: withCtx(() => [
9135
+ (openBlock(), createElementBlock("img", mergeProps({
9136
+ class: ["lupa-images-hover-image", { [_ctx.imageClass]: true, "lupa-images-hover-image": isHover.value }],
9137
+ src: finalUrl.value
9138
+ }, { alt: imageAlt.value ? imageAlt.value : void 0 }, {
9139
+ onError: replaceWithPlaceholder,
9140
+ key: finalUrl.value
9141
+ }), null, 16, _hoisted_1$17))
9142
+ ]),
9143
+ _: 1
9144
+ })
9145
+ ], 34);
8483
9146
  };
8484
9147
  }
8485
9148
  });
@@ -9197,6 +9860,8 @@ const _sfc_main$_ = /* @__PURE__ */ defineComponent(__spreadProps2(__spreadValue
9197
9860
  },
9198
9861
  setup(__props) {
9199
9862
  const props = __props;
9863
+ const dynamicDataStore = useDynamicDataStore();
9864
+ const { dynamicDataIdMap } = storeToRefs(dynamicDataStore);
9200
9865
  const positionValue = computed(() => {
9201
9866
  var _a;
9202
9867
  return (_a = props.position) != null ? _a : "card";
@@ -9204,6 +9869,14 @@ const _sfc_main$_ = /* @__PURE__ */ defineComponent(__spreadProps2(__spreadValue
9204
9869
  const anchorPosition = computed(() => {
9205
9870
  return props.options.anchor;
9206
9871
  });
9872
+ const enhancedProduct = computed(() => {
9873
+ var _a, _b, _c, _d;
9874
+ if (!((_a = props.options.product) == null ? void 0 : _a.id)) {
9875
+ return props.options.product;
9876
+ }
9877
+ const enhancementData = (_d = (_c = dynamicDataIdMap.value) == null ? void 0 : _c[(_b = props.options.product) == null ? void 0 : _b.id]) != null ? _d : {};
9878
+ return __spreadValues2(__spreadValues2({}, props.options.product), enhancementData);
9879
+ });
9207
9880
  const badges = computed(() => {
9208
9881
  if (!props.options.elements) {
9209
9882
  return [];
@@ -9214,8 +9887,8 @@ const _sfc_main$_ = /* @__PURE__ */ defineComponent(__spreadProps2(__spreadValue
9214
9887
  }).map((x) => {
9215
9888
  var _a;
9216
9889
  return __spreadProps2(__spreadValues2({}, x), {
9217
- value: ((_a = props.options.product) == null ? void 0 : _a[x.key]) || "badge",
9218
- product: props.options.product
9890
+ value: ((_a = enhancedProduct.value) == null ? void 0 : _a[x.key]) || "badge",
9891
+ product: enhancedProduct.value
9219
9892
  });
9220
9893
  });
9221
9894
  });
@@ -17302,8 +17975,8 @@ lodash$1.exports;
17302
17975
  function createRelationalOperation(operator) {
17303
17976
  return function(value, other) {
17304
17977
  if (!(typeof value == "string" && typeof other == "string")) {
17305
- value = toNumber(value);
17306
- other = toNumber(other);
17978
+ value = toNumber2(value);
17979
+ other = toNumber2(other);
17307
17980
  }
17308
17981
  return operator(value, other);
17309
17982
  };
@@ -17337,7 +18010,7 @@ lodash$1.exports;
17337
18010
  function createRound(methodName) {
17338
18011
  var func = Math2[methodName];
17339
18012
  return function(number, precision) {
17340
- number = toNumber(number);
18013
+ number = toNumber2(number);
17341
18014
  precision = precision == null ? 0 : nativeMin(toInteger(precision), 292);
17342
18015
  if (precision && nativeIsFinite(number)) {
17343
18016
  var pair = (toString(number) + "e").split("e"), value = func(pair[0] + "e" + (+pair[1] + precision));
@@ -18695,11 +19368,11 @@ lodash$1.exports;
18695
19368
  if (typeof func != "function") {
18696
19369
  throw new TypeError2(FUNC_ERROR_TEXT);
18697
19370
  }
18698
- wait = toNumber(wait) || 0;
19371
+ wait = toNumber2(wait) || 0;
18699
19372
  if (isObject2(options)) {
18700
19373
  leading = !!options.leading;
18701
19374
  maxing = "maxWait" in options;
18702
- maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait;
19375
+ maxWait = maxing ? nativeMax(toNumber2(options.maxWait) || 0, wait) : maxWait;
18703
19376
  trailing = "trailing" in options ? !!options.trailing : trailing;
18704
19377
  }
18705
19378
  function invokeFunc(time) {
@@ -18775,7 +19448,7 @@ lodash$1.exports;
18775
19448
  return baseDelay(func, 1, args);
18776
19449
  });
18777
19450
  var delay = baseRest(function(func, wait, args) {
18778
- return baseDelay(func, toNumber(wait) || 0, args);
19451
+ return baseDelay(func, toNumber2(wait) || 0, args);
18779
19452
  });
18780
19453
  function flip(func) {
18781
19454
  return createWrap(func, WRAP_FLIP_FLAG);
@@ -19072,7 +19745,7 @@ lodash$1.exports;
19072
19745
  if (!value) {
19073
19746
  return value === 0 ? value : 0;
19074
19747
  }
19075
- value = toNumber(value);
19748
+ value = toNumber2(value);
19076
19749
  if (value === INFINITY || value === -INFINITY) {
19077
19750
  var sign = value < 0 ? -1 : 1;
19078
19751
  return sign * MAX_INTEGER;
@@ -19086,7 +19759,7 @@ lodash$1.exports;
19086
19759
  function toLength(value) {
19087
19760
  return value ? baseClamp(toInteger(value), 0, MAX_ARRAY_LENGTH) : 0;
19088
19761
  }
19089
- function toNumber(value) {
19762
+ function toNumber2(value) {
19090
19763
  if (typeof value == "number") {
19091
19764
  return value;
19092
19765
  }
@@ -19349,14 +20022,14 @@ lodash$1.exports;
19349
20022
  lower = undefined$1;
19350
20023
  }
19351
20024
  if (upper !== undefined$1) {
19352
- upper = toNumber(upper);
20025
+ upper = toNumber2(upper);
19353
20026
  upper = upper === upper ? upper : 0;
19354
20027
  }
19355
20028
  if (lower !== undefined$1) {
19356
- lower = toNumber(lower);
20029
+ lower = toNumber2(lower);
19357
20030
  lower = lower === lower ? lower : 0;
19358
20031
  }
19359
- return baseClamp(toNumber(number), lower, upper);
20032
+ return baseClamp(toNumber2(number), lower, upper);
19360
20033
  }
19361
20034
  function inRange(number, start, end) {
19362
20035
  start = toFinite(start);
@@ -19366,7 +20039,7 @@ lodash$1.exports;
19366
20039
  } else {
19367
20040
  end = toFinite(end);
19368
20041
  }
19369
- number = toNumber(number);
20042
+ number = toNumber2(number);
19370
20043
  return baseInRange(number, start, end);
19371
20044
  }
19372
20045
  function random(lower, upper, floating) {
@@ -20152,7 +20825,7 @@ lodash$1.exports;
20152
20825
  lodash2.toInteger = toInteger;
20153
20826
  lodash2.toLength = toLength;
20154
20827
  lodash2.toLower = toLower;
20155
- lodash2.toNumber = toNumber;
20828
+ lodash2.toNumber = toNumber2;
20156
20829
  lodash2.toSafeInteger = toSafeInteger;
20157
20830
  lodash2.toString = toString;
20158
20831
  lodash2.toUpper = toUpper;
@@ -24298,8 +24971,8 @@ lodash.exports;
24298
24971
  function createRelationalOperation(operator) {
24299
24972
  return function(value, other) {
24300
24973
  if (!(typeof value == "string" && typeof other == "string")) {
24301
- value = toNumber(value);
24302
- other = toNumber(other);
24974
+ value = toNumber2(value);
24975
+ other = toNumber2(other);
24303
24976
  }
24304
24977
  return operator(value, other);
24305
24978
  };
@@ -24333,7 +25006,7 @@ lodash.exports;
24333
25006
  function createRound(methodName) {
24334
25007
  var func = Math2[methodName];
24335
25008
  return function(number, precision) {
24336
- number = toNumber(number);
25009
+ number = toNumber2(number);
24337
25010
  precision = precision == null ? 0 : nativeMin(toInteger(precision), 292);
24338
25011
  if (precision && nativeIsFinite(number)) {
24339
25012
  var pair = (toString(number) + "e").split("e"), value = func(pair[0] + "e" + (+pair[1] + precision));
@@ -25691,11 +26364,11 @@ lodash.exports;
25691
26364
  if (typeof func != "function") {
25692
26365
  throw new TypeError2(FUNC_ERROR_TEXT);
25693
26366
  }
25694
- wait = toNumber(wait) || 0;
26367
+ wait = toNumber2(wait) || 0;
25695
26368
  if (isObject2(options)) {
25696
26369
  leading = !!options.leading;
25697
26370
  maxing = "maxWait" in options;
25698
- maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait;
26371
+ maxWait = maxing ? nativeMax(toNumber2(options.maxWait) || 0, wait) : maxWait;
25699
26372
  trailing = "trailing" in options ? !!options.trailing : trailing;
25700
26373
  }
25701
26374
  function invokeFunc(time) {
@@ -25771,7 +26444,7 @@ lodash.exports;
25771
26444
  return baseDelay(func, 1, args);
25772
26445
  });
25773
26446
  var delay = baseRest(function(func, wait, args) {
25774
- return baseDelay(func, toNumber(wait) || 0, args);
26447
+ return baseDelay(func, toNumber2(wait) || 0, args);
25775
26448
  });
25776
26449
  function flip(func) {
25777
26450
  return createWrap(func, WRAP_FLIP_FLAG);
@@ -26068,7 +26741,7 @@ lodash.exports;
26068
26741
  if (!value) {
26069
26742
  return value === 0 ? value : 0;
26070
26743
  }
26071
- value = toNumber(value);
26744
+ value = toNumber2(value);
26072
26745
  if (value === INFINITY || value === -INFINITY) {
26073
26746
  var sign = value < 0 ? -1 : 1;
26074
26747
  return sign * MAX_INTEGER;
@@ -26082,7 +26755,7 @@ lodash.exports;
26082
26755
  function toLength(value) {
26083
26756
  return value ? baseClamp(toInteger(value), 0, MAX_ARRAY_LENGTH) : 0;
26084
26757
  }
26085
- function toNumber(value) {
26758
+ function toNumber2(value) {
26086
26759
  if (typeof value == "number") {
26087
26760
  return value;
26088
26761
  }
@@ -26345,14 +27018,14 @@ lodash.exports;
26345
27018
  lower = undefined$1;
26346
27019
  }
26347
27020
  if (upper !== undefined$1) {
26348
- upper = toNumber(upper);
27021
+ upper = toNumber2(upper);
26349
27022
  upper = upper === upper ? upper : 0;
26350
27023
  }
26351
27024
  if (lower !== undefined$1) {
26352
- lower = toNumber(lower);
27025
+ lower = toNumber2(lower);
26353
27026
  lower = lower === lower ? lower : 0;
26354
27027
  }
26355
- return baseClamp(toNumber(number), lower, upper);
27028
+ return baseClamp(toNumber2(number), lower, upper);
26356
27029
  }
26357
27030
  function inRange(number, start, end) {
26358
27031
  start = toFinite(start);
@@ -26362,7 +27035,7 @@ lodash.exports;
26362
27035
  } else {
26363
27036
  end = toFinite(end);
26364
27037
  }
26365
- number = toNumber(number);
27038
+ number = toNumber2(number);
26366
27039
  return baseInRange(number, start, end);
26367
27040
  }
26368
27041
  function random(lower, upper, floating) {
@@ -27148,7 +27821,7 @@ lodash.exports;
27148
27821
  lodash2.toInteger = toInteger;
27149
27822
  lodash2.toLength = toLength;
27150
27823
  lodash2.toLower = toLower;
27151
- lodash2.toNumber = toNumber;
27824
+ lodash2.toNumber = toNumber2;
27152
27825
  lodash2.toSafeInteger = toSafeInteger;
27153
27826
  lodash2.toString = toString;
27154
27827
  lodash2.toUpper = toUpper;