@vue/compat 3.5.38 → 3.5.40

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,5 +1,5 @@
1
1
  /**
2
- * @vue/compat v3.5.38
2
+ * @vue/compat v3.5.40
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -379,8 +379,9 @@ var Vue = (function () {
379
379
  this._isPaused = true;
380
380
  let i, l;
381
381
  if (this.scopes) {
382
- for (i = 0, l = this.scopes.length; i < l; i++) {
383
- this.scopes[i].pause();
382
+ const scopes = this.scopes.slice();
383
+ for (i = 0, l = scopes.length; i < l; i++) {
384
+ scopes[i].pause();
384
385
  }
385
386
  }
386
387
  for (i = 0, l = this.effects.length; i < l; i++) {
@@ -397,12 +398,14 @@ var Vue = (function () {
397
398
  this._isPaused = false;
398
399
  let i, l;
399
400
  if (this.scopes) {
400
- for (i = 0, l = this.scopes.length; i < l; i++) {
401
- this.scopes[i].resume();
401
+ const scopes = this.scopes.slice();
402
+ for (i = 0, l = scopes.length; i < l; i++) {
403
+ scopes[i].resume();
402
404
  }
403
405
  }
404
- for (i = 0, l = this.effects.length; i < l; i++) {
405
- this.effects[i].resume();
406
+ const effects = this.effects.slice();
407
+ for (i = 0, l = effects.length; i < l; i++) {
408
+ effects[i].resume();
406
409
  }
407
410
  }
408
411
  }
@@ -464,8 +467,9 @@ var Vue = (function () {
464
467
  }
465
468
  this.cleanups.length = 0;
466
469
  if (this.scopes) {
467
- for (i = 0, l = this.scopes.length; i < l; i++) {
468
- this.scopes[i].stop(true);
470
+ const scopes = this.scopes.slice();
471
+ for (i = 0, l = scopes.length; i < l; i++) {
472
+ scopes[i].stop(true);
469
473
  }
470
474
  this.scopes.length = 0;
471
475
  }
@@ -1374,7 +1378,7 @@ var Vue = (function () {
1374
1378
  value,
1375
1379
  isRef(target) ? target : receiver
1376
1380
  );
1377
- if (target === toRaw(receiver)) {
1381
+ if (target === toRaw(receiver) && result) {
1378
1382
  if (!hadKey) {
1379
1383
  trigger(target, "add", key, value);
1380
1384
  } else if (hasChanged(value, oldValue)) {
@@ -3387,10 +3391,12 @@ Details: https://v3-migration.vuejs.org/breaking-changes/migration-build.html`
3387
3391
  setBlockTracking(-1);
3388
3392
  }
3389
3393
  const prevInstance = setCurrentRenderingInstance(ctx);
3394
+ const prevStackSize = blockStack.length;
3390
3395
  let res;
3391
3396
  try {
3392
3397
  res = fn(...args);
3393
3398
  } finally {
3399
+ for (let i = blockStack.length; i > prevStackSize; i--) closeBlock();
3394
3400
  setCurrentRenderingInstance(prevInstance);
3395
3401
  if (renderFnWithContext._d) {
3396
3402
  setBlockTracking(1);
@@ -3825,11 +3831,9 @@ Details: https://v3-migration.vuejs.org/breaking-changes/migration-build.html`
3825
3831
  }
3826
3832
  } else {
3827
3833
  if ((n2.props && n2.props.to) !== (n1.props && n1.props.to)) {
3828
- const nextTarget = n2.target = resolveTarget(
3829
- n2.props,
3830
- querySelector
3831
- );
3834
+ const nextTarget = resolveTarget(n2.props, querySelector);
3832
3835
  if (nextTarget) {
3836
+ n2.target = nextTarget;
3833
3837
  moveTeleport(
3834
3838
  n2,
3835
3839
  nextTarget,
@@ -3867,7 +3871,8 @@ Details: https://v3-migration.vuejs.org/breaking-changes/migration-build.html`
3867
3871
  target,
3868
3872
  props
3869
3873
  } = vnode;
3870
- const shouldRemove = doRemove || !isTeleportDisabled(props);
3874
+ const disabled = isTeleportDisabled(props);
3875
+ const shouldRemove = doRemove || !disabled;
3871
3876
  const pendingMount = pendingMounts.get(vnode);
3872
3877
  if (pendingMount) {
3873
3878
  pendingMount.flags |= 8;
@@ -3878,7 +3883,7 @@ Details: https://v3-migration.vuejs.org/breaking-changes/migration-build.html`
3878
3883
  hostRemove(targetAnchor);
3879
3884
  }
3880
3885
  doRemove && hostRemove(anchor);
3881
- if (!pendingMount && shapeFlag & 16) {
3886
+ if (!pendingMount && (disabled || target) && shapeFlag & 16) {
3882
3887
  for (let i = 0; i < children.length; i++) {
3883
3888
  const child = children[i];
3884
3889
  unmount(
@@ -4816,7 +4821,15 @@ Details: https://v3-migration.vuejs.org/breaking-changes/migration-build.html`
4816
4821
  };
4817
4822
  const hydrateElement = (el, vnode, parentComponent, parentSuspense, slotScopeIds, optimized) => {
4818
4823
  optimized = optimized || !!vnode.dynamicChildren;
4819
- const { type, props, patchFlag, shapeFlag, dirs, transition } = vnode;
4824
+ const {
4825
+ type,
4826
+ dynamicProps,
4827
+ props,
4828
+ patchFlag,
4829
+ shapeFlag,
4830
+ dirs,
4831
+ transition
4832
+ } = vnode;
4820
4833
  const forcePatch = type === "input" || type === "option";
4821
4834
  {
4822
4835
  if (dirs) {
@@ -4887,6 +4900,7 @@ Server rendered element contains more child nodes than client vdom.`
4887
4900
  if (props) {
4888
4901
  {
4889
4902
  const isCustomElement = el.tagName.includes("-");
4903
+ const namespace = el.namespaceURI.includes("svg") ? "svg" : el.namespaceURI.includes("MathML") ? "mathml" : void 0;
4890
4904
  for (const key in props) {
4891
4905
  if (// #11189 skip if this node has directives that have created hooks
4892
4906
  // as it could have mutated the DOM in any possible way
@@ -4894,8 +4908,8 @@ Server rendered element contains more child nodes than client vdom.`
4894
4908
  logMismatchError();
4895
4909
  }
4896
4910
  if (forcePatch && (key.endsWith("value") || key === "indeterminate") || isOn(key) && !isReservedProp(key) || // force hydrate v-bind with .prop modifiers
4897
- key[0] === "." || isCustomElement && !isReservedProp(key)) {
4898
- patchProp(el, key, null, props[key], void 0, parentComponent);
4911
+ key[0] === "." || isCustomElement && !isReservedProp(key) || dynamicProps && dynamicProps.includes(key)) {
4912
+ patchProp(el, key, null, props[key], namespace, parentComponent);
4899
4913
  }
4900
4914
  }
4901
4915
  }
@@ -4999,7 +5013,7 @@ Server rendered element contains fewer child nodes than client vdom.`
4999
5013
  }
5000
5014
  };
5001
5015
  const handleMismatch = (node, vnode, parentComponent, parentSuspense, slotScopeIds, isFragment) => {
5002
- if (!isMismatchAllowed(node.parentElement, 1 /* CHILDREN */)) {
5016
+ if (!isNodeMismatchAllowed(node, vnode)) {
5003
5017
  warn$1(
5004
5018
  `Hydration node mismatch:
5005
5019
  - rendered on server:`,
@@ -5214,7 +5228,12 @@ Server rendered element contains fewer child nodes than client vdom.`
5214
5228
  el = el.parentElement;
5215
5229
  }
5216
5230
  }
5217
- const allowedAttr = el && el.getAttribute(allowMismatchAttr);
5231
+ return isMismatchAllowedByAttr(
5232
+ el && el.getAttribute(allowMismatchAttr),
5233
+ allowedType
5234
+ );
5235
+ }
5236
+ function isMismatchAllowedByAttr(allowedAttr, allowedType) {
5218
5237
  if (allowedAttr == null) {
5219
5238
  return false;
5220
5239
  } else if (allowedAttr === "") {
@@ -5227,6 +5246,19 @@ Server rendered element contains fewer child nodes than client vdom.`
5227
5246
  return list.includes(MismatchTypeString[allowedType]);
5228
5247
  }
5229
5248
  }
5249
+ function isNodeMismatchAllowed(node, vnode) {
5250
+ return isMismatchAllowed(node.parentElement, 1 /* CHILDREN */) || isMismatchAllowedByNode(node) || isMismatchAllowedByVNode(vnode);
5251
+ }
5252
+ function isMismatchAllowedByNode(node) {
5253
+ return node.nodeType === 1 && isMismatchAllowedByAttr(
5254
+ node.getAttribute(allowMismatchAttr),
5255
+ 1 /* CHILDREN */
5256
+ );
5257
+ }
5258
+ function isMismatchAllowedByVNode({ props }) {
5259
+ const allowedAttr = props && props[allowMismatchAttr];
5260
+ return typeof allowedAttr === "string" && isMismatchAllowedByAttr(allowedAttr, 1 /* CHILDREN */);
5261
+ }
5230
5262
 
5231
5263
  const requestIdleCallback = getGlobalThis().requestIdleCallback || ((cb) => setTimeout(cb, 1));
5232
5264
  const cancelIdleCallback = getGlobalThis().cancelIdleCallback || ((id) => clearTimeout(id));
@@ -5380,6 +5412,7 @@ Server rendered element contains fewer child nodes than client vdom.`
5380
5412
  name: "AsyncComponentWrapper",
5381
5413
  __asyncLoader: load,
5382
5414
  __asyncHydrate(el, instance, hydrate) {
5415
+ const wasConnected = el.isConnected;
5383
5416
  let patched = false;
5384
5417
  (instance.bu || (instance.bu = [])).push(() => patched = true);
5385
5418
  const performHydrate = () => {
@@ -5391,6 +5424,7 @@ Server rendered element contains fewer child nodes than client vdom.`
5391
5424
  }
