@vue/runtime-dom 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/runtime-dom 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/runtime-dom 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/runtime-dom 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);
@@ -2577,8 +2582,6 @@ function hasPropsChanged(prevProps, nextProps, emitsOptions) {
2577
2582
  return false;
2578
2583
  }
2579
2584
  function updateHOCHostEl({ vnode, parent }, el) {
2580
- if (!el)
2581
- return;
2582
2585
  while (parent) {
2583
2586
  const root = parent.subTree;
2584
2587
  if (root.suspense && root.suspense.activeBranch === vnode) {
@@ -3219,7 +3222,12 @@ function queueEffectWithSuspense(fn, suspense) {
3219
3222
  function setActiveBranch(suspense, branch) {
3220
3223
  suspense.activeBranch = branch;
3221
3224
  const { vnode, parentComponent } = suspense;
3222
- const el = vnode.el = branch.el;
3225
+ let el = branch.el;
3226
+ while (!el && branch.component) {
3227
+ branch = branch.component.subTree;
3228
+ el = branch.el;
3229
+ }
3230
+ vnode.el = el;
3223
3231
  if (parentComponent && parentComponent.subTree === vnode) {
3224
3232
  parentComponent.vnode.el = el;
3225
3233
  updateHOCHostEl(parentComponent, el);
@@ -3445,14 +3453,9 @@ function instanceWatch(source, value, options) {
3445
3453
  cb = value.handler;
3446
3454
  options = value;
3447
3455
  }
3448
- const cur = currentInstance;
3449
- setCurrentInstance(this);
3456
+ const reset = setCurrentInstance(this);
3450
3457
  const res = doWatch(getter, cb.bind(publicThis), options);
3451
- if (cur) {
3452
- setCurrentInstance(cur);
3453
- } else {
3454
- unsetCurrentInstance();
3455
- }
3458
+ reset();
3456
3459
  return res;
3457
3460
  }
3458
3461
  function createPathGetter(ctx, path) {
@@ -3504,12 +3507,11 @@ function validateDirectiveName(name) {
3504
3507
  }
3505
3508
  }
3506
3509
  function withDirectives(vnode, directives) {
3507
- const internalInstance = currentRenderingInstance;
3508
- if (internalInstance === null) {
3510
+ if (currentRenderingInstance === null) {
3509
3511
  warn$1(`withDirectives can only be used inside render functions.`);
3510
3512
  return vnode;
3511
3513
  }
3512
- const instance = getExposeProxy(internalInstance) || internalInstance.proxy;
3514
+ const instance = getExposeProxy(currentRenderingInstance) || currentRenderingInstance.proxy;
3513
3515
  const bindings = vnode.dirs || (vnode.dirs = []);
3514
3516
  for (let i = 0; i < directives.length; i++) {
3515
3517
  let [dir, value, arg, modifiers = EMPTY_OBJ] = directives[i];
@@ -4289,9 +4291,9 @@ function injectHook(type, hook, target = currentInstance, prepend = false) {
4289
4291
  return;
4290
4292
  }
4291
4293
  pauseTracking();
4292
- setCurrentInstance(target);
4294
+ const reset = setCurrentInstance(target);
4293
4295
  const res = callWithAsyncErrorHandling(hook, target, type, args);
4294
- unsetCurrentInstance();
4296
+ reset();
4295
4297
  resetTracking();
4296
4298
  return res;
4297
4299
  });
@@ -5676,12 +5678,12 @@ function resolvePropValue(options, props, key, value, instance, isAbsent) {
5676
5678
  if (key in propsDefaults) {
5677
5679
  value = propsDefaults[key];
5678
5680
  } else {
5679
- setCurrentInstance(instance);
5681
+ const reset = setCurrentInstance(instance);
5680
5682
  value = propsDefaults[key] = defaultValue.call(
5681
5683
  null,
5682
5684
  props
5683
5685
  );
5684
- unsetCurrentInstance();
5686
+ reset();
5685
5687
  }
5686
5688
  } else {
5687
5689
  value = defaultValue;
@@ -6557,29 +6559,34 @@ function propHasMismatch(el, key, clientValue, vnode) {
6557
6559
  let actual;
6558
6560
  let expected;
6559
6561
  if (key === "class") {
6560
- actual = toClassSet(el.getAttribute("class") || "");
6561
- expected = toClassSet(normalizeClass(clientValue));
6562
- if (!isSetEqual(actual, expected)) {
6562
+ actual = el.getAttribute("class");
6563
+ expected = normalizeClass(clientValue);
6564
+ if (!isSetEqual(toClassSet(actual || ""), toClassSet(expected))) {
6563
6565
  mismatchType = mismatchKey = `class`;
6564
6566
  }
6565
6567
  } else if (key === "style") {
6566
- actual = toStyleMap(el.getAttribute("style") || "");
6567
- expected = toStyleMap(
6568
- isString(clientValue) ? clientValue : stringifyStyle(normalizeStyle(clientValue))
6569
- );
6568
+ actual = el.getAttribute("style");
6569
+ expected = isString(clientValue) ? clientValue : stringifyStyle(normalizeStyle(clientValue));
6570
+ const actualMap = toStyleMap(actual);
6571
+ const expectedMap = toStyleMap(expected);
6570
6572
  if (vnode.dirs) {
6571
6573
  for (const { dir, value } of vnode.dirs) {
6572
6574
  if (dir.name === "show" && !value) {
6573
- expected.set("display", "none");
6575
+ expectedMap.set("display", "none");
6574
6576
  }
6575
6577
  }
6576
6578
  }
6577
- if (!isMapEqual(actual, expected)) {
6579
+ if (!isMapEqual(actualMap, expectedMap)) {
6578
6580
  mismatchType = mismatchKey = "style";
6579
6581
  }
6580
6582
  } else if (el instanceof SVGElement && isKnownSvgAttr(key) || el instanceof HTMLElement && (isBooleanAttr(key) || isKnownHtmlAttr(key))) {
6581
- actual = el.hasAttribute(key) ? el.getAttribute(key) : key in el ? el[key] : "";
6582
- expected = isBooleanAttr(key) ? includeBooleanAttr(clientValue) ? "" : false : clientValue == null ? "" : String(clientValue);
6583
+ if (isBooleanAttr(key)) {
6584
+ actual = el.hasAttribute(key);
6585
+ expected = includeBooleanAttr(clientValue);
6586
+ } else {
6587
+ actual = el.hasAttribute(key) ? el.getAttribute(key) : key in el ? el[key] : "";
6588
+ expected = clientValue == null ? "" : String(clientValue);
6589
+ }
6583
6590
  if (actual !== expected) {
6584
6591
  mismatchType = `attribute`;
6585
6592
  mismatchKey = key;
@@ -8928,14 +8935,7 @@ function createComponentInstance(vnode, parent, suspense) {
8928
8935
  return instance;
8929
8936
  }
8930
8937
  let currentInstance = null;
8931
- const getCurrentInstance = () => {
8932
- if (isInComputedGetter) {
8933
- warn$1(
8934
- `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.`
8935
- );
8936
- }
8937
- return currentInstance || currentRenderingInstance;
8938
- };
8938
+ const getCurrentInstance = () => currentInstance || currentRenderingInstance;
8939
8939
  let internalSetCurrentInstance;
8940
8940
  let setInSSRSetupState;
8941
8941
  {
@@ -8947,8 +8947,13 @@ let setInSSRSetupState;
8947
8947
  };
8948
8948
  }
8949
8949
  const setCurrentInstance = (instance) => {
8950
+ const prev = currentInstance;
8950
8951
  internalSetCurrentInstance(instance);
8951
8952
  instance.scope.on();
8953
+ return () => {
8954
+ instance.scope.off();
8955
+ internalSetCurrentInstance(prev);
8956
+ };
8952
8957
  };
8953
8958
  const unsetCurrentInstance = () => {
8954
8959
  currentInstance && currentInstance.scope.off();
@@ -9010,7 +9015,7 @@ function setupStatefulComponent(instance, isSSR) {
9010
9015
  const { setup } = Component;
9011
9016
  if (setup) {
9012
9017
  const setupContext = instance.setupContext = setup.length > 1 ? createSetupContext(instance) : null;
9013
- setCurrentInstance(instance);
9018
+ const reset = setCurrentInstance(instance);
9014
9019
  pauseTracking();
9015
9020
  const setupResult = callWithErrorHandling(
9016
9021
  setup,
@@ -9022,7 +9027,7 @@ function setupStatefulComponent(instance, isSSR) {
9022
9027
  ]
9023
9028
  );
9024
9029
  resetTracking();
9025
- unsetCurrentInstance();
9030
+ reset();
9026
9031
  if (isPromise(setupResult)) {
9027
9032
  setupResult.then(unsetCurrentInstance, unsetCurrentInstance);
9028
9033
  if (isSSR) {
@@ -9116,13 +9121,13 @@ function finishComponentSetup(instance, isSSR, skipOptions) {
9116
9121
  }
9117
9122
  }
9118
9123
  {
9119
- setCurrentInstance(instance);
9124
+ const reset = setCurrentInstance(instance);
9120
9125
  pauseTracking();
9121
9126
  try {
9122
9127
  applyOptions(instance);
9123
9128
  } finally {
9124
9129
  resetTracking();
9125
- unsetCurrentInstance();
9130
+ reset();
9126
9131
  }
9127
9132
  }
9128
9133
  if (!Component.render && instance.render === NOOP && !isSSR) {
@@ -9249,25 +9254,7 @@ function isClassComponent(value) {
9249
9254
  return isFunction(value) && "__vccOpts" in value;
9250
9255
  }
9251
9256
 
9252
- let isInComputedGetter = false;
9253
- function wrapComputedGetter(getter) {
9254
- return () => {
9255
- isInComputedGetter = true;
9256
- try {
9257
- return getter();
9258
- } finally {
9259
- isInComputedGetter = false;
9260
- }
9261
- };
9262
- }
9263
9257
  const computed = (getterOrOptions, debugOptions) => {
9264
- {
9265
- if (isFunction(getterOrOptions)) {
9266
- getterOrOptions = wrapComputedGetter(getterOrOptions);
9267
- } else {
9268
- getterOrOptions.get = wrapComputedGetter(getterOrOptions.get);
9269
- }
9270
- }
9271
9258
  return computed$1(getterOrOptions, debugOptions, isInSSRComponentSetup);
9272
9259
  };
9273
9260
 
@@ -9493,7 +9480,7 @@ function isMemoSame(cached, memo) {
9493
9480
  return true;
9494
9481
  }
9495
9482
 
9496
- const version = "3.4.6";
9483
+ const version = "3.4.8";
9497
9484
  const warn = warn$1 ;
9498
9485
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
9499
9486
  const devtools = devtools$1 ;