@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
  var VueRuntimeDOM = (function (exports) {
2
7
  'use strict';
3
8
 
@@ -2580,8 +2585,6 @@ var VueRuntimeDOM = (function (exports) {
2580
2585
  return false;
2581
2586
  }
2582
2587
  function updateHOCHostEl({ vnode, parent }, el) {
2583
- if (!el)
2584
- return;
2585
2588
  while (parent) {
2586
2589
  const root = parent.subTree;
2587
2590
  if (root.suspense && root.suspense.activeBranch === vnode) {
@@ -3222,7 +3225,12 @@ If this is a native custom element, make sure to exclude it from component resol
3222
3225
  function setActiveBranch(suspense, branch) {
3223
3226
  suspense.activeBranch = branch;
3224
3227
  const { vnode, parentComponent } = suspense;
3225
- const el = vnode.el = branch.el;
3228
+ let el = branch.el;
3229
+ while (!el && branch.component) {
3230
+ branch = branch.component.subTree;
3231
+ el = branch.el;
3232
+ }
3233
+ vnode.el = el;
3226
3234
  if (parentComponent && parentComponent.subTree === vnode) {
3227
3235
  parentComponent.vnode.el = el;
3228
3236
  updateHOCHostEl(parentComponent, el);
@@ -3442,14 +3450,9 @@ If this is a native custom element, make sure to exclude it from component resol
3442
3450
  cb = value.handler;
3443
3451
  options = value;
3444
3452
  }
3445
- const cur = currentInstance;
3446
- setCurrentInstance(this);
3453
+ const reset = setCurrentInstance(this);
3447
3454
  const res = doWatch(getter, cb.bind(publicThis), options);
3448
- if (cur) {
3449
- setCurrentInstance(cur);
3450
- } else {
3451
- unsetCurrentInstance();
3452
- }
3455
+ reset();
3453
3456
  return res;
3454
3457
  }
3455
3458
  function createPathGetter(ctx, path) {
@@ -3501,12 +3504,11 @@ If this is a native custom element, make sure to exclude it from component resol
3501
3504
  }
3502
3505
  }
3503
3506
  function withDirectives(vnode, directives) {
3504
- const internalInstance = currentRenderingInstance;
3505
- if (internalInstance === null) {
3507
+ if (currentRenderingInstance === null) {
3506
3508
  warn$1(`withDirectives can only be used inside render functions.`);
3507
3509
  return vnode;
3508
3510
  }
3509
- const instance = getExposeProxy(internalInstance) || internalInstance.proxy;
3511
+ const instance = getExposeProxy(currentRenderingInstance) || currentRenderingInstance.proxy;
3510
3512
  const bindings = vnode.dirs || (vnode.dirs = []);
3511
3513
  for (let i = 0; i < directives.length; i++) {
3512
3514
  let [dir, value, arg, modifiers = EMPTY_OBJ] = directives[i];
@@ -4286,9 +4288,9 @@ If this is a native custom element, make sure to exclude it from component resol
4286
4288
  return;
4287
4289
  }
4288
4290
  pauseTracking();
4289
- setCurrentInstance(target);
4291
+ const reset = setCurrentInstance(target);
4290
4292
  const res = callWithAsyncErrorHandling(hook, target, type, args);
4291
- unsetCurrentInstance();
4293
+ reset();
4292
4294
  resetTracking();
4293
4295
  return res;
4294
4296
  });
@@ -5673,12 +5675,12 @@ If you want to remount the same app, move your app creation logic into a factory
5673
5675
  if (key in propsDefaults) {
5674
5676
  value = propsDefaults[key];
5675
5677
  } else {
5676
- setCurrentInstance(instance);
5678
+ const reset = setCurrentInstance(instance);
5677
5679
  value = propsDefaults[key] = defaultValue.call(
5678
5680
  null,
5679
5681
  props
5680
5682
  );
5681
- unsetCurrentInstance();
5683
+ reset();
5682
5684
  }
5683
5685
  } else {
5684
5686
  value = defaultValue;
@@ -6554,29 +6556,34 @@ Server rendered element contains fewer child nodes than client vdom.`
6554
6556
  let actual;
6555
6557
  let expected;
6556
6558
  if (key === "class") {
6557
- actual = toClassSet(el.getAttribute("class") || "");
6558
- expected = toClassSet(normalizeClass(clientValue));
6559
- if (!isSetEqual(actual, expected)) {
6559
+ actual = el.getAttribute("class");
6560
+ expected = normalizeClass(clientValue);
6561
+ if (!isSetEqual(toClassSet(actual || ""), toClassSet(expected))) {
6560
6562
  mismatchType = mismatchKey = `class`;
6561
6563
  }
6562
6564
  } else if (key === "style") {
6563
- actual = toStyleMap(el.getAttribute("style") || "");
6564
- expected = toStyleMap(
6565
- isString(clientValue) ? clientValue : stringifyStyle(normalizeStyle(clientValue))
6566
- );
6565
+ actual = el.getAttribute("style");
6566
+ expected = isString(clientValue) ? clientValue : stringifyStyle(normalizeStyle(clientValue));
6567
+ const actualMap = toStyleMap(actual);
6568
+ const expectedMap = toStyleMap(expected);
6567
6569
  if (vnode.dirs) {
6568
6570
  for (const { dir, value } of vnode.dirs) {
6569
6571
  if (dir.name === "show" && !value) {
6570
- expected.set("display", "none");
6572
+ expectedMap.set("display", "none");
6571
6573
  }
6572
6574
  }
6573
6575
  }
6574
- if (!isMapEqual(actual, expected)) {
6576
+ if (!isMapEqual(actualMap, expectedMap)) {
6575
6577
  mismatchType = mismatchKey = "style";
6576
6578
  }
6577
6579
  } else if (el instanceof SVGElement && isKnownSvgAttr(key) || el instanceof HTMLElement && (isBooleanAttr(key) || isKnownHtmlAttr(key))) {
6578
- actual = el.hasAttribute(key) ? el.getAttribute(key) : key in el ? el[key] : "";
6579
- expected = isBooleanAttr(key) ? includeBooleanAttr(clientValue) ? "" : false : clientValue == null ? "" : String(clientValue);
6580
+ if (isBooleanAttr(key)) {
6581
+ actual = el.hasAttribute(key);
6582
+ expected = includeBooleanAttr(clientValue);
6583
+ } else {
6584
+ actual = el.hasAttribute(key) ? el.getAttribute(key) : key in el ? el[key] : "";
6585
+ expected = clientValue == null ? "" : String(clientValue);
6586
+ }
6580
6587
  if (actual !== expected) {
6581
6588
  mismatchType = `attribute`;
6582
6589
  mismatchKey = key;
@@ -8925,14 +8932,7 @@ Component that was made reactive: `,
8925
8932
  return instance;
8926
8933
  }
8927
8934
  let currentInstance = null;
8928
- const getCurrentInstance = () => {
8929
- if (isInComputedGetter) {
8930
- warn$1(
8931
- `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.`
8932
- );
8933
- }
8934
- return currentInstance || currentRenderingInstance;
8935
- };
8935
+ const getCurrentInstance = () => currentInstance || currentRenderingInstance;
8936
8936
  let internalSetCurrentInstance;
8937
8937
  let setInSSRSetupState;
8938
8938
  {
@@ -8944,8 +8944,13 @@ Component that was made reactive: `,
8944
8944
  };
8945
8945
  }
8946
8946
  const setCurrentInstance = (instance) => {
8947
+ const prev = currentInstance;
8947
8948
  internalSetCurrentInstance(instance);
8948
8949
  instance.scope.on();
8950
+ return () => {
8951
+ instance.scope.off();
8952
+ internalSetCurrentInstance(prev);
8953
+ };
8949
8954
  };
8950
8955
  const unsetCurrentInstance = () => {
8951
8956
  currentInstance && currentInstance.scope.off();
@@ -9007,7 +9012,7 @@ Component that was made reactive: `,
9007
9012
  const { setup } = Component;
9008
9013
  if (setup) {
9009
9014
  const setupContext = instance.setupContext = setup.length > 1 ? createSetupContext(instance) : null;
9010
- setCurrentInstance(instance);
9015
+ const reset = setCurrentInstance(instance);
9011
9016
  pauseTracking();
9012
9017
  const setupResult = callWithErrorHandling(
9013
9018
  setup,
@@ -9019,7 +9024,7 @@ Component that was made reactive: `,
9019
9024
  ]
9020
9025
  );
9021
9026
  resetTracking();
9022
- unsetCurrentInstance();
9027
+ reset();
9023
9028
  if (isPromise(setupResult)) {
9024
9029
  setupResult.then(unsetCurrentInstance, unsetCurrentInstance);
9025
9030
  if (isSSR) {
@@ -9113,13 +9118,13 @@ Component that was made reactive: `,
9113
9118
  }
9114
9119
  }
9115
9120
  {
9116
- setCurrentInstance(instance);
9121
+ const reset = setCurrentInstance(instance);
9117
9122
  pauseTracking();
9118
9123
  try {
9119
9124
  applyOptions(instance);
9120
9125
  } finally {
9121
9126
  resetTracking();
9122
- unsetCurrentInstance();
9127
+ reset();
9123
9128
  }
9124
9129
  }
9125
9130
  if (!Component.render && instance.render === NOOP && !isSSR) {
@@ -9246,25 +9251,7 @@ Component that was made reactive: `,
9246
9251
  return isFunction(value) && "__vccOpts" in value;
9247
9252
  }
9248
9253
 
9249
- let isInComputedGetter = false;
9250
- function wrapComputedGetter(getter) {
9251
- return () => {
9252
- isInComputedGetter = true;
9253
- try {
9254
- return getter();
9255
- } finally {
9256
- isInComputedGetter = false;
9257
- }
9258
- };
9259
- }
9260
9254
  const computed = (getterOrOptions, debugOptions) => {
9261
- {
9262
- if (isFunction(getterOrOptions)) {
9263
- getterOrOptions = wrapComputedGetter(getterOrOptions);
9264
- } else {
9265
- getterOrOptions.get = wrapComputedGetter(getterOrOptions.get);
9266
- }
9267
- }
9268
9255
  return computed$1(getterOrOptions, debugOptions, isInSSRComponentSetup);
9269
9256
  };
9270
9257
 
@@ -9490,7 +9477,7 @@ Component that was made reactive: `,
9490
9477
  return true;
9491
9478
  }
9492
9479
 
9493
- const version = "3.4.6";
9480
+ const version = "3.4.8";
9494
9481
  const warn = warn$1 ;
9495
9482
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
9496
9483
  const devtools = devtools$1 ;