@vue/runtime-core 3.2.43 → 3.2.45

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.
@@ -514,12 +514,6 @@ function reload(id, newComp) {
514
514
  // components to be unmounted and re-mounted. Queue the update so that we
515
515
  // don't end up forcing the same parent to re-render multiple times.
516
516
  queueJob(instance.parent.update);
517
- // instance is the inner component of an async custom element
518
- // invoke to reset styles
519
- if (instance.parent.type.__asyncLoader &&
520
- instance.parent.ceReload) {
521
- instance.parent.ceReload(newComp.styles);
522
- }
523
517
  }
524
518
  else if (instance.appContext.reload) {
525
519
  // root instance mounted via createApp() has a reload method
@@ -1792,10 +1786,11 @@ function doWatch(source, cb, { immediate, deep, flush, onTrack, onTrigger } = sh
1792
1786
  callWithAsyncErrorHandling(cb, instance, 3 /* ErrorCodes.WATCH_CALLBACK */, [
1793
1787
  newValue,
1794
1788
  // pass undefined as the old value when it's changed for the first time
1795
- oldValue === INITIAL_WATCHER_VALUE ||
1796
- (isMultiSource && oldValue[0] === INITIAL_WATCHER_VALUE)
1797
- ? []
1798
- : oldValue,
1789
+ oldValue === INITIAL_WATCHER_VALUE
1790
+ ? undefined
1791
+ : (isMultiSource && oldValue[0] === INITIAL_WATCHER_VALUE)
1792
+ ? []
1793
+ : oldValue,
1799
1794
  onCleanup
1800
1795
  ]);
1801
1796
  oldValue = newValue;
@@ -2394,10 +2389,15 @@ function defineAsyncComponent(source) {
2394
2389
  }
2395
2390
  });
2396
2391
  }
2397
- function createInnerComp(comp, { vnode: { ref, props, children, shapeFlag }, parent }) {
2392
+ function createInnerComp(comp, parent) {
2393
+ const { ref, props, children, ce } = parent.vnode;
2398
2394
  const vnode = createVNode(comp, props, children);
2399
2395
  // ensure inner component inherits the async wrapper's ref owner
2400
2396
  vnode.ref = ref;
2397
+ // pass the custom element callback on to the inner comp
2398
+ // and remove it from the async wrapper
2399
+ vnode.ce = ce;
2400
+ delete parent.vnode.ce;
2401
2401
  return vnode;
2402
2402
  }
2403
2403
 
@@ -2563,8 +2563,7 @@ const KeepAliveImpl = {
2563
2563
  : comp);
2564
2564
  const { include, exclude, max } = props;
2565
2565
  if ((include && (!name || !matches(include, name))) ||
2566
- (exclude && name && matches(exclude, name)) ||
2567
- (hmrDirtyComponents.has(comp))) {
2566
+ (exclude && name && matches(exclude, name))) {
2568
2567
  current = vnode;
2569
2568
  return rawVNode;
2570
2569
  }
@@ -2674,14 +2673,9 @@ function injectToKeepAliveRoot(hook, type, target, keepAliveRoot) {
2674
2673
  }, target);
2675
2674
  }
2676
2675
  function resetShapeFlag(vnode) {
2677
- let shapeFlag = vnode.shapeFlag;
2678
- if (shapeFlag & 256 /* ShapeFlags.COMPONENT_SHOULD_KEEP_ALIVE */) {
2679
- shapeFlag -= 256 /* ShapeFlags.COMPONENT_SHOULD_KEEP_ALIVE */;
2680
- }
2681
- if (shapeFlag & 512 /* ShapeFlags.COMPONENT_KEPT_ALIVE */) {
2682
- shapeFlag -= 512 /* ShapeFlags.COMPONENT_KEPT_ALIVE */;
2683
- }
2684
- vnode.shapeFlag = shapeFlag;
2676
+ // bitwise operations to remove keep alive flags
2677
+ vnode.shapeFlag &= ~256 /* ShapeFlags.COMPONENT_SHOULD_KEEP_ALIVE */;
2678
+ vnode.shapeFlag &= ~512 /* ShapeFlags.COMPONENT_KEPT_ALIVE */;
2685
2679
  }
2686
2680
  function getInnerChild(vnode) {
2687
2681
  return vnode.shapeFlag & 128 /* ShapeFlags.SUSPENSE */ ? vnode.ssContent : vnode;
@@ -2980,7 +2974,9 @@ fallback, noSlotted) {
2980
2974
  (currentRenderingInstance.parent &&
2981
2975
  isAsyncWrapper(currentRenderingInstance.parent) &&
2982
2976
  currentRenderingInstance.parent.isCE)) {
2983
- return createVNode('slot', name === 'default' ? null : { name }, fallback && fallback());
2977
+ if (name !== 'default')
2978
+ props.name = name;
2979
+ return createVNode('slot', props, fallback && fallback());
2984
2980
  }
2985
2981
  let slot = slots[name];
2986
2982
  if (slot && slot.length > 1) {
@@ -3080,6 +3076,7 @@ const publicPropertiesMap =
3080
3076
  $watch: i => (instanceWatch.bind(i) )
3081
3077
  });
