@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
  **/
@@ -214,6 +214,14 @@ function isRenderableAttrValue(value) {
214
214
  return type === "string" || type === "number" || type === "boolean";
215
215
  }
216
216
 
217
+ const cssVarNameEscapeSymbolsRE = /[ !"#$%&'()*+,./:;<=>?@[\\\]^`{|}~]/g;
218
+ function getEscapedCssVarName(key, doubleEscape) {
219
+ return key.replace(
220
+ cssVarNameEscapeSymbolsRE,
221
+ (s) => `\\${s}`
222
+ );
223
+ }
224
+
217
225
  function looseCompareArrays(a, b) {
218
226
  if (a.length !== b.length) return false;
219
227
  let equal = true;
@@ -337,12 +345,13 @@ class EffectScope {
337
345
  pause() {
338
346
  if (this._active) {
339
347
  this._isPaused = true;
348
+ let i, l;
340
349
  if (this.scopes) {
341
- for (let i = 0, l = this.scopes.length; i < l; i++) {
350
+ for (i = 0, l = this.scopes.length; i < l; i++) {
342
351
  this.scopes[i].pause();
343
352
  }
344
353
  }
345
- for (let i = 0, l = this.effects.length; i < l; i++) {
354
+ for (i = 0, l = this.effects.length; i < l; i++) {
346
355
  this.effects[i].pause();
347
356
  }
348
357
  }
@@ -354,12 +363,13 @@ class EffectScope {
354
363
  if (this._active) {
355
364
  if (this._isPaused) {
356
365
  this._isPaused = false;
366
+ let i, l;
357
367
  if (this.scopes) {
358
- for (let i = 0, l = this.scopes.length; i < l; i++) {
368
+ for (i = 0, l = this.scopes.length; i < l; i++) {
359
369
  this.scopes[i].resume();
360
370
  }
361
371
  }
362
- for (let i = 0, l = this.effects.length; i < l; i++) {
372
+ for (i = 0, l = this.effects.length; i < l; i++) {
363
373
  this.effects[i].resume();
364
374
  }
365
375
  }
@@ -552,11 +562,9 @@ function startBatch() {
552
562
  batchDepth++;
553
563
  }
554
564
  function endBatch() {
555
- if (batchDepth > 1) {
556
- batchDepth--;
565
+ if (--batchDepth > 0) {
557
566
  return;
558
567
  }
559
- batchDepth--;
560
568
  let error;
561
569
  while (batchedEffect) {
562
570
  let e = batchedEffect;
@@ -1073,7 +1081,7 @@ function apply(self, method, fn, thisArg, wrappedRetFn, args) {
1073
1081
  const needsWrap = arr !== self && !isShallow(self);
1074
1082
  const methodFn = arr[method];
1075
1083
  if (methodFn !== arrayProto[method]) {
1076
- const result2 = methodFn.apply(arr, args);
1084
+ const result2 = methodFn.apply(self, args);
1077
1085
  return needsWrap ? toReactive(result2) : result2;
1078
1086
  }
1079
1087
  let wrappedFn = fn;
@@ -1215,7 +1223,12 @@ class MutableReactiveHandler extends BaseReactiveHandler {
1215
1223
  }
1216
1224
  }
1217
1225
  const hadKey = isArray(target) && isIntegerKey(key) ? Number(key) < target.length : hasOwn(target, key);
1218
- const result = Reflect.set(target, key, value, receiver);
1226
+ const result = Reflect.set(
1227
+ target,
1228
+ key,
1229
+ value,
1230
+ isRef(target) ? target : receiver
1231
+ );
1219
1232
  if (target === toRaw(receiver)) {
1220
1233
  if (!hadKey) {
1221
1234
  trigger(target, "add", key, value);
@@ -2028,18 +2041,25 @@ function watch$1(source, cb, options = EMPTY_OBJ) {
2028
2041
  const depth = deep === true ? Infinity : deep;
2029
2042
  getter = () => traverse(baseGetter(), depth);
2030
2043
  }
2044
+ const scope = getCurrentScope();
2045
+ const watchHandle = () => {
2046
+ effect.stop();
2047
+ if (scope) {
2048
+ remove(scope.effects, effect);
2049
+ }
2050
+ };
2031
2051
  if (once) {
2032
2052
  if (cb) {
2033
2053
  const _cb = cb;
2034
2054
  cb = (...args) => {
2035
2055
  _cb(...args);
2036
- effect.stop();
2056
+ watchHandle();
2037
2057
  };
2038
2058
  } else {
2039
2059
  const _getter = getter;
2040
2060
  getter = () => {
2041
2061
  _getter();
2042
- effect.stop();
2062
+ watchHandle();
2043
2063
  };
2044
2064
  }
2045
2065
  }
@@ -2108,13 +2128,6 @@ function watch$1(source, cb, options = EMPTY_OBJ) {
2108
2128
  } else {
2109
2129
  effect.run();
2110
2130
  }
2111
- const scope = getCurrentScope();
2112
- const watchHandle = () => {
2113
- effect.stop();
2114
- if (scope) {
2115
- remove(scope.effects, effect);
2116
- }
2117
- };
2118
2131
  watchHandle.pause = effect.pause.bind(effect);
2119
2132
  watchHandle.resume = effect.resume.bind(effect);
2120
2133
  watchHandle.stop = watchHandle;
@@ -4094,7 +4107,7 @@ function getTransitionRawChildren(children, keepComment = false, parentKey) {
4094
4107
  // @__NO_SIDE_EFFECTS__
4095
4108
  function defineComponent(options, extraOptions) {
4096
4109
  return isFunction(options) ? (
4097
- // #8326: extend call and options.name access are considered side-effects
4110
+ // #8236: extend call and options.name access are considered side-effects
4098
4111
  // by Rollup, so we have to wrap it in a pure-annotated IIFE.
4099
4112
  /* @__PURE__ */ (() => extend({ name: options.name }, extraOptions, { setup: options }))()
4100
4113
  ) : options;
@@ -4530,8 +4543,7 @@ Server rendered element contains more child nodes than client vdom.`
4530
4543
  const isText = vnode.type === Text;
4531
4544
  if (node) {
4532
4545
  if (isText && !optimized) {
4533
- let next = children[i + 1];
4534
- if (next && (next = normalizeVNode(next)).type === Text) {
4546
+ if (i + 1 < l && normalizeVNode(children[i + 1]).type === Text) {
4535
4547
  insert(
4536
4548
  createText(
4537
4549
  node.data.slice(vnode.children.length)
@@ -4787,7 +4799,10 @@ function resolveCssVars(instance, vnode, expectedMap) {
4787
4799
  if (instance.getCssVars && (vnode === root || root && root.type === Fragment && root.children.includes(vnode))) {
4788
4800
  const cssVars = instance.getCssVars();
4789
4801
  for (const key in cssVars) {
4790
- expectedMap.set(`--${key}`, String(cssVars[key]));
4802
+ expectedMap.set(
4803
+ `--${getEscapedCssVarName(key)}`,
4804
+ String(cssVars[key])
4805
+ );
4791
4806
  }
4792
4807
  }
4793
4808
  if (vnode === root && instance.parent) {
@@ -5221,6 +5236,7 @@ const KeepAliveImpl = {
5221
5236
  );
5222
5237
  const { include, exclude, max } = props;
5223
5238
  if (include && (!name || !matches(include, name)) || exclude && name && matches(exclude, name)) {
5239
+ vnode.shapeFlag &= ~256;
5224
5240
  current = vnode;
5225
5241
  return rawVNode;
5226
5242
  }
@@ -6969,7 +6985,7 @@ function createCompatVue$1(createApp, createSingletonApp) {
6969
6985
  return vm;
6970
6986
  }
6971
6987
  }
6972
- Vue.version = `2.6.14-compat:${"3.5.0-beta.3"}`;
6988
+ Vue.version = `2.6.14-compat:${"3.5.0"}`;
6973
6989
  Vue.config = singletonApp.config;
6974
6990
  Vue.use = (plugin, ...options) => {
6975
6991
  if (plugin && isFunction(plugin.install)) {
@@ -12105,7 +12121,7 @@ function isMemoSame(cached, memo) {
12105
12121
  return true;
12106
12122
  }
12107
12123
 
12108
- const version = "3.5.0-beta.3";
12124
+ const version = "3.5.0";
12109
12125
  const warn = warn$1 ;
12110
12126
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
12111
12127
  const devtools = devtools$1 ;
@@ -12804,15 +12820,20 @@ function compatCoerceAttr(el, key, value, instance = null) {
12804
12820
 
12805
12821
  function patchDOMProp(el, key, value, parentComponent) {
12806
12822
  if (key === "innerHTML" || key === "textContent") {
12807
- if (value == null) return;
12808
- el[key] = value;
12823
+ if (value != null) {
12824
+ el[key] = key === "innerHTML" ? unsafeToTrustedHTML(value) : value;
12825
+ }
12809
12826
  return;
12810
12827
  }
12811
12828
  const tag = el.tagName;
12812
12829
  if (key === "value" && tag !== "PROGRESS" && // custom elements may use _value internally
12813
12830
  !tag.includes("-")) {
12814
12831
  const oldValue = tag === "OPTION" ? el.getAttribute("value") || "" : el.value;
12815
- const newValue = value == null ? "" : String(value);
12832
+ const newValue = value == null ? (
12833
+ // #11647: value should be set as empty string for null and undefined,
12834
+ // but <input type="checkbox"> should be set as 'on'.
12835
+ el.type === "checkbox" ? "on" : ""
12836
+ ) : String(value);
12816
12837
  if (oldValue !== newValue || !("_value" in el)) {
12817
12838
  el.value = newValue;
12818
12839
  }
@@ -13248,6 +13269,9 @@ class VueElement extends BaseClass {
13248
13269
  delete this._props[key];
13249
13270
  } else {
13250
13271
  this._props[key] = val;
13272
+ if (key === "key" && this._app) {
13273
+ this._app._ceVNode.key = val;
13274
+ }
13251
13275
  }
13252
13276
  if (shouldUpdate && this._instance) {
13253
13277
  this._update();
@@ -13695,12 +13719,16 @@ const vModelCheckbox = {
13695
13719
  };
13696
13720
  function setChecked(el, { value, oldValue }, vnode) {
13697
13721
  el._modelValue = value;
13722
+ let checked;
13698
13723
  if (isArray(value)) {
13699
- el.checked = looseIndexOf(value, vnode.props.value) > -1;
13724
+ checked = looseIndexOf(value, vnode.props.value) > -1;
13700
13725
  } else if (isSet(value)) {
13701
- el.checked = value.has(vnode.props.value);
13702
- } else if (value !== oldValue) {
13703
- el.checked = looseEqual(value, getCheckboxValue(el, true));
13726
+ checked = value.has(vnode.props.value);
13727
+ } else {
13728
+ checked = looseEqual(value, getCheckboxValue(el, true));
13729
+ }
13730
+ if (el.checked !== checked) {
13731
+ el.checked = checked;
13704
13732
  }
13705
13733
  }
13706
13734
  const vModelRadio = {