@vue/compat 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.
@@ -12,8 +12,8 @@ const EMPTY_ARR = Object.freeze([]) ;
12
12
  const NOOP = () => {
13
13
  };
14
14
  const NO = () => false;
15
- const onRE = /^on[^a-z]/;
16
- const isOn = (key) => onRE.test(key);
15
+ const isOn = (key) => key.charCodeAt(0) === 111 && key.charCodeAt(1) === 110 && // uppercase letter
16
+ (key.charCodeAt(2) > 122 || key.charCodeAt(2) < 97);
17
17
  const isModelListener = (key) => key.startsWith("onUpdate:");
18
18
  const extend = Object.assign;
19
19
  const remove = (arr, el) => {
@@ -936,7 +936,7 @@ function createReadonlyMethod(type) {
936
936
  toRaw(this)
937
937
  );
938
938
  }
939
- return type === "delete" ? false : this;
939
+ return type === "delete" ? false : type === "clear" ? void 0 : this;
940
940
  };
941
941
  }
942
942
  function createInstrumentations() {
@@ -2664,9 +2664,19 @@ function renderComponentRoot(instance) {
2664
2664
  try {
2665
2665
  if (vnode.shapeFlag & 4) {
2666
2666
  const proxyToUse = withProxy || proxy;
2667
+ const thisProxy = setupState.__isScriptSetup ? new Proxy(proxyToUse, {
2668
+ get(target, key, receiver) {
2669
+ warn(
2670
+ `Property '${String(
2671
+ key
2672
+ )}' was accessed via 'this'. Avoid using 'this' in templates.`
2673
+ );
2674
+ return Reflect.get(target, key, receiver);
2675
+ }
2676
+ }) : proxyToUse;
2667
2677
  result = normalizeVNode(
2668
2678
  render.call(
2669
- proxyToUse,
2679
+ thisProxy,
2670
2680
  proxyToUse,
2671
2681
  renderCache,
2672
2682
  props,
@@ -3297,7 +3307,12 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
3297
3307
  if (delayEnter) {
3298
3308
  activeBranch.transition.afterLeave = () => {
3299
3309
  if (pendingId === suspense.pendingId) {
3300
- move(pendingBranch, container2, anchor2, 0);
3310
+ move(
3311
+ pendingBranch,
3312
+ container2,
3313
+ next(activeBranch),
3314
+ 0
3315
+ );
3301
3316
  queuePostFlushCb(effects);
3302
3317
  }
3303
3318
  };
@@ -3344,7 +3359,6 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
3344
3359
  }
3345
3360
  const { vnode: vnode2, activeBranch, parentComponent: parentComponent2, container: container2, isSVG: isSVG2 } = suspense;
3346
3361
  triggerEvent(vnode2, "onFallback");
3347
- const anchor2 = next(activeBranch);
3348
3362
  const mountFallback = () => {
3349
3363
  if (!suspense.isInFallback) {
3350
3364
  return;
@@ -3353,7 +3367,7 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
3353
3367
  null,
3354
3368
  fallbackVNode,
3355
3369
  container2,
3356
- anchor2,
3370
+ next(activeBranch),
3357
3371
  parentComponent2,
3358
3372
  null,
3359
3373
  // fallback tree will not have suspense context
@@ -3696,6 +3710,7 @@ function doWatch(source, cb, { immediate, deep, flush, onTrack, onTrigger } = EM
3696
3710
  let onCleanup = (fn) => {
3697
3711
  cleanup = effect.onStop = () => {
3698
3712
  callWithErrorHandling(fn, instance, 4);
3713
+ cleanup = effect.onStop = void 0;
3699
3714
  };
3700
3715
  };
3701
3716
  let oldValue = isMultiSource ? new Array(source.length).fill(INITIAL_WATCHER_VALUE) : INITIAL_WATCHER_VALUE;
@@ -4172,7 +4187,11 @@ function emptyPlaceholder(vnode) {
4172
4187
  }
4173
4188
  }
4174
4189
  function getKeepAliveChild(vnode) {
4175
- return isKeepAlive(vnode) ? vnode.children ? vnode.children[0] : void 0 : vnode;
4190
+ return isKeepAlive(vnode) ? (
4191
+ // #7121 ensure get the child component subtree in case
4192
+ // it's been replaced during HMR
4193
+ vnode.component ? vnode.component.subTree : vnode.children ? vnode.children[0] : void 0
4194
+ ) : vnode;
4176
4195
  }
4177
4196
  function setTransitionHooks(vnode, hooks) {
4178
4197
  if (vnode.shapeFlag & 6 && vnode.component) {
@@ -6189,7 +6208,7 @@ function createCompatVue$1(createApp, createSingletonApp) {
6189
6208
  return vm;
6190
6209
  }
6191
6210
  }
6192
- Vue.version = `2.6.14-compat:${"3.3.8"}`;
6211
+ Vue.version = `2.6.14-compat:${"3.3.10"}`;
6193
6212
  Vue.config = singletonApp.config;
6194
6213
  Vue.use = (p, ...options) => {
6195
6214
  if (p && isFunction(p.install)) {
@@ -7217,6 +7236,9 @@ function assertType(value, type) {
7217
7236
  };
7218
7237
  }
7219
7238
  function getInvalidTypeMessage(name, value, expectedTypes) {
7239
+ if (expectedTypes.length === 0) {
7240
+ return `Prop type [] for prop "${name}" won't match anything. Did you mean to use type Array instead?`;
7241
+ }
7220
7242
  let message = `Invalid prop: type check failed for prop "${name}". Expected ${expectedTypes.map(capitalize).join(" | ")}`;
7221
7243
  const expectedType = expectedTypes[0];
7222
7244
  const receivedType = toRawType(value);
@@ -7488,6 +7510,20 @@ function createHydrationFunctions(rendererInternals) {
7488
7510
  const { type, ref, shapeFlag, patchFlag } = vnode;
7489
7511
  let domType = node.nodeType;
7490
7512
  vnode.el = node;
7513
+ {
7514
+ if (!("__vnode" in node)) {
7515
+ Object.defineProperty(node, "__vnode", {
7516
+ value: vnode,
7517
+ enumerable: false
7518
+ });
7519
+ }
7520
+ if (!("__vueParentComponent" in node)) {
7521
+ Object.defineProperty(node, "__vueParentComponent", {
7522
+ value: parentComponent,
7523
+ enumerable: false
7524
+ });
7525
+ }
7526
+ }
7491
7527
  if (patchFlag === -2) {
7492
7528
  optimized = false;
7493
7529
  vnode.dynamicChildren = null;
@@ -7649,15 +7685,16 @@ function createHydrationFunctions(rendererInternals) {
7649
7685
  const hydrateElement = (el, vnode, parentComponent, parentSuspense, slotScopeIds, optimized) => {
7650
7686
  optimized = optimized || !!vnode.dynamicChildren;
7651
7687
  const { type, props, patchFlag, shapeFlag, dirs, transition } = vnode;
7652
- const forcePatchValue = type === "input" && dirs || type === "option";
7688
+ const forcePatch = type === "input" || type === "option";
7653
7689
  {
7654
7690
  if (dirs) {
7655
7691
  invokeDirectiveHook(vnode, null, parentComponent, "created");
7656
7692
  }
7657
7693
  if (props) {
7658
- if (forcePatchValue || !optimized || patchFlag & (16 | 32)) {
7694
+ if (forcePatch || !optimized || patchFlag & (16 | 32)) {
7659
7695
  for (const key in props) {
7660
- if (forcePatchValue && key.endsWith("value") || isOn(key) && !isReservedProp(key)) {
7696
+ if (forcePatch && (key.endsWith("value") || key === "indeterminate") || isOn(key) && !isReservedProp(key) || // force hydrate v-bind with .prop modifiers
7697
+ key[0] === ".") {
7661
7698
  patchProp(
7662
7699
  el,
7663
7700
  key,
@@ -9448,6 +9485,7 @@ const resolveTarget = (props, select) => {
9448
9485
  }
9449
9486
  };
9450
9487
  const TeleportImpl = {
9488
+ name: "Teleport",
9451
9489
  __isTeleport: true,
9452
9490
  process(n1, n2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized, internals) {
9453
9491
  const {
@@ -9927,7 +9965,7 @@ function _createVNode(type, props = null, children = null, patchFlag = 0, dynami
9927
9965
  if (shapeFlag & 4 && isProxy(type)) {
9928
9966
  type = toRaw(type);
9929
9967
  warn(
9930
- `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\`.`,
9968
+ `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\`.`,
9931
9969
  `
9932
9970
  Component that was made reactive: `,
9933
9971
  type
@@ -10567,9 +10605,9 @@ function initCustomFormatter() {
10567
10605
  return;
10568
10606
  }
10569
10607
  const vueStyle = { style: "color:#3ba776" };
10570
- const numberStyle = { style: "color:#0b1bc9" };
10571
- const stringStyle = { style: "color:#b62e24" };
10572
- const keywordStyle = { style: "color:#9d288c" };
10608
+ const numberStyle = { style: "color:#1677ff" };
10609
+ const stringStyle = { style: "color:#f5222d" };
10610
+ const keywordStyle = { style: "color:#eb2f96" };
10573
10611
  const formatter = {
10574
10612
  header(obj) {
10575
10613
  if (!isObject(obj)) {
@@ -10763,7 +10801,7 @@ function isMemoSame(cached, memo) {
10763
10801
  return true;
10764
10802
  }
10765
10803
 
10766
- const version = "3.3.8";
10804
+ const version = "3.3.10";
10767
10805
  const ssrUtils = null;
10768
10806
  const resolveFilter = resolveFilter$1 ;
10769
10807
  const _compatUtils = {
@@ -11462,7 +11500,8 @@ function patchStopImmediatePropagation(e, value) {
11462
11500
  }
11463
11501
  }
11464
11502
 
11465
- const nativeOnRE = /^on[a-z]/;
11503
+ const isNativeOn = (key) => key.charCodeAt(0) === 111 && key.charCodeAt(1) === 110 && // lowercase letter
11504
+ key.charCodeAt(2) > 96 && key.charCodeAt(2) < 123;
11466
11505
  const patchProp = (el, key, prevValue, nextValue, isSVG = false, prevChildren, parentComponent, parentSuspense, unmountChildren) => {
11467
11506
  if (key === "class") {
11468
11507
  patchClass(el, nextValue, isSVG);
@@ -11496,7 +11535,7 @@ function shouldSetAsProp(el, key, value, isSVG) {
11496
11535
  if (key === "innerHTML" || key === "textContent") {
11497
11536
  return true;
11498
11537
  }
11499
- if (key in el && nativeOnRE.test(key) && isFunction(value)) {
11538
+ if (key in el && isNativeOn(key) && isFunction(value)) {
11500
11539
  return true;
11501
11540
  }
11502
11541
  return false;
@@ -11513,7 +11552,11 @@ function shouldSetAsProp(el, key, value, isSVG) {
11513
11552
  if (key === "type" && el.tagName === "TEXTAREA") {
11514
11553
  return false;
11515
11554
  }
11516
- if (nativeOnRE.test(key) && isString(value)) {
11555
+ if (key === "width" || key === "height") {
11556
+ const tag = el.tagName;
11557
+ return !(tag === "IMG" || tag === "VIDEO" || tag === "CANVAS" || tag === "SOURCE");
11558
+ }
11559
+ if (isNativeOn(key) && isString(value)) {
11517
11560
  return false;
11518
11561
  }
11519
11562
  return key in el;
@@ -12004,21 +12047,20 @@ const vModelText = {
12004
12047
  el[assignKey] = getModelAssigner(vnode);
12005
12048
  if (el.composing)
12006
12049
  return;
12050
+ const elValue = number || el.type === "number" ? looseToNumber(el.value) : el.value;
12051
+ const newValue = value == null ? "" : value;
12052
+ if (elValue === newValue) {
12053
+ return;
12054
+ }
12007
12055
  if (document.activeElement === el && el.type !== "range") {
12008
12056
  if (lazy) {
12009
12057
  return;
12010
12058
  }
12011
- if (trim && el.value.trim() === value) {
12059
+ if (trim && el.value.trim() === newValue) {
12012
12060
  return;
12013
12061
  }
12014
- if ((number || el.type === "number") && looseToNumber(el.value) === value) {
12015
- return;
12016
- }
12017
- }
12018
- const newValue = value == null ? "" : value;
12019
- if (el.value !== newValue) {
12020
- el.value = newValue;
12021
12062
  }
12063
+ el.value = newValue;
12022
12064
  }
12023
12065
  };
12024
12066
  const vModelCheckbox = {
@@ -12204,14 +12246,14 @@ const modifierGuards = {
12204
12246
  exact: (e, modifiers) => systemModifiers.some((m) => e[`${m}Key`] && !modifiers.includes(m))
12205
12247
  };
12206
12248
  const withModifiers = (fn, modifiers) => {
12207
- return (event, ...args) => {
12249
+ return fn._withMods || (fn._withMods = (event, ...args) => {
12208
12250
  for (let i = 0; i < modifiers.length; i++) {
12209
12251
  const guard = modifierGuards[modifiers[i]];
12210
12252
  if (guard && guard(event, modifiers))
12211
12253
  return;
12212
12254
  }
12213
12255
  return fn(event, ...args);
12214
- };
12256
+ });
12215
12257
  };
12216
12258
  const keyNames = {
12217
12259
  esc: "escape",
@@ -12239,7 +12281,7 @@ const withKeys = (fn, modifiers) => {
12239
12281
  );
12240
12282
  }
12241
12283
  }
12242
- return (event) => {
12284
+ return fn._withKeys || (fn._withKeys = (event) => {
12243
12285
  if (!("key" in event)) {
12244
12286
  return;
12245
12287
  }
@@ -12267,7 +12309,7 @@ const withKeys = (fn, modifiers) => {
12267
12309
  }
12268
12310
  }
12269
12311
  }
12270
- };
12312
+ });
12271
12313
  };
12272
12314
 
12273
12315
  const rendererOptions = /* @__PURE__ */ extend({ patchProp }, nodeOps);