vue 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.
package/dist/vue.cjs.js CHANGED
@@ -1,3 +1,8 @@
1
+ /**
2
+ * vue v3.4.8
3
+ * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
+ * @license MIT
5
+ **/
1
6
  'use strict';
2
7
 
3
8
  Object.defineProperty(exports, '__esModule', { value: true });
@@ -1,3 +1,8 @@
1
+ /**
2
+ * vue v3.4.8
3
+ * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
+ * @license MIT
5
+ **/
1
6
  'use strict';
2
7
 
3
8
  Object.defineProperty(exports, '__esModule', { value: true });
@@ -1,3 +1,8 @@
1
+ /**
2
+ * vue 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);
@@ -2642,8 +2647,6 @@ function hasPropsChanged(prevProps, nextProps, emitsOptions) {
2642
2647
  return false;
2643
2648
  }
2644
2649
  function updateHOCHostEl({ vnode, parent }, el) {
2645
- if (!el)
2646
- return;
2647
2650
  while (parent) {
2648
2651
  const root = parent.subTree;
2649
2652
  if (root.suspense && root.suspense.activeBranch === vnode) {
@@ -3284,7 +3287,12 @@ function queueEffectWithSuspense(fn, suspense) {
3284
3287
  function setActiveBranch(suspense, branch) {
3285
3288
  suspense.activeBranch = branch;
3286
3289
  const { vnode, parentComponent } = suspense;
3287
- const el = vnode.el = branch.el;
3290
+ let el = branch.el;
3291
+ while (!el && branch.component) {
3292
+ branch = branch.component.subTree;
3293
+ el = branch.el;
3294
+ }
3295
+ vnode.el = el;
3288
3296
  if (parentComponent && parentComponent.subTree === vnode) {
3289
3297
  parentComponent.vnode.el = el;
3290
3298
  updateHOCHostEl(parentComponent, el);
@@ -3510,14 +3518,9 @@ function instanceWatch(source, value, options) {
3510
3518
  cb = value.handler;
3511
3519
  options = value;
3512
3520
  }
3513
- const cur = currentInstance;
3514
- setCurrentInstance(this);
3521
+ const reset = setCurrentInstance(this);
3515
3522
  const res = doWatch(getter, cb.bind(publicThis), options);
3516
- if (cur) {
3517
- setCurrentInstance(cur);
3518
- } else {
3519
- unsetCurrentInstance();
3520
- }
3523
+ reset();
3521
3524
  return res;
3522
3525
  }
3523
3526
  function createPathGetter(ctx, path) {
@@ -3569,12 +3572,11 @@ function validateDirectiveName(name) {
3569
3572
  }
3570
3573
  }
3571
3574
  function withDirectives(vnode, directives) {
3572
- const internalInstance = currentRenderingInstance;
3573
- if (internalInstance === null) {
3575
+ if (currentRenderingInstance === null) {
3574
3576
  warn$1(`withDirectives can only be used inside render functions.`);
3575
3577
  return vnode;
3576
3578
  }
3577
- const instance = getExposeProxy(internalInstance) || internalInstance.proxy;
3579
+ const instance = getExposeProxy(currentRenderingInstance) || currentRenderingInstance.proxy;
3578
3580
  const bindings = vnode.dirs || (vnode.dirs = []);
3579
3581
  for (let i = 0; i < directives.length; i++) {
3580
3582
  let [dir, value, arg, modifiers = EMPTY_OBJ] = directives[i];
@@ -4354,9 +4356,9 @@ function injectHook(type, hook, target = currentInstance, prepend = false) {
4354
4356
  return;
4355
4357
  }
4356
4358
  pauseTracking();
4357
- setCurrentInstance(target);
4359
+ const reset = setCurrentInstance(target);
4358
4360
  const res = callWithAsyncErrorHandling(hook, target, type, args);
4359
- unsetCurrentInstance();
4361
+ reset();
4360
4362
  resetTracking();
4361
4363
  return res;
4362
4364
  });
@@ -5741,12 +5743,12 @@ function resolvePropValue(options, props, key, value, instance, isAbsent) {
5741
5743
  if (key in propsDefaults) {
5742
5744
  value = propsDefaults[key];
5743
5745
  } else {
5744
- setCurrentInstance(instance);
5746
+ const reset = setCurrentInstance(instance);
5745
5747
  value = propsDefaults[key] = defaultValue.call(
5746
5748
  null,
5747
5749
  props
5748
5750
  );
5749
- unsetCurrentInstance();
5751
+ reset();
5750
5752
  }
5751
5753
  } else {
5752
5754
  value = defaultValue;
@@ -6622,29 +6624,34 @@ function propHasMismatch(el, key, clientValue, vnode) {
6622
6624
  let actual;
6623
6625
  let expected;
6624
6626
  if (key === "class") {
6625
- actual = toClassSet(el.getAttribute("class") || "");
6626
- expected = toClassSet(normalizeClass(clientValue));
6627
- if (!isSetEqual(actual, expected)) {
6627
+ actual = el.getAttribute("class");
6628
+ expected = normalizeClass(clientValue);
6629
+ if (!isSetEqual(toClassSet(actual || ""), toClassSet(expected))) {
6628
6630
  mismatchType = mismatchKey = `class`;
6629
6631
  }
6630
6632
  } else if (key === "style") {
6631
- actual = toStyleMap(el.getAttribute("style") || "");
6632
- expected = toStyleMap(
6633
- isString(clientValue) ? clientValue : stringifyStyle(normalizeStyle(clientValue))
6634
- );
6633
+ actual = el.getAttribute("style");
6634
+ expected = isString(clientValue) ? clientValue : stringifyStyle(normalizeStyle(clientValue));
6635
+ const actualMap = toStyleMap(actual);
6636
+ const expectedMap = toStyleMap(expected);
6635
6637
  if (vnode.dirs) {
6636
6638
  for (const { dir, value } of vnode.dirs) {
6637
6639
  if (dir.name === "show" && !value) {
6638
- expected.set("display", "none");
6640
+ expectedMap.set("display", "none");
6639
6641
  }
6640
6642
  }
6641
6643
  }
6642
- if (!isMapEqual(actual, expected)) {
6644
+ if (!isMapEqual(actualMap, expectedMap)) {
6643
6645
  mismatchType = mismatchKey = "style";
6644
6646
  }
6645
6647
  } else if (el instanceof SVGElement && isKnownSvgAttr(key) || el instanceof HTMLElement && (isBooleanAttr(key) || isKnownHtmlAttr(key))) {
6646
- actual = el.hasAttribute(key) ? el.getAttribute(key) : key in el ? el[key] : "";
6647
- expected = isBooleanAttr(key) ? includeBooleanAttr(clientValue) ? "" : false : clientValue == null ? "" : String(clientValue);
6648
+ if (isBooleanAttr(key)) {
6649
+ actual = el.hasAttribute(key);
6650
+ expected = includeBooleanAttr(clientValue);
6651
+ } else {
6652
+ actual = el.hasAttribute(key) ? el.getAttribute(key) : key in el ? el[key] : "";
6653
+ expected = clientValue == null ? "" : String(clientValue);
6654
+ }
6648
6655
  if (actual !== expected) {
6649
6656
  mismatchType = `attribute`;
6650
6657
  mismatchKey = key;
@@ -8993,14 +9000,7 @@ function createComponentInstance(vnode, parent, suspense) {
8993
9000
  return instance;
8994
9001
  }
8995
9002
  let currentInstance = null;
8996
- const getCurrentInstance = () => {
8997
- if (isInComputedGetter) {
8998
- warn$1(
8999
- `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.`
9000
- );
9001
- }
9002
- return currentInstance || currentRenderingInstance;
9003
- };
9003
+ const getCurrentInstance = () => currentInstance || currentRenderingInstance;
9004
9004
  let internalSetCurrentInstance;
9005
9005
  let setInSSRSetupState;
9006
9006
  {
@@ -9012,8 +9012,13 @@ let setInSSRSetupState;
9012
9012
  };
9013
9013
  }
9014
9014
  const setCurrentInstance = (instance) => {
9015
+ const prev = currentInstance;
9015
9016
  internalSetCurrentInstance(instance);
9016
9017
  instance.scope.on();
9018
+ return () => {
9019
+ instance.scope.off();
9020
+ internalSetCurrentInstance(prev);
9021
+ };
9017
9022
  };
9018
9023
  const unsetCurrentInstance = () => {
9019
9024
  currentInstance && currentInstance.scope.off();
@@ -9075,7 +9080,7 @@ function setupStatefulComponent(instance, isSSR) {
9075
9080
  const { setup } = Component;
9076
9081
  if (setup) {
9077
9082
  const setupContext = instance.setupContext = setup.length > 1 ? createSetupContext(instance) : null;
9078
- setCurrentInstance(instance);
9083
+ const reset = setCurrentInstance(instance);
9079
9084
  pauseTracking();
9080
9085
  const setupResult = callWithErrorHandling(
9081
9086
  setup,
@@ -9087,7 +9092,7 @@ function setupStatefulComponent(instance, isSSR) {
9087
9092
  ]
9088
9093
  );
9089
9094
  resetTracking();
9090
- unsetCurrentInstance();
9095
+ reset();
9091
9096
  if (isPromise(setupResult)) {
9092
9097
  setupResult.then(unsetCurrentInstance, unsetCurrentInstance);
9093
9098
  if (isSSR) {
@@ -9181,13 +9186,13 @@ function finishComponentSetup(instance, isSSR, skipOptions) {
9181
9186
  }
9182
9187
  }
9183
9188
  {
9184
- setCurrentInstance(instance);
9189
+ const reset = setCurrentInstance(instance);
9185
9190
  pauseTracking();
9186
9191
  try {
9187
9192
  applyOptions(instance);
9188
9193
  } finally {
9189
9194
  resetTracking();
9190
- unsetCurrentInstance();
9195
+ reset();
9191
9196
  }
9192
9197
  }
9193
9198
  if (!Component.render && instance.render === NOOP && !isSSR) {
@@ -9314,25 +9319,7 @@ function isClassComponent(value) {
9314
9319
  return isFunction(value) && "__vccOpts" in value;
9315
9320
  }
9316
9321
 
9317
- let isInComputedGetter = false;
9318
- function wrapComputedGetter(getter) {
9319
- return () => {
9320
- isInComputedGetter = true;
9321
- try {
9322
- return getter();
9323
- } finally {
9324
- isInComputedGetter = false;
9325
- }
9326
- };
9327
- }
9328
9322
  const computed = (getterOrOptions, debugOptions) => {
9329
- {
9330
- if (isFunction(getterOrOptions)) {
9331
- getterOrOptions = wrapComputedGetter(getterOrOptions);
9332
- } else {
9333
- getterOrOptions.get = wrapComputedGetter(getterOrOptions.get);
9334
- }
9335
- }
9336
9323
  return computed$1(getterOrOptions, debugOptions, isInSSRComponentSetup);
9337
9324
  };
9338
9325
 
@@ -9558,7 +9545,7 @@ function isMemoSame(cached, memo) {
9558
9545
  return true;
9559
9546
  }
9560
9547
 
9561
- const version = "3.4.6";
9548
+ const version = "3.4.8";
9562
9549
  const warn = warn$1 ;
9563
9550
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
9564
9551
  const devtools = devtools$1 ;
@@ -13630,8 +13617,7 @@ function createTransformContext(root, {
13630
13617
  }
13631
13618
  context.parent.children.splice(removalIndex, 1);
13632
13619
  },
13633
- onNodeRemoved: () => {
13634
- },
13620
+ onNodeRemoved: NOOP,
13635
13621
  addIdentifiers(exp) {
13636
13622
  },
13637
13623
  removeIdentifiers(exp) {