@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.
@@ -792,17 +792,19 @@ class MutableReactiveHandler extends BaseReactiveHandler {
792
792
  }
793
793
  set(target, key, value, receiver) {
794
794
  let oldValue = target[key];
795
- if (isReadonly(oldValue) && isRef(oldValue) && !isRef(value)) {
796
- return false;
797
- }
798
795
  if (!this._shallow) {
796
+ const isOldValueReadonly = isReadonly(oldValue);
799
797
  if (!isShallow(value) && !isReadonly(value)) {
800
798
  oldValue = toRaw(oldValue);
801
799
  value = toRaw(value);
802
800
  }
803
801
  if (!isArray(target) && isRef(oldValue) && !isRef(value)) {
804
- oldValue.value = value;
805
- return true;
802
+ if (isOldValueReadonly) {
803
+ return false;
804
+ } else {
805
+ oldValue.value = value;
806
+ return true;
807
+ }
806
808
  }
807
809
  }
808
810
  const hadKey = isArray(target) && isIntegerKey(key) ? Number(key) < target.length : hasOwn(target, key);
@@ -3372,7 +3374,7 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
3372
3374
  timeout: typeof timeout === "number" ? timeout : -1,
3373
3375
  activeBranch: null,
3374
3376
  pendingBranch: null,
3375
- isInFallback: true,
3377
+ isInFallback: !isHydrating,
3376
3378
  isHydrating,
3377
3379
  isUnmounted: false,
3378
3380
  effects: [],
@@ -6339,7 +6341,7 @@ function createCompatVue$1(createApp, createSingletonApp) {
6339
6341
  return vm;
6340
6342
  }
6341
6343
  }
6342
- Vue.version = `2.6.14-compat:${"3.3.11"}`;
6344
+ Vue.version = `2.6.14-compat:${"3.3.13"}`;
6343
6345
  Vue.config = singletonApp.config;
6344
6346
  Vue.use = (p, ...options) => {
6345
6347
  if (p && isFunction(p.install)) {
@@ -7824,6 +7826,16 @@ function createHydrationFunctions(rendererInternals) {
7824
7826
  if (dirs) {
7825
7827
  invokeDirectiveHook(vnode, null, parentComponent, "created");
7826
7828
  }
7829
+ let needCallTransitionHooks = false;
7830
+ if (isTemplateNode(el)) {
7831
+ needCallTransitionHooks = needTransition(parentSuspense, transition) && parentComponent && parentComponent.vnode.props && parentComponent.vnode.props.appear;
7832
+ const content = el.content.firstChild;
7833
+ if (needCallTransitionHooks) {
7834
+ transition.beforeEnter(content);
7835
+ }
7836
+ replaceNode(content, el, parentComponent);
7837
+ vnode.el = el = content;
7838
+ }
7827
7839
  if (props) {
7828
7840
  if (forcePatch || !optimized || patchFlag & (16 | 32)) {
7829
7841
  for (const key in props) {
@@ -7856,16 +7868,6 @@ function createHydrationFunctions(rendererInternals) {
7856
7868
  if (vnodeHooks = props && props.onVnodeBeforeMount) {
7857
7869
  invokeVNodeHook(vnodeHooks, parentComponent, vnode);
7858
7870
  }
7859
- let needCallTransitionHooks = false;
7860
- if (isTemplateNode(el)) {
7861
- needCallTransitionHooks = needTransition(parentSuspense, transition) && parentComponent && parentComponent.vnode.props && parentComponent.vnode.props.appear;
7862
- const content = el.content.firstChild;
7863
- if (needCallTransitionHooks) {
7864
- transition.beforeEnter(content);
7865
- }
7866
- replaceNode(content, el, parentComponent);
7867
- vnode.el = el = content;
7868
- }
7869
7871
  if (dirs) {
7870
7872
  invokeDirectiveHook(vnode, null, parentComponent, "beforeMount");
7871
7873
  }
@@ -10997,7 +10999,7 @@ function isMemoSame(cached, memo) {
10997
10999
  return true;
10998
11000
  }
10999
11001
 
11000
- const version = "3.3.11";
11002
+ const version = "3.3.13";
11001
11003
  const _ssrUtils = {
11002
11004
  createComponentInstance,
11003
11005
  setupComponent,
@@ -11451,6 +11453,69 @@ function initVShowForSSR() {
11451
11453
  };
11452
11454
  }
11453
11455
 
11456
+ const CSS_VAR_TEXT = Symbol(!!(process.env.NODE_ENV !== "production") ? "CSS_VAR_TEXT" : "");
11457
+ function useCssVars(getter) {
11458
+ const instance = getCurrentInstance();
11459
+ if (!instance) {
11460
+ !!(process.env.NODE_ENV !== "production") && warn(`useCssVars is called without current active component instance.`);
11461
+ return;
11462
+ }
11463
+ const updateTeleports = instance.ut = (vars = getter(instance.proxy)) => {
11464
+ Array.from(
11465
+ document.querySelectorAll(`[data-v-owner="${instance.uid}"]`)
11466
+ ).forEach((node) => setVarsOnNode(node, vars));
11467
+ };
11468
+ const setVars = () => {
11469
+ const vars = getter(instance.proxy);
11470
+ setVarsOnVNode(instance.subTree, vars);
11471
+ updateTeleports(vars);
11472
+ };
11473
+ watchPostEffect(setVars);
11474
+ onMounted(() => {
11475
+ const ob = new MutationObserver(setVars);
11476
+ ob.observe(instance.subTree.el.parentNode, { childList: true });
11477
+ onUnmounted(() => ob.disconnect());
11478
+ });
11479
+ }
11480
+ function setVarsOnVNode(vnode, vars) {
11481
+ if (vnode.shapeFlag & 128) {
11482
+ const suspense = vnode.suspense;
11483
+ vnode = suspense.activeBranch;
11484
+ if (suspense.pendingBranch && !suspense.isHydrating) {
11485
+ suspense.effects.push(() => {
11486
+ setVarsOnVNode(suspense.activeBranch, vars);
11487
+ });
11488
+ }
11489
+ }
11490
+ while (vnode.component) {
11491
+ vnode = vnode.component.subTree;
11492
+ }
11493
+ if (vnode.shapeFlag & 1 && vnode.el) {
11494
+ setVarsOnNode(vnode.el, vars);
11495
+ } else if (vnode.type === Fragment) {
11496
+ vnode.children.forEach((c) => setVarsOnVNode(c, vars));
11497
+ } else if (vnode.type === Static) {
11498
+ let { el, anchor } = vnode;
11499
+ while (el) {
11500
+ setVarsOnNode(el, vars);
11501
+ if (el === anchor)
11502
+ break;
11503
+ el = el.nextSibling;
11504
+ }
11505
+ }
11506
+ }
11507
+ function setVarsOnNode(el, vars) {
11508
+ if (el.nodeType === 1) {
11509
+ const style = el.style;
11510
+ let cssText = "";
11511
+ for (const key in vars) {
11512
+ style.setProperty(`--${key}`, vars[key]);
11513
+ cssText += `--${key}: ${vars[key]};`;
11514
+ }
11515
+ style[CSS_VAR_TEXT] = cssText;
11516
+ }
11517
+ }
11518
+
11454
11519
  function patchStyle(el, prev, next) {
11455
11520
  const style = el.style;
11456
11521
  const isCssString = isString(next);
@@ -11469,6 +11534,10 @@ function patchStyle(el, prev, next) {
11469
11534
  const currentDisplay = style.display;
11470
11535
  if (isCssString) {
11471
11536
  if (prev !== next) {
11537
+ const cssVarText = style[CSS_VAR_TEXT];
11538
+ if (cssVarText) {
11539
+ next += ";" + cssVarText;
11540
+ }
11472
11541
  style.cssText = next;
11473
11542
  }
11474
11543
  } else if (prev) {
@@ -12018,65 +12087,6 @@ function useCssModule(name = "$style") {
12018
12087
  }
12019
12088
  }
12020
12089
 
12021
- function useCssVars(getter) {
12022
- const instance = getCurrentInstance();
12023
- if (!instance) {
12024
- !!(process.env.NODE_ENV !== "production") && warn(`useCssVars is called without current active component instance.`);
12025
- return;
12026
- }
12027
- const updateTeleports = instance.ut = (vars = getter(instance.proxy)) => {
12028
- Array.from(
12029
- document.querySelectorAll(`[data-v-owner="${instance.uid}"]`)
12030
- ).forEach((node) => setVarsOnNode(node, vars));
12031
- };
12032
- const setVars = () => {
12033
- const vars = getter(instance.proxy);
12034
- setVarsOnVNode(instance.subTree, vars);
12035
- updateTeleports(vars);
12036
- };
12037
- watchPostEffect(setVars);
12038
- onMounted(() => {
12039
- const ob = new MutationObserver(setVars);
12040
- ob.observe(instance.subTree.el.parentNode, { childList: true });
12041
- onUnmounted(() => ob.disconnect());
12042
- });
12043
- }
12044
- function setVarsOnVNode(vnode, vars) {
12045
- if (vnode.shapeFlag & 128) {
12046
- const suspense = vnode.suspense;
12047
- vnode = suspense.activeBranch;
12048
- if (suspense.pendingBranch && !suspense.isHydrating) {
12049
- suspense.effects.push(() => {
12050
- setVarsOnVNode(suspense.activeBranch, vars);
12051
- });
12052
- }
12053
- }
12054
- while (vnode.component) {
12055
- vnode = vnode.component.subTree;
12056
- }
12057
- if (vnode.shapeFlag & 1 && vnode.el) {
12058
- setVarsOnNode(vnode.el, vars);
12059
- } else if (vnode.type === Fragment) {
12060
- vnode.children.forEach((c) => setVarsOnVNode(c, vars));
12061
- } else if (vnode.type === Static) {
12062
- let { el, anchor } = vnode;
12063
- while (el) {
12064
- setVarsOnNode(el, vars);
12065
- if (el === anchor)
12066
- break;
12067
- el = el.nextSibling;
12068
- }
12069
- }
12070
- }
12071
- function setVarsOnNode(el, vars) {
12072
- if (el.nodeType === 1) {
12073
- const style = el.style;
12074
- for (const key in vars) {
12075
- style.setProperty(`--${key}`, vars[key]);
12076
- }
12077
- }
12078
- }
12079
-
12080
12090
  const positionMap = /* @__PURE__ */ new WeakMap();
12081
12091
  const newPositionMap = /* @__PURE__ */ new WeakMap();
12082
12092
  const moveCbKey = Symbol("_moveCb");
@@ -12493,7 +12503,9 @@ const modifierGuards = {
12493
12503
  exact: (e, modifiers) => systemModifiers.some((m) => e[`${m}Key`] && !modifiers.includes(m))
12494
12504
  };
12495
12505
  const withModifiers = (fn, modifiers) => {
12496
- return fn._withMods || (fn._withMods = (event, ...args) => {
12506
+ const cache = fn._withMods || (fn._withMods = {});
12507
+ const cacheKey = modifiers.join(".");
12508
+ return cache[cacheKey] || (cache[cacheKey] = (event, ...args) => {
12497
12509
  for (let i = 0; i < modifiers.length; i++) {
12498
12510
  const guard = modifierGuards[modifiers[i]];
12499
12511
  if (guard && guard(event, modifiers))
@@ -12528,7 +12540,9 @@ const withKeys = (fn, modifiers) => {
12528
12540
  );
12529
12541
  }
12530
12542
  }
12531
- return fn._withKeys || (fn._withKeys = (event) => {
12543
+ const cache = fn._withKeys || (fn._withKeys = {});
12544
+ const cacheKey = modifiers.join(".");
12545
+ return cache[cacheKey] || (cache[cacheKey] = (event) => {
12532
12546
  if (!("key" in event)) {
12533
12547
  return;
12534
12548
  }
@@ -791,17 +791,19 @@ var Vue = (function () {
791
791
  }
792
792
  set(target, key, value, receiver) {
793
793
  let oldValue = target[key];
794
- if (isReadonly(oldValue) && isRef(oldValue) && !isRef(value)) {
795
- return false;
796
- }
797
794
  if (!this._shallow) {
795
+ const isOldValueReadonly = isReadonly(oldValue);
798
796
  if (!isShallow(value) && !isReadonly(value)) {
799
797
  oldValue = toRaw(oldValue);
800
798
  value = toRaw(value);
801
799
  }
802
800
  if (!isArray(target) && isRef(oldValue) && !isRef(value)) {
803
- oldValue.value = value;
804
- return true;
801
+ if (isOldValueReadonly) {
802
+ return false;
803
+ } else {
804
+ oldValue.value = value;
805
+ return true;
806
+ }
805
807
  }
806
808
  }
807
809
  const hadKey = isArray(target) && isIntegerKey(key) ? Number(key) < target.length : hasOwn(target, key);
@@ -3358,7 +3360,7 @@ If this is a native custom element, make sure to exclude it from component resol
3358
3360
  timeout: typeof timeout === "number" ? timeout : -1,
3359
3361
  activeBranch: null,
3360
3362
  pendingBranch: null,
3361
- isInFallback: true,
3363
+ isInFallback: !isHydrating,
3362
3364
  isHydrating,
3363
3365
  isUnmounted: false,
3364
3366
  effects: [],
@@ -6294,7 +6296,7 @@ If this is a native custom element, make sure to exclude it from component resol
6294
6296
  return vm;
6295
6297
  }
6296
6298
  }
6297
- Vue.version = `2.6.14-compat:${"3.3.11"}`;
6299
+ Vue.version = `2.6.14-compat:${"3.3.13"}`;
6298
6300
  Vue.config = singletonApp.config;
6299
6301
  Vue.use = (p, ...options) => {
6300
6302
  if (p && isFunction(p.install)) {
@@ -7776,6 +7778,16 @@ If you want to remount the same app, move your app creation logic into a factory
7776
7778
  if (dirs) {
7777
7779
  invokeDirectiveHook(vnode, null, parentComponent, "created");
7778
7780
  }
7781
+ let needCallTransitionHooks = false;
7782
+ if (isTemplateNode(el)) {
7783
+ needCallTransitionHooks = needTransition(parentSuspense, transition) && parentComponent && parentComponent.vnode.props && parentComponent.vnode.props.appear;
7784
+ const content = el.content.firstChild;
7785
+ if (needCallTransitionHooks) {
7786
+ transition.beforeEnter(content);
7787
+ }
7788
+ replaceNode(content, el, parentComponent);
7789
+ vnode.el = el = content;
7790
+ }
7779
7791
  if (props) {
7780
7792
  if (forcePatch || !optimized || patchFlag & (16 | 32)) {
7781
7793
  for (const key in props) {
@@ -7808,16 +7820,6 @@ If you want to remount the same app, move your app creation logic into a factory
7808
7820
  if (vnodeHooks = props && props.onVnodeBeforeMount) {
7809
7821
  invokeVNodeHook(vnodeHooks, parentComponent, vnode);
7810
7822
  }
7811
- let needCallTransitionHooks = false;
7812
- if (isTemplateNode(el)) {
7813
- needCallTransitionHooks = needTransition(parentSuspense, transition) && parentComponent && parentComponent.vnode.props && parentComponent.vnode.props.appear;
7814
- const content = el.content.firstChild;
7815
- if (needCallTransitionHooks) {
7816
- transition.beforeEnter(content);
7817
- }
7818
- replaceNode(content, el, parentComponent);
7819
- vnode.el = el = content;
7820
- }
7821
7823
  if (dirs) {
7822
7824
  invokeDirectiveHook(vnode, null, parentComponent, "beforeMount");
7823
7825
  }
@@ -10881,7 +10883,7 @@ Component that was made reactive: `,
10881
10883
  return true;
10882
10884
  }
10883
10885
 
10884
- const version = "3.3.11";
10886
+ const version = "3.3.13";
10885
10887
  const ssrUtils = null;
10886
10888
  const resolveFilter = resolveFilter$1 ;
10887
10889
  const _compatUtils = {
@@ -11320,6 +11322,69 @@ Component that was made reactive: `,
11320
11322
  el.style.display = value ? el[vShowOldKey] : "none";
11321
11323
  }
11322
11324
 
11325
+ const CSS_VAR_TEXT = Symbol("CSS_VAR_TEXT" );
11326
+ function useCssVars(getter) {
11327
+ const instance = getCurrentInstance();
11328
+ if (!instance) {
11329
+ warn(`useCssVars is called without current active component instance.`);
11330
+ return;
11331
+ }
11332
+ const updateTeleports = instance.ut = (vars = getter(instance.proxy)) => {
11333
+ Array.from(
11334
+ document.querySelectorAll(`[data-v-owner="${instance.uid}"]`)
11335
+ ).forEach((node) => setVarsOnNode(node, vars));
11336
+ };
11337
+ const setVars = () => {
11338
+ const vars = getter(instance.proxy);
11339
+ setVarsOnVNode(instance.subTree, vars);
11340
+ updateTeleports(vars);
11341
+ };
11342
+ watchPostEffect(setVars);
11343
+ onMounted(() => {
11344
+ const ob = new MutationObserver(setVars);
11345
+ ob.observe(instance.subTree.el.parentNode, { childList: true });
11346
+ onUnmounted(() => ob.disconnect());
11347
+ });
11348
+ }
11349
+ function setVarsOnVNode(vnode, vars) {
11350
+ if (vnode.shapeFlag & 128) {
11351
+ const suspense = vnode.suspense;
11352
+ vnode = suspense.activeBranch;
11353
+ if (suspense.pendingBranch && !suspense.isHydrating) {
11354
+ suspense.effects.push(() => {
11355
+ setVarsOnVNode(suspense.activeBranch, vars);
11356
+ });
11357
+ }
11358
+ }
11359
+ while (vnode.component) {
11360
+ vnode = vnode.component.subTree;
11361
+ }
11362
+ if (vnode.shapeFlag & 1 && vnode.el) {
11363
+ setVarsOnNode(vnode.el, vars);
11364
+ } else if (vnode.type === Fragment) {
11365
+ vnode.children.forEach((c) => setVarsOnVNode(c, vars));
11366
+ } else if (vnode.type === Static) {
11367
+ let { el, anchor } = vnode;
11368
+ while (el) {
11369
+ setVarsOnNode(el, vars);
11370
+ if (el === anchor)
11371
+ break;
11372
+ el = el.nextSibling;
11373
+ }
11374
+ }
11375
+ }
11376
+ function setVarsOnNode(el, vars) {
11377
+ if (el.nodeType === 1) {
11378
+ const style = el.style;
11379
+ let cssText = "";
11380
+ for (const key in vars) {
11381
+ style.setProperty(`--${key}`, vars[key]);
11382
+ cssText += `--${key}: ${vars[key]};`;
11383
+ }
11384
+ style[CSS_VAR_TEXT] = cssText;
11385
+ }
11386
+ }
11387
+
11323
11388
  function patchStyle(el, prev, next) {
11324
11389
  const style = el.style;
11325
11390
  const isCssString = isString(next);
@@ -11338,6 +11403,10 @@ Component that was made reactive: `,
11338
11403
  const currentDisplay = style.display;
11339
11404
  if (isCssString) {
11340
11405
  if (prev !== next) {
11406
+ const cssVarText = style[CSS_VAR_TEXT];
11407
+ if (cssVarText) {
11408
+ next += ";" + cssVarText;
11409
+ }
11341
11410
  style.cssText = next;
11342
11411
  }
11343
11412
  } else if (prev) {
@@ -11875,65 +11944,6 @@ Component that was made reactive: `,
11875
11944
  }
11876
11945
  }
11877
11946
 
11878
- function useCssVars(getter) {
11879
- const instance = getCurrentInstance();
11880
- if (!instance) {
11881
- warn(`useCssVars is called without current active component instance.`);
11882
- return;
11883
- }
11884
- const updateTeleports = instance.ut = (vars = getter(instance.proxy)) => {
11885
- Array.from(
11886
- document.querySelectorAll(`[data-v-owner="${instance.uid}"]`)
11887
- ).forEach((node) => setVarsOnNode(node, vars));
11888
- };
11889
- const setVars = () => {
11890
- const vars = getter(instance.proxy);
11891
- setVarsOnVNode(instance.subTree, vars);
11892
- updateTeleports(vars);
11893
- };
11894
- watchPostEffect(setVars);
11895
- onMounted(() => {
11896
- const ob = new MutationObserver(setVars);
11897
- ob.observe(instance.subTree.el.parentNode, { childList: true });
11898
- onUnmounted(() => ob.disconnect());
11899
- });
11900
- }
11901
- function setVarsOnVNode(vnode, vars) {
11902
- if (vnode.shapeFlag & 128) {
11903
- const suspense = vnode.suspense;
11904
- vnode = suspense.activeBranch;
11905
- if (suspense.pendingBranch && !suspense.isHydrating) {
11906
- suspense.effects.push(() => {
11907
- setVarsOnVNode(suspense.activeBranch, vars);
11908
- });
11909
- }
11910
- }
11911
- while (vnode.component) {
11912
- vnode = vnode.component.subTree;
11913
- }
11914
- if (vnode.shapeFlag & 1 && vnode.el) {
11915
- setVarsOnNode(vnode.el, vars);
11916
- } else if (vnode.type === Fragment) {
11917
- vnode.children.forEach((c) => setVarsOnVNode(c, vars));
11918
- } else if (vnode.type === Static) {
11919
- let { el, anchor } = vnode;
11920
- while (el) {
11921
- setVarsOnNode(el, vars);
11922
- if (el === anchor)
11923
- break;
11924
- el = el.nextSibling;
11925
- }
11926
- }
11927
- }
11928
- function setVarsOnNode(el, vars) {
11929
- if (el.nodeType === 1) {
11930
- const style = el.style;
11931
- for (const key in vars) {
11932
- style.setProperty(`--${key}`, vars[key]);
11933
- }
11934
- }
11935
- }
11936
-
11937
11947
  const positionMap = /* @__PURE__ */ new WeakMap();
11938
11948
  const newPositionMap = /* @__PURE__ */ new WeakMap();
11939
11949
  const moveCbKey = Symbol("_moveCb");
@@ -12316,7 +12326,9 @@ Component that was made reactive: `,
12316
12326
  exact: (e, modifiers) => systemModifiers.some((m) => e[`${m}Key`] && !modifiers.includes(m))
12317
12327
  };
12318
12328
  const withModifiers = (fn, modifiers) => {
12319
- return fn._withMods || (fn._withMods = (event, ...args) => {
12329
+ const cache = fn._withMods || (fn._withMods = {});
12330
+ const cacheKey = modifiers.join(".");
12331
+ return cache[cacheKey] || (cache[cacheKey] = (event, ...args) => {
12320
12332
  for (let i = 0; i < modifiers.length; i++) {
12321
12333
  const guard = modifierGuards[modifiers[i]];
12322
12334
  if (guard && guard(event, modifiers))
@@ -12351,7 +12363,9 @@ Component that was made reactive: `,
12351
12363
  );
12352
12364
  }
12353
12365
  }
12354
- return fn._withKeys || (fn._withKeys = (event) => {
12366
+ const cache = fn._withKeys || (fn._withKeys = {});
12367
+ const cacheKey = modifiers.join(".");
12368
+ return cache[cacheKey] || (cache[cacheKey] = (event) => {
12355
12369
  if (!("key" in event)) {
12356
12370
  return;
12357
12371
  }