vue 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.
@@ -107,7 +107,7 @@ var Vue = (function (exports) {
107
107
  [4]: `STYLE`,
108
108
  [8]: `PROPS`,
109
109
  [16]: `FULL_PROPS`,
110
- [32]: `HYDRATE_EVENTS`,
110
+ [32]: `NEED_HYDRATION`,
111
111
  [64]: `STABLE_FRAGMENT`,
112
112
  [128]: `KEYED_FRAGMENT`,
113
113
  [256]: `UNKEYED_FRAGMENT`,
@@ -1004,7 +1004,7 @@ var Vue = (function (exports) {
1004
1004
  toRaw(this)
1005
1005
  );
1006
1006
  }
1007
- return type === "delete" ? false : this;
1007
+ return type === "delete" ? false : type === "clear" ? void 0 : this;
1008
1008
  };
1009
1009
  }
1010
1010
  function createInstrumentations() {
@@ -2275,9 +2275,19 @@ var Vue = (function (exports) {
2275
2275
  try {
2276
2276
  if (vnode.shapeFlag & 4) {
2277
2277
  const proxyToUse = withProxy || proxy;
2278
+ const thisProxy = setupState.__isScriptSetup ? new Proxy(proxyToUse, {
2279
+ get(target, key, receiver) {
2280
+ warn(
2281
+ `Property '${String(
2282
+ key
2283
+ )}' was accessed via 'this'. Avoid using 'this' in templates.`
2284
+ );
2285
+ return Reflect.get(target, key, receiver);
2286
+ }
2287
+ }) : proxyToUse;
2278
2288
  result = normalizeVNode(
2279
2289
  render.call(
2280
- proxyToUse,
2290
+ thisProxy,
2281
2291
  proxyToUse,
2282
2292
  renderCache,
2283
2293
  props,
@@ -2512,6 +2522,61 @@ var Vue = (function (exports) {
2512
2522
  }
2513
2523
  }
2514
2524
 
2525
+ const COMPONENTS = "components";
2526
+ const DIRECTIVES = "directives";
2527
+ function resolveComponent(name, maybeSelfReference) {
2528
+ return resolveAsset(COMPONENTS, name, true, maybeSelfReference) || name;
2529
+ }
2530
+ const NULL_DYNAMIC_COMPONENT = Symbol.for("v-ndc");
2531
+ function resolveDynamicComponent(component) {
2532
+ if (isString(component)) {
2533
+ return resolveAsset(COMPONENTS, component, false) || component;
2534
+ } else {
2535
+ return component || NULL_DYNAMIC_COMPONENT;
2536
+ }
2537
+ }
2538
+ function resolveDirective(name) {
2539
+ return resolveAsset(DIRECTIVES, name);
2540
+ }
2541
+ function resolveAsset(type, name, warnMissing = true, maybeSelfReference = false) {
2542
+ const instance = currentRenderingInstance || currentInstance;
2543
+ if (instance) {
2544
+ const Component = instance.type;
2545
+ if (type === COMPONENTS) {
2546
+ const selfName = getComponentName(
2547
+ Component,
2548
+ false
2549
+ /* do not include inferred name to avoid breaking existing code */
2550
+ );
2551
+ if (selfName && (selfName === name || selfName === camelize(name) || selfName === capitalize(camelize(name)))) {
2552
+ return Component;
2553
+ }
2554
+ }
2555
+ const res = (
2556
+ // local registration
2557
+ // check instance[type] first which is resolved for options API
2558
+ resolve(instance[type] || Component[type], name) || // global registration
2559
+ resolve(instance.appContext[type], name)
2560
+ );
2561
+ if (!res && maybeSelfReference) {
2562
+ return Component;
2563
+ }
2564
+ if (warnMissing && !res) {
2565
+ const extra = type === COMPONENTS ? `
2566
+ If this is a native custom element, make sure to exclude it from component resolution via compilerOptions.isCustomElement.` : ``;
2567
+ warn(`Failed to resolve ${type.slice(0, -1)}: ${name}${extra}`);
2568
+ }
2569
+ return res;
2570
+ } else {
2571
+ warn(
2572
+ `resolve${capitalize(type.slice(0, -1))} can only be used in render() or setup().`
2573
+ );
2574
+ }
2575
+ }
2576
+ function resolve(registry, name) {
2577
+ return registry && (registry[name] || registry[camelize(name)] || registry[capitalize(camelize(name))]);
2578
+ }
2579
+
2515
2580
  const isSuspense = (type) => type.__isSuspense;
2516
2581
  const SuspenseImpl = {
2517
2582
  name: "Suspense",
@@ -3046,7 +3111,7 @@ var Vue = (function (exports) {
3046
3111
  }
3047
3112
  if (isArray(s)) {
3048
3113
  const singleChild = filterSingleRoot(s);
3049
- if (!singleChild) {
3114
+ if (!singleChild && s.filter((child) => child !== NULL_DYNAMIC_COMPONENT).length > 0) {
3050
3115
  warn(`<Suspense> slots expect a single root node.`);
3051
3116
  }
3052
3117
  s = singleChild;
@@ -3184,6 +3249,7 @@ var Vue = (function (exports) {
3184
3249
  let onCleanup = (fn) => {
3185
3250
  cleanup = effect.onStop = () => {
3186
3251
  callWithErrorHandling(fn, instance, 4);
3252
+ cleanup = effect.onStop = void 0;
3187
3253
  };
3188
3254
  };
3189
3255
  let oldValue = isMultiSource ? new Array(source.length).fill(INITIAL_WATCHER_VALUE) : INITIAL_WATCHER_VALUE;
@@ -3654,7 +3720,11 @@ var Vue = (function (exports) {
3654
3720
  }
3655
3721
  }
3656
3722
  function getKeepAliveChild(vnode) {
3657
- return isKeepAlive(vnode) ? vnode.children ? vnode.children[0] : void 0 : vnode;
3723
+ return isKeepAlive(vnode) ? (
3724
+ // #7121 ensure get the child component subtree in case
3725
+ // it's been replaced during HMR
3726
+ vnode.component ? vnode.component.subTree : vnode.children ? vnode.children[0] : void 0
3727
+ ) : vnode;
3658
3728
  }
3659
3729
  function setTransitionHooks(vnode, hooks) {
3660
3730
  if (vnode.shapeFlag & 6 && vnode.component) {
@@ -4131,61 +4201,6 @@ var Vue = (function (exports) {
4131
4201
  injectHook("ec", hook, target);
4132
4202
  }
4133
4203
 
4134
- const COMPONENTS = "components";
4135
- const DIRECTIVES = "directives";
4136
- function resolveComponent(name, maybeSelfReference) {
4137
- return resolveAsset(COMPONENTS, name, true, maybeSelfReference) || name;
4138
- }
4139
- const NULL_DYNAMIC_COMPONENT = Symbol.for("v-ndc");
4140
- function resolveDynamicComponent(component) {
4141
- if (isString(component)) {
4142
- return resolveAsset(COMPONENTS, component, false) || component;
4143
- } else {
4144
- return component || NULL_DYNAMIC_COMPONENT;
4145
- }
4146
- }
4147
- function resolveDirective(name) {
4148
- return resolveAsset(DIRECTIVES, name);
4149
- }
4150
- function resolveAsset(type, name, warnMissing = true, maybeSelfReference = false) {
4151
- const instance = currentRenderingInstance || currentInstance;
4152
- if (instance) {
4153
- const Component = instance.type;
4154
- if (type === COMPONENTS) {
4155
- const selfName = getComponentName(
4156
- Component,
4157
- false
4158
- /* do not include inferred name to avoid breaking existing code */
4159
- );
4160
- if (selfName && (selfName === name || selfName === camelize(name) || selfName === capitalize(camelize(name)))) {
4161
- return Component;
4162
- }
4163
- }
4164
- const res = (
4165
- // local registration
4166
- // check instance[type] first which is resolved for options API
4167
- resolve(instance[type] || Component[type], name) || // global registration
4168
- resolve(instance.appContext[type], name)
4169
- );
4170
- if (!res && maybeSelfReference) {
4171
- return Component;
4172
- }
4173
- if (warnMissing && !res) {
4174
- const extra = type === COMPONENTS ? `
4175
- If this is a native custom element, make sure to exclude it from component resolution via compilerOptions.isCustomElement.` : ``;
4176
- warn(`Failed to resolve ${type.slice(0, -1)}: ${name}${extra}`);
4177
- }
4178
- return res;
4179
- } else {
4180
- warn(
4181
- `resolve${capitalize(type.slice(0, -1))} can only be used in render() or setup().`
4182
- );
4183
- }
4184
- }
4185
- function resolve(registry, name) {
4186
- return registry && (registry[name] || registry[camelize(name)] || registry[capitalize(camelize(name))]);
4187
- }
4188
-
4189
4204
  function renderList(source, renderItem, cache, index) {
4190
4205
  let ret;
4191
4206
  const cached = cache && cache[index];
@@ -5702,6 +5717,9 @@ If you want to remount the same app, move your app creation logic into a factory
5702
5717
  };
5703
5718
  }
5704
5719
  function getInvalidTypeMessage(name, value, expectedTypes) {
5720
+ if (expectedTypes.length === 0) {
5721
+ return `Prop type [] for prop "${name}" won't match anything. Did you mean to use type Array instead?`;
5722
+ }
5705
5723
  let message = `Invalid prop: type check failed for prop "${name}". Expected ${expectedTypes.map(capitalize).join(" | ")}`;
5706
5724
  const expectedType = expectedTypes[0];
5707
5725
  const receivedType = toRawType(value);
@@ -5971,6 +5989,20 @@ If you want to remount the same app, move your app creation logic into a factory
5971
5989
  const { type, ref, shapeFlag, patchFlag } = vnode;
5972
5990
  let domType = node.nodeType;
5973
5991
  vnode.el = node;
5992
+ {
5993
+ if (!("__vnode" in node)) {
5994
+ Object.defineProperty(node, "__vnode", {
5995
+ value: vnode,
5996
+ enumerable: false
5997
+ });
5998
+ }
5999
+ if (!("__vueParentComponent" in node)) {
6000
+ Object.defineProperty(node, "__vueParentComponent", {
6001
+ value: parentComponent,
6002
+ enumerable: false
6003
+ });
6004
+ }
6005
+ }
5974
6006
  if (patchFlag === -2) {
5975
6007
  optimized = false;
5976
6008
  vnode.dynamicChildren = null;
@@ -6001,15 +6033,15 @@ If you want to remount the same app, move your app creation logic into a factory
6001
6033
  }
6002
6034
  break;
6003
6035
  case Comment:
6004
- if (domType !== 8 /* COMMENT */ || isFragmentStart) {
6005
- if (node.tagName.toLowerCase() === "template") {
6006
- const content = vnode.el.content.firstChild;
6007
- replaceNode(content, node, parentComponent);
6008
- vnode.el = node = content;
6009
- nextNode = nextSibling(node);
6010
- } else {
6011
- nextNode = onMismatch();
6012
- }
6036
+ if (isTemplateNode(node)) {
6037
+ nextNode = nextSibling(node);
6038
+ replaceNode(
6039
+ vnode.el = node.content.firstChild,
6040
+ node,
6041
+ parentComponent
6042
+ );
6043
+ } else if (domType !== 8 /* COMMENT */ || isFragmentStart) {
6044
+ nextNode = onMismatch();
6013
6045
  } else {
6014
6046
  nextNode = nextSibling(node);
6015
6047
  }
@@ -6132,15 +6164,16 @@ If you want to remount the same app, move your app creation logic into a factory
6132
6164
  const hydrateElement = (el, vnode, parentComponent, parentSuspense, slotScopeIds, optimized) => {
6133
6165
  optimized = optimized || !!vnode.dynamicChildren;
6134
6166
  const { type, props, patchFlag, shapeFlag, dirs, transition } = vnode;
6135
- const forcePatchValue = type === "input" && dirs || type === "option";
6167
+ const forcePatch = type === "input" || type === "option";
6136
6168
  {
6137
6169
  if (dirs) {
6138
6170
  invokeDirectiveHook(vnode, null, parentComponent, "created");
6139
6171
  }
6140
6172
  if (props) {
6141
- if (forcePatchValue || !optimized || patchFlag & (16 | 32)) {
6173
+ if (forcePatch || !optimized || patchFlag & (16 | 32)) {
6142
6174
  for (const key in props) {
6143
- if (forcePatchValue && key.endsWith("value") || isOn(key) && !isReservedProp(key)) {
6175
+ if (forcePatch && (key.endsWith("value") || key === "indeterminate") || isOn(key) && !isReservedProp(key) || // force hydrate v-bind with .prop modifiers
6176
+ key[0] === ".") {
6144
6177
  patchProp(
6145
6178
  el,
6146
6179
  key,
@@ -6353,8 +6386,7 @@ If you want to remount the same app, move your app creation logic into a factory
6353
6386
  let parent = parentComponent;
6354
6387
  while (parent) {
6355
6388
  if (parent.vnode.el === oldNode) {
6356
- parent.vnode.el = newNode;
6357
- parent.subTree.el = newNode;
6389
+ parent.vnode.el = parent.subTree.el = newNode;
6358
6390
  }
6359
6391
  parent = parent.parent;
6360
6392
  }
@@ -7898,6 +7930,7 @@ If you want to remount the same app, move your app creation logic into a factory
7898
7930
  }
7899
7931
  };
7900
7932
  const TeleportImpl = {
7933
+ name: "Teleport",
7901
7934
  __isTeleport: true,
7902
7935
  process(n1, n2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized, internals) {
7903
7936
  const {
@@ -8319,7 +8352,7 @@ If you want to remount the same app, move your app creation logic into a factory
8319
8352
  if (shapeFlag & 4 && isProxy(type)) {
8320
8353
  type = toRaw(type);
8321
8354
  warn(
8322
- `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\`.`,
8355
+ `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\`.`,
8323
8356
  `
8324
8357
  Component that was made reactive: `,
8325
8358
  type
@@ -9134,7 +9167,7 @@ Component that was made reactive: `,
9134
9167
  return true;
9135
9168
  }
9136
9169
 
9137
- const version = "3.3.7";
9170
+ const version = "3.3.9";
9138
9171
  const ssrUtils = null;
9139
9172
  const resolveFilter = null;
9140
9173
  const compatUtils = null;
@@ -10267,21 +10300,20 @@ Component that was made reactive: `,
10267
10300
  el[assignKey] = getModelAssigner(vnode);
10268
10301
  if (el.composing)
10269
10302
  return;
10303
+ const elValue = number || el.type === "number" ? looseToNumber(el.value) : el.value;
10304
+ const newValue = value == null ? "" : value;
10305
+ if (elValue === newValue) {
10306
+ return;
10307
+ }
10270
10308
  if (document.activeElement === el && el.type !== "range") {
10271
10309
  if (lazy) {
10272
10310
  return;
10273
10311
  }
10274
- if (trim && el.value.trim() === value) {
10312
+ if (trim && el.value.trim() === newValue) {
10275
10313
  return;
10276
10314
  }
10277
- if ((number || el.type === "number") && looseToNumber(el.value) === value) {
10278
- return;
10279
- }
10280
- }
10281
- const newValue = value == null ? "" : value;
10282
- if (el.value !== newValue) {
10283
- el.value = newValue;
10284
10315
  }
10316
+ el.value = newValue;
10285
10317
  }
10286
10318
  };
10287
10319
  const vModelCheckbox = {
@@ -11189,6 +11221,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
11189
11221
  return node;
11190
11222
  }
11191
11223
  }
11224
+ const forAliasRE = /([\s\S]*?)\s+(?:in|of)\s+([\s\S]*)/;
11192
11225
 
11193
11226
  const decodeRE = /&(gt|lt|amp|apos|quot);/g;
11194
11227
  const decodeMap = {
@@ -13417,7 +13450,6 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
13417
13450
  onExit();
13418
13451
  };
13419
13452
  }
13420
- const forAliasRE = /([\s\S]*?)\s+(?:in|of)\s+([\s\S]*)/;
13421
13453
  const forIteratorRE = /,([^,\}\]]*)(?:,([^,\}\]]*))?$/;
13422
13454
  const stripParensRE = /^\(|\)$/g;
13423
13455
  function parseForExpression(input, context) {
@@ -14006,7 +14038,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
14006
14038
  )
14007
14039
  );
14008
14040
  } else {
14009
- const { name, arg, exp, loc } = prop;
14041
+ const { name, arg, exp, loc, modifiers } = prop;
14010
14042
  const isVBind = name === "bind";
14011
14043
  const isVOn = name === "on";
14012
14044
  if (name === "slot") {
@@ -14066,6 +14098,9 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
14066
14098
  }
14067
14099
  continue;
14068
14100
  }
14101
+ if (isVBind && modifiers.includes("prop")) {
14102
+ patchFlag |= 32;
14103
+ }
14069
14104
  const directiveTransform = context.directiveTransforms[name];
14070
14105
  if (directiveTransform) {
14071
14106
  const { props: props2, needRuntime } = directiveTransform(prop, node, context);
@@ -14951,8 +14986,8 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
14951
14986
  );
14952
14987
  }
14953
14988
  function checkDuplicatedValue() {
14954
- const value = findProp(node, "value");
14955
- if (value) {
14989
+ const value = findDir(node, "bind");
14990
+ if (value && isStaticArgOf(value.arg, "value")) {
14956
14991
  context.onError(
14957
14992
  createDOMCompilerError(
14958
14993
  60,