@vue/runtime-core 3.2.44 → 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
@@ -2395,10 +2389,15 @@ function defineAsyncComponent(source) {
2395
2389
  }
2396
2390
  });
2397
2391
  }
2398
- function createInnerComp(comp, { vnode: { ref, props, children, shapeFlag }, parent }) {
2392
+ function createInnerComp(comp, parent) {
2393
+ const { ref, props, children, ce } = parent.vnode;
2399
2394
  const vnode = createVNode(comp, props, children);
2400
2395
  // ensure inner component inherits the async wrapper's ref owner
2401
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;
2402
2401
  return vnode;
2403
2402
  }
2404
2403
 
@@ -2564,8 +2563,7 @@ const KeepAliveImpl = {
2564
2563
  : comp);
2565
2564
  const { include, exclude, max } = props;
2566
2565
  if ((include && (!name || !matches(include, name))) ||
2567
- (exclude && name && matches(exclude, name)) ||
2568
- (hmrDirtyComponents.has(comp))) {
2566
+ (exclude && name && matches(exclude, name))) {
2569
2567
  current = vnode;
2570
2568
  return rawVNode;
2571
2569
  }
@@ -2675,14 +2673,9 @@ function injectToKeepAliveRoot(hook, type, target, keepAliveRoot) {
2675
2673
  }, target);
2676
2674
  }
2677
2675
  function resetShapeFlag(vnode) {
2678
- let shapeFlag = vnode.shapeFlag;
2679
- if (shapeFlag & 256 /* ShapeFlags.COMPONENT_SHOULD_KEEP_ALIVE */) {
2680
- shapeFlag -= 256 /* ShapeFlags.COMPONENT_SHOULD_KEEP_ALIVE */;
2681
- }
2682
- if (shapeFlag & 512 /* ShapeFlags.COMPONENT_KEPT_ALIVE */) {
2683
- shapeFlag -= 512 /* ShapeFlags.COMPONENT_KEPT_ALIVE */;
2684
- }
2685
- 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 */;
2686
2679
  }
2687
2680
  function getInnerChild(vnode) {
2688
2681
  return vnode.shapeFlag & 128 /* ShapeFlags.SUSPENSE */ ? vnode.ssContent : vnode;
@@ -2981,7 +2974,9 @@ fallback, noSlotted) {
2981
2974
  (currentRenderingInstance.parent &&
2982
2975
  isAsyncWrapper(currentRenderingInstance.parent) &&
2983
2976
  currentRenderingInstance.parent.isCE)) {
2984
- return createVNode('slot', name === 'default' ? null : { name }, fallback && fallback());
2977
+ if (name !== 'default')
2978
+ props.name = name;
2979
+ return createVNode('slot', props, fallback && fallback());
2985
2980
  }
2986
2981
  let slot = slots[name];
2987
2982
  if (slot && slot.length > 1) {
@@ -3081,6 +3076,7 @@ const publicPropertiesMap =
3081
3076
  $watch: i => (instanceWatch.bind(i) )
3082
3077
  });
3083
3078
  const isReservedPrefix = (key) => key === '_' || key === '$';
