@vue/compat 3.6.0-beta.14 → 3.6.0-beta.15

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.6.0-beta.14
2
+ * @vue/compat v3.6.0-beta.15
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -2251,8 +2251,9 @@ var WatcherEffect = class extends ReactiveEffect {
2251
2251
  if (once && cb) {
2252
2252
  const _cb = cb;
2253
2253
  cb = (...args) => {
2254
- _cb(...args);
2254
+ const res = _cb(...args);
2255
2255
  this.stop();
2256
+ return res;
2256
2257
  };
2257
2258
  }
2258
2259
  this.cb = cb;
@@ -2268,7 +2269,7 @@ var WatcherEffect = class extends ReactiveEffect {
2268
2269
  if (!this.cb) return;
2269
2270
  const { immediate, deep, call } = this.options;
2270
2271
  if (initialRun && !immediate) return;
2271
- if (deep || this.forceTrigger || (this.isMultiSource ? newValue.some((v, i) => hasChanged(v, oldValue[i])) : hasChanged(newValue, oldValue))) {
2272
+ if (initialRun || deep || this.forceTrigger || (this.isMultiSource ? newValue.some((v, i) => hasChanged(v, oldValue[i])) : hasChanged(newValue, oldValue))) {
2272
2273
  cleanup(this);
2273
2274
  const currentWatcher = activeWatcher;
2274
2275
  activeWatcher = this;
@@ -4736,11 +4737,16 @@ function defineAsyncComponent(source) {
4736
4737
  onError(err);
4737
4738
  return () => errorComponent ? createVNode(errorComponent, { error: err }) : null;
4738
4739
  });
4739
- const { loaded, error, delayed } = useAsyncComponentState(delay, timeout, onError);
4740
+ const { loaded, error, delayed } = useAsyncComponentState(delay, timeout, onError, instance);
4740
4741
  load().then(() => {
4742
+ if (instance.isUnmounted) return;
4741
4743
  loaded.value = true;
4742
4744
  if (instance.parent && instance.parent.vnode && isKeepAlive(instance.parent.vnode)) instance.parent.update();
4743
4745
  }).catch((err) => {
4746
+ if (instance.isUnmounted) {
4747
+ setPendingRequest(null);
4748
+ return;
4749
+ }
4744
4750
  onError(err);
4745
4751
  error.value = err;
4746
4752
  });
@@ -4798,14 +4804,22 @@ function createAsyncComponentContext(source) {
4798
4804
  setPendingRequest: (request) => pendingRequest = request
4799
4805
  };
4800
4806
  }
4801
- const useAsyncComponentState = (delay, timeout, onError) => {
4807
+ const useAsyncComponentState = (delay, timeout, onError, instance = currentInstance) => {
4802
4808
  const loaded = /* @__PURE__ */ ref(false);
4803
4809
  const error = /* @__PURE__ */ ref();
4804
4810
  const delayed = /* @__PURE__ */ ref(!!delay);
4805
- if (delay) setTimeout(() => {
4811
+ let timeoutTimer;
4812
+ let delayTimer;
4813
+ if (instance) onUnmounted(() => {
4814
+ if (timeoutTimer != null) clearTimeout(timeoutTimer);
4815
+ if (delayTimer != null) clearTimeout(delayTimer);
4816
+ }, instance);
4817
+ if (delay) delayTimer = setTimeout(() => {
4818
+ if (instance && instance.isUnmounted) return;
4806
4819
  delayed.value = false;
4807
4820
  }, delay);
4808
- if (timeout != null) setTimeout(() => {
4821
+ if (timeout != null) timeoutTimer = setTimeout(() => {
4822
+ if (instance && instance.isUnmounted) return;
4809
4823
  if (!loaded.value && !error.value) {
4810
4824
  const err = /* @__PURE__ */ new Error(`Async component timed out after ${timeout}ms.`);
4811
4825
  onError(err);
@@ -6366,7 +6380,7 @@ function createCompatVue$1(createApp, createSingletonApp) {
6366
6380
  if (options.el) return vm.$mount(options.el);
6367
6381
  else return vm;
6368
6382
  }
6369
- Vue.version = `2.6.14-compat:3.6.0-beta.14`;
6383
+ Vue.version = `2.6.14-compat:3.6.0-beta.15`;
6370
6384
  Vue.config = singletonApp.config;
6371
6385
  Vue.use = (plugin, ...options) => {
6372
6386
  if (plugin && isFunction(plugin.install)) plugin.install(Vue, ...options);
@@ -6621,7 +6635,9 @@ function defineReactive(obj, key, val) {
6621
6635
  else Object.keys(val).forEach((key) => {
6622
6636
  try {
6623
6637
  defineReactiveSimple(val, key, val[key]);
6624
- } catch (e) {}
6638
+ } catch (e) {
6639
+ if (!!(process.env.NODE_ENV !== "production")) warn$1(`Failed making property "${key}" reactive:`, e);
6640
+ }
6625
6641
  });
6626
6642
  }
6627
6643
  const i = obj.$;
@@ -6872,12 +6888,13 @@ function useModel(props, name, options = EMPTY_OBJ) {
6872
6888
  for (const key of rawPropKeys) if (key === name || key === camelizedName || key === hyphenatedName) parentPassedModelValue = true;
6873
6889
  else if (key === `onUpdate:${name}` || key === `onUpdate:${camelizedName}` || key === `onUpdate:${hyphenatedName}`) parentPassedModelUpdater = true;
6874
6890
  }
6875
- if (!parentPassedModelValue || !parentPassedModelUpdater) {
6891
+ const hasVModel = parentPassedModelValue && parentPassedModelUpdater;
6892
+ if (!hasVModel) {
6876
6893
  localValue = value;
6877
6894
  trigger();
6878
6895
  }
6879
6896
  i.emit(`update:${name}`, emittedValue);
6880
- if (hasChanged(value, emittedValue) && hasChanged(value, prevSetValue) && !hasChanged(emittedValue, prevEmittedValue)) trigger();
6897
+ if (hasChanged(value, prevSetValue) && (hasChanged(value, emittedValue) && !hasChanged(emittedValue, prevEmittedValue) || hasVModel && prevSetValue !== EMPTY_OBJ && !hasChanged(emittedValue, localValue))) trigger();
6881
6898
  prevSetValue = value;
6882
6899
  prevEmittedValue = emittedValue;
6883
6900
  }
@@ -9906,7 +9923,7 @@ function isMemoSame(cached, memo) {
9906
9923
  }
9907
9924
  //#endregion
9908
9925
  //#region packages/runtime-core/src/index.ts
9909
- const version = "3.6.0-beta.14";
9926
+ const version = "3.6.0-beta.15";
9910
9927
  const warn = !!(process.env.NODE_ENV !== "production") ? warn$1 : NOOP;
9911
9928
  /**
9912
9929
  * Runtime error messages. Only exposed in dev or esm builds.
@@ -11130,7 +11147,7 @@ const TransitionGroup = /* @__PURE__ */ decorate({
11130
11147
  prevChildren = [];
11131
11148
  if (children) for (let i = 0; i < children.length; i++) {
11132
11149
  const child = children[i];
11133
- if (child.el && child.el instanceof Element) {
11150
+ if (child.el && child.el instanceof Element && !child.el[vShowHidden]) {
11134
11151
  prevChildren.push(child);
11135
11152
  setTransitionHooks(child, resolveTransitionHooks(child, cssTransitionProps, state, instance));
11136
11153
  positionMap.set(child, getPosition(child.el));
@@ -13476,7 +13493,7 @@ const tokenizer = new Tokenizer(stack, {
13476
13493
  }
13477
13494
  },
13478
13495
  oncdata(start, end) {
13479
- if (stack[0].ns !== 0) onText(getSlice(start, end), start, end);
13496
+ if ((stack[0] ? stack[0].ns : currentOptions.ns) !== 0) onText(getSlice(start, end), start, end);
13480
13497
  else emitError(1, start - 9);
13481
13498
  },
13482
13499
  onprocessinginstruction(start) {
@@ -13972,7 +13989,7 @@ function getSelfName(filename) {
13972
13989
  const nameMatch = filename.replace(/\?.*$/, "").match(/([^/\\]+)\.\w+$/);
13973
13990
  return nameMatch ? capitalize(camelize(nameMatch[1])) : null;
13974
13991
  }
13975
- function createTransformContext(root, { filename = "", prefixIdentifiers = false, hoistStatic = false, hmr = false, cacheHandlers = false, nodeTransforms = [], directiveTransforms = {}, transformHoist = null, isBuiltInComponent = NOOP, isCustomElement = NOOP, expressionPlugins = [], scopeId = null, slotted = true, ssr = false, inSSR = false, ssrCssVars = ``, bindingMetadata = EMPTY_OBJ, inline = false, isTS = false, onError = defaultOnError, onWarn = defaultOnWarn, compatConfig }) {
13992
+ function createTransformContext(root, { filename = "", prefixIdentifiers = false, hoistStatic = false, hmr = false, cacheHandlers = false, nodeTransforms = [], directiveTransforms = {}, transformHoist = null, isBuiltInComponent = NOOP, isCustomElement = NOOP, expressionPlugins = [], scopeId = null, slotted = true, ssr = false, inSSR = false, ssrCssVars = ``, bindingMetadata = EMPTY_OBJ, inline = false, isTS = false, eventDelegation = true, onError = defaultOnError, onWarn = defaultOnWarn, compatConfig }) {
13976
13993
  const context = {
13977
13994
  filename,
13978
13995
  selfName: getSelfName(filename),
@@ -13994,6 +14011,7 @@ function createTransformContext(root, { filename = "", prefixIdentifiers = false
13994
14011
  bindingMetadata,
13995
14012
  inline,
13996
14013
  isTS,
14014
+ eventDelegation,
13997
14015
  onError,
13998
14016
  onWarn,
13999
14017
  compatConfig,
@@ -14005,6 +14023,7 @@ function createTransformContext(root, { filename = "", prefixIdentifiers = false
14005
14023
  imports: [],
14006
14024
  cached: [],
14007
14025
  constantCache: /* @__PURE__ */ new WeakMap(),
14026
+ vForMemoKeyedNodes: /* @__PURE__ */ new WeakSet(),
14008
14027
  temps: 0,
14009
14028
  identifiers: Object.create(null),
14010
14029
  identifierScopes: Object.create(null),
@@ -14640,7 +14659,7 @@ const transformExpression = (node, context) => {
14640
14659
  if (dir.type === 7 && dir.name !== "for") {
14641
14660
  const exp = dir.exp;
14642
14661
  const arg = dir.arg;
14643
- if (exp && exp.type === 4 && !(dir.name === "on" && arg) && !(memo && arg && arg.type === 4 && arg.content === "key")) dir.exp = processExpression(exp, context, dir.name === "slot");
14662
+ if (exp && exp.type === 4 && !(dir.name === "on" && arg) && !(memo && context.vForMemoKeyedNodes.has(node) && arg && arg.type === 4 && arg.content === "key")) dir.exp = processExpression(exp, context, dir.name === "slot");
14644
14663
  if (arg && arg.type === 4 && !arg.isStatic) dir.arg = processExpression(arg, context);
14645
14664
  }
14646
14665
  }
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @vue/compat v3.6.0-beta.14
2
+ * @vue/compat v3.6.0-beta.15
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -2247,8 +2247,9 @@ var Vue = (function() {
2247
2247
  if (once && cb) {
2248
2248
  const _cb = cb;
2249
2249
  cb = (...args) => {
2250
- _cb(...args);
2250
+ const res = _cb(...args);
2251
2251
  this.stop();
2252
+ return res;
2252
2253
  };
2253
2254
  }
2254
2255
  this.cb = cb;
@@ -2262,7 +2263,7 @@ var Vue = (function() {
2262
2263
  if (!this.cb) return;
2263
2264
  const { immediate, deep, call } = this.options;
2264
2265
  if (initialRun && !immediate) return;
2265
- if (deep || this.forceTrigger || (this.isMultiSource ? newValue.some((v, i) => hasChanged(v, oldValue[i])) : hasChanged(newValue, oldValue))) {
2266
+ if (initialRun || deep || this.forceTrigger || (this.isMultiSource ? newValue.some((v, i) => hasChanged(v, oldValue[i])) : hasChanged(newValue, oldValue))) {
2266
2267
  cleanup(this);
2267
2268
  const currentWatcher = activeWatcher;
2268
2269
  activeWatcher = this;
@@ -4666,11 +4667,16 @@ var Vue = (function() {
4666
4667
  onError(err);
4667
4668
  return () => errorComponent ? createVNode(errorComponent, { error: err }) : null;
4668
4669
  });
4669
- const { loaded, error, delayed } = useAsyncComponentState(delay, timeout, onError);
4670
+ const { loaded, error, delayed } = useAsyncComponentState(delay, timeout, onError, instance);
4670
4671
  load().then(() => {
4672
+ if (instance.isUnmounted) return;
4671
4673
  loaded.value = true;
4672
4674
  if (instance.parent && instance.parent.vnode && isKeepAlive(instance.parent.vnode)) instance.parent.update();
4673
4675
  }).catch((err) => {
4676
+ if (instance.isUnmounted) {
4677
+ setPendingRequest(null);
4678
+ return;
4679
+ }
4674
4680
  onError(err);
4675
4681
  error.value = err;
4676
4682
  });
@@ -4728,14 +4734,22 @@ var Vue = (function() {
4728
4734
  setPendingRequest: (request) => pendingRequest = request
4729
4735
  };
4730
4736
  }
4731
- const useAsyncComponentState = (delay, timeout, onError) => {
4737
+ const useAsyncComponentState = (delay, timeout, onError, instance = currentInstance) => {
4732
4738
  const loaded = /* @__PURE__ */ ref(false);
4733
4739
  const error = /* @__PURE__ */ ref();
4734
4740
  const delayed = /* @__PURE__ */ ref(!!delay);
4735
- if (delay) setTimeout(() => {
4741
+ let timeoutTimer;
4742
+ let delayTimer;
4743
+ if (instance) onUnmounted(() => {
4744
+ if (timeoutTimer != null) clearTimeout(timeoutTimer);
4745
+ if (delayTimer != null) clearTimeout(delayTimer);
4746
+ }, instance);
4747
+ if (delay) delayTimer = setTimeout(() => {
4748
+ if (instance && instance.isUnmounted) return;
4736
4749
  delayed.value = false;
4737
4750
  }, delay);
4738
- if (timeout != null) setTimeout(() => {
4751
+ if (timeout != null) timeoutTimer = setTimeout(() => {
4752
+ if (instance && instance.isUnmounted) return;
4739
4753
  if (!loaded.value && !error.value) {
4740
4754
  const err = /* @__PURE__ */ new Error(`Async component timed out after ${timeout}ms.`);
4741
4755
  onError(err);
@@ -6290,7 +6304,7 @@ var Vue = (function() {
6290
6304
  if (options.el) return vm.$mount(options.el);
6291
6305
  else return vm;
6292
6306
  }
6293
- Vue.version = `2.6.14-compat:3.6.0-beta.14`;
6307
+ Vue.version = `2.6.14-compat:3.6.0-beta.15`;
6294
6308
  Vue.config = singletonApp.config;
6295
6309
  Vue.use = (plugin, ...options) => {
6296
6310
  if (plugin && isFunction(plugin.install)) plugin.install(Vue, ...options);
@@ -6545,7 +6559,9 @@ var Vue = (function() {
6545
6559
  else Object.keys(val).forEach((key) => {
6546
6560
  try {
6547
6561
  defineReactiveSimple(val, key, val[key]);
6548
- } catch (e) {}
6562
+ } catch (e) {
6563
+ warn$1(`Failed making property "${key}" reactive:`, e);
6564
+ }
6549
6565
  });
6550
6566
  }
6551
6567
  const i = obj.$;
@@ -6790,12 +6806,13 @@ var Vue = (function() {
6790
6806
  for (const key of rawPropKeys) if (key === name || key === camelizedName || key === hyphenatedName) parentPassedModelValue = true;
6791
6807
  else if (key === `onUpdate:${name}` || key === `onUpdate:${camelizedName}` || key === `onUpdate:${hyphenatedName}`) parentPassedModelUpdater = true;
6792
6808
  }
6793
- if (!parentPassedModelValue || !parentPassedModelUpdater) {
6809
+ const hasVModel = parentPassedModelValue && parentPassedModelUpdater;
6810
+ if (!hasVModel) {
6794
6811
  localValue = value;
6795
6812
  trigger();
6796
6813
  }
6797
6814
  i.emit(`update:${name}`, emittedValue);
6798
- if (hasChanged(value, emittedValue) && hasChanged(value, prevSetValue) && !hasChanged(emittedValue, prevEmittedValue)) trigger();
6815
+ if (hasChanged(value, prevSetValue) && (hasChanged(value, emittedValue) && !hasChanged(emittedValue, prevEmittedValue) || hasVModel && prevSetValue !== EMPTY_OBJ && !hasChanged(emittedValue, localValue))) trigger();
6799
6816
  prevSetValue = value;
6800
6817
  prevEmittedValue = emittedValue;
6801
6818
  }
@@ -9750,7 +9767,7 @@ var Vue = (function() {
9750
9767
  }
9751
9768
  //#endregion
9752
9769
  //#region packages/runtime-core/src/index.ts
9753
- const version = "3.6.0-beta.14";
9770
+ const version = "3.6.0-beta.15";
9754
9771
  const warn = warn$1;
9755
9772
  /**
9756
9773
  * Runtime error messages. Only exposed in dev or esm builds.
@@ -10932,7 +10949,7 @@ var Vue = (function() {
10932
10949
  prevChildren = [];
10933
10950
  if (children) for (let i = 0; i < children.length; i++) {
10934
10951
  const child = children[i];
10935
- if (child.el && child.el instanceof Element) {
10952
+ if (child.el && child.el instanceof Element && !child.el[vShowHidden]) {
10936
10953
  prevChildren.push(child);
10937
10954
  setTransitionHooks(child, resolveTransitionHooks(child, cssTransitionProps, state, instance));
10938
10955
  positionMap.set(child, getPosition(child.el));
@@ -13153,7 +13170,7 @@ var Vue = (function() {
13153
13170
  }
13154
13171
  },
13155
13172
  oncdata(start, end) {
13156
- if (stack[0].ns !== 0) onText(getSlice(start, end), start, end);
13173
+ if ((stack[0] ? stack[0].ns : currentOptions.ns) !== 0) onText(getSlice(start, end), start, end);
13157
13174
  else emitError(1, start - 9);
13158
13175
  },
13159
13176
  onprocessinginstruction(start) {
@@ -13645,7 +13662,7 @@ var Vue = (function() {
13645
13662
  const nameMatch = filename.replace(/\?.*$/, "").match(/([^/\\]+)\.\w+$/);
13646
13663
  return nameMatch ? capitalize(camelize(nameMatch[1])) : null;
13647
13664
  }
13648
- function createTransformContext(root, { filename = "", prefixIdentifiers = false, hoistStatic = false, hmr = false, cacheHandlers = false, nodeTransforms = [], directiveTransforms = {}, transformHoist = null, isBuiltInComponent = NOOP, isCustomElement = NOOP, expressionPlugins = [], scopeId = null, slotted = true, ssr = false, inSSR = false, ssrCssVars = ``, bindingMetadata = EMPTY_OBJ, inline = false, isTS = false, onError = defaultOnError, onWarn = defaultOnWarn, compatConfig }) {
13665
+ function createTransformContext(root, { filename = "", prefixIdentifiers = false, hoistStatic = false, hmr = false, cacheHandlers = false, nodeTransforms = [], directiveTransforms = {}, transformHoist = null, isBuiltInComponent = NOOP, isCustomElement = NOOP, expressionPlugins = [], scopeId = null, slotted = true, ssr = false, inSSR = false, ssrCssVars = ``, bindingMetadata = EMPTY_OBJ, inline = false, isTS = false, eventDelegation = true, onError = defaultOnError, onWarn = defaultOnWarn, compatConfig }) {
13649
13666
  const context = {
13650
13667
  filename,
13651
13668
  selfName: getSelfName(filename),
@@ -13667,6 +13684,7 @@ var Vue = (function() {
13667
13684
  bindingMetadata,
13668
13685
  inline,
13669
13686
  isTS,
13687
+ eventDelegation,
13670
13688
  onError,
13671
13689
  onWarn,
13672
13690
  compatConfig,
@@ -13678,6 +13696,7 @@ var Vue = (function() {
13678
13696
  imports: [],
13679
13697
  cached: [],
13680
13698
  constantCache: /* @__PURE__ */ new WeakMap(),
13699
+ vForMemoKeyedNodes: /* @__PURE__ */ new WeakSet(),
13681
13700
  temps: 0,
13682
13701
  identifiers: Object.create(null),
13683
13702
  identifierScopes: Object.create(null),
@@ -14308,7 +14327,7 @@ var Vue = (function() {
14308
14327
  if (dir.type === 7 && dir.name !== "for") {
14309
14328
  const exp = dir.exp;
14310
14329
  const arg = dir.arg;
14311
- if (exp && exp.type === 4 && !(dir.name === "on" && arg) && !(memo && arg && arg.type === 4 && arg.content === "key")) dir.exp = processExpression(exp, context, dir.name === "slot");
14330
+ if (exp && exp.type === 4 && !(dir.name === "on" && arg) && !(memo && context.vForMemoKeyedNodes.has(node) && arg && arg.type === 4 && arg.content === "key")) dir.exp = processExpression(exp, context, dir.name === "slot");
14312
14331
  if (arg && arg.type === 4 && !arg.isStatic) dir.arg = processExpression(arg, context);
14313
14332
  }
14314
14333
  }