@cabloy/vue-runtime-core 3.4.24 → 3.4.26

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @cabloy/vue-runtime-core v3.4.21
2
+ * @cabloy/vue-runtime-core v3.4.23
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -207,11 +207,17 @@ function callWithAsyncErrorHandling(fn, instance, type, args) {
207
207
  }
208
208
  return res;
209
209
  }
210
- const values = [];
211
- for (let i = 0; i < fn.length; i++) {
212
- values.push(callWithAsyncErrorHandling(fn[i], instance, type, args));
210
+ if (shared.isArray(fn)) {
211
+ const values = [];
212
+ for (let i = 0; i < fn.length; i++) {
213
+ values.push(callWithAsyncErrorHandling(fn[i], instance, type, args));
214
+ }
215
+ return values;
216
+ } else {
217
+ warn$1(
218
+ `Invalid value type passed to callWithAsyncErrorHandling(): ${typeof fn}`
219
+ );
213
220
  }
214
- return values;
215
221
  }
216
222
  function handleError(err, instance, type, throwInDev = true) {
217
223
  const contextVNode = instance ? instance.vnode : null;
@@ -2396,11 +2402,19 @@ function emptyPlaceholder(vnode) {
2396
2402
  }
2397
2403
  }
2398
2404
  function getKeepAliveChild(vnode) {
2399
- return isKeepAlive(vnode) ? (
2400
- // #7121 ensure get the child component subtree in case
2401
- // it's been replaced during HMR
2402
- vnode.component ? vnode.component.subTree : vnode.children ? vnode.children[0] : void 0
2403
- ) : vnode;
2405
+ if (!isKeepAlive(vnode)) {
2406
+ return vnode;
2407
+ }
2408
+ if (vnode.component) {
2409
+ return vnode.component.subTree;
2410
+ }
2411
+ const { shapeFlag, children } = vnode;
2412
+ if (shapeFlag & 16) {
2413
+ return children[0];
2414
+ }
2415
+ if (shapeFlag & 32 && shared.isFunction(children.default)) {
2416
+ return children.default();
2417
+ }
2404
2418
  }