3079
+ const hasSetupBinding = (state, key) => state !== shared.EMPTY_OBJ && !state.__isScriptSetup && shared.hasOwn(state, key);
3084
3080
  const PublicInstanceProxyHandlers = {
3085
3081
  get({ _: instance }, key) {
3086
3082
  const { ctx, setupState, data, props, accessCache, type, appContext } = instance;
@@ -3088,15 +3084,6 @@ const PublicInstanceProxyHandlers = {
3088
3084
  if (key === '__isVue') {
3089
3085
  return true;
3090
3086
  }
3091
- // prioritize <script setup> bindings during dev.
3092
- // this allows even properties that start with _ or $ to be used - so that
3093
- // it aligns with the production behavior where the render fn is inlined and
3094
- // indeed has access to all declared variables.
3095
- if (setupState !== shared.EMPTY_OBJ &&
3096
- setupState.__isScriptSetup &&
3097
- shared.hasOwn(setupState, key)) {
3098
- return setupState[key];
3099
- }
3100
3087
  // data / props / ctx
3101
3088
  // This getter gets called for every property access on the render context
3102
3089
  // during render and is a major hotspot. The most expensive part of this
@@ -3119,7 +3106,7 @@ const PublicInstanceProxyHandlers = {
3119
3106
  // default: just fallthrough
3120
3107
  }
3121
3108
  }
3122
- else if (setupState !== shared.EMPTY_OBJ && shared.hasOwn(setupState, key)) {
3109
+ else if (hasSetupBinding(setupState, key)) {
3123
3110
  accessCache[key] = 1 /* AccessTypes.SETUP */;
3124
3111
  return setupState[key];
3125
3112
  }
@@ -3189,21 +3176,26 @@ const PublicInstanceProxyHandlers = {
3189
3176
  },
3190
3177
  set({ _: instance }, key, value) {
3191
3178
  const { data, setupState, ctx } = instance;
3192
- if (setupState !== shared.EMPTY_OBJ && shared.hasOwn(setupState, key)) {
3179
+ if (hasSetupBinding(setupState, key)) {
3193
3180
  setupState[key] = value;
3194
3181
  return true;
3195
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
+ }
3196
3188
  else if (data !== shared.EMPTY_OBJ && shared.hasOwn(data, key)) {
3197
3189
  data[key] = value;
3198
3190
  return true;
3199
3191
  }
3200
3192
  else if (shared.hasOwn(instance.props, key)) {
3201
- warn(`Attempting to mutate prop "${key}". Props are readonly.`, instance);
3193
+ warn(`Attempting to mutate prop "${key}". Props are readonly.`);
3202
3194
  return false;
3203
3195
  }
3204
3196
  if (key[0] === '$' && key.slice(1) in instance) {
3205
3197
  warn(`Attempting to mutate public property "${key}". ` +
3206
- `Properties starting with $ are reserved and readonly.`, instance);
3198
+ `Properties starting with $ are reserved and readonly.`);
3207
3199
  return false;
3208
3200
  }
3209
3201
  else {
@@ -3224,7 +3216,7 @@ const PublicInstanceProxyHandlers = {
3224
3216
  let normalizedProps;
3225
3217
  return (!!accessCache[key] ||
3226
3218
  (data !== shared.EMPTY_OBJ && shared.hasOwn(data, key)) ||
3227
- (setupState !== shared.EMPTY_OBJ && shared.hasOwn(setupState, key)) ||
3219
+ hasSetupBinding(setupState, key) ||
3228
3220
  ((normalizedProps = propsOptions[0]) && shared.hasOwn(normalizedProps, key)) ||
3229
3221
  shared.hasOwn(ctx, key) ||
3230
3222
  shared.hasOwn(publicPropertiesMap, key) ||
@@ -6263,6 +6255,10 @@ function traverseStaticChildren(n1, n2, shallow = false) {
6263
6255
  if (!shallow)
6264
6256
  traverseStaticChildren(c1, c2);
6265
6257
  }
6258
+ // #6852 also inherit for text nodes
6259
+ if (c2.type === Text) {
6260
+ c2.el = c1.el;
6261
+ }
6266
6262
  // also inherit for comment nodes, but not placeholders (e.g. v-if which
6267
6263
  // would have received .el during block patch)
6268
6264
  if (c2.type === Comment && !c2.el) {
@@ -6433,6 +6429,7 @@ const TeleportImpl = {
6433
6429
  }
6434
6430
  }
6435
6431
  }
6432
+ updateCssVars(n2);
6436
6433
  },
6437
6434
  remove(vnode, parentComponent, parentSuspense, optimized, { um: unmount, o: { remove: hostRemove } }, doRemove) {
6438
6435
  const { shapeFlag, children, anchor, targetAnchor, target, props } = vnode;
@@ -6511,11 +6508,26 @@ function hydrateTeleport(node, vnode, parentComponent, parentSuspense, slotScope
6511
6508
  hydrateChildren(targetNode, vnode, target, parentComponent, parentSuspense, slotScopeIds, optimized);
6512
6509
  }
6513
6510
  }
6511
+ updateCssVars(vnode);
6514
6512
  }
6515
6513
  return vnode.anchor && nextSibling(vnode.anchor);
6516
6514
  }
6517
6515
  // Force-casted public typing for h and TSX props inference
6518
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
+ }
6519
6531
 
6520
6532
  const Fragment = Symbol('Fragment' );
6521
6533
  const Text = Symbol('Text' );
@@ -6610,6 +6622,10 @@ function isVNode(value) {
6610
6622
  function isSameVNodeType(n1, n2) {
6611
6623
  if (n2.shapeFlag & 6 /* ShapeFlags.COMPONENT */ &&
6612
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 */;
6613
6629
  // HMR only: if the component has been hot-updated, force a reload.
6614
6630
  return false;
6615
6631
  }
@@ -6665,7 +6681,8 @@ function createBaseVNode(type, props = null, children = null, patchFlag = 0, dyn
6665
6681
  patchFlag,
6666
6682
  dynamicProps,
6667
6683
  dynamicChildren: null,
6668
- appContext: null
6684
+ appContext: null,
6685
+ ctx: currentRenderingInstance
6669
6686
  };
6670
6687
  if (needFullChildrenNormalization) {
6671
6688
  normalizeChildren(vnode, children);
@@ -6832,7 +6849,8 @@ function cloneVNode(vnode, extraProps, mergeRef = false) {
6832
6849
  ssContent: vnode.ssContent && cloneVNode(vnode.ssContent),
6833
6850
  ssFallback: vnode.ssFallback && cloneVNode(vnode.ssFallback),
6834
6851
  el: vnode.el,
6835
- anchor: vnode.anchor
6852
+ anchor: vnode.anchor,
6853
+ ctx: vnode.ctx
6836
6854
  };
6837
6855
  return cloned;
6838
6856
  }
@@ -7809,7 +7827,7 @@ function isMemoSame(cached, memo) {
7809
7827
  }
7810
7828
 
7811
7829
  // Core API ------------------------------------------------------------------
7812
- const version = "3.2.44";
7830
+ const version = "3.2.45";
7813
7831
  const _ssrUtils = {
7814
7832
  createComponentInstance,
7815
7833
  setupComponent,
@@ -1790,10 +1790,15 @@ function defineAsyncComponent(source) {
1790
1790
  }
1791
1791
  });
1792
1792
  }
1793
- function createInnerComp(comp, { vnode: { ref, props, children, shapeFlag }, parent }) {
1793
+ function createInnerComp(comp, parent) {
1794
+ const { ref, props, children, ce } = parent.vnode;
1794
1795
  const vnode = createVNode(comp, props, children);
1795
1796
  // ensure inner component inherits the async wrapper's ref owner
1796
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;
1797
1802
  return vnode;
1798
1803
  }
1799
1804
 
@@ -1945,8 +1950,7 @@ const KeepAliveImpl = {
1945
1950
  : comp);
1946
1951
  const { include, exclude, max } = props;
1947
1952
  if ((include && (!name || !matches(include, name))) ||
1948
- (exclude && name && matches(exclude, name)) ||
1949
- (false )) {
1953
+ (exclude && name && matches(exclude, name))) {
1950
1954
  current = vnode;
1951
1955
  return rawVNode;
1952
1956
  }
@@ -2056,14 +2060,9 @@ function injectToKeepAliveRoot(hook, type, target, keepAliveRoot) {
2056
2060
  }, target);
2057
2061
  }
2058
2062
  function resetShapeFlag(vnode) {
2059
- let shapeFlag = vnode.shapeFlag;
2060
- if (shapeFlag & 256 /* ShapeFlags.COMPONENT_SHOULD_KEEP_ALIVE */) {
2061
- shapeFlag -= 256 /* ShapeFlags.COMPONENT_SHOULD_KEEP_ALIVE */;
2062
- }
2063
- if (shapeFlag & 512 /* ShapeFlags.COMPONENT_KEPT_ALIVE */) {
2064
- shapeFlag -= 512 /* ShapeFlags.COMPONENT_KEPT_ALIVE */;
2065
- }
2066
- 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 */;
2067
2066
  }
2068
2067
  function getInnerChild(vnode) {
2069
2068
  return vnode.shapeFlag & 128 /* ShapeFlags.SUSPENSE */ ? vnode.ssContent : vnode;
@@ -2333,7 +2332,9 @@ fallback, noSlotted) {
2333
2332
  (currentRenderingInstance.parent &&
2334
2333
  isAsyncWrapper(currentRenderingInstance.parent) &&
2335
2334
  currentRenderingInstance.parent.isCE)) {
2336
- return createVNode('slot', name === 'default' ? null : { name }, fallback && fallback());
2335
+ if (name !== 'default')
2336
+ props.name = name;
2337
+ return createVNode('slot', props, fallback && fallback());
2337
2338
  }
2338
2339
  let slot = slots[name];
2339
2340
  // a compiled slot disables block tracking by default to avoid manual
@@ -2422,6 +2423,7 @@ const publicPropertiesMap =
2422
2423
  $nextTick: i => i.n || (i.n = nextTick.bind(i.proxy)),
2423
2424
  $watch: i => (instanceWatch.bind(i) )
2424
2425
  });
