@vue/compat 3.5.39 → 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.39
2
+ * @vue/compat v3.5.41
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -194,7 +194,7 @@ const isMathMLTag = /* @__PURE__ */ makeMap(MATH_TAGS);
194
194
  const specialBooleanAttrs = `itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly`;
195
195
  const isSpecialBooleanAttr = /* @__PURE__ */ makeMap(specialBooleanAttrs);
196
196
  const isBooleanAttr = /* @__PURE__ */ makeMap(
197
- specialBooleanAttrs + `,async,autofocus,autoplay,controls,default,defer,disabled,hidden,inert,loop,open,required,reversed,scoped,seamless,checked,muted,multiple,selected`
197
+ specialBooleanAttrs + `,async,autofocus,autoplay,controls,default,defer,disabled,inert,loop,open,required,reversed,scoped,seamless,checked,muted,multiple,selected`
198
198
  );
199
199
  function includeBooleanAttr(value) {
200
200
  return !!value || value === "";
@@ -376,8 +376,9 @@ class EffectScope {
376
376
  this._isPaused = true;
377
377
  let i, l;
378
378
  if (this.scopes) {
379
- for (i = 0, l = this.scopes.length; i < l; i++) {
380
- this.scopes[i].pause();
379
+ const scopes = this.scopes.slice();
380
+ for (i = 0, l = scopes.length; i < l; i++) {
381
+ scopes[i].pause();
381
382
  }
382
383
  }
383
384
  for (i = 0, l = this.effects.length; i < l; i++) {
@@ -394,12 +395,14 @@ class EffectScope {
394
395
  this._isPaused = false;
395
396
  let i, l;
396
397
  if (this.scopes) {
397
- for (i = 0, l = this.scopes.length; i < l; i++) {
398
- this.scopes[i].resume();
398
+ const scopes = this.scopes.slice();
399
+ for (i = 0, l = scopes.length; i < l; i++) {
400
+ scopes[i].resume();
399
401
  }
400
402
  }
401
- for (i = 0, l = this.effects.length; i < l; i++) {
402
- this.effects[i].resume();
403
+ const effects = this.effects.slice();
404
+ for (i = 0, l = effects.length; i < l; i++) {
405
+ effects[i].resume();
403
406
  }
404
407
  }
405
408
  }
@@ -461,8 +464,9 @@ class EffectScope {
461
464
  }
462
465
  this.cleanups.length = 0;
463
466
  if (this.scopes) {
464
- for (i = 0, l = this.scopes.length; i < l; i++) {
465
- this.scopes[i].stop(true);
467
+ const scopes = this.scopes.slice();
468
+ for (i = 0, l = scopes.length; i < l; i++) {
469
+ scopes[i].stop(true);
466
470
  }
467
471
  this.scopes.length = 0;
468
472
  }
@@ -2593,7 +2597,9 @@ function queuePostFlushCb(cb) {
2593
2597
  cb.flags |= 1;
2594
2598
  }
2595
2599
  } else {
2596
- pendingPostFlushCbs.push(...cb);
2600
+ for (let i = 0; i < cb.length; i++) {
2601
+ pendingPostFlushCbs.push(cb[i]);
2602
+ }
2597
2603
  }
2598
2604
  queueFlush();
2599
2605
  }
@@ -2629,7 +2635,9 @@ function flushPostFlushCbs(seen) {
2629
2635
  );
2630
2636
  pendingPostFlushCbs.length = 0;
2631
2637
  if (activePostFlushCbs) {
2632
- activePostFlushCbs.push(...deduped);
2638
+ for (let i = 0; i < deduped.length; i++) {
2639
+ activePostFlushCbs.push(deduped[i]);
2640
+ }
2633
2641
  return;
2634
2642
  }
2635
2643
  activePostFlushCbs = deduped;
@@ -3384,10 +3392,12 @@ function withCtx(fn, ctx = currentRenderingInstance, isNonScopedSlot) {
3384
3392
  setBlockTracking(-1);
3385
3393
  }
3386
3394
  const prevInstance = setCurrentRenderingInstance(ctx);
3395
+ const prevStackSize = blockStack.length;
3387
3396
  let res;
3388
3397
  try {
3389
3398
  res = fn(...args);
3390
3399
  } finally {
3400
+ for (let i = blockStack.length; i > prevStackSize; i--) closeBlock();
3391
3401
  setCurrentRenderingInstance(prevInstance);
3392
3402
  if (renderFnWithContext._d) {
3393
3403
  setBlockTracking(1);
@@ -4388,7 +4398,11 @@ function getInnerChild$1(vnode) {
4388
4398
  function setTransitionHooks(vnode, hooks) {
4389
4399
  if (vnode.shapeFlag & 6 && vnode.component) {
4390
4400
  vnode.transition = hooks;
4391
- setTransitionHooks(vnode.component.subTree, hooks);
4401
+ const subTree = vnode.component.subTree;
4402
+ setTransitionHooks(
4403
+ isTeleport(subTree.type) ? getInnerChild$1(subTree) || subTree : subTree,
4404
+ hooks
4405
+ );
4392
4406
  } else if (vnode.shapeFlag & 128) {
4393
4407
  vnode.ssContent.transition = hooks.clone(vnode.ssContent);
4394
4408
  vnode.ssFallback.transition = hooks.clone(vnode.ssFallback);
@@ -4548,12 +4562,7 @@ function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
4548
4562
  }
4549
4563
  }
4550
4564
  if (isFunction(ref)) {
4551
- pauseTracking();
4552
- try {
4553
- callWithErrorHandling(ref, owner, 12, [value, refs]);
4554
- } finally {
4555
- resetTracking();
4556
- }
4565
+ callWithErrorHandling(ref, owner, 12, [value, refs]);
4557
4566
  } else {
4558
4567
  const _isString = isString(ref);
4559
4568
  const _isRef = isRef(ref);
@@ -4924,6 +4933,7 @@ Server rendered element contains more child nodes than client vdom.`
4924
4933
  if (props) {
4925
4934
  {
4926
4935
  const isCustomElement = el.tagName.includes("-");
4936
+ const namespace = el.namespaceURI.includes("svg") ? "svg" : el.namespaceURI.includes("MathML") ? "mathml" : void 0;
4927
4937
  for (const key in props) {
4928
4938
  if (// #11189 skip if this node has directives that have created hooks
4929
4939
  // as it could have mutated the DOM in any possible way
@@ -4932,7 +4942,10 @@ Server rendered element contains more child nodes than client vdom.`
4932
4942
  }
4933
4943
  if (forcePatch && (key.endsWith("value") || key === "indeterminate") || isOn(key) && !isReservedProp(key) || // force hydrate v-bind with .prop modifiers
4934
4944
  key[0] === "." || isCustomElement && !isReservedProp(key) || dynamicProps && dynamicProps.includes(key)) {
4935
- patchProp(el, key, null, props[key], void 0, parentComponent);
4945
+ if (isUnchangedResourceProp(el, key, props[key])) {
4946
+ continue;
4947
+ }
4948
+ patchProp(el, key, null, props[key], namespace, parentComponent);
4936
4949
  }
4937
4950
  }
4938
4951
  }
@@ -5114,6 +5127,13 @@ Server rendered element contains fewer child nodes than client vdom.`
5114
5127
  };
5115
5128
  return [hydrate, hydrateNode];
5116
5129
  }
5130
+ const resourceProps = /* @__PURE__ */ new Set(["src", "srcset", "href", "poster"]);
5131
+ function isUnchangedResourceProp(el, key, clientValue) {
5132
+ if (!resourceProps.has(key)) {
5133
+ return false;
5134
+ }
5135
+ return el.getAttribute(key) === (clientValue == null ? null : `${clientValue}`);
5136
+ }
5117
5137
  function propHasMismatch(el, key, clientValue, vnode, instance) {
5118
5138
  let mismatchType;
5119
5139
  let mismatchKey;
@@ -5151,7 +5171,10 @@ function propHasMismatch(el, key, clientValue, vnode, instance) {
5151
5171
  mismatchKey = "style";
5152
5172
  }
5153
5173
  } else if (el instanceof SVGElement && isKnownSvgAttr(key) || el instanceof HTMLElement && (isBooleanAttr(key) || isKnownHtmlAttr(key))) {
5154
- if (isBooleanAttr(key)) {
5174
+ if (key === "hidden") {
5175
+ actual = normalizeHiddenValue(el.getAttribute(key));
5176
+ expected = normalizeHiddenValue(clientValue);
5177
+ } else if (isBooleanAttr(key)) {
5155
5178
  actual = el.hasAttribute(key);
5156
5179
  expected = includeBooleanAttr(clientValue);
5157
5180
  } else if (clientValue == null) {
@@ -5187,6 +5210,15 @@ function propHasMismatch(el, key, clientValue, vnode, instance) {
5187
5210
  }
5188
5211
  return false;
5189
5212
  }
5213
+ function normalizeHiddenValue(value) {
5214
+ if (!isRenderableAttrValue(value)) {
5215
+ return false;
5216
+ }
5217
+ if (isString(value)) {
5218
+ return value.toLowerCase() === "until-found" ? "until-found" : "";
5219
+ }
5220
+ return includeBooleanAttr(value) ? "" : false;
5221
+ }
5190
5222
  function toClassSet(str) {
5191
5223
  return new Set(str.trim().split(/\s+/));
5192
5224
  }
@@ -5435,6 +5467,7 @@ function defineAsyncComponent(source) {
5435
5467
  name: "AsyncComponentWrapper",
5436
5468
  __asyncLoader: load,
5437
5469
  __asyncHydrate(el, instance, hydrate) {
5470
+ const wasConnected = el.isConnected;
5438
5471
  let patched = false;
5439
5472
  (instance.bu || (instance.bu = [])).push(() => patched = true);
5440
5473
  const performHydrate = () => {
@@ -5446,6 +5479,7 @@ function defineAsyncComponent(source) {
5446
5479
  }
5447
5480
  return;
5448
5481
  }
5482
+ if (!el.parentNode || wasConnected && !el.isConnected) return;
5449
5483
  hydrate();
5450
5484
  };
5451
5485
  const doHydrate = hydrateStrategy ? () => {
@@ -6295,14 +6329,16 @@ function createSlots(slots, dynamicSlots) {
6295
6329
  return slots;
6296
6330
  }
6297
6331
 
6298
- function renderSlot(slots, name, props = {}, fallback, noSlotted) {
6332
+ function renderSlot(slots, name, props, fallback, noSlotted, branchKey) {
6333
+ if (props == null) props = {};
6299
6334
  if (currentRenderingInstance.ce || currentRenderingInstance.parent && isAsyncWrapper(currentRenderingInstance.parent) && currentRenderingInstance.parent.ce) {
6300
- const hasProps = Object.keys(props).length > 0;
6301
- if (name !== "default") props.name = name;
6335
+ const slotProps = branchKey != null && props.key == null ? extend({}, props, { key: branchKey }) : props;
6336
+ const hasProps = Object.keys(slotProps).length > 0;
6337
+ if (name !== "default") slotProps.name = name;
6302
6338
  return openBlock(), createBlock(
6303
6339
  Fragment,
6304
6340
  null,
6305
- [createVNode("slot", props, fallback && fallback())],
6341
+ [createVNode("slot", slotProps, fallback && fallback())],
6306
6342
  hasProps ? -2 : 64
6307
6343
  );
6308
6344
  }
@@ -6316,26 +6352,34 @@ function renderSlot(slots, name, props = {}, fallback, noSlotted) {
6316
6352
  if (slot && slot._c) {
6317
6353
  slot._d = false;
6318
6354
  }
6355
+ const prevStackSize = blockStack.length;
6319
6356
  openBlock();
6320
- const validSlotContent = slot && ensureValidVNode(slot(props));
6321
- const slotKey = props.key || // slot content array of a dynamic conditional slot may have a branch
6322
- // key attached in the `createSlots` helper, respect that
6323
- validSlotContent && validSlotContent.key;
6324
- const rendered = createBlock(
6325
- Fragment,
6326
- {
6327
- key: (slotKey && !isSymbol(slotKey) ? slotKey : `_${name}`) + // #7256 force differentiate fallback content from actual content
6328
- (!validSlotContent && fallback ? "_fb" : "")
6329
- },
6330
- validSlotContent || (fallback ? fallback() : []),
6331
- validSlotContent && slots._ === 1 ? 64 : -2
6332
- );
6357
+ let rendered;
6358
+ try {
6359
+ const validSlotContent = slot && ensureValidVNode(slot(props));
6360
+ const slotKey = props.key || branchKey || // slot content array of a dynamic conditional slot may have a branch
6361
+ // key attached in the `createSlots` helper, respect that
6362
+ validSlotContent && validSlotContent.key;
6363
+ rendered = createBlock(
6364
+ Fragment,
6365
+ {
6366
+ key: (slotKey && !isSymbol(slotKey) ? slotKey : `_${name}`) + // #7256 force differentiate fallback content from actual content
6367
+ (!validSlotContent && fallback ? "_fb" : "")
6368
+ },
6369
+ validSlotContent || (fallback ? fallback() : []),
6370
+ validSlotContent && slots._ === 1 ? 64 : -2
6371
+ );
6372
+ } catch (err) {
6373
+ for (let i = blockStack.length; i > prevStackSize; i--) closeBlock();
6374
+ throw err;
6375
+ } finally {
6376
+ if (slot && slot._c) {
6377
+ slot._d = true;
6378
+ }
6379
+ }
6333
6380
  if (!noSlotted && rendered.scopeId) {
6334
6381
  rendered.slotScopeIds = [rendered.scopeId + "-s"];
6335
6382
  }
6336
- if (slot && slot._c) {
6337
- slot._d = true;
6338
- }
6339
6383
  return rendered;
6340
6384
  }
6341
6385
  function ensureValidVNode(vnodes) {
@@ -7513,7 +7557,7 @@ function createCompatVue$1(createApp, createSingletonApp) {
7513
7557
  return vm;
7514
7558
  }
7515
7559
  }
7516
- Vue.version = `2.6.14-compat:${"3.5.39"}`;
7560
+ Vue.version = `2.6.14-compat:${"3.5.41"}`;
7517
7561
  Vue.config = singletonApp.config;
7518
7562
  Vue.use = (plugin, ...options) => {
7519
7563
  if (plugin && isFunction(plugin.install)) {
@@ -8535,12 +8579,13 @@ function renderComponentRoot(instance) {
8535
8579
  root.dirs = root.dirs ? root.dirs.concat(vnode.dirs) : vnode.dirs;
8536
8580
  }
8537
8581
  if (vnode.transition) {
8538
- if (!isElementRoot(root)) {
8582
+ const child = isTeleport(root.type) ? getInnerChild$1(root) || root : root;
8583
+ if (!isElementRoot(child)) {
8539
8584
  warn$1(
8540
8585
  `Component inside <Transition> renders non-element root node that cannot be animated.`
8541
8586
  );
8542
8587
  }
8543
- setTransitionHooks(root, vnode.transition);
8588
+ setTransitionHooks(child, vnode.transition);
8544
8589
  }
8545
8590
  if (setRoot) {
8546
8591
  setRoot(root);
@@ -11294,7 +11339,9 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
11294
11339
  let hasUnresolvedAncestor = false;
11295
11340
  while (parent) {
11296
11341
  if (parent.pendingBranch) {
11297
- parent.effects.push(...effects);
11342
+ for (let i = 0; i < effects.length; i++) {
11343
+ parent.effects.push(effects[i]);
11344
+ }
11298
11345
  hasUnresolvedAncestor = true;
11299
11346
  break;
11300
11347
  }
@@ -11716,6 +11763,14 @@ function createBaseVNode(type, props = null, children = null, patchFlag = 0, dyn
11716
11763
  if (vnode.key !== vnode.key) {
11717
11764
  warn$1(`VNode created with invalid key (NaN). VNode type:`, vnode.type);
11718
11765
  }
11766
+ if (props && vnode.shapeFlag & 1) {
11767
+ const overwritingProp = props.innerHTML != null ? "innerHTML" : props.textContent != null ? "textContent" : null;
11768
+ if (overwritingProp && hasContentChildren(vnode.children)) {
11769
+ warn$1(
11770
+ `The \`${overwritingProp}\` prop on <${vnode.type}> will override its children. Remove either the \`${overwritingProp}\` prop or the children.`
11771
+ );
11772
+ }
11773
+ }
11719
11774
  if (isBlockTreeEnabled > 0 && // avoid a block node from tracking itself
11720
11775
  !isBlockNode && // has current parent block
11721
11776
  currentBlock && // presence of a patch flag indicates this node needs patching on updates.
@@ -11733,6 +11788,11 @@ function createBaseVNode(type, props = null, children = null, patchFlag = 0, dyn
11733
11788
  }
11734
11789
  return vnode;
11735
11790
  }
11791
+ function hasContentChildren(children) {
11792
+ if (isString(children)) return children !== "";
11793
+ if (isArray(children)) return children.length > 0;
11794
+ return false;
11795
+ }
11736
11796
  const createVNode = createVNodeWithArgsTransform ;
11737
11797
  function _createVNode(type, props = null, children = null, patchFlag = 0, dynamicProps = null, isBlockNode = false) {
11738
11798
  if (!type || type === NULL_DYNAMIC_COMPONENT) {
@@ -12187,7 +12247,12 @@ function setupStatefulComponent(instance, isSSR) {
12187
12247
  setupResult.then(unsetCurrentInstance, unsetCurrentInstance);
12188
12248
  if (isSSR) {
12189
12249
  return setupResult.then((resolvedResult) => {
12190
- handleSetupResult(instance, resolvedResult, isSSR);
12250
+ setInSSRSetupState(true);
12251
+ try {
12252
+ handleSetupResult(instance, resolvedResult, isSSR);
12253
+ } finally {
12254
+ setInSSRSetupState(false);
12255
+ }
12191
12256
  }).catch((e) => {
12192
12257
  handleError(e, instance, 0);
12193
12258
  });
@@ -12665,7 +12730,7 @@ function isMemoSame(cached, memo) {
12665
12730
  return true;
12666
12731
  }
12667
12732
 
12668
- const version = "3.5.39";
12733
+ const version = "3.5.41";
12669
12734
  const warn = warn$1 ;
12670
12735
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
12671
12736
  const devtools = devtools$1 ;
@@ -13723,7 +13788,9 @@ class VueElement extends BaseClass {
13723
13788
  if (parent && parent._pendingResolve) {
13724
13789
  this._pendingResolve = parent._pendingResolve.then(() => {
13725
13790
  this._pendingResolve = void 0;
13726
- this._resolveDef();
13791
+ if (this.isConnected) {
13792
+ return this._resolveDef();
13793
+ }
13727
13794
  });
13728
13795
  } else {
13729
13796
  this._resolveDef();
@@ -13773,7 +13840,7 @@ class VueElement extends BaseClass {
13773
13840
  */
13774
13841
  _resolveDef() {
13775
13842
  if (this._pendingResolve) {
13776
- return;
13843
+ return this._pendingResolve;
13777
13844
  }
13778
13845
  for (let i = 0; i < this.attributes.length; i++) {
13779
13846
  this._setAttr(this.attributes[i].name);
@@ -13813,6 +13880,7 @@ class VueElement extends BaseClass {
13813
13880
  def.configureApp = this._def.configureApp;
13814
13881
  resolve(this._def = def, true);
13815
13882
  });
13883
+ return this._pendingResolve;
13816
13884
  } else {
13817
13885
  resolve(this._def);
13818
13886
  }
@@ -13850,6 +13918,11 @@ class VueElement extends BaseClass {
13850
13918
  }
13851
13919
  }
13852
13920
  for (const key of declaredPropKeys.map(camelize)) {
13921
+ if (key in Object.getPrototypeOf(this)) {
13922
+ warn(
13923
+ `Custom element prop "${key}" conflicts with an existing property on the element and will overwrite it.`
13924
+ );
13925
+ }
13853
13926
  Object.defineProperty(this, key, {
13854
13927
  get() {
13855
13928
  return this._getProp(key);
@@ -14343,6 +14416,7 @@ function onCompositionEnd(e) {
14343
14416
  }
14344
14417
  }
14345
14418
  const assignKey = /* @__PURE__ */ Symbol("_assign");
14419
+ const initialValueKey = /* @__PURE__ */ Symbol("_initialValue");
14346
14420
  function castValue(value, trim, number) {
14347
14421
  if (trim) value = value.trim();
14348
14422
  if (number) value = looseToNumber(value);
@@ -14350,6 +14424,13 @@ function castValue(value, trim, number) {
14350
14424
  }
14351
14425
  const vModelText = {
14352
14426
  created(el, { modifiers: { lazy, trim, number } }, vnode) {
14427
+ if (el.parentNode) {
14428
+ if (el.type === "text") {
14429
+ el[initialValueKey] = el.defaultValue.replace(/[\r\n]/g, "");
14430
+ } else if (el.type === "textarea") {
14431
+ el[initialValueKey] = el.defaultValue.replace(/\r\n?/g, "\n");
14432
+ }
14433
+ }
14353
14434
  el[assignKey] = getModelAssigner(vnode);
14354
14435
  const castToNumber = number || vnode.props && vnode.props.type === "number";
14355
14436
  addEventListener(el, lazy ? "change" : "input", (e) => {
@@ -14368,8 +14449,15 @@ const vModelText = {
14368
14449
  }
14369
14450
  },
14370
14451
  // set value on mounted so it's after min/max for type="range"
14371
- mounted(el, { value }) {
14372
- el.value = value == null ? "" : value;
14452
+ mounted(el, { value, modifiers: { trim, number } }) {
14453
+ const newValue = value == null ? "" : value;
14454
+ const initialValue = el[initialValueKey];
14455
+ delete el[initialValueKey];
14456
+ if (initialValue !== void 0 && (el.type === "text" || el.type === "textarea") && el.value !== initialValue) {
14457
+ el[assignKey](castValue(el.value, trim, number));
14458
+ } else {
14459
+ el.value = newValue;
14460
+ }
14373
14461
  },
14374
14462
  beforeUpdate(el, { value, oldValue, modifiers: { lazy, trim, number } }, vnode) {
14375
14463
  el[assignKey] = getModelAssigner(vnode);
@@ -14465,13 +14553,13 @@ const vModelSelect = {
14465
14553
  // <select multiple> value need to be deep traversed
14466
14554
  deep: true,
14467
14555
  created(el, { value, modifiers: { number } }, vnode) {
14468
- const isSetModel = isSet(value);
14556
+ el._modelValue = value;
14469
14557
  addEventListener(el, "change", () => {
14470
14558
  const selectedVal = Array.prototype.filter.call(el.options, (o) => o.selected).map(
14471
14559
  (o) => number ? looseToNumber(getValue(o)) : getValue(o)
14472
14560
  );
14473
14561
  el[assignKey](
14474
- el.multiple ? isSetModel ? new Set(selectedVal) : selectedVal : selectedVal[0]
14562
+ el.multiple ? isSet(el._modelValue) ? new Set(selectedVal) : selectedVal : selectedVal[0]
14475
14563
  );
14476
14564
  el._assigning = true;
14477
14565
  nextTick(() => {
@@ -14485,7 +14573,8 @@ const vModelSelect = {
14485
14573
  mounted(el, { value }) {
14486
14574
  setSelected(el, value);
14487
14575
  },
14488
- beforeUpdate(el, _binding, vnode) {
14576
+ beforeUpdate(el, { value }, vnode) {
14577
+ el._modelValue = value;
14489
14578
  el[assignKey] = getModelAssigner(vnode);
14490
14579
  },
14491
14580
  updated(el, { value }) {