@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.
@@ -300,20 +300,29 @@ const replacer = (_key, val) => {
300
300
  return replacer(_key, val.value);
301
301
  } else if (isMap(val)) {
302
302
  return {
303
- [`Map(${val.size})`]: [...val.entries()].reduce((entries, [key, val2]) => {
304
- entries[`${key} =>`] = val2;
305
- return entries;
306
- }, {})
303
+ [`Map(${val.size})`]: [...val.entries()].reduce(
304
+ (entries, [key, val2], i) => {
305
+ entries[stringifySymbol(key, i) + " =>"] = val2;
306
+ return entries;
307
+ },
308
+ {}
309
+ )
307
310
  };
308
311
  } else if (isSet(val)) {
309
312
  return {
310
- [`Set(${val.size})`]: [...val.values()]
313
+ [`Set(${val.size})`]: [...val.values()].map((v) => stringifySymbol(v))
311
314
  };
315
+ } else if (isSymbol(val)) {
316
+ return stringifySymbol(val);
312
317
  } else if (isObject(val) && !isArray(val) && !isPlainObject(val)) {
313
318
  return String(val);
314
319
  }
315
320
  return val;
316
321
  };
322
+ const stringifySymbol = (v, i = "") => {
323
+ var _a;
324
+ return isSymbol(v) ? `Symbol(${(_a = v.description) != null ? _a : i})` : v;
325
+ };
317
326
 
