@vue/compat 3.4.6 → 3.4.8

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.
@@ -1,3 +1,8 @@
1
+ /**
2
+ * @vue/compat v3.4.8
3
+ * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
+ * @license MIT
5
+ **/
1
6
  function makeMap(str, expectsLowerCase) {
2
7
  const set = new Set(str.split(","));
3
8
  return expectsLowerCase ? (val) => set.has(val.toLowerCase()) : (val) => set.has(val);
@@ -3101,8 +3106,6 @@ function hasPropsChanged(prevProps, nextProps, emitsOptions) {
3101
3106
  return false;
3102
3107
  }
3103
3108
  function updateHOCHostEl({ vnode, parent }, el) {
3104
- if (!el)
3105
- return;
3106
3109
  while (parent) {
3107
3110
  const root = parent.subTree;
3108
3111
  if (root.suspense && root.suspense.activeBranch === vnode) {
@@ -3747,7 +3750,12 @@ function queueEffectWithSuspense(fn, suspense) {
3747
3750
  function setActiveBranch(suspense, branch) {
3748
3751
  suspense.activeBranch = branch;
3749
3752
  const { vnode, parentComponent } = suspense;
3750
- const el = vnode.el = branch.el;
3753
+ let el = branch.el;
3754
+ while (!el && branch.component) {
3755
+ branch = branch.component.subTree;
3756
+ el = branch.el;
3757
+ }
3758
+ vnode.el = el;
3751
3759
  if (parentComponent && parentComponent.subTree === vnode) {
3752
3760
  parentComponent.vnode.el = el;
3753
3761
  updateHOCHostEl(parentComponent, el);
@@ -4042,14 +4050,9 @@ function instanceWatch(source, value, options) {
4042
4050
  cb = value.handler;
4043
4051
  options = value;
4044
4052
  }
4045
- const cur = currentInstance;
4046
- setCurrentInstance(this);
4053
+ const reset = setCurrentInstance(this);
4047
4054
  const res = doWatch(getter, cb.bind(publicThis), options);
4048
- if (cur) {
4049
- setCurrentInstance(cur);
4050
- } else {
4051
- unsetCurrentInstance();
4052
- }
4055
+ reset();
4053
4056
  return res;
4054
4057
  }
4055
4058
  function createPathGetter(ctx, path) {
@@ -4101,12 +4104,11 @@ function validateDirectiveName(name) {
4101
4104
  }
4102
4105
  }
4103
4106
  function withDirectives(vnode, directives) {
4104
- const internalInstance = currentRenderingInstance;
4105
- if (internalInstance === null) {
4107
+ if (currentRenderingInstance === null) {
4106
4108
  !!(process.env.NODE_ENV !== "production") && warn$1(`withDirectives can only be used inside render functions.`);
4107
4109
  return vnode;
4108
4110
  }
4109
- const instance = getExposeProxy(internalInstance) || internalInstance.proxy;
4111
+ const instance = getExposeProxy(currentRenderingInstance) || currentRenderingInstance.proxy;
4110
4112
  const bindings = vnode.dirs || (vnode.dirs = []);
4111
4113
  for (let i = 0; i < directives.length; i++) {
4112
4114
  let [dir, value, arg, modifiers = EMPTY_OBJ] = directives[i];
@@ -4903,9 +4905,9 @@ function injectHook(type, hook, target = currentInstance, prepend = false) {
4903
4905
  return;
4904
4906
  }
4905
4907
  pauseTracking();
4906
- setCurrentInstance(target);
4908
+ const reset = setCurrentInstance(target);
4907
4909
  const res = callWithAsyncErrorHandling(hook, target, type, args);
4908
- unsetCurrentInstance();
4910
+ reset();
4909
4911
  resetTracking();
4910
4912
  return res;
4911
4913
  });
@@ -6499,7 +6501,7 @@ function createCompatVue$1(createApp, createSingletonApp) {
6499
6501
  return vm;
6500
6502
  }
6501
6503
  }
6502
- Vue.version = `2.6.14-compat:${"3.4.6"}`;
6504
+ Vue.version = `2.6.14-compat:${"3.4.8"}`;
6503
6505
  Vue.config = singletonApp.config;
6504
6506
  Vue.use = (p, ...options) => {
6505
6507
  if (p && isFunction(p.install)) {
@@ -7342,12 +7344,12 @@ function resolvePropValue(options, props, key, value, instance, isAbsent) {
7342
7344
  if (key in propsDefaults) {
7343
7345
  value = propsDefaults[key];
7344
7346
  } else {
7345
- setCurrentInstance(instance);
7347
+ const reset = setCurrentInstance(instance);
7346
7348
  value = propsDefaults[key] = defaultValue.call(
7347
7349
  isCompatEnabled("PROPS_DEFAULT_THIS", instance) ? createPropsDefaultThis(instance, props, key) : null,
7348
7350
  props
7349
7351
  );
7350
- unsetCurrentInstance();
7352
+ reset();
7351
7353
  }
7352
7354
  } else {
7353
7355
  value = defaultValue;
@@ -8238,29 +8240,34 @@ function propHasMismatch(el, key, clientValue, vnode) {
8238
8240
  let actual;
8239
8241
  let expected;
8240
8242
  if (key === "class") {
8241
- actual = toClassSet(el.getAttribute("class") || "");
8242
- expected = toClassSet(normalizeClass(clientValue));
8243
- if (!isSetEqual(actual, expected)) {
8243
+ actual = el.getAttribute("class");
8244
+ expected = normalizeClass(clientValue);
8245
+ if (!isSetEqual(toClassSet(actual || ""), toClassSet(expected))) {
8244
8246
  mismatchType = mismatchKey = `class`;
8245
8247
  }
8246
8248
  } else if (key === "style") {
8247
- actual = toStyleMap(el.getAttribute("style") || "");
8248
- expected = toStyleMap(
8249
- isString(clientValue) ? clientValue : stringifyStyle(normalizeStyle(clientValue))
8250
- );
8249
+ actual = el.getAttribute("style");
8250
+ expected = isString(clientValue) ? clientValue : stringifyStyle(normalizeStyle(clientValue));
8251
+ const actualMap = toStyleMap(actual);
8252
+ const expectedMap = toStyleMap(expected);
8251
8253
  if (vnode.dirs) {
8252
8254
  for (const { dir, value } of vnode.dirs) {
8253
8255
  if (dir.name === "show" && !value) {
8254
- expected.set("display", "none");
8256
+ expectedMap.set("display", "none");
8255
8257
  }
8256
8258
  }
8257
8259
  }
8258
- if (!isMapEqual(actual, expected)) {
8260
+ if (!isMapEqual(actualMap, expectedMap)) {
8259
8261
  mismatchType = mismatchKey = "style";
8260
8262
  }
8261
8263
  } else if (el instanceof SVGElement && isKnownSvgAttr(key) || el instanceof HTMLElement && (isBooleanAttr(key) || isKnownHtmlAttr(key))) {
8262
- actual = el.hasAttribute(key) ? el.getAttribute(key) : key in el ? el[key] : "";
8263
- expected = isBooleanAttr(key) ? includeBooleanAttr(clientValue) ? "" : false : clientValue == null ? "" : String(clientValue);
8264
+ if (isBooleanAttr(key)) {
8265
+ actual = el.hasAttribute(key);
8266
+ expected = includeBooleanAttr(clientValue);
8267
+ } else {
8268
+ actual = el.hasAttribute(key) ? el.getAttribute(key) : key in el ? el[key] : "";
8269
+ expected = clientValue == null ? "" : String(clientValue);
8270
+ }
8264
8271
  if (actual !== expected) {
8265
8272
  mismatchType = `attribute`;
8266
8273
  mismatchKey = key;
@@ -10744,14 +10751,7 @@ function createComponentInstance(vnode, parent, suspense) {
10744
10751
  return instance;
10745
10752
  }
10746
10753
  let currentInstance = null;
10747
- const getCurrentInstance = () => {
10748
- if (!!(process.env.NODE_ENV !== "production") && isInComputedGetter) {
10749
- warn$1(
10750
- `getCurrentInstance() called inside a computed getter. This is incorrect usage as computed getters are not guaranteed to be executed with an active component instance. If you are using a composable inside a computed getter, move it ouside to the setup scope.`
10751
- );
10752
- }
10753
- return currentInstance || currentRenderingInstance;
10754
- };
10754
+ const getCurrentInstance = () => currentInstance || currentRenderingInstance;
10755
10755
  let internalSetCurrentInstance;
10756
10756
  let setInSSRSetupState;
10757
10757
  {
@@ -10778,8 +10778,13 @@ let setInSSRSetupState;
10778
10778
  );
10779
10779
  }
10780
10780
  const setCurrentInstance = (instance) => {
10781
+ const prev = currentInstance;
10781
10782
  internalSetCurrentInstance(instance);
10782
10783
  instance.scope.on();
10784
+ return () => {
10785
+ instance.scope.off();
10786
+ internalSetCurrentInstance(prev);
10787
+ };
10783
10788
  };
10784
10789
  const unsetCurrentInstance = () => {
10785
10790
  currentInstance && currentInstance.scope.off();
@@ -10841,7 +10846,7 @@ function setupStatefulComponent(instance, isSSR) {
10841
10846
  const { setup } = Component;
10842
10847
  if (setup) {
10843
10848
  const setupContext = instance.setupContext = setup.length > 1 ? createSetupContext(instance) : null;
10844
- setCurrentInstance(instance);
10849
+ const reset = setCurrentInstance(instance);
10845
10850
  pauseTracking();
10846
10851
  const setupResult = callWithErrorHandling(
10847
10852
  setup,
@@ -10853,7 +10858,7 @@ function setupStatefulComponent(instance, isSSR) {
10853
10858
  ]
10854
10859
  );
10855
10860
  resetTracking();
10856
- unsetCurrentInstance();
10861
+ reset();
10857
10862
  if (isPromise(setupResult)) {
10858
10863
  setupResult.then(unsetCurrentInstance, unsetCurrentInstance);
10859
10864
  if (isSSR) {
@@ -10961,13 +10966,13 @@ function finishComponentSetup(instance, isSSR, skipOptions) {
10961
10966
  }
10962
10967
  }
10963
10968
  if (__VUE_OPTIONS_API__ && !skipOptions) {
10964
- setCurrentInstance(instance);
10969
+ const reset = setCurrentInstance(instance);
10965
10970
  pauseTracking();
10966
10971
  try {
10967
10972
  applyOptions(instance);
10968
10973
  } finally {
10969
10974
  resetTracking();
10970
- unsetCurrentInstance();
10975
+ reset();
10971
10976
  }
10972
10977
  }
10973
10978
  if (!!(process.env.NODE_ENV !== "production") && !Component.render && instance.render === NOOP && !isSSR) {
@@ -11108,25 +11113,7 @@ function isClassComponent(value) {
11108
11113
  return isFunction(value) && "__vccOpts" in value;
11109
11114
  }
11110
11115
 
11111
- let isInComputedGetter = false;
11112
- function wrapComputedGetter(getter) {
11113
- return () => {
11114
- isInComputedGetter = true;
11115
- try {
11116
- return getter();
11117
- } finally {
11118
- isInComputedGetter = false;
11119
- }
11120
- };
11121
- }
11122
11116
  const computed = (getterOrOptions, debugOptions) => {
11123
- if (!!(process.env.NODE_ENV !== "production")) {
11124
- if (isFunction(getterOrOptions)) {
11125
- getterOrOptions = wrapComputedGetter(getterOrOptions);
11126
- } else {
11127
- getterOrOptions.get = wrapComputedGetter(getterOrOptions.get);
11128
- }
11129
- }
11130
11117
  return computed$1(getterOrOptions, debugOptions, isInSSRComponentSetup);
11131
11118
  };
11132
11119
 
@@ -11352,7 +11339,7 @@ function isMemoSame(cached, memo) {
11352
11339
  return true;
11353
11340
  }
11354
11341
 
11355
- const version = "3.4.6";
11342
+ const version = "3.4.8";
11356
11343
  const warn = !!(process.env.NODE_ENV !== "production") ? warn$1 : NOOP;
11357
11344
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
11358
11345
  const devtools = !!(process.env.NODE_ENV !== "production") || __VUE_PROD_DEVTOOLS__ ? devtools$1 : void 0;
@@ -1,3 +1,8 @@
1
+ /**
2
+ * @vue/compat v3.4.8
3
+ * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
+ * @license MIT
5
+ **/
1
6
  var Vue = (function () {
2
7
  'use strict';
3
8
 
@@ -3097,8 +3102,6 @@ Details: https://v3-migration.vuejs.org/breaking-changes/migration-build.html`
3097
3102
  return false;
3098
3103
  }
3099
3104
  function updateHOCHostEl({ vnode, parent }, el) {
3100
- if (!el)
3101
- return;
3102
3105
  while (parent) {
3103
3106
  const root = parent.subTree;
3104
3107
  if (root.suspense && root.suspense.activeBranch === vnode) {
@@ -3743,7 +3746,12 @@ If this is a native custom element, make sure to exclude it from component resol
3743
3746
  function setActiveBranch(suspense, branch) {
3744
3747
  suspense.activeBranch = branch;
3745
3748
  const { vnode, parentComponent } = suspense;
3746
- const el = vnode.el = branch.el;
3749
+ let el = branch.el;
3750
+ while (!el && branch.component) {
3751
+ branch = branch.component.subTree;
3752
+ el = branch.el;
3753
+ }
3754
+ vnode.el = el;
3747
3755
  if (parentComponent && parentComponent.subTree === vnode) {
3748
3756
  parentComponent.vnode.el = el;
3749
3757
  updateHOCHostEl(parentComponent, el);
@@ -4011,14 +4019,9 @@ If this is a native custom element, make sure to exclude it from component resol
4011
4019
  cb = value.handler;
4012
4020
  options = value;
4013
4021
  }
4014
- const cur = currentInstance;
4015
- setCurrentInstance(this);
4022
+ const reset = setCurrentInstance(this);
4016
4023
  const res = doWatch(getter, cb.bind(publicThis), options);
4017
- if (cur) {
4018
- setCurrentInstance(cur);
4019
- } else {
4020
- unsetCurrentInstance();
4021
- }
4024
+ reset();
4022
4025
  return res;
4023
4026
  }
4024
4027
  function createPathGetter(ctx, path) {
@@ -4070,12 +4073,11 @@ If this is a native custom element, make sure to exclude it from component resol
4070
4073
  }
4071
4074
  }
4072
4075
  function withDirectives(vnode, directives) {
4073
- const internalInstance = currentRenderingInstance;
4074
- if (internalInstance === null) {
4076
+ if (currentRenderingInstance === null) {
4075
4077
  warn$1(`withDirectives can only be used inside render functions.`);
4076
4078
  return vnode;
4077
4079
  }
4078
- const instance = getExposeProxy(internalInstance) || internalInstance.proxy;
4080
+ const instance = getExposeProxy(currentRenderingInstance) || currentRenderingInstance.proxy;
4079
4081
  const bindings = vnode.dirs || (vnode.dirs = []);
4080
4082
  for (let i = 0; i < directives.length; i++) {
4081
4083
  let [dir, value, arg, modifiers = EMPTY_OBJ] = directives[i];
@@ -4864,9 +4866,9 @@ If this is a native custom element, make sure to exclude it from component resol
4864
4866
  return;
4865
4867
  }
4866
4868
  pauseTracking();
4867
- setCurrentInstance(target);
4869
+ const reset = setCurrentInstance(target);
4868
4870
  const res = callWithAsyncErrorHandling(hook, target, type, args);
4869
- unsetCurrentInstance();
4871
+ reset();
4870
4872
  resetTracking();
4871
4873
  return res;
4872
4874
  });
@@ -6458,7 +6460,7 @@ If this is a native custom element, make sure to exclude it from component resol
6458
6460
  return vm;
6459
6461
  }
6460
6462
  }
6461
- Vue.version = `2.6.14-compat:${"3.4.6"}`;
6463
+ Vue.version = `2.6.14-compat:${"3.4.8"}`;
6462
6464
  Vue.config = singletonApp.config;
6463
6465
  Vue.use = (p, ...options) => {
6464
6466
  if (p && isFunction(p.install)) {
@@ -7298,12 +7300,12 @@ If you want to remount the same app, move your app creation logic into a factory
7298
7300
  if (key in propsDefaults) {
7299
7301
  value = propsDefaults[key];
7300
7302
  } else {
7301
- setCurrentInstance(instance);
7303
+ const reset = setCurrentInstance(instance);
7302
7304
  value = propsDefaults[key] = defaultValue.call(
7303
7305
  isCompatEnabled("PROPS_DEFAULT_THIS", instance) ? createPropsDefaultThis(instance, props, key) : null,
7304
7306
  props
7305
7307
  );
7306
- unsetCurrentInstance();
7308
+ reset();
7307
7309
  }
7308
7310
  } else {
7309
7311
  value = defaultValue;
@@ -8184,29 +8186,34 @@ Server rendered element contains fewer child nodes than client vdom.`
8184
8186
  let actual;
8185
8187
  let expected;
8186
8188
  if (key === "class") {
8187
- actual = toClassSet(el.getAttribute("class") || "");
8188
- expected = toClassSet(normalizeClass(clientValue));
8189
- if (!isSetEqual(actual, expected)) {
8189
+ actual = el.getAttribute("class");
8190
+ expected = normalizeClass(clientValue);
8191
+ if (!isSetEqual(toClassSet(actual || ""), toClassSet(expected))) {
8190
8192
  mismatchType = mismatchKey = `class`;
8191
8193
  }
8192
8194
  } else if (key === "style") {
8193
- actual = toStyleMap(el.getAttribute("style") || "");
8194
- expected = toStyleMap(
8195
- isString(clientValue) ? clientValue : stringifyStyle(normalizeStyle(clientValue))
8196
- );
8195
+ actual = el.getAttribute("style");
8196
+ expected = isString(clientValue) ? clientValue : stringifyStyle(normalizeStyle(clientValue));
8197
+ const actualMap = toStyleMap(actual);
8198
+ const expectedMap = toStyleMap(expected);
8197
8199
  if (vnode.dirs) {
8198
8200
  for (const { dir, value } of vnode.dirs) {
8199
8201
  if (dir.name === "show" && !value) {
8200
- expected.set("display", "none");
8202
+ expectedMap.set("display", "none");
8201
8203
  }
8202
8204
  }
8203
8205
  }
8204
- if (!isMapEqual(actual, expected)) {
8206
+ if (!isMapEqual(actualMap, expectedMap)) {
8205
8207
  mismatchType = mismatchKey = "style";
8206
8208
  }
8207
8209
  } else if (el instanceof SVGElement && isKnownSvgAttr(key) || el instanceof HTMLElement && (isBooleanAttr(key) || isKnownHtmlAttr(key))) {
8208
- actual = el.hasAttribute(key) ? el.getAttribute(key) : key in el ? el[key] : "";
8209
- expected = isBooleanAttr(key) ? includeBooleanAttr(clientValue) ? "" : false : clientValue == null ? "" : String(clientValue);
8210
+ if (isBooleanAttr(key)) {
8211
+ actual = el.hasAttribute(key);
8212
+ expected = includeBooleanAttr(clientValue);
8213
+ } else {
8214
+ actual = el.hasAttribute(key) ? el.getAttribute(key) : key in el ? el[key] : "";
8215
+ expected = clientValue == null ? "" : String(clientValue);
8216
+ }
8210
8217
  if (actual !== expected) {
8211
8218
  mismatchType = `attribute`;
8212
8219
  mismatchKey = key;
@@ -10650,14 +10657,7 @@ Component that was made reactive: `,
10650
10657
  return instance;
10651
10658
  }
10652
10659
  let currentInstance = null;
10653
- const getCurrentInstance = () => {
10654
- if (isInComputedGetter) {
10655
- warn$1(
10656
- `getCurrentInstance() called inside a computed getter. This is incorrect usage as computed getters are not guaranteed to be executed with an active component instance. If you are using a composable inside a computed getter, move it ouside to the setup scope.`
10657
- );
10658
- }
10659
- return currentInstance || currentRenderingInstance;
10660
- };
10660
+ const getCurrentInstance = () => currentInstance || currentRenderingInstance;
10661
10661
  let internalSetCurrentInstance;
10662
10662
  let setInSSRSetupState;
10663
10663
  {
@@ -10669,8 +10669,13 @@ Component that was made reactive: `,
10669
10669
  };
10670
10670
  }
10671
10671
  const setCurrentInstance = (instance) => {
10672
+ const prev = currentInstance;
10672
10673
  internalSetCurrentInstance(instance);
10673
10674
  instance.scope.on();
10675
+ return () => {
10676
+ instance.scope.off();
10677
+ internalSetCurrentInstance(prev);
10678
+ };
10674
10679
  };
10675
10680
  const unsetCurrentInstance = () => {
10676
10681
  currentInstance && currentInstance.scope.off();
@@ -10732,7 +10737,7 @@ Component that was made reactive: `,
10732
10737
  const { setup } = Component;
10733
10738
  if (setup) {
10734
10739
  const setupContext = instance.setupContext = setup.length > 1 ? createSetupContext(instance) : null;
10735
- setCurrentInstance(instance);
10740
+ const reset = setCurrentInstance(instance);
10736
10741
  pauseTracking();
10737
10742
  const setupResult = callWithErrorHandling(
10738
10743
  setup,
@@ -10744,7 +10749,7 @@ Component that was made reactive: `,
10744
10749
  ]
10745
10750
  );
10746
10751
  resetTracking();
10747
- unsetCurrentInstance();
10752
+ reset();
10748
10753
  if (isPromise(setupResult)) {
10749
10754
  setupResult.then(unsetCurrentInstance, unsetCurrentInstance);
10750
10755
  if (isSSR) {
@@ -10850,13 +10855,13 @@ Component that was made reactive: `,
10850
10855
  }
10851
10856
  }
10852
10857
  if (!skipOptions) {
10853
- setCurrentInstance(instance);
10858
+ const reset = setCurrentInstance(instance);
10854
10859
  pauseTracking();
10855
10860
  try {
10856
10861
  applyOptions(instance);
10857
10862
  } finally {
10858
10863
  resetTracking();
10859
- unsetCurrentInstance();
10864
+ reset();
10860
10865
  }
10861
10866
  }
10862
10867
  if (!Component.render && instance.render === NOOP && !isSSR) {
@@ -10983,25 +10988,7 @@ Component that was made reactive: `,
10983
10988
  return isFunction(value) && "__vccOpts" in value;
10984
10989
  }
10985
10990
 
10986
- let isInComputedGetter = false;
10987
- function wrapComputedGetter(getter) {
10988
- return () => {
10989
- isInComputedGetter = true;
10990
- try {
10991
- return getter();
10992
- } finally {
10993
- isInComputedGetter = false;
10994
- }
10995
- };
10996
- }
10997
10991
  const computed = (getterOrOptions, debugOptions) => {
10998
- {
10999
- if (isFunction(getterOrOptions)) {
11000
- getterOrOptions = wrapComputedGetter(getterOrOptions);
11001
- } else {
11002
- getterOrOptions.get = wrapComputedGetter(getterOrOptions.get);
11003
- }
11004
- }
11005
10992
  return computed$1(getterOrOptions, debugOptions, isInSSRComponentSetup);
11006
10993
  };
11007
10994
 
@@ -11227,7 +11214,7 @@ Component that was made reactive: `,
11227
11214
  return true;
11228
11215
  }
11229
11216
 
11230
- const version = "3.4.6";
11217
+ const version = "3.4.8";
11231
11218
  const warn = warn$1 ;
11232
11219
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
11233
11220
  const devtools = devtools$1 ;