2405
2419
  function setTransitionHooks(vnode, hooks) {
2406
2420
  if (vnode.shapeFlag & 6 && vnode.component) {
@@ -2722,7 +2736,7 @@ const KeepAliveImpl = {
2722
2736
  return () => {
2723
2737
  pendingCacheKey = null;
2724
2738
  if (!slots.default) {
2725
- return null;
2739
+ return current = null;
2726
2740
  }
2727
2741
  const children = slots.default();
2728
2742
  const rawVNode = children[0];
@@ -3035,6 +3049,9 @@ const isReservedPrefix = (key) => key === "_" || key === "$";
3035
3049
  const hasSetupBinding = (state, key) => state !== shared.EMPTY_OBJ && !state.__isScriptSetup && shared.hasOwn(state, key);
3036
3050
  const PublicInstanceProxyHandlers = {
3037
3051
  get({ _: instance }, key) {
3052
+ if (key === "__v_skip") {
3053
+ return true;
3054
+ }
3038
3055
  const { ctx, setupState, data, props, accessCache, type, appContext } = instance;
3039
3056
  if (key === "__isVue") {
3040
3057
  return true;
@@ -3077,7 +3094,7 @@ const PublicInstanceProxyHandlers = {
3077
3094
  let cssModule, globalProperties;
3078
3095
  if (publicGetter) {
3079
3096
  if (key === "$attrs") {
3080
- reactivity.track(instance, "get", key);
3097
+ reactivity.track(instance.attrs, "get", "");
3081
3098
  markAttrsAccessed();
3082
3099
  } else if (key === "$slots") {
3083
3100
  reactivity.track(instance, "get", key);
@@ -4002,10 +4019,13 @@ function hasInjectionContext() {
4002
4019
  return !!(currentInstance || currentRenderingInstance || currentApp);
4003
4020
  }
4004
4021
 
4022
+ const internalObjectProto = /* @__PURE__ */ Object.create(null);
4023
+ const createInternalObject = () => Object.create(internalObjectProto);
4024
+ const isInternalObject = (obj) => Object.getPrototypeOf(obj) === internalObjectProto;
4025
+
4005
4026
  function initProps(instance, rawProps, isStateful, isSSR = false) {
4006
4027
  const props = {};
4007
- const attrs = {};
4008
- shared.def(attrs, InternalObjectKey, 1);
4028
+ const attrs = createInternalObject();
4009
4029
  instance.propsDefaults = /* @__PURE__ */ Object.create(null);
4010
4030
  setFullProps(instance, rawProps, props, attrs);
4011
4031
  for (const key in instance.propsOptions[0]) {
@@ -4120,7 +4140,7 @@ function updateProps(instance, rawProps, rawPrevProps, optimized) {
4120
4140
  }
4121
4141
  }
4122
4142
  if (hasAttrsChanged) {
4123
- reactivity.trigger(instance, "set", "$attrs");
4143
+ reactivity.trigger(instance.attrs, "set", "");
4124
4144
  }
4125
4145
  {
4126
4146
  validateProps(rawProps || {}, props, instance);
@@ -4452,23 +4472,18 @@ const normalizeVNodeSlots = (instance, children) => {
4452
4472
  instance.slots.default = () => normalized;
4453
4473
  };
4454
4474
  const initSlots = (instance, children) => {
4475
+ const slots = instance.slots = createInternalObject();
4455
4476
  if (instance.vnode.shapeFlag & 32) {
4456
4477
  const type = children._;
4457
4478
  if (type) {
4458
- instance.slots = reactivity.toRaw(children);
4459
- shared.def(children, "_", type);
4479
+ shared.extend(slots, children);
4480
+ shared.def(slots, "_", type);
4460
4481
  } else {
4461
- normalizeObjectSlots(
4462
- children,
4463
- instance.slots = {});
4464
- }
4465
- } else {
4466
- instance.slots = {};
4467
- if (children) {
4468
- normalizeVNodeSlots(instance, children);
4482
+ normalizeObjectSlots(children, slots);
4469
4483
  }
4484
+ } else if (children) {
4485
+ normalizeVNodeSlots(instance, children);
4470
4486
  }
4471
- shared.def(instance.slots, InternalObjectKey, 1);
4472
4487
  };
4473
4488
  const updateSlots = (instance, children, optimized) => {
4474
4489
  const { vnode, slots } = instance;
@@ -4640,6 +4655,7 @@ function createHydrationFunctions(rendererInternals) {
4640
4655
  }
4641
4656
  };
4642
4657
  const hydrateNode = (node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized = false) => {
4658
+ optimized = optimized || !!vnode.dynamicChildren;
4643
4659
  const isFragmentStart = isComment(node) && node.data === "[";
4644
4660
  const onMismatch = () => handleMismatch(
4645
4661
  node,
@@ -7074,7 +7090,6 @@ const createVNodeWithArgsTransform = (...args) => {
7074
7090
  ...vnodeArgsTransformer ? vnodeArgsTransformer(args, currentRenderingInstance) : args
7075
7091
  );
7076
7092
  };
7077
- const InternalObjectKey = `__vInternal`;
7078
7093
  const normalizeKey = ({ key }) => key != null ? key : null;
7079
7094
  const normalizeRef = ({
7080
7095
  ref,
@@ -7207,7 +7222,7 @@ Component that was made reactive: `,
7207
7222
  function guardReactiveProps(props) {
7208
7223
  if (!props)
7209
7224
  return null;
7210
- return reactivity.isProxy(props) || InternalObjectKey in props ? shared.extend({}, props) : props;
7225
+ return reactivity.isProxy(props) || isInternalObject(props) ? shared.extend({}, props) : props;
7211
7226
  }
7212
7227
  function cloneVNode(vnode, extraProps, mergeRef = false) {
7213
7228
  const { props, ref, patchFlag, children } = vnode;
@@ -7312,7 +7327,7 @@ function normalizeChildren(vnode, children) {
7312
7327
  } else {
7313
7328
  type = 32;
7314
7329
  const slotFlag = children._;
7315
- if (!slotFlag && !(InternalObjectKey in children)) {
7330
+ if (!slotFlag && !isInternalObject(children)) {
7316
7331
  children._ctx = currentRenderingInstance;
7317
7332
  } else if (slotFlag === 3 && currentRenderingInstance) {
7318
7333
  if (currentRenderingInstance.slots._ === 1) {
@@ -7548,7 +7563,7 @@ function setupStatefulComponent(instance, isSSR) {
7548
7563
  }
7549
7564
  }
7550
7565
  instance.accessCache = /* @__PURE__ */ Object.create(null);
7551
- instance.proxy = reactivity.markRaw(new Proxy(instance.ctx, PublicInstanceProxyHandlers));
7566
+ instance.proxy = new Proxy(instance.ctx, PublicInstanceProxyHandlers);
7552
7567
  {
7553
7568
  exposePropsOnRenderContext(instance);
7554
7569
  }
@@ -7682,26 +7697,21 @@ function finishComponentSetup(instance, isSSR, skipOptions) {
7682
7697
  }
7683
7698
  }
7684
7699
  }
7685
- function getAttrsProxy(instance) {
7686
- return instance.attrsProxy || (instance.attrsProxy = new Proxy(
7687
- instance.attrs,
7688
- {
7689
- get(target, key) {
7690
- markAttrsAccessed();
7691
- reactivity.track(instance, "get", "$attrs");
7692
- return target[key];
7693
- },
7694
- set() {
7695
- warn$1(`setupContext.attrs is readonly.`);
7696
- return false;
7697
- },
7698
- deleteProperty() {
7699
- warn$1(`setupContext.attrs is readonly.`);
7700
- return false;
7701
- }
7702
- }
7703
- ));
7704
- }
7700
+ const attrsProxyHandlers = {
7701
+ get(target, key) {
7702
+ markAttrsAccessed();
7703
+ reactivity.track(target, "get", "");
7704
+ return target[key];
7705
+ },
7706
+ set() {
7707
+ warn$1(`setupContext.attrs is readonly.`);
7708
+ return false;
7709
+ },
7710
+ deleteProperty() {
7711
+ warn$1(`setupContext.attrs is readonly.`);
7712
+ return false;
7713
+ }
7714
+ } ;
7705
7715
  function getSlotsProxy(instance) {
7706
7716
  return instance.slotsProxy || (instance.slotsProxy = new Proxy(instance.slots, {
7707
7717
  get(target, key) {
@@ -7735,9 +7745,10 @@ function createSetupContext(instance) {
7735
7745
  instance.exposed = exposed || {};
7736
7746
  };
7737
7747
  {
7748
+ let attrsProxy;
7738
7749
  return Object.freeze({
7739
7750
  get attrs() {
7740
- return getAttrsProxy(instance);
7751
+ return attrsProxy || (attrsProxy = new Proxy(instance.attrs, attrsProxyHandlers));
7741
7752
  },
7742
7753
  get slots() {
7743
7754
  return getSlotsProxy(instance);
@@ -8082,7 +8093,7 @@ function isMemoSame(cached, memo) {
8082
8093
  return true;
8083
8094
  }
8084
8095
 
8085
- const version = "3.4.21";
8096
+ const version = "3.4.23";
8086
8097
  const warn = warn$1 ;
8087
8098
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
8088
8099
  const devtools = devtools$1 ;
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @cabloy/vue-runtime-core v3.4.21
2
+ * @cabloy/vue-runtime-core v3.4.23
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -94,11 +94,13 @@ function callWithAsyncErrorHandling(fn, instance, type, args) {
94
94
  }
95
95
  return res;
96
96
  }
97
- const values = [];
98
- for (let i = 0; i < fn.length; i++) {
99
- values.push(callWithAsyncErrorHandling(fn[i], instance, type, args));
97
+ if (shared.isArray(fn)) {
98
+ const values = [];
99
+ for (let i = 0; i < fn.length; i++) {
100
+ values.push(callWithAsyncErrorHandling(fn[i], instance, type, args));
101
+ }
102
+ return values;
100
103
  }
101
- return values;
102
104
  }
103
105
  function handleError(err, instance, type, throwInDev = true) {
104
106
  const contextVNode = instance ? instance.vnode : null;
@@ -1790,11 +1792,16 @@ function emptyPlaceholder(vnode) {
1790
1792
  }
1791
1793
  }
1792
1794
  function getKeepAliveChild(vnode) {
1793
- return isKeepAlive(vnode) ? (
1794
- // #7121 ensure get the child component subtree in case
1795
- // it's been replaced during HMR
1796
- vnode.children ? vnode.children[0] : void 0
1797
- ) : vnode;
1795
+ if (!isKeepAlive(vnode)) {
1796
+ return vnode;
1797
+ }
1798
+ const { shapeFlag, children } = vnode;
1799
+ if (shapeFlag & 16) {
1800
+ return children[0];
1801
+ }
1802
+ if (shapeFlag & 32 && shared.isFunction(children.default)) {
1803
+ return children.default();
1804
+ }
1798
1805
  }
1799
1806
  function setTransitionHooks(vnode, hooks) {
1800
1807
  if (vnode.shapeFlag & 6 && vnode.component) {
@@ -2099,7 +2106,7 @@ const KeepAliveImpl = {
2099
2106
  return () => {
2100
2107
  pendingCacheKey = null;
2101
2108
  if (!slots.default) {
2102
- return null;
2109
+ return current = null;
2103
2110
  }
2104
2111
  const children = slots.default();
2105
2112
  const rawVNode = children[0];
@@ -2390,6 +2397,9 @@ const publicPropertiesMap = (
2390
2397
  const hasSetupBinding = (state, key) => state !== shared.EMPTY_OBJ && !state.__isScriptSetup && shared.hasOwn(state, key);
2391
2398
  const PublicInstanceProxyHandlers = {
2392
2399
  get({ _: instance }, key) {
2400
+ if (key === "__v_skip") {
2401
+ return true;
2402
+ }
2393
2403
  const { ctx, setupState, data, props, accessCache, type, appContext } = instance;
2394
2404
  let normalizedProps;
2395
2405
  if (key[0] !== "$") {
@@ -2429,7 +2439,7 @@ const PublicInstanceProxyHandlers = {
2429
2439
  let cssModule, globalProperties;
2430
2440
  if (publicGetter) {
2431
2441
  if (key === "$attrs") {
2432
- reactivity.track(instance, "get", key);
2442
+ reactivity.track(instance.attrs, "get", "");
2433
2443
  }
2434
2444
  return publicGetter(instance);
2435
2445
  } else if (
@@ -3070,10 +3080,13 @@ function hasInjectionContext() {
3070
3080
  return !!(currentInstance || currentRenderingInstance || currentApp);
3071
3081
  }
3072
3082
 
3083
+ const internalObjectProto = /* @__PURE__ */ Object.create(null);
3084
+ const createInternalObject = () => Object.create(internalObjectProto);
3085
+ const isInternalObject = (obj) => Object.getPrototypeOf(obj) === internalObjectProto;
3086
+
3073
3087
  function initProps(instance, rawProps, isStateful, isSSR = false) {
3074
3088
  const props = {};
3075
- const attrs = {};
3076
- shared.def(attrs, InternalObjectKey, 1);
3089
+ const attrs = createInternalObject();
3077
3090
  instance.propsDefaults = /* @__PURE__ */ Object.create(null);
3078
3091
  setFullProps(instance, rawProps, props, attrs);
3079
3092
  for (const key in instance.propsOptions[0]) {
@@ -3178,7 +3191,7 @@ function updateProps(instance, rawProps, rawPrevProps, optimized) {
3178
3191
  }
3179
3192
  }
3180
3193
  if (hasAttrsChanged) {
3181
- reactivity.trigger(instance, "set", "$attrs");
3194
+ reactivity.trigger(instance.attrs, "set", "");
3182
3195
  }
3183
3196
  }
3184
3197
  function setFullProps(instance, rawProps, props, attrs) {
@@ -3382,23 +3395,18 @@ const normalizeVNodeSlots = (instance, children) => {
3382
3395
  instance.slots.default = () => normalized;
3383
3396
  };
3384
3397
  const initSlots = (instance, children) => {
3398
+ const slots = instance.slots = createInternalObject();
3385
3399
  if (instance.vnode.shapeFlag & 32) {
3386
3400
  const type = children._;
3387
3401
  if (type) {
3388
- instance.slots = reactivity.toRaw(children);
3389
- shared.def(children, "_", type);
3402
+ shared.extend(slots, children);
3403
+ shared.def(slots, "_", type);
3390
3404
  } else {
3391
- normalizeObjectSlots(
3392
- children,
3393
- instance.slots = {});
3394
- }
3395
- } else {
3396
- instance.slots = {};
3397
- if (children) {
3398
- normalizeVNodeSlots(instance, children);
3405
+ normalizeObjectSlots(children, slots);
3399
3406
  }
3407
+ } else if (children) {
3408
+ normalizeVNodeSlots(instance, children);
3400
3409
  }
3401
- shared.def(instance.slots, InternalObjectKey, 1);
3402
3410
  };
3403
3411
  const updateSlots = (instance, children, optimized) => {
3404
3412
  const { vnode, slots } = instance;
@@ -3554,6 +3562,7 @@ function createHydrationFunctions(rendererInternals) {
3554
3562
  }
3555
3563
  };
3556
3564
  const hydrateNode = (node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized = false) => {
3565
+ optimized = optimized || !!vnode.dynamicChildren;
3557
3566
  const isFragmentStart = isComment(node) && node.data === "[";
3558
3567
  const onMismatch = () => handleMismatch(
3559
3568
  node,
@@ -5611,7 +5620,6 @@ function isSameVNodeType(n1, n2) {
5611
5620
  }
5612
5621
  function transformVNodeArgs(transformer) {
5613
5622
  }
5614
- const InternalObjectKey = `__vInternal`;
5615
5623
  const normalizeKey = ({ key }) => key != null ? key : null;
5616
5624
  const normalizeRef = ({
5617
5625
  ref,
@@ -5729,7 +5737,7 @@ function _createVNode(type, props = null, children = null, patchFlag = 0, dynami
5729
5737
  function guardReactiveProps(props) {
5730
5738
  if (!props)
5731
5739
  return null;
5732
- return reactivity.isProxy(props) || InternalObjectKey in props ? shared.extend({}, props) : props;
5740
+ return reactivity.isProxy(props) || isInternalObject(props) ? shared.extend({}, props) : props;
5733
5741
  }
5734
5742
  function cloneVNode(vnode, extraProps, mergeRef = false) {
5735
5743
  const { props, ref, patchFlag, children } = vnode;
@@ -5827,7 +5835,7 @@ function normalizeChildren(vnode, children) {
5827
5835
  } else {
5828
5836
  type = 32;
5829
5837
  const slotFlag = children._;
5830
- if (!slotFlag && !(InternalObjectKey in children)) {
5838
+ if (!slotFlag && !isInternalObject(children)) {
5831
5839
  children._ctx = currentRenderingInstance;
5832
5840
  } else if (slotFlag === 3 && currentRenderingInstance) {
5833
5841
  if (currentRenderingInstance.slots._ === 1) {
@@ -6032,7 +6040,7 @@ function setupComponent(instance, isSSR = false) {
6032
6040
  function setupStatefulComponent(instance, isSSR) {
6033
6041
  const Component = instance.type;
6034
6042
  instance.accessCache = /* @__PURE__ */ Object.create(null);
6035
- instance.proxy = reactivity.markRaw(new Proxy(instance.ctx, PublicInstanceProxyHandlers));
6043
+ instance.proxy = new Proxy(instance.ctx, PublicInstanceProxyHandlers);
6036
6044
  const { setup } = Component;
6037
6045
  if (setup) {
6038
6046
  const setupContext = instance.setupContext = setup.length > 1 ? createSetupContext(instance) : null;
@@ -6127,26 +6135,19 @@ function finishComponentSetup(instance, isSSR, skipOptions) {
6127
6135
  }
6128
6136
  }
6129
6137
  }
6130
- function getAttrsProxy(instance) {
6131
- return instance.attrsProxy || (instance.attrsProxy = new Proxy(
6132
- instance.attrs,
6133
- {
6134
- get(target, key) {
6135
- reactivity.track(instance, "get", "$attrs");
6136
- return target[key];
6137
- }
6138
- }
6139
- ));
6140
- }
6138
+ const attrsProxyHandlers = {
6139
+ get(target, key) {
6140
+ reactivity.track(target, "get", "");
6141
+ return target[key];
6142
+ }
6143
+ };
6141
6144
  function createSetupContext(instance) {
6142
6145
  const expose = (exposed) => {
6143
6146
  instance.exposed = exposed || {};
6144
6147
  };
6145
6148
  {
6146
6149
  return {
6147
- get attrs() {
6148
- return getAttrsProxy(instance);
6149
- },
6150
+ attrs: new Proxy(instance.attrs, attrsProxyHandlers),
6150
6151
  slots: instance.slots,
6151
6152
  emit: instance.emit,
6152
6153
  expose
@@ -6278,7 +6279,7 @@ function isMemoSame(cached, memo) {
6278
6279
  return true;
6279
6280
  }
6280
6281
 
6281
- const version = "3.4.21";
6282
+ const version = "3.4.23";
6282
6283
  const warn$1 = shared.NOOP;
6283
6284
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
6284
6285
  const devtools = void 0;