318
327
  function warn$1(msg, ...args) {
319
328
  console.warn(`[Vue warn] ${msg}`, ...args);
@@ -737,8 +746,13 @@ class BaseReactiveHandler {
737
746
  return isReadonly2;
738
747
  } else if (key === "__v_isShallow") {
739
748
  return shallow;
740
- } else if (key === "__v_raw" && receiver === (isReadonly2 ? shallow ? shallowReadonlyMap : readonlyMap : shallow ? shallowReactiveMap : reactiveMap).get(target)) {
741
- return target;
749
+ } else if (key === "__v_raw") {
750
+ if (receiver === (isReadonly2 ? shallow ? shallowReadonlyMap : readonlyMap : shallow ? shallowReactiveMap : reactiveMap).get(target) || // receiver is not the reactive proxy, but has the same prototype
751
+ // this means the reciever is a user proxy of the reactive proxy
752
+ Object.getPrototypeOf(target) === Object.getPrototypeOf(receiver)) {
753
+ return target;
754
+ }
755
+ return;
742
756
  }
743
757
  const targetIsArray = isArray(target);
744
758
  if (!isReadonly2) {
@@ -774,17 +788,19 @@ class MutableReactiveHandler extends BaseReactiveHandler {
774
788
  }
775
789
  set(target, key, value, receiver) {
776
790
  let oldValue = target[key];
777
- if (isReadonly(oldValue) && isRef(oldValue) && !isRef(value)) {
778
- return false;
779
- }
780
791
  if (!this._shallow) {
792
+ const isOldValueReadonly = isReadonly(oldValue);
781
793
  if (!isShallow(value) && !isReadonly(value)) {
782
794
  oldValue = toRaw(oldValue);
783
795
  value = toRaw(value);
784
796
  }
785
797
  if (!isArray(target) && isRef(oldValue) && !isRef(value)) {
786
- oldValue.value = value;
787
- return true;
798
+ if (isOldValueReadonly) {
799
+ return false;
800
+ } else {
801
+ oldValue.value = value;
802
+ return true;
803
+ }
788
804
  }
789
805
  }
790
806
  const hadKey = isArray(target) && isIntegerKey(key) ? Number(key) < target.length : hasOwn(target, key);
@@ -1749,13 +1765,16 @@ function queuePostFlushCb(cb) {
1749
1765
  }
1750
1766
  queueFlush();
1751
1767
  }
1752
- function flushPreFlushCbs(seen, i = isFlushing ? flushIndex + 1 : 0) {
1768
+ function flushPreFlushCbs(instance, seen, i = isFlushing ? flushIndex + 1 : 0) {
1753
1769
  {
1754
1770
  seen = seen || /* @__PURE__ */ new Map();
1755
1771
  }
1756
1772
  for (; i < queue.length; i++) {
1757
1773
  const cb = queue[i];
1758
1774
  if (cb && cb.pre) {
1775
+ if (instance && cb.id !== instance.uid) {
1776
+ continue;
1777
+ }
1759
1778
  if (checkRecursiveUpdates(seen, cb)) {
1760
1779
  continue;
1761
1780
  }
@@ -3338,7 +3357,7 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
3338
3357
  timeout: typeof timeout === "number" ? timeout : -1,
3339
3358
  activeBranch: null,
3340
3359
  pendingBranch: null,
3341
- isInFallback: true,
3360
+ isInFallback: !isHydrating,
3342
3361
  isHydrating,
3343
3362
  isUnmounted: false,
3344
3363
  effects: [],
@@ -3424,6 +3443,7 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
3424
3443
  }
3425
3444
  const { vnode: vnode2, activeBranch, parentComponent: parentComponent2, container: container2, isSVG: isSVG2 } = suspense;
3426
3445
  triggerEvent(vnode2, "onFallback");
3446
+ const anchor2 = next(activeBranch);
3427
3447
  const mountFallback = () => {
3428
3448
  if (!suspense.isInFallback) {
3429
3449
  return;
@@ -3432,7 +3452,7 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
3432
3452
  null,
3433
3453
  fallbackVNode,
3434
3454
  container2,
3435
- next(activeBranch),
3455
+ anchor2,
3436
3456
  parentComponent2,
3437
3457
  null,
3438
3458
  // fallback tree will not have suspense context
@@ -6273,7 +6293,7 @@ function createCompatVue$1(createApp, createSingletonApp) {
6273
6293
  return vm;
6274
6294
  }
6275
6295
  }
6276
- Vue.version = `2.6.14-compat:${"3.3.10"}`;
6296
+ Vue.version = `2.6.14-compat:${"3.3.12"}`;
6277
6297
  Vue.config = singletonApp.config;
6278
6298
  Vue.use = (p, ...options) => {
6279
6299
  if (p && isFunction(p.install)) {
@@ -7755,6 +7775,16 @@ function createHydrationFunctions(rendererInternals) {
7755
7775
  if (dirs) {
7756
7776
  invokeDirectiveHook(vnode, null, parentComponent, "created");
7757
7777
  }
7778
+ let needCallTransitionHooks = false;
7779
+ if (isTemplateNode(el)) {
7780
+ needCallTransitionHooks = needTransition(parentSuspense, transition) && parentComponent && parentComponent.vnode.props && parentComponent.vnode.props.appear;
7781
+ const content = el.content.firstChild;
7782
+ if (needCallTransitionHooks) {
7783
+ transition.beforeEnter(content);
7784
+ }
7785
+ replaceNode(content, el, parentComponent);
7786
+ vnode.el = el = content;
7787
+ }
7758
7788
  if (props) {
7759
7789
  if (forcePatch || !optimized || patchFlag & (16 | 32)) {
7760
7790
  for (const key in props) {
@@ -7787,16 +7817,6 @@ function createHydrationFunctions(rendererInternals) {
7787
7817
  if (vnodeHooks = props && props.onVnodeBeforeMount) {
7788
7818
  invokeVNodeHook(vnodeHooks, parentComponent, vnode);
7789
7819
  }
7790
- let needCallTransitionHooks = false;
7791
- if (isTemplateNode(el)) {
7792
- needCallTransitionHooks = needTransition(parentSuspense, transition) && parentComponent && parentComponent.vnode.props && parentComponent.vnode.props.appear;
7793
- const content = el.content.firstChild;
7794
- if (needCallTransitionHooks) {
7795
- transition.beforeEnter(content);
7796
- }
7797
- replaceNode(content, el, parentComponent);
7798
- vnode.el = el = content;
7799
- }
7800
7820
  if (dirs) {
7801
7821
  invokeDirectiveHook(vnode, null, parentComponent, "beforeMount");
7802
7822
  }
@@ -8911,7 +8931,7 @@ function baseCreateRenderer(options, createHydrationFns) {
8911
8931
  updateProps(instance, nextVNode.props, prevProps, optimized);
8912
8932
  updateSlots(instance, nextVNode.children, optimized);
8913
8933
  pauseTracking();
8914
- flushPreFlushCbs();
8934
+ flushPreFlushCbs(instance);
8915
8935
  resetTracking();
8916
8936
  };
8917
8937
  const patchChildren = (n1, n2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized = false) => {
@@ -10866,7 +10886,7 @@ function isMemoSame(cached, memo) {
10866
10886
  return true;
10867
10887
  }
10868
10888
 
10869
- const version = "3.3.10";
10889
+ const version = "3.3.12";
10870
10890
  const ssrUtils = null;
10871
10891
  const resolveFilter = resolveFilter$1 ;
10872
10892
  const _compatUtils = {
@@ -11305,6 +11325,69 @@ function setDisplay(el, value) {
11305
11325
  el.style.display = value ? el[vShowOldKey] : "none";
11306
11326
  }
11307
11327
 
11328
+ const CSS_VAR_TEXT = Symbol("CSS_VAR_TEXT" );
11329
+ function useCssVars(getter) {
11330
+ const instance = getCurrentInstance();
11331
+ if (!instance) {
11332
+ warn(`useCssVars is called without current active component instance.`);
11333
+ return;
11334
+ }
11335
+ const updateTeleports = instance.ut = (vars = getter(instance.proxy)) => {
11336
+ Array.from(
11337
+ document.querySelectorAll(`[data-v-owner="${instance.uid}"]`)
11338
+ ).forEach((node) => setVarsOnNode(node, vars));
11339
+ };
11340
+ const setVars = () => {
11341
+ const vars = getter(instance.proxy);
11342
+ setVarsOnVNode(instance.subTree, vars);
11343
+ updateTeleports(vars);
11344
+ };
11345
+ watchPostEffect(setVars);
11346
+ onMounted(() => {
11347
+ const ob = new MutationObserver(setVars);
11348
+ ob.observe(instance.subTree.el.parentNode, { childList: true });
11349
+ onUnmounted(() => ob.disconnect());
11350
+ });
11351
+ }
11352
+ function setVarsOnVNode(vnode, vars) {
11353
+ if (vnode.shapeFlag & 128) {
11354
+ const suspense = vnode.suspense;
11355
+ vnode = suspense.activeBranch;
11356
+ if (suspense.pendingBranch && !suspense.isHydrating) {
11357
+ suspense.effects.push(() => {
11358
+ setVarsOnVNode(suspense.activeBranch, vars);
11359
+ });
11360
+ }
11361
+ }
11362
+ while (vnode.component) {
11363
+ vnode = vnode.component.subTree;
11364
+ }
11365
+ if (vnode.shapeFlag & 1 && vnode.el) {
11366
+ setVarsOnNode(vnode.el, vars);
11367
+ } else if (vnode.type === Fragment) {
11368
+ vnode.children.forEach((c) => setVarsOnVNode(c, vars));
11369
+ } else if (vnode.type === Static) {
11370
+ let { el, anchor } = vnode;
11371
+ while (el) {
11372
+ setVarsOnNode(el, vars);
11373
+ if (el === anchor)
11374
+ break;
11375
+ el = el.nextSibling;
11376
+ }
11377
+ }
11378
+ }
11379
+ function setVarsOnNode(el, vars) {
11380
+ if (el.nodeType === 1) {
11381
+ const style = el.style;
11382
+ let cssText = "";
11383
+ for (const key in vars) {
11384
+ style.setProperty(`--${key}`, vars[key]);
11385
+ cssText += `--${key}: ${vars[key]};`;
11386
+ }
11387
+ style[CSS_VAR_TEXT] = cssText;
11388
+ }
11389
+ }
11390
+
11308
11391
  function patchStyle(el, prev, next) {
11309
11392
  const style = el.style;
11310
11393
  const isCssString = isString(next);
@@ -11323,6 +11406,10 @@ function patchStyle(el, prev, next) {
11323
11406
  const currentDisplay = style.display;
11324
11407
  if (isCssString) {
11325
11408
  if (prev !== next) {
11409
+ const cssVarText = style[CSS_VAR_TEXT];
11410
+ if (cssVarText) {
11411
+ next += ";" + cssVarText;
11412
+ }
11326
11413
  style.cssText = next;
11327
11414
  }
11328
11415
  } else if (prev) {
@@ -11619,7 +11706,9 @@ function shouldSetAsProp(el, key, value, isSVG) {
11619
11706
  }
11620
11707
  if (key === "width" || key === "height") {
11621
11708
  const tag = el.tagName;
11622
- return !(tag === "IMG" || tag === "VIDEO" || tag === "CANVAS" || tag === "SOURCE");
11709
+ if (tag === "IMG" || tag === "VIDEO" || tag === "CANVAS" || tag === "SOURCE") {
11710
+ return false;
11711
+ }
11623
11712
  }
11624
11713
  if (isNativeOn(key) && isString(value)) {
11625
11714
  return false;
@@ -11870,65 +11959,6 @@ function useCssModule(name = "$style") {
11870
11959
  }
11871
11960
  }
11872
11961
 
11873
- function useCssVars(getter) {
11874
- const instance = getCurrentInstance();
11875
- if (!instance) {
11876
- warn(`useCssVars is called without current active component instance.`);
11877
- return;
11878
- }
11879
- const updateTeleports = instance.ut = (vars = getter(instance.proxy)) => {
11880
- Array.from(
11881
- document.querySelectorAll(`[data-v-owner="${instance.uid}"]`)
11882
- ).forEach((node) => setVarsOnNode(node, vars));
11883
- };
11884
- const setVars = () => {
11885
- const vars = getter(instance.proxy);
11886
- setVarsOnVNode(instance.subTree, vars);
11887
- updateTeleports(vars);
11888
- };
11889
- watchPostEffect(setVars);
11890
- onMounted(() => {
11891
- const ob = new MutationObserver(setVars);
11892
- ob.observe(instance.subTree.el.parentNode, { childList: true });
11893
- onUnmounted(() => ob.disconnect());
11894
- });
11895
- }
11896
- function setVarsOnVNode(vnode, vars) {
11897
- if (vnode.shapeFlag & 128) {
11898
- const suspense = vnode.suspense;
11899
- vnode = suspense.activeBranch;
11900
- if (suspense.pendingBranch && !suspense.isHydrating) {
11901
- suspense.effects.push(() => {
11902
- setVarsOnVNode(suspense.activeBranch, vars);
11903
- });
11904
- }
11905
- }
11906
- while (vnode.component) {
11907
- vnode = vnode.component.subTree;
11908
- }
11909
- if (vnode.shapeFlag & 1 && vnode.el) {
11910
- setVarsOnNode(vnode.el, vars);
11911
- } else if (vnode.type === Fragment) {
11912
- vnode.children.forEach((c) => setVarsOnVNode(c, vars));
11913
- } else if (vnode.type === Static) {
11914
- let { el, anchor } = vnode;
11915
- while (el) {
11916
- setVarsOnNode(el, vars);
11917
- if (el === anchor)
11918
- break;
11919
- el = el.nextSibling;
11920
- }
11921
- }
11922
- }
11923
- function setVarsOnNode(el, vars) {
11924
- if (el.nodeType === 1) {
11925
- const style = el.style;
11926
- for (const key in vars) {
11927
- style.setProperty(`--${key}`, vars[key]);
11928
- }
11929
- }
11930
- }
11931
-
11932
11962
  const positionMap = /* @__PURE__ */ new WeakMap();
11933
11963
  const newPositionMap = /* @__PURE__ */ new WeakMap();
11934
11964
  const moveCbKey = Symbol("_moveCb");