@vue/runtime-dom 3.3.7 → 3.3.9

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.
@@ -939,7 +939,7 @@ var VueRuntimeDOM = (function (exports) {
939
939
  toRaw(this)
940
940
  );
941
941
  }
942
- return type === "delete" ? false : this;
942
+ return type === "delete" ? false : type === "clear" ? void 0 : this;
943
943
  };
944
944
  }
945
945
  function createInstrumentations() {
@@ -2210,9 +2210,19 @@ var VueRuntimeDOM = (function (exports) {
2210
2210
  try {
2211
2211
  if (vnode.shapeFlag & 4) {
2212
2212
  const proxyToUse = withProxy || proxy;
2213
+ const thisProxy = setupState.__isScriptSetup ? new Proxy(proxyToUse, {
2214
+ get(target, key, receiver) {
2215
+ warn(
2216
+ `Property '${String(
2217
+ key
2218
+ )}' was accessed via 'this'. Avoid using 'this' in templates.`
2219
+ );
2220
+ return Reflect.get(target, key, receiver);
2221
+ }
2222
+ }) : proxyToUse;
2213
2223
  result = normalizeVNode(
2214
2224
  render.call(
2215
- proxyToUse,
2225
+ thisProxy,
2216
2226
  proxyToUse,
2217
2227
  renderCache,
2218
2228
  props,
@@ -2447,6 +2457,61 @@ var VueRuntimeDOM = (function (exports) {
2447
2457
  }
2448
2458
  }
2449
2459
 
2460
+ const COMPONENTS = "components";
2461
+ const DIRECTIVES = "directives";
2462
+ function resolveComponent(name, maybeSelfReference) {
2463
+ return resolveAsset(COMPONENTS, name, true, maybeSelfReference) || name;
2464
+ }
2465
+ const NULL_DYNAMIC_COMPONENT = Symbol.for("v-ndc");
2466
+ function resolveDynamicComponent(component) {
2467
+ if (isString(component)) {
2468
+ return resolveAsset(COMPONENTS, component, false) || component;
2469
+ } else {
2470
+ return component || NULL_DYNAMIC_COMPONENT;
2471
+ }
2472
+ }
2473
+ function resolveDirective(name) {
2474
+ return resolveAsset(DIRECTIVES, name);
2475
+ }
2476
+ function resolveAsset(type, name, warnMissing = true, maybeSelfReference = false) {
2477
+ const instance = currentRenderingInstance || currentInstance;
2478
+ if (instance) {
2479
+ const Component = instance.type;
2480
+ if (type === COMPONENTS) {
2481
+ const selfName = getComponentName(
2482
+ Component,
2483
+ false
2484
+ /* do not include inferred name to avoid breaking existing code */
2485
+ );
2486
+ if (selfName && (selfName === name || selfName === camelize(name) || selfName === capitalize(camelize(name)))) {
2487
+ return Component;
2488
+ }
2489
+ }
2490
+ const res = (
2491
+ // local registration
2492
+ // check instance[type] first which is resolved for options API
2493
+ resolve(instance[type] || Component[type], name) || // global registration
2494
+ resolve(instance.appContext[type], name)
2495
+ );
2496
+ if (!res && maybeSelfReference) {
2497
+ return Component;
2498
+ }
2499
+ if (warnMissing && !res) {
2500
+ const extra = type === COMPONENTS ? `
2501
+ If this is a native custom element, make sure to exclude it from component resolution via compilerOptions.isCustomElement.` : ``;
2502
+ warn(`Failed to resolve ${type.slice(0, -1)}: ${name}${extra}`);
2503
+ }
2504
+ return res;
2505
+ } else {
2506
+ warn(
2507
+ `resolve${capitalize(type.slice(0, -1))} can only be used in render() or setup().`
2508
+ );
2509
+ }
2510
+ }
2511
+ function resolve(registry, name) {
2512
+ return registry && (registry[name] || registry[camelize(name)] || registry[capitalize(camelize(name))]);
2513
+ }
2514
+
2450
2515
  const isSuspense = (type) => type.__isSuspense;
2451
2516
  const SuspenseImpl = {
2452
2517
  name: "Suspense",
@@ -2981,7 +3046,7 @@ var VueRuntimeDOM = (function (exports) {
2981
3046
  }
2982
3047
  if (isArray(s)) {
2983
3048
  const singleChild = filterSingleRoot(s);
2984
- if (!singleChild) {
3049
+ if (!singleChild && s.filter((child) => child !== NULL_DYNAMIC_COMPONENT).length > 0) {
2985
3050
  warn(`<Suspense> slots expect a single root node.`);
2986
3051
  }
2987
3052
  s = singleChild;
@@ -3119,6 +3184,7 @@ var VueRuntimeDOM = (function (exports) {
3119
3184
  let onCleanup = (fn) => {
3120
3185
  cleanup = effect.onStop = () => {
3121
3186
  callWithErrorHandling(fn, instance, 4);
3187
+ cleanup = effect.onStop = void 0;
3122
3188
  };
3123
3189
  };
3124
3190
  let oldValue = isMultiSource ? new Array(source.length).fill(INITIAL_WATCHER_VALUE) : INITIAL_WATCHER_VALUE;
@@ -3589,7 +3655,11 @@ var VueRuntimeDOM = (function (exports) {
3589
3655
  }
3590
3656
  }
3591
3657
  function getKeepAliveChild(vnode) {
3592
- return isKeepAlive(vnode) ? vnode.children ? vnode.children[0] : void 0 : vnode;
3658
+ return isKeepAlive(vnode) ? (
3659
+ // #7121 ensure get the child component subtree in case
3660
+ // it's been replaced during HMR
3661
+ vnode.component ? vnode.component.subTree : vnode.children ? vnode.children[0] : void 0
3662
+ ) : vnode;
3593
3663
  }
3594
3664
  function setTransitionHooks(vnode, hooks) {
3595
3665
  if (vnode.shapeFlag & 6 && vnode.component) {
@@ -4066,61 +4136,6 @@ var VueRuntimeDOM = (function (exports) {
4066
4136
  injectHook("ec", hook, target);
4067
4137
  }
4068
4138
 
4069
- const COMPONENTS = "components";
4070
- const DIRECTIVES = "directives";
4071
- function resolveComponent(name, maybeSelfReference) {
4072
- return resolveAsset(COMPONENTS, name, true, maybeSelfReference) || name;
4073
- }
4074
- const NULL_DYNAMIC_COMPONENT = Symbol.for("v-ndc");
4075
- function resolveDynamicComponent(component) {
4076
- if (isString(component)) {
4077
- return resolveAsset(COMPONENTS, component, false) || component;
4078
- } else {
4079
- return component || NULL_DYNAMIC_COMPONENT;
4080
- }
4081
- }
4082
- function resolveDirective(name) {
4083
- return resolveAsset(DIRECTIVES, name);
4084
- }
4085
- function resolveAsset(type, name, warnMissing = true, maybeSelfReference = false) {
4086
- const instance = currentRenderingInstance || currentInstance;
4087
- if (instance) {
4088
- const Component = instance.type;
4089
- if (type === COMPONENTS) {
4090
- const selfName = getComponentName(
4091
- Component,
4092
- false
4093
- /* do not include inferred name to avoid breaking existing code */
4094
- );
4095
- if (selfName && (selfName === name || selfName === camelize(name) || selfName === capitalize(camelize(name)))) {
4096
- return Component;
4097
- }
4098
- }
4099
- const res = (
4100
- // local registration
4101
- // check instance[type] first which is resolved for options API
4102
- resolve(instance[type] || Component[type], name) || // global registration
4103
- resolve(instance.appContext[type], name)
4104
- );
4105
- if (!res && maybeSelfReference) {
4106
- return Component;
4107
- }
4108
- if (warnMissing && !res) {
4109
- const extra = type === COMPONENTS ? `
4110
- If this is a native custom element, make sure to exclude it from component resolution via compilerOptions.isCustomElement.` : ``;
4111
- warn(`Failed to resolve ${type.slice(0, -1)}: ${name}${extra}`);
4112
- }
4113
- return res;
4114
- } else {
4115
- warn(
4116
- `resolve${capitalize(type.slice(0, -1))} can only be used in render() or setup().`
4117
- );
4118
- }
4119
- }
4120
- function resolve(registry, name) {
4121
- return registry && (registry[name] || registry[camelize(name)] || registry[capitalize(camelize(name))]);
4122
- }
4123
-
4124
4139
  function renderList(source, renderItem, cache, index) {
4125
4140
  let ret;
4126
4141
  const cached = cache && cache[index];
@@ -5637,6 +5652,9 @@ If you want to remount the same app, move your app creation logic into a factory
5637
5652
  };
5638
5653
  }
5639
5654
  function getInvalidTypeMessage(name, value, expectedTypes) {
5655
+ if (expectedTypes.length === 0) {
5656
+ return `Prop type [] for prop "${name}" won't match anything. Did you mean to use type Array instead?`;
5657
+ }
5640
5658
  let message = `Invalid prop: type check failed for prop "${name}". Expected ${expectedTypes.map(capitalize).join(" | ")}`;
5641
5659
  const expectedType = expectedTypes[0];
5642
5660
  const receivedType = toRawType(value);
@@ -5906,6 +5924,20 @@ If you want to remount the same app, move your app creation logic into a factory
5906
5924
  const { type, ref, shapeFlag, patchFlag } = vnode;
5907
5925
  let domType = node.nodeType;
5908
5926
  vnode.el = node;
5927
+ {
5928
+ if (!("__vnode" in node)) {
5929
+ Object.defineProperty(node, "__vnode", {
5930
+ value: vnode,
5931
+ enumerable: false
5932
+ });
5933
+ }
5934
+ if (!("__vueParentComponent" in node)) {
5935
+ Object.defineProperty(node, "__vueParentComponent", {
5936
+ value: parentComponent,
5937
+ enumerable: false
5938
+ });
5939
+ }
5940
+ }
5909
5941
  if (patchFlag === -2) {
5910
5942
  optimized = false;
5911
5943
  vnode.dynamicChildren = null;
@@ -5936,15 +5968,15 @@ If you want to remount the same app, move your app creation logic into a factory
5936
5968
  }
5937
5969
  break;
5938
5970
  case Comment:
5939
- if (domType !== 8 /* COMMENT */ || isFragmentStart) {
5940
- if (node.tagName.toLowerCase() === "template") {
5941
- const content = vnode.el.content.firstChild;
5942
- replaceNode(content, node, parentComponent);
5943
- vnode.el = node = content;
5944
- nextNode = nextSibling(node);
5945
- } else {
5946
- nextNode = onMismatch();
5947
- }
5971
+ if (isTemplateNode(node)) {
5972
+ nextNode = nextSibling(node);
5973
+ replaceNode(
5974
+ vnode.el = node.content.firstChild,
5975
+ node,
5976
+ parentComponent
5977
+ );
5978
+ } else if (domType !== 8 /* COMMENT */ || isFragmentStart) {
5979
+ nextNode = onMismatch();
5948
5980
  } else {
5949
5981
  nextNode = nextSibling(node);
5950
5982
  }
@@ -6067,15 +6099,16 @@ If you want to remount the same app, move your app creation logic into a factory
6067
6099
  const hydrateElement = (el, vnode, parentComponent, parentSuspense, slotScopeIds, optimized) => {
6068
6100
  optimized = optimized || !!vnode.dynamicChildren;
6069
6101
  const { type, props, patchFlag, shapeFlag, dirs, transition } = vnode;
6070
- const forcePatchValue = type === "input" && dirs || type === "option";
6102
+ const forcePatch = type === "input" || type === "option";
6071
6103
  {
6072
6104
  if (dirs) {
6073
6105
  invokeDirectiveHook(vnode, null, parentComponent, "created");
6074
6106
  }
6075
6107
  if (props) {
6076
- if (forcePatchValue || !optimized || patchFlag & (16 | 32)) {
6108
+ if (forcePatch || !optimized || patchFlag & (16 | 32)) {
6077
6109
  for (const key in props) {
6078
- if (forcePatchValue && key.endsWith("value") || isOn(key) && !isReservedProp(key)) {
6110
+ if (forcePatch && (key.endsWith("value") || key === "indeterminate") || isOn(key) && !isReservedProp(key) || // force hydrate v-bind with .prop modifiers
6111
+ key[0] === ".") {
6079
6112
  patchProp(
6080
6113
  el,
6081
6114
  key,
@@ -6288,8 +6321,7 @@ If you want to remount the same app, move your app creation logic into a factory
6288
6321
  let parent = parentComponent;
6289
6322
  while (parent) {
6290
6323
  if (parent.vnode.el === oldNode) {
6291
- parent.vnode.el = newNode;
6292
- parent.subTree.el = newNode;
6324
+ parent.vnode.el = parent.subTree.el = newNode;
6293
6325
  }
6294
6326
  parent = parent.parent;
6295
6327
  }
@@ -7833,6 +7865,7 @@ If you want to remount the same app, move your app creation logic into a factory
7833
7865
  }
7834
7866
  };
7835
7867
  const TeleportImpl = {
7868
+ name: "Teleport",
7836
7869
  __isTeleport: true,
7837
7870
  process(n1, n2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized, internals) {
7838
7871
  const {
@@ -8254,7 +8287,7 @@ If you want to remount the same app, move your app creation logic into a factory
8254
8287
  if (shapeFlag & 4 && isProxy(type)) {
8255
8288
  type = toRaw(type);
8256
8289
  warn(
8257
- `Vue received a Component which was made a reactive object. This can lead to unnecessary performance overhead, and should be avoided by marking the component with \`markRaw\` or using \`shallowRef\` instead of \`ref\`.`,
8290
+ `Vue received a Component that was made a reactive object. This can lead to unnecessary performance overhead and should be avoided by marking the component with \`markRaw\` or using \`shallowRef\` instead of \`ref\`.`,
8258
8291
  `
8259
8292
  Component that was made reactive: `,
8260
8293
  type
@@ -9069,7 +9102,7 @@ Component that was made reactive: `,
9069
9102
  return true;
9070
9103
  }
9071
9104
 
9072
- const version = "3.3.7";
9105
+ const version = "3.3.9";
9073
9106
  const ssrUtils = null;
9074
9107
  const resolveFilter = null;
9075
9108
  const compatUtils = null;
@@ -10202,21 +10235,20 @@ Component that was made reactive: `,
10202
10235
  el[assignKey] = getModelAssigner(vnode);
10203
10236
  if (el.composing)
10204
10237
  return;
10238
+ const elValue = number || el.type === "number" ? looseToNumber(el.value) : el.value;
10239
+ const newValue = value == null ? "" : value;
10240
+ if (elValue === newValue) {
10241
+ return;
10242
+ }
10205
10243
  if (document.activeElement === el && el.type !== "range") {
10206
10244
  if (lazy) {
10207
10245
  return;
10208
10246
  }
10209
- if (trim && el.value.trim() === value) {
10210
- return;
10211
- }
10212
- if ((number || el.type === "number") && looseToNumber(el.value) === value) {
10247
+ if (trim && el.value.trim() === newValue) {
10213
10248
  return;
10214
10249
  }
10215
10250
  }
10216
- const newValue = value == null ? "" : value;
10217
- if (el.value !== newValue) {
10218
- el.value = newValue;
10219
- }
10251
+ el.value = newValue;
10220
10252
  }
10221
10253
  };
10222
10254
  const vModelCheckbox = {