@vue/compat 3.3.10 → 3.3.12

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.
@@ -235,20 +235,29 @@ const replacer = (_key, val) => {
235
235
  return replacer(_key, val.value);
236
236
  } else if (isMap(val)) {
237
237
  return {
238
- [`Map(${val.size})`]: [...val.entries()].reduce((entries, [key, val2]) => {
239
- entries[`${key} =>`] = val2;
240
- return entries;
241
- }, {})
238
+ [`Map(${val.size})`]: [...val.entries()].reduce(
239
+ (entries, [key, val2], i) => {
240
+ entries[stringifySymbol(key, i) + " =>"] = val2;
241
+ return entries;
242
+ },
243
+ {}
244
+ )
242
245
  };
243
246
  } else if (isSet(val)) {
244
247
  return {
245
- [`Set(${val.size})`]: [...val.values()]
248
+ [`Set(${val.size})`]: [...val.values()].map((v) => stringifySymbol(v))
246
249
  };
250
+ } else if (isSymbol(val)) {
251
+ return stringifySymbol(val);
247
252
  } else if (isObject(val) && !isArray(val) && !isPlainObject(val)) {
248
253
  return String(val);
249
254
  }
250
255
  return val;
251
256
  };
257
+ const stringifySymbol = (v, i = "") => {
258
+ var _a;
259
+ return isSymbol(v) ? `Symbol(${(_a = v.description) != null ? _a : i})` : v;
260
+ };
252
261
 