2426
+ const hasSetupBinding = (state, key) => state !== shared.EMPTY_OBJ && !state.__isScriptSetup && shared.hasOwn(state, key);
2425
2427
  const PublicInstanceProxyHandlers = {
2426
2428
  get({ _: instance }, key) {
2427
2429
  const { ctx, setupState, data, props, accessCache, type, appContext } = instance;
@@ -2447,7 +2449,7 @@ const PublicInstanceProxyHandlers = {
2447
2449
  // default: just fallthrough
2448
2450
  }
2449
2451
  }
2450
- else if (setupState !== shared.EMPTY_OBJ && shared.hasOwn(setupState, key)) {
2452
+ else if (hasSetupBinding(setupState, key)) {
2451
2453
  accessCache[key] = 1 /* AccessTypes.SETUP */;
2452
2454
  return setupState[key];
2453
2455
  }
@@ -2503,7 +2505,7 @@ const PublicInstanceProxyHandlers = {
2503
2505
  },
2504
2506
  set({ _: instance }, key, value) {
2505
2507
  const { data, setupState, ctx } = instance;
2506
- if (setupState !== shared.EMPTY_OBJ && shared.hasOwn(setupState, key)) {
2508
+ if (hasSetupBinding(setupState, key)) {
2507
2509
  setupState[key] = value;
2508
2510
  return true;
2509
2511
  }
@@ -2528,7 +2530,7 @@ const PublicInstanceProxyHandlers = {
2528
2530
  let normalizedProps;
2529
2531
  return (!!accessCache[key] ||
2530
2532
  (data !== shared.EMPTY_OBJ && shared.hasOwn(data, key)) ||
2531
- (setupState !== shared.EMPTY_OBJ && shared.hasOwn(setupState, key)) ||
2533
+ hasSetupBinding(setupState, key) ||
2532
2534
  ((normalizedProps = propsOptions[0]) && shared.hasOwn(normalizedProps, key)) ||
2533
2535
  shared.hasOwn(ctx, key) ||
2534
2536
  shared.hasOwn(publicPropertiesMap, key) ||
@@ -4945,6 +4947,10 @@ function traverseStaticChildren(n1, n2, shallow = false) {
4945
4947
  if (!shallow)
4946
4948
  traverseStaticChildren(c1, c2);
4947
4949
  }
4950
+ // #6852 also inherit for text nodes
4951
+ if (c2.type === Text) {
4952
+ c2.el = c1.el;
4953
+ }
4948
4954
  }
4949
4955
  }
4950
4956
  }
@@ -5085,6 +5091,7 @@ const TeleportImpl = {
5085
5091
  }
5086
5092
  }
5087
5093
  }
5094
+ updateCssVars(n2);
5088
5095
  },
