@vue/runtime-dom 3.4.21 → 3.4.23

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,8 +1,10 @@
1
1
  /**
2
- * @vue/runtime-dom v3.4.21
2
+ * @vue/runtime-dom v3.4.23
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
6
+ /*! #__NO_SIDE_EFFECTS__ */
7
+ // @__NO_SIDE_EFFECTS__
6
8
  function makeMap(str, expectsLowerCase) {
7
9
  const set = new Set(str.split(","));
8
10
  return expectsLowerCase ? (val) => set.has(val.toLowerCase()) : (val) => set.has(val);
@@ -289,7 +291,11 @@ const replacer = (_key, val) => {
289
291
  };
290
292
  const stringifySymbol = (v, i = "") => {
291
293
  var _a;
292
- return isSymbol(v) ? `Symbol(${(_a = v.description) != null ? _a : i})` : v;
294
+ return (
295
+ // Symbol.description in es2019+ so we need to cast here to pass
296
+ // the lib: es2016 check
297
+ isSymbol(v) ? `Symbol(${(_a = v.description) != null ? _a : i})` : v
298
+ );
293
299
  };
294
300
 
295
301
  function warn$2(msg, ...args) {
@@ -725,6 +731,8 @@ function createArrayInstrumentations() {
725
731
  return instrumentations;
726
732
  }
727
733
  function hasOwnProperty(key) {
734
+ if (!isSymbol(key))
735
+ key = String(key);
728
736
  const obj = toRaw(this);
729
737
  track(obj, "has", key);
730
738
  return obj.hasOwnProperty(key);
@@ -1077,23 +1085,16 @@ function createInstrumentations() {
1077
1085
  clear: createReadonlyMethod("clear"),
1078
1086
  forEach: createForEach(true, true)
1079
1087
  };
1080
- const iteratorMethods = ["keys", "values", "entries", Symbol.iterator];
1088
+ const iteratorMethods = [
1089
+ "keys",
1090
+ "values",
1091
+ "entries",
1092
+ Symbol.iterator
1093
+ ];
1081
1094
  iteratorMethods.forEach((method) => {
1082
- mutableInstrumentations2[method] = createIterableMethod(
1083
- method,
1084
- false,
1085
- false
1086
- );
1087
- readonlyInstrumentations2[method] = createIterableMethod(
1088
- method,
1089
- true,
1090
- false
1091
- );
1092
- shallowInstrumentations2[method] = createIterableMethod(
1093
- method,
1094
- false,
1095
- true
1096
- );
1095
+ mutableInstrumentations2[method] = createIterableMethod(method, false, false);
1096
+ readonlyInstrumentations2[method] = createIterableMethod(method, true, false);
1097
+ shallowInstrumentations2[method] = createIterableMethod(method, false, true);
1097
1098
  shallowReadonlyInstrumentations2[method] = createIterableMethod(
1098
1099
  method,
1099
1100
  true,
@@ -1250,7 +1251,7 @@ function isShallow(value) {
1250
1251
  return !!(value && value["__v_isShallow"]);
1251
1252
  }
1252
1253
  function isProxy(value) {
1253
- return isReactive(value) || isReadonly(value);
1254
+ return value ? !!value["__v_raw"] : false;
1254
1255
  }
1255
1256
  function toRaw(observed) {
1256
1257
  const raw = observed && observed["__v_raw"];
@@ -1712,11 +1713,17 @@ function callWithAsyncErrorHandling(fn, instance, type, args) {
1712
1713
  }
1713
1714
  return res;
1714
1715
  }
1715
- const values = [];
1716
- for (let i = 0; i < fn.length; i++) {
1717
- values.push(callWithAsyncErrorHandling(fn[i], instance, type, args));
1716
+ if (isArray(fn)) {
1717
+ const values = [];
1718
+ for (let i = 0; i < fn.length; i++) {
1719
+ values.push(callWithAsyncErrorHandling(fn[i], instance, type, args));
1720
+ }
1721
+ return values;
1722
+ } else {
1723
+ warn$1(
1724
+ `Invalid value type passed to callWithAsyncErrorHandling(): ${typeof fn}`
1725
+ );
1718
1726
  }
1719
- return values;
1720
1727
  }
1721
1728
  function handleError(err, instance, type, throwInDev = true) {
1722
1729
  const contextVNode = instance ? instance.vnode : null;
@@ -1737,12 +1744,14 @@ function handleError(err, instance, type, throwInDev = true) {
1737
1744
  }
1738
1745
  const appErrorHandler = instance.appContext.config.errorHandler;
1739
1746
  if (appErrorHandler) {
1747
+ pauseTracking();
1740
1748
  callWithErrorHandling(
1741
1749
  appErrorHandler,
1742
1750
  null,
1743
1751
  10,
1744
1752
  [err, exposedInstance, errorInfo]
1745
1753
  );
1754
+ resetTracking();
1746
1755
  return;
1747
1756
  }
1748
1757
  }
@@ -2118,6 +2127,8 @@ const devtoolsComponentRemoved = (component) => {
2118
2127
  _devtoolsComponentRemoved(component);
2119
2128
  }
2120
2129
  };
2130
+ /*! #__NO_SIDE_EFFECTS__ */
2131
+ // @__NO_SIDE_EFFECTS__
2121
2132
  function createDevtoolsComponentHook(hook) {
2122
2133
  return (component) => {
2123
2134
  emit$1(
@@ -4194,7 +4205,7 @@ const KeepAliveImpl = {
4194
4205
  return () => {
4195
4206
  pendingCacheKey = null;
4196
4207
  if (!slots.default) {
4197
- return null;
4208
+ return current = null;
4198
4209
  }
4199
4210
  const children = slots.default();
4200
4211
  const rawVNode = children[0];
@@ -4507,6 +4518,9 @@ const isReservedPrefix = (key) => key === "_" || key === "$";
4507
4518
  const hasSetupBinding = (state, key) => state !== EMPTY_OBJ && !state.__isScriptSetup && hasOwn(state, key);
4508
4519
  const PublicInstanceProxyHandlers = {
4509
4520
  get({ _: instance }, key) {
4521
+ if (key === "__v_skip") {
4522
+ return true;
4523
+ }
4510
4524
  const { ctx, setupState, data, props, accessCache, type, appContext } = instance;
4511
4525
  if (key === "__isVue") {
4512
4526
  return true;
@@ -4549,7 +4563,7 @@ const PublicInstanceProxyHandlers = {
4549
4563
  let cssModule, globalProperties;
4550
4564
  if (publicGetter) {
4551
4565
  if (key === "$attrs") {
4552
- track(instance, "get", key);
4566
+ track(instance.attrs, "get", "");
4553
4567
  markAttrsAccessed();
4554
4568
  } else if (key === "$slots") {
4555
4569
  track(instance, "get", key);
@@ -5474,10 +5488,13 @@ function hasInjectionContext() {
5474
5488
  return !!(currentInstance || currentRenderingInstance || currentApp);
5475
5489
  }
5476
5490
 
5491
+ const internalObjectProto = /* @__PURE__ */ Object.create(null);
5492
+ const createInternalObject = () => Object.create(internalObjectProto);
5493
+ const isInternalObject = (obj) => Object.getPrototypeOf(obj) === internalObjectProto;
5494
+
5477
5495
  function initProps(instance, rawProps, isStateful, isSSR = false) {
5478
5496
  const props = {};
5479
- const attrs = {};
5480
- def(attrs, InternalObjectKey, 1);
5497
+ const attrs = createInternalObject();
5481
5498
  instance.propsDefaults = /* @__PURE__ */ Object.create(null);
5482
5499
  setFullProps(instance, rawProps, props, attrs);
5483
5500
  for (const key in instance.propsOptions[0]) {
@@ -5592,7 +5609,7 @@ function updateProps(instance, rawProps, rawPrevProps, optimized) {
5592
5609
  }
5593
5610
  }
5594
5611
  if (hasAttrsChanged) {
5595
- trigger(instance, "set", "$attrs");
5612
+ trigger(instance.attrs, "set", "");
5596
5613
  }
5597
5614
  {
5598
5615
  validateProps(rawProps || {}, props, instance);
@@ -5928,19 +5945,18 @@ const initSlots = (instance, children) => {
5928
5945
  const type = children._;
5929
5946
  if (type) {
5930
5947
  instance.slots = toRaw(children);
5931
- def(children, "_", type);
5948
+ def(instance.slots, "_", type);
5932
5949
  } else {
5933
5950
  normalizeObjectSlots(
5934
5951
  children,
5935
- instance.slots = {});
5952
+ instance.slots = createInternalObject());
5936
5953
  }
5937
5954
  } else {
5938
- instance.slots = {};
5955
+ instance.slots = createInternalObject();
5939
5956
  if (children) {
5940
5957
  normalizeVNodeSlots(instance, children);
5941
5958
  }
5942
5959
  }
5943
- def(instance.slots, InternalObjectKey, 1);
5944
5960
  };
5945
5961
  const updateSlots = (instance, children, optimized) => {
5946
5962
  const { vnode, slots } = instance;
@@ -6112,6 +6128,7 @@ function createHydrationFunctions(rendererInternals) {
6112
6128
  }
6113
6129
  };
6114
6130
  const hydrateNode = (node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized = false) => {
6131
+ optimized = optimized || !!vnode.dynamicChildren;
6115
6132
  const isFragmentStart = isComment(node) && node.data === "[";
6116
6133
  const onMismatch = () => handleMismatch(
6117
6134
  node,
@@ -8546,7 +8563,6 @@ const createVNodeWithArgsTransform = (...args) => {
8546
8563
  ...vnodeArgsTransformer ? vnodeArgsTransformer(args, currentRenderingInstance) : args
8547
8564
  );
8548
8565
  };
8549
- const InternalObjectKey = `__vInternal`;
8550
8566
  const normalizeKey = ({ key }) => key != null ? key : null;
8551
8567
  const normalizeRef = ({
8552
8568
  ref,
@@ -8679,7 +8695,7 @@ Component that was made reactive: `,
8679
8695
  function guardReactiveProps(props) {
8680
8696
  if (!props)
8681
8697
  return null;
8682
- return isProxy(props) || InternalObjectKey in props ? extend({}, props) : props;
8698
+ return isProxy(props) || isInternalObject(props) ? extend({}, props) : props;
8683
8699
  }
8684
8700
  function cloneVNode(vnode, extraProps, mergeRef = false) {
8685
8701
  const { props, ref, patchFlag, children } = vnode;
@@ -8784,7 +8800,7 @@ function normalizeChildren(vnode, children) {
8784
8800
  } else {
8785
8801
  type = 32;
8786
8802
  const slotFlag = children._;
8787
- if (!slotFlag && !(InternalObjectKey in children)) {
8803
+ if (!slotFlag && !isInternalObject(children)) {
8788
8804
  children._ctx = currentRenderingInstance;
8789
8805
  } else if (slotFlag === 3 && currentRenderingInstance) {
8790
8806
  if (currentRenderingInstance.slots._ === 1) {
@@ -9005,7 +9021,7 @@ function setupStatefulComponent(instance, isSSR) {
9005
9021
  }
9006
9022
  }
9007
9023
  instance.accessCache = /* @__PURE__ */ Object.create(null);
9008
- instance.proxy = markRaw(new Proxy(instance.ctx, PublicInstanceProxyHandlers));
9024
+ instance.proxy = new Proxy(instance.ctx, PublicInstanceProxyHandlers);
9009
9025
  {
9010
9026
  exposePropsOnRenderContext(instance);
9011
9027
  }
@@ -9137,26 +9153,21 @@ function finishComponentSetup(instance, isSSR, skipOptions) {
9137
9153
  }
9138
9154
  }
9139
9155
  }
9140
- function getAttrsProxy(instance) {
9141
- return instance.attrsProxy || (instance.attrsProxy = new Proxy(
9142
- instance.attrs,
9143
- {
9144
- get(target, key) {
9145
- markAttrsAccessed();
9146
- track(instance, "get", "$attrs");
9147
- return target[key];
9148
- },
9149
- set() {
9150
- warn$1(`setupContext.attrs is readonly.`);
9151
- return false;
9152
- },
9153
- deleteProperty() {
9154
- warn$1(`setupContext.attrs is readonly.`);
9155
- return false;
9156
- }
9157
- }
9158
- ));
9159
- }
9156
+ const attrsProxyHandlers = {
9157
+ get(target, key) {
9158
+ markAttrsAccessed();
9159
+ track(target, "get", "");
9160
+ return target[key];
9161
+ },
9162
+ set() {
9163
+ warn$1(`setupContext.attrs is readonly.`);
9164
+ return false;
9165
+ },
9166
+ deleteProperty() {
9167
+ warn$1(`setupContext.attrs is readonly.`);
9168
+ return false;
9169
+ }
9170
+ } ;
9160
9171
  function getSlotsProxy(instance) {
9161
9172
  return instance.slotsProxy || (instance.slotsProxy = new Proxy(instance.slots, {
9162
9173
  get(target, key) {
@@ -9190,9 +9201,10 @@ function createSetupContext(instance) {
9190
9201
  instance.exposed = exposed || {};
9191
9202
  };
9192
9203
  {
9204
+ let attrsProxy;
9193
9205
  return Object.freeze({
9194
9206
  get attrs() {
9195
- return getAttrsProxy(instance);
9207
+ return attrsProxy || (attrsProxy = new Proxy(instance.attrs, attrsProxyHandlers));
9196
9208
  },
9197
9209
  get slots() {
9198
9210
  return getSlotsProxy(instance);
@@ -9537,7 +9549,7 @@ function isMemoSame(cached, memo) {
9537
9549
  return true;
9538
9550
  }
9539
9551
 
9540
- const version = "3.4.21";
9552
+ const version = "3.4.23";
9541
9553
  const warn = warn$1 ;
9542
9554
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
9543
9555
  const devtools = devtools$1 ;
@@ -9963,8 +9975,8 @@ function useCssVars(getter) {
9963
9975
  setVarsOnVNode(instance.subTree, vars);
9964
9976
  updateTeleports(vars);
9965
9977
  };
9966
- watchPostEffect(setVars);
9967
9978
  onMounted(() => {
9979
+ watchPostEffect(setVars);
9968
9980
  const ob = new MutationObserver(setVars);
9969
9981
  ob.observe(instance.subTree.el.parentNode, { childList: true });
9970
9982
  onUnmounted(() => ob.disconnect());
@@ -10187,11 +10199,14 @@ function patchEvent(el, rawName, prevValue, nextValue, instance = null) {
10187
10199
  const invokers = el[veiKey] || (el[veiKey] = {});
10188
10200
  const existingInvoker = invokers[rawName];
10189
10201
  if (nextValue && existingInvoker) {
10190
- existingInvoker.value = nextValue;
10202
+ existingInvoker.value = sanitizeEventValue(nextValue, rawName) ;
10191
10203
  } else {
10192
10204
  const [name, options] = parseName(rawName);
10193
10205
  if (nextValue) {
10194
- const invoker = invokers[rawName] = createInvoker(nextValue, instance);
10206
+ const invoker = invokers[rawName] = createInvoker(
10207
+ sanitizeEventValue(nextValue, rawName) ,
10208
+ instance
10209
+ );
10195
10210
  addEventListener(el, name, invoker, options);
10196
10211
  } else if (existingInvoker) {
10197
10212
  removeEventListener(el, name, existingInvoker, options);
@@ -10234,6 +10249,16 @@ function createInvoker(initialValue, instance) {
10234
10249
  invoker.attached = getNow();
10235
10250
  return invoker;
10236
10251
  }
10252
+ function sanitizeEventValue(value, propName) {
10253
+ if (isFunction(value) || isArray(value)) {
10254
+ return value;
10255
+ }
10256
+ warn(
10257
+ `Wrong type passed as event handler to ${propName} - did you forget @ or : in front of your prop?
10258
+ Expected function or array of functions, received type ${typeof value}.`
10259
+ );
10260
+ return NOOP;
10261
+ }
10237
10262
  function patchStopImmediatePropagation(e, value) {
10238
10263
  if (isArray(value)) {
10239
10264
  const originalStop = e.stopImmediatePropagation;
@@ -10241,7 +10266,9 @@ function patchStopImmediatePropagation(e, value) {
10241
10266
  originalStop.call(e);
10242
10267
  e._stopped = true;
10243
10268
  };
10244
- return value.map((fn) => (e2) => !e2._stopped && fn && fn(e2));
10269
+ return value.map(
10270
+ (fn) => (e2) => !e2._stopped && fn && fn(e2)
10271
+ );
10245
10272
  } else {
10246
10273
  return value;
10247
10274
  }
@@ -10442,7 +10469,7 @@ class VueElement extends BaseClass {
10442
10469
  }
10443
10470
  }
10444
10471
  _setAttr(key) {
10445
- let value = this.getAttribute(key);
10472
+ let value = this.hasAttribute(key) ? this.getAttribute(key) : void 0;
10446
10473
  const camelKey = camelize(key);
10447
10474
  if (this._numberProps && this._numberProps[camelKey]) {
10448
10475
  value = toNumber(value);
@@ -10608,7 +10635,28 @@ const TransitionGroupImpl = {
10608
10635
  const rawProps = toRaw(props);
10609
10636
  const cssTransitionProps = resolveTransitionProps(rawProps);
10610
10637
  let tag = rawProps.tag || Fragment;
10611
- prevChildren = children;
10638
+ prevChildren = [];
10639
+ if (children) {
10640
+ for (let i = 0; i < children.length; i++) {
10641
+ const child = children[i];
10642
+ if (child.el && child.el instanceof Element) {
10643
+ prevChildren.push(child);
10644
+ setTransitionHooks(
10645
+ child,
10646
+ resolveTransitionHooks(
10647
+ child,
10648
+ cssTransitionProps,
10649
+ state,
10650
+ instance
10651
+ )
10652
+ );
10653
+ positionMap.set(
10654
+ child,
10655
+ child.el.getBoundingClientRect()
10656
+ );
10657
+ }
10658
+ }
10659
+ }
10612
10660
  children = slots.default ? getTransitionRawChildren(slots.default()) : [];
10613
10661
  for (let i = 0; i < children.length; i++) {
10614
10662
  const child = children[i];
@@ -10621,16 +10669,6 @@ const TransitionGroupImpl = {
10621
10669
  warn(`<TransitionGroup> children must be keyed.`);
10622
10670
  }
10623
10671
  }
10624
- if (prevChildren) {
10625
- for (let i = 0; i < prevChildren.length; i++) {
10626
- const child = prevChildren[i];
10627
- setTransitionHooks(
10628
- child,
10629
- resolveTransitionHooks(child, cssTransitionProps, state, instance)
10630
- );
10631
- positionMap.set(child, child.el.getBoundingClientRect());
10632
- }
10633
- }
10634
10672
  return createVNode(tag, null, children);
10635
10673
  };
10636
10674
  }
@@ -10729,7 +10767,7 @@ const vModelText = {
10729
10767
  el[assignKey] = getModelAssigner(vnode);
10730
10768
  if (el.composing)
10731
10769
  return;
10732
- const elValue = number || el.type === "number" ? looseToNumber(el.value) : el.value;
10770
+ const elValue = (number || el.type === "number") && !/^0\d/.test(el.value) ? looseToNumber(el.value) : el.value;
10733
10771
  const newValue = value == null ? "" : value;
10734
10772
  if (elValue === newValue) {
10735
10773
  return;
@@ -10832,14 +10870,14 @@ const vModelSelect = {
10832
10870
  // set value in mounted & updated because <select> relies on its children
10833
10871
  // <option>s.
10834
10872
  mounted(el, { value, modifiers: { number } }) {
10835
- setSelected(el, value, number);
10873
+ setSelected(el, value);
10836
10874
  },
10837
10875
  beforeUpdate(el, _binding, vnode) {
10838
10876
  el[assignKey] = getModelAssigner(vnode);
10839
10877
  },
10840
10878
  updated(el, { value, modifiers: { number } }) {
10841
10879
  if (!el._assigning) {
10842
- setSelected(el, value, number);
10880
+ setSelected(el, value);
10843
10881
  }
10844
10882
  }
10845
10883
  };
@@ -10859,9 +10897,7 @@ function setSelected(el, value, number) {
10859
10897
  if (isArrayValue) {
10860
10898
  const optionType = typeof optionValue;
10861
10899
  if (optionType === "string" || optionType === "number") {
10862
- option.selected = value.includes(
10863
- number ? looseToNumber(optionValue) : optionValue
10864
- );
10900
+ option.selected = value.some((v) => String(v) === String(optionValue));
10865
10901
  } else {
10866
10902
  option.selected = looseIndexOf(value, optionValue) > -1;
10867
10903
  }