253
262
  function warn$1(msg, ...args) {
254
263
  console.warn(`[Vue warn] ${msg}`, ...args);
@@ -672,8 +681,13 @@ class BaseReactiveHandler {
672
681
  return isReadonly2;
673
682
  } else if (key === "__v_isShallow") {
674
683
  return shallow;
675
- } else if (key === "__v_raw" && receiver === (isReadonly2 ? shallow ? shallowReadonlyMap : readonlyMap : shallow ? shallowReactiveMap : reactiveMap).get(target)) {
676
- return target;
684
+ } else if (key === "__v_raw") {
685
+ if (receiver === (isReadonly2 ? shallow ? shallowReadonlyMap : readonlyMap : shallow ? shallowReactiveMap : reactiveMap).get(target) || // receiver is not the reactive proxy, but has the same prototype
686
+ // this means the reciever is a user proxy of the reactive proxy
687
+ Object.getPrototypeOf(target) === Object.getPrototypeOf(receiver)) {
688
+ return target;
689
+ }
690
+ return;
677
691
  }
678
692
  const targetIsArray = isArray(target);
679
693
  if (!isReadonly2) {
@@ -709,17 +723,19 @@ class MutableReactiveHandler extends BaseReactiveHandler {
709
723
  }
710
724
  set(target, key, value, receiver) {
711
725
  let oldValue = target[key];
712
- if (isReadonly(oldValue) && isRef(oldValue) && !isRef(value)) {
713
- return false;
714
- }
715
726
  if (!this._shallow) {
727
+ const isOldValueReadonly = isReadonly(oldValue);
716
728
  if (!isShallow(value) && !isReadonly(value)) {
717
729
  oldValue = toRaw(oldValue);
718
730
  value = toRaw(value);
719
731
  }
720
732
  if (!isArray(target) && isRef(oldValue) && !isRef(value)) {
721
- oldValue.value = value;
722
- return true;
733
+ if (isOldValueReadonly) {
734
+ return false;
735
+ } else {
736
+ oldValue.value = value;
737
+ return true;
738
+ }
723
739
  }
724
740
  }
725
741
  const hadKey = isArray(target) && isIntegerKey(key) ? Number(key) < target.length : hasOwn(target, key);
@@ -1684,13 +1700,16 @@ function queuePostFlushCb(cb) {
1684
1700
  }
1685
1701
  queueFlush();
1686
1702
  }
1687
- function flushPreFlushCbs(seen, i = isFlushing ? flushIndex + 1 : 0) {
1703
+ function flushPreFlushCbs(instance, seen, i = isFlushing ? flushIndex + 1 : 0) {
1688
1704
  {
1689
1705
  seen = seen || /* @__PURE__ */ new Map();
1690
1706
  }
1691
1707
  for (; i < queue.length; i++) {
1692
1708
  const cb = queue[i];
1693
1709
  if (cb && cb.pre) {
1710
+ if (instance && cb.id !== instance.uid) {
1711
+ continue;
1712
+ }
1694
1713
  if (checkRecursiveUpdates(seen, cb)) {
1695
1714
  continue;
1696
1715
  }
@@ -3273,7 +3292,7 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
3273
3292
  timeout: typeof timeout === "number" ? timeout : -1,
3274
3293
  activeBranch: null,
3275
3294
  pendingBranch: null,
3276
- isInFallback: true,
3295
+ isInFallback: !isHydrating,
3277
3296
  isHydrating,
3278
3297
  isUnmounted: false,
3279
3298
  effects: [],
@@ -3359,6 +3378,7 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
3359
3378
  }
3360
3379
  const { vnode: vnode2, activeBranch, parentComponent: parentComponent2, container: container2, isSVG: isSVG2 } = suspense;
3361
3380
  triggerEvent(vnode2, "onFallback");
3381
+ const anchor2 = next(activeBranch);
3362
3382
  const mountFallback = () => {
3363
3383
  if (!suspense.isInFallback) {
3364
3384
  return;
@@ -3367,7 +3387,7 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
3367
3387
  null,
3368
3388
  fallbackVNode,
3369
3389
  container2,
3370
- next(activeBranch),
3390
+ anchor2,
3371
3391
  parentComponent2,
3372
3392
  null,
3373
3393
  // fallback tree will not have suspense context
@@ -6208,7 +6228,7 @@ function createCompatVue$1(createApp, createSingletonApp) {
6208
6228
  return vm;
6209
6229
  }
6210
6230
  }
6211
- Vue.version = `2.6.14-compat:${"3.3.10"}`;
6231
+ Vue.version = `2.6.14-compat:${"3.3.12"}`;
6212
6232
  Vue.config = singletonApp.config;
6213
6233
  Vue.use = (p, ...options) => {
6214
6234
  if (p && isFunction(p.install)) {
@@ -7690,6 +7710,16 @@ function createHydrationFunctions(rendererInternals) {
7690
7710
  if (dirs) {
7691
7711
  invokeDirectiveHook(vnode, null, parentComponent, "created");
7692
7712
  }
7713
+ let needCallTransitionHooks = false;
7714
+ if (isTemplateNode(el)) {
7715
+ needCallTransitionHooks = needTransition(parentSuspense, transition) && parentComponent && parentComponent.vnode.props && parentComponent.vnode.props.appear;
7716
+ const content = el.content.firstChild;
7717
+ if (needCallTransitionHooks) {
7718
+ transition.beforeEnter(content);
7719
+ }
7720
+ replaceNode(content, el, parentComponent);
7721
+ vnode.el = el = content;
7722
+ }
7693
7723
  if (props) {
7694
7724
  if (forcePatch || !optimized || patchFlag & (16 | 32)) {
7695
7725
  for (const key in props) {
@@ -7722,16 +7752,6 @@ function createHydrationFunctions(rendererInternals) {
7722
7752
  if (vnodeHooks = props && props.onVnodeBeforeMount) {
7723
7753
  invokeVNodeHook(vnodeHooks, parentComponent, vnode);
7724
7754
  }
7725
- let needCallTransitionHooks = false;
7726
- if (isTemplateNode(el)) {
7727
- needCallTransitionHooks = needTransition(parentSuspense, transition) && parentComponent && parentComponent.vnode.props && parentComponent.vnode.props.appear;
7728
- const content = el.content.firstChild;
7729
- if (needCallTransitionHooks) {
7730
- transition.beforeEnter(content);
7731
- }
7732
- replaceNode(content, el, parentComponent);
7733
- vnode.el = el = content;
7734
- }
7735
7755
  if (dirs) {
7736
7756
  invokeDirectiveHook(vnode, null, parentComponent, "beforeMount");
7737
7757
  }
@@ -8846,7 +8866,7 @@ function baseCreateRenderer(options, createHydrationFns) {
8846
8866
  updateProps(instance, nextVNode.props, prevProps, optimized);
8847
8867
  updateSlots(instance, nextVNode.children, optimized);
8848
8868
  pauseTracking();
8849
- flushPreFlushCbs();
8869
+ flushPreFlushCbs(instance);
8850
8870
  resetTracking();
8851
8871
  };
8852
8872
  const patchChildren = (n1, n2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized = false) => {
@@ -10801,7 +10821,7 @@ function isMemoSame(cached, memo) {
10801
10821
  return true;
10802
10822
  }
10803
10823
 
10804
- const version = "3.3.10";
10824
+ const version = "3.3.12";
10805
10825
  const ssrUtils = null;
10806
10826
  const resolveFilter = resolveFilter$1 ;
10807
10827
  const _compatUtils = {
@@ -11240,6 +11260,69 @@ function setDisplay(el, value) {
11240
11260
  el.style.display = value ? el[vShowOldKey] : "none";
11241
11261
  }
11242
11262
 
11263
+ const CSS_VAR_TEXT = Symbol("CSS_VAR_TEXT" );
11264
+ function useCssVars(getter) {
11265
+ const instance = getCurrentInstance();
11266
+ if (!instance) {
11267
+ warn(`useCssVars is called without current active component instance.`);
11268
+ return;
11269
+ }
11270
+ const updateTeleports = instance.ut = (vars = getter(instance.proxy)) => {
11271
+ Array.from(
11272
+ document.querySelectorAll(`[data-v-owner="${instance.uid}"]`)
11273
+ ).forEach((node) => setVarsOnNode(node, vars));
11274
+ };
11275
+ const setVars = () => {
11276
+ const vars = getter(instance.proxy);
11277
+ setVarsOnVNode(instance.subTree, vars);
11278
+ updateTeleports(vars);
11279
+ };
11280
+ watchPostEffect(setVars);
11281
+ onMounted(() => {
11282
+ const ob = new MutationObserver(setVars);
11283
+ ob.observe(instance.subTree.el.parentNode, { childList: true });
11284
+ onUnmounted(() => ob.disconnect());
11285
+ });
11286
+ }
11287
+ function setVarsOnVNode(vnode, vars) {
11288
+ if (vnode.shapeFlag & 128) {
11289
+ const suspense = vnode.suspense;
11290
+ vnode = suspense.activeBranch;
11291
+ if (suspense.pendingBranch && !suspense.isHydrating) {
11292
+ suspense.effects.push(() => {
11293
+ setVarsOnVNode(suspense.activeBranch, vars);
11294
+ });
11295
+ }
11296
+ }
11297
+ while (vnode.component) {
11298
+ vnode = vnode.component.subTree;
11299
+ }
11300
+ if (vnode.shapeFlag & 1 && vnode.el) {
11301
+ setVarsOnNode(vnode.el, vars);
11302
+ } else if (vnode.type === Fragment) {
11303
+ vnode.children.forEach((c) => setVarsOnVNode(c, vars));
11304
+ } else if (vnode.type === Static) {
11305
+ let { el, anchor } = vnode;
11306
+ while (el) {
11307
+ setVarsOnNode(el, vars);
11308
+ if (el === anchor)
11309
+ break;
11310
+ el = el.nextSibling;
11311
+ }
11312
+ }
11313
+ }
11314
+ function setVarsOnNode(el, vars) {
11315
+ if (el.nodeType === 1) {
11316
+ const style = el.style;
11317
+ let cssText = "";
11318
+ for (const key in vars) {
11319
+ style.setProperty(`--${key}`, vars[key]);
11320
+ cssText += `--${key}: ${vars[key]};`;
11321
+ }
11322
+ style[CSS_VAR_TEXT] = cssText;
11323
+ }
11324
+ }
11325
+
11243
11326
  function patchStyle(el, prev, next) {
11244
11327
  const style = el.style;
11245
11328
  const isCssString = isString(next);
@@ -11258,6 +11341,10 @@ function patchStyle(el, prev, next) {
11258
11341
  const currentDisplay = style.display;
11259
11342
  if (isCssString) {
11260
11343
  if (prev !== next) {
11344
+ const cssVarText = style[CSS_VAR_TEXT];
11345
+ if (cssVarText) {
11346
+ next += ";" + cssVarText;
11347
+ }
11261
11348
  style.cssText = next;
11262
11349
  }
11263
11350
  } else if (prev) {
@@ -11554,7 +11641,9 @@ function shouldSetAsProp(el, key, value, isSVG) {
11554
11641
  }
11555
11642
  if (key === "width" || key === "height") {
11556
11643
  const tag = el.tagName;
11557
- return !(tag === "IMG" || tag === "VIDEO" || tag === "CANVAS" || tag === "SOURCE");
11644
+ if (tag === "IMG" || tag === "VIDEO" || tag === "CANVAS" || tag === "SOURCE") {
11645
+ return false;
11646
+ }
11558
11647
  }
11559
11648
  if (isNativeOn(key) && isString(value)) {
11560
11649
  return false;
@@ -11805,65 +11894,6 @@ function useCssModule(name = "$style") {
11805
11894
  }
11806
11895
  }
11807
11896
 
11808
- function useCssVars(getter) {
11809
- const instance = getCurrentInstance();
11810
- if (!instance) {
11811
- warn(`useCssVars is called without current active component instance.`);
11812
- return;
11813
- }
11814
- const updateTeleports = instance.ut = (vars = getter(instance.proxy)) => {
11815
- Array.from(
11816
- document.querySelectorAll(`[data-v-owner="${instance.uid}"]`)
11817
- ).forEach((node) => setVarsOnNode(node, vars));
11818
- };
11819
- const setVars = () => {
11820
- const vars = getter(instance.proxy);
11821
- setVarsOnVNode(instance.subTree, vars);
11822
- updateTeleports(vars);
11823
- };
11824
- watchPostEffect(setVars);
11825
- onMounted(() => {
11826
- const ob = new MutationObserver(setVars);
11827
- ob.observe(instance.subTree.el.parentNode, { childList: true });
11828
- onUnmounted(() => ob.disconnect());
11829
- });
11830
- }
11831
- function setVarsOnVNode(vnode, vars) {
11832
- if (vnode.shapeFlag & 128) {
11833
- const suspense = vnode.suspense;
11834
- vnode = suspense.activeBranch;
11835
- if (suspense.pendingBranch && !suspense.isHydrating) {
11836
- suspense.effects.push(() => {
11837
- setVarsOnVNode(suspense.activeBranch, vars);
11838
- });
11839
- }
11840
- }
11841
- while (vnode.component) {
11842
- vnode = vnode.component.subTree;
11843
- }
11844
- if (vnode.shapeFlag & 1 && vnode.el) {
11845
- setVarsOnNode(vnode.el, vars);
11846
- } else if (vnode.type === Fragment) {
11847
- vnode.children.forEach((c) => setVarsOnVNode(c, vars));
11848
- } else if (vnode.type === Static) {
11849
- let { el, anchor } = vnode;
11850
- while (el) {
11851
- setVarsOnNode(el, vars);
11852
- if (el === anchor)
11853
- break;
11854
- el = el.nextSibling;
11855
- }
11856
- }
11857
- }
11858
- function setVarsOnNode(el, vars) {
11859
- if (el.nodeType === 1) {
11860
- const style = el.style;
11861
- for (const key in vars) {
11862
- style.setProperty(`--${key}`, vars[key]);
11863
- }
11864
- }
11865
- }
11866
-
11867
11897
  const positionMap = /* @__PURE__ */ new WeakMap();
11868
11898
  const newPositionMap = /* @__PURE__ */ new WeakMap();
11869
11899
  const moveCbKey = Symbol("_moveCb");