5089
5096
  remove(vnode, parentComponent, parentSuspense, optimized, { um: unmount, o: { remove: hostRemove } }, doRemove) {
5090
5097
  const { shapeFlag, children, anchor, targetAnchor, target, props } = vnode;
@@ -5163,11 +5170,26 @@ function hydrateTeleport(node, vnode, parentComponent, parentSuspense, slotScope
5163
5170
  hydrateChildren(targetNode, vnode, target, parentComponent, parentSuspense, slotScopeIds, optimized);
5164
5171
  }
5165
5172
  }
5173
+ updateCssVars(vnode);
5166
5174
  }
5167
5175
  return vnode.anchor && nextSibling(vnode.anchor);
5168
5176
  }
5169
5177
  // Force-casted public typing for h and TSX props inference
5170
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
+ }
5171
5193
 
5172
5194
  const Fragment = Symbol(undefined);
5173
5195
  const Text = Symbol(undefined);
@@ -5305,7 +5327,8 @@ function createBaseVNode(type, props = null, children = null, patchFlag = 0, dyn
5305
5327
  patchFlag,
5306
5328
  dynamicProps,
5307
5329
  dynamicChildren: null,
5308
- appContext: null
5330
+ appContext: null,
5331
+ ctx: currentRenderingInstance
5309
5332
  };
