vue 3.3.8 → 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.
@@ -104,7 +104,7 @@ const PatchFlagNames = {
104
104
  [4]: `STYLE`,
105
105
  [8]: `PROPS`,
106
106
  [16]: `FULL_PROPS`,
107
- [32]: `HYDRATE_EVENTS`,
107
+ [32]: `NEED_HYDRATION`,
108
108
  [64]: `STABLE_FRAGMENT`,
109
109
  [128]: `KEYED_FRAGMENT`,
110
110
  [256]: `UNKEYED_FRAGMENT`,
@@ -1001,7 +1001,7 @@ function createReadonlyMethod(type) {
1001
1001
  toRaw(this)
1002
1002
  );
1003
1003
  }
1004
- return type === "delete" ? false : this;
1004
+ return type === "delete" ? false : type === "clear" ? void 0 : this;
1005
1005
  };
1006
1006
  }
1007
1007
  function createInstrumentations() {
@@ -2272,9 +2272,19 @@ function renderComponentRoot(instance) {
2272
2272
  try {
2273
2273
  if (vnode.shapeFlag & 4) {
2274
2274
  const proxyToUse = withProxy || proxy;
2275
+ const thisProxy = setupState.__isScriptSetup ? new Proxy(proxyToUse, {
2276
+ get(target, key, receiver) {
2277
+ warn(
2278
+ `Property '${String(
2279
+ key
2280
+ )}' was accessed via 'this'. Avoid using 'this' in templates.`
2281
+ );
2282
+ return Reflect.get(target, key, receiver);
2283
+ }
2284
+ }) : proxyToUse;
2275
2285
  result = normalizeVNode(
2276
2286
  render.call(
2277
- proxyToUse,
2287
+ thisProxy,
2278
2288
  proxyToUse,
2279
2289
  renderCache,
2280
2290
  props,
@@ -3236,6 +3246,7 @@ function doWatch(source, cb, { immediate, deep, flush, onTrack, onTrigger } = EM
3236
3246
  let onCleanup = (fn) => {
3237
3247
  cleanup = effect.onStop = () => {
3238
3248
  callWithErrorHandling(fn, instance, 4);
3249
+ cleanup = effect.onStop = void 0;
3239
3250
  };
3240
3251
  };
3241
3252
  let oldValue = isMultiSource ? new Array(source.length).fill(INITIAL_WATCHER_VALUE) : INITIAL_WATCHER_VALUE;
@@ -3706,7 +3717,11 @@ function emptyPlaceholder(vnode) {
3706
3717
  }
3707
3718
  }
3708
3719
  function getKeepAliveChild(vnode) {
3709
- return isKeepAlive(vnode) ? vnode.children ? vnode.children[0] : void 0 : vnode;
3720
+ return isKeepAlive(vnode) ? (
3721
+ // #7121 ensure get the child component subtree in case
3722
+ // it's been replaced during HMR
3723
+ vnode.component ? vnode.component.subTree : vnode.children ? vnode.children[0] : void 0
3724
+ ) : vnode;
3710
3725
  }
3711
3726
  function setTransitionHooks(vnode, hooks) {
3712
3727
  if (vnode.shapeFlag & 6 && vnode.component) {
@@ -5699,6 +5714,9 @@ function assertType(value, type) {
5699
5714
  };
5700
5715
  }
5701
5716
  function getInvalidTypeMessage(name, value, expectedTypes) {
5717
+ if (expectedTypes.length === 0) {
5718
+ return `Prop type [] for prop "${name}" won't match anything. Did you mean to use type Array instead?`;
5719
+ }
5702
5720
  let message = `Invalid prop: type check failed for prop "${name}". Expected ${expectedTypes.map(capitalize).join(" | ")}`;
5703
5721
  const expectedType = expectedTypes[0];
5704
5722
  const receivedType = toRawType(value);
@@ -5968,6 +5986,20 @@ function createHydrationFunctions(rendererInternals) {
5968
5986
  const { type, ref, shapeFlag, patchFlag } = vnode;
5969
5987
  let domType = node.nodeType;
5970
5988
  vnode.el = node;
5989
+ {
5990
+ if (!("__vnode" in node)) {
5991
+ Object.defineProperty(node, "__vnode", {
5992
+ value: vnode,
5993
+ enumerable: false
5994
+ });
5995
+ }
5996
+ if (!("__vueParentComponent" in node)) {
5997
+ Object.defineProperty(node, "__vueParentComponent", {
5998
+ value: parentComponent,
5999
+ enumerable: false
6000
+ });
6001
+ }
6002
+ }
5971
6003
  if (patchFlag === -2) {
5972
6004
  optimized = false;
5973
6005
  vnode.dynamicChildren = null;
@@ -6129,15 +6161,16 @@ function createHydrationFunctions(rendererInternals) {
6129
6161
  const hydrateElement = (el, vnode, parentComponent, parentSuspense, slotScopeIds, optimized) => {
6130
6162
  optimized = optimized || !!vnode.dynamicChildren;
6131
6163
  const { type, props, patchFlag, shapeFlag, dirs, transition } = vnode;
6132
- const forcePatchValue = type === "input" && dirs || type === "option";
6164
+ const forcePatch = type === "input" || type === "option";
6133
6165
  {
6134
6166
  if (dirs) {
6135
6167
  invokeDirectiveHook(vnode, null, parentComponent, "created");
6136
6168
  }
6137
6169
  if (props) {
6138
- if (forcePatchValue || !optimized || patchFlag & (16 | 32)) {
6170
+ if (forcePatch || !optimized || patchFlag & (16 | 32)) {
6139
6171
  for (const key in props) {
6140
- if (forcePatchValue && key.endsWith("value") || isOn(key) && !isReservedProp(key)) {
6172
+ if (forcePatch && (key.endsWith("value") || key === "indeterminate") || isOn(key) && !isReservedProp(key) || // force hydrate v-bind with .prop modifiers
6173
+ key[0] === ".") {
6141
6174
  patchProp(
6142
6175
  el,
6143
6176
  key,
@@ -7894,6 +7927,7 @@ const resolveTarget = (props, select) => {
7894
7927
  }
7895
7928
  };
7896
7929
  const TeleportImpl = {
7930
+ name: "Teleport",
7897
7931
  __isTeleport: true,
7898
7932
  process(n1, n2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized, internals) {
7899
7933
  const {
@@ -8315,7 +8349,7 @@ function _createVNode(type, props = null, children = null, patchFlag = 0, dynami
8315
8349
  if (shapeFlag & 4 && isProxy(type)) {
8316
8350
  type = toRaw(type);
8317
8351
  warn(
8318
- `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\`.`,
8352
+ `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\`.`,
8319
8353
  `
8320
8354
  Component that was made reactive: `,
8321
8355
  type
@@ -9136,7 +9170,7 @@ function isMemoSame(cached, memo) {
9136
9170
  return true;
9137
9171
  }
9138
9172
 
9139
- const version = "3.3.8";
9173
+ const version = "3.3.9";
9140
9174
  const ssrUtils = null;
9141
9175
  const resolveFilter = null;
9142
9176
  const compatUtils = null;
@@ -10281,21 +10315,20 @@ const vModelText = {
10281
10315
  el[assignKey] = getModelAssigner(vnode);
10282
10316
  if (el.composing)
10283
10317
  return;
10318
+ const elValue = number || el.type === "number" ? looseToNumber(el.value) : el.value;
10319
+ const newValue = value == null ? "" : value;
10320
+ if (elValue === newValue) {
10321
+ return;
10322
+ }
10284
10323
  if (document.activeElement === el && el.type !== "range") {
10285
10324
  if (lazy) {
10286
10325
  return;
10287
10326
  }
10288
- if (trim && el.value.trim() === value) {
10289
- return;
10290
- }
10291
- if ((number || el.type === "number") && looseToNumber(el.value) === value) {
10327
+ if (trim && el.value.trim() === newValue) {
10292
10328
  return;
10293
10329
  }
10294
10330
  }
10295
- const newValue = value == null ? "" : value;
10296
- if (el.value !== newValue) {
10297
- el.value = newValue;
10298
- }
10331
+ el.value = newValue;
10299
10332
  }
10300
10333
  };
10301
10334
  const vModelCheckbox = {
@@ -11360,6 +11393,7 @@ function getMemoedVNodeCall(node) {
11360
11393
  return node;
11361
11394
  }
11362
11395
  }
11396
+ const forAliasRE = /([\s\S]*?)\s+(?:in|of)\s+([\s\S]*)/;
11363
11397
 
11364
11398
  const decodeRE = /&(gt|lt|amp|apos|quot);/g;
11365
11399
  const decodeMap = {
@@ -13588,7 +13622,6 @@ function processFor(node, dir, context, processCodegen) {
13588
13622
  onExit();
13589
13623
  };
13590
13624
  }
13591
- const forAliasRE = /([\s\S]*?)\s+(?:in|of)\s+([\s\S]*)/;
13592
13625
  const forIteratorRE = /,([^,\}\]]*)(?:,([^,\}\]]*))?$/;
13593
13626
  const stripParensRE = /^\(|\)$/g;
13594
13627
  function parseForExpression(input, context) {
@@ -14177,7 +14210,7 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
14177
14210
  )
14178
14211
  );
14179
14212
  } else {
14180
- const { name, arg, exp, loc } = prop;
14213
+ const { name, arg, exp, loc, modifiers } = prop;
14181
14214
  const isVBind = name === "bind";
14182
14215
  const isVOn = name === "on";
14183
14216
  if (name === "slot") {
@@ -14237,6 +14270,9 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
14237
14270
  }
14238
14271
  continue;
14239
14272
  }
14273
+ if (isVBind && modifiers.includes("prop")) {
14274
+ patchFlag |= 32;
14275
+ }
14240
14276
  const directiveTransform = context.directiveTransforms[name];
14241
14277
  if (directiveTransform) {
14242
14278
  const { props: props2, needRuntime } = directiveTransform(prop, node, context);
@@ -15122,8 +15158,8 @@ const transformModel = (dir, node, context) => {
15122
15158
  );
15123
15159
  }
15124
15160
  function checkDuplicatedValue() {
15125
- const value = findProp(node, "value");
15126
- if (value) {
15161
+ const value = findDir(node, "bind");
15162
+ if (value && isStaticArgOf(value.arg, "value")) {
15127
15163
  context.onError(
15128
15164
  createDOMCompilerError(
15129
15165
  60,