5392
5425
  return;
5393
5426
  }
5427
+ if (!el.parentNode || wasConnected && !el.isConnected) return;
5394
5428
  hydrate();
5395
5429
  };
5396
5430
  const doHydrate = hydrateStrategy ? () => {
@@ -6234,14 +6268,15 @@ If this is a native custom element, make sure to exclude it from component resol
6234
6268
  return slots;
6235
6269
  }
6236
6270
 
6237
- function renderSlot(slots, name, props = {}, fallback, noSlotted) {
6271
+ function renderSlot(slots, name, props = {}, fallback, noSlotted, branchKey) {
6238
6272
  if (currentRenderingInstance.ce || currentRenderingInstance.parent && isAsyncWrapper(currentRenderingInstance.parent) && currentRenderingInstance.parent.ce) {
6239
- const hasProps = Object.keys(props).length > 0;
6240
- if (name !== "default") props.name = name;
6273
+ const slotProps = branchKey != null && props.key == null ? extend({}, props, { key: branchKey }) : props;
6274
+ const hasProps = Object.keys(slotProps).length > 0;
6275
+ if (name !== "default") slotProps.name = name;
6241
6276
  return openBlock(), createBlock(
6242
6277
  Fragment,
6243
6278
  null,
6244
- [createVNode("slot", props, fallback && fallback())],
6279
+ [createVNode("slot", slotProps, fallback && fallback())],
6245
6280
  hasProps ? -2 : 64
6246
6281
  );
6247
6282
  }
@@ -6255,26 +6290,34 @@ If this is a native custom element, make sure to exclude it from component resol
6255
6290
  if (slot && slot._c) {
6256
6291
  slot._d = false;
6257
6292
  }
6293
+ const prevStackSize = blockStack.length;
6258
6294
  openBlock();
6259
- const validSlotContent = slot && ensureValidVNode(slot(props));
6260
- const slotKey = props.key || // slot content array of a dynamic conditional slot may have a branch
6261
- // key attached in the `createSlots` helper, respect that
6262
- validSlotContent && validSlotContent.key;
6263
- const rendered = createBlock(
6264
- Fragment,
6265
- {
6266
- key: (slotKey && !isSymbol(slotKey) ? slotKey : `_${name}`) + // #7256 force differentiate fallback content from actual content
6267
- (!validSlotContent && fallback ? "_fb" : "")
6268
- },
6269
- validSlotContent || (fallback ? fallback() : []),
6270
- validSlotContent && slots._ === 1 ? 64 : -2
6271
- );
6295
+ let rendered;
6296
+ try {
6297
+ const validSlotContent = slot && ensureValidVNode(slot(props));
6298
+ const slotKey = props.key || branchKey || // slot content array of a dynamic conditional slot may have a branch
6299
+ // key attached in the `createSlots` helper, respect that
6300
+ validSlotContent && validSlotContent.key;
6301
+ rendered = createBlock(
6302
+ Fragment,
6303
+ {
6304
+ key: (slotKey && !isSymbol(slotKey) ? slotKey : `_${name}`) + // #7256 force differentiate fallback content from actual content
6305
+ (!validSlotContent && fallback ? "_fb" : "")
6306
+ },
6307
+ validSlotContent || (fallback ? fallback() : []),
6308
+ validSlotContent && slots._ === 1 ? 64 : -2
6309
+ );
6310
+ } catch (err) {
6311
+ for (let i = blockStack.length; i > prevStackSize; i--) closeBlock();
6312
+ throw err;
6313
+ } finally {
6314
+ if (slot && slot._c) {
6315
+ slot._d = true;
6316
+ }
6317
+ }
6272
6318
  if (!noSlotted && rendered.scopeId) {
6273
6319
  rendered.slotScopeIds = [rendered.scopeId + "-s"];
6274
6320
  }
6275
- if (slot && slot._c) {
6276
- slot._d = true;
6277
- }
6278
6321
  return rendered;
6279
6322
  }
6280
6323
  function ensureValidVNode(vnodes) {
@@ -7449,7 +7492,7 @@ If this is a native custom element, make sure to exclude it from component resol
7449
7492
  return vm;
7450
7493
  }
7451
7494
  }
