@vue/compat 3.5.0-rc.1 → 3.5.1

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-rc.1
2
+ * @vue/compat v3.5.1
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;
@@ -1034,7 +1042,7 @@ const arrayInstrumentations = {
1034
1042
  },
1035
1043
  concat(...args) {
1036
1044
  return reactiveReadArray(this).concat(
1037
- ...args.map((x) => reactiveReadArray(x))
1045
+ ...args.map((x) => isArray(x) ? reactiveReadArray(x) : x)
1038
1046
  );
1039
1047
  },
1040
1048
  entries() {
@@ -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;
@@ -3888,7 +3896,9 @@ const BaseTransitionImpl = {
3888
3896
  // #11061, ensure enterHooks is fresh after clone
3889
3897
  (hooks) => enterHooks = hooks
3890
3898
  );
3891
- setTransitionHooks(innerChild, enterHooks);
3899
+ if (innerChild.type !== Comment) {
3900
+ setTransitionHooks(innerChild, enterHooks);
3901
+ }
3892
3902
  const oldChild = instance.subTree;
3893
3903
  const oldInnerChild = oldChild && getInnerChild$1(oldChild);
3894
3904
  if (oldInnerChild && oldInnerChild.type !== Comment && !isSameVNodeType(innerChild, oldInnerChild) && recursiveGetSubtree(instance).type !== Comment) {
@@ -4214,10 +4224,11 @@ function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
4214
4224
  const oldRef = oldRawRef && oldRawRef.r;
4215
4225
  const refs = owner.refs === EMPTY_OBJ ? owner.refs = {} : owner.refs;
4216
4226
  const setupState = owner.setupState;
4227
+ const canSetSetupRef = setupState === EMPTY_OBJ ? () => false : (key) => hasOwn(setupState, key) && !(Object.getOwnPropertyDescriptor(refs, key) || EMPTY_OBJ).get;
4217
4228
  if (oldRef != null && oldRef !== ref) {
4218
4229
  if (isString(oldRef)) {
4219
4230
  refs[oldRef] = null;
4220
- if (hasOwn(setupState, oldRef)) {
4231
+ if (canSetSetupRef(oldRef)) {
4221
4232
  setupState[oldRef] = null;
4222
4233
  }
4223
4234
  } else if (isRef(oldRef)) {
@@ -4232,14 +4243,14 @@ function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
4232
4243
  if (_isString || _isRef) {
4233
4244
  const doSet = () => {
4234
4245
  if (rawRef.f) {
4235
- const existing = _isString ? hasOwn(setupState, ref) ? setupState[ref] : refs[ref] : ref.value;
4246
+ const existing = _isString ? canSetSetupRef(ref) ? setupState[ref] : refs[ref] : ref.value;
4236
4247
  if (isUnmount) {
4237
4248
  isArray(existing) && remove(existing, refValue);
4238
4249
  } else {
4239
4250
  if (!isArray(existing)) {
4240
4251
  if (_isString) {
4241
4252
  refs[ref] = [refValue];
4242
- if (hasOwn(setupState, ref)) {
4253
+ if (canSetSetupRef(ref)) {
4243
4254
  setupState[ref] = refs[ref];
4244
4255
  }
4245
4256
  } else {
@@ -4252,7 +4263,7 @@ function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
4252
4263
  }
4253
4264
  } else if (_isString) {
4254
4265
  refs[ref] = value;
4255
- if (hasOwn(setupState, ref)) {
4266
+ if (canSetSetupRef(ref)) {
4256
4267
  setupState[ref] = value;
4257
4268
  }
4258
4269
  } else if (_isRef) {
@@ -4602,8 +4613,7 @@ Server rendered element contains more child nodes than client vdom.`
4602
4613
  const isText = vnode.type === Text;
4603
4614
  if (node) {
4604
4615
  if (isText && !optimized) {
4605
- let next = children[i + 1];
4606
- if (next && (next = normalizeVNode(next)).type === Text) {
4616
+ if (i + 1 < l && normalizeVNode(children[i + 1]).type === Text) {
4607
4617
  insert(
4608
4618
  createText(
4609
4619
  node.data.slice(vnode.children.length)
@@ -4859,7 +4869,10 @@ function resolveCssVars(instance, vnode, expectedMap) {
4859
4869
  if (instance.getCssVars && (vnode === root || root && root.type === Fragment && root.children.includes(vnode))) {
4860
4870
  const cssVars = instance.getCssVars();
4861
4871
  for (const key in cssVars) {
4862
- expectedMap.set(`--${key}`, String(cssVars[key]));
4872
+ expectedMap.set(
4873
+ `--${getEscapedCssVarName(key)}`,
4874
+ String(cssVars[key])
4875
+ );
4863
4876
  }
4864
4877
  }
4865
4878
  if (vnode === root && instance.parent) {
@@ -5327,10 +5340,11 @@ const KeepAliveImpl = {
5327
5340
  };
5328
5341
  }
5329
5342
  };
5330
- {
5331
- KeepAliveImpl.__isBuildIn = true;
5332
- }
5333
- const KeepAlive = KeepAliveImpl;
5343
+ const decorate$2 = (t) => {
5344
+ t.__isBuiltIn = true;
5345
+ return t;
5346
+ };
5347
+ const KeepAlive = /* @__PURE__ */ decorate$2(KeepAliveImpl) ;
5334
5348
  function matches(pattern, name) {
5335
5349
  if (isArray(pattern)) {
5336
5350
  return pattern.some((p) => matches(p, name));
@@ -7042,7 +7056,7 @@ function createCompatVue$1(createApp, createSingletonApp) {
7042
7056
  return vm;
7043
7057
  }
7044
7058
  }
7045
- Vue.version = `2.6.14-compat:${"3.5.0-rc.1"}`;
7059
+ Vue.version = `2.6.14-compat:${"3.5.1"}`;
7046
7060
  Vue.config = singletonApp.config;
7047
7061
  Vue.use = (plugin, ...options) => {
7048
7062
  if (plugin && isFunction(plugin.install)) {
@@ -12178,7 +12192,7 @@ function isMemoSame(cached, memo) {
12178
12192
  return true;
12179
12193
  }
12180
12194
 
12181
- const version = "3.5.0-rc.1";
12195
+ const version = "3.5.1";
12182
12196
  const warn = warn$1 ;
12183
12197
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
12184
12198
  const devtools = devtools$1 ;
@@ -12289,11 +12303,6 @@ const nodeOps = {
12289
12303
  const TRANSITION$1 = "transition";
12290
12304
  const ANIMATION = "animation";
12291
12305
  const vtcKey = Symbol("_vtc");
12292
- const Transition = (props, { slots }) => h(BaseTransition, resolveTransitionProps(props), slots);
12293
- Transition.displayName = "Transition";
12294
- {
12295
- Transition.__isBuiltIn = true;
12296
- }
12297
12306
  const DOMTransitionPropsValidators = {
12298
12307
  name: String,
12299
12308
  type: String,
@@ -12312,11 +12321,22 @@ const DOMTransitionPropsValidators = {
12312
12321
  leaveActiveClass: String,
12313
12322
  leaveToClass: String
12314
12323
  };
12315
- const TransitionPropsValidators = Transition.props = /* @__PURE__ */ extend(
12324
+ const TransitionPropsValidators = /* @__PURE__ */ extend(
12316
12325
  {},
12317
12326
  BaseTransitionPropsValidators,
12318
12327
  DOMTransitionPropsValidators
12319
12328
  );
12329
+ const decorate$1 = (t) => {
12330
+ t.displayName = "Transition";
12331
+ t.props = TransitionPropsValidators;
12332
+ {
12333
+ t.__isBuiltIn = true;
12334
+ }
12335
+ return t;
12336
+ };
12337
+ const Transition = /* @__PURE__ */ decorate$1(
12338
+ (props, { slots }) => h(BaseTransition, resolveTransitionProps(props), slots)
12339
+ );
12320
12340
  const callHook = (hook, args = []) => {
12321
12341
  if (isArray(hook)) {
12322
12342
  hook.forEach((h2) => h2(...args));
@@ -12886,7 +12906,11 @@ function patchDOMProp(el, key, value, parentComponent) {
12886
12906
  if (key === "value" && tag !== "PROGRESS" && // custom elements may use _value internally
12887
12907
  !tag.includes("-")) {
12888
12908
  const oldValue = tag === "OPTION" ? el.getAttribute("value") || "" : el.value;
12889
- const newValue = value == null ? "" : String(value);
12909
+ const newValue = value == null ? (
12910
+ // #11647: value should be set as empty string for null and undefined,
12911
+ // but <input type="checkbox"> should be set as 'on'.
12912
+ el.type === "checkbox" ? "on" : ""
12913
+ ) : String(value);
12890
12914
  if (oldValue !== newValue || !("_value" in el)) {
12891
12915
  el.value = newValue;
12892
12916
  }
@@ -13526,7 +13550,14 @@ const positionMap = /* @__PURE__ */ new WeakMap();
13526
13550
  const newPositionMap = /* @__PURE__ */ new WeakMap();
13527
13551
  const moveCbKey = Symbol("_moveCb");
13528
13552
  const enterCbKey = Symbol("_enterCb");
13529
- const TransitionGroupImpl = {
13553
+ const decorate = (t) => {
13554
+ delete t.props.mode;
13555
+ {
13556
+ t.__isBuiltIn = true;
13557
+ }
13558
+ return t;
13559
+ };
13560
+ const TransitionGroupImpl = /* @__PURE__ */ decorate({
13530
13561
  name: "TransitionGroup",
13531
13562
  props: /* @__PURE__ */ extend({}, TransitionPropsValidators, {
13532
13563
  tag: String,
@@ -13618,12 +13649,7 @@ const TransitionGroupImpl = {
13618
13649
  return createVNode(tag, null, children);
13619
13650
  };
13620
13651
  }
13621
- };
13622
- {
13623
- TransitionGroupImpl.__isBuiltIn = true;
13624
- }
13625
- const removeMode = (props) => delete props.mode;
13626
- /* @__PURE__ */ removeMode(TransitionGroupImpl.props);
13652
+ });
13627
13653
  const TransitionGroup = TransitionGroupImpl;
13628
13654
  function callPendingCbs(c) {
13629
13655
  const el = c.el;
@@ -13772,12 +13798,16 @@ const vModelCheckbox = {
13772
13798
  };
13773
13799
  function setChecked(el, { value, oldValue }, vnode) {
13774
13800
  el._modelValue = value;
13801
+ let checked;
13775
13802
  if (isArray(value)) {
13776
- el.checked = looseIndexOf(value, vnode.props.value) > -1;
13803
+ checked = looseIndexOf(value, vnode.props.value) > -1;
13777
13804
  } else if (isSet(value)) {
13778
- el.checked = value.has(vnode.props.value);
13779
- } else if (value !== oldValue) {
13780
- el.checked = looseEqual(value, getCheckboxValue(el, true));
13805
+ checked = value.has(vnode.props.value);
13806
+ } else {
13807
+ checked = looseEqual(value, getCheckboxValue(el, true));
13808
+ }
13809
+ if (el.checked !== checked) {
13810
+ el.checked = checked;
13781
13811
  }
13782
13812
  }
13783
13813
  const vModelRadio = {
@@ -17145,7 +17175,7 @@ function createStructuralDirectiveTransform(name, fn) {
17145
17175
  };
17146
17176
  }
17147
17177
 
17148
- const PURE_ANNOTATION = `/*#__PURE__*/`;
17178
+ const PURE_ANNOTATION = `/*@__PURE__*/`;
17149
17179
  const aliasHelper = (s) => `${helperNameMap[s]}: _${helperNameMap[s]}`;
17150
17180
  function createCodegenContext(ast, {
17151
17181
  mode = "function",