3082
3078
  const isReservedPrefix = (key) => key === '_' || key === '$';
3079
+ const hasSetupBinding = (state, key) => state !== shared.EMPTY_OBJ && !state.__isScriptSetup && shared.hasOwn(state, key);
3083
3080
  const PublicInstanceProxyHandlers = {
3084
3081
  get({ _: instance }, key) {
3085
3082
  const { ctx, setupState, data, props, accessCache, type, appContext } = instance;
@@ -3087,15 +3084,6 @@ const PublicInstanceProxyHandlers = {
3087
3084
  if (key === '__isVue') {
3088
3085
  return true;
3089
3086
  }
3090
- // prioritize <script setup> bindings during dev.
3091
- // this allows even properties that start with _ or $ to be used - so that
3092
- // it aligns with the production behavior where the render fn is inlined and
3093
- // indeed has access to all declared variables.
3094
- if (setupState !== shared.EMPTY_OBJ &&
3095
- setupState.__isScriptSetup &&
3096
- shared.hasOwn(setupState, key)) {
3097
- return setupState[key];
3098
- }
3099
3087
  // data / props / ctx
3100
3088
  // This getter gets called for every property access on the render context
3101
3089
  // during render and is a major hotspot. The most expensive part of this
@@ -3118,7 +3106,7 @@ const PublicInstanceProxyHandlers = {
3118
3106
  // default: just fallthrough
3119
3107
  }
3120
3108
  }
3121
- else if (setupState !== shared.EMPTY_OBJ && shared.hasOwn(setupState, key)) {
3109
+ else if (hasSetupBinding(setupState, key)) {
3122
3110
  accessCache[key] = 1 /* AccessTypes.SETUP */;
3123
3111
  return setupState[key];
3124
3112
  }
@@ -3188,21 +3176,26 @@ const PublicInstanceProxyHandlers = {
3188
3176
  },
3189
3177
  set({ _: instance }, key, value) {
3190
3178
  const { data, setupState, ctx } = instance;
3191
- if (setupState !== shared.EMPTY_OBJ && shared.hasOwn(setupState, key)) {
3179
+ if (hasSetupBinding(setupState, key)) {
3192
3180
  setupState[key] = value;
3193
3181
  return true;
3194
3182
  }
3183
+ else if (setupState.__isScriptSetup &&
3184
+ shared.hasOwn(setupState, key)) {
3185
+ warn(`Cannot mutate <script setup> binding "${key}" from Options API.`);
3186
+ return false;
3187
+ }
3195
3188
  else if (data !== shared.EMPTY_OBJ && shared.hasOwn(data, key)) {
3196
3189
  data[key] = value;
3197
3190
  return true;
3198
3191
  }
3199
3192
  else if (shared.hasOwn(instance.props, key)) {
3200
- warn(`Attempting to mutate prop "${key}". Props are readonly.`, instance);
3193
+ warn(`Attempting to mutate prop "${key}". Props are readonly.`);
3201
3194
  return false;
3202
3195
  }
3203
3196
  if (key[0] === '$' && key.slice(1) in instance) {
3204
3197
  warn(`Attempting to mutate public property "${key}". ` +
3205
- `Properties starting with $ are reserved and readonly.`, instance);
3198
+ `Properties starting with $ are reserved and readonly.`);
3206
3199
  return false;
3207
3200
  }
3208
3201
  else {
@@ -3223,7 +3216,7 @@ const PublicInstanceProxyHandlers = {
3223
3216
  let normalizedProps;
3224
3217
  return (!!accessCache[key] ||
3225
3218
  (data !== shared.EMPTY_OBJ && shared.hasOwn(data, key)) ||
3226
- (setupState !== shared.EMPTY_OBJ && shared.hasOwn(setupState, key)) ||
3219
+ hasSetupBinding(setupState, key) ||
3227
3220
  ((normalizedProps = propsOptions[0]) && shared.hasOwn(normalizedProps, key)) ||
3228
3221
  shared.hasOwn(ctx, key) ||
3229
3222
  shared.hasOwn(publicPropertiesMap, key) ||
@@ -6262,6 +6255,10 @@ function traverseStaticChildren(n1, n2, shallow = false) {
6262
6255
  if (!shallow)
6263
6256
  traverseStaticChildren(c1, c2);
6264
6257
  }
6258
+ // #6852 also inherit for text nodes
6259
+ if (c2.type === Text) {
6260
+ c2.el = c1.el;
6261
+ }
6265
6262
  // also inherit for comment nodes, but not placeholders (e.g. v-if which
6266
6263
  // would have received .el during block patch)
6267
6264
  if (c2.type === Comment && !c2.el) {
@@ -6432,6 +6429,7 @@ const TeleportImpl = {
6432
6429
  }
6433
6430
  }
6434
6431
  }
6432
+ updateCssVars(n2);
6435
6433
  },
6436
6434
  remove(vnode, parentComponent, parentSuspense, optimized, { um: unmount, o: { remove: hostRemove } }, doRemove) {
6437
6435
  const { shapeFlag, children, anchor, targetAnchor, target, props } = vnode;
@@ -6510,11 +6508,26 @@ function hydrateTeleport(node, vnode, parentComponent, parentSuspense, slotScope
6510
6508
  hydrateChildren(targetNode, vnode, target, parentComponent, parentSuspense, slotScopeIds, optimized);
6511
6509
  }
6512
6510
  }
6511
+ updateCssVars(vnode);
6513
6512
  }
6514
6513
  return vnode.anchor && nextSibling(vnode.anchor);
6515
6514
  }
6516
6515
  // Force-casted public typing for h and TSX props inference
6517
6516
  const Teleport = TeleportImpl;
6517
+ function updateCssVars(vnode) {
6518
+ // presence of .ut method indicates owner component uses css vars.
6519
+ // code path here can assume browser environment.
6520
+ const ctx = vnode.ctx;
6521
+ if (ctx && ctx.ut) {
6522
+ let node = vnode.children[0].el;
6523
+ while (node !== vnode.targetAnchor) {
6524
+ if (node.nodeType === 1)
6525
+ node.setAttribute('data-v-owner', ctx.uid);
6526
+ node = node.nextSibling;
6527
+ }
6528
+ ctx.ut();
6529
+ }
6530
+ }
6518
6531
 
6519
6532
  const Fragment = Symbol('Fragment' );
6520
6533
  const Text = Symbol('Text' );
@@ -6609,6 +6622,10 @@ function isVNode(value) {
6609
6622
  function isSameVNodeType(n1, n2) {
6610
6623
  if (n2.shapeFlag & 6 /* ShapeFlags.COMPONENT */ &&
6611
6624
  hmrDirtyComponents.has(n2.type)) {
6625
+ // #7042, ensure the vnode being unmounted during HMR
6626
+ // bitwise operations to remove keep alive flags
6627
+ n1.shapeFlag &= ~256 /* ShapeFlags.COMPONENT_SHOULD_KEEP_ALIVE */;
6628
+ n2.shapeFlag &= ~512 /* ShapeFlags.COMPONENT_KEPT_ALIVE */;
6612
6629
  // HMR only: if the component has been hot-updated, force a reload.
6613
6630
  return false;
6614
6631
  }
@@ -6664,7 +6681,8 @@ function createBaseVNode(type, props = null, children = null, patchFlag = 0, dyn
6664
6681
  patchFlag,
6665
6682
  dynamicProps,
6666
6683
  dynamicChildren: null,
6667
- appContext: null
6684
+ appContext: null,
6685
+ ctx: currentRenderingInstance
6668
6686
  };
6669
6687
  if (needFullChildrenNormalization) {
6670
6688
  normalizeChildren(vnode, children);
@@ -6831,7 +6849,8 @@ function cloneVNode(vnode, extraProps, mergeRef = false) {
6831
6849
  ssContent: vnode.ssContent && cloneVNode(vnode.ssContent),
6832
6850
  ssFallback: vnode.ssFallback && cloneVNode(vnode.ssFallback),
6833
6851
  el: vnode.el,
6834
- anchor: vnode.anchor
6852
+ anchor: vnode.anchor,
6853
+ ctx: vnode.ctx
6835
6854
  };
6836
6855
  return cloned;
6837
6856
  }
@@ -7808,7 +7827,7 @@ function isMemoSame(cached, memo) {
7808
7827
  }
7809
7828
 
7810
7829
  // Core API ------------------------------------------------------------------
7811
- const version = "3.2.43";
7830
+ const version = "3.2.45";
7812
7831
  const _ssrUtils = {
7813
7832
  createComponentInstance,
7814
7833
  setupComponent,
@@ -1212,10 +1212,11 @@ function doWatch(source, cb, { immediate, deep, flush, onTrack, onTrigger } = sh
1212
1212
  callWithAsyncErrorHandling(cb, instance, 3 /* ErrorCodes.WATCH_CALLBACK */, [
1213
1213
  newValue,
1214
1214
  // pass undefined as the old value when it's changed for the first time
1215
- oldValue === INITIAL_WATCHER_VALUE ||
1216
- (isMultiSource && oldValue[0] === INITIAL_WATCHER_VALUE)
1217
- ? []
1218
- : oldValue,
1215
+ oldValue === INITIAL_WATCHER_VALUE
1216
+ ? undefined
1217
+ : (isMultiSource && oldValue[0] === INITIAL_WATCHER_VALUE)
1218
+ ? []
1219
+ : oldValue,
1219
1220
  onCleanup
1220
1221
  ]);
1221
1222
  oldValue = newValue;
@@ -1789,10 +1790,15 @@ function defineAsyncComponent(source) {
1789
1790
  }
1790
1791
  });
1791
1792
  }
1792
- function createInnerComp(comp, { vnode: { ref, props, children, shapeFlag }, parent }) {
1793
+ function createInnerComp(comp, parent) {
1794
+ const { ref, props, children, ce } = parent.vnode;
1793
1795
  const vnode = createVNode(comp, props, children);
1794
1796
  // ensure inner component inherits the async wrapper's ref owner
1795
1797
  vnode.ref = ref;
1798
+ // pass the custom element callback on to the inner comp
1799
+ // and remove it from the async wrapper
1800
+ vnode.ce = ce;
1801
+ delete parent.vnode.ce;
1796
1802
  return vnode;
1797
1803
  }
1798
1804
 
@@ -1944,8 +1950,7 @@ const KeepAliveImpl = {
1944
1950
  : comp);
1945
1951
  const { include, exclude, max } = props;
1946
1952
  if ((include && (!name || !matches(include, name))) ||
1947
- (exclude && name && matches(exclude, name)) ||
1948
- (false )) {
1953
+ (exclude && name && matches(exclude, name))) {
1949
1954
  current = vnode;
1950
1955
  return rawVNode;
1951
1956
  }
@@ -2055,14 +2060,9 @@ function injectToKeepAliveRoot(hook, type, target, keepAliveRoot) {
2055
2060
  }, target);
2056
2061
  }
2057
2062
  function resetShapeFlag(vnode) {
2058
- let shapeFlag = vnode.shapeFlag;
2059
- if (shapeFlag & 256 /* ShapeFlags.COMPONENT_SHOULD_KEEP_ALIVE */) {
2060
- shapeFlag -= 256 /* ShapeFlags.COMPONENT_SHOULD_KEEP_ALIVE */;
2061
- }
2062
- if (shapeFlag & 512 /* ShapeFlags.COMPONENT_KEPT_ALIVE */) {
2063
- shapeFlag -= 512 /* ShapeFlags.COMPONENT_KEPT_ALIVE */;
2064
- }
2065
- vnode.shapeFlag = shapeFlag;
2063
+ // bitwise operations to remove keep alive flags
2064
+ vnode.shapeFlag &= ~256 /* ShapeFlags.COMPONENT_SHOULD_KEEP_ALIVE */;
2065
+ vnode.shapeFlag &= ~512 /* ShapeFlags.COMPONENT_KEPT_ALIVE */;
2066
2066
  }
2067
2067
  function getInnerChild(vnode) {
2068
2068
  return vnode.shapeFlag & 128 /* ShapeFlags.SUSPENSE */ ? vnode.ssContent : vnode;
@@ -2332,7 +2332,9 @@ fallback, noSlotted) {
2332
2332
  (currentRenderingInstance.parent &&
2333
2333
  isAsyncWrapper(currentRenderingInstance.parent) &&
2334
2334
  currentRenderingInstance.parent.isCE)) {
2335
- return createVNode('slot', name === 'default' ? null : { name }, fallback && fallback());
2335
+ if (name !== 'default')
2336
+ props.name = name;
2337
+ return createVNode('slot', props, fallback && fallback());
2336
2338
  }
2337
2339
  let slot = slots[name];
2338
2340
  // a compiled slot disables block tracking by default to avoid manual
@@ -2421,6 +2423,7 @@ const publicPropertiesMap =
2421
2423
  $nextTick: i => i.n || (i.n = nextTick.bind(i.proxy)),
2422
2424
  $watch: i => (instanceWatch.bind(i) )
2423
2425
  });
2426
+ const hasSetupBinding = (state, key) => state !== shared.EMPTY_OBJ && !state.__isScriptSetup && shared.hasOwn(state, key);
2424
2427
  const PublicInstanceProxyHandlers = {
2425
2428
  get({ _: instance }, key) {
2426
2429
  const { ctx, setupState, data, props, accessCache, type, appContext } = instance;
@@ -2446,7 +2449,7 @@ const PublicInstanceProxyHandlers = {
2446
2449
  // default: just fallthrough
2447
2450
  }
2448
2451
  }
2449
- else if (setupState !== shared.EMPTY_OBJ && shared.hasOwn(setupState, key)) {
2452
+ else if (hasSetupBinding(setupState, key)) {
2450
2453
  accessCache[key] = 1 /* AccessTypes.SETUP */;
2451
2454
  return setupState[key];
2452
2455
  }
@@ -2502,7 +2505,7 @@ const PublicInstanceProxyHandlers = {
2502
2505
  },
2503
2506
  set({ _: instance }, key, value) {
2504
2507
  const { data, setupState, ctx } = instance;
2505
- if (setupState !== shared.EMPTY_OBJ && shared.hasOwn(setupState, key)) {
2508
+ if (hasSetupBinding(setupState, key)) {
2506
2509
  setupState[key] = value;
2507
2510
  return true;
2508
2511
  }
@@ -2527,7 +2530,7 @@ const PublicInstanceProxyHandlers = {
2527
2530
  let normalizedProps;
2528
2531
  return (!!accessCache[key] ||
2529
2532
  (data !== shared.EMPTY_OBJ && shared.hasOwn(data, key)) ||
2530
- (setupState !== shared.EMPTY_OBJ && shared.hasOwn(setupState, key)) ||
2533
+ hasSetupBinding(setupState, key) ||
2531
2534
  ((normalizedProps = propsOptions[0]) && shared.hasOwn(normalizedProps, key)) ||
2532
2535
  shared.hasOwn(ctx, key) ||
2533
2536
  shared.hasOwn(publicPropertiesMap, key) ||
@@ -4944,6 +4947,10 @@ function traverseStaticChildren(n1, n2, shallow = false) {
4944
4947
  if (!shallow)
4945
4948
  traverseStaticChildren(c1, c2);
4946
4949
  }
4950
+ // #6852 also inherit for text nodes
4951
+ if (c2.type === Text) {
4952
+ c2.el = c1.el;
4953
+ }
4947
4954
  }
4948
4955
  }
4949
4956
  }
@@ -5084,6 +5091,7 @@ const TeleportImpl = {
5084
5091
  }
5085
5092
  }
5086
5093
  }
5094
+ updateCssVars(n2);
5087
5095
  },
5088
5096
  remove(vnode, parentComponent, parentSuspense, optimized, { um: unmount, o: { remove: hostRemove } }, doRemove) {
5089
5097
  const { shapeFlag, children, anchor, targetAnchor, target, props } = vnode;
@@ -5162,11 +5170,26 @@ function hydrateTeleport(node, vnode, parentComponent, parentSuspense, slotScope
5162
5170
  hydrateChildren(targetNode, vnode, target, parentComponent, parentSuspense, slotScopeIds, optimized);
5163
5171
  }
5164
5172
  }
5173
+ updateCssVars(vnode);
5165
5174
  }
