vue 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.
package/dist/vue.cjs.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * vue v3.6.0-beta.14
2
+ * vue v3.6.0-beta.15
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -1,5 +1,5 @@
1
1
  /**
2
- * vue v3.6.0-beta.14
2
+ * vue v3.6.0-beta.15
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -1,5 +1,5 @@
1
1
  /**
2
- * vue v3.6.0-beta.14
2
+ * vue v3.6.0-beta.15
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -2246,8 +2246,9 @@ var WatcherEffect = class extends ReactiveEffect {
2246
2246
  if (once && cb) {
2247
2247
  const _cb = cb;
2248
2248
  cb = (...args) => {
2249
- _cb(...args);
2249
+ const res = _cb(...args);
2250
2250
  this.stop();
2251
+ return res;
2251
2252
  };
2252
2253
  }
2253
2254
  this.cb = cb;
@@ -2261,7 +2262,7 @@ var WatcherEffect = class extends ReactiveEffect {
2261
2262
  if (!this.cb) return;
2262
2263
  const { immediate, deep, call } = this.options;
2263
2264
  if (initialRun && !immediate) return;
2264
- if (deep || this.forceTrigger || (this.isMultiSource ? newValue.some((v, i) => hasChanged(v, oldValue[i])) : hasChanged(newValue, oldValue))) {
2265
+ if (initialRun || deep || this.forceTrigger || (this.isMultiSource ? newValue.some((v, i) => hasChanged(v, oldValue[i])) : hasChanged(newValue, oldValue))) {
2265
2266
  cleanup(this);
2266
2267
  const currentWatcher = activeWatcher;
2267
2268
  activeWatcher = this;
@@ -4317,11 +4318,16 @@ function defineAsyncComponent(source) {
4317
4318
  onError(err);
4318
4319
  return () => errorComponent ? createVNode(errorComponent, { error: err }) : null;
4319
4320
  });
4320
- const { loaded, error, delayed } = useAsyncComponentState(delay, timeout, onError);
4321
+ const { loaded, error, delayed } = useAsyncComponentState(delay, timeout, onError, instance);
4321
4322
  load().then(() => {
4323
+ if (instance.isUnmounted) return;
4322
4324
  loaded.value = true;
4323
4325
  if (instance.parent && instance.parent.vnode && isKeepAlive(instance.parent.vnode)) instance.parent.update();
4324
4326
  }).catch((err) => {
4327
+ if (instance.isUnmounted) {
4328
+ setPendingRequest(null);
4329
+ return;
4330
+ }
4325
4331
  onError(err);
4326
4332
  error.value = err;
4327
4333
  });
@@ -4379,14 +4385,22 @@ function createAsyncComponentContext(source) {
4379
4385
  setPendingRequest: (request) => pendingRequest = request
4380
4386
  };
4381
4387
  }
4382
- const useAsyncComponentState = (delay, timeout, onError) => {
4388
+ const useAsyncComponentState = (delay, timeout, onError, instance = currentInstance) => {
4383
4389
  const loaded = /* @__PURE__ */ ref(false);
4384
4390
  const error = /* @__PURE__ */ ref();
4385
4391
  const delayed = /* @__PURE__ */ ref(!!delay);
