@vue/compat 3.3.11 → 3.3.13

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.
@@ -727,17 +727,19 @@ class MutableReactiveHandler extends BaseReactiveHandler {
727
727
  }
728
728
  set(target, key, value, receiver) {
729
729
  let oldValue = target[key];
730
- if (isReadonly(oldValue) && isRef(oldValue) && !isRef(value)) {
731
- return false;
732
- }
733
730
  if (!this._shallow) {
731
+ const isOldValueReadonly = isReadonly(oldValue);
734
732
  if (!isShallow(value) && !isReadonly(value)) {
735
733
  oldValue = toRaw(oldValue);
736
734
  value = toRaw(value);
737
735
  }
738
736
  if (!isArray(target) && isRef(oldValue) && !isRef(value)) {
739
- oldValue.value = value;
740
- return true;
737
+ if (isOldValueReadonly) {
738
+ return false;
739
+ } else {
740
+ oldValue.value = value;
741
+ return true;
742
+ }
741
743
  }
742
744
  }
743
745
  const hadKey = isArray(target) && isIntegerKey(key) ? Number(key) < target.length : hasOwn(target, key);
@@ -3307,7 +3309,7 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
3307
3309
  timeout: typeof timeout === "number" ? timeout : -1,
3308
3310
  activeBranch: null,
3309
3311
  pendingBranch: null,
3310
- isInFallback: true,
3312
+ isInFallback: !isHydrating,
3311
3313
  isHydrating,
3312
3314
  isUnmounted: false,
3313
3315
  effects: [],
@@ -6274,7 +6276,7 @@ function createCompatVue$1(createApp, createSingletonApp) {
6274
6276
  return vm;
6275
6277
  }
6276
6278
  }
6277
- Vue.version = `2.6.14-compat:${"3.3.11"}`;
6279
+ Vue.version = `2.6.14-compat:${"3.3.13"}`;
6278
6280
  Vue.config = singletonApp.config;
