@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
  **/
@@ -213,7 +213,7 @@ const isVoidTag = /* @__PURE__ */ makeMap(VOID_TAGS);
213
213
  const specialBooleanAttrs = `itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly`;
214
214
  const isSpecialBooleanAttr = /* @__PURE__ */ makeMap(specialBooleanAttrs);
215
215
  const isBooleanAttr = /* @__PURE__ */ makeMap(
216
- specialBooleanAttrs + `,async,autofocus,autoplay,controls,default,defer,disabled,hidden,inert,loop,open,required,reversed,scoped,seamless,checked,muted,multiple,selected`
216
+ specialBooleanAttrs + `,async,autofocus,autoplay,controls,default,defer,disabled,inert,loop,open,required,reversed,scoped,seamless,checked,muted,multiple,selected`
217
217
  );
218
218
  function includeBooleanAttr(value) {
219
219
  return !!value || value === "";
@@ -2345,7 +2345,9 @@ function queuePostFlushCb(cb) {
2345
2345
  cb.flags |= 1;
2346
2346
  }
2347
2347
  } else {
2348
- pendingPostFlushCbs.push(...cb);
2348
+ for (let i = 0; i < cb.length; i++) {
2349
+ pendingPostFlushCbs.push(cb[i]);
2350
+ }
2349
2351
  }
2350
2352
  queueFlush();
2351
2353
  }
@@ -2375,7 +2377,9 @@ function flushPostFlushCbs(seen) {
2375
2377
  );
2376
2378
  pendingPostFlushCbs.length = 0;
2377
2379
  if (activePostFlushCbs) {
2378
- activePostFlushCbs.push(...deduped);
2380
+ for (let i = 0; i < deduped.length; i++) {
2381
+ activePostFlushCbs.push(deduped[i]);
2382
+ }
2379
2383
  return;
2380
2384
  }
2381
2385
  activePostFlushCbs = deduped;
@@ -3542,7 +3546,11 @@ function getInnerChild$1(vnode) {
3542
3546
  function setTransitionHooks(vnode, hooks) {
3543
3547
  if (vnode.shapeFlag & 6 && vnode.component) {
3544
3548
  vnode.transition = hooks;
3545
- setTransitionHooks(vnode.component.subTree, hooks);
3549
+ const subTree = vnode.component.subTree;
3550
+ setTransitionHooks(
3551
+ isTeleport(subTree.type) ? getInnerChild$1(subTree) || subTree : subTree,
3552
+ hooks
3553
+ );
3546
3554
  } else if (vnode.shapeFlag & 128) {
3547
3555
  vnode.ssContent.transition = hooks.clone(vnode.ssContent);
3548
3556
  vnode.ssFallback.transition = hooks.clone(vnode.ssFallback);
@@ -4010,6 +4018,9 @@ function createHydrationFunctions(rendererInternals) {
4010
4018
  for (const key in props) {
4011
4019
  if (forcePatch && (key.endsWith("value") || key === "indeterminate") || isOn(key) && !isReservedProp(key) || // force hydrate v-bind with .prop modifiers
4012
4020
  key[0] === "." || isCustomElement && !isReservedProp(key) || dynamicProps && dynamicProps.includes(key)) {
4021
+ if (isUnchangedResourceProp(el, key, props[key])) {
4022
+ continue;
4023
+ }
4013
4024
  patchProp(el, key, null, props[key], namespace, parentComponent);
4014
4025
  }
4015
4026
  }
@@ -4188,6 +4199,13 @@ function createHydrationFunctions(rendererInternals) {
4188
4199
  };
4189
4200
  return [hydrate, hydrateNode];
4190
4201
  }
4202
+ const resourceProps = /* @__PURE__ */ new Set(["src", "srcset", "href", "poster"]);
4203
+ function isUnchangedResourceProp(el, key, clientValue) {
4204
+ if (!resourceProps.has(key)) {
4205
+ return false;
4206
+ }
4207
+ return el.getAttribute(key) === (clientValue == null ? null : `${clientValue}`);
4208
+ }
4191
4209
  const allowMismatchAttr = "data-allow-mismatch";
4192
4210
  const MismatchTypeString = {
4193
4211
  [0 /* TEXT */]: "text",
@@ -5201,7 +5219,8 @@ function createSlots(slots, dynamicSlots) {
5201
5219
  return slots;
5202
5220
  }
5203
5221
 
5204
- function renderSlot(slots, name, props = {}, fallback, noSlotted, branchKey) {
5222
+ function renderSlot(slots, name, props, fallback, noSlotted, branchKey) {
5223
+ if (props == null) props = {};
5205
5224
  if (currentRenderingInstance.ce || currentRenderingInstance.parent && isAsyncWrapper(currentRenderingInstance.parent) && currentRenderingInstance.parent.ce) {
5206
5225
  const slotProps = branchKey != null && props.key == null ? extend$1({}, props, { key: branchKey }) : props;
5207
5226
  const hasProps = Object.keys(slotProps).length > 0;
@@ -6169,7 +6188,7 @@ function createCompatVue$1(createApp, createSingletonApp) {
6169
6188
  return vm;
6170
6189
  }
6171
6190
  }
6172
- Vue.version = `2.6.14-compat:${"3.5.40"}`;
6191
+ Vue.version = `2.6.14-compat:${"3.5.41"}`;
6173
6192
  Vue.config = singletonApp.config;
6174
6193
  Vue.use = (plugin, ...options) => {
6175
6194
  if (plugin && isFunction(plugin.install)) {
@@ -6968,7 +6987,8 @@ function renderComponentRoot(instance) {
6968
6987
  root.dirs = root.dirs ? root.dirs.concat(vnode.dirs) : vnode.dirs;
6969
6988
  }
6970
6989
  if (vnode.transition) {
6971
- setTransitionHooks(root, vnode.transition);
6990
+ const child = isTeleport(root.type) ? getInnerChild$1(root) || root : root;
6991
+ setTransitionHooks(child, vnode.transition);
6972
6992
  }
6973
6993
  {
6974
6994
  result = root;
@@ -9333,7 +9353,9 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
9333
9353
  let hasUnresolvedAncestor = false;
9334
9354
  while (parent) {
9335
9355
  if (parent.pendingBranch) {
9336
- parent.effects.push(...effects);
9356
+ for (let i = 0; i < effects.length; i++) {
9357
+ parent.effects.push(effects[i]);
9358
+ }
9337
9359
  hasUnresolvedAncestor = true;
9338
9360
  break;
9339
9361
  }
@@ -10147,7 +10169,12 @@ function setupStatefulComponent(instance, isSSR) {
10147
10169
  setupResult.then(unsetCurrentInstance, unsetCurrentInstance);
10148
10170
  if (isSSR) {
10149
10171
  return setupResult.then((resolvedResult) => {
10150
- handleSetupResult(instance, resolvedResult, isSSR);
10172
+ setInSSRSetupState(true);
10173
+ try {
10174
+ handleSetupResult(instance, resolvedResult, isSSR);
10175
+ } finally {
10176
+ setInSSRSetupState(false);
10177
+ }
10151
10178
  }).catch((e) => {
10152
10179
  handleError(e, instance, 0);
10153
10180
  });
@@ -10337,7 +10364,7 @@ function isMemoSame(cached, memo) {
10337
10364
  return true;
10338
10365
  }
10339
10366
 
10340
- const version = "3.5.40";
10367
+ const version = "3.5.41";
10341
10368
  const warn$1 = NOOP;
10342
10369
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
10343
10370
  const devtools = void 0;
@@ -11289,7 +11316,9 @@ class VueElement extends BaseClass {
11289
11316
  if (parent && parent._pendingResolve) {
11290
11317
  this._pendingResolve = parent._pendingResolve.then(() => {
11291
11318
  this._pendingResolve = void 0;
11292
- this._resolveDef();
11319
+ if (this.isConnected) {
11320
+ return this._resolveDef();
11321
+ }
11293
11322
  });
11294
11323
  } else {
11295
11324
  this._resolveDef();
@@ -11339,7 +11368,7 @@ class VueElement extends BaseClass {
11339
11368
  */
11340
11369
  _resolveDef() {
11341
11370
  if (this._pendingResolve) {
11342
- return;
11371
+ return this._pendingResolve;
11343
11372
  }
11344
11373
  for (let i = 0; i < this.attributes.length; i++) {
11345
11374
  this._setAttr(this.attributes[i].name);
@@ -11375,6 +11404,7 @@ class VueElement extends BaseClass {
11375
11404
  def.configureApp = this._def.configureApp;
11376
11405
  resolve(this._def = def, true);
11377
11406
  });
11407
+ return this._pendingResolve;
11378
11408
  } else {
11379
11409
  resolve(this._def);
11380
11410
  }
@@ -11848,6 +11878,7 @@ function onCompositionEnd(e) {
11848
11878
  }
11849
11879
  }
11850
11880
  const assignKey = /* @__PURE__ */ Symbol("_assign");
11881
+ const initialValueKey = /* @__PURE__ */ Symbol("_initialValue");
11851
11882
  function castValue(value, trim, number) {
11852
11883
  if (trim) value = value.trim();
11853
11884
  if (number) value = looseToNumber(value);
@@ -11855,6 +11886,13 @@ function castValue(value, trim, number) {
11855
11886
  }
11856
11887
  const vModelText = {
11857
11888
  created(el, { modifiers: { lazy, trim, number } }, vnode) {
11889
+ if (el.parentNode) {
11890
+ if (el.type === "text") {
11891
+ el[initialValueKey] = el.defaultValue.replace(/[\r\n]/g, "");
11892
+ } else if (el.type === "textarea") {
11893
+ el[initialValueKey] = el.defaultValue.replace(/\r\n?/g, "\n");
11894
+ }
11895
+ }
11858
11896
  el[assignKey] = getModelAssigner(vnode);
11859
11897
  const castToNumber = number || vnode.props && vnode.props.type === "number";
11860
11898
  addEventListener(el, lazy ? "change" : "input", (e) => {
@@ -11873,8 +11911,15 @@ const vModelText = {
11873
11911
  }
11874
11912
  },
11875
11913
  // set value on mounted so it's after min/max for type="range"
11876
- mounted(el, { value }) {
11877
- el.value = value == null ? "" : value;
11914
+ mounted(el, { value, modifiers: { trim, number } }) {
11915
+ const newValue = value == null ? "" : value;
11916
+ const initialValue = el[initialValueKey];
11917
+ delete el[initialValueKey];
11918
+ if (initialValue !== void 0 && (el.type === "text" || el.type === "textarea") && el.value !== initialValue) {
11919
+ el[assignKey](castValue(el.value, trim, number));
11920
+ } else {
11921
+ el.value = newValue;
11922
+ }
11878
11923
  },
11879
11924
  beforeUpdate(el, { value, oldValue, modifiers: { lazy, trim, number } }, vnode) {
11880
11925
  el[assignKey] = getModelAssigner(vnode);
@@ -16951,6 +16996,7 @@ const transformFor = createStructuralDirectiveTransform(
16951
16996
  node.loc
16952
16997
  );
16953
16998
  return () => {
16999
+ var _a;
16954
17000
  let childBlock;
16955
17001
  const { children } = forNode;
16956
17002
  if (isTemplate) {
@@ -16994,7 +17040,8 @@ const transformFor = createStructuralDirectiveTransform(
16994
17040
  if (isTemplate && keyProperty) {
16995
17041
  injectProp(childBlock, keyProperty, context);
16996
17042
  }
16997
- if (childBlock.isBlock !== !isStableFragment) {
17043
+ const shouldUseBlock = !isStableFragment || childBlock.isBlockRequired === true;
17044
+ if (childBlock.isBlock !== shouldUseBlock) {
16998
17045
  if (childBlock.isBlock) {
16999
17046
  removeHelper(OPEN_BLOCK);
17000
17047
  removeHelper(
@@ -17006,12 +17053,15 @@ const transformFor = createStructuralDirectiveTransform(
17006
17053
  );
17007
17054
  }
17008
17055
  }
17009
- childBlock.isBlock = !isStableFragment;
17056
+ childBlock.isBlock = shouldUseBlock;
17010
17057
  if (childBlock.isBlock) {
17011
17058
  helper(OPEN_BLOCK);
17012
17059
  helper(getVNodeBlockHelper(context.inSSR, childBlock.isComponent));
17013
17060
  } else {
17014
17061
  helper(getVNodeHelper(context.inSSR, childBlock.isComponent));
17062
+ if (childBlock.needsPatch) {
17063
+ childBlock.patchFlag = ((_a = childBlock.patchFlag) != null ? _a : 0) | 512;
17064
+ }
17015
17065
  }
17016
17066
  }
17017
17067
  if (memo) {
@@ -17433,6 +17483,8 @@ const transformElement = (node, context) => {
17433
17483
  let vnodeDynamicProps;
17434
17484
  let dynamicPropNames;
17435
17485
  let vnodeDirectives;
17486
+ let needsPatch = false;
17487
+ let isBlockRequired = false;
17436
17488
  let shouldUseBlock = (
17437
17489
  // dynamic component may resolve to plain elements
17438
17490
  isDynamicComponent || vnodeTag === TELEPORT || vnodeTag === SUSPENSE || !isComponent && // <svg> and <foreignObject> must be forced into blocks so that block
@@ -17452,6 +17504,8 @@ const transformElement = (node, context) => {
17452
17504
  vnodeProps = propsBuildResult.props;
17453
17505
  patchFlag = propsBuildResult.patchFlag;
17454
17506
  dynamicPropNames = propsBuildResult.dynamicPropNames;
17507
+ needsPatch = propsBuildResult.needsPatch;
17508
+ isBlockRequired = propsBuildResult.isBlockRequired;
17455
17509
  const directives = propsBuildResult.directives;
17456
17510
  vnodeDirectives = directives && directives.length ? createArrayExpression(
17457
17511
  directives.map((dir) => buildDirectiveArgs(dir, context))
@@ -17493,7 +17547,7 @@ const transformElement = (node, context) => {
17493
17547
  if (dynamicPropNames && dynamicPropNames.length) {
17494
17548
  vnodeDynamicProps = stringifyDynamicPropNames(dynamicPropNames);
17495
17549
  }
17496
- node.codegenNode = createVNodeCall(
17550
+ const vnodeCall = node.codegenNode = createVNodeCall(
17497
17551
  context,
17498
17552
  vnodeTag,
17499
17553
  vnodeProps,
@@ -17506,6 +17560,13 @@ const transformElement = (node, context) => {
17506
17560
  isComponent,
17507
17561
  node.loc
17508
17562
  );
17563
+ needsPatch = needsPatch && (patchFlag === 0 || patchFlag === 32);
17564
+ if (needsPatch) {
17565
+ vnodeCall.needsPatch = true;
17566
+ }
17567
+ if (isBlockRequired) {
17568
+ vnodeCall.isBlockRequired = true;
17569
+ }
17509
17570
  };
17510
17571
  };
17511
17572
  function resolveComponentType(node, context, ssr = false) {
@@ -17615,6 +17676,7 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
17615
17676
  const runtimeDirectives = [];
17616
17677
  const hasChildren = children.length > 0;
17617
17678
  let shouldUseBlock = false;
17679
+ let isBlockRequired = false;
17618
17680
  let patchFlag = 0;
17619
17681
  let hasRef = false;
17620
17682
  let hasClassBinding = false;
@@ -17656,19 +17718,20 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
17656
17718
  if (isEventHandler && isReservedProp(name)) {
17657
17719
  hasVnodeHook = true;
17658
17720
  }
17721
+ if (name === "ref") {
17722
+ hasRef = true;
17723
+ }
17659
17724
  if (isEventHandler && value.type === 14) {
17660
17725
  value = value.arguments[0];
17661
17726
  }
17662
17727
  if (value.type === 20 || (value.type === 4 || value.type === 8) && getConstantType(value, context) > 0) {
17663
17728
  return;
17664
17729
  }
17665
- if (name === "ref") {
17666
- hasRef = true;
17667
- } else if (name === "class") {
17730
+ if (name === "class") {
17668
17731
  hasClassBinding = true;
17669
17732
  } else if (name === "style") {
17670
17733
  hasStyleBinding = true;
17671
- } else if (name !== "key" && !dynamicPropNames.includes(name)) {
17734
+ } else if (name !== "ref" && name !== "key" && !dynamicPropNames.includes(name)) {
17672
17735
  dynamicPropNames.push(name);
17673
17736
  }
17674
17737
  if (isComponent && (name === "class" || name === "style") && !dynamicPropNames.includes(name)) {
@@ -17739,14 +17802,13 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
17739
17802
  if (isVOn && ssr) {
17740
17803
  continue;
17741
17804
  }
17742
- if (
17743
- // #938: elements with dynamic keys should be forced into blocks
17744
- isVBind && isStaticArgOf(arg, "key") || // inline before-update hooks need to force block so that it is invoked
17745
- // before children
17746
- isVOn && hasChildren && isStaticArgOf(arg, "vue:before-update")
17747
- ) {
17805
+ if (isVBind && isStaticArgOf(arg, "key")) {
17748
17806
  shouldUseBlock = true;
17749
17807
  }
17808
+ if (isVOn && hasChildren && arg && isStaticExp(arg) && camelize(arg.content) === "vue:beforeUpdate") {
17809
+ shouldUseBlock = true;
17810
+ isBlockRequired = true;
17811
+ }
17750
17812
  if (isVBind && isStaticArgOf(arg, "ref")) {
17751
17813
  pushRefVForMarker();
17752
17814
  }
@@ -17807,6 +17869,7 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
17807
17869
  runtimeDirectives.push(prop);
17808
17870
  if (hasChildren) {
17809
17871
  shouldUseBlock = true;
17872
+ isBlockRequired = true;
17810
17873
  }
17811
17874
  }
17812
17875
  }
@@ -17845,7 +17908,8 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
17845
17908
  patchFlag |= 32;
17846
17909
  }
17847
17910
  }
17848
- if (!shouldUseBlock && (patchFlag === 0 || patchFlag === 32) && (hasRef || hasVnodeHook || runtimeDirectives.length > 0)) {
17911
+ const needsPatch = (patchFlag === 0 || patchFlag === 32) && (hasRef || hasVnodeHook || runtimeDirectives.length > 0);
17912
+ if (!shouldUseBlock && needsPatch) {
17849
17913
  patchFlag |= 512;
17850
17914
  }
17851
17915
  if (!context.inSSR && propsExpression) {
@@ -17911,7 +17975,9 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
17911
17975
  directives: runtimeDirectives,
17912
17976
  patchFlag,
17913
17977
  dynamicPropNames,
17914
- shouldUseBlock
17978
+ shouldUseBlock,
17979
+ needsPatch,
17980
+ isBlockRequired
17915
17981
  };
17916
17982
  }
17917
17983
  function dedupeProperties(properties) {
@@ -19216,12 +19282,15 @@ function stringifyElement(node, context) {
19216
19282
  res += ` ${p.arg.content}="__VUE_EXP_START__${exp.content}__VUE_EXP_END__"`;
19217
19283
  continue;
19218
19284
  }
19219
- if (isBooleanAttr(p.arg.content) && exp.content === "false") {
19285
+ if ((isBooleanAttr(p.arg.content) || p.arg.content === "hidden") && exp.content === "false") {
19220
19286
  continue;
19221
19287
  }
19222
19288
  let evaluated = evaluateConstant(exp);
19223
19289
  if (evaluated != null) {
19224
19290
  const arg = p.arg && p.arg.content;
19291
+ if (arg === "hidden" && typeof evaluated === "number" && !includeBooleanAttr(evaluated)) {
19292
+ continue;
19293
+ }
19225
19294
  if (arg === "class") {
19226
19295
  evaluated = normalizeClass(evaluated);
19227
19296
  } else if (arg === "style") {