@vue/compat 3.5.40 → 3.5.41

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.40
2
+ * @vue/compat v3.5.41
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -267,7 +267,7 @@ const isVoidTag = /* @__PURE__ */ makeMap(VOID_TAGS);
267
267
  const specialBooleanAttrs = `itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly`;
268
268
  const isSpecialBooleanAttr = /* @__PURE__ */ makeMap(specialBooleanAttrs);
269
269
  const isBooleanAttr = /* @__PURE__ */ makeMap(
270
- specialBooleanAttrs + `,async,autofocus,autoplay,controls,default,defer,disabled,hidden,inert,loop,open,required,reversed,scoped,seamless,checked,muted,multiple,selected`
270
+ specialBooleanAttrs + `,async,autofocus,autoplay,controls,default,defer,disabled,inert,loop,open,required,reversed,scoped,seamless,checked,muted,multiple,selected`
271
271
  );
272
272
  function includeBooleanAttr(value) {
273
273
  return !!value || value === "";
@@ -2670,7 +2670,9 @@ function queuePostFlushCb(cb) {
2670
2670
  cb.flags |= 1;
2671
2671
  }
2672
2672
  } else {
2673
- pendingPostFlushCbs.push(...cb);
2673
+ for (let i = 0; i < cb.length; i++) {
2674
+ pendingPostFlushCbs.push(cb[i]);
2675
+ }
2674
2676
  }
2675
2677
  queueFlush();
2676
2678
  }
@@ -2706,7 +2708,9 @@ function flushPostFlushCbs(seen) {
2706
2708
  );
2707
2709
  pendingPostFlushCbs.length = 0;
2708
2710
  if (activePostFlushCbs) {
2709
- activePostFlushCbs.push(...deduped);
2711
+ for (let i = 0; i < deduped.length; i++) {
2712
+ activePostFlushCbs.push(deduped[i]);
2713
+ }
2710
2714
  return;
2711
2715
  }
2712
2716
  activePostFlushCbs = deduped;
