@cabloy/vue-runtime-core 3.4.35 → 3.4.36

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/README.md CHANGED
@@ -13,7 +13,7 @@ const { render, createApp } = createRenderer({
13
13
  patchProp,
14
14
  insert,
15
15
  remove,
16
- createElement
16
+ createElement,
17
17
  // ...
18
18
  })
19
19
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @cabloy/vue-runtime-core v3.4.34
2
+ * @cabloy/vue-runtime-core v3.4.37
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -1359,7 +1359,7 @@ const KeepAliveImpl = {
1359
1359
  }
1360
1360
  function pruneCacheEntry(key) {
1361
1361
  const cached = cache.get(key);
1362
- if (!current || !isSameVNodeType(cached, current)) {
1362
+ if (cached && (!current || !isSameVNodeType(cached, current))) {
1363
1363
  unmount(cached);
1364
1364
  } else if (current) {
1365
1365
  resetShapeFlag(current);
@@ -1421,6 +1421,10 @@ const KeepAliveImpl = {
1421
1421
  return rawVNode;
1422
1422
  }
1423
1423
  let vnode = getInnerChild(rawVNode);
1424
+ if (vnode.type === Comment) {
1425
+ current = null;
1426
+ return vnode;
1427
+ }
1424
1428
  const comp = vnode.type;
1425
1429
  const name = getComponentName(
1426
1430
  isAsyncWrapper(vnode) ? vnode.type.__asyncResolved || {} : comp
@@ -2716,7 +2720,7 @@ function provide(key, value) {
2716
2720
  function inject(key, defaultValue, treatDefaultAsFactory = false) {
2717
2721
  const instance = currentInstance || currentRenderingInstance;
2718
2722
  if (instance || currentApp) {
2719
- const provides = instance ? instance.parent == null ? instance.vnode.appContext && instance.vnode.appContext.provides : instance.parent.provides : currentApp._context.provides;
2723
+ const provides = currentApp ? currentApp._context.provides : instance ? instance.parent == null ? instance.vnode.appContext && instance.vnode.appContext.provides : instance.parent.provides : void 0;
2720
2724
  if (provides && key in provides) {
2721
2725
  return provides[key];
2722
2726
  } else if (arguments.length > 1) {
@@ -2985,14 +2989,27 @@ function normalizePropsOptions(comp, appContext, asMixin = false) {
2985
2989
  if (validatePropName(normalizedKey)) {
2986
2990
  const opt = raw[key];
2987
2991
  const prop = normalized[normalizedKey] = shared.isArray(opt) || shared.isFunction(opt) ? { type: opt } : shared.extend({}, opt);
2988
- if (prop) {
2989
- const booleanIndex = getTypeIndex(Boolean, prop.type);
2990
- const stringIndex = getTypeIndex(String, prop.type);
2991
- prop[0 /* shouldCast */] = booleanIndex > -1;
2992
- prop[1 /* shouldCastTrue */] = stringIndex < 0 || booleanIndex < stringIndex;
2993
- if (booleanIndex > -1 || shared.hasOwn(prop, "default")) {
2994
- needCastKeys.push(normalizedKey);
2992
+ const propType = prop.type;
2993
+ let shouldCast = false;
2994
+ let shouldCastTrue = true;
2995
+ if (shared.isArray(propType)) {
2996
+ for (let index = 0; index < propType.length; ++index) {
2997
+ const type = propType[index];
2998
+ const typeName = shared.isFunction(type) && type.name;
2999
+ if (typeName === "Boolean") {
3000
+ shouldCast = true;
3001
+ break;
3002
+ } else if (typeName === "String") {
3003
+ shouldCastTrue = false;
3004
+ }
2995
3005
  }
3006
+ } else {
3007
+ shouldCast = shared.isFunction(propType) && propType.name === "Boolean";
3008
+ }
3009
+ prop[0 /* shouldCast */] = shouldCast;
3010
+ prop[1 /* shouldCastTrue */] = shouldCastTrue;
3011
+ if (shouldCast || shared.hasOwn(prop, "default")) {
3012
+ needCastKeys.push(normalizedKey);
2996
3013
  }
2997
3014
  }
2998
3015
  }
@@ -3023,17 +3040,6 @@ function getType(ctor) {
3023
3040
  }
3024
3041
  return "";
3025
3042
  }
3026
- function isSameType(a, b) {
3027
- return getType(a) === getType(b);
3028
- }
3029
- function getTypeIndex(type, expectedTypes) {
3030
- if (shared.isArray(expectedTypes)) {
3031
- return expectedTypes.findIndex((t) => isSameType(t, type));
3032
- } else if (shared.isFunction(expectedTypes)) {
3033
- return isSameType(expectedTypes, type) ? 0 : -1;
3034
- }
3035
- return -1;
3036
- }
3037
3043
  function validateProps(rawProps, props, instance) {
3038
3044
  const resolvedValues = reactivity.toRaw(props);
3039
3045
  const options = instance.propsOptions[0];
@@ -3373,15 +3379,11 @@ const TeleportImpl = {
3373
3379
  if (n1 == null) {
3374
3380
  const placeholder = n2.el = createComment("teleport start") ;
3375
3381
  const mainAnchor = n2.anchor = createComment("teleport end") ;
3376
- const target = n2.target = resolveTarget(n2.props, querySelector);
3377
- const targetStart = n2.targetStart = createText("");
3378
- const targetAnchor = n2.targetAnchor = createText("");
3379
3382
  insert(placeholder, container, anchor);
3380
3383
  insert(mainAnchor, container, anchor);
3381
- targetStart[TeleportEndKey] = targetAnchor;
3384
+ const target = n2.target = resolveTarget(n2.props, querySelector);
3385
+ const targetAnchor = prepareAnchor(target, n2, createText, insert);
3382
3386
  if (target) {
3383
- insert(targetStart, target);
3384
- insert(targetAnchor, target);
3385
3387
  if (namespace === "svg" || isTargetSVG(target)) {
3386
3388
  namespace = "svg";
3387
3389
  } else if (namespace === "mathml" || isTargetMathML(target)) {
@@ -3553,7 +3555,7 @@ function moveTeleport(vnode, container, parentAnchor, { o: { insert }, m: move }
3553
3555
  }
3554
3556
  }
3555
3557
  function hydrateTeleport(node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized, {
3556
- o: { nextSibling, parentNode, querySelector }
3558
+ o: { nextSibling, parentNode, querySelector, insert, createText }
3557
3559
  }, hydrateChildren) {
3558
3560
  const target = vnode.target = resolveTarget(
3559
3561
  vnode.props,
@@ -3572,20 +3574,28 @@ function hydrateTeleport(node, vnode, parentComponent, parentSuspense, slotScope
3572
3574
  slotScopeIds,
3573
3575
  optimized
3574
3576
  );
3575
- vnode.targetAnchor = targetNode;
3577
+ vnode.targetStart = targetNode;
3578
+ vnode.targetAnchor = targetNode && nextSibling(targetNode);
3576
3579
  } else {
3577
3580
  vnode.anchor = nextSibling(node);
3578
3581
  let targetAnchor = targetNode;
3579
3582
  while (targetAnchor) {
3580
- targetAnchor = nextSibling(targetAnchor);
3581
- if (targetAnchor && targetAnchor.nodeType === 8 && targetAnchor.data === "teleport anchor") {
3582
- vnode.targetAnchor = targetAnchor;
3583
- target._lpa = vnode.targetAnchor && nextSibling(vnode.targetAnchor);
3584
- break;
3583
+ if (targetAnchor && targetAnchor.nodeType === 8) {
3584
+ if (targetAnchor.data === "teleport start anchor") {
3585
+ vnode.targetStart = targetAnchor;
3586
+ } else if (targetAnchor.data === "teleport anchor") {
3587
+ vnode.targetAnchor = targetAnchor;
3588
+ target._lpa = vnode.targetAnchor && nextSibling(vnode.targetAnchor);
3589
+ break;
3590
+ }
3585
3591
  }
3592
+ targetAnchor = nextSibling(targetAnchor);
3593
+ }
3594
+ if (!vnode.targetAnchor) {
3595
+ prepareAnchor(target, vnode, createText, insert);
3586
3596
  }
3587
3597
  hydrateChildren(
3588
- targetNode,
3598
+ targetNode && nextSibling(targetNode),
3589
3599
  vnode,
3590
3600
  target,
3591
3601
  parentComponent,
@@ -3611,6 +3621,16 @@ function updateCssVars(vnode) {
3611
3621
  ctx.ut();
3612
3622
  }
3613
3623
  }
3624
+ function prepareAnchor(target, vnode, createText, insert) {
3625
+ const targetStart = vnode.targetStart = createText("");
3626
+ const targetAnchor = vnode.targetAnchor = createText("");
3627
+ targetStart[TeleportEndKey] = targetAnchor;
3628
+ if (target) {
3629
+ insert(targetStart, target);
3630
+ insert(targetAnchor, target);
3631
+ }
3632
+ return targetAnchor;
3633
+ }
3614
3634
 
3615
3635
  let hasLoggedMismatchError = false;
3616
3636
  const logMismatchError = () => {
@@ -3894,6 +3914,7 @@ Server rendered element contains more child nodes than client vdom.`
3894
3914
  }
3895
3915
  if (props) {
3896
3916
  {
3917
+ const isCustomElement = el.tagName.includes("-");
3897
3918
  for (const key in props) {
3898
3919
  if (// #11189 skip if this node has directives that have created hooks
3899
3920
  // as it could have mutated the DOM in any possible way
@@ -3901,7 +3922,7 @@ Server rendered element contains more child nodes than client vdom.`
3901
3922
  logMismatchError();
3902
3923
  }
3903
3924
  if (forcePatch && (key.endsWith("value") || key === "indeterminate") || shared.isOn(key) && !shared.isReservedProp(key) || // force hydrate v-bind with .prop modifiers
3904
- key[0] === ".") {
3925
+ key[0] === "." || isCustomElement) {
3905
3926
  patchProp(el, key, null, props[key], void 0, parentComponent);
3906
3927
  }
3907
3928
  }
@@ -5599,13 +5620,13 @@ function baseCreateRenderer(options, createHydrationFns) {
5599
5620
  namespace
5600
5621
  );
5601
5622
  }
5623
+ container._vnode = vnode;
5602
5624
  if (!isFlushing) {
5603
5625
  isFlushing = true;
5604
5626
  flushPreFlushCbs();
5605
5627
  flushPostFlushCbs();
5606
5628
  isFlushing = false;
5607
5629
  }
5608
- container._vnode = vnode;
5609
5630
  };
5610
5631
  const internals = {
5611
5632
  p: patch,
@@ -6033,7 +6054,8 @@ function useModel(props, name, options = shared.EMPTY_OBJ) {
6033
6054
  return options.get ? options.get(localValue) : localValue;
6034
6055
  },
6035
6056
  set(value) {
6036
- if (!shared.hasChanged(value, localValue) && !(prevSetValue !== shared.EMPTY_OBJ && shared.hasChanged(value, prevSetValue))) {
6057
+ const emittedValue = options.set ? options.set(value) : value;
6058
+ if (!shared.hasChanged(emittedValue, localValue) && !(prevSetValue !== shared.EMPTY_OBJ && shared.hasChanged(value, prevSetValue))) {
6037
6059
  return;
6038
6060
  }
6039
6061
  const rawProps = i.vnode.props;
@@ -6042,7 +6064,6 @@ function useModel(props, name, options = shared.EMPTY_OBJ) {
6042
6064
  localValue = value;
6043
6065
  trigger();
6044
6066
  }
6045
- const emittedValue = options.set ? options.set(value) : value;
6046
6067
  i.emit(`update:${name}`, emittedValue);
6047
6068
  if (shared.hasChanged(value, emittedValue) && shared.hasChanged(value, prevSetValue) && !shared.hasChanged(emittedValue, prevEmittedValue)) {
6048
6069
  trigger();
@@ -6080,9 +6101,9 @@ function emit(instance, event, ...rawArgs) {
6080
6101
  } = instance;
6081
6102
  if (emitsOptions) {
6082
6103
  if (!(event in emitsOptions) && true) {
6083
- if (!propsOptions || !(shared.toHandlerKey(event) in propsOptions)) {
6104
+ if (!propsOptions || !(shared.toHandlerKey(shared.camelize(event)) in propsOptions)) {
6084
6105
  warn$1(
6085
- `Component emitted event "${event}" but it is neither declared in the emits option nor as an "${shared.toHandlerKey(event)}" prop.`
6106
+ `Component emitted event "${event}" but it is neither declared in the emits option nor as an "${shared.toHandlerKey(shared.camelize(event))}" prop.`
6086
6107
  );
6087
6108
  }
6088
6109
  } else {
@@ -8122,7 +8143,7 @@ function isMemoSame(cached, memo) {
8122
8143
  return true;
8123
8144
  }
8124
8145
 
8125
- const version = "3.4.34";
8146
+ const version = "3.4.37";
8126
8147
  const warn = warn$1 ;
8127
8148
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
8128
8149
  const devtools = devtools$1 ;
@@ -8134,7 +8155,8 @@ const _ssrUtils = {
8134
8155
  setCurrentRenderingInstance,
8135
8156
  isVNode: isVNode,
8136
8157
  normalizeVNode,
8137
- getComponentPublicInstance
8158
+ getComponentPublicInstance,
8159
+ ensureValidVNode
8138
8160
  };
8139
8161
  const ssrUtils = _ssrUtils ;
8140
8162
  const resolveFilter = null;
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @cabloy/vue-runtime-core v3.4.34
2
+ * @cabloy/vue-runtime-core v3.4.37
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -928,7 +928,7 @@ const KeepAliveImpl = {
928
928
  }
929
929
  function pruneCacheEntry(key) {
930
930
  const cached = cache.get(key);
931
- if (!current || !isSameVNodeType(cached, current)) {
931
+ if (cached && (!current || !isSameVNodeType(cached, current))) {
932
932
  unmount(cached);
933
933
  } else if (current) {
934
934
  resetShapeFlag(current);
@@ -987,6 +987,10 @@ const KeepAliveImpl = {
987
987
  return rawVNode;
988
988
  }
989
989
  let vnode = getInnerChild(rawVNode);
990
+ if (vnode.type === Comment) {
991
+ current = null;
992
+ return vnode;
993
+ }
990
994
  const comp = vnode.type;
991
995
  const name = getComponentName(
992
996
  isAsyncWrapper(vnode) ? vnode.type.__asyncResolved || {} : comp
@@ -1971,7 +1975,7 @@ function provide(key, value) {
1971
1975
  function inject(key, defaultValue, treatDefaultAsFactory = false) {
1972
1976
  const instance = currentInstance || currentRenderingInstance;
1973
1977
  if (instance || currentApp) {
1974
- const provides = instance ? instance.parent == null ? instance.vnode.appContext && instance.vnode.appContext.provides : instance.parent.provides : currentApp._context.provides;
1978
+ const provides = currentApp ? currentApp._context.provides : instance ? instance.parent == null ? instance.vnode.appContext && instance.vnode.appContext.provides : instance.parent.provides : void 0;
1975
1979
  if (provides && key in provides) {
1976
1980
  return provides[key];
1977
1981
  } else if (arguments.length > 1) {
@@ -2218,14 +2222,27 @@ function normalizePropsOptions(comp, appContext, asMixin = false) {
2218
2222
  if (validatePropName(normalizedKey)) {
2219
2223
  const opt = raw[key];
2220
2224
  const prop = normalized[normalizedKey] = shared.isArray(opt) || shared.isFunction(opt) ? { type: opt } : shared.extend({}, opt);
2221
- if (prop) {
2222
- const booleanIndex = getTypeIndex(Boolean, prop.type);
2223
- const stringIndex = getTypeIndex(String, prop.type);
2224
- prop[0 /* shouldCast */] = booleanIndex > -1;
2225
- prop[1 /* shouldCastTrue */] = stringIndex < 0 || booleanIndex < stringIndex;
2226
- if (booleanIndex > -1 || shared.hasOwn(prop, "default")) {
2227
- needCastKeys.push(normalizedKey);
2225
+ const propType = prop.type;
2226
+ let shouldCast = false;
2227
+ let shouldCastTrue = true;
2228
+ if (shared.isArray(propType)) {
2229
+ for (let index = 0; index < propType.length; ++index) {
2230
+ const type = propType[index];
2231
+ const typeName = shared.isFunction(type) && type.name;
2232
+ if (typeName === "Boolean") {
2233
+ shouldCast = true;
2234
+ break;
2235
+ } else if (typeName === "String") {
2236
+ shouldCastTrue = false;
2237
+ }
2228
2238
  }
2239
+ } else {
2240
+ shouldCast = shared.isFunction(propType) && propType.name === "Boolean";
2241
+ }
2242
+ prop[0 /* shouldCast */] = shouldCast;
2243
+ prop[1 /* shouldCastTrue */] = shouldCastTrue;
2244
+ if (shouldCast || shared.hasOwn(prop, "default")) {
2245
+ needCastKeys.push(normalizedKey);
2229
2246
  }
2230
2247
  }
2231
2248
  }
@@ -2242,29 +2259,6 @@ function validatePropName(key) {
2242
2259
  }
2243
2260
  return false;
2244
2261
  }
2245
- function getType(ctor) {
2246
- if (ctor === null) {
2247
- return "null";
2248
- }
2249
- if (typeof ctor === "function") {
2250
- return ctor.name || "";
2251
- } else if (typeof ctor === "object") {
2252
- const name = ctor.constructor && ctor.constructor.name;
2253
- return name || "";
2254
- }
2255
- return "";
2256
- }
2257
- function isSameType(a, b) {
2258
- return getType(a) === getType(b);
2259
- }
2260
- function getTypeIndex(type, expectedTypes) {
2261
- if (shared.isArray(expectedTypes)) {
2262
- return expectedTypes.findIndex((t) => isSameType(t, type));
2263
- } else if (shared.isFunction(expectedTypes)) {
2264
- return isSameType(expectedTypes, type) ? 0 : -1;
2265
- }
2266
- return -1;
2267
- }
2268
2262
 
2269
2263
  const isInternalKey = (key) => key[0] === "_" || key === "$stable";
2270
2264
  const normalizeSlotValue = (value) => shared.isArray(value) ? value.map(normalizeVNode) : [normalizeVNode(value)];
@@ -2460,15 +2454,11 @@ const TeleportImpl = {
2460
2454
  if (n1 == null) {
2461
2455
  const placeholder = n2.el = createText("");
2462
2456
  const mainAnchor = n2.anchor = createText("");
2463
- const target = n2.target = resolveTarget(n2.props, querySelector);
2464
- const targetStart = n2.targetStart = createText("");
2465
- const targetAnchor = n2.targetAnchor = createText("");
2466
2457
  insert(placeholder, container, anchor);
2467
2458
  insert(mainAnchor, container, anchor);
2468
- targetStart[TeleportEndKey] = targetAnchor;
2459
+ const target = n2.target = resolveTarget(n2.props, querySelector);
2460
+ const targetAnchor = prepareAnchor(target, n2, createText, insert);
2469
2461
  if (target) {
2470
- insert(targetStart, target);
2471
- insert(targetAnchor, target);
2472
2462
  if (namespace === "svg" || isTargetSVG(target)) {
2473
2463
  namespace = "svg";
2474
2464
  } else if (namespace === "mathml" || isTargetMathML(target)) {
@@ -2632,7 +2622,7 @@ function moveTeleport(vnode, container, parentAnchor, { o: { insert }, m: move }
2632
2622
  }
2633
2623
  }
2634
2624
  function hydrateTeleport(node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized, {
2635
- o: { nextSibling, parentNode, querySelector }
2625
+ o: { nextSibling, parentNode, querySelector, insert, createText }
2636
2626
  }, hydrateChildren) {
2637
2627
  const target = vnode.target = resolveTarget(
2638
2628
  vnode.props,
@@ -2651,20 +2641,28 @@ function hydrateTeleport(node, vnode, parentComponent, parentSuspense, slotScope
2651
2641
  slotScopeIds,
2652
2642
  optimized
2653
2643
  );
2654
- vnode.targetAnchor = targetNode;
2644
+ vnode.targetStart = targetNode;
2645
+ vnode.targetAnchor = targetNode && nextSibling(targetNode);
2655
2646
  } else {
2656
2647
  vnode.anchor = nextSibling(node);
2657
2648
  let targetAnchor = targetNode;
2658
2649
  while (targetAnchor) {
2659
- targetAnchor = nextSibling(targetAnchor);
2660
- if (targetAnchor && targetAnchor.nodeType === 8 && targetAnchor.data === "teleport anchor") {
2661
- vnode.targetAnchor = targetAnchor;
2662
- target._lpa = vnode.targetAnchor && nextSibling(vnode.targetAnchor);
2663
- break;
2650
+ if (targetAnchor && targetAnchor.nodeType === 8) {
2651
+ if (targetAnchor.data === "teleport start anchor") {
2652
+ vnode.targetStart = targetAnchor;
2653
+ } else if (targetAnchor.data === "teleport anchor") {
2654
+ vnode.targetAnchor = targetAnchor;
2655
+ target._lpa = vnode.targetAnchor && nextSibling(vnode.targetAnchor);
2656
+ break;
2657
+ }
2664
2658
  }
2659
+ targetAnchor = nextSibling(targetAnchor);
2660
+ }
2661
+ if (!vnode.targetAnchor) {
2662
+ prepareAnchor(target, vnode, createText, insert);
2665
2663
  }
2666
2664
  hydrateChildren(
2667
- targetNode,
2665
+ targetNode && nextSibling(targetNode),
2668
2666
  vnode,
2669
2667
  target,
2670
2668
  parentComponent,
@@ -2690,6 +2688,16 @@ function updateCssVars(vnode) {
2690
2688
  ctx.ut();
2691
2689
  }
2692
2690
  }
2691
+ function prepareAnchor(target, vnode, createText, insert) {
2692
+ const targetStart = vnode.targetStart = createText("");
2693
+ const targetAnchor = vnode.targetAnchor = createText("");
2694
+ targetStart[TeleportEndKey] = targetAnchor;
2695
+ if (target) {
2696
+ insert(targetStart, target);
2697
+ insert(targetAnchor, target);
2698
+ }
2699
+ return targetAnchor;
2700
+ }
2693
2701
 
2694
2702
  let hasLoggedMismatchError = false;
2695
2703
  const logMismatchError = () => {
@@ -2938,9 +2946,10 @@ function createHydrationFunctions(rendererInternals) {
2938
2946
  }
2939
2947
  if (props) {
2940
2948
  if (forcePatch || !optimized || patchFlag & (16 | 32)) {
2949
+ const isCustomElement = el.tagName.includes("-");
2941
2950
  for (const key in props) {
2942
2951
  if (forcePatch && (key.endsWith("value") || key === "indeterminate") || shared.isOn(key) && !shared.isReservedProp(key) || // force hydrate v-bind with .prop modifiers
2943
- key[0] === ".") {
2952
+ key[0] === "." || isCustomElement) {
2944
2953
  patchProp(el, key, null, props[key], void 0, parentComponent);
2945
2954
  }
2946
2955
  }
@@ -4342,13 +4351,13 @@ function baseCreateRenderer(options, createHydrationFns) {
4342
4351
  namespace
4343
4352
  );
4344
4353
  }
4354
+ container._vnode = vnode;
4345
4355
  if (!isFlushing) {
4346
4356
  isFlushing = true;
4347
4357
  flushPreFlushCbs();
4348
4358
  flushPostFlushCbs();
4349
4359
  isFlushing = false;
4350
4360
  }
4351
- container._vnode = vnode;
4352
4361
  };
4353
4362
  const internals = {
4354
4363
  p: patch,
@@ -4719,7 +4728,8 @@ function useModel(props, name, options = shared.EMPTY_OBJ) {
4719
4728
  return options.get ? options.get(localValue) : localValue;
4720
4729
  },
4721
4730
  set(value) {
4722
- if (!shared.hasChanged(value, localValue) && !(prevSetValue !== shared.EMPTY_OBJ && shared.hasChanged(value, prevSetValue))) {
4731
+ const emittedValue = options.set ? options.set(value) : value;
4732
+ if (!shared.hasChanged(emittedValue, localValue) && !(prevSetValue !== shared.EMPTY_OBJ && shared.hasChanged(value, prevSetValue))) {
4723
4733
  return;
4724
4734
  }
4725
4735
  const rawProps = i.vnode.props;
@@ -4728,7 +4738,6 @@ function useModel(props, name, options = shared.EMPTY_OBJ) {
4728
4738
  localValue = value;
4729
4739
  trigger();
4730
4740
  }
4731
- const emittedValue = options.set ? options.set(value) : value;
4732
4741
  i.emit(`update:${name}`, emittedValue);
4733
4742
  if (shared.hasChanged(value, emittedValue) && shared.hasChanged(value, prevSetValue) && !shared.hasChanged(emittedValue, prevEmittedValue)) {
4734
4743
  trigger();
@@ -6304,7 +6313,7 @@ function isMemoSame(cached, memo) {
6304
6313
  return true;
6305
6314
  }
6306
6315
 
6307
- const version = "3.4.34";
6316
+ const version = "3.4.37";
6308
6317
  const warn$1 = shared.NOOP;
6309
6318
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
6310
6319
  const devtools = void 0;
@@ -6316,7 +6325,8 @@ const _ssrUtils = {
6316
6325
  setCurrentRenderingInstance,
6317
6326
  isVNode: isVNode,
6318
6327
  normalizeVNode,
6319
- getComponentPublicInstance
6328
+ getComponentPublicInstance,
6329
+ ensureValidVNode
6320
6330
  };
6321
6331
  const ssrUtils = _ssrUtils ;
6322
6332
  const resolveFilter = null;
@@ -507,7 +507,7 @@ export interface ObjectDirective<T = any, V = any> {
507
507
  export type FunctionDirective<T = any, V = any> = DirectiveHook<T, any, V>;
508
508
  export type Directive<T = any, V = any> = ObjectDirective<T, V> | FunctionDirective<T, V>;
509
509
  type DirectiveModifiers = Record<string, boolean>;
510
- export type DirectiveArguments = Array<[Directive | undefined] | [Directive | undefined, any] | [Directive | undefined, any, string] | [Directive | undefined, any, string, DirectiveModifiers]>;
510
+ export type DirectiveArguments = Array<[Directive | undefined] | [Directive | undefined, any] | [Directive | undefined, any, string] | [Directive | undefined, any, string | undefined, DirectiveModifiers]>;
511
511
  /**
512
512
  * Adds directives to a VNode.
513
513
  */
@@ -846,7 +846,7 @@ declare enum TeleportMoveTypes {
846
846
  REORDER = 2
847
847
  }
848
848
  declare function moveTeleport(vnode: VNode, container: RendererElement, parentAnchor: RendererNode | null, { o: { insert }, m: move }: RendererInternals, moveType?: TeleportMoveTypes): void;
849
- declare function hydrateTeleport(node: Node, vnode: TeleportVNode, parentComponent: ComponentInternalInstance | null, parentSuspense: SuspenseBoundary | null, slotScopeIds: string[] | null, optimized: boolean, { o: { nextSibling, parentNode, querySelector }, }: RendererInternals<Node, Element>, hydrateChildren: (node: Node | null, vnode: VNode, container: Element, parentComponent: ComponentInternalInstance | null, parentSuspense: SuspenseBoundary | null, slotScopeIds: string[] | null, optimized: boolean) => Node | null): Node | null;
849
+ declare function hydrateTeleport(node: Node, vnode: TeleportVNode, parentComponent: ComponentInternalInstance | null, parentSuspense: SuspenseBoundary | null, slotScopeIds: string[] | null, optimized: boolean, { o: { nextSibling, parentNode, querySelector, insert, createText }, }: RendererInternals<Node, Element>, hydrateChildren: (node: Node | null, vnode: VNode, container: Element, parentComponent: ComponentInternalInstance | null, parentSuspense: SuspenseBoundary | null, slotScopeIds: string[] | null, optimized: boolean) => Node | null): Node | null;
850
850
  export declare const Teleport: {
851
851
  new (): {
852
852
  $props: VNodeProps & TeleportProps;
@@ -1147,7 +1147,7 @@ export declare function registerRuntimeCompiler(_compile: any): void;
1147
1147
  export declare const isRuntimeOnly: () => boolean;
1148
1148
 
1149
1149
  export type WatchEffect = (onCleanup: OnCleanup) => void;
1150
- export type WatchSource<T = any> = Ref<T, any> | ComputedRef<T> | (() => T);
1150
+ export type WatchSource<T = any> = Ref<T> | ComputedRef<T> | (() => T);
1151
1151
  export type WatchCallback<V = any, OV = any> = (value: V, oldValue: OV, onCleanup: OnCleanup) => any;
1152
1152
  type MaybeUndefined<T, I> = I extends true ? T | undefined : T;
1153
1153
  type MapSources<T, Immediate> = {
@@ -1357,7 +1357,7 @@ type InferDefaults<T> = {
1357
1357
  type NativeType = null | number | string | boolean | symbol | Function;
1358
1358
  type InferDefault<P, T> = ((props: P) => T & {}) | (T extends NativeType ? T : never);
1359
1359
  type PropsWithDefaults<T, Defaults extends InferDefaults<T>, BKeys extends keyof T> = Readonly<MappedOmit<T, keyof Defaults>> & {
1360
- readonly [K in keyof Defaults]-?: K extends keyof T ? Defaults[K] extends undefined ? T[K] : NotUndefined<T[K]> : never;
1360
+ readonly [K in keyof Defaults]-?: K extends keyof T ? Defaults[K] extends undefined ? IfAny<Defaults[K], NotUndefined<T[K]>, T[K]> : NotUndefined<T[K]> : never;
1361
1361
  } & {
1362
1362
  readonly [K in BKeys]-?: K extends keyof Defaults ? Defaults[K] extends undefined ? boolean | undefined : boolean : boolean;
1363
1363
  };
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @cabloy/vue-runtime-core v3.4.34
2
+ * @cabloy/vue-runtime-core v3.4.37
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -1361,7 +1361,7 @@ const KeepAliveImpl = {
1361
1361
  }
1362
1362
  function pruneCacheEntry(key) {
1363
1363
  const cached = cache.get(key);
1364
- if (!current || !isSameVNodeType(cached, current)) {
1364
+ if (cached && (!current || !isSameVNodeType(cached, current))) {
1365
1365
  unmount(cached);
1366
1366
  } else if (current) {
1367
1367
  resetShapeFlag(current);
@@ -1423,6 +1423,10 @@ const KeepAliveImpl = {
1423
1423
  return rawVNode;
1424
1424
  }
1425
1425
  let vnode = getInnerChild(rawVNode);
1426
+ if (vnode.type === Comment) {
1427
+ current = null;
1428
+ return vnode;
1429
+ }
1426
1430
  const comp = vnode.type;
1427
1431
  const name = getComponentName(
1428
1432
  isAsyncWrapper(vnode) ? vnode.type.__asyncResolved || {} : comp
@@ -2722,7 +2726,7 @@ function provide(key, value) {
2722
2726
  function inject(key, defaultValue, treatDefaultAsFactory = false) {
2723
2727
  const instance = currentInstance || currentRenderingInstance;
2724
2728
  if (instance || currentApp) {
2725
- const provides = instance ? instance.parent == null ? instance.vnode.appContext && instance.vnode.appContext.provides : instance.parent.provides : currentApp._context.provides;
2729
+ const provides = currentApp ? currentApp._context.provides : instance ? instance.parent == null ? instance.vnode.appContext && instance.vnode.appContext.provides : instance.parent.provides : void 0;
2726
2730
  if (provides && key in provides) {
2727
2731
  return provides[key];
2728
2732
  } else if (arguments.length > 1) {
@@ -2991,14 +2995,27 @@ function normalizePropsOptions(comp, appContext, asMixin = false) {
2991
2995
  if (validatePropName(normalizedKey)) {
2992
2996
  const opt = raw[key];
2993
2997
  const prop = normalized[normalizedKey] = isArray(opt) || isFunction(opt) ? { type: opt } : extend({}, opt);
2994
- if (prop) {
2995
- const booleanIndex = getTypeIndex(Boolean, prop.type);
2996
- const stringIndex = getTypeIndex(String, prop.type);
2997
- prop[0 /* shouldCast */] = booleanIndex > -1;
2998
- prop[1 /* shouldCastTrue */] = stringIndex < 0 || booleanIndex < stringIndex;
2999
- if (booleanIndex > -1 || hasOwn(prop, "default")) {
3000
- needCastKeys.push(normalizedKey);
2998
+ const propType = prop.type;
2999
+ let shouldCast = false;
3000
+ let shouldCastTrue = true;
3001
+ if (isArray(propType)) {
3002
+ for (let index = 0; index < propType.length; ++index) {
3003
+ const type = propType[index];
3004
+ const typeName = isFunction(type) && type.name;
3005
+ if (typeName === "Boolean") {
3006
+ shouldCast = true;
3007
+ break;
3008
+ } else if (typeName === "String") {
3009
+ shouldCastTrue = false;
3010
+ }
3001
3011
  }
3012
+ } else {
3013
+ shouldCast = isFunction(propType) && propType.name === "Boolean";
3014
+ }
3015
+ prop[0 /* shouldCast */] = shouldCast;
3016
+ prop[1 /* shouldCastTrue */] = shouldCastTrue;
3017
+ if (shouldCast || hasOwn(prop, "default")) {
3018
+ needCastKeys.push(normalizedKey);
3002
3019
  }
3003
3020
  }
3004
3021
  }
@@ -3029,17 +3046,6 @@ function getType(ctor) {
3029
3046
  }
3030
3047
  return "";
3031
3048
  }
3032
- function isSameType(a, b) {
3033
- return getType(a) === getType(b);
3034
- }
3035
- function getTypeIndex(type, expectedTypes) {
3036
- if (isArray(expectedTypes)) {
3037
- return expectedTypes.findIndex((t) => isSameType(t, type));
3038
- } else if (isFunction(expectedTypes)) {
3039
- return isSameType(expectedTypes, type) ? 0 : -1;
3040
- }
3041
- return -1;
3042
- }
3043
3049
  function validateProps(rawProps, props, instance) {
3044
3050
  const resolvedValues = toRaw(props);
3045
3051
  const options = instance.propsOptions[0];
@@ -3379,15 +3385,11 @@ const TeleportImpl = {
3379
3385
  if (n1 == null) {
3380
3386
  const placeholder = n2.el = !!(process.env.NODE_ENV !== "production") ? createComment("teleport start") : createText("");
3381
3387
  const mainAnchor = n2.anchor = !!(process.env.NODE_ENV !== "production") ? createComment("teleport end") : createText("");
3382
- const target = n2.target = resolveTarget(n2.props, querySelector);
3383
- const targetStart = n2.targetStart = createText("");
3384
- const targetAnchor = n2.targetAnchor = createText("");
3385
3388
  insert(placeholder, container, anchor);
3386
3389
  insert(mainAnchor, container, anchor);
3387
- targetStart[TeleportEndKey] = targetAnchor;
3390
+ const target = n2.target = resolveTarget(n2.props, querySelector);
3391
+ const targetAnchor = prepareAnchor(target, n2, createText, insert);
3388
3392
  if (target) {
3389
- insert(targetStart, target);
3390
- insert(targetAnchor, target);
3391
3393
  if (namespace === "svg" || isTargetSVG(target)) {
3392
3394
  namespace = "svg";
3393
3395
  } else if (namespace === "mathml" || isTargetMathML(target)) {
@@ -3559,7 +3561,7 @@ function moveTeleport(vnode, container, parentAnchor, { o: { insert }, m: move }
3559
3561
  }
3560
3562
  }
3561
3563
  function hydrateTeleport(node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized, {
3562
- o: { nextSibling, parentNode, querySelector }
3564
+ o: { nextSibling, parentNode, querySelector, insert, createText }
3563
3565
  }, hydrateChildren) {
3564
3566
  const target = vnode.target = resolveTarget(
3565
3567
  vnode.props,
@@ -3578,20 +3580,28 @@ function hydrateTeleport(node, vnode, parentComponent, parentSuspense, slotScope
3578
3580
  slotScopeIds,
3579
3581
  optimized
3580
3582
  );
3581
- vnode.targetAnchor = targetNode;
3583
+ vnode.targetStart = targetNode;
3584
+ vnode.targetAnchor = targetNode && nextSibling(targetNode);
3582
3585
  } else {
3583
3586
  vnode.anchor = nextSibling(node);
3584
3587
  let targetAnchor = targetNode;
3585
3588
  while (targetAnchor) {
3586
- targetAnchor = nextSibling(targetAnchor);
3587
- if (targetAnchor && targetAnchor.nodeType === 8 && targetAnchor.data === "teleport anchor") {
3588
- vnode.targetAnchor = targetAnchor;
3589
- target._lpa = vnode.targetAnchor && nextSibling(vnode.targetAnchor);
3590
- break;
3589
+ if (targetAnchor && targetAnchor.nodeType === 8) {
3590
+ if (targetAnchor.data === "teleport start anchor") {
3591
+ vnode.targetStart = targetAnchor;
3592
+ } else if (targetAnchor.data === "teleport anchor") {
3593
+ vnode.targetAnchor = targetAnchor;
3594
+ target._lpa = vnode.targetAnchor && nextSibling(vnode.targetAnchor);
3595
+ break;
3596
+ }
3591
3597
  }
3598
+ targetAnchor = nextSibling(targetAnchor);
3599
+ }
3600
+ if (!vnode.targetAnchor) {
3601
+ prepareAnchor(target, vnode, createText, insert);
3592
3602
  }
3593
3603
  hydrateChildren(
3594
- targetNode,
3604
+ targetNode && nextSibling(targetNode),
3595
3605
  vnode,
3596
3606
  target,
3597
3607
  parentComponent,
@@ -3617,6 +3627,16 @@ function updateCssVars(vnode) {
3617
3627
  ctx.ut();
3618
3628
  }
3619
3629
  }
3630
+ function prepareAnchor(target, vnode, createText, insert) {
3631
+ const targetStart = vnode.targetStart = createText("");
3632
+ const targetAnchor = vnode.targetAnchor = createText("");
3633
+ targetStart[TeleportEndKey] = targetAnchor;
3634
+ if (target) {
3635
+ insert(targetStart, target);
3636
+ insert(targetAnchor, target);
3637
+ }
3638
+ return targetAnchor;
3639
+ }
3620
3640
 
3621
3641
  let hasLoggedMismatchError = false;
3622
3642
  const logMismatchError = () => {
@@ -3900,6 +3920,7 @@ Server rendered element contains more child nodes than client vdom.`
3900
3920
  }
3901
3921
  if (props) {
3902
3922
  if (!!(process.env.NODE_ENV !== "production") || __VUE_PROD_HYDRATION_MISMATCH_DETAILS__ || forcePatch || !optimized || patchFlag & (16 | 32)) {
3923
+ const isCustomElement = el.tagName.includes("-");
3903
3924
  for (const key in props) {
3904
3925
  if ((!!(process.env.NODE_ENV !== "production") || __VUE_PROD_HYDRATION_MISMATCH_DETAILS__) && // #11189 skip if this node has directives that have created hooks
3905
3926
  // as it could have mutated the DOM in any possible way
@@ -3907,7 +3928,7 @@ Server rendered element contains more child nodes than client vdom.`
3907
3928
  logMismatchError();
3908
3929
  }
3909
3930
  if (forcePatch && (key.endsWith("value") || key === "indeterminate") || isOn(key) && !isReservedProp(key) || // force hydrate v-bind with .prop modifiers
3910
- key[0] === ".") {
3931
+ key[0] === "." || isCustomElement) {
3911
3932
  patchProp(el, key, null, props[key], void 0, parentComponent);
3912
3933
  }
3913
3934
  }
@@ -5654,13 +5675,13 @@ function baseCreateRenderer(options, createHydrationFns) {
5654
5675
  namespace
5655
5676
  );
5656
5677
  }
5678
+ container._vnode = vnode;
5657
5679
  if (!isFlushing) {
5658
5680
  isFlushing = true;
5659
5681
  flushPreFlushCbs();
5660
5682
  flushPostFlushCbs();
5661
5683
  isFlushing = false;
5662
5684
  }
5663
- container._vnode = vnode;
5664
5685
  };
5665
5686
  const internals = {
5666
5687
  p: patch,
@@ -6088,7 +6109,8 @@ function useModel(props, name, options = EMPTY_OBJ) {
6088
6109
  return options.get ? options.get(localValue) : localValue;
6089
6110
  },
6090
6111
  set(value) {
6091
- if (!hasChanged(value, localValue) && !(prevSetValue !== EMPTY_OBJ && hasChanged(value, prevSetValue))) {
6112
+ const emittedValue = options.set ? options.set(value) : value;
6113
+ if (!hasChanged(emittedValue, localValue) && !(prevSetValue !== EMPTY_OBJ && hasChanged(value, prevSetValue))) {
6092
6114
  return;
6093
6115
  }
6094
6116
  const rawProps = i.vnode.props;
@@ -6097,7 +6119,6 @@ function useModel(props, name, options = EMPTY_OBJ) {
6097
6119
  localValue = value;
6098
6120
  trigger();
6099
6121
  }
6100
- const emittedValue = options.set ? options.set(value) : value;
6101
6122
  i.emit(`update:${name}`, emittedValue);
6102
6123
  if (hasChanged(value, emittedValue) && hasChanged(value, prevSetValue) && !hasChanged(emittedValue, prevEmittedValue)) {
6103
6124
  trigger();
@@ -6135,9 +6156,9 @@ function emit(instance, event, ...rawArgs) {
6135
6156
  } = instance;
6136
6157
  if (emitsOptions) {
6137
6158
  if (!(event in emitsOptions) && true) {
6138
- if (!propsOptions || !(toHandlerKey(event) in propsOptions)) {
6159
+ if (!propsOptions || !(toHandlerKey(camelize(event)) in propsOptions)) {
6139
6160
  warn$1(
6140
- `Component emitted event "${event}" but it is neither declared in the emits option nor as an "${toHandlerKey(event)}" prop.`
6161
+ `Component emitted event "${event}" but it is neither declared in the emits option nor as an "${toHandlerKey(camelize(event))}" prop.`
6141
6162
  );
6142
6163
  }
6143
6164
  } else {
@@ -8191,7 +8212,7 @@ function isMemoSame(cached, memo) {
8191
8212
  return true;
8192
8213
  }
8193
8214
 
8194
- const version = "3.4.34";
8215
+ const version = "3.4.37";
8195
8216
  const warn = !!(process.env.NODE_ENV !== "production") ? warn$1 : NOOP;
8196
8217
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
8197
8218
  const devtools = !!(process.env.NODE_ENV !== "production") || true ? devtools$1 : void 0;
@@ -8203,7 +8224,8 @@ const _ssrUtils = {
8203
8224
  setCurrentRenderingInstance,
8204
8225
  isVNode: isVNode,
8205
8226
  normalizeVNode,
8206
- getComponentPublicInstance
8227
+ getComponentPublicInstance,
8228
+ ensureValidVNode
8207
8229
  };
8208
8230
  const ssrUtils = _ssrUtils ;
8209
8231
  const resolveFilter = null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cabloy/vue-runtime-core",
3
- "version": "3.4.35",
3
+ "version": "3.4.36",
4
4
  "description": "@vue/runtime-core",
5
5
  "main": "index.js",
6
6
  "module": "dist/runtime-core.esm-bundler.js",
@@ -46,7 +46,7 @@
46
46
  },
47
47
  "homepage": "https://github.com/vuejs/core/tree/main/packages/runtime-core#readme",
48
48
  "dependencies": {
49
- "@vue/shared": "3.4.34",
50
- "@vue/reactivity": "npm:@cabloy/vue-reactivity@3.4.35"
49
+ "@vue/shared": "3.4.37",
50
+ "@vue/reactivity": "npm:@cabloy/vue-reactivity@3.4.36"
51
51
  }
52
52
  }