@vue/compat 3.5.0 → 3.5.2

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
2
+ * @vue/compat v3.5.2
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -644,9 +644,6 @@ function isDirty(sub) {
644
644
  return false;
645
645
  }
646
646
  function refreshComputed(computed) {
647
- if (computed.flags & 2) {
648
- return false;
649
- }
650
647
  if (computed.flags & 4 && !(computed.flags & 16)) {
651
648
  return;
652
649
  }
@@ -667,7 +664,7 @@ function refreshComputed(computed) {
667
664
  shouldTrack = true;
668
665
  try {
669
666
  prepareDeps(computed);
670
- const value = computed.fn();
667
+ const value = computed.fn(computed._value);
671
668
  if (dep.version === 0 || hasChanged(value, computed._value)) {
672
669
  computed._value = value;
673
670
  dep.version++;
@@ -773,7 +770,7 @@ class Dep {
773
770
  this.subs = void 0;
774
771
  }
775
772
  track(debugInfo) {
776
- if (!activeSub || !shouldTrack) {
773
+ if (!activeSub || !shouldTrack || activeSub === this.computed) {
777
774
  return;
778
775
  }
779
776
  let link = this.activeLink;
@@ -958,7 +955,7 @@ const arrayInstrumentations = {
958
955
  },
959
956
  concat(...args) {
960
957
  return reactiveReadArray(this).concat(
961
- ...args.map((x) => reactiveReadArray(x))
958
+ ...args.map((x) => isArray(x) ? reactiveReadArray(x) : x)
962
959
  );
963
960
  },
964
961
  entries() {
@@ -1694,7 +1691,7 @@ function toValue(source) {
1694
1691
  return isFunction(source) ? source() : unref(source);
1695
1692
  }
1696
1693
  const shallowUnwrapHandlers = {
1697
- get: (target, key, receiver) => unref(Reflect.get(target, key, receiver)),
1694
+ get: (target, key, receiver) => key === "__v_raw" ? target : unref(Reflect.get(target, key, receiver)),
1698
1695
  set: (target, key, value, receiver) => {
1699
1696
  const oldValue = target[key];
1700
1697
  if (isRef(oldValue) && !isRef(value)) {
@@ -1823,8 +1820,8 @@ class ComputedRefImpl {
1823
1820
  * @internal
1824
1821
  */
1825
1822
  notify() {
1823
+ this.flags |= 16;
1826
1824
  if (activeSub !== this) {
1827
- this.flags |= 16;
1828
1825
  this.dep.notify();
1829
1826
  }
1830
1827
  }
@@ -2232,9 +2229,7 @@ function queueJob(job) {
2232
2229
  } else {
2233
2230
  queue.splice(findInsertionIndex(jobId), 0, job);
2234
2231
  }
2235
- if (!(job.flags & 4)) {
2236
- job.flags |= 1;
2237
- }
2232
+ job.flags |= 1;
2238
2233
  queueFlush();
2239
2234
  }
2240
2235
  }
@@ -2250,9 +2245,7 @@ function queuePostFlushCb(cb) {
2250
2245
  activePostFlushCbs.splice(postFlushIndex + 1, 0, cb);
2251
2246
  } else if (!(cb.flags & 1)) {
2252
2247
  pendingPostFlushCbs.push(cb);
2253
- if (!(cb.flags & 4)) {
2254
- cb.flags |= 1;
2255
- }
2248
+ cb.flags |= 1;
2256
2249
  }
2257
2250
  } else {
2258
2251
  pendingPostFlushCbs.push(...cb);
@@ -2268,6 +2261,9 @@ function flushPreFlushCbs(instance, seen, i = isFlushing ? flushIndex + 1 : 0) {
2268
2261
  }
2269
2262
  queue.splice(i, 1);
2270
2263
  i--;
2264
+ if (cb.flags & 4) {
2265
+ cb.flags &= ~1;
2266
+ }
2271
2267
  cb();
2272
2268
  cb.flags &= ~1;
2273
2269
  }
@@ -2286,6 +2282,9 @@ function flushPostFlushCbs(seen) {
2286
2282
  activePostFlushCbs = deduped;
2287
2283
  for (postFlushIndex = 0; postFlushIndex < activePostFlushCbs.length; postFlushIndex++) {
2288
2284
  const cb = activePostFlushCbs[postFlushIndex];
2285
+ if (cb.flags & 4) {
2286
+ cb.flags &= ~1;
2287
+ }
2289
2288
  if (!(cb.flags & 8)) cb();
2290
2289
  cb.flags &= ~1;
2291
2290
  }
@@ -2302,6 +2301,9 @@ function flushJobs(seen) {
2302
2301
  const job = queue[flushIndex];
2303
2302
  if (job && !(job.flags & 8)) {
2304
2303
  if (false) ;
2304
+ if (job.flags & 4) {
2305
+ job.flags &= ~1;
2306
+ }
2305
2307
  callWithErrorHandling(
2306
2308
  job,
2307
2309
  job.i,
@@ -2311,6 +2313,12 @@ function flushJobs(seen) {
2311
2313
  }
2312
2314
  }
2313
2315
  } finally {
2316
+ for (; flushIndex < queue.length; flushIndex++) {
2317
+ const job = queue[flushIndex];
2318
+ if (job) {
2319
+ job.flags &= ~1;
2320
+ }
2321
+ }
2314
2322
  flushIndex = 0;
2315
2323
  queue.length = 0;
2316
2324
  flushPostFlushCbs();
@@ -3034,7 +3042,9 @@ const BaseTransitionImpl = {
3034
3042
  // #11061, ensure enterHooks is fresh after clone
3035
3043
  (hooks) => enterHooks = hooks
3036
3044
  );
3037
- setTransitionHooks(innerChild, enterHooks);
3045
+ if (innerChild.type !== Comment) {
3046
+ setTransitionHooks(innerChild, enterHooks);
3047
+ }
3038
3048
  const oldChild = instance.subTree;
3039
3049
  const oldInnerChild = oldChild && getInnerChild$1(oldChild);
3040
3050
  if (oldInnerChild && oldInnerChild.type !== Comment && !isSameVNodeType(innerChild, oldInnerChild) && recursiveGetSubtree(instance).type !== Comment) {
@@ -3052,6 +3062,7 @@ const BaseTransitionImpl = {
3052
3062
  if (!(instance.job.flags & 8)) {
3053
3063
  instance.update();
3054
3064
  }
3065
+ delete leavingHooks.afterLeave;
3055
3066
  };
3056
3067
  return emptyPlaceholder(child);
3057
3068
  } else if (mode === "in-out" && innerChild.type !== Comment) {
@@ -3318,6 +3329,23 @@ function markAsyncBoundary(instance) {
3318
3329
  instance.ids = [instance.ids[0] + instance.ids[2]++ + "-", 0, 0];
3319
3330
  }
3320
3331
 
3332
+ function useTemplateRef(key) {
3333
+ const i = getCurrentInstance();
3334
+ const r = shallowRef(null);
3335
+ if (i) {
3336
+ const refs = i.refs === EMPTY_OBJ ? i.refs = {} : i.refs;
3337
+ {
3338
+ Object.defineProperty(refs, key, {
3339
+ enumerable: true,
3340
+ get: () => r.value,
3341
+ set: (val) => r.value = val
3342
+ });
3343
+ }
3344
+ }
3345
+ const ret = r;
3346
+ return ret;
3347
+ }
3348
+
3321
3349
  function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
3322
3350
  if (isArray(rawRef)) {
3323
3351
  rawRef.forEach(
@@ -3340,10 +3368,14 @@ function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
3340
3368
  const oldRef = oldRawRef && oldRawRef.r;
3341
3369
  const refs = owner.refs === EMPTY_OBJ ? owner.refs = {} : owner.refs;
3342
3370
  const setupState = owner.setupState;
3371
+ const rawSetupState = toRaw(setupState);
3372
+ const canSetSetupRef = setupState === EMPTY_OBJ ? () => false : (key) => {
3373
+ return hasOwn(rawSetupState, key);
3374
+ };
3343
3375
  if (oldRef != null && oldRef !== ref) {
3344
3376
  if (isString(oldRef)) {
3345
3377
  refs[oldRef] = null;
3346
- if (hasOwn(setupState, oldRef)) {
3378
+ if (canSetSetupRef(oldRef)) {
3347
3379
  setupState[oldRef] = null;
3348
3380
  }
3349
3381
  } else if (isRef(oldRef)) {
@@ -3358,14 +3390,14 @@ function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
3358
3390
  if (_isString || _isRef) {
3359
3391
  const doSet = () => {
3360
3392
  if (rawRef.f) {
3361
- const existing = _isString ? hasOwn(setupState, ref) ? setupState[ref] : refs[ref] : ref.value;
3393
+ const existing = _isString ? canSetSetupRef(ref) ? setupState[ref] : refs[ref] : ref.value;
3362
3394
  if (isUnmount) {
3363
3395
  isArray(existing) && remove(existing, refValue);
3364
3396
  } else {
3365
3397
  if (!isArray(existing)) {
3366
3398
  if (_isString) {
3367
3399
  refs[ref] = [refValue];
3368
- if (hasOwn(setupState, ref)) {
3400
+ if (canSetSetupRef(ref)) {
3369
3401
  setupState[ref] = refs[ref];
3370
3402
  }
3371
3403
  } else {
@@ -3378,7 +3410,7 @@ function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
3378
3410
  }
3379
3411
  } else if (_isString) {
3380
3412
  refs[ref] = value;
3381
- if (hasOwn(setupState, ref)) {
3413
+ if (canSetSetupRef(ref)) {
3382
3414
  setupState[ref] = value;
3383
3415
  }
3384
3416
  } else if (_isRef) {
@@ -4207,7 +4239,7 @@ const KeepAliveImpl = {
4207
4239
  return () => {
4208
4240
  pendingCacheKey = null;
4209
4241
  if (!slots.default) {
4210
- return null;
4242
+ return current = null;
4211
4243
  }
4212
4244
  const children = slots.default();
4213
4245
  const rawVNode = children[0];
@@ -4263,10 +4295,11 @@ const KeepAliveImpl = {
4263
4295
  };
4264
4296
  }
4265
4297
  };
4266
- {
4267
- KeepAliveImpl.__isBuildIn = true;
4268
- }
4269
- const KeepAlive = KeepAliveImpl;
4298
+ const decorate$2 = (t) => {
4299
+ t.__isBuiltIn = true;
4300
+ return t;
4301
+ };
4302
+ const KeepAlive = /* @__PURE__ */ decorate$2(KeepAliveImpl) ;
4270
4303
  function matches(pattern, name) {
4271
4304
  if (isArray(pattern)) {
4272
4305
  return pattern.some((p) => matches(p, name));
@@ -5702,7 +5735,7 @@ function createCompatVue$1(createApp, createSingletonApp) {
5702
5735
  return vm;
5703
5736
  }
5704
5737
  }
5705
- Vue.version = `2.6.14-compat:${"3.5.0"}`;
5738
+ Vue.version = `2.6.14-compat:${"3.5.2"}`;
5706
5739
  Vue.config = singletonApp.config;
5707
5740
  Vue.use = (plugin, ...options) => {
5708
5741
  if (plugin && isFunction(plugin.install)) {
@@ -8294,7 +8327,8 @@ function renderComponentRoot(instance) {
8294
8327
  data,
8295
8328
  setupState,
8296
8329
  ctx,
8297
- inheritAttrs
8330
+ inheritAttrs,
8331
+ isMounted
8298
8332
  } = instance;
8299
8333
  const prev = setCurrentRenderingInstance(instance);
8300
8334
  let result;
@@ -8385,7 +8419,7 @@ function renderComponentRoot(instance) {
8385
8419
  root.dirs = root.dirs ? root.dirs.concat(vnode.dirs) : vnode.dirs;
8386
8420
  }
8387
8421
  if (vnode.transition) {
8388
- root.transition = vnode.transition;
8422
+ root.transition = isMounted ? vnode.component.subTree.transition : vnode.transition;
8389
8423
  }
8390
8424
  {
8391
8425
  result = root;
@@ -8823,7 +8857,7 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
8823
8857
  };
8824
8858
  }
8825
8859
  if (activeBranch) {
8826
- if (parentNode(activeBranch.el) !== suspense.hiddenContainer) {
8860
+ if (parentNode(activeBranch.el) === container2) {
8827
8861
  anchor = next(activeBranch);
8828
8862
  }
8829
8863
  unmount(activeBranch, parentComponent2, suspense, true);
@@ -9769,22 +9803,6 @@ const computed = (getterOrOptions, debugOptions) => {
9769
9803
  return c;
9770
9804
  };
9771
9805
 
9772
- function useTemplateRef(key) {
9773
- const i = getCurrentInstance();
9774
- const r = shallowRef(null);
9775
- if (i) {
9776
- const refs = i.refs === EMPTY_OBJ ? i.refs = {} : i.refs;
9777
- {
9778
- Object.defineProperty(refs, key, {
9779
- enumerable: true,
9780
- get: () => r.value,
9781
- set: (val) => r.value = val
9782
- });
9783
- }
9784
- }
9785
- return r;
9786
- }
9787
-
9788
9806
  function h(type, propsOrChildren, children) {
9789
9807
  const l = arguments.length;
9790
9808
  if (l === 2) {
@@ -9838,7 +9856,7 @@ function isMemoSame(cached, memo) {
9838
9856
  return true;
9839
9857
  }
9840
9858
 
9841
- const version = "3.5.0";
9859
+ const version = "3.5.2";
9842
9860
  const warn$1 = NOOP;
9843
9861
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
9844
9862
  const devtools = void 0;
@@ -9948,11 +9966,6 @@ const nodeOps = {
9948
9966
  const TRANSITION$1 = "transition";
9949
9967
  const ANIMATION = "animation";
9950
9968
  const vtcKey = Symbol("_vtc");
9951
- const Transition = (props, { slots }) => h(BaseTransition, resolveTransitionProps(props), slots);
9952
- Transition.displayName = "Transition";
9953
- {
9954
- Transition.__isBuiltIn = true;
9955
- }
9956
9969
  const DOMTransitionPropsValidators = {
9957
9970
  name: String,
9958
9971
  type: String,
@@ -9971,11 +9984,22 @@ const DOMTransitionPropsValidators = {
9971
9984
  leaveActiveClass: String,
9972
9985
  leaveToClass: String
9973
9986
  };
9974
- const TransitionPropsValidators = Transition.props = /* @__PURE__ */ extend$1(
9987
+ const TransitionPropsValidators = /* @__PURE__ */ extend$1(
9975
9988
  {},
9976
9989
  BaseTransitionPropsValidators,
9977
9990
  DOMTransitionPropsValidators
9978
9991
  );
9992
+ const decorate$1 = (t) => {
9993
+ t.displayName = "Transition";
9994
+ t.props = TransitionPropsValidators;
9995
+ {
9996
+ t.__isBuiltIn = true;
9997
+ }
9998
+ return t;
9999
+ };
10000
+ const Transition = /* @__PURE__ */ decorate$1(
10001
+ (props, { slots }) => h(BaseTransition, resolveTransitionProps(props), slots)
10002
+ );
9979
10003
  const callHook = (hook, args = []) => {
9980
10004
  if (isArray(hook)) {
9981
10005
  hook.forEach((h2) => h2(...args));
@@ -11026,7 +11050,14 @@ const positionMap = /* @__PURE__ */ new WeakMap();
11026
11050
  const newPositionMap = /* @__PURE__ */ new WeakMap();
11027
11051
  const moveCbKey = Symbol("_moveCb");
11028
11052
  const enterCbKey = Symbol("_enterCb");
11029
- const TransitionGroupImpl = {
11053
+ const decorate = (t) => {
11054
+ delete t.props.mode;
11055
+ {
11056
+ t.__isBuiltIn = true;
11057
+ }
11058
+ return t;
11059
+ };
11060
+ const TransitionGroupImpl = /* @__PURE__ */ decorate({
11030
11061
  name: "TransitionGroup",
11031
11062
  props: /* @__PURE__ */ extend$1({}, TransitionPropsValidators, {
11032
11063
  tag: String,
@@ -11116,12 +11147,7 @@ const TransitionGroupImpl = {
11116
11147
  return createVNode(tag, null, children);
11117
11148
  };
11118
11149
  }
11119
- };
11120
- {
11121
- TransitionGroupImpl.__isBuiltIn = true;
11122
- }
11123
- const removeMode = (props) => delete props.mode;
11124
- /* @__PURE__ */ removeMode(TransitionGroupImpl.props);
11150
+ });
11125
11151
  const TransitionGroup = TransitionGroupImpl;
11126
11152
  function callPendingCbs(c) {
11127
11153
  const el = c.el;
@@ -13754,7 +13780,7 @@ const tokenizer = new Tokenizer(stack, {
13754
13780
  rawName: raw,
13755
13781
  exp: void 0,
13756
13782
  arg: void 0,
13757
- modifiers: raw === "." ? ["prop"] : [],
13783
+ modifiers: raw === "." ? [createSimpleExpression("prop")] : [],
13758
13784
  loc: getLoc(start)
13759
13785
  };
13760
13786
  if (name === "pre") {
@@ -13797,7 +13823,8 @@ const tokenizer = new Tokenizer(stack, {
13797
13823
  setLocEnd(arg.loc, end);
13798
13824
  }
13799
13825
  } else {
13800
- currentProp.modifiers.push(mod);
13826
+ const exp = createSimpleExpression(mod, true, getLoc(start, end));
13827
+ currentProp.modifiers.push(exp);
13801
13828
  }
13802
13829
  },
13803
13830
  onattribdata(start, end) {
@@ -13863,7 +13890,9 @@ const tokenizer = new Tokenizer(stack, {
13863
13890
  currentProp.forParseResult = parseForExpression(currentProp.exp);
13864
13891
  }
13865
13892
  let syncIndex = -1;
13866
- if (currentProp.name === "bind" && (syncIndex = currentProp.modifiers.indexOf("sync")) > -1 && checkCompatEnabled(
13893
+ if (currentProp.name === "bind" && (syncIndex = currentProp.modifiers.findIndex(
13894
+ (mod) => mod.content === "sync"
13895
+ )) > -1 && checkCompatEnabled(
13867
13896
  "COMPILER_V_BIND_SYNC",
13868
13897
  currentOptions,
13869
13898
  currentProp.loc,
@@ -14938,7 +14967,7 @@ function createStructuralDirectiveTransform(name, fn) {
14938
14967
  };
14939
14968
  }
14940
14969
 
14941
- const PURE_ANNOTATION = `/*#__PURE__*/`;
14970
+ const PURE_ANNOTATION = `/*@__PURE__*/`;
14942
14971
  const aliasHelper = (s) => `${helperNameMap[s]}: _${helperNameMap[s]}`;
14943
14972
  function createCodegenContext(ast, {
14944
14973
  mode = "function",
@@ -16170,7 +16199,7 @@ const transformBind = (dir, _node, context) => {
16170
16199
  } else if (!arg.isStatic) {
16171
16200
  arg.content = `${arg.content} || ""`;
16172
16201
  }
16173
- if (modifiers.includes("camel")) {
16202
+ if (modifiers.some((mod) => mod.content === "camel")) {
16174
16203
  if (arg.type === 4) {
16175
16204
  if (arg.isStatic) {
16176
16205
  arg.content = camelize(arg.content);
@@ -16183,10 +16212,10 @@ const transformBind = (dir, _node, context) => {
16183
16212
  }
16184
16213
  }
16185
16214
  if (!context.inSSR) {
16186
- if (modifiers.includes("prop")) {
16215
+ if (modifiers.some((mod) => mod.content === "prop")) {
16187
16216
  injectPrefix(arg, ".");
16188
16217
  }
16189
- if (modifiers.includes("attr")) {
16218
+ if (modifiers.some((mod) => mod.content === "attr")) {
16190
16219
  injectPrefix(arg, "^");
16191
16220
  }
16192
16221
  }
@@ -17097,7 +17126,7 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
17097
17126
  }
17098
17127
  continue;
17099
17128
  }
17100
- if (isVBind && modifiers.includes("prop")) {
17129
+ if (isVBind && modifiers.some((mod) => mod.content === "prop")) {
17101
17130
  patchFlag |= 32;
17102
17131
  }
17103
17132
  const directiveTransform = context.directiveTransforms[name];
@@ -17660,7 +17689,7 @@ const transformModel$1 = (dir, node, context) => {
17660
17689
  props[1].value = context.cache(props[1].value);
17661
17690
  }
17662
17691
  if (dir.modifiers.length && node.tagType === 1) {
17663
- const modifiers = dir.modifiers.map((m) => (isSimpleIdentifier(m) ? m : JSON.stringify(m)) + `: true`).join(`, `);
17692
+ const modifiers = dir.modifiers.map((m) => m.content).map((m) => (isSimpleIdentifier(m) ? m : JSON.stringify(m)) + `: true`).join(`, `);
17664
17693
  const modifiersKey = arg ? isStaticExp(arg) ? `${arg.content}Modifiers` : createCompoundExpression([arg, ' + "Modifiers"']) : `modelModifiers`;
17665
17694
  props.push(
17666
17695
  createObjectProperty(
@@ -18175,7 +18204,7 @@ const resolveModifiers = (key, modifiers, context, loc) => {
18175
18204
  const nonKeyModifiers = [];
18176
18205
  const eventOptionModifiers = [];
18177
18206
  for (let i = 0; i < modifiers.length; i++) {
18178
- const modifier = modifiers[i];
18207
+ const modifier = modifiers[i].content;
18179
18208
  if (modifier === "native" && checkCompatEnabled(
18180
18209
  "COMPILER_V_ON_NATIVE",
18181
18210
  context)) {