@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);
@@ -3094,8 +3099,6 @@ function hasPropsChanged(prevProps, nextProps, emitsOptions) {
3094
3099
  return false;
3095
3100
  }
3096
3101
  function updateHOCHostEl({ vnode, parent }, el) {
3097
- if (!el)
3098
- return;
3099
3102
  while (parent) {
3100
3103
  const root = parent.subTree;
3101
3104
  if (root.suspense && root.suspense.activeBranch === vnode) {
@@ -3740,7 +3743,12 @@ function queueEffectWithSuspense(fn, suspense) {
3740
3743
  function setActiveBranch(suspense, branch) {
3741
3744
  suspense.activeBranch = branch;
3742
3745
  const { vnode, parentComponent } = suspense;
3743
- const el = vnode.el = branch.el;
3746
+ let el = branch.el;
3747
+ while (!el && branch.component) {
3748
+ branch = branch.component.subTree;
3749
+ el = branch.el;
3750
+ }
3751
+ vnode.el = el;
3744
3752
  if (parentComponent && parentComponent.subTree === vnode) {
3745
3753
  parentComponent.vnode.el = el;
3746
3754
  updateHOCHostEl(parentComponent, el);
@@ -4014,14 +4022,9 @@ function instanceWatch(source, value, options) {
4014
4022
  cb = value.handler;
4015
4023
  options = value;
4016
4024
  }
4017
- const cur = currentInstance;
4018
- setCurrentInstance(this);
4025
+ const reset = setCurrentInstance(this);
4019
4026
  const res = doWatch(getter, cb.bind(publicThis), options);
4020
- if (cur) {
4021
- setCurrentInstance(cur);
4022
- } else {
4023
- unsetCurrentInstance();
4024
- }
4027
+ reset();
4025
4028
  return res;
4026
4029
  }
4027
4030
  function createPathGetter(ctx, path) {
@@ -4073,12 +4076,11 @@ function validateDirectiveName(name) {
4073
4076
  }
4074
4077
  }
4075
4078
  function withDirectives(vnode, directives) {
4076
- const internalInstance = currentRenderingInstance;
4077
- if (internalInstance === null) {
4079
+ if (currentRenderingInstance === null) {
4078
4080
  warn$1(`withDirectives can only be used inside render functions.`);
4079
4081
  return vnode;
4080
4082
  }
4081
- const instance = getExposeProxy(internalInstance) || internalInstance.proxy;
4083
+ const instance = getExposeProxy(currentRenderingInstance) || currentRenderingInstance.proxy;
4082
4084
  const bindings = vnode.dirs || (vnode.dirs = []);
4083
4085
  for (let i = 0; i < directives.length; i++) {
4084
4086
  let [dir, value, arg, modifiers = EMPTY_OBJ] = directives[i];
@@ -4867,9 +4869,9 @@ function injectHook(type, hook, target = currentInstance, prepend = false) {
4867
4869
  return;
4868
4870
  }
4869
4871
  pauseTracking();
4870
- setCurrentInstance(target);
4872
+ const reset = setCurrentInstance(target);
4871
4873
  const res = callWithAsyncErrorHandling(hook, target, type, args);
4872
- unsetCurrentInstance();
4874
+ reset();
4873
4875
  resetTracking();
4874
4876
  return res;
4875
4877
  });
@@ -6461,7 +6463,7 @@ function createCompatVue$1(createApp, createSingletonApp) {
6461
6463
  return vm;
6462
6464
  }
6463
6465
  }
6464
- Vue.version = `2.6.14-compat:${"3.4.6"}`;
6466
+ Vue.version = `2.6.14-compat:${"3.4.8"}`;
6465
6467
  Vue.config = singletonApp.config;
6466
6468
  Vue.use = (p, ...options) => {
6467
6469
  if (p && isFunction(p.install)) {
@@ -7301,12 +7303,12 @@ function resolvePropValue(options, props, key, value, instance, isAbsent) {
7301
7303
  if (key in propsDefaults) {
7302
7304
  value = propsDefaults[key];
7303
7305
  } else {
7304
- setCurrentInstance(instance);
7306
+ const reset = setCurrentInstance(instance);
7305
7307
  value = propsDefaults[key] = defaultValue.call(
7306
7308
  isCompatEnabled("PROPS_DEFAULT_THIS", instance) ? createPropsDefaultThis(instance, props, key) : null,
7307
7309
  props
7308
7310
  );
7309
- unsetCurrentInstance();
7311
+ reset();
7310
7312
  }
7311
7313
  } else {
7312
7314
  value = defaultValue;
@@ -8187,29 +8189,34 @@ function propHasMismatch(el, key, clientValue, vnode) {
8187
8189
  let actual;
8188
8190
  let expected;
8189
8191
  if (key === "class") {
8190
- actual = toClassSet(el.getAttribute("class") || "");
8191
- expected = toClassSet(normalizeClass(clientValue));
8192
- if (!isSetEqual(actual, expected)) {
8192
+ actual = el.getAttribute("class");
8193
+ expected = normalizeClass(clientValue);
8194
+ if (!isSetEqual(toClassSet(actual || ""), toClassSet(expected))) {
8193
8195
  mismatchType = mismatchKey = `class`;
8194
8196
  }
8195
8197
  } else if (key === "style") {
8196
- actual = toStyleMap(el.getAttribute("style") || "");
8197
- expected = toStyleMap(
8198
- isString(clientValue) ? clientValue : stringifyStyle(normalizeStyle(clientValue))
8199
- );
8198
+ actual = el.getAttribute("style");
8199
+ expected = isString(clientValue) ? clientValue : stringifyStyle(normalizeStyle(clientValue));
8200
+ const actualMap = toStyleMap(actual);
8201
+ const expectedMap = toStyleMap(expected);
8200
8202
  if (vnode.dirs) {
8201
8203
  for (const { dir, value } of vnode.dirs) {
8202
8204
  if (dir.name === "show" && !value) {
8203
- expected.set("display", "none");
8205
+ expectedMap.set("display", "none");
8204
8206
  }
8205
8207
  }
8206
8208
  }
8207
- if (!isMapEqual(actual, expected)) {
8209
+ if (!isMapEqual(actualMap, expectedMap)) {
8208
8210
  mismatchType = mismatchKey = "style";
8209
8211
  }
8210
8212
  } else if (el instanceof SVGElement && isKnownSvgAttr(key) || el instanceof HTMLElement && (isBooleanAttr(key) || isKnownHtmlAttr(key))) {
8211
- actual = el.hasAttribute(key) ? el.getAttribute(key) : key in el ? el[key] : "";
8212
- expected = isBooleanAttr(key) ? includeBooleanAttr(clientValue) ? "" : false : clientValue == null ? "" : String(clientValue);
8213
+ if (isBooleanAttr(key)) {
8214
+ actual = el.hasAttribute(key);
8215
+ expected = includeBooleanAttr(clientValue);
8216
+ } else {
8217
+ actual = el.hasAttribute(key) ? el.getAttribute(key) : key in el ? el[key] : "";
8218
+ expected = clientValue == null ? "" : String(clientValue);
8219
+ }
8213
8220
  if (actual !== expected) {
8214
8221
  mismatchType = `attribute`;
8215
8222
  mismatchKey = key;
@@ -10653,14 +10660,7 @@ function createComponentInstance(vnode, parent, suspense) {
10653
10660
  return instance;
10654
10661
  }
10655
10662
  let currentInstance = null;
10656
- const getCurrentInstance = () => {
10657
- if (isInComputedGetter) {
10658
- warn$1(
10659
- `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.`
10660
- );
10661
- }
10662
- return currentInstance || currentRenderingInstance;
10663
- };
10663
+ const getCurrentInstance = () => currentInstance || currentRenderingInstance;
10664
10664
  let internalSetCurrentInstance;
10665
10665
  let setInSSRSetupState;
10666
10666
  {
@@ -10672,8 +10672,13 @@ let setInSSRSetupState;
10672
10672
  };
10673
10673
  }
10674
10674
  const setCurrentInstance = (instance) => {
10675
+ const prev = currentInstance;
10675
10676
  internalSetCurrentInstance(instance);
10676
10677
  instance.scope.on();
10678
+ return () => {
10679
+ instance.scope.off();
10680
+ internalSetCurrentInstance(prev);
10681
+ };
10677
10682
  };
10678
10683
  const unsetCurrentInstance = () => {
10679
10684
  currentInstance && currentInstance.scope.off();
@@ -10735,7 +10740,7 @@ function setupStatefulComponent(instance, isSSR) {
10735
10740
  const { setup } = Component;
10736
10741
  if (setup) {
10737
10742
  const setupContext = instance.setupContext = setup.length > 1 ? createSetupContext(instance) : null;
10738
- setCurrentInstance(instance);
10743
+ const reset = setCurrentInstance(instance);
10739
10744
  pauseTracking();
10740
10745
  const setupResult = callWithErrorHandling(
10741
10746
  setup,
@@ -10747,7 +10752,7 @@ function setupStatefulComponent(instance, isSSR) {
10747
10752
  ]
10748
10753
  );
10749
10754
  resetTracking();
10750
- unsetCurrentInstance();
10755
+ reset();
10751
10756
  if (isPromise(setupResult)) {
10752
10757
  setupResult.then(unsetCurrentInstance, unsetCurrentInstance);
10753
10758
  if (isSSR) {
@@ -10853,13 +10858,13 @@ function finishComponentSetup(instance, isSSR, skipOptions) {
10853
10858
  }
10854
10859
  }
10855
10860
  if (!skipOptions) {
10856
- setCurrentInstance(instance);
10861
+ const reset = setCurrentInstance(instance);
10857
10862
  pauseTracking();
10858
10863
  try {
10859
10864
  applyOptions(instance);
10860
10865
  } finally {
10861
10866
  resetTracking();
10862
- unsetCurrentInstance();
10867
+ reset();
10863
10868
  }
10864
10869
  }
10865
10870
  if (!Component.render && instance.render === NOOP && !isSSR) {
@@ -10986,25 +10991,7 @@ function isClassComponent(value) {
10986
10991
  return isFunction(value) && "__vccOpts" in value;
10987
10992
  }
10988
10993
 
10989
- let isInComputedGetter = false;
10990
- function wrapComputedGetter(getter) {
10991
- return () => {
10992
- isInComputedGetter = true;
10993
- try {
10994
- return getter();
10995
- } finally {
10996
- isInComputedGetter = false;
10997
- }
10998
- };
10999
- }
11000
10994
  const computed = (getterOrOptions, debugOptions) => {
11001
- {
11002
- if (isFunction(getterOrOptions)) {
11003
- getterOrOptions = wrapComputedGetter(getterOrOptions);
11004
- } else {
11005
- getterOrOptions.get = wrapComputedGetter(getterOrOptions.get);
11006
- }
11007
- }
11008
10995
  return computed$1(getterOrOptions, debugOptions, isInSSRComponentSetup);
11009
10996
  };
11010
10997
 
@@ -11230,7 +11217,7 @@ function isMemoSame(cached, memo) {
11230
11217
  return true;
11231
11218
  }
11232
11219
 
11233
- const version = "3.4.6";
11220
+ const version = "3.4.8";
11234
11221
  const warn = warn$1 ;
11235
11222
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
11236
11223
  const devtools = devtools$1 ;