7452
- Vue.version = `2.6.14-compat:${"3.5.38"}`;
7495
+ Vue.version = `2.6.14-compat:${"3.5.40"}`;
7453
7496
  Vue.config = singletonApp.config;
7454
7497
  Vue.use = (plugin, ...options) => {
7455
7498
  if (plugin && isFunction(plugin.install)) {
@@ -8310,7 +8353,8 @@ If you want to remount the same app, move your app creation logic into a factory
8310
8353
  if (key.startsWith(compatModelEventPrefix)) {
8311
8354
  return true;
8312
8355
  }
8313
- key = key.slice(2).replace(/Once$/, "");
8356
+ key = key.slice(2);
8357
+ key = key === "Once" ? key : key.replace(/Once$/, "");
8314
8358
  return hasOwn(options, key[0].toLowerCase() + key.slice(1)) || hasOwn(options, hyphenate(key)) || hasOwn(options, key);
8315
8359
  }
8316
8360
 
@@ -9627,7 +9671,12 @@ If you want to remount the same app, move your app creation logic into a factory
9627
9671
  invokeDirectiveHook(n2, n1, parentComponent, "beforeUpdate");
9628
9672
  }
9629
9673
  parentComponent && toggleRecurse(parentComponent, true);
9630
- if (isHmrUpdating) {
9674
+ if (
9675
+ // HMR updated, force full diff
9676
+ isHmrUpdating || // #6385 the old vnode may be a user-wrapped non-isomorphic block
9677
+ // Force full diff when block metadata is unstable.
9678
+ dynamicChildren && (!n1.dynamicChildren || n1.dynamicChildren.length !== dynamicChildren.length)
9679
+ ) {
9631
9680
  patchFlag = 0;
9632
9681
  optimized = false;
9633
9682
  dynamicChildren = null;
@@ -11861,6 +11910,10 @@ Component that was made reactive: `,
11861
11910
  }
11862
11911
  }
11863
11912
  } else if (isFunction(children)) {
11913
+ if (shapeFlag & (1 | 64)) {
11914
+ normalizeChildren(vnode, { default: children });
11915
+ return;
11916
+ }
11864
11917
  children = { default: children, _ctx: currentRenderingInstance };
11865
11918
  type = 32;
11866
11919
  } else {
@@ -12577,7 +12630,7 @@ Component that was made reactive: `,
12577
12630
  return true;
12578
12631
  }
12579
12632
 
12580
- const version = "3.5.38";
12633
+ const version = "3.5.40";
12581
12634
  const warn = warn$1 ;
12582
12635
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
12583
12636
  const devtools = devtools$1 ;
@@ -13379,16 +13432,15 @@ Component that was made reactive: `,
13379
13432
  }
13380
13433
  }
13381
13434
  }
13382
- const optionsModifierRE = /(?:Once|Passive|Capture)$/;
13435
+ const optionsModifierRE = /(Once|Passive|Capture)$/;
13436
+ const optionsModifierEventRE = /^on:?(?:Once|Passive|Capture)$/;
13383
13437
  function parseName(name) {
13384
13438
  let options;
13385
- if (optionsModifierRE.test(name)) {
13386
- options = {};
13387
- let m;
13388
- while (m = name.match(optionsModifierRE)) {
13389
- name = name.slice(0, name.length - m[0].length);
13390
- options[m[0].toLowerCase()] = true;
13391
- }
13439
+ let m;
13440
+ while ((m = name.match(optionsModifierRE)) && !optionsModifierEventRE.test(name)) {
13441
+ if (!options) options = {};
13442
+ name = name.slice(0, name.length - m[1].length);
13443
+ options[m[1].toLowerCase()] = true;
13392
13444
  }
13393
13445
  const event = name[2] === ":" ? name.slice(3) : hyphenate(name.slice(2));
13394
13446
  return [event, options];
@@ -14347,13 +14399,13 @@ Expected function or array of functions, received type ${typeof value}.`
14347
14399
  // <select multiple> value need to be deep traversed
14348
14400
  deep: true,
14349
14401
  created(el, { value, modifiers: { number } }, vnode) {
14350
- const isSetModel = isSet(value);
14402
+ el._modelValue = value;
14351
14403
  addEventListener(el, "change", () => {
14352
14404
  const selectedVal = Array.prototype.filter.call(el.options, (o) => o.selected).map(
14353
14405
  (o) => number ? looseToNumber(getValue(o)) : getValue(o)
14354
14406
  );
14355
14407
  el[assignKey](
14356
- el.multiple ? isSetModel ? new Set(selectedVal) : selectedVal : selectedVal[0]
14408
+ el.multiple ? isSet(el._modelValue) ? new Set(selectedVal) : selectedVal : selectedVal[0]
14357
14409
  );
14358
14410
  el._assigning = true;
14359
14411
  nextTick(() => {
@@ -14367,7 +14419,8 @@ Expected function or array of functions, received type ${typeof value}.`
14367
14419
  mounted(el, { value }) {
14368
14420
  setSelected(el, value);
14369
14421
  },
14370
- beforeUpdate(el, _binding, vnode) {
14422
+ beforeUpdate(el, { value }, vnode) {
14423
+ el._modelValue = value;
14371
14424
  el[assignKey] = getModelAssigner(vnode);
14372
14425
  },
14373
14426
  updated(el, { value }) {