5310
5333
  if (needFullChildrenNormalization) {
5311
5334
  normalizeChildren(vnode, children);
@@ -5456,7 +5479,8 @@ function cloneVNode(vnode, extraProps, mergeRef = false) {
5456
5479
  ssContent: vnode.ssContent && cloneVNode(vnode.ssContent),
5457
5480
  ssFallback: vnode.ssFallback && cloneVNode(vnode.ssFallback),
5458
5481
  el: vnode.el,
5459
- anchor: vnode.anchor
5482
+ anchor: vnode.anchor,
5483
+ ctx: vnode.ctx
5460
5484
  };
5461
5485
  return cloned;
5462
5486
  }
@@ -6089,7 +6113,7 @@ function isMemoSame(cached, memo) {
6089
6113
  }
6090
6114
 
6091
6115
  // Core API ------------------------------------------------------------------
6092
- const version = "3.2.44";
6116
+ const version = "3.2.45";
6093
6117
  const _ssrUtils = {
6094
6118
  createComponentInstance,
6095
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
@@ -2406,10 +2400,15 @@ function defineAsyncComponent(source) {
2406
2400
  }
2407
2401
  });
2408
2402
  }
2409
- function createInnerComp(comp, { vnode: { ref, props, children, shapeFlag }, parent }) {
2403
+ function createInnerComp(comp, parent) {
2404
+ const { ref, props, children, ce } = parent.vnode;
2410
2405
  const vnode = createVNode(comp, props, children);
2411
2406
  // ensure inner component inherits the async wrapper's ref owner
2412
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;
2413
2412
  return vnode;
2414
2413
  }
2415
2414
 
@@ -2575,8 +2574,7 @@ const KeepAliveImpl = {
2575
2574
  : comp);
2576
2575
  const { include, exclude, max } = props;
2577
2576
  if ((include && (!name || !matches(include, name))) ||
2578
- (exclude && name && matches(exclude, name)) ||
2579
- ((process.env.NODE_ENV !== 'production') && hmrDirtyComponents.has(comp))) {
2577
+ (exclude && name && matches(exclude, name))) {
2580
2578
  current = vnode;
2581
2579
  return rawVNode;
2582
2580
  }
@@ -2686,14 +2684,9 @@ function injectToKeepAliveRoot(hook, type, target, keepAliveRoot) {
2686
2684
  }, target);
2687
2685
  }
2688
2686
  function resetShapeFlag(vnode) {
2689
- let shapeFlag = vnode.shapeFlag;
2690
- if (shapeFlag & 256 /* ShapeFlags.COMPONENT_SHOULD_KEEP_ALIVE */) {
2691
- shapeFlag -= 256 /* ShapeFlags.COMPONENT_SHOULD_KEEP_ALIVE */;
2692
- }
2693
- if (shapeFlag & 512 /* ShapeFlags.COMPONENT_KEPT_ALIVE */) {
2694
- shapeFlag -= 512 /* ShapeFlags.COMPONENT_KEPT_ALIVE */;
2695
- }
2696
- 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 */;
2697
2690
  }
2698
2691
  function getInnerChild(vnode) {
2699
2692
  return vnode.shapeFlag & 128 /* ShapeFlags.SUSPENSE */ ? vnode.ssContent : vnode;
@@ -2992,7 +2985,9 @@ fallback, noSlotted) {
2992
2985
  (currentRenderingInstance.parent &&
2993
2986
  isAsyncWrapper(currentRenderingInstance.parent) &&
2994
2987
  currentRenderingInstance.parent.isCE)) {
2995
- return createVNode('slot', name === 'default' ? null : { name }, fallback && fallback());
2988
+ if (name !== 'default')
2989
+ props.name = name;
2990
+ return createVNode('slot', props, fallback && fallback());
2996
2991
  }