6279
6281
  Vue.use = (p, ...options) => {
6280
6282
  if (p && isFunction(p.install)) {
@@ -7759,6 +7761,16 @@ function createHydrationFunctions(rendererInternals) {
7759
7761
  if (dirs) {
7760
7762
  invokeDirectiveHook(vnode, null, parentComponent, "created");
7761
7763
  }
7764
+ let needCallTransitionHooks = false;
7765
+ if (isTemplateNode(el)) {
7766
+ needCallTransitionHooks = needTransition(parentSuspense, transition) && parentComponent && parentComponent.vnode.props && parentComponent.vnode.props.appear;
7767
+ const content = el.content.firstChild;
7768
+ if (needCallTransitionHooks) {
7769
+ transition.beforeEnter(content);
7770
+ }
7771
+ replaceNode(content, el, parentComponent);
7772
+ vnode.el = el = content;
7773
+ }
7762
7774
  if (props) {
7763
7775
  if (forcePatch || !optimized || patchFlag & (16 | 32)) {
7764
7776
  for (const key in props) {
@@ -7791,16 +7803,6 @@ function createHydrationFunctions(rendererInternals) {
7791
7803
  if (vnodeHooks = props && props.onVnodeBeforeMount) {
7792
7804
  invokeVNodeHook(vnodeHooks, parentComponent, vnode);
7793
7805
  }
7794
- let needCallTransitionHooks = false;
7795
- if (isTemplateNode(el)) {
7796
- needCallTransitionHooks = needTransition(parentSuspense, transition) && parentComponent && parentComponent.vnode.props && parentComponent.vnode.props.appear;
7797
- const content = el.content.firstChild;
7798
- if (needCallTransitionHooks) {
7799
- transition.beforeEnter(content);
7800
- }
7801
- replaceNode(content, el, parentComponent);
7802
- vnode.el = el = content;
7803
- }
7804
7806
  if (dirs) {
7805
7807
  invokeDirectiveHook(vnode, null, parentComponent, "beforeMount");
7806
7808
  }
@@ -10932,7 +10934,7 @@ function isMemoSame(cached, memo) {
10932
10934
  return true;
10933
10935
  }
10934
10936
 
10935
- const version = "3.3.11";
10937
+ const version = "3.3.13";
10936
10938
  const _ssrUtils = {
10937
10939
  createComponentInstance,
10938
10940
  setupComponent,
@@ -11386,6 +11388,69 @@ function initVShowForSSR() {
11386
11388
  };
11387
11389
  }
11388
11390
 
11391
+ const CSS_VAR_TEXT = Symbol(!!(process.env.NODE_ENV !== "production") ? "CSS_VAR_TEXT" : "");
11392
+ function useCssVars(getter) {
11393
+ const instance = getCurrentInstance();
11394
+ if (!instance) {
11395
+ !!(process.env.NODE_ENV !== "production") && warn(`useCssVars is called without current active component instance.`);
11396
+ return;
11397
+ }
11398
+ const updateTeleports = instance.ut = (vars = getter(instance.proxy)) => {
11399
+ Array.from(
11400
+ document.querySelectorAll(`[data-v-owner="${instance.uid}"]`)
11401
+ ).forEach((node) => setVarsOnNode(node, vars));
11402
+ };
11403
+ const setVars = () => {
11404
+ const vars = getter(instance.proxy);
11405
+ setVarsOnVNode(instance.subTree, vars);
11406
+ updateTeleports(vars);
11407
+ };
11408
+ watchPostEffect(setVars);
11409
+ onMounted(() => {
11410
+ const ob = new MutationObserver(setVars);
11411
+ ob.observe(instance.subTree.el.parentNode, { childList: true });
11412
+ onUnmounted(() => ob.disconnect());
11413
+ });
11414
+ }
11415
+ function setVarsOnVNode(vnode, vars) {
11416
+ if (vnode.shapeFlag & 128) {
11417
+ const suspense = vnode.suspense;
11418
+ vnode = suspense.activeBranch;
11419
+ if (suspense.pendingBranch && !suspense.isHydrating) {
11420
+ suspense.effects.push(() => {
11421
+ setVarsOnVNode(suspense.activeBranch, vars);
11422
+ });
11423
+ }
11424
+ }
11425
+ while (vnode.component) {
11426
+ vnode = vnode.component.subTree;
11427
+ }
11428
+ if (vnode.shapeFlag & 1 && vnode.el) {
11429
+ setVarsOnNode(vnode.el, vars);
11430
+ } else if (vnode.type === Fragment) {
11431
+ vnode.children.forEach((c) => setVarsOnVNode(c, vars));
11432
+ } else if (vnode.type === Static) {
11433
+ let { el, anchor } = vnode;
11434
+ while (el) {
11435
+ setVarsOnNode(el, vars);
11436
+ if (el === anchor)
11437
+ break;
11438
+ el = el.nextSibling;
11439
+ }
11440
+ }
11441
+ }
11442
+ function setVarsOnNode(el, vars) {
11443
+ if (el.nodeType === 1) {
11444
+ const style = el.style;
11445
+ let cssText = "";
11446
+ for (const key in vars) {
11447
+ style.setProperty(`--${key}`, vars[key]);
11448
+ cssText += `--${key}: ${vars[key]};`;
11449
+ }
11450
+ style[CSS_VAR_TEXT] = cssText;
11451
+ }
11452
+ }
11453
+
11389
11454
  function patchStyle(el, prev, next) {
11390
11455
  const style = el.style;
11391
11456
  const isCssString = isString(next);
@@ -11404,6 +11469,10 @@ function patchStyle(el, prev, next) {
11404
11469
  const currentDisplay = style.display;
11405
11470
  if (isCssString) {
11406
11471
  if (prev !== next) {
11472
+ const cssVarText = style[CSS_VAR_TEXT];
11473
+ if (cssVarText) {
11474
+ next += ";" + cssVarText;
11475
+ }
11407
11476
  style.cssText = next;
11408
11477
  }
11409
11478
  } else if (prev) {
@@ -11953,65 +12022,6 @@ function useCssModule(name = "$style") {
11953
12022
  }
11954
12023
  }
11955
12024
 
11956
- function useCssVars(getter) {
11957
- const instance = getCurrentInstance();
11958
- if (!instance) {
11959
- !!(process.env.NODE_ENV !== "production") && warn(`useCssVars is called without current active component instance.`);
11960
- return;
11961
- }
11962
- const updateTeleports = instance.ut = (vars = getter(instance.proxy)) => {
11963
- Array.from(
11964
- document.querySelectorAll(`[data-v-owner="${instance.uid}"]`)
11965
- ).forEach((node) => setVarsOnNode(node, vars));
11966
- };
11967
- const setVars = () => {
11968
- const vars = getter(instance.proxy);
11969
- setVarsOnVNode(instance.subTree, vars);
11970
- updateTeleports(vars);
11971
- };
11972
- watchPostEffect(setVars);
11973
- onMounted(() => {
11974
- const ob = new MutationObserver(setVars);
11975
- ob.observe(instance.subTree.el.parentNode, { childList: true });
11976
- onUnmounted(() => ob.disconnect());
11977
- });
11978
- }
11979
- function setVarsOnVNode(vnode, vars) {
11980
- if (vnode.shapeFlag & 128) {
11981
- const suspense = vnode.suspense;
11982
- vnode = suspense.activeBranch;
11983
- if (suspense.pendingBranch && !suspense.isHydrating) {
11984
- suspense.effects.push(() => {
11985
- setVarsOnVNode(suspense.activeBranch, vars);
11986
- });
11987
- }
11988
- }
11989
- while (vnode.component) {
11990
- vnode = vnode.component.subTree;
11991
- }
11992
- if (vnode.shapeFlag & 1 && vnode.el) {
11993
- setVarsOnNode(vnode.el, vars);
11994
- } else if (vnode.type === Fragment) {
11995
- vnode.children.forEach((c) => setVarsOnVNode(c, vars));
11996
- } else if (vnode.type === Static) {
11997
- let { el, anchor } = vnode;
11998
- while (el) {
11999
- setVarsOnNode(el, vars);
12000
- if (el === anchor)
12001
- break;
12002
- el = el.nextSibling;
12003
- }
12004
- }
12005
- }
12006
- function setVarsOnNode(el, vars) {
12007
- if (el.nodeType === 1) {
12008
- const style = el.style;
12009
- for (const key in vars) {
12010
- style.setProperty(`--${key}`, vars[key]);
12011
- }
12012
- }
12013
- }
12014
-
12015
12025
  const positionMap = /* @__PURE__ */ new WeakMap();
12016
12026
  const newPositionMap = /* @__PURE__ */ new WeakMap();
12017
12027
  const moveCbKey = Symbol("_moveCb");
@@ -12428,7 +12438,9 @@ const modifierGuards = {
12428
12438
  exact: (e, modifiers) => systemModifiers.some((m) => e[`${m}Key`] && !modifiers.includes(m))
12429
12439
  };
12430
12440
  const withModifiers = (fn, modifiers) => {
12431
- return fn._withMods || (fn._withMods = (event, ...args) => {
12441
+ const cache = fn._withMods || (fn._withMods = {});
12442
+ const cacheKey = modifiers.join(".");
12443
+ return cache[cacheKey] || (cache[cacheKey] = (event, ...args) => {
12432
12444
  for (let i = 0; i < modifiers.length; i++) {
12433
12445
  const guard = modifierGuards[modifiers[i]];
12434
12446
  if (guard && guard(event, modifiers))
@@ -12463,7 +12475,9 @@ const withKeys = (fn, modifiers) => {
12463
12475
  );
12464
12476
  }
12465
12477
  }
12466
- return fn._withKeys || (fn._withKeys = (event) => {
12478
+ const cache = fn._withKeys || (fn._withKeys = {});
12479
+ const cacheKey = modifiers.join(".");
12480
+ return cache[cacheKey] || (cache[cacheKey] = (event) => {
12467
12481
  if (!("key" in event)) {
12468
12482
  return;
12469
12483
  }
@@ -726,17 +726,19 @@ var Vue = (function () {
726
726
  }
727
727
  set(target, key, value, receiver) {
728
728
  let oldValue = target[key];
729
- if (isReadonly(oldValue) && isRef(oldValue) && !isRef(value)) {
730
- return false;
731
- }
732
729
  if (!this._shallow) {
730
+ const isOldValueReadonly = isReadonly(oldValue);
733
731
  if (!isShallow(value) && !isReadonly(value)) {
734
732
  oldValue = toRaw(oldValue);
735
733
  value = toRaw(value);
736
734
  }
737
735
  if (!isArray(target) && isRef(oldValue) && !isRef(value)) {
738
- oldValue.value = value;
739
- return true;
736
+ if (isOldValueReadonly) {
737
+ return false;
738
+ } else {
739
+ oldValue.value = value;
740
+ return true;
741
+ }
740
742
  }
741
743
  }
742
744
  const hadKey = isArray(target) && isIntegerKey(key) ? Number(key) < target.length : hasOwn(target, key);
@@ -3293,7 +3295,7 @@ If this is a native custom element, make sure to exclude it from component resol
3293
3295
  timeout: typeof timeout === "number" ? timeout : -1,
3294
3296
  activeBranch: null,
3295
3297
  pendingBranch: null,
3296
- isInFallback: true,
3298
+ isInFallback: !isHydrating,
3297
3299
  isHydrating,
3298
3300
  isUnmounted: false,
3299
3301
  effects: [],
@@ -6229,7 +6231,7 @@ If this is a native custom element, make sure to exclude it from component resol
6229
6231
  return vm;
6230
6232
  }
6231
6233
  }
6232
- Vue.version = `2.6.14-compat:${"3.3.11"}`;
6234
+ Vue.version = `2.6.14-compat:${"3.3.13"}`;
6233
6235
  Vue.config = singletonApp.config;
6234
6236
  Vue.use = (p, ...options) => {
6235
6237
  if (p && isFunction(p.install)) {
@@ -7711,6 +7713,16 @@ If you want to remount the same app, move your app creation logic into a factory
7711
7713
  if (dirs) {
7712
7714
  invokeDirectiveHook(vnode, null, parentComponent, "created");
7713
7715
  }
7716
+ let needCallTransitionHooks = false;
7717
+ if (isTemplateNode(el)) {
7718
+ needCallTransitionHooks = needTransition(parentSuspense, transition) && parentComponent && parentComponent.vnode.props && parentComponent.vnode.props.appear;
7719
+ const content = el.content.firstChild;
7720
+ if (needCallTransitionHooks) {
7721
+ transition.beforeEnter(content);
7722
+ }
7723
+ replaceNode(content, el, parentComponent);
7724
+ vnode.el = el = content;
7725
+ }
7714
7726
  if (props) {
7715
7727
  if (forcePatch || !optimized || patchFlag & (16 | 32)) {
7716
7728
  for (const key in props) {
@@ -7743,16 +7755,6 @@ If you want to remount the same app, move your app creation logic into a factory
7743
7755
  if (vnodeHooks = props && props.onVnodeBeforeMount) {
7744
7756
  invokeVNodeHook(vnodeHooks, parentComponent, vnode);
7745
7757
  }
7746
- let needCallTransitionHooks = false;
7747
- if (isTemplateNode(el)) {
7748
- needCallTransitionHooks = needTransition(parentSuspense, transition) && parentComponent && parentComponent.vnode.props && parentComponent.vnode.props.appear;
7749
- const content = el.content.firstChild;
7750
- if (needCallTransitionHooks) {
7751
- transition.beforeEnter(content);
7752
- }
7753
- replaceNode(content, el, parentComponent);
7754
- vnode.el = el = content;
7755
- }
7756
7758
  if (dirs) {
7757
7759
  invokeDirectiveHook(vnode, null, parentComponent, "beforeMount");
7758
7760
  }
@@ -10816,7 +10818,7 @@ Component that was made reactive: `,
10816
10818
  return true;
10817
10819
  }
10818
10820
 
10819
- const version = "3.3.11";
10821
+ const version = "3.3.13";
10820
10822
  const ssrUtils = null;
10821
10823
  const resolveFilter = resolveFilter$1 ;
10822
10824
  const _compatUtils = {
@@ -11255,6 +11257,69 @@ Component that was made reactive: `,
11255
11257
  el.style.display = value ? el[vShowOldKey] : "none";
11256
11258
  }
11257
11259
 
11260
+ const CSS_VAR_TEXT = Symbol("CSS_VAR_TEXT" );
11261
+ function useCssVars(getter) {
11262
+ const instance = getCurrentInstance();
11263
+ if (!instance) {
11264
+ warn(`useCssVars is called without current active component instance.`);
11265
+ return;
11266
+ }
11267
+ const updateTeleports = instance.ut = (vars = getter(instance.proxy)) => {
11268
+ Array.from(
11269
+ document.querySelectorAll(`[data-v-owner="${instance.uid}"]`)
11270
+ ).forEach((node) => setVarsOnNode(node, vars));
11271
+ };
11272
+ const setVars = () => {
11273
+ const vars = getter(instance.proxy);
11274
+ setVarsOnVNode(instance.subTree, vars);
11275
+ updateTeleports(vars);
11276
+ };
11277
+ watchPostEffect(setVars);
11278
+ onMounted(() => {
11279
+ const ob = new MutationObserver(setVars);
11280
+ ob.observe(instance.subTree.el.parentNode, { childList: true });
11281
+ onUnmounted(() => ob.disconnect());
11282
+ });
11283
+ }
11284
+ function setVarsOnVNode(vnode, vars) {
11285
+ if (vnode.shapeFlag & 128) {
11286
+ const suspense = vnode.suspense;
11287
+ vnode = suspense.activeBranch;
11288
+ if (suspense.pendingBranch && !suspense.isHydrating) {
11289
+ suspense.effects.push(() => {
11290
+ setVarsOnVNode(suspense.activeBranch, vars);
11291
+ });
11292
+ }
11293
+ }
11294
+ while (vnode.component) {
11295
+ vnode = vnode.component.subTree;
11296
+ }
11297
+ if (vnode.shapeFlag & 1 && vnode.el) {
11298
+ setVarsOnNode(vnode.el, vars);
11299
+ } else if (vnode.type === Fragment) {
11300
+ vnode.children.forEach((c) => setVarsOnVNode(c, vars));
11301
+ } else if (vnode.type === Static) {
11302
+ let { el, anchor } = vnode;
11303
+ while (el) {
11304
+ setVarsOnNode(el, vars);
11305
+ if (el === anchor)
11306
+ break;
11307
+ el = el.nextSibling;
11308
+ }
11309
+ }
11310
+ }
11311
+ function setVarsOnNode(el, vars) {
11312
+ if (el.nodeType === 1) {
11313
+ const style = el.style;
11314
+ let cssText = "";
11315
+ for (const key in vars) {
11316
+ style.setProperty(`--${key}`, vars[key]);
11317
+ cssText += `--${key}: ${vars[key]};`;
11318
+ }
11319
+ style[CSS_VAR_TEXT] = cssText;
11320
+ }
11321
+ }
11322
+
11258
11323
  function patchStyle(el, prev, next) {
11259
11324
  const style = el.style;
11260
11325
  const isCssString = isString(next);
@@ -11273,6 +11338,10 @@ Component that was made reactive: `,
11273
11338
  const currentDisplay = style.display;
11274
11339
  if (isCssString) {
11275
11340
  if (prev !== next) {
11341
+ const cssVarText = style[CSS_VAR_TEXT];
11342
+ if (cssVarText) {
11343
+ next += ";" + cssVarText;
11344
+ }
11276
11345
  style.cssText = next;
11277
11346
  }
11278
11347
  } else if (prev) {
@@ -11810,65 +11879,6 @@ Component that was made reactive: `,
11810
11879
  }
11811
11880
  }
11812
11881
 
11813
- function useCssVars(getter) {
11814
- const instance = getCurrentInstance();
11815
- if (!instance) {
11816
- warn(`useCssVars is called without current active component instance.`);
11817
- return;
11818
- }
11819
- const updateTeleports = instance.ut = (vars = getter(instance.proxy)) => {
11820
- Array.from(
11821
- document.querySelectorAll(`[data-v-owner="${instance.uid}"]`)
11822
- ).forEach((node) => setVarsOnNode(node, vars));
11823
- };
11824
- const setVars = () => {
11825
- const vars = getter(instance.proxy);
11826
- setVarsOnVNode(instance.subTree, vars);
11827
- updateTeleports(vars);
11828
- };
11829
- watchPostEffect(setVars);
11830
- onMounted(() => {
11831
- const ob = new MutationObserver(setVars);
11832
- ob.observe(instance.subTree.el.parentNode, { childList: true });
11833
- onUnmounted(() => ob.disconnect());
11834
- });
11835
- }
11836
- function setVarsOnVNode(vnode, vars) {
11837
- if (vnode.shapeFlag & 128) {
11838
- const suspense = vnode.suspense;
11839
- vnode = suspense.activeBranch;
11840
- if (suspense.pendingBranch && !suspense.isHydrating) {
11841
- suspense.effects.push(() => {
11842
- setVarsOnVNode(suspense.activeBranch, vars);
11843
- });
11844
- }
11845
- }
11846
- while (vnode.component) {
11847
- vnode = vnode.component.subTree;
11848
- }
11849
- if (vnode.shapeFlag & 1 && vnode.el) {
11850
- setVarsOnNode(vnode.el, vars);
11851
- } else if (vnode.type === Fragment) {
11852
- vnode.children.forEach((c) => setVarsOnVNode(c, vars));
11853
- } else if (vnode.type === Static) {
11854
- let { el, anchor } = vnode;
11855
- while (el) {
11856
- setVarsOnNode(el, vars);
11857
- if (el === anchor)
11858
- break;
11859
- el = el.nextSibling;
11860
- }
11861
- }
11862
- }
11863
- function setVarsOnNode(el, vars) {
11864
- if (el.nodeType === 1) {
11865
- const style = el.style;
11866
- for (const key in vars) {
11867
- style.setProperty(`--${key}`, vars[key]);
11868
- }
11869
- }
11870
- }
11871
-
11872
11882
  const positionMap = /* @__PURE__ */ new WeakMap();
11873
11883
  const newPositionMap = /* @__PURE__ */ new WeakMap();
11874
11884
  const moveCbKey = Symbol("_moveCb");
@@ -12251,7 +12261,9 @@ Component that was made reactive: `,
12251
12261
  exact: (e, modifiers) => systemModifiers.some((m) => e[`${m}Key`] && !modifiers.includes(m))
12252
12262
  };
12253
12263
  const withModifiers = (fn, modifiers) => {
12254
- return fn._withMods || (fn._withMods = (event, ...args) => {
12264
+ const cache = fn._withMods || (fn._withMods = {});
12265
+ const cacheKey = modifiers.join(".");
12266
+ return cache[cacheKey] || (cache[cacheKey] = (event, ...args) => {
12255
12267
  for (let i = 0; i < modifiers.length; i++) {
12256
12268
  const guard = modifierGuards[modifiers[i]];
12257
12269
  if (guard && guard(event, modifiers))
@@ -12286,7 +12298,9 @@ Component that was made reactive: `,
12286
12298
  );
12287
12299
  }
12288
12300
  }
12289
- return fn._withKeys || (fn._withKeys = (event) => {
12301
+ const cache = fn._withKeys || (fn._withKeys = {});
12302
+ const cacheKey = modifiers.join(".");
12303
+ return cache[cacheKey] || (cache[cacheKey] = (event) => {
12290
12304
  if (!("key" in event)) {
12291
12305
  return;
12292
12306
  }