5166
5175
  return vnode.anchor && nextSibling(vnode.anchor);
5167
5176
  }
5168
5177
  // Force-casted public typing for h and TSX props inference
5169
5178
  const Teleport = TeleportImpl;
5179
+ function updateCssVars(vnode) {
5180
+ // presence of .ut method indicates owner component uses css vars.
5181
+ // code path here can assume browser environment.
5182
+ const ctx = vnode.ctx;
5183
+ if (ctx && ctx.ut) {
5184
+ let node = vnode.children[0].el;
5185
+ while (node !== vnode.targetAnchor) {
5186
+ if (node.nodeType === 1)
5187
+ node.setAttribute('data-v-owner', ctx.uid);
5188
+ node = node.nextSibling;
5189
+ }
5190
+ ctx.ut();
5191
+ }
5192
+ }
5170
5193
 
5171
5194
  const Fragment = Symbol(undefined);
5172
5195
  const Text = Symbol(undefined);
@@ -5304,7 +5327,8 @@ function createBaseVNode(type, props = null, children = null, patchFlag = 0, dyn
5304
5327
  patchFlag,
5305
5328
  dynamicProps,
5306
5329
  dynamicChildren: null,
5307
- appContext: null
5330
+ appContext: null,
5331
+ ctx: currentRenderingInstance
5308
5332
  };
