@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;
@@ -1140,7 +1148,7 @@ function apply(self, method, fn, thisArg, wrappedRetFn, args) {
1140
1148
  const needsWrap = arr !== self && !isShallow(self);
1141
1149
  const methodFn = arr[method];
1142
1150
  if (methodFn !== arrayProto[method]) {
1143
- const result2 = methodFn.apply(arr, args);
1151
+ const result2 = methodFn.apply(self, args);
1144
1152
  return needsWrap ? toReactive(result2) : result2;
1145
1153
  }
1146
1154
  let wrappedFn = fn;
@@ -1282,7 +1290,12 @@ class MutableReactiveHandler extends BaseReactiveHandler {
1282
1290
  }
1283
1291
  }
1284
1292
  const hadKey = isArray(target) && isIntegerKey(key) ? Number(key) < target.length : hasOwn(target, key);
1285
- const result = Reflect.set(target, key, value, receiver);
1293
+ const result = Reflect.set(
1294
+ target,
1295
+ key,
1296
+ value,
1297
+ isRef(target) ? target : receiver
1298
+ );
1286
1299
  if (target === toRaw(receiver)) {
1287
1300
  if (!hadKey) {
1288
1301
  trigger(target, "add", key, value);
@@ -2095,18 +2108,25 @@ function watch$1(source, cb, options = EMPTY_OBJ) {
2095
2108
  const depth = deep === true ? Infinity : deep;
2096
2109
  getter = () => traverse(baseGetter(), depth);
2097
2110
  }
2111
+ const scope = getCurrentScope();
2112
+ const watchHandle = () => {
2113
+ effect.stop();
2114
+ if (scope) {
2115
+ remove(scope.effects, effect);
2116
+ }
2117
+ };
2098
2118
  if (once) {
2099
2119
  if (cb) {
2100
2120
  const _cb = cb;
2101
2121
  cb = (...args) => {
2102
2122
  _cb(...args);
2103
- effect.stop();
2123
+ watchHandle();
2104
2124
  };
2105
2125
  } else {
2106
2126
  const _getter = getter;
2107
2127
  getter = () => {
2108
2128
  _getter();
2109
- effect.stop();
2129
+ watchHandle();
2110
2130
  };
2111
2131
  }
2112
2132
  }
@@ -2175,13 +2195,6 @@ function watch$1(source, cb, options = EMPTY_OBJ) {
2175
2195
  } else {
2176
2196
  effect.run();
2177
2197
  }
2178
- const scope = getCurrentScope();
2179
- const watchHandle = () => {
2180
- effect.stop();
2181
- if (scope) {
2182
- remove(scope.effects, effect);
2183
- }
2184
- };
2185
2198
  watchHandle.pause = effect.pause.bind(effect);
2186
2199
  watchHandle.resume = effect.resume.bind(effect);
2187
2200
  watchHandle.stop = watchHandle;
@@ -4161,7 +4174,7 @@ function getTransitionRawChildren(children, keepComment = false, parentKey) {
4161
4174
  // @__NO_SIDE_EFFECTS__
4162
4175
  function defineComponent(options, extraOptions) {
4163
4176
  return isFunction(options) ? (
4164
- // #8326: extend call and options.name access are considered side-effects
4177
+ // #8236: extend call and options.name access are considered side-effects
4165
4178
  // by Rollup, so we have to wrap it in a pure-annotated IIFE.
4166
4179
  /* @__PURE__ */ (() => extend({ name: options.name }, extraOptions, { setup: options }))()
4167
4180
  ) : options;
@@ -4597,8 +4610,7 @@ Server rendered element contains more child nodes than client vdom.`
4597
4610
  const isText = vnode.type === Text;
4598
4611
  if (node) {
4599
4612
  if (isText && !optimized) {
4600
- let next = children[i + 1];
4601
- if (next && (next = normalizeVNode(next)).type === Text) {
4613
+ if (i + 1 < l && normalizeVNode(children[i + 1]).type === Text) {
4602
4614
  insert(
4603
4615
  createText(
4604
4616
  node.data.slice(vnode.children.length)
@@ -4854,7 +4866,10 @@ function resolveCssVars(instance, vnode, expectedMap) {
4854
4866
  if (instance.getCssVars && (vnode === root || root && root.type === Fragment && root.children.includes(vnode))) {
4855
4867
  const cssVars = instance.getCssVars();
4856
4868
  for (const key in cssVars) {
4857
- expectedMap.set(`--${key}`, String(cssVars[key]));
4869
+ expectedMap.set(
4870
+ `--${getEscapedCssVarName(key)}`,
4871
+ String(cssVars[key])
4872
+ );
4858
4873
  }
4859
4874
  }
4860
4875
  if (vnode === root && instance.parent) {
@@ -5288,6 +5303,7 @@ const KeepAliveImpl = {
5288
5303
  );
5289
5304
  const { include, exclude, max } = props;
5290
5305
  if (include && (!name || !matches(include, name)) || exclude && name && matches(exclude, name)) {
5306
+ vnode.shapeFlag &= ~256;
5291
5307
  current = vnode;
5292
5308
  return rawVNode;
5293
5309
  }
@@ -7036,7 +7052,7 @@ function createCompatVue$1(createApp, createSingletonApp) {
7036
7052
  return vm;
7037
7053
  }
7038
7054
  }
7039
- Vue.version = `2.6.14-compat:${"3.5.0-beta.3"}`;
7055
+ Vue.version = `2.6.14-compat:${"3.5.0"}`;
7040
7056
  Vue.config = singletonApp.config;
7041
7057
  Vue.use = (plugin, ...options) => {
7042
7058
  if (plugin && isFunction(plugin.install)) {
@@ -12172,7 +12188,7 @@ function isMemoSame(cached, memo) {
12172
12188
  return true;
12173
12189
  }
12174
12190
 
12175
- const version = "3.5.0-beta.3";
12191
+ const version = "3.5.0";
12176
12192
  const warn = warn$1 ;
12177
12193
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
12178
12194
  const devtools = devtools$1 ;
@@ -12871,15 +12887,20 @@ function compatCoerceAttr(el, key, value, instance = null) {
12871
12887
 
12872
12888
  function patchDOMProp(el, key, value, parentComponent) {
12873
12889
  if (key === "innerHTML" || key === "textContent") {
12874
- if (value == null) return;
12875
- el[key] = value;
12890
+ if (value != null) {
12891
+ el[key] = key === "innerHTML" ? unsafeToTrustedHTML(value) : value;
12892
+ }
12876
12893
  return;
12877
12894
  }
12878
12895
  const tag = el.tagName;
12879
12896
  if (key === "value" && tag !== "PROGRESS" && // custom elements may use _value internally
12880
12897
  !tag.includes("-")) {
12881
12898
  const oldValue = tag === "OPTION" ? el.getAttribute("value") || "" : el.value;
12882
- const newValue = value == null ? "" : String(value);
12899
+ const newValue = value == null ? (
12900
+ // #11647: value should be set as empty string for null and undefined,
12901
+ // but <input type="checkbox"> should be set as 'on'.
12902
+ el.type === "checkbox" ? "on" : ""
12903
+ ) : String(value);
12883
12904
  if (oldValue !== newValue || !("_value" in el)) {
12884
12905
  el.value = newValue;
12885
12906
  }
@@ -13315,6 +13336,9 @@ class VueElement extends BaseClass {
13315
13336
  delete this._props[key];
13316
13337
  } else {
13317
13338
  this._props[key] = val;
13339
+ if (key === "key" && this._app) {
13340
+ this._app._ceVNode.key = val;
13341
+ }
13318
13342
  }
13319
13343
  if (shouldUpdate && this._instance) {
13320
13344
  this._update();
@@ -13762,12 +13786,16 @@ const vModelCheckbox = {
13762
13786
  };
13763
13787
  function setChecked(el, { value, oldValue }, vnode) {
13764
13788
  el._modelValue = value;
13789
+ let checked;
13765
13790
  if (isArray(value)) {
13766
- el.checked = looseIndexOf(value, vnode.props.value) > -1;
13791
+ checked = looseIndexOf(value, vnode.props.value) > -1;
13767
13792
  } else if (isSet(value)) {
13768
- el.checked = value.has(vnode.props.value);
13769
- } else if (value !== oldValue) {
13770
- el.checked = looseEqual(value, getCheckboxValue(el, true));
13793
+ checked = value.has(vnode.props.value);
13794
+ } else {
13795
+ checked = looseEqual(value, getCheckboxValue(el, true));
13796
+ }
13797
+ if (el.checked !== checked) {
13798
+ el.checked = checked;
13771
13799
  }
13772
13800
  }
13773
13801
  const vModelRadio = {
@@ -17457,7 +17485,7 @@ function genNode(node, context) {
17457
17485
  break;
17458
17486
  case 26:
17459
17487
  break;
17460
- /* istanbul ignore next */
17488
+ /* v8 ignore start */
17461
17489
  case 10:
17462
17490
  break;
17463
17491
  default: