@vue/runtime-dom 3.4.20 → 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.20
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"];
@@ -1533,7 +1534,10 @@ function warn$1(msg, ...args) {
1533
1534
  instance,
1534
1535
  11,
1535
1536
  [
1536
- msg + args.join(""),
1537
+ msg + args.map((a) => {
1538
+ var _a, _b;
1539
+ return (_b = (_a = a.toString) == null ? void 0 : _a.call(a)) != null ? _b : JSON.stringify(a);
1540
+ }).join(""),
1537
1541
  instance && instance.proxy,
1538
1542
  trace.map(
1539
1543
  ({ vnode }) => `at <${formatComponentName(instance, vnode.type)}>`
@@ -1709,11 +1713,17 @@ function callWithAsyncErrorHandling(fn, instance, type, args) {
1709
1713
  }
1710
1714
  return res;
1711
1715
  }
1712
- const values = [];
1713
- for (let i = 0; i < fn.length; i++) {
1714
- 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
+ );
1715
1726
  }
1716
- return values;
1717
1727
  }
1718
1728
  function handleError(err, instance, type, throwInDev = true) {
1719
1729
  const contextVNode = instance ? instance.vnode : null;
@@ -1734,12 +1744,14 @@ function handleError(err, instance, type, throwInDev = true) {
1734
1744
  }
1735
1745
  const appErrorHandler = instance.appContext.config.errorHandler;
1736
1746
  if (appErrorHandler) {
1747
+ pauseTracking();
1737
1748
  callWithErrorHandling(
1738
1749
  appErrorHandler,
1739
1750
  null,
1740
1751
  10,
1741
1752
  [err, exposedInstance, errorInfo]
1742
1753
  );
1754
+ resetTracking();
1743
1755
  return;
1744
1756
  }
1745
1757
  }
@@ -2115,6 +2127,8 @@ const devtoolsComponentRemoved = (component) => {
2115
2127
  _devtoolsComponentRemoved(component);
2116
2128
  }
2117
2129
  };
2130
+ /*! #__NO_SIDE_EFFECTS__ */
2131
+ // @__NO_SIDE_EFFECTS__
2118
2132
  function createDevtoolsComponentHook(hook) {
2119
2133
  return (component) => {
2120
2134
  emit$1(
@@ -2700,7 +2714,7 @@ const SuspenseImpl = {
2700
2714
  rendererInternals
2701
2715
  );
2702
2716
  } else {
2703
- if (parentSuspense && parentSuspense.deps > 0) {
2717
+ if (parentSuspense && parentSuspense.deps > 0 && !n1.suspense.isInFallback) {
2704
2718
  n2.suspense = n1.suspense;
2705
2719
  n2.suspense.vnode = n2;
2706
2720
  n2.el = n1.el;
@@ -4191,7 +4205,7 @@ const KeepAliveImpl = {
4191
4205
  return () => {
4192
4206
  pendingCacheKey = null;
4193
4207
  if (!slots.default) {
4194
- return null;
4208
+ return current = null;
4195
4209
  }
4196
4210
  const children = slots.default();
4197
4211
  const rawVNode = children[0];
@@ -4504,6 +4518,9 @@ const isReservedPrefix = (key) => key === "_" || key === "$";
4504
4518
  const hasSetupBinding = (state, key) => state !== EMPTY_OBJ && !state.__isScriptSetup && hasOwn(state, key);
4505
4519
  const PublicInstanceProxyHandlers = {
4506
4520
  get({ _: instance }, key) {
4521
+ if (key === "__v_skip") {
4522
+ return true;
4523
+ }
4507
4524
  const { ctx, setupState, data, props, accessCache, type, appContext } = instance;
4508
4525
  if (key === "__isVue") {
4509
4526
  return true;
@@ -5471,10 +5488,10 @@ function hasInjectionContext() {
5471
5488
  return !!(currentInstance || currentRenderingInstance || currentApp);
5472
5489
  }
5473
5490
 
5491
+ const attrsProto = {};
5474
5492
  function initProps(instance, rawProps, isStateful, isSSR = false) {
5475
5493
  const props = {};
5476
- const attrs = {};
5477
- def(attrs, InternalObjectKey, 1);
5494
+ const attrs = Object.create(attrsProto);
5478
5495
  instance.propsDefaults = /* @__PURE__ */ Object.create(null);
5479
5496
  setFullProps(instance, rawProps, props, attrs);
5480
5497
  for (const key in instance.propsOptions[0]) {
@@ -5589,7 +5606,7 @@ function updateProps(instance, rawProps, rawPrevProps, optimized) {
5589
5606
  }
5590
5607
  }
5591
5608
  if (hasAttrsChanged) {
5592
- trigger(instance, "set", "$attrs");
5609
+ trigger(instance.attrs, "set", "");
5593
5610
  }
5594
5611
  {
5595
5612
  validateProps(rawProps || {}, props, instance);
@@ -5925,7 +5942,7 @@ const initSlots = (instance, children) => {
5925
5942
  const type = children._;
5926
5943
  if (type) {
5927
5944
  instance.slots = toRaw(children);
5928
- def(children, "_", type);
5945
+ def(instance.slots, "_", type);
5929
5946
  } else {
5930
5947
  normalizeObjectSlots(
5931
5948
  children,
@@ -5937,7 +5954,6 @@ const initSlots = (instance, children) => {
5937
5954
  normalizeVNodeSlots(instance, children);
5938
5955
  }
5939
5956
  }
5940
- def(instance.slots, InternalObjectKey, 1);
5941
5957
  };
5942
5958
  const updateSlots = (instance, children, optimized) => {
5943
5959
  const { vnode, slots } = instance;
@@ -6109,6 +6125,7 @@ function createHydrationFunctions(rendererInternals) {
6109
6125
  }
6110
6126
  };
6111
6127
  const hydrateNode = (node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized = false) => {
6128
+ optimized = optimized || !!vnode.dynamicChildren;
6112
6129
  const isFragmentStart = isComment(node) && node.data === "[";
6113
6130
  const onMismatch = () => handleMismatch(
6114
6131
  node,
@@ -8543,7 +8560,6 @@ const createVNodeWithArgsTransform = (...args) => {
8543
8560
  ...vnodeArgsTransformer ? vnodeArgsTransformer(args, currentRenderingInstance) : args
8544
8561
  );
8545
8562
  };
8546
- const InternalObjectKey = `__vInternal`;
8547
8563
  const normalizeKey = ({ key }) => key != null ? key : null;
8548
8564
  const normalizeRef = ({
8549
8565
  ref,
@@ -8676,7 +8692,7 @@ Component that was made reactive: `,
8676
8692
  function guardReactiveProps(props) {
8677
8693
  if (!props)
8678
8694
  return null;
8679
- return isProxy(props) || InternalObjectKey in props ? extend({}, props) : props;
8695
+ return isProxy(props) || Object.getPrototypeOf(props) === attrsProto ? extend({}, props) : props;
8680
8696
  }
8681
8697
  function cloneVNode(vnode, extraProps, mergeRef = false) {
8682
8698
  const { props, ref, patchFlag, children } = vnode;
@@ -8781,7 +8797,7 @@ function normalizeChildren(vnode, children) {
8781
8797
  } else {
8782
8798
  type = 32;
8783
8799
  const slotFlag = children._;
8784
- if (!slotFlag && !(InternalObjectKey in children)) {
8800
+ if (!slotFlag) {
8785
8801
  children._ctx = currentRenderingInstance;
8786
8802
  } else if (slotFlag === 3 && currentRenderingInstance) {
8787
8803
  if (currentRenderingInstance.slots._ === 1) {
@@ -9002,7 +9018,7 @@ function setupStatefulComponent(instance, isSSR) {
9002
9018
  }
9003
9019
  }
9004
9020
  instance.accessCache = /* @__PURE__ */ Object.create(null);
9005
- instance.proxy = markRaw(new Proxy(instance.ctx, PublicInstanceProxyHandlers));
9021
+ instance.proxy = new Proxy(instance.ctx, PublicInstanceProxyHandlers);
9006
9022
  {
9007
9023
  exposePropsOnRenderContext(instance);
9008
9024
  }
@@ -9134,26 +9150,21 @@ function finishComponentSetup(instance, isSSR, skipOptions) {
9134
9150
  }
9135
9151
  }
9136
9152
  }
9137
- function getAttrsProxy(instance) {
9138
- return instance.attrsProxy || (instance.attrsProxy = new Proxy(
9139
- instance.attrs,
9140
- {
9141
- get(target, key) {
9142
- markAttrsAccessed();
9143
- track(instance, "get", "$attrs");
9144
- return target[key];
9145
- },
9146
- set() {
9147
- warn$1(`setupContext.attrs is readonly.`);
9148
- return false;
9149
- },
9150
- deleteProperty() {
9151
- warn$1(`setupContext.attrs is readonly.`);
9152
- return false;
9153
- }
9154
- }
9155
- ));
9156
- }
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
+ } ;
9157
9168
  function getSlotsProxy(instance) {
9158
9169
  return instance.slotsProxy || (instance.slotsProxy = new Proxy(instance.slots, {
9159
9170
  get(target, key) {
@@ -9187,9 +9198,10 @@ function createSetupContext(instance) {
9187
9198
  instance.exposed = exposed || {};
9188
9199
  };
9189
9200
  {
9201
+ let attrsProxy;
9190
9202
  return Object.freeze({
9191
9203
  get attrs() {
9192
- return getAttrsProxy(instance);
9204
+ return attrsProxy || (attrsProxy = new Proxy(instance.attrs, attrsProxyHandlers));
9193
9205
  },
9194
9206
  get slots() {
9195
9207
  return getSlotsProxy(instance);
@@ -9534,7 +9546,7 @@ function isMemoSame(cached, memo) {
9534
9546
  return true;
9535
9547
  }
9536
9548
 
9537
- const version = "3.4.20";
9549
+ const version = "3.4.22";
9538
9550
  const warn = warn$1 ;
9539
9551
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
9540
9552
  const devtools = devtools$1 ;
@@ -9960,8 +9972,8 @@ function useCssVars(getter) {
9960
9972
  setVarsOnVNode(instance.subTree, vars);
9961
9973
  updateTeleports(vars);
9962
9974
  };
9963
- watchPostEffect(setVars);
9964
9975
  onMounted(() => {
9976
+ watchPostEffect(setVars);
9965
9977
  const ob = new MutationObserver(setVars);
9966
9978
  ob.observe(instance.subTree.el.parentNode, { childList: true });
9967
9979
  onUnmounted(() => ob.disconnect());
@@ -10136,15 +10148,15 @@ function patchDOMProp(el, key, value, prevChildren, parentComponent, parentSuspe
10136
10148
  const tag = el.tagName;
10137
10149
  if (key === "value" && tag !== "PROGRESS" && // custom elements may use _value internally
10138
10150
  !tag.includes("-")) {
10139
- el._value = value;
10140
10151
  const oldValue = tag === "OPTION" ? el.getAttribute("value") || "" : el.value;
10141
10152
  const newValue = value == null ? "" : value;
10142
- if (oldValue !== newValue) {
10153
+ if (oldValue !== newValue || !("_value" in el)) {
10143
10154
  el.value = newValue;
10144
10155
  }
10145
10156
  if (value == null) {
10146
10157
  el.removeAttribute(key);
10147
10158
  }
10159
+ el._value = value;
10148
10160
  return;
10149
10161
  }
10150
10162
  let needRemove = false;
@@ -10184,11 +10196,14 @@ function patchEvent(el, rawName, prevValue, nextValue, instance = null) {
10184
10196
  const invokers = el[veiKey] || (el[veiKey] = {});
10185
10197
  const existingInvoker = invokers[rawName];
10186
10198
  if (nextValue && existingInvoker) {
10187
- existingInvoker.value = nextValue;
10199
+ existingInvoker.value = sanitizeEventValue(nextValue, rawName) ;
10188
10200
  } else {
10189
10201
  const [name, options] = parseName(rawName);
10190
10202
  if (nextValue) {
10191
- const invoker = invokers[rawName] = createInvoker(nextValue, instance);
10203
+ const invoker = invokers[rawName] = createInvoker(
10204
+ sanitizeEventValue(nextValue, rawName) ,
10205
+ instance
10206
+ );
10192
10207
  addEventListener(el, name, invoker, options);
10193
10208
  } else if (existingInvoker) {
10194
10209
  removeEventListener(el, name, existingInvoker, options);
@@ -10231,6 +10246,16 @@ function createInvoker(initialValue, instance) {
10231
10246
  invoker.attached = getNow();
10232
10247
  return invoker;
10233
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
+ }
10234
10259
  function patchStopImmediatePropagation(e, value) {
10235
10260
  if (isArray(value)) {
10236
10261
  const originalStop = e.stopImmediatePropagation;
@@ -10238,7 +10263,9 @@ function patchStopImmediatePropagation(e, value) {
10238
10263
  originalStop.call(e);
10239
10264
  e._stopped = true;
10240
10265
  };
10241
- return value.map((fn) => (e2) => !e2._stopped && fn && fn(e2));
10266
+ return value.map(
10267
+ (fn) => (e2) => !e2._stopped && fn && fn(e2)
10268
+ );
10242
10269
  } else {
10243
10270
  return value;
10244
10271
  }
@@ -10439,7 +10466,7 @@ class VueElement extends BaseClass {
10439
10466
  }
10440
10467
  }
10441
10468
  _setAttr(key) {
10442
- let value = this.getAttribute(key);
10469
+ let value = this.hasAttribute(key) ? this.getAttribute(key) : void 0;
10443
10470
  const camelKey = camelize(key);
10444
10471
  if (this._numberProps && this._numberProps[camelKey]) {
10445
10472
  value = toNumber(value);
@@ -10605,7 +10632,28 @@ const TransitionGroupImpl = {
10605
10632
  const rawProps = toRaw(props);
10606
10633
  const cssTransitionProps = resolveTransitionProps(rawProps);
10607
10634
  let tag = rawProps.tag || Fragment;
10608
- 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
+ }
10609
10657
  children = slots.default ? getTransitionRawChildren(slots.default()) : [];
10610
10658
  for (let i = 0; i < children.length; i++) {
10611
10659
  const child = children[i];
@@ -10618,16 +10666,6 @@ const TransitionGroupImpl = {
10618
10666
  warn(`<TransitionGroup> children must be keyed.`);
10619
10667
  }
10620
10668
  }
10621
- if (prevChildren) {
10622
- for (let i = 0; i < prevChildren.length; i++) {
10623
- const child = prevChildren[i];
10624
- setTransitionHooks(
10625
- child,
10626
- resolveTransitionHooks(child, cssTransitionProps, state, instance)
10627
- );
10628
- positionMap.set(child, child.el.getBoundingClientRect());
10629
- }
10630
- }
10631
10669
  return createVNode(tag, null, children);
10632
10670
  };
10633
10671
  }
@@ -10726,7 +10764,7 @@ const vModelText = {
10726
10764
  el[assignKey] = getModelAssigner(vnode);
10727
10765
  if (el.composing)
10728
10766
  return;
10729
- 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;
10730
10768
  const newValue = value == null ? "" : value;
10731
10769
  if (elValue === newValue) {
10732
10770
  return;
@@ -10829,14 +10867,14 @@ const vModelSelect = {
10829
10867
  // set value in mounted & updated because <select> relies on its children
10830
10868
  // <option>s.
10831
10869
  mounted(el, { value, modifiers: { number } }) {
10832
- setSelected(el, value, number);
10870
+ setSelected(el, value);
10833
10871
  },
10834
10872
  beforeUpdate(el, _binding, vnode) {
10835
10873
  el[assignKey] = getModelAssigner(vnode);
10836
10874
  },
10837
10875
  updated(el, { value, modifiers: { number } }) {
10838
10876
  if (!el._assigning) {
10839
- setSelected(el, value, number);
10877
+ setSelected(el, value);
10840
10878
  }
10841
10879
  }
10842
10880
  };
@@ -10856,9 +10894,7 @@ function setSelected(el, value, number) {
10856
10894
  if (isArrayValue) {
10857
10895
  const optionType = typeof optionValue;
10858
10896
  if (optionType === "string" || optionType === "number") {
10859
- option.selected = value.includes(
10860
- number ? looseToNumber(optionValue) : optionValue
10861
- );
10897
+ option.selected = value.some((v) => String(v) === String(optionValue));
10862
10898
  } else {
10863
10899
  option.selected = looseIndexOf(value, optionValue) > -1;
10864
10900
  }