2997
2992
  let slot = slots[name];
2998
2993
  if ((process.env.NODE_ENV !== 'production') && slot && slot.length > 1) {
@@ -3092,6 +3087,7 @@ const publicPropertiesMap =
3092
3087
  $watch: i => (__VUE_OPTIONS_API__ ? instanceWatch.bind(i) : NOOP)
3093
3088
  });
3094
3089
  const isReservedPrefix = (key) => key === '_' || key === '$';
3090
+ const hasSetupBinding = (state, key) => state !== EMPTY_OBJ && !state.__isScriptSetup && hasOwn(state, key);
3095
3091
  const PublicInstanceProxyHandlers = {
3096
3092
  get({ _: instance }, key) {
3097
3093
  const { ctx, setupState, data, props, accessCache, type, appContext } = instance;
@@ -3099,16 +3095,6 @@ const PublicInstanceProxyHandlers = {
3099
3095
  if ((process.env.NODE_ENV !== 'production') && key === '__isVue') {
3100
3096
  return true;
3101
3097
  }
3102
- // prioritize <script setup> bindings during dev.
3103
- // this allows even properties that start with _ or $ to be used - so that
3104
- // it aligns with the production behavior where the render fn is inlined and
3105
- // indeed has access to all declared variables.
3106
- if ((process.env.NODE_ENV !== 'production') &&
3107
- setupState !== EMPTY_OBJ &&
3108
- setupState.__isScriptSetup &&
3109
- hasOwn(setupState, key)) {
3110
- return setupState[key];
3111
- }
3112
3098
  // data / props / ctx
3113
3099
  // This getter gets called for every property access on the render context
3114
3100
  // during render and is a major hotspot. The most expensive part of this
@@ -3131,7 +3117,7 @@ const PublicInstanceProxyHandlers = {
3131
3117
  // default: just fallthrough
3132
3118
  }
3133
3119
  }
3134
- else if (setupState !== EMPTY_OBJ && hasOwn(setupState, key)) {
3120
+ else if (hasSetupBinding(setupState, key)) {
3135
3121
  accessCache[key] = 1 /* AccessTypes.SETUP */;
3136
3122
  return setupState[key];
3137
3123
  }
@@ -3202,23 +3188,28 @@ const PublicInstanceProxyHandlers = {
3202
3188
  },
3203
3189
  set({ _: instance }, key, value) {
3204
3190
  const { data, setupState, ctx } = instance;
3205
- if (setupState !== EMPTY_OBJ && hasOwn(setupState, key)) {
3191
+ if (hasSetupBinding(setupState, key)) {
3206
3192
  setupState[key] = value;
3207
3193
  return true;
3208
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
+ }
3209
3201
  else if (data !== EMPTY_OBJ && hasOwn(data, key)) {
3210
3202
  data[key] = value;
3211
3203
  return true;
3212
3204
  }
3213
3205
  else if (hasOwn(instance.props, key)) {
3214
- (process.env.NODE_ENV !== 'production') &&
3215
- 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.`);
3216
3207
  return false;
3217
3208
  }
3218
3209
  if (key[0] === '$' && key.slice(1) in instance) {
3219
3210
  (process.env.NODE_ENV !== 'production') &&
3220
3211
  warn(`Attempting to mutate public property "${key}". ` +
3221
- `Properties starting with $ are reserved and readonly.`, instance);
3212
+ `Properties starting with $ are reserved and readonly.`);
3222
3213
  return false;
3223
3214
  }
3224
3215
  else {
@@ -3239,7 +3230,7 @@ const PublicInstanceProxyHandlers = {
3239
3230
  let normalizedProps;
3240
3231
  return (!!accessCache[key] ||
3241
3232
  (data !== EMPTY_OBJ && hasOwn(data, key)) ||
3242
- (setupState !== EMPTY_OBJ && hasOwn(setupState, key)) ||
3233
+ hasSetupBinding(setupState, key) ||
3243
3234
  ((normalizedProps = propsOptions[0]) && hasOwn(normalizedProps, key)) ||
3244
3235
  hasOwn(ctx, key) ||
3245
3236
  hasOwn(publicPropertiesMap, key) ||
@@ -6326,6 +6317,10 @@ function traverseStaticChildren(n1, n2, shallow = false) {
6326
6317
  if (!shallow)
6327
6318
  traverseStaticChildren(c1, c2);
6328
6319
  }
6320
+ // #6852 also inherit for text nodes
6321
+ if (c2.type === Text) {
6322
+ c2.el = c1.el;
6323
+ }
6329
6324
  // also inherit for comment nodes, but not placeholders (e.g. v-if which
6330
6325
  // would have received .el during block patch)
6331
6326
  if ((process.env.NODE_ENV !== 'production') && c2.type === Comment && !c2.el) {
@@ -6500,6 +6495,7 @@ const TeleportImpl = {
6500
6495
  }
6501
6496
  }
6502
6497
  }
6498
+ updateCssVars(n2);
6503
6499
  },
6504
6500
  remove(vnode, parentComponent, parentSuspense, optimized, { um: unmount, o: { remove: hostRemove } }, doRemove) {
6505
6501
  const { shapeFlag, children, anchor, targetAnchor, target, props } = vnode;
@@ -6578,11 +6574,26 @@ function hydrateTeleport(node, vnode, parentComponent, parentSuspense, slotScope
6578
6574
  hydrateChildren(targetNode, vnode, target, parentComponent, parentSuspense, slotScopeIds, optimized);
6579
6575
  }
6580
6576
  }
6577
+ updateCssVars(vnode);
6581
6578
  }
6582
6579
  return vnode.anchor && nextSibling(vnode.anchor);
6583
6580
  }
6584
6581
  // Force-casted public typing for h and TSX props inference
6585
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
+ }
6586
6597
 
6587
6598
  const Fragment = Symbol((process.env.NODE_ENV !== 'production') ? 'Fragment' : undefined);
6588
6599
  const Text = Symbol((process.env.NODE_ENV !== 'production') ? 'Text' : undefined);
@@ -6678,6 +6689,10 @@ function isSameVNodeType(n1, n2) {
6678
6689
  if ((process.env.NODE_ENV !== 'production') &&
6679
6690
  n2.shapeFlag & 6 /* ShapeFlags.COMPONENT */ &&
6680
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 */;
6681
6696
  // HMR only: if the component has been hot-updated, force a reload.
6682
6697
  return false;
6683
6698
  }
@@ -6733,7 +6748,8 @@ function createBaseVNode(type, props = null, children = null, patchFlag = 0, dyn
6733
6748
  patchFlag,
6734
6749
  dynamicProps,
6735
6750
  dynamicChildren: null,
6736
- appContext: null
6751
+ appContext: null,
6752
+ ctx: currentRenderingInstance
6737
6753
  };
6738
6754
  if (needFullChildrenNormalization) {
6739
6755
  normalizeChildren(vnode, children);
@@ -6900,7 +6916,8 @@ function cloneVNode(vnode, extraProps, mergeRef = false) {
6900
6916
  ssContent: vnode.ssContent && cloneVNode(vnode.ssContent),
6901
6917
  ssFallback: vnode.ssFallback && cloneVNode(vnode.ssFallback),
6902
6918
  el: vnode.el,
6903
- anchor: vnode.anchor
6919
+ anchor: vnode.anchor,
6920
+ ctx: vnode.ctx
6904
6921
  };
6905
6922
  return cloned;
6906
6923
  }
@@ -7898,7 +7915,7 @@ function isMemoSame(cached, memo) {
7898
7915
  }
7899
7916
 
7900
7917
  // Core API ------------------------------------------------------------------
7901
- const version = "3.2.44";
7918
+ const version = "3.2.45";
7902
7919
  const _ssrUtils = {
7903
7920
  createComponentInstance,
7904
7921
  setupComponent,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vue/runtime-core",
3
- "version": "3.2.44",
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.44",
36
- "@vue/reactivity": "3.2.44"
35
+ "@vue/shared": "3.2.45",
36
+ "@vue/reactivity": "3.2.45"
37
37
  }
38
38
  }