5309
5333
  if (needFullChildrenNormalization) {
5310
5334
  normalizeChildren(vnode, children);
@@ -5455,7 +5479,8 @@ function cloneVNode(vnode, extraProps, mergeRef = false) {
5455
5479
  ssContent: vnode.ssContent && cloneVNode(vnode.ssContent),
5456
5480
  ssFallback: vnode.ssFallback && cloneVNode(vnode.ssFallback),
5457
5481
  el: vnode.el,
5458
- anchor: vnode.anchor
5482
+ anchor: vnode.anchor,
5483
+ ctx: vnode.ctx
5459
5484
  };
5460
5485
  return cloned;
5461
5486
  }
@@ -6088,7 +6113,7 @@ function isMemoSame(cached, memo) {
6088
6113
  }
6089
6114
 
6090
6115
  // Core API ------------------------------------------------------------------
6091
- const version = "3.2.43";
6116
+ const version = "3.2.45";
6092
6117
  const _ssrUtils = {
6093
6118
  createComponentInstance,
6094
6119
  setupComponent,
@@ -366,14 +366,8 @@ export declare interface ComponentInternalInstance {
366
366
  /* Excluded from this release type: propsOptions */
367
367
  /* Excluded from this release type: emitsOptions */
368
368
  /* Excluded from this release type: inheritAttrs */
369
- /**
370
- * is custom element?
371
- */
372
- isCE?: boolean;
373
- /**
374
- * custom element specific HMR method
375
- */
376
- ceReload?: (newStyles?: string[]) => void;
369
+ /* Excluded from this release type: isCE */
370
+ /* Excluded from this release type: ceReload */
377
371
  proxy: ComponentPublicInstance | null;
378
372
  exposed: Record<string, any> | null;
379
373
  exposeProxy: Record<string, any> | null;
@@ -411,14 +405,9 @@ export declare interface ComponentInternalInstance {
411
405
  /* Excluded from this release type: da */
412
406
  /* Excluded from this release type: ec */
413
407
  /* Excluded from this release type: sp */
414
- /**
415
- * For caching bound $forceUpdate on public proxy access
416
- */
417
- f?: () => void;
418
- /**
419
- * For caching bound $nextTick on public proxy access
420
- */
421
- n?: () => Promise<void>;
408
+ /* Excluded from this release type: f */
409
+ /* Excluded from this release type: n */
410
+ /* Excluded from this release type: ut */
422
411
  }
423
412
 
424
413
  declare interface ComponentInternalOptions {
@@ -1875,6 +1864,7 @@ export declare interface VNode<HostNode = RendererNode, HostElement = RendererEl
1875
1864
  /* Excluded from this release type: dynamicProps */
1876
1865
  /* Excluded from this release type: dynamicChildren */
1877
1866
  appContext: AppContext | null;
1867
+ /* Excluded from this release type: ctx */
1878
1868
  /* Excluded from this release type: memo */
1879
1869
  /* Excluded from this release type: isCompatRoot */
1880
1870
  /* Excluded from this release type: ce */
@@ -520,12 +520,6 @@ function reload(id, newComp) {
520
520
  // components to be unmounted and re-mounted. Queue the update so that we
521
521
  // don't end up forcing the same parent to re-render multiple times.
522
522
  queueJob(instance.parent.update);
523
- // instance is the inner component of an async custom element
524
- // invoke to reset styles
525
- if (instance.parent.type.__asyncLoader &&
526
- instance.parent.ceReload) {
527
- instance.parent.ceReload(newComp.styles);
528
- }
529
523
  }
530
524
  else if (instance.appContext.reload) {
531
525
  // root instance mounted via createApp() has a reload method
@@ -1800,10 +1794,11 @@ function doWatch(source, cb, { immediate, deep, flush, onTrack, onTrigger } = EM
1800
1794
  callWithAsyncErrorHandling(cb, instance, 3 /* ErrorCodes.WATCH_CALLBACK */, [
1801
1795
  newValue,
1802
1796
  // pass undefined as the old value when it's changed for the first time
1803
- oldValue === INITIAL_WATCHER_VALUE ||
1804
- (isMultiSource && oldValue[0] === INITIAL_WATCHER_VALUE)
1805
- ? []
1806
- : oldValue,
1797
+ oldValue === INITIAL_WATCHER_VALUE
1798
+ ? undefined
1799
+ : (isMultiSource && oldValue[0] === INITIAL_WATCHER_VALUE)
1800
+ ? []
1801
+ : oldValue,
1807
1802
  onCleanup
1808
1803
  ]);
1809
1804
  oldValue = newValue;
@@ -2405,10 +2400,15 @@ function defineAsyncComponent(source) {
2405
2400
  }
2406
2401
  });
2407
2402
  }
2408
- function createInnerComp(comp, { vnode: { ref, props, children, shapeFlag }, parent }) {
2403
+ function createInnerComp(comp, parent) {
2404
+ const { ref, props, children, ce } = parent.vnode;
2409
2405
  const vnode = createVNode(comp, props, children);
2410
2406
  // ensure inner component inherits the async wrapper's ref owner
2411
2407
  vnode.ref = ref;
2408
+ // pass the custom element callback on to the inner comp
2409
+ // and remove it from the async wrapper
2410
+ vnode.ce = ce;
2411
+ delete parent.vnode.ce;
2412
2412
  return vnode;
2413
2413
  }
2414
2414
 
@@ -2574,8 +2574,7 @@ const KeepAliveImpl = {
2574
2574
  : comp);
2575
2575
  const { include, exclude, max } = props;
2576
2576
  if ((include && (!name || !matches(include, name))) ||
2577
- (exclude && name && matches(exclude, name)) ||
2578
- ((process.env.NODE_ENV !== 'production') && hmrDirtyComponents.has(comp))) {
2577
+ (exclude && name && matches(exclude, name))) {
2579
2578
  current = vnode;
2580
2579
  return rawVNode;
2581
2580
  }
@@ -2685,14 +2684,9 @@ function injectToKeepAliveRoot(hook, type, target, keepAliveRoot) {
2685
2684
  }, target);
2686
2685
  }
2687
2686
  function resetShapeFlag(vnode) {
2688
- let shapeFlag = vnode.shapeFlag;
2689
- if (shapeFlag & 256 /* ShapeFlags.COMPONENT_SHOULD_KEEP_ALIVE */) {
2690
- shapeFlag -= 256 /* ShapeFlags.COMPONENT_SHOULD_KEEP_ALIVE */;
2691
- }
2692
- if (shapeFlag & 512 /* ShapeFlags.COMPONENT_KEPT_ALIVE */) {
2693
- shapeFlag -= 512 /* ShapeFlags.COMPONENT_KEPT_ALIVE */;
2694
- }
2695
- vnode.shapeFlag = shapeFlag;
2687
+ // bitwise operations to remove keep alive flags
2688
+ vnode.shapeFlag &= ~256 /* ShapeFlags.COMPONENT_SHOULD_KEEP_ALIVE */;
2689
+ vnode.shapeFlag &= ~512 /* ShapeFlags.COMPONENT_KEPT_ALIVE */;
2696
2690
  }
2697
2691
  function getInnerChild(vnode) {
2698
2692
  return vnode.shapeFlag & 128 /* ShapeFlags.SUSPENSE */ ? vnode.ssContent : vnode;
@@ -2991,7 +2985,9 @@ fallback, noSlotted) {
2991
2985
  (currentRenderingInstance.parent &&
2992
2986
  isAsyncWrapper(currentRenderingInstance.parent) &&
2993
2987
  currentRenderingInstance.parent.isCE)) {
2994
- return createVNode('slot', name === 'default' ? null : { name }, fallback && fallback());
2988
+ if (name !== 'default')
2989
+ props.name = name;
2990
+ return createVNode('slot', props, fallback && fallback());
2995
2991
  }
2996
2992
  let slot = slots[name];
2997
2993
  if ((process.env.NODE_ENV !== 'production') && slot && slot.length > 1) {
@@ -3091,6 +3087,7 @@ const publicPropertiesMap =
3091
3087
  $watch: i => (__VUE_OPTIONS_API__ ? instanceWatch.bind(i) : NOOP)
3092
3088
  });