4386
- if (delay) setTimeout(() => {
4392
+ let timeoutTimer;
4393
+ let delayTimer;
4394
+ if (instance) onUnmounted(() => {
4395
+ if (timeoutTimer != null) clearTimeout(timeoutTimer);
4396
+ if (delayTimer != null) clearTimeout(delayTimer);
4397
+ }, instance);
4398
+ if (delay) delayTimer = setTimeout(() => {
4399
+ if (instance && instance.isUnmounted) return;
4387
4400
  delayed.value = false;
4388
4401
  }, delay);
4389
- if (timeout != null) setTimeout(() => {
4402
+ if (timeout != null) timeoutTimer = setTimeout(() => {
4403
+ if (instance && instance.isUnmounted) return;
4390
4404
  if (!loaded.value && !error.value) {
4391
4405
  const err = /* @__PURE__ */ new Error(`Async component timed out after ${timeout}ms.`);
4392
4406
  onError(err);
@@ -5643,12 +5657,13 @@ function useModel(props, name, options = EMPTY_OBJ) {
5643
5657
  for (const key of rawPropKeys) if (key === name || key === camelizedName || key === hyphenatedName) parentPassedModelValue = true;
5644
5658
  else if (key === `onUpdate:${name}` || key === `onUpdate:${camelizedName}` || key === `onUpdate:${hyphenatedName}`) parentPassedModelUpdater = true;
5645
5659
  }
5646
- if (!parentPassedModelValue || !parentPassedModelUpdater) {
5660
+ const hasVModel = parentPassedModelValue && parentPassedModelUpdater;
5661
+ if (!hasVModel) {
5647
5662
  localValue = value;
5648
5663
  trigger();
5649
5664
  }
5650
5665
  i.emit(`update:${name}`, emittedValue);
5651
- if (hasChanged(value, emittedValue) && hasChanged(value, prevSetValue) && !hasChanged(emittedValue, prevEmittedValue)) trigger();
5666
+ if (hasChanged(value, prevSetValue) && (hasChanged(value, emittedValue) && !hasChanged(emittedValue, prevEmittedValue) || hasVModel && prevSetValue !== EMPTY_OBJ && !hasChanged(emittedValue, localValue))) trigger();
5652
5667
  prevSetValue = value;
5653
5668
  prevEmittedValue = emittedValue;
5654
5669
  }
@@ -8494,7 +8509,7 @@ function isMemoSame(cached, memo) {
8494
8509
  }
8495
8510
  //#endregion
8496
8511
  //#region packages/runtime-core/src/index.ts
8497
- const version = "3.6.0-beta.14";
8512
+ const version = "3.6.0-beta.15";
8498
8513
  const warn = warn$1;
8499
8514
  /**
8500
8515
  * Runtime error messages. Only exposed in dev or esm builds.
@@ -9645,7 +9660,7 @@ const TransitionGroup = /* @__PURE__ */ decorate({
9645
9660
  prevChildren = [];
9646
9661
  if (children) for (let i = 0; i < children.length; i++) {
9647
9662
  const child = children[i];
9648
- if (child.el && child.el instanceof Element) {
9663
+ if (child.el && child.el instanceof Element && !child.el[vShowHidden]) {
9649
9664
  prevChildren.push(child);
9650
9665
  setTransitionHooks(child, resolveTransitionHooks(child, cssTransitionProps, state, instance));
9651
9666
  positionMap.set(child, getPosition(child.el));
@@ -11759,7 +11774,7 @@ const tokenizer = new Tokenizer(stack, {
11759
11774
  }
11760
11775
  },
11761
11776
  oncdata(start, end) {
11762
- if (stack[0].ns !== 0) onText(getSlice(start, end), start, end);
11777
+ if ((stack[0] ? stack[0].ns : currentOptions.ns) !== 0) onText(getSlice(start, end), start, end);
11763
11778
  else emitError(1, start - 9);
11764
11779
  },
11765
11780
  onprocessinginstruction(start) {
@@ -12220,7 +12235,7 @@ function getSelfName(filename) {
12220
12235
  const nameMatch = filename.replace(/\?.*$/, "").match(/([^/\\]+)\.\w+$/);
12221
12236
  return nameMatch ? capitalize(camelize(nameMatch[1])) : null;
12222
12237
  }
12223
- 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 }) {
12238
+ 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 }) {
12224
12239
  const context = {
12225
12240
  filename,
12226
12241
  selfName: getSelfName(filename),
@@ -12242,6 +12257,7 @@ function createTransformContext(root, { filename = "", prefixIdentifiers = false
12242
12257
  bindingMetadata,
12243
12258
  inline,
12244
12259
  isTS,
12260
+ eventDelegation,
12245
12261
  onError,
12246
12262
  onWarn,
12247
12263
  compatConfig,
@@ -12253,6 +12269,7 @@ function createTransformContext(root, { filename = "", prefixIdentifiers = false
12253
12269
  imports: [],
12254
12270
  cached: [],
12255
12271
  constantCache: /* @__PURE__ */ new WeakMap(),
12272
+ vForMemoKeyedNodes: /* @__PURE__ */ new WeakSet(),
12256
12273
  temps: 0,
12257
12274
  identifiers: Object.create(null),
12258
12275
  identifierScopes: Object.create(null),
@@ -12873,7 +12890,7 @@ const transformExpression = (node, context) => {
12873
12890
  if (dir.type === 7 && dir.name !== "for") {
12874
12891
  const exp = dir.exp;
12875
12892
  const arg = dir.arg;
12876
- 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");
12893
+ 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");
12877
12894
  if (arg && arg.type === 4 && !arg.isStatic) dir.arg = processExpression(arg, context);
12878
12895
  }
12879
12896
  }