@vue/runtime-dom 3.3.8 → 3.3.10

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.
@@ -15,8 +15,8 @@ var VueRuntimeDOM = (function (exports) {
15
15
  const NOOP = () => {
16
16
  };
17
17
  const NO = () => false;
18
- const onRE = /^on[^a-z]/;
19
- const isOn = (key) => onRE.test(key);
18
+ const isOn = (key) => key.charCodeAt(0) === 111 && key.charCodeAt(1) === 110 && // uppercase letter
19
+ (key.charCodeAt(2) > 122 || key.charCodeAt(2) < 97);
20
20
  const isModelListener = (key) => key.startsWith("onUpdate:");
21
21
  const extend = Object.assign;
22
22
  const remove = (arr, el) => {
@@ -939,7 +939,7 @@ var VueRuntimeDOM = (function (exports) {
939
939
  toRaw(this)
940
940
  );
941
941
  }
942
- return type === "delete" ? false : this;
942
+ return type === "delete" ? false : type === "clear" ? void 0 : this;
943
943
  };
944
944
  }
945
945
  function createInstrumentations() {
@@ -2210,9 +2210,19 @@ var VueRuntimeDOM = (function (exports) {
2210
2210
  try {
2211
2211
  if (vnode.shapeFlag & 4) {
2212
2212
  const proxyToUse = withProxy || proxy;
2213
+ const thisProxy = setupState.__isScriptSetup ? new Proxy(proxyToUse, {
2214
+ get(target, key, receiver) {
2215
+ warn(
2216
+ `Property '${String(
2217
+ key
2218
+ )}' was accessed via 'this'. Avoid using 'this' in templates.`
2219
+ );
2220
+ return Reflect.get(target, key, receiver);
2221
+ }
2222
+ }) : proxyToUse;
2213
2223
  result = normalizeVNode(
2214
2224
  render.call(
2215
- proxyToUse,
2225
+ thisProxy,
2216
2226
  proxyToUse,
2217
2227
  renderCache,
2218
2228
  props,
@@ -2823,7 +2833,12 @@ If this is a native custom element, make sure to exclude it from component resol
2823
2833
  if (delayEnter) {
2824
2834
  activeBranch.transition.afterLeave = () => {
2825
2835
  if (pendingId === suspense.pendingId) {
2826
- move(pendingBranch, container2, anchor2, 0);
2836
+ move(
2837
+ pendingBranch,
2838
+ container2,
2839
+ next(activeBranch),
2840
+ 0
2841
+ );
2827
2842
  queuePostFlushCb(effects);
2828
2843
  }
2829
2844
  };
@@ -2870,7 +2885,6 @@ If this is a native custom element, make sure to exclude it from component resol
2870
2885
  }
2871
2886
  const { vnode: vnode2, activeBranch, parentComponent: parentComponent2, container: container2, isSVG: isSVG2 } = suspense;
2872
2887
  triggerEvent(vnode2, "onFallback");
2873
- const anchor2 = next(activeBranch);
2874
2888
  const mountFallback = () => {
2875
2889
  if (!suspense.isInFallback) {
2876
2890
  return;
@@ -2879,7 +2893,7 @@ If this is a native custom element, make sure to exclude it from component resol
2879
2893
  null,
2880
2894
  fallbackVNode,
2881
2895
  container2,
2882
- anchor2,
2896
+ next(activeBranch),
2883
2897
  parentComponent2,
2884
2898
  null,
2885
2899
  // fallback tree will not have suspense context
@@ -3174,6 +3188,7 @@ If this is a native custom element, make sure to exclude it from component resol
3174
3188
  let onCleanup = (fn) => {
3175
3189
  cleanup = effect.onStop = () => {
3176
3190
  callWithErrorHandling(fn, instance, 4);
3191
+ cleanup = effect.onStop = void 0;
3177
3192
  };
3178
3193
  };
3179
3194
  let oldValue = isMultiSource ? new Array(source.length).fill(INITIAL_WATCHER_VALUE) : INITIAL_WATCHER_VALUE;
@@ -3644,7 +3659,11 @@ If this is a native custom element, make sure to exclude it from component resol
3644
3659
  }
3645
3660
  }
3646
3661
  function getKeepAliveChild(vnode) {
3647
- return isKeepAlive(vnode) ? vnode.children ? vnode.children[0] : void 0 : vnode;
3662
+ return isKeepAlive(vnode) ? (
3663
+ // #7121 ensure get the child component subtree in case
3664
+ // it's been replaced during HMR
3665
+ vnode.component ? vnode.component.subTree : vnode.children ? vnode.children[0] : void 0
3666
+ ) : vnode;
3648
3667
  }
3649
3668
  function setTransitionHooks(vnode, hooks) {
3650
3669
  if (vnode.shapeFlag & 6 && vnode.component) {
@@ -5637,6 +5656,9 @@ If you want to remount the same app, move your app creation logic into a factory
5637
5656
  };
5638
5657
  }
5639
5658
  function getInvalidTypeMessage(name, value, expectedTypes) {
5659
+ if (expectedTypes.length === 0) {
5660
+ return `Prop type [] for prop "${name}" won't match anything. Did you mean to use type Array instead?`;
5661
+ }
5640
5662
  let message = `Invalid prop: type check failed for prop "${name}". Expected ${expectedTypes.map(capitalize).join(" | ")}`;
5641
5663
  const expectedType = expectedTypes[0];
5642
5664
  const receivedType = toRawType(value);
@@ -5906,6 +5928,20 @@ If you want to remount the same app, move your app creation logic into a factory
5906
5928
  const { type, ref, shapeFlag, patchFlag } = vnode;
5907
5929
  let domType = node.nodeType;
5908
5930
  vnode.el = node;
5931
+ {
5932
+ if (!("__vnode" in node)) {
5933
+ Object.defineProperty(node, "__vnode", {
5934
+ value: vnode,
5935
+ enumerable: false
5936
+ });
5937
+ }
5938
+ if (!("__vueParentComponent" in node)) {
5939
+ Object.defineProperty(node, "__vueParentComponent", {
5940
+ value: parentComponent,
5941
+ enumerable: false
5942
+ });
5943
+ }
5944
+ }
5909
5945
  if (patchFlag === -2) {
5910
5946
  optimized = false;
5911
5947
  vnode.dynamicChildren = null;
@@ -6067,15 +6103,16 @@ If you want to remount the same app, move your app creation logic into a factory
6067
6103
  const hydrateElement = (el, vnode, parentComponent, parentSuspense, slotScopeIds, optimized) => {
6068
6104
  optimized = optimized || !!vnode.dynamicChildren;
6069
6105
  const { type, props, patchFlag, shapeFlag, dirs, transition } = vnode;
6070
- const forcePatchValue = type === "input" && dirs || type === "option";
6106
+ const forcePatch = type === "input" || type === "option";
6071
6107
  {
6072
6108
  if (dirs) {
6073
6109
  invokeDirectiveHook(vnode, null, parentComponent, "created");
6074
6110
  }
6075
6111
  if (props) {
6076
- if (forcePatchValue || !optimized || patchFlag & (16 | 32)) {
6112
+ if (forcePatch || !optimized || patchFlag & (16 | 32)) {
6077
6113
  for (const key in props) {
6078
- if (forcePatchValue && key.endsWith("value") || isOn(key) && !isReservedProp(key)) {
6114
+ if (forcePatch && (key.endsWith("value") || key === "indeterminate") || isOn(key) && !isReservedProp(key) || // force hydrate v-bind with .prop modifiers
6115
+ key[0] === ".") {
6079
6116
  patchProp(
6080
6117
  el,
6081
6118
  key,
@@ -7832,6 +7869,7 @@ If you want to remount the same app, move your app creation logic into a factory
7832
7869
  }
7833
7870
  };
7834
7871
  const TeleportImpl = {
7872
+ name: "Teleport",
7835
7873
  __isTeleport: true,
7836
7874
  process(n1, n2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized, internals) {
7837
7875
  const {
@@ -8253,7 +8291,7 @@ If you want to remount the same app, move your app creation logic into a factory
8253
8291
  if (shapeFlag & 4 && isProxy(type)) {
8254
8292
  type = toRaw(type);
8255
8293
  warn(
8256
- `Vue received a Component which was made a reactive object. This can lead to unnecessary performance overhead, and should be avoided by marking the component with \`markRaw\` or using \`shallowRef\` instead of \`ref\`.`,
8294
+ `Vue received a Component that was made a reactive object. This can lead to unnecessary performance overhead and should be avoided by marking the component with \`markRaw\` or using \`shallowRef\` instead of \`ref\`.`,
8257
8295
  `
8258
8296
  Component that was made reactive: `,
8259
8297
  type
@@ -8872,9 +8910,9 @@ Component that was made reactive: `,
8872
8910
  return;
8873
8911
  }
8874
8912
  const vueStyle = { style: "color:#3ba776" };
8875
- const numberStyle = { style: "color:#0b1bc9" };
8876
- const stringStyle = { style: "color:#b62e24" };
8877
- const keywordStyle = { style: "color:#9d288c" };
8913
+ const numberStyle = { style: "color:#1677ff" };
8914
+ const stringStyle = { style: "color:#f5222d" };
8915
+ const keywordStyle = { style: "color:#eb2f96" };
8878
8916
  const formatter = {
8879
8917
  header(obj) {
8880
8918
  if (!isObject(obj)) {
@@ -9068,7 +9106,7 @@ Component that was made reactive: `,
9068
9106
  return true;
9069
9107
  }
9070
9108
 
9071
- const version = "3.3.8";
9109
+ const version = "3.3.10";
9072
9110
  const ssrUtils = null;
9073
9111
  const resolveFilter = null;
9074
9112
  const compatUtils = null;
@@ -9680,7 +9718,8 @@ Component that was made reactive: `,
9680
9718
  }
9681
9719
  }
9682
9720
 
9683
- const nativeOnRE = /^on[a-z]/;
9721
+ const isNativeOn = (key) => key.charCodeAt(0) === 111 && key.charCodeAt(1) === 110 && // lowercase letter
9722
+ key.charCodeAt(2) > 96 && key.charCodeAt(2) < 123;
9684
9723
  const patchProp = (el, key, prevValue, nextValue, isSVG = false, prevChildren, parentComponent, parentSuspense, unmountChildren) => {
9685
9724
  if (key === "class") {
9686
9725
  patchClass(el, nextValue, isSVG);
@@ -9714,7 +9753,7 @@ Component that was made reactive: `,
9714
9753
  if (key === "innerHTML" || key === "textContent") {
9715
9754
  return true;
9716
9755
  }
9717
- if (key in el && nativeOnRE.test(key) && isFunction(value)) {
9756
+ if (key in el && isNativeOn(key) && isFunction(value)) {
9718
9757
  return true;
9719
9758
  }
9720
9759
  return false;
@@ -9731,7 +9770,11 @@ Component that was made reactive: `,
9731
9770
  if (key === "type" && el.tagName === "TEXTAREA") {
9732
9771
  return false;
9733
9772
  }
9734
- if (nativeOnRE.test(key) && isString(value)) {
9773
+ if (key === "width" || key === "height") {
9774
+ const tag = el.tagName;
9775
+ return !(tag === "IMG" || tag === "VIDEO" || tag === "CANVAS" || tag === "SOURCE");
9776
+ }
9777
+ if (isNativeOn(key) && isString(value)) {
9735
9778
  return false;
9736
9779
  }
9737
9780
  return key in el;
@@ -10201,21 +10244,20 @@ Component that was made reactive: `,
10201
10244
  el[assignKey] = getModelAssigner(vnode);
10202
10245
  if (el.composing)
10203
10246
  return;
10247
+ const elValue = number || el.type === "number" ? looseToNumber(el.value) : el.value;
10248
+ const newValue = value == null ? "" : value;
10249
+ if (elValue === newValue) {
10250
+ return;
10251
+ }
10204
10252
  if (document.activeElement === el && el.type !== "range") {
10205
10253
  if (lazy) {
10206
10254
  return;
10207
10255
  }
10208
- if (trim && el.value.trim() === value) {
10256
+ if (trim && el.value.trim() === newValue) {
10209
10257
  return;
10210
10258
  }
10211
- if ((number || el.type === "number") && looseToNumber(el.value) === value) {
10212
- return;
10213
- }
10214
- }
10215
- const newValue = value == null ? "" : value;
10216
- if (el.value !== newValue) {
10217
- el.value = newValue;
10218
10259
  }
10260
+ el.value = newValue;
10219
10261
  }
10220
10262
  };
10221
10263
  const vModelCheckbox = {
@@ -10401,14 +10443,14 @@ Component that was made reactive: `,
10401
10443
  exact: (e, modifiers) => systemModifiers.some((m) => e[`${m}Key`] && !modifiers.includes(m))
10402
10444
  };
10403
10445
  const withModifiers = (fn, modifiers) => {
10404
- return (event, ...args) => {
10446
+ return fn._withMods || (fn._withMods = (event, ...args) => {
10405
10447
  for (let i = 0; i < modifiers.length; i++) {
10406
10448
  const guard = modifierGuards[modifiers[i]];
10407
10449
  if (guard && guard(event, modifiers))
10408
10450
  return;
10409
10451
  }
10410
10452
  return fn(event, ...args);
10411
- };
10453
+ });
10412
10454
  };
10413
10455
  const keyNames = {
10414
10456
  esc: "escape",
@@ -10420,7 +10462,7 @@ Component that was made reactive: `,
10420
10462
  delete: "backspace"
10421
10463
  };
10422
10464
  const withKeys = (fn, modifiers) => {
10423
- return (event) => {
10465
+ return fn._withKeys || (fn._withKeys = (event) => {
10424
10466
  if (!("key" in event)) {
10425
10467
  return;
10426
10468
  }
@@ -10428,7 +10470,7 @@ Component that was made reactive: `,
10428
10470
  if (modifiers.some((k) => k === eventKey || keyNames[k] === eventKey)) {
10429
10471
  return fn(event);
10430
10472
  }
10431
- };
10473
+ });
10432
10474
  };
10433
10475
 
10434
10476
  const rendererOptions = /* @__PURE__ */ extend({ patchProp }, nodeOps);