3093
3089
  const isReservedPrefix = (key) => key === '_' || key === '$';
3090
+ const hasSetupBinding = (state, key) => state !== EMPTY_OBJ && !state.__isScriptSetup && hasOwn(state, key);
3094
3091
  const PublicInstanceProxyHandlers = {
3095
3092
  get({ _: instance }, key) {
3096
3093
  const { ctx, setupState, data, props, accessCache, type, appContext } = instance;
@@ -3098,16 +3095,6 @@ const PublicInstanceProxyHandlers = {
3098
3095
  if ((process.env.NODE_ENV !== 'production') && key === '__isVue') {
3099
3096
  return true;
3100
3097
  }
3101
- // prioritize <script setup> bindings during dev.
3102
- // this allows even properties that start with _ or $ to be used - so that
3103
- // it aligns with the production behavior where the render fn is inlined and
3104
- // indeed has access to all declared variables.
3105
- if ((process.env.NODE_ENV !== 'production') &&
3106
- setupState !== EMPTY_OBJ &&
3107
- setupState.__isScriptSetup &&
3108
- hasOwn(setupState, key)) {
3109
- return setupState[key];
3110
- }
3111
3098
  // data / props / ctx
3112
3099
  // This getter gets called for every property access on the render context
3113
3100
  // during render and is a major hotspot. The most expensive part of this
@@ -3130,7 +3117,7 @@ const PublicInstanceProxyHandlers = {
3130
3117
  // default: just fallthrough
3131
3118
  }
3132
3119
  }
3133
- else if (setupState !== EMPTY_OBJ && hasOwn(setupState, key)) {
3120
+ else if (hasSetupBinding(setupState, key)) {
3134
3121
  accessCache[key] = 1 /* AccessTypes.SETUP */;
3135
3122
  return setupState[key];
3136
3123
  }
@@ -3201,23 +3188,28 @@ const PublicInstanceProxyHandlers = {
3201
3188
  },
3202
3189
  set({ _: instance }, key, value) {
3203
3190
  const { data, setupState, ctx } = instance;
3204
- if (setupState !== EMPTY_OBJ && hasOwn(setupState, key)) {
3191
+ if (hasSetupBinding(setupState, key)) {
3205
3192
  setupState[key] = value;
3206
3193
  return true;
3207
3194
  }
3195
+ else if ((process.env.NODE_ENV !== 'production') &&
3196
+ setupState.__isScriptSetup &&
3197
+ hasOwn(setupState, key)) {
3198
+ warn(`Cannot mutate <script setup> binding "${key}" from Options API.`);
3199
+ return false;
3200
+ }
3208
3201
  else if (data !== EMPTY_OBJ && hasOwn(data, key)) {
3209
3202
  data[key] = value;
3210
3203
  return true;
3211
3204
  }
3212
3205
  else if (hasOwn(instance.props, key)) {
3213
- (process.env.NODE_ENV !== 'production') &&
3214
- warn(`Attempting to mutate prop "${key}". Props are readonly.`, instance);
3206
+ (process.env.NODE_ENV !== 'production') && warn(`Attempting to mutate prop "${key}". Props are readonly.`);
3215
3207
  return false;
3216
3208
  }
3217
3209
  if (key[0] === '$' && key.slice(1) in instance) {
3218
3210
  (process.env.NODE_ENV !== 'production') &&
3219
3211
  warn(`Attempting to mutate public property "${key}". ` +
3220
- `Properties starting with $ are reserved and readonly.`, instance);
3212
+ `Properties starting with $ are reserved and readonly.`);
3221
3213
  return false;
3222
3214
  }
3223
3215
  else {
@@ -3238,7 +3230,7 @@ const PublicInstanceProxyHandlers = {
3238
3230
  let normalizedProps;
3239
3231
  return (!!accessCache[key] ||
3240
3232
  (data !== EMPTY_OBJ && hasOwn(data, key)) ||
3241
- (setupState !== EMPTY_OBJ && hasOwn(setupState, key)) ||
3233
+ hasSetupBinding(setupState, key) ||
3242
3234
  ((normalizedProps = propsOptions[0]) && hasOwn(normalizedProps, key)) ||
3243
3235
  hasOwn(ctx, key) ||
3244
3236
  hasOwn(publicPropertiesMap, key) ||
@@ -6325,6 +6317,10 @@ function traverseStaticChildren(n1, n2, shallow = false) {
6325
6317
  if (!shallow)
6326
6318
  traverseStaticChildren(c1, c2);
6327
6319
  }
6320
+ // #6852 also inherit for text nodes
6321
+ if (c2.type === Text) {
6322
+ c2.el = c1.el;
6323
+ }
6328
6324
  // also inherit for comment nodes, but not placeholders (e.g. v-if which
6329
6325
  // would have received .el during block patch)
6330
6326
  if ((process.env.NODE_ENV !== 'production') && c2.type === Comment && !c2.el) {
@@ -6499,6 +6495,7 @@ const TeleportImpl = {
6499
6495
  }
6500
6496
  }
6501
6497
  }
6498
+ updateCssVars(n2);
6502
6499
  },
6503
6500
  remove(vnode, parentComponent, parentSuspense, optimized, { um: unmount, o: { remove: hostRemove } }, doRemove) {
6504
6501
  const { shapeFlag, children, anchor, targetAnchor, target, props } = vnode;
@@ -6577,11 +6574,26 @@ function hydrateTeleport(node, vnode, parentComponent, parentSuspense, slotScope
6577
6574
  hydrateChildren(targetNode, vnode, target, parentComponent, parentSuspense, slotScopeIds, optimized);
6578
6575
  }
6579
6576
  }
6577
+ updateCssVars(vnode);
6580
6578
  }
6581
6579
  return vnode.anchor && nextSibling(vnode.anchor);
6582
6580
  }
6583
6581
  // Force-casted public typing for h and TSX props inference
6584
6582
  const Teleport = TeleportImpl;
6583
+ function updateCssVars(vnode) {
6584
+ // presence of .ut method indicates owner component uses css vars.
6585
+ // code path here can assume browser environment.
6586
+ const ctx = vnode.ctx;
6587
+ if (ctx && ctx.ut) {
6588
+ let node = vnode.children[0].el;
6589
+ while (node !== vnode.targetAnchor) {
6590
+ if (node.nodeType === 1)
6591
+ node.setAttribute('data-v-owner', ctx.uid);
6592
+ node = node.nextSibling;
6593
+ }
6594
+ ctx.ut();
6595
+ }
6596
+ }
6585
6597
 
6586
6598
  const Fragment = Symbol((process.env.NODE_ENV !== 'production') ? 'Fragment' : undefined);
6587
6599
  const Text = Symbol((process.env.NODE_ENV !== 'production') ? 'Text' : undefined);
@@ -6677,6 +6689,10 @@ function isSameVNodeType(n1, n2) {
6677
6689
  if ((process.env.NODE_ENV !== 'production') &&
6678
6690
  n2.shapeFlag & 6 /* ShapeFlags.COMPONENT */ &&
6679
6691
  hmrDirtyComponents.has(n2.type)) {
6692
+ // #7042, ensure the vnode being unmounted during HMR
6693
+ // bitwise operations to remove keep alive flags
6694
+ n1.shapeFlag &= ~256 /* ShapeFlags.COMPONENT_SHOULD_KEEP_ALIVE */;
6695
+ n2.shapeFlag &= ~512 /* ShapeFlags.COMPONENT_KEPT_ALIVE */;
6680
6696
  // HMR only: if the component has been hot-updated, force a reload.
6681
6697
  return false;
6682
6698
  }
@@ -6732,7 +6748,8 @@ function createBaseVNode(type, props = null, children = null, patchFlag = 0, dyn
6732
6748
  patchFlag,
6733
6749
  dynamicProps,
6734
6750
  dynamicChildren: null,
6735
- appContext: null
6751
+ appContext: null,
6752
+ ctx: currentRenderingInstance
6736
6753
  };
6737
6754
  if (needFullChildrenNormalization) {
6738
6755
  normalizeChildren(vnode, children);
@@ -6899,7 +6916,8 @@ function cloneVNode(vnode, extraProps, mergeRef = false) {
6899
6916
  ssContent: vnode.ssContent && cloneVNode(vnode.ssContent),
6900
6917
  ssFallback: vnode.ssFallback && cloneVNode(vnode.ssFallback),
6901
6918
  el: vnode.el,
6902
- anchor: vnode.anchor
6919
+ anchor: vnode.anchor,
6920
+ ctx: vnode.ctx
6903
6921
  };
6904
6922
  return cloned;
6905
6923
  }
@@ -7897,7 +7915,7 @@ function isMemoSame(cached, memo) {
7897
7915
  }
7898
7916
 
7899
7917
  // Core API ------------------------------------------------------------------
7900
- const version = "3.2.43";
7918
+ const version = "3.2.45";
7901
7919
  const _ssrUtils = {
7902
7920
  createComponentInstance,
7903
7921
  setupComponent,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vue/runtime-core",
3
- "version": "3.2.43",
3
+ "version": "3.2.45",
4
4
  "description": "@vue/runtime-core",
5
5
  "main": "index.js",
6
6
  "module": "dist/runtime-core.esm-bundler.js",
@@ -32,7 +32,7 @@
32
32
  },
33
33
  "homepage": "https://github.com/vuejs/core/tree/main/packages/runtime-core#readme",
34
34
  "dependencies": {
35
- "@vue/shared": "3.2.43",
36
- "@vue/reactivity": "3.2.43"
35
+ "@vue/shared": "3.2.45",
36
+ "@vue/reactivity": "3.2.45"
37
37
  }
38
38
  }