@vue/runtime-dom 3.4.21 → 3.4.22

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.22
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;
@@ -5474,10 +5488,10 @@ function hasInjectionContext() {
5474
5488
  return !!(currentInstance || currentRenderingInstance || currentApp);
5475
5489
  }
5476
5490
 
5491
+ const attrsProto = {};
5477
5492
  function initProps(instance, rawProps, isStateful, isSSR = false) {
5478
5493
  const props = {};
5479
- const attrs = {};
5480
- def(attrs, InternalObjectKey, 1);
5494
+ const attrs = Object.create(attrsProto);
5481
5495
  instance.propsDefaults = /* @__PURE__ */ Object.create(null);
5482
5496
  setFullProps(instance, rawProps, props, attrs);
5483
5497
  for (const key in instance.propsOptions[0]) {
@@ -5592,7 +5606,7 @@ function updateProps(instance, rawProps, rawPrevProps, optimized) {
5592
5606
  }
5593
5607
  }
5594
5608
  if (hasAttrsChanged) {
5595
- trigger(instance, "set", "$attrs");
5609
+ trigger(instance.attrs, "set", "");
5596
5610
  }
5597
5611
  {
5598
5612
  validateProps(rawProps || {}, props, instance);
@@ -5928,7 +5942,7 @@ const initSlots = (instance, children) => {
5928
5942
  const type = children._;
5929
5943
  if (type) {
5930
5944
  instance.slots = toRaw(children);
5931
- def(children, "_", type);
5945
+ def(instance.slots, "_", type);
5932
5946
  } else {
5933
5947
  normalizeObjectSlots(
5934
5948
  children,
@@ -5940,7 +5954,6 @@ const initSlots = (instance, children) => {
5940
5954
  normalizeVNodeSlots(instance, children);
5941
5955
  }
5942
5956
  }
5943
- def(instance.slots, InternalObjectKey, 1);
5944
5957
  };
5945
5958
  const updateSlots = (instance, children, optimized) => {
5946
5959
  const { vnode, slots } = instance;
@@ -6112,6 +6125,7 @@ function createHydrationFunctions(rendererInternals) {
6112
6125
  }
6113
6126
  };
6114
6127
  const hydrateNode = (node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized = false) => {
6128
+ optimized = optimized || !!vnode.dynamicChildren;
6115
6129
  const isFragmentStart = isComment(node) && node.data === "[";
6116
6130
  const onMismatch = () => handleMismatch(
6117
6131
  node,
@@ -8546,7 +8560,6 @@ const createVNodeWithArgsTransform = (...args) => {
8546
8560
  ...vnodeArgsTransformer ? vnodeArgsTransformer(args, currentRenderingInstance) : args
8547
8561
  );
8548
8562
  };
8549
- const InternalObjectKey = `__vInternal`;
8550
8563
  const normalizeKey = ({ key }) => key != null ? key : null;
8551
8564
  const normalizeRef = ({
8552
8565
  ref,
@@ -8679,7 +8692,7 @@ Component that was made reactive: `,
8679
8692
  function guardReactiveProps(props) {
8680
8693
  if (!props)
8681
8694
  return null;
8682
- return isProxy(props) || InternalObjectKey in props ? extend({}, props) : props;
8695
+ return isProxy(props) || Object.getPrototypeOf(props) === attrsProto ? extend({}, props) : props;
8683
8696
  }
8684
8697
  function cloneVNode(vnode, extraProps, mergeRef = false) {
8685
8698
  const { props, ref, patchFlag, children } = vnode;
@@ -8784,7 +8797,7 @@ function normalizeChildren(vnode, children) {
8784
8797
  } else {
8785
8798
  type = 32;
8786
8799
  const slotFlag = children._;
8787
- if (!slotFlag && !(InternalObjectKey in children)) {
8800
+ if (!slotFlag) {
8788
8801
  children._ctx = currentRenderingInstance;
8789
8802
  } else if (slotFlag === 3 && currentRenderingInstance) {
8790
8803
  if (currentRenderingInstance.slots._ === 1) {
@@ -9005,7 +9018,7 @@ function setupStatefulComponent(instance, isSSR) {
9005
9018
  }
9006
9019
  }
9007
9020
  instance.accessCache = /* @__PURE__ */ Object.create(null);
9008
- instance.proxy = markRaw(new Proxy(instance.ctx, PublicInstanceProxyHandlers));
9021
+ instance.proxy = new Proxy(instance.ctx, PublicInstanceProxyHandlers);
9009
9022
  {
9010
9023
  exposePropsOnRenderContext(instance);
9011
9024
  }
@@ -9137,26 +9150,21 @@ function finishComponentSetup(instance, isSSR, skipOptions) {
9137
9150
  }
9138
9151
  }
9139
9152
  }
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
- }
9153
+ const attrsProxyHandlers = {
9154
+ get(target, key) {
9155
+ markAttrsAccessed();
9156
+ track(target, "get", "");
9157
+ return target[key];
9158
+ },
9159
+ set() {
9160
+ warn$1(`setupContext.attrs is readonly.`);
9161
+ return false;
9162
+ },
9163
+ deleteProperty() {
9164
+ warn$1(`setupContext.attrs is readonly.`);
9165
+ return false;
9166
+ }
9167
+ } ;
9160
9168
  function getSlotsProxy(instance) {
9161
9169
  return instance.slotsProxy || (instance.slotsProxy = new Proxy(instance.slots, {
9162
9170
  get(target, key) {
@@ -9190,9 +9198,10 @@ function createSetupContext(instance) {
9190
9198
  instance.exposed = exposed || {};
9191
9199
  };
9192
9200
  {
9201
+ let attrsProxy;
9193
9202
  return Object.freeze({
9194
9203
  get attrs() {
9195
- return getAttrsProxy(instance);
9204
+ return attrsProxy || (attrsProxy = new Proxy(instance.attrs, attrsProxyHandlers));
9196
9205
  },
9197
9206
  get slots() {
9198
9207
  return getSlotsProxy(instance);
@@ -9537,7 +9546,7 @@ function isMemoSame(cached, memo) {
9537
9546
  return true;
9538
9547
  }
9539
9548
 
9540
- const version = "3.4.21";
9549
+ const version = "3.4.22";
9541
9550
  const warn = warn$1 ;
9542
9551
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
9543
9552
  const devtools = devtools$1 ;
@@ -9963,8 +9972,8 @@ function useCssVars(getter) {
9963
9972
  setVarsOnVNode(instance.subTree, vars);
9964
9973
  updateTeleports(vars);
9965
9974
  };
9966
- watchPostEffect(setVars);
9967
9975
  onMounted(() => {
9976
+ watchPostEffect(setVars);
9968
9977
  const ob = new MutationObserver(setVars);
9969
9978
  ob.observe(instance.subTree.el.parentNode, { childList: true });
9970
9979
  onUnmounted(() => ob.disconnect());
@@ -10187,11 +10196,14 @@ function patchEvent(el, rawName, prevValue, nextValue, instance = null) {
10187
10196
  const invokers = el[veiKey] || (el[veiKey] = {});
10188
10197
  const existingInvoker = invokers[rawName];
10189
10198
  if (nextValue && existingInvoker) {
10190
- existingInvoker.value = nextValue;
10199
+ existingInvoker.value = sanitizeEventValue(nextValue, rawName) ;
10191
10200
  } else {
10192
10201
  const [name, options] = parseName(rawName);
10193
10202
  if (nextValue) {
10194
- const invoker = invokers[rawName] = createInvoker(nextValue, instance);
10203
+ const invoker = invokers[rawName] = createInvoker(
10204
+ sanitizeEventValue(nextValue, rawName) ,
10205
+ instance
10206
+ );
10195
10207
  addEventListener(el, name, invoker, options);
10196
10208
  } else if (existingInvoker) {
10197
10209
  removeEventListener(el, name, existingInvoker, options);
@@ -10234,6 +10246,16 @@ function createInvoker(initialValue, instance) {
10234
10246
  invoker.attached = getNow();
10235
10247
  return invoker;
10236
10248
  }
10249
+ function sanitizeEventValue(value, propName) {
10250
+ if (isFunction(value) || isArray(value)) {
10251
+ return value;
10252
+ }
10253
+ warn(
10254
+ `Wrong type passed as event handler to ${propName} - did you forget @ or : in front of your prop?
10255
+ Expected function or array of functions, received type ${typeof value}.`
10256
+ );
10257
+ return NOOP;
10258
+ }
10237
10259
  function patchStopImmediatePropagation(e, value) {
10238
10260
  if (isArray(value)) {
10239
10261
  const originalStop = e.stopImmediatePropagation;
@@ -10241,7 +10263,9 @@ function patchStopImmediatePropagation(e, value) {
10241
10263
  originalStop.call(e);
10242
10264
  e._stopped = true;
10243
10265
  };
10244
- return value.map((fn) => (e2) => !e2._stopped && fn && fn(e2));
10266
+ return value.map(
10267
+ (fn) => (e2) => !e2._stopped && fn && fn(e2)
10268
+ );
10245
10269
  } else {
10246
10270
  return value;
10247
10271
  }
@@ -10442,7 +10466,7 @@ class VueElement extends BaseClass {
10442
10466
  }
10443
10467
  }
10444
10468
  _setAttr(key) {
10445
- let value = this.getAttribute(key);
10469
+ let value = this.hasAttribute(key) ? this.getAttribute(key) : void 0;
10446
10470
  const camelKey = camelize(key);
10447
10471
  if (this._numberProps && this._numberProps[camelKey]) {
10448
10472
  value = toNumber(value);
@@ -10608,7 +10632,28 @@ const TransitionGroupImpl = {
10608
10632
  const rawProps = toRaw(props);
10609
10633
  const cssTransitionProps = resolveTransitionProps(rawProps);
10610
10634
  let tag = rawProps.tag || Fragment;
10611
- prevChildren = children;
10635
+ prevChildren = [];
10636
+ if (children) {
10637
+ for (let i = 0; i < children.length; i++) {
10638
+ const child = children[i];
10639
+ if (child.el && child.el instanceof Element) {
10640
+ prevChildren.push(child);
10641
+ setTransitionHooks(
10642
+ child,
10643
+ resolveTransitionHooks(
10644
+ child,
10645
+ cssTransitionProps,
10646
+ state,
10647
+ instance
10648
+ )
10649
+ );
10650
+ positionMap.set(
10651
+ child,
10652
+ child.el.getBoundingClientRect()
10653
+ );
10654
+ }
10655
+ }
10656
+ }
10612
10657
  children = slots.default ? getTransitionRawChildren(slots.default()) : [];
10613
10658
  for (let i = 0; i < children.length; i++) {
10614
10659
  const child = children[i];
@@ -10621,16 +10666,6 @@ const TransitionGroupImpl = {
10621
10666
  warn(`<TransitionGroup> children must be keyed.`);
10622
10667
  }
10623
10668
  }
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
10669
  return createVNode(tag, null, children);
10635
10670
  };
10636
10671
  }
@@ -10729,7 +10764,7 @@ const vModelText = {
10729
10764
  el[assignKey] = getModelAssigner(vnode);
10730
10765
  if (el.composing)
10731
10766
  return;
10732
- const elValue = number || el.type === "number" ? looseToNumber(el.value) : el.value;
10767
+ const elValue = (number || el.type === "number") && !/^0\d/.test(el.value) ? looseToNumber(el.value) : el.value;
10733
10768
  const newValue = value == null ? "" : value;
10734
10769
  if (elValue === newValue) {
10735
10770
  return;
@@ -10832,14 +10867,14 @@ const vModelSelect = {
10832
10867
  // set value in mounted & updated because <select> relies on its children
10833
10868
  // <option>s.
10834
10869
  mounted(el, { value, modifiers: { number } }) {
10835
- setSelected(el, value, number);
10870
+ setSelected(el, value);
10836
10871
  },
10837
10872
  beforeUpdate(el, _binding, vnode) {
10838
10873
  el[assignKey] = getModelAssigner(vnode);
10839
10874
  },
10840
10875
  updated(el, { value, modifiers: { number } }) {
10841
10876
  if (!el._assigning) {
10842
- setSelected(el, value, number);
10877
+ setSelected(el, value);
10843
10878
  }
10844
10879
  }
10845
10880
  };
@@ -10859,9 +10894,7 @@ function setSelected(el, value, number) {
10859
10894
  if (isArrayValue) {
10860
10895
  const optionType = typeof optionValue;
10861
10896
  if (optionType === "string" || optionType === "number") {
10862
- option.selected = value.includes(
10863
- number ? looseToNumber(optionValue) : optionValue
10864
- );
10897
+ option.selected = value.some((v) => String(v) === String(optionValue));
10865
10898
  } else {
10866
10899
  option.selected = looseIndexOf(value, optionValue) > -1;
10867
10900
  }