@vue/compat 3.5.0-beta.3 → 3.5.0

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.0-beta.3
2
+ * @vue/compat v3.5.0
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -281,6 +281,14 @@ function isRenderableAttrValue(value) {
281
281
  return type === "string" || type === "number" || type === "boolean";
282
282
  }
283
283
 
284
+ const cssVarNameEscapeSymbolsRE = /[ !"#$%&'()*+,./:;<=>?@[\\\]^`{|}~]/g;
285
+ function getEscapedCssVarName(key, doubleEscape) {
286
+ return key.replace(
287
+ cssVarNameEscapeSymbolsRE,
288
+ (s) => `\\${s}`
289
+ );
290
+ }
291
+
284
292
  function looseCompareArrays(a, b) {
285
293
  if (a.length !== b.length) return false;
286
294
  let equal = true;
@@ -404,12 +412,13 @@ class EffectScope {
404
412
  pause() {
405
413
  if (this._active) {
406
414
  this._isPaused = true;
415
+ let i, l;
407
416
  if (this.scopes) {
408
- for (let i = 0, l = this.scopes.length; i < l; i++) {
417
+ for (i = 0, l = this.scopes.length; i < l; i++) {
409
418
  this.scopes[i].pause();
410
419
  }
411
420
  }
412
- for (let i = 0, l = this.effects.length; i < l; i++) {
421
+ for (i = 0, l = this.effects.length; i < l; i++) {
413
422
  this.effects[i].pause();
414
423
  }
415
424
  }
@@ -421,12 +430,13 @@ class EffectScope {
421
430
  if (this._active) {
422
431
  if (this._isPaused) {
423
432
  this._isPaused = false;
433
+ let i, l;
424
434
  if (this.scopes) {
425
- for (let i = 0, l = this.scopes.length; i < l; i++) {
435
+ for (i = 0, l = this.scopes.length; i < l; i++) {
426
436
  this.scopes[i].resume();
427
437
  }
428
438
  }
429
- for (let i = 0, l = this.effects.length; i < l; i++) {
439
+ for (i = 0, l = this.effects.length; i < l; i++) {
430
440
  this.effects[i].resume();
431
441
  }
432
442
  }
@@ -619,11 +629,9 @@ function startBatch() {
619
629
  batchDepth++;
620
630
  }
621
631
  function endBatch() {
622
- if (batchDepth > 1) {
623
- batchDepth--;
632
+ if (--batchDepth > 0) {
624
633
  return;
625
634
  }
626
- batchDepth--;
627
635
  let error;
628
636
  while (batchedEffect) {
629
637
  let e = batchedEffect;
@@ -1144,7 +1152,7 @@ function apply(self, method, fn, thisArg, wrappedRetFn, args) {
1144
1152
  const needsWrap = arr !== self && !isShallow(self);
1145
1153
  const methodFn = arr[method];
1146
1154
  if (methodFn !== arrayProto[method]) {
1147
- const result2 = methodFn.apply(arr, args);
1155
+ const result2 = methodFn.apply(self, args);
1148
1156
  return needsWrap ? toReactive(result2) : result2;
1149
1157
  }
1150
1158
  let wrappedFn = fn;
@@ -1286,7 +1294,12 @@ class MutableReactiveHandler extends BaseReactiveHandler {
1286
1294
  }
1287
1295
  }
1288
1296
  const hadKey = isArray(target) && isIntegerKey(key) ? Number(key) < target.length : hasOwn(target, key);
1289
- const result = Reflect.set(target, key, value, receiver);
1297
+ const result = Reflect.set(
1298
+ target,
1299
+ key,
1300
+ value,
1301
+ isRef(target) ? target : receiver
1302
+ );
1290
1303
  if (target === toRaw(receiver)) {
1291
1304
  if (!hadKey) {
1292
1305
  trigger(target, "add", key, value);
@@ -2105,18 +2118,25 @@ function watch$1(source, cb, options = EMPTY_OBJ) {
2105
2118
  const depth = deep === true ? Infinity : deep;
2106
2119
  getter = () => traverse(baseGetter(), depth);
2107
2120
  }
2121
+ const scope = getCurrentScope();
2122
+ const watchHandle = () => {
2123
+ effect.stop();
2124
+ if (scope) {
2125
+ remove(scope.effects, effect);
2126
+ }
2127
+ };
2108
2128
  if (once) {
2109
2129
  if (cb) {
2110
2130
  const _cb = cb;
2111
2131
  cb = (...args) => {
2112
2132
  _cb(...args);
2113
- effect.stop();
2133
+ watchHandle();
2114
2134
  };
2115
2135
  } else {
2116
2136
  const _getter = getter;
2117
2137
  getter = () => {
2118
2138
  _getter();
2119
- effect.stop();
2139
+ watchHandle();
2120
2140
  };
2121
2141
  }
2122
2142
  }
@@ -2185,13 +2205,6 @@ function watch$1(source, cb, options = EMPTY_OBJ) {
2185
2205
  } else {
2186
2206
  effect.run();
2187
2207
  }
2188
- const scope = getCurrentScope();
2189
- const watchHandle = () => {
2190
- effect.stop();
2191
- if (scope) {
2192
- remove(scope.effects, effect);
2193
- }
2194
- };
2195
2208
  watchHandle.pause = effect.pause.bind(effect);
2196
2209
  watchHandle.resume = effect.resume.bind(effect);
2197
2210
  watchHandle.stop = watchHandle;
@@ -4180,7 +4193,7 @@ function getTransitionRawChildren(children, keepComment = false, parentKey) {
4180
4193
  // @__NO_SIDE_EFFECTS__
4181
4194
  function defineComponent(options, extraOptions) {
4182
4195
  return isFunction(options) ? (
4183
- // #8326: extend call and options.name access are considered side-effects
4196
+ // #8236: extend call and options.name access are considered side-effects
4184
4197
  // by Rollup, so we have to wrap it in a pure-annotated IIFE.
4185
4198
  /* @__PURE__ */ (() => extend({ name: options.name }, extraOptions, { setup: options }))()
4186
4199
  ) : options;
@@ -4627,8 +4640,7 @@ Server rendered element contains more child nodes than client vdom.`
4627
4640
  const isText = vnode.type === Text;
4628
4641
  if (node) {
4629
4642
  if (isText && !optimized) {
4630
- let next = children[i + 1];
4631
- if (next && (next = normalizeVNode(next)).type === Text) {
4643
+ if (i + 1 < l && normalizeVNode(children[i + 1]).type === Text) {
4632
4644
  insert(
4633
4645
  createText(
4634
4646
  node.data.slice(vnode.children.length)
@@ -4884,7 +4896,10 @@ function resolveCssVars(instance, vnode, expectedMap) {
4884
4896
  if (instance.getCssVars && (vnode === root || root && root.type === Fragment && root.children.includes(vnode))) {
4885
4897
  const cssVars = instance.getCssVars();
4886
4898
  for (const key in cssVars) {
4887
- expectedMap.set(`--${key}`, String(cssVars[key]));
4899
+ expectedMap.set(
4900
+ `--${getEscapedCssVarName(key)}`,
4901
+ String(cssVars[key])
4902
+ );
4888
4903
  }
4889
4904
  }
4890
4905
  if (vnode === root && instance.parent) {
@@ -5318,6 +5333,7 @@ const KeepAliveImpl = {
5318
5333
  );
5319
5334
  const { include, exclude, max } = props;
5320
5335
  if (include && (!name || !matches(include, name)) || exclude && name && matches(exclude, name)) {
5336
+ vnode.shapeFlag &= ~256;
5321
5337
  current = vnode;
5322
5338
  return rawVNode;
5323
5339
  }
@@ -7068,7 +7084,7 @@ function createCompatVue$1(createApp, createSingletonApp) {
7068
7084
  return vm;
7069
7085
  }
7070
7086
  }
7071
- Vue.version = `2.6.14-compat:${"3.5.0-beta.3"}`;
7087
+ Vue.version = `2.6.14-compat:${"3.5.0"}`;
7072
7088
  Vue.config = singletonApp.config;
7073
7089
  Vue.use = (plugin, ...options) => {
7074
7090
  if (plugin && isFunction(plugin.install)) {
@@ -12258,7 +12274,7 @@ function isMemoSame(cached, memo) {
12258
12274
  return true;
12259
12275
  }
12260
12276
 
12261
- const version = "3.5.0-beta.3";
12277
+ const version = "3.5.0";
12262
12278
  const warn = !!(process.env.NODE_ENV !== "production") ? warn$1 : NOOP;
12263
12279
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
12264
12280
  const devtools = !!(process.env.NODE_ENV !== "production") || true ? devtools$1 : void 0;
@@ -12957,15 +12973,20 @@ function compatCoerceAttr(el, key, value, instance = null) {
12957
12973
 
12958
12974
  function patchDOMProp(el, key, value, parentComponent) {
12959
12975
  if (key === "innerHTML" || key === "textContent") {
12960
- if (value == null) return;
12961
- el[key] = value;
12976
+ if (value != null) {
12977
+ el[key] = key === "innerHTML" ? unsafeToTrustedHTML(value) : value;
12978
+ }
12962
12979
  return;
12963
12980
  }
12964
12981
  const tag = el.tagName;
12965
12982
  if (key === "value" && tag !== "PROGRESS" && // custom elements may use _value internally
12966
12983
  !tag.includes("-")) {
12967
12984
  const oldValue = tag === "OPTION" ? el.getAttribute("value") || "" : el.value;
12968
- const newValue = value == null ? "" : String(value);
12985
+ const newValue = value == null ? (
12986
+ // #11647: value should be set as empty string for null and undefined,
12987
+ // but <input type="checkbox"> should be set as 'on'.
12988
+ el.type === "checkbox" ? "on" : ""
12989
+ ) : String(value);
12969
12990
  if (oldValue !== newValue || !("_value" in el)) {
12970
12991
  el.value = newValue;
12971
12992
  }
@@ -13401,6 +13422,9 @@ class VueElement extends BaseClass {
13401
13422
  delete this._props[key];
13402
13423
  } else {
13403
13424
  this._props[key] = val;
13425
+ if (key === "key" && this._app) {
13426
+ this._app._ceVNode.key = val;
13427
+ }
13404
13428
  }
13405
13429
  if (shouldUpdate && this._instance) {
13406
13430
  this._update();
@@ -13848,12 +13872,16 @@ const vModelCheckbox = {
13848
13872
  };
13849
13873
  function setChecked(el, { value, oldValue }, vnode) {
13850
13874
  el._modelValue = value;
13875
+ let checked;
13851
13876
  if (isArray(value)) {
13852
- el.checked = looseIndexOf(value, vnode.props.value) > -1;
13877
+ checked = looseIndexOf(value, vnode.props.value) > -1;
13853
13878
  } else if (isSet(value)) {
13854
- el.checked = value.has(vnode.props.value);
13855
- } else if (value !== oldValue) {
13856
- el.checked = looseEqual(value, getCheckboxValue(el, true));
13879
+ checked = value.has(vnode.props.value);
13880
+ } else {
13881
+ checked = looseEqual(value, getCheckboxValue(el, true));
13882
+ }
13883
+ if (el.checked !== checked) {
13884
+ el.checked = checked;
13857
13885
  }
13858
13886
  }
13859
13887
  const vModelRadio = {
@@ -17538,7 +17566,7 @@ function genNode(node, context) {
17538
17566
  break;
17539
17567
  case 26:
17540
17568
  break;
17541
- /* istanbul ignore next */
17569
+ /* v8 ignore start */
17542
17570
  case 10:
17543
17571
  break;
17544
17572
  default:
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @vue/compat v3.5.0-beta.3
2
+ * @vue/compat v3.5.0
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -284,6 +284,14 @@ var Vue = (function () {
284
284
  return type === "string" || type === "number" || type === "boolean";
285
285
  }
286
286
 
287
+ const cssVarNameEscapeSymbolsRE = /[ !"#$%&'()*+,./:;<=>?@[\\\]^`{|}~]/g;
288
+ function getEscapedCssVarName(key, doubleEscape) {
289
+ return key.replace(
290
+ cssVarNameEscapeSymbolsRE,
291
+ (s) => `\\${s}`
292
+ );
293
+ }
294
+
287
295
  function looseCompareArrays(a, b) {
288
296
  if (a.length !== b.length) return false;
289
297
  let equal = true;
@@ -407,12 +415,13 @@ var Vue = (function () {
407
415
  pause() {
408
416
  if (this._active) {
409
417
  this._isPaused = true;
418
+ let i, l;
410
419
  if (this.scopes) {
411
- for (let i = 0, l = this.scopes.length; i < l; i++) {
420
+ for (i = 0, l = this.scopes.length; i < l; i++) {
412
421
  this.scopes[i].pause();
413
422
  }
414
423
  }
415
- for (let i = 0, l = this.effects.length; i < l; i++) {
424
+ for (i = 0, l = this.effects.length; i < l; i++) {
416
425
  this.effects[i].pause();
417
426
  }
418
427
  }
@@ -424,12 +433,13 @@ var Vue = (function () {
424
433
  if (this._active) {
425
434
  if (this._isPaused) {
426
435
  this._isPaused = false;
436
+ let i, l;
427
437
  if (this.scopes) {
428
- for (let i = 0, l = this.scopes.length; i < l; i++) {
438
+ for (i = 0, l = this.scopes.length; i < l; i++) {
429
439
  this.scopes[i].resume();
430
440
  }
431
441
  }
432
- for (let i = 0, l = this.effects.length; i < l; i++) {
442
+ for (i = 0, l = this.effects.length; i < l; i++) {
433
443
  this.effects[i].resume();
434
444
  }
435
445
  }
@@ -622,11 +632,9 @@ var Vue = (function () {
622
632
  batchDepth++;
623
633
  }
624
634
  function endBatch() {
625
- if (batchDepth > 1) {
626
- batchDepth--;
635
+ if (--batchDepth > 0) {
627
636
  return;
628
637
  }
629
- batchDepth--;
630
638
  let error;
631
639
  while (batchedEffect) {
632
640
  let e = batchedEffect;
@@ -1143,7 +1151,7 @@ var Vue = (function () {
1143
1151
  const needsWrap = arr !== self && !isShallow(self);
1144
1152
  const methodFn = arr[method];
1145
1153
  if (methodFn !== arrayProto[method]) {
1146
- const result2 = methodFn.apply(arr, args);
1154
+ const result2 = methodFn.apply(self, args);
1147
1155
  return needsWrap ? toReactive(result2) : result2;
1148
1156
  }
1149
1157
  let wrappedFn = fn;
@@ -1285,7 +1293,12 @@ var Vue = (function () {
1285
1293
  }
1286
1294
  }
1287
1295
  const hadKey = isArray(target) && isIntegerKey(key) ? Number(key) < target.length : hasOwn(target, key);
1288
- const result = Reflect.set(target, key, value, receiver);
1296
+ const result = Reflect.set(
1297
+ target,
1298
+ key,
1299
+ value,
1300
+ isRef(target) ? target : receiver
1301
+ );
1289
1302
  if (target === toRaw(receiver)) {
1290
1303
  if (!hadKey) {
1291
1304
  trigger(target, "add", key, value);
@@ -2098,18 +2111,25 @@ var Vue = (function () {
2098
2111
  const depth = deep === true ? Infinity : deep;
2099
2112
  getter = () => traverse(baseGetter(), depth);
2100
2113
  }
2114
+ const scope = getCurrentScope();
2115
+ const watchHandle = () => {
2116
+ effect.stop();
2117
+ if (scope) {
2118
+ remove(scope.effects, effect);
2119
+ }
2120
+ };
2101
2121
  if (once) {
2102
2122
  if (cb) {
2103
2123
  const _cb = cb;
2104
2124
  cb = (...args) => {
2105
2125
  _cb(...args);
2106
- effect.stop();
2126
+ watchHandle();
2107
2127
  };
2108
2128
  } else {
2109
2129
  const _getter = getter;
2110
2130
  getter = () => {
2111
2131
  _getter();
2112
- effect.stop();
2132
+ watchHandle();
2113
2133
  };
2114
2134
  }
2115
2135
  }
@@ -2178,13 +2198,6 @@ var Vue = (function () {
2178
2198
  } else {
2179
2199
  effect.run();
2180
2200
  }
2181
- const scope = getCurrentScope();
2182
- const watchHandle = () => {
2183
- effect.stop();
2184
- if (scope) {
2185
- remove(scope.effects, effect);
2186
- }
2187
- };
2188
2201
  watchHandle.pause = effect.pause.bind(effect);
2189
2202
  watchHandle.resume = effect.resume.bind(effect);
2190
2203
  watchHandle.stop = watchHandle;
@@ -4164,7 +4177,7 @@ Details: https://v3-migration.vuejs.org/breaking-changes/migration-build.html`
4164
4177
  // @__NO_SIDE_EFFECTS__
4165
4178
  function defineComponent(options, extraOptions) {
4166
4179
  return isFunction(options) ? (
4167
- // #8326: extend call and options.name access are considered side-effects
4180
+ // #8236: extend call and options.name access are considered side-effects
4168
4181
  // by Rollup, so we have to wrap it in a pure-annotated IIFE.
4169
4182
  /* @__PURE__ */ (() => extend({ name: options.name }, extraOptions, { setup: options }))()
4170
4183
  ) : options;
@@ -4600,8 +4613,7 @@ Server rendered element contains more child nodes than client vdom.`
4600
4613
  const isText = vnode.type === Text;
4601
4614
  if (node) {
4602
4615
  if (isText && !optimized) {
4603
- let next = children[i + 1];
4604
- if (next && (next = normalizeVNode(next)).type === Text) {
4616
+ if (i + 1 < l && normalizeVNode(children[i + 1]).type === Text) {
4605
4617
  insert(
4606
4618
  createText(
4607
4619
  node.data.slice(vnode.children.length)
@@ -4857,7 +4869,10 @@ Server rendered element contains fewer child nodes than client vdom.`
4857
4869
  if (instance.getCssVars && (vnode === root || root && root.type === Fragment && root.children.includes(vnode))) {
4858
4870
  const cssVars = instance.getCssVars();
4859
4871
  for (const key in cssVars) {
4860
- expectedMap.set(`--${key}`, String(cssVars[key]));
4872
+ expectedMap.set(
4873
+ `--${getEscapedCssVarName(key)}`,
4874
+ String(cssVars[key])
4875
+ );
4861
4876
  }
4862
4877
  }
4863
4878
  if (vnode === root && instance.parent) {
@@ -5285,6 +5300,7 @@ Server rendered element contains fewer child nodes than client vdom.`
5285
5300
  );
5286
5301
  const { include, exclude, max } = props;
5287
5302
  if (include && (!name || !matches(include, name)) || exclude && name && matches(exclude, name)) {
5303
+ vnode.shapeFlag &= ~256;
5288
5304
  current = vnode;
5289
5305
  return rawVNode;
5290
5306
  }
@@ -7030,7 +7046,7 @@ If this is a native custom element, make sure to exclude it from component resol
7030
7046
  return vm;
7031
7047
  }
7032
7048
  }
7033
- Vue.version = `2.6.14-compat:${"3.5.0-beta.3"}`;
7049
+ Vue.version = `2.6.14-compat:${"3.5.0"}`;
7034
7050
  Vue.config = singletonApp.config;
7035
7051
  Vue.use = (plugin, ...options) => {
7036
7052
  if (plugin && isFunction(plugin.install)) {
@@ -12130,7 +12146,7 @@ Component that was made reactive: `,
12130
12146
  return true;
12131
12147
  }
12132
12148
 
12133
- const version = "3.5.0-beta.3";
12149
+ const version = "3.5.0";
12134
12150
  const warn = warn$1 ;
12135
12151
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
12136
12152
  const devtools = devtools$1 ;
@@ -12812,15 +12828,20 @@ Component that was made reactive: `,
12812
12828
 
12813
12829
  function patchDOMProp(el, key, value, parentComponent) {
12814
12830
  if (key === "innerHTML" || key === "textContent") {
12815
- if (value == null) return;
12816
- el[key] = value;
12831
+ if (value != null) {
12832
+ el[key] = key === "innerHTML" ? unsafeToTrustedHTML(value) : value;
12833
+ }
12817
12834
  return;
12818
12835
  }
12819
12836
  const tag = el.tagName;
12820
12837
  if (key === "value" && tag !== "PROGRESS" && // custom elements may use _value internally
12821
12838
  !tag.includes("-")) {
12822
12839
  const oldValue = tag === "OPTION" ? el.getAttribute("value") || "" : el.value;
12823
- const newValue = value == null ? "" : String(value);
12840
+ const newValue = value == null ? (
12841
+ // #11647: value should be set as empty string for null and undefined,
12842
+ // but <input type="checkbox"> should be set as 'on'.
12843
+ el.type === "checkbox" ? "on" : ""
12844
+ ) : String(value);
12824
12845
  if (oldValue !== newValue || !("_value" in el)) {
12825
12846
  el.value = newValue;
12826
12847
  }
@@ -13256,6 +13277,9 @@ Expected function or array of functions, received type ${typeof value}.`
13256
13277
  delete this._props[key];
13257
13278
  } else {
13258
13279
  this._props[key] = val;
13280
+ if (key === "key" && this._app) {
13281
+ this._app._ceVNode.key = val;
13282
+ }
13259
13283
  }
13260
13284
  if (shouldUpdate && this._instance) {
13261
13285
  this._update();
@@ -13691,12 +13715,16 @@ Expected function or array of functions, received type ${typeof value}.`
13691
13715
  };
13692
13716
  function setChecked(el, { value, oldValue }, vnode) {
13693
13717
  el._modelValue = value;
13718
+ let checked;
13694
13719
  if (isArray(value)) {
13695
- el.checked = looseIndexOf(value, vnode.props.value) > -1;
13720
+ checked = looseIndexOf(value, vnode.props.value) > -1;
13696
13721
  } else if (isSet(value)) {
13697
- el.checked = value.has(vnode.props.value);
13698
- } else if (value !== oldValue) {
13699
- el.checked = looseEqual(value, getCheckboxValue(el, true));
13722
+ checked = value.has(vnode.props.value);
13723
+ } else {
13724
+ checked = looseEqual(value, getCheckboxValue(el, true));
13725
+ }
13726
+ if (el.checked !== checked) {
13727
+ el.checked = checked;
13700
13728
  }
13701
13729
  }
13702
13730
  const vModelRadio = {
@@ -17345,7 +17373,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
17345
17373
  break;
17346
17374
  case 26:
17347
17375
  break;
17348
- /* istanbul ignore next */
17376
+ /* v8 ignore start */
17349
17377
  case 10:
17350
17378
  break;
17351
17379
  default: