@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
  **/
@@ -688,9 +688,6 @@ function isDirty(sub) {
688
688
  return false;
689
689
  }
690
690
  function refreshComputed(computed) {
691
- if (computed.flags & 2) {
692
- return false;
693
- }
694
691
  if (computed.flags & 4 && !(computed.flags & 16)) {
695
692
  return;
696
693
  }
@@ -711,7 +708,7 @@ function refreshComputed(computed) {
711
708
  shouldTrack = true;
712
709
  try {
713
710
  prepareDeps(computed);
714
- const value = computed.fn();
711
+ const value = computed.fn(computed._value);
715
712
  if (dep.version === 0 || hasChanged(value, computed._value)) {
716
713
  computed._value = value;
717
714
  dep.version++;
@@ -820,7 +817,7 @@ class Dep {
820
817
  }
821
818
  }
822
819
  track(debugInfo) {
823
- if (!activeSub || !shouldTrack) {
820
+ if (!activeSub || !shouldTrack || activeSub === this.computed) {
824
821
  return;
825
822
  }
826
823
  let link = this.activeLink;
@@ -1046,7 +1043,7 @@ const arrayInstrumentations = {
1046
1043
  },
1047
1044
  concat(...args) {
1048
1045
  return reactiveReadArray(this).concat(
1049
- ...args.map((x) => reactiveReadArray(x))
1046
+ ...args.map((x) => isArray(x) ? reactiveReadArray(x) : x)
1050
1047
  );
1051
1048
  },
1052
1049
  entries() {
@@ -1843,7 +1840,7 @@ function toValue(source) {
1843
1840
  return isFunction(source) ? source() : unref(source);
1844
1841
  }
1845
1842
  const shallowUnwrapHandlers = {
1846
- get: (target, key, receiver) => unref(Reflect.get(target, key, receiver)),
1843
+ get: (target, key, receiver) => key === "__v_raw" ? target : unref(Reflect.get(target, key, receiver)),
1847
1844
  set: (target, key, value, receiver) => {
1848
1845
  const oldValue = target[key];
1849
1846
  if (isRef(oldValue) && !isRef(value)) {
@@ -1975,8 +1972,8 @@ class ComputedRefImpl {
1975
1972
  * @internal
1976
1973
  */
1977
1974
  notify() {
1975
+ this.flags |= 16;
1978
1976
  if (activeSub !== this) {
1979
- this.flags |= 16;
1980
1977
  this.dep.notify();
1981
1978
  } else if (!!(process.env.NODE_ENV !== "production")) ;
1982
1979
  }
@@ -2550,9 +2547,7 @@ function queueJob(job) {
2550
2547
  } else {
2551
2548
  queue.splice(findInsertionIndex(jobId), 0, job);
2552
2549
  }
2553
- if (!(job.flags & 4)) {
2554
- job.flags |= 1;
2555
- }
2550
+ job.flags |= 1;
2556
2551
  queueFlush();
2557
2552
  }
2558
2553
  }
@@ -2568,9 +2563,7 @@ function queuePostFlushCb(cb) {
2568
2563
  activePostFlushCbs.splice(postFlushIndex + 1, 0, cb);
2569
2564
  } else if (!(cb.flags & 1)) {
2570
2565
  pendingPostFlushCbs.push(cb);
2571
- if (!(cb.flags & 4)) {
2572
- cb.flags |= 1;
2573
- }
2566
+ cb.flags |= 1;
2574
2567
  }
2575
2568
  } else {
2576
2569
  pendingPostFlushCbs.push(...cb);
@@ -2592,6 +2585,9 @@ function flushPreFlushCbs(instance, seen, i = isFlushing ? flushIndex + 1 : 0) {
2592
2585
  }
2593
2586
  queue.splice(i, 1);
2594
2587
  i--;
2588
+ if (cb.flags & 4) {
2589
+ cb.flags &= ~1;
2590
+ }
2595
2591
  cb();
2596
2592
  cb.flags &= ~1;
2597
2593
  }
@@ -2616,6 +2612,9 @@ function flushPostFlushCbs(seen) {
2616
2612
  if (!!(process.env.NODE_ENV !== "production") && checkRecursiveUpdates(seen, cb)) {
2617
2613
  continue;
2618
2614
  }
2615
+ if (cb.flags & 4) {
2616
+ cb.flags &= ~1;
2617
+ }
2619
2618
  if (!(cb.flags & 8)) cb();
2620
2619
  cb.flags &= ~1;
2621
2620
  }
@@ -2638,6 +2637,9 @@ function flushJobs(seen) {
2638
2637
  if (!!(process.env.NODE_ENV !== "production") && check(job)) {
2639
2638
  continue;
2640
2639
  }
2640
+ if (job.flags & 4) {
2641
+ job.flags &= ~1;
2642
+ }
2641
2643
  callWithErrorHandling(
2642
2644
  job,
2643
2645
  job.i,
@@ -2647,6 +2649,12 @@ function flushJobs(seen) {
2647
2649
  }
2648
2650
  }
2649
2651
  } finally {
2652
+ for (; flushIndex < queue.length; flushIndex++) {
2653
+ const job = queue[flushIndex];
2654
+ if (job) {
2655
+ job.flags &= ~1;
2656
+ }
2657
+ }
2650
2658
  flushIndex = 0;
2651
2659
  queue.length = 0;
2652
2660
  flushPostFlushCbs(seen);
@@ -3914,7 +3922,9 @@ const BaseTransitionImpl = {
3914
3922
  // #11061, ensure enterHooks is fresh after clone
3915
3923
  (hooks) => enterHooks = hooks
3916
3924
  );
3917
- setTransitionHooks(innerChild, enterHooks);
3925
+ if (innerChild.type !== Comment) {
3926
+ setTransitionHooks(innerChild, enterHooks);
3927
+ }
3918
3928
  const oldChild = instance.subTree;
3919
3929
  const oldInnerChild = oldChild && getInnerChild$1(oldChild);
3920
3930
  if (oldInnerChild && oldInnerChild.type !== Comment && !isSameVNodeType(innerChild, oldInnerChild) && recursiveGetSubtree(instance).type !== Comment) {
@@ -3932,6 +3942,7 @@ const BaseTransitionImpl = {
3932
3942
  if (!(instance.job.flags & 8)) {
3933
3943
  instance.update();
3934
3944
  }
3945
+ delete leavingHooks.afterLeave;
3935
3946
  };
3936
3947
  return emptyPlaceholder(child);
3937
3948
  } else if (mode === "in-out" && innerChild.type !== Comment) {
@@ -4213,6 +4224,34 @@ function markAsyncBoundary(instance) {
4213
4224
  instance.ids = [instance.ids[0] + instance.ids[2]++ + "-", 0, 0];
4214
4225
  }
4215
4226
 
4227
+ const knownTemplateRefs = /* @__PURE__ */ new WeakSet();
4228
+ function useTemplateRef(key) {
4229
+ const i = getCurrentInstance();
4230
+ const r = shallowRef(null);
4231
+ if (i) {
4232
+ const refs = i.refs === EMPTY_OBJ ? i.refs = {} : i.refs;
4233
+ let desc;
4234
+ if (!!(process.env.NODE_ENV !== "production") && (desc = Object.getOwnPropertyDescriptor(refs, key)) && !desc.configurable) {
4235
+ warn$1(`useTemplateRef('${key}') already exists.`);
4236
+ } else {
4237
+ Object.defineProperty(refs, key, {
4238
+ enumerable: true,
4239
+ get: () => r.value,
4240
+ set: (val) => r.value = val
4241
+ });
4242
+ }
4243
+ } else if (!!(process.env.NODE_ENV !== "production")) {
4244
+ warn$1(
4245
+ `useTemplateRef() is called when there is no active component instance to be associated with.`
4246
+ );
4247
+ }
4248
+ const ret = !!(process.env.NODE_ENV !== "production") ? readonly(r) : r;
4249
+ if (!!(process.env.NODE_ENV !== "production")) {
4250
+ knownTemplateRefs.add(ret);
4251
+ }
4252
+ return ret;
4253
+ }
4254
+
4216
4255
  function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
4217
4256
  if (isArray(rawRef)) {
4218
4257
  rawRef.forEach(
@@ -4241,10 +4280,17 @@ function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
4241
4280
  const oldRef = oldRawRef && oldRawRef.r;
4242
4281
  const refs = owner.refs === EMPTY_OBJ ? owner.refs = {} : owner.refs;
4243
4282
  const setupState = owner.setupState;
4283
+ const rawSetupState = toRaw(setupState);
4284
+ const canSetSetupRef = setupState === EMPTY_OBJ ? () => false : (key) => {
4285
+ if (!!(process.env.NODE_ENV !== "production") && knownTemplateRefs.has(rawSetupState[key])) {
4286
+ return false;
4287
+ }
4288
+ return hasOwn(rawSetupState, key);
4289
+ };
4244
4290
  if (oldRef != null && oldRef !== ref) {
4245
4291
  if (isString(oldRef)) {
4246
4292
  refs[oldRef] = null;
4247
- if (hasOwn(setupState, oldRef)) {
4293
+ if (canSetSetupRef(oldRef)) {
4248
4294
  setupState[oldRef] = null;
4249
4295
  }
4250
4296
  } else if (isRef(oldRef)) {
@@ -4259,14 +4305,14 @@ function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
4259
4305
  if (_isString || _isRef) {
4260
4306
  const doSet = () => {
4261
4307
  if (rawRef.f) {
4262
- const existing = _isString ? hasOwn(setupState, ref) ? setupState[ref] : refs[ref] : ref.value;
4308
+ const existing = _isString ? canSetSetupRef(ref) ? setupState[ref] : refs[ref] : ref.value;
4263
4309
  if (isUnmount) {
4264
4310
  isArray(existing) && remove(existing, refValue);
4265
4311
  } else {
4266
4312
  if (!isArray(existing)) {
4267
4313
  if (_isString) {
4268
4314
  refs[ref] = [refValue];
4269
- if (hasOwn(setupState, ref)) {
4315
+ if (canSetSetupRef(ref)) {
4270
4316
  setupState[ref] = refs[ref];
4271
4317
  }
4272
4318
  } else {
@@ -4279,7 +4325,7 @@ function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
4279
4325
  }
4280
4326
  } else if (_isString) {
4281
4327
  refs[ref] = value;
4282
- if (hasOwn(setupState, ref)) {
4328
+ if (canSetSetupRef(ref)) {
4283
4329
  setupState[ref] = value;
4284
4330
  }
4285
4331
  } else if (_isRef) {
@@ -5308,7 +5354,7 @@ const KeepAliveImpl = {
5308
5354
  return () => {
5309
5355
  pendingCacheKey = null;
5310
5356
  if (!slots.default) {
5311
- return null;
5357
+ return current = null;
5312
5358
  }
5313
5359
  const children = slots.default();
5314
5360
  const rawVNode = children[0];
@@ -5367,10 +5413,11 @@ const KeepAliveImpl = {
5367
5413
  };
5368
5414
  }
5369
5415
  };
5370
- {
5371
- KeepAliveImpl.__isBuildIn = true;
5372
- }
5373
- const KeepAlive = KeepAliveImpl;
5416
+ const decorate$2 = (t) => {
5417
+ t.__isBuiltIn = true;
5418
+ return t;
5419
+ };
5420
+ const KeepAlive = /* @__PURE__ */ decorate$2(KeepAliveImpl) ;
5374
5421
  function matches(pattern, name) {
5375
5422
  if (isArray(pattern)) {
5376
5423
  return pattern.some((p) => matches(p, name));
@@ -7084,7 +7131,7 @@ function createCompatVue$1(createApp, createSingletonApp) {
7084
7131
  return vm;
7085
7132
  }
7086
7133
  }
7087
- Vue.version = `2.6.14-compat:${"3.5.0"}`;
7134
+ Vue.version = `2.6.14-compat:${"3.5.2"}`;
7088
7135
  Vue.config = singletonApp.config;
7089
7136
  Vue.use = (plugin, ...options) => {
7090
7137
  if (plugin && isFunction(plugin.install)) {
@@ -10237,7 +10284,8 @@ function renderComponentRoot(instance) {
10237
10284
  data,
10238
10285
  setupState,
10239
10286
  ctx,
10240
- inheritAttrs
10287
+ inheritAttrs,
10288
+ isMounted
10241
10289
  } = instance;
10242
10290
  const prev = setCurrentRenderingInstance(instance);
10243
10291
  let result;
@@ -10378,7 +10426,7 @@ function renderComponentRoot(instance) {
10378
10426
  `Component inside <Transition> renders non-element root node that cannot be animated.`
10379
10427
  );
10380
10428
  }
10381
- root.transition = vnode.transition;
10429
+ root.transition = isMounted ? vnode.component.subTree.transition : vnode.transition;
10382
10430
  }
10383
10431
  if (!!(process.env.NODE_ENV !== "production") && setRoot) {
10384
10432
  setRoot(root);
@@ -10872,7 +10920,7 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
10872
10920
  };
10873
10921
  }
10874
10922
  if (activeBranch) {
10875
- if (parentNode(activeBranch.el) !== suspense.hiddenContainer) {
10923
+ if (parentNode(activeBranch.el) === container2) {
10876
10924
  anchor = next(activeBranch);
10877
10925
  }
10878
10926
  unmount(activeBranch, parentComponent2, suspense, true);
@@ -12026,29 +12074,6 @@ const computed = (getterOrOptions, debugOptions) => {
12026
12074
  return c;
12027
12075
  };
12028
12076
 
12029
- function useTemplateRef(key) {
12030
- const i = getCurrentInstance();
12031
- const r = shallowRef(null);
12032
- if (i) {
12033
- const refs = i.refs === EMPTY_OBJ ? i.refs = {} : i.refs;
12034
- let desc;
12035
- if (!!(process.env.NODE_ENV !== "production") && (desc = Object.getOwnPropertyDescriptor(refs, key)) && !desc.configurable) {
12036
- warn$1(`useTemplateRef('${key}') already exists.`);
12037
- } else {
12038
- Object.defineProperty(refs, key, {
12039
- enumerable: true,
12040
- get: () => r.value,
12041
- set: (val) => r.value = val
12042
- });
12043
- }
12044
- } else if (!!(process.env.NODE_ENV !== "production")) {
12045
- warn$1(
12046
- `useTemplateRef() is called when there is no active component instance to be associated with.`
12047
- );
12048
- }
12049
- return !!(process.env.NODE_ENV !== "production") ? readonly(r) : r;
12050
- }
12051
-
12052
12077
  function h(type, propsOrChildren, children) {
12053
12078
  const l = arguments.length;
12054
12079
  if (l === 2) {
@@ -12274,7 +12299,7 @@ function isMemoSame(cached, memo) {
12274
12299
  return true;
12275
12300
  }
12276
12301
 
12277
- const version = "3.5.0";
12302
+ const version = "3.5.2";
12278
12303
  const warn = !!(process.env.NODE_ENV !== "production") ? warn$1 : NOOP;
12279
12304
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
12280
12305
  const devtools = !!(process.env.NODE_ENV !== "production") || true ? devtools$1 : void 0;
@@ -12385,11 +12410,6 @@ const nodeOps = {
12385
12410
  const TRANSITION$1 = "transition";
12386
12411
  const ANIMATION = "animation";
12387
12412
  const vtcKey = Symbol("_vtc");
12388
- const Transition = (props, { slots }) => h(BaseTransition, resolveTransitionProps(props), slots);
12389
- Transition.displayName = "Transition";
12390
- {
12391
- Transition.__isBuiltIn = true;
12392
- }
12393
12413
  const DOMTransitionPropsValidators = {
12394
12414
  name: String,
12395
12415
  type: String,
@@ -12408,11 +12428,22 @@ const DOMTransitionPropsValidators = {
12408
12428
  leaveActiveClass: String,
12409
12429
  leaveToClass: String
12410
12430
  };
12411
- const TransitionPropsValidators = Transition.props = /* @__PURE__ */ extend(
12431
+ const TransitionPropsValidators = /* @__PURE__ */ extend(
12412
12432
  {},
12413
12433
  BaseTransitionPropsValidators,
12414
12434
  DOMTransitionPropsValidators
12415
12435
  );
12436
+ const decorate$1 = (t) => {
12437
+ t.displayName = "Transition";
12438
+ t.props = TransitionPropsValidators;
12439
+ {
12440
+ t.__isBuiltIn = true;
12441
+ }
12442
+ return t;
12443
+ };
12444
+ const Transition = /* @__PURE__ */ decorate$1(
12445
+ (props, { slots }) => h(BaseTransition, resolveTransitionProps(props), slots)
12446
+ );
12416
12447
  const callHook = (hook, args = []) => {
12417
12448
  if (isArray(hook)) {
12418
12449
  hook.forEach((h2) => h2(...args));
@@ -13626,7 +13657,14 @@ const positionMap = /* @__PURE__ */ new WeakMap();
13626
13657
  const newPositionMap = /* @__PURE__ */ new WeakMap();
13627
13658
  const moveCbKey = Symbol("_moveCb");
13628
13659
  const enterCbKey = Symbol("_enterCb");
13629
- const TransitionGroupImpl = {
13660
+ const decorate = (t) => {
13661
+ delete t.props.mode;
13662
+ {
13663
+ t.__isBuiltIn = true;
13664
+ }
13665
+ return t;
13666
+ };
13667
+ const TransitionGroupImpl = /* @__PURE__ */ decorate({
13630
13668
  name: "TransitionGroup",
13631
13669
  props: /* @__PURE__ */ extend({}, TransitionPropsValidators, {
13632
13670
  tag: String,
@@ -13718,12 +13756,7 @@ const TransitionGroupImpl = {
13718
13756
  return createVNode(tag, null, children);
13719
13757
  };
13720
13758
  }
13721
- };
13722
- {
13723
- TransitionGroupImpl.__isBuiltIn = true;
13724
- }
13725
- const removeMode = (props) => delete props.mode;
13726
- /* @__PURE__ */ removeMode(TransitionGroupImpl.props);
13759
+ });
13727
13760
  const TransitionGroup = TransitionGroupImpl;
13728
13761
  function callPendingCbs(c) {
13729
13762
  const el = c.el;
@@ -16050,7 +16083,7 @@ const tokenizer = new Tokenizer(stack, {
16050
16083
  rawName: raw,
16051
16084
  exp: void 0,
16052
16085
  arg: void 0,
16053
- modifiers: raw === "." ? ["prop"] : [],
16086
+ modifiers: raw === "." ? [createSimpleExpression("prop")] : [],
16054
16087
  loc: getLoc(start)
16055
16088
  };
16056
16089
  if (name === "pre") {
@@ -16093,7 +16126,8 @@ const tokenizer = new Tokenizer(stack, {
16093
16126
  setLocEnd(arg.loc, end);
16094
16127
  }
16095
16128
  } else {
16096
- currentProp.modifiers.push(mod);
16129
+ const exp = createSimpleExpression(mod, true, getLoc(start, end));
16130
+ currentProp.modifiers.push(exp);
16097
16131
  }
16098
16132
  },
16099
16133
  onattribdata(start, end) {
@@ -16156,7 +16190,9 @@ const tokenizer = new Tokenizer(stack, {
16156
16190
  currentProp.forParseResult = parseForExpression(currentProp.exp);
16157
16191
  }
16158
16192
  let syncIndex = -1;
16159
- if (currentProp.name === "bind" && (syncIndex = currentProp.modifiers.indexOf("sync")) > -1 && checkCompatEnabled(
16193
+ if (currentProp.name === "bind" && (syncIndex = currentProp.modifiers.findIndex(
16194
+ (mod) => mod.content === "sync"
16195
+ )) > -1 && checkCompatEnabled(
16160
16196
  "COMPILER_V_BIND_SYNC",
16161
16197
  currentOptions,
16162
16198
  currentProp.loc,
@@ -17244,7 +17280,7 @@ function createStructuralDirectiveTransform(name, fn) {
17244
17280
  };
17245
17281
  }
17246
17282
 
17247
- const PURE_ANNOTATION = `/*#__PURE__*/`;
17283
+ const PURE_ANNOTATION = `/*@__PURE__*/`;
17248
17284
  const aliasHelper = (s) => `${helperNameMap[s]}: _${helperNameMap[s]}`;
17249
17285
  function createCodegenContext(ast, {
17250
17286
  mode = "function",
@@ -18146,7 +18182,7 @@ const transformBind = (dir, _node, context) => {
18146
18182
  } else if (!arg.isStatic) {
18147
18183
  arg.content = `${arg.content} || ""`;
18148
18184
  }
18149
- if (modifiers.includes("camel")) {
18185
+ if (modifiers.some((mod) => mod.content === "camel")) {
18150
18186
  if (arg.type === 4) {
18151
18187
  if (arg.isStatic) {
18152
18188
  arg.content = camelize(arg.content);
@@ -18159,10 +18195,10 @@ const transformBind = (dir, _node, context) => {
18159
18195
  }
18160
18196
  }
18161
18197
  if (!context.inSSR) {
18162
- if (modifiers.includes("prop")) {
18198
+ if (modifiers.some((mod) => mod.content === "prop")) {
18163
18199
  injectPrefix(arg, ".");
18164
18200
  }
18165
- if (modifiers.includes("attr")) {
18201
+ if (modifiers.some((mod) => mod.content === "attr")) {
18166
18202
  injectPrefix(arg, "^");
18167
18203
  }
18168
18204
  }
@@ -18975,7 +19011,7 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
18975
19011
  }
18976
19012
  continue;
18977
19013
  }
18978
- if (isVBind && modifiers.includes("prop")) {
19014
+ if (isVBind && modifiers.some((mod) => mod.content === "prop")) {
18979
19015
  patchFlag |= 32;
18980
19016
  }
18981
19017
  const directiveTransform = context.directiveTransforms[name];
@@ -19489,7 +19525,7 @@ const transformModel$1 = (dir, node, context) => {
19489
19525
  createObjectProperty(eventName, assignmentExp)
19490
19526
  ];
19491
19527
  if (dir.modifiers.length && node.tagType === 1) {
19492
- const modifiers = dir.modifiers.map((m) => (isSimpleIdentifier(m) ? m : JSON.stringify(m)) + `: true`).join(`, `);
19528
+ const modifiers = dir.modifiers.map((m) => m.content).map((m) => (isSimpleIdentifier(m) ? m : JSON.stringify(m)) + `: true`).join(`, `);
19493
19529
  const modifiersKey = arg ? isStaticExp(arg) ? `${arg.content}Modifiers` : createCompoundExpression([arg, ' + "Modifiers"']) : `modelModifiers`;
19494
19530
  props.push(
19495
19531
  createObjectProperty(
@@ -20038,7 +20074,7 @@ const resolveModifiers = (key, modifiers, context, loc) => {
20038
20074
  const nonKeyModifiers = [];
20039
20075
  const eventOptionModifiers = [];
20040
20076
  for (let i = 0; i < modifiers.length; i++) {
20041
- const modifier = modifiers[i];
20077
+ const modifier = modifiers[i].content;
20042
20078
  if (modifier === "native" && checkCompatEnabled(
20043
20079
  "COMPILER_V_ON_NATIVE",
20044
20080
  context,