@@ -4467,7 +4471,11 @@ function getInnerChild$1(vnode) {
4467
4471
  function setTransitionHooks(vnode, hooks) {
4468
4472
  if (vnode.shapeFlag & 6 && vnode.component) {
4469
4473
  vnode.transition = hooks;
4470
- setTransitionHooks(vnode.component.subTree, hooks);
4474
+ const subTree = vnode.component.subTree;
4475
+ setTransitionHooks(
4476
+ isTeleport(subTree.type) ? getInnerChild$1(subTree) || subTree : subTree,
4477
+ hooks
4478
+ );
4471
4479
  } else if (vnode.shapeFlag & 128) {
4472
4480
  vnode.ssContent.transition = hooks.clone(vnode.ssContent);
4473
4481
  vnode.ssFallback.transition = hooks.clone(vnode.ssFallback);
@@ -5007,6 +5015,9 @@ Server rendered element contains more child nodes than client vdom.`
5007
5015
  }
5008
5016
  if (forcePatch && (key.endsWith("value") || key === "indeterminate") || isOn(key) && !isReservedProp(key) || // force hydrate v-bind with .prop modifiers
5009
5017
  key[0] === "." || isCustomElement && !isReservedProp(key) || dynamicProps && dynamicProps.includes(key)) {
5018
+ if (isUnchangedResourceProp(el, key, props[key])) {
5019
+ continue;
5020
+ }
5010
5021
  patchProp(el, key, null, props[key], namespace, parentComponent);
5011
5022
  }
5012
5023
  }
@@ -5189,6 +5200,13 @@ Server rendered element contains fewer child nodes than client vdom.`
5189
5200
  };
5190
5201
  return [hydrate, hydrateNode];
5191
5202
  }
5203
+ const resourceProps = /* @__PURE__ */ new Set(["src", "srcset", "href", "poster"]);
5204
+ function isUnchangedResourceProp(el, key, clientValue) {
5205
+ if (!resourceProps.has(key)) {
5206
+ return false;
5207
+ }
5208
+ return el.getAttribute(key) === (clientValue == null ? null : `${clientValue}`);
5209
+ }
5192
5210
  function propHasMismatch(el, key, clientValue, vnode, instance) {
5193
5211
  let mismatchType;
5194
5212
  let mismatchKey;
@@ -5226,7 +5244,10 @@ function propHasMismatch(el, key, clientValue, vnode, instance) {
5226
5244
  mismatchKey = "style";
5227
5245
  }
5228
5246
  } else if (el instanceof SVGElement && isKnownSvgAttr(key) || el instanceof HTMLElement && (isBooleanAttr(key) || isKnownHtmlAttr(key))) {
5229
- if (isBooleanAttr(key)) {
5247
+ if (key === "hidden") {
5248
+ actual = normalizeHiddenValue(el.getAttribute(key));
5249
+ expected = normalizeHiddenValue(clientValue);
5250
+ } else if (isBooleanAttr(key)) {
5230
5251
  actual = el.hasAttribute(key);
5231
5252
  expected = includeBooleanAttr(clientValue);
5232
5253
  } else if (clientValue == null) {
@@ -5262,6 +5283,15 @@ function propHasMismatch(el, key, clientValue, vnode, instance) {
5262
5283
  }
5263
5284
  return false;
5264
5285
  }
5286
+ function normalizeHiddenValue(value) {
5287
+ if (!isRenderableAttrValue(value)) {
5288
+ return false;
5289
+ }
5290
+ if (isString(value)) {
5291
+ return value.toLowerCase() === "until-found" ? "until-found" : "";
5292
+ }
5293
+ return includeBooleanAttr(value) ? "" : false;
5294
+ }
5265
5295
  function toClassSet(str) {
5266
5296
  return new Set(str.trim().split(/\s+/));
5267
5297
  }
@@ -6372,7 +6402,8 @@ function createSlots(slots, dynamicSlots) {
6372
6402
  return slots;
6373
6403
  }
6374
6404
 
6375
- function renderSlot(slots, name, props = {}, fallback, noSlotted, branchKey) {
6405
+ function renderSlot(slots, name, props, fallback, noSlotted, branchKey) {
6406
+ if (props == null) props = {};
6376
6407
  if (currentRenderingInstance.ce || currentRenderingInstance.parent && isAsyncWrapper(currentRenderingInstance.parent) && currentRenderingInstance.parent.ce) {
6377
6408
  const slotProps = branchKey != null && props.key == null ? extend({}, props, { key: branchKey }) : props;
6378
6409
  const hasProps = Object.keys(slotProps).length > 0;
@@ -7599,7 +7630,7 @@ function createCompatVue$1(createApp, createSingletonApp) {
7599
7630
  return vm;
7600
7631
  }
7601
7632
  }
7602
- Vue.version = `2.6.14-compat:${"3.5.40"}`;
7633
+ Vue.version = `2.6.14-compat:${"3.5.41"}`;
7603
7634
  Vue.config = singletonApp.config;
7604
7635
  Vue.use = (plugin, ...options) => {
7605
7636
  if (plugin && isFunction(plugin.install)) {
@@ -8621,12 +8652,13 @@ function renderComponentRoot(instance) {
8621
8652
  root.dirs = root.dirs ? root.dirs.concat(vnode.dirs) : vnode.dirs;
8622
8653
  }
8623
8654
  if (vnode.transition) {
8624
- if (!isElementRoot(root)) {
8655
+ const child = isTeleport(root.type) ? getInnerChild$1(root) || root : root;
8656
+ if (!isElementRoot(child)) {
8625
8657
  warn$1(
8626
8658
  `Component inside <Transition> renders non-element root node that cannot be animated.`
8627
8659
  );
8628
8660
  }
8629
- setTransitionHooks(root, vnode.transition);
8661
+ setTransitionHooks(child, vnode.transition);
8630
8662
  }
8631
8663
  if (setRoot) {
8632
8664
  setRoot(root);
@@ -11380,7 +11412,9 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
11380
11412
  let hasUnresolvedAncestor = false;
11381
11413
  while (parent) {
11382
11414
  if (parent.pendingBranch) {
11383
- parent.effects.push(...effects);
11415
+ for (let i = 0; i < effects.length; i++) {
11416
+ parent.effects.push(effects[i]);
11417
+ }
11384
11418
  hasUnresolvedAncestor = true;
11385
11419
  break;
11386
11420
  }
@@ -11802,6 +11836,14 @@ function createBaseVNode(type, props = null, children = null, patchFlag = 0, dyn
11802
11836
  if (vnode.key !== vnode.key) {
11803
11837
  warn$1(`VNode created with invalid key (NaN). VNode type:`, vnode.type);
11804
11838
  }
11839
+ if (props && vnode.shapeFlag & 1) {
11840
+ const overwritingProp = props.innerHTML != null ? "innerHTML" : props.textContent != null ? "textContent" : null;
11841
+ if (overwritingProp && hasContentChildren(vnode.children)) {
11842
+ warn$1(
11843
+ `The \`${overwritingProp}\` prop on <${vnode.type}> will override its children. Remove either the \`${overwritingProp}\` prop or the children.`
11844
+ );
11845
+ }
11846
+ }
11805
11847
  if (isBlockTreeEnabled > 0 && // avoid a block node from tracking itself
11806
11848
  !isBlockNode && // has current parent block
11807
11849
  currentBlock && // presence of a patch flag indicates this node needs patching on updates.
@@ -11819,6 +11861,11 @@ function createBaseVNode(type, props = null, children = null, patchFlag = 0, dyn
11819
11861
  }
11820
11862
  return vnode;
11821
11863
  }
11864
+ function hasContentChildren(children) {
11865
+ if (isString(children)) return children !== "";
11866
+ if (isArray(children)) return children.length > 0;
11867
+ return false;
11868
+ }
11822
11869
  const createVNode = createVNodeWithArgsTransform ;
11823
11870
  function _createVNode(type, props = null, children = null, patchFlag = 0, dynamicProps = null, isBlockNode = false) {
11824
11871
  if (!type || type === NULL_DYNAMIC_COMPONENT) {
@@ -12273,7 +12320,12 @@ function setupStatefulComponent(instance, isSSR) {
12273
12320
  setupResult.then(unsetCurrentInstance, unsetCurrentInstance);
12274
12321
  if (isSSR) {
12275
12322
  return setupResult.then((resolvedResult) => {
12276
- handleSetupResult(instance, resolvedResult, isSSR);
12323
+ setInSSRSetupState(true);
12324
+ try {
12325
+ handleSetupResult(instance, resolvedResult, isSSR);
12326
+ } finally {
12327
+ setInSSRSetupState(false);
12328
+ }
12277
12329
  }).catch((e) => {
12278
12330
  handleError(e, instance, 0);
12279
12331
  });
@@ -12751,7 +12803,7 @@ function isMemoSame(cached, memo) {
12751
12803
  return true;
12752
12804
  }
12753
12805
 
12754
- const version = "3.5.40";
12806
+ const version = "3.5.41";
12755
12807
  const warn = warn$1 ;
12756
12808
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
12757
12809
  const devtools = devtools$1 ;
@@ -13809,7 +13861,9 @@ class VueElement extends BaseClass {
13809
13861
  if (parent && parent._pendingResolve) {
13810
13862
  this._pendingResolve = parent._pendingResolve.then(() => {
13811
13863
  this._pendingResolve = void 0;
13812
- this._resolveDef();
13864
+ if (this.isConnected) {
13865
+ return this._resolveDef();
13866
+ }
13813
13867
  });
13814
13868
  } else {
13815
13869
  this._resolveDef();
@@ -13859,7 +13913,7 @@ class VueElement extends BaseClass {
13859
13913
  */
13860
13914
  _resolveDef() {
13861
13915
  if (this._pendingResolve) {
13862
- return;
13916
+ return this._pendingResolve;
13863
13917
  }
13864
13918
  for (let i = 0; i < this.attributes.length; i++) {
13865
13919
  this._setAttr(this.attributes[i].name);
@@ -13899,6 +13953,7 @@ class VueElement extends BaseClass {
13899
13953
  def.configureApp = this._def.configureApp;
13900
13954
  resolve(this._def = def, true);
13901
13955
  });
13956
+ return this._pendingResolve;
13902
13957
  } else {
13903
13958
  resolve(this._def);
13904
13959
  }
@@ -13936,6 +13991,11 @@ class VueElement extends BaseClass {
13936
13991
  }
13937
13992
  }
13938
13993
  for (const key of declaredPropKeys.map(camelize)) {
13994
+ if (key in Object.getPrototypeOf(this)) {
13995
+ warn(
13996
+ `Custom element prop "${key}" conflicts with an existing property on the element and will overwrite it.`
13997
+ );
13998
+ }
13939
13999
  Object.defineProperty(this, key, {
13940
14000
  get() {
13941
14001
  return this._getProp(key);
@@ -14429,6 +14489,7 @@ function onCompositionEnd(e) {
14429
14489
  }
14430
14490
  }
14431
14491
  const assignKey = /* @__PURE__ */ Symbol("_assign");
14492
+ const initialValueKey = /* @__PURE__ */ Symbol("_initialValue");
14432
14493
  function castValue(value, trim, number) {
14433
14494
  if (trim) value = value.trim();
14434
14495
  if (number) value = looseToNumber(value);
@@ -14436,6 +14497,13 @@ function castValue(value, trim, number) {
14436
14497
  }
14437
14498
  const vModelText = {
14438
14499
  created(el, { modifiers: { lazy, trim, number } }, vnode) {
14500
+ if (el.parentNode) {
14501
+ if (el.type === "text") {
14502
+ el[initialValueKey] = el.defaultValue.replace(/[\r\n]/g, "");
14503
+ } else if (el.type === "textarea") {
14504
+ el[initialValueKey] = el.defaultValue.replace(/\r\n?/g, "\n");
14505
+ }
14506
+ }
14439
14507
  el[assignKey] = getModelAssigner(vnode);
14440
14508
  const castToNumber = number || vnode.props && vnode.props.type === "number";
14441
14509
  addEventListener(el, lazy ? "change" : "input", (e) => {
@@ -14454,8 +14522,15 @@ const vModelText = {
14454
14522
  }
14455
14523
  },
14456
14524
  // set value on mounted so it's after min/max for type="range"
14457
- mounted(el, { value }) {
14458
- el.value = value == null ? "" : value;
14525
+ mounted(el, { value, modifiers: { trim, number } }) {
14526
+ const newValue = value == null ? "" : value;
14527
+ const initialValue = el[initialValueKey];
14528
+ delete el[initialValueKey];
14529
+ if (initialValue !== void 0 && (el.type === "text" || el.type === "textarea") && el.value !== initialValue) {
14530
+ el[assignKey](castValue(el.value, trim, number));
14531
+ } else {
14532
+ el.value = newValue;
14533
+ }
14459
14534
  },
14460
14535
  beforeUpdate(el, { value, oldValue, modifiers: { lazy, trim, number } }, vnode) {
14461
14536
  el[assignKey] = getModelAssigner(vnode);
@@ -18855,6 +18930,7 @@ const transformFor = createStructuralDirectiveTransform(
18855
18930
  node.loc
18856
18931
  );
18857
18932
  return () => {
18933
+ var _a;
18858
18934
  let childBlock;
18859
18935
  const { children } = forNode;
18860
18936
  if (isTemplate) {
@@ -18898,7 +18974,8 @@ const transformFor = createStructuralDirectiveTransform(
18898
18974
  if (isTemplate && keyProperty) {
18899
18975
  injectProp(childBlock, keyProperty, context);
18900
18976
  }
18901
- if (childBlock.isBlock !== !isStableFragment) {
18977
+ const shouldUseBlock = !isStableFragment || childBlock.isBlockRequired === true;
18978
+ if (childBlock.isBlock !== shouldUseBlock) {
18902
18979
  if (childBlock.isBlock) {
18903
18980
  removeHelper(OPEN_BLOCK);
18904
18981
  removeHelper(
@@ -18910,12 +18987,15 @@ const transformFor = createStructuralDirectiveTransform(
18910
18987
  );
18911
18988
  }
18912
18989
  }
18913
- childBlock.isBlock = !isStableFragment;
18990
+ childBlock.isBlock = shouldUseBlock;
18914
18991
  if (childBlock.isBlock) {
18915
18992
  helper(OPEN_BLOCK);
18916
18993
  helper(getVNodeBlockHelper(context.inSSR, childBlock.isComponent));
18917
18994
  } else {
18918
18995
  helper(getVNodeHelper(context.inSSR, childBlock.isComponent));
18996
+ if (childBlock.needsPatch) {
18997
+ childBlock.patchFlag = ((_a = childBlock.patchFlag) != null ? _a : 0) | 512;
18998
+ }
18919
18999
  }
18920
19000
  }
18921
19001
  if (memo) {
@@ -19294,6 +19374,8 @@ const transformElement = (node, context) => {
19294
19374
  let vnodeDynamicProps;
19295
19375
  let dynamicPropNames;
19296
19376
  let vnodeDirectives;
19377
+ let needsPatch = false;
19378
+ let isBlockRequired = false;
19297
19379
  let shouldUseBlock = (
19298
19380
  // dynamic component may resolve to plain elements
19299
19381
  isDynamicComponent || vnodeTag === TELEPORT || vnodeTag === SUSPENSE || !isComponent && // <svg> and <foreignObject> must be forced into blocks so that block
@@ -19313,6 +19395,8 @@ const transformElement = (node, context) => {
19313
19395
  vnodeProps = propsBuildResult.props;
19314
19396
  patchFlag = propsBuildResult.patchFlag;
19315
19397
  dynamicPropNames = propsBuildResult.dynamicPropNames;
19398
+ needsPatch = propsBuildResult.needsPatch;
19399
+ isBlockRequired = propsBuildResult.isBlockRequired;
19316
19400
  const directives = propsBuildResult.directives;
19317
19401
  vnodeDirectives = directives && directives.length ? createArrayExpression(
19318
19402
  directives.map((dir) => buildDirectiveArgs(dir, context))
@@ -19363,7 +19447,7 @@ const transformElement = (node, context) => {
19363
19447
  if (dynamicPropNames && dynamicPropNames.length) {
19364
19448
  vnodeDynamicProps = stringifyDynamicPropNames(dynamicPropNames);
19365
19449
  }
19366
- node.codegenNode = createVNodeCall(
19450
+ const vnodeCall = node.codegenNode = createVNodeCall(
19367
19451
  context,
19368
19452
  vnodeTag,
19369
19453
  vnodeProps,
@@ -19376,6 +19460,13 @@ const transformElement = (node, context) => {
19376
19460
  isComponent,
19377
19461
  node.loc
19378
19462
  );
19463
+ needsPatch = needsPatch && (patchFlag === 0 || patchFlag === 32);
19464
+ if (needsPatch) {
19465
+ vnodeCall.needsPatch = true;
19466
+ }
19467
+ if (isBlockRequired) {
19468
+ vnodeCall.isBlockRequired = true;
19469
+ }
19379
19470
  };
19380
19471
  };
19381
19472
  function resolveComponentType(node, context, ssr = false) {
@@ -19427,6 +19518,7 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
19427
19518
  const runtimeDirectives = [];
19428
19519
  const hasChildren = children.length > 0;
19429
19520
  let shouldUseBlock = false;
19521
+ let isBlockRequired = false;
19430
19522
  let patchFlag = 0;
19431
19523
  let hasRef = false;
19432
19524
  let hasClassBinding = false;
@@ -19468,19 +19560,20 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
19468
19560
  if (isEventHandler && isReservedProp(name)) {
19469
19561
  hasVnodeHook = true;
19470
19562
  }
19563
+ if (name === "ref") {
19564
+ hasRef = true;
19565
+ }
19471
19566
  if (isEventHandler && value.type === 14) {
19472
19567
  value = value.arguments[0];
19473
19568
  }
19474
19569
  if (value.type === 20 || (value.type === 4 || value.type === 8) && getConstantType(value, context) > 0) {
19475
19570
  return;
19476
19571
  }
19477
- if (name === "ref") {
19478
- hasRef = true;
19479
- } else if (name === "class") {
19572
+ if (name === "class") {
19480
19573
  hasClassBinding = true;
19481
19574
  } else if (name === "style") {
19482
19575
  hasStyleBinding = true;
19483
- } else if (name !== "key" && !dynamicPropNames.includes(name)) {
19576
+ } else if (name !== "ref" && name !== "key" && !dynamicPropNames.includes(name)) {
19484
19577
  dynamicPropNames.push(name);
19485
19578
  }
19486
19579
  if (isComponent && (name === "class" || name === "style") && !dynamicPropNames.includes(name)) {
@@ -19539,13 +19632,12 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
19539
19632
  if (isVOn && ssr) {
19540
19633
  continue;
19541
19634
  }
19542
- if (
19543
- // #938: elements with dynamic keys should be forced into blocks
19544
- isVBind && isStaticArgOf(arg, "key") || // inline before-update hooks need to force block so that it is invoked
19545
- // before children
19546
- isVOn && hasChildren && isStaticArgOf(arg, "vue:before-update")
19547
- ) {
19635
+ if (isVBind && isStaticArgOf(arg, "key")) {
19636
+ shouldUseBlock = true;
19637
+ }
19638
+ if (isVOn && hasChildren && arg && isStaticExp(arg) && camelize(arg.content) === "vue:beforeUpdate") {
19548
19639
  shouldUseBlock = true;
19640
+ isBlockRequired = true;
19549
19641
  }
19550
19642
  if (isVBind && isStaticArgOf(arg, "ref")) {
19551
19643
  pushRefVForMarker();
@@ -19628,6 +19720,7 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
19628
19720
  runtimeDirectives.push(prop);
19629
19721
  if (hasChildren) {
19630
19722
  shouldUseBlock = true;
19723
+ isBlockRequired = true;
19631
19724
  }
19632
19725
  }
19633
19726
  }
@@ -19666,7 +19759,8 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
19666
19759
  patchFlag |= 32;
19667
19760
  }
19668
19761
  }
19669
- if (!shouldUseBlock && (patchFlag === 0 || patchFlag === 32) && (hasRef || hasVnodeHook || runtimeDirectives.length > 0)) {
19762
+ const needsPatch = (patchFlag === 0 || patchFlag === 32) && (hasRef || hasVnodeHook || runtimeDirectives.length > 0);
19763
+ if (!shouldUseBlock && needsPatch) {
19670
19764
  patchFlag |= 512;
19671
19765
  }
19672
19766
  if (!context.inSSR && propsExpression) {
@@ -19732,7 +19826,9 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
19732
19826
  directives: runtimeDirectives,
19733
19827
  patchFlag,
19734
19828
  dynamicPropNames,
19735
- shouldUseBlock
19829
+ shouldUseBlock,
19830
+ needsPatch,
19831
+ isBlockRequired
19736
19832
  };
19737
19833
  }
19738
19834
  function dedupeProperties(properties) {