@vue/compat 3.2.11 → 3.2.12

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.
@@ -2441,12 +2441,12 @@ var Vue = (function () {
2441
2441
  function renderComponentRoot(instance) {
2442
2442
  const { type: Component, vnode, proxy, withProxy, props, propsOptions: [propsOptions], slots, attrs, emit, render, renderCache, data, setupState, ctx, inheritAttrs } = instance;
2443
2443
  let result;
2444
+ let fallthroughAttrs;
2444
2445
  const prev = setCurrentRenderingInstance(instance);
2445
2446
  {
2446
2447
  accessedAttrs = false;
2447
2448
  }
2448
2449
  try {
2449
- let fallthroughAttrs;
2450
2450
  if (vnode.shapeFlag & 4 /* STATEFUL_COMPONENT */) {
2451
2451
  // withProxy is a proxy with a different `has` trap only for
2452
2452
  // runtime-compiled render functions using `with` block.
@@ -2477,108 +2477,105 @@ var Vue = (function () {
2477
2477
  ? attrs
2478
2478
  : getFunctionalFallthrough(attrs);
2479
2479
  }
2480
- // attr merging
2481
- // in dev mode, comments are preserved, and it's possible for a template
2482
- // to have comments along side the root element which makes it a fragment
2483
- let root = result;
2484
- let setRoot = undefined;
2485
- if (true &&
2486
- result.patchFlag > 0 &&
2487
- result.patchFlag & 2048 /* DEV_ROOT_FRAGMENT */) {
2488
- ;
2489
- [root, setRoot] = getChildRoot(result);
2490
- }
2491
- if (fallthroughAttrs && inheritAttrs !== false) {
2492
- const keys = Object.keys(fallthroughAttrs);
2493
- const { shapeFlag } = root;
2494
- if (keys.length) {
2495
- if (shapeFlag & (1 /* ELEMENT */ | 6 /* COMPONENT */)) {
2496
- if (propsOptions && keys.some(isModelListener)) {
2497
- // If a v-model listener (onUpdate:xxx) has a corresponding declared
2498
- // prop, it indicates this component expects to handle v-model and
2499
- // it should not fallthrough.
2500
- // related: #1543, #1643, #1989
2501
- fallthroughAttrs = filterModelListeners(fallthroughAttrs, propsOptions);
2502
- }
2503
- root = cloneVNode(root, fallthroughAttrs);
2504
- }
2505
- else if (true && !accessedAttrs && root.type !== Comment) {
2506
- const allAttrs = Object.keys(attrs);
2507
- const eventAttrs = [];
2508
- const extraAttrs = [];
2509
- for (let i = 0, l = allAttrs.length; i < l; i++) {
2510
- const key = allAttrs[i];
2511
- if (isOn(key)) {
2512
- // ignore v-model handlers when they fail to fallthrough
2513
- if (!isModelListener(key)) {
2514
- // remove `on`, lowercase first letter to reflect event casing
2515
- // accurately
2516
- eventAttrs.push(key[2].toLowerCase() + key.slice(3));
2517
- }
2518
- }
2519
- else {
2520
- extraAttrs.push(key);
2480
+ }
2481
+ catch (err) {
2482
+ blockStack.length = 0;
2483
+ handleError(err, instance, 1 /* RENDER_FUNCTION */);
2484
+ result = createVNode(Comment);
2485
+ }
2486
+ // attr merging
2487
+ // in dev mode, comments are preserved, and it's possible for a template
2488
+ // to have comments along side the root element which makes it a fragment
2489
+ let root = result;
2490
+ let setRoot = undefined;
2491
+ if (result.patchFlag > 0 &&
2492
+ result.patchFlag & 2048 /* DEV_ROOT_FRAGMENT */) {
2493
+ [root, setRoot] = getChildRoot(result);
2494
+ }
2495
+ if (fallthroughAttrs && inheritAttrs !== false) {
2496
+ const keys = Object.keys(fallthroughAttrs);
2497
+ const { shapeFlag } = root;
2498
+ if (keys.length) {
2499
+ if (shapeFlag & (1 /* ELEMENT */ | 6 /* COMPONENT */)) {
2500
+ if (propsOptions && keys.some(isModelListener)) {
2501
+ // If a v-model listener (onUpdate:xxx) has a corresponding declared
2502
+ // prop, it indicates this component expects to handle v-model and
2503
+ // it should not fallthrough.
2504
+ // related: #1543, #1643, #1989
2505
+ fallthroughAttrs = filterModelListeners(fallthroughAttrs, propsOptions);
2506
+ }
2507
+ root = cloneVNode(root, fallthroughAttrs);
2508
+ }
2509
+ else if (!accessedAttrs && root.type !== Comment) {
2510
+ const allAttrs = Object.keys(attrs);
2511
+ const eventAttrs = [];
2512
+ const extraAttrs = [];
2513
+ for (let i = 0, l = allAttrs.length; i < l; i++) {
2514
+ const key = allAttrs[i];
2515
+ if (isOn(key)) {
2516
+ // ignore v-model handlers when they fail to fallthrough
2517
+ if (!isModelListener(key)) {
2518
+ // remove `on`, lowercase first letter to reflect event casing
2519
+ // accurately
2520
+ eventAttrs.push(key[2].toLowerCase() + key.slice(3));
2521
2521
  }
2522
2522
  }
2523
- if (extraAttrs.length) {
2524
- warn$1(`Extraneous non-props attributes (` +
2525
- `${extraAttrs.join(', ')}) ` +
2526
- `were passed to component but could not be automatically inherited ` +
2527
- `because component renders fragment or text root nodes.`);
2528
- }
2529
- if (eventAttrs.length) {
2530
- warn$1(`Extraneous non-emits event listeners (` +
2531
- `${eventAttrs.join(', ')}) ` +
2532
- `were passed to component but could not be automatically inherited ` +
2533
- `because component renders fragment or text root nodes. ` +
2534
- `If the listener is intended to be a component custom event listener only, ` +
2535
- `declare it using the "emits" option.`);
2523
+ else {
2524
+ extraAttrs.push(key);
2536
2525
  }
2537
2526
  }
2538
- }
2539
- }
2540
- if (true &&
2541
- isCompatEnabled("INSTANCE_ATTRS_CLASS_STYLE" /* INSTANCE_ATTRS_CLASS_STYLE */, instance) &&
2542
- vnode.shapeFlag & 4 /* STATEFUL_COMPONENT */ &&
2543
- root.shapeFlag & (1 /* ELEMENT */ | 6 /* COMPONENT */)) {
2544
- const { class: cls, style } = vnode.props || {};
2545
- if (cls || style) {
2546
- if (true && inheritAttrs === false) {
2547
- warnDeprecation("INSTANCE_ATTRS_CLASS_STYLE" /* INSTANCE_ATTRS_CLASS_STYLE */, instance, getComponentName(instance.type));
2527
+ if (extraAttrs.length) {
2528
+ warn$1(`Extraneous non-props attributes (` +
2529
+ `${extraAttrs.join(', ')}) ` +
2530
+ `were passed to component but could not be automatically inherited ` +
2531
+ `because component renders fragment or text root nodes.`);
2532
+ }
2533
+ if (eventAttrs.length) {
2534
+ warn$1(`Extraneous non-emits event listeners (` +
2535
+ `${eventAttrs.join(', ')}) ` +
2536
+ `were passed to component but could not be automatically inherited ` +
2537
+ `because component renders fragment or text root nodes. ` +
2538
+ `If the listener is intended to be a component custom event listener only, ` +
2539
+ `declare it using the "emits" option.`);
2548
2540
  }
2549
- root = cloneVNode(root, {
2550
- class: cls,
2551
- style: style
2552
- });
2553
- }
2554
- }
2555
- // inherit directives
2556
- if (vnode.dirs) {
2557
- if (true && !isElementRoot(root)) {
2558
- warn$1(`Runtime directive used on component with non-element root node. ` +
2559
- `The directives will not function as intended.`);
2560
2541
  }
2561
- root.dirs = root.dirs ? root.dirs.concat(vnode.dirs) : vnode.dirs;
2562
2542
  }
2563
- // inherit transition data
2564
- if (vnode.transition) {
2565
- if (true && !isElementRoot(root)) {
2566
- warn$1(`Component inside <Transition> renders non-element root node ` +
2567
- `that cannot be animated.`);
2543
+ }
2544
+ if (isCompatEnabled("INSTANCE_ATTRS_CLASS_STYLE" /* INSTANCE_ATTRS_CLASS_STYLE */, instance) &&
2545
+ vnode.shapeFlag & 4 /* STATEFUL_COMPONENT */ &&
2546
+ root.shapeFlag & (1 /* ELEMENT */ | 6 /* COMPONENT */)) {
2547
+ const { class: cls, style } = vnode.props || {};
2548
+ if (cls || style) {
2549
+ if (inheritAttrs === false) {
2550
+ warnDeprecation("INSTANCE_ATTRS_CLASS_STYLE" /* INSTANCE_ATTRS_CLASS_STYLE */, instance, getComponentName(instance.type));
2568
2551
  }
2569
- root.transition = vnode.transition;
2552
+ root = cloneVNode(root, {
2553
+ class: cls,
2554
+ style: style
2555
+ });
2570
2556
  }
2571
- if (true && setRoot) {
2572
- setRoot(root);
2557
+ }
2558
+ // inherit directives
2559
+ if (vnode.dirs) {
2560
+ if (!isElementRoot(root)) {
2561
+ warn$1(`Runtime directive used on component with non-element root node. ` +
2562
+ `The directives will not function as intended.`);
2573
2563
  }
2574
- else {
2575
- result = root;
2564
+ root.dirs = root.dirs ? root.dirs.concat(vnode.dirs) : vnode.dirs;
2565
+ }
2566
+ // inherit transition data
2567
+ if (vnode.transition) {
2568
+ if (!isElementRoot(root)) {
2569
+ warn$1(`Component inside <Transition> renders non-element root node ` +
2570
+ `that cannot be animated.`);
2576
2571
  }
2572
+ root.transition = vnode.transition;
2577
2573
  }
2578
- catch (err) {
2579
- blockStack.length = 0;
2580
- handleError(err, instance, 1 /* RENDER_FUNCTION */);
2581
- result = createVNode(Comment);
2574
+ if (setRoot) {
2575
+ setRoot(root);
2576
+ }
2577
+ else {
2578
+ result = root;
2582
2579
  }
2583
2580
  setCurrentRenderingInstance(prev);
2584
2581
  return result;
@@ -3113,8 +3110,8 @@ var Vue = (function () {
3113
3110
  function normalizeSuspenseSlot(s) {
3114
3111
  let block;
3115
3112
  if (isFunction(s)) {
3116
- const isCompiledSlot = s._c;
3117
- if (isCompiledSlot) {
3113
+ const trackBlock = isBlockTreeEnabled && s._c;
3114
+ if (trackBlock) {
3118
3115
  // disableTracking: false
3119
3116
  // allow block tracking for compiled slots
3120
3117
  // (see ./componentRenderContext.ts)
@@ -3122,7 +3119,7 @@ var Vue = (function () {
3122
3119
  openBlock();
3123
3120
  }
3124
3121
  s = s();
3125
- if (isCompiledSlot) {
3122
+ if (trackBlock) {
3126
3123
  s._d = true;
3127
3124
  block = currentBlock;
3128
3125
  closeBlock();
@@ -5278,7 +5275,7 @@ var Vue = (function () {
5278
5275
  return vm;
5279
5276
  }
5280
5277
  }
5281
- Vue.version = "3.2.11";
5278
+ Vue.version = "3.2.12";
5282
5279
  Vue.config = singletonApp.config;
5283
5280
  Vue.use = (p, ...options) => {
5284
5281
  if (p && isFunction(p.install)) {
@@ -7926,7 +7923,11 @@ var Vue = (function () {
7926
7923
  return Component;
7927
7924
  }
7928
7925
  if (warnMissing && !res) {
7929
- warn$1(`Failed to resolve ${type.slice(0, -1)}: ${name}`);
7926
+ const extra = type === COMPONENTS
7927
+ ? `\nIf this is a native custom element, make sure to exclude it from ` +
7928
+ `component resolution via compilerOptions.isCustomElement.`
7929
+ : ``;
7930
+ warn$1(`Failed to resolve ${type.slice(0, -1)}: ${name}${extra}`);
7930
7931
  }
7931
7932
  return res;
7932
7933
  }
@@ -9368,17 +9369,19 @@ var Vue = (function () {
9368
9369
  function exposeSetupStateOnRenderContext(instance) {
9369
9370
  const { ctx, setupState } = instance;
9370
9371
  Object.keys(toRaw(setupState)).forEach(key => {
9371
- if (!setupState.__isScriptSetup && (key[0] === '$' || key[0] === '_')) {
9372
- warn$1(`setup() return property ${JSON.stringify(key)} should not start with "$" or "_" ` +
9373
- `which are reserved prefixes for Vue internals.`);
9374
- return;
9372
+ if (!setupState.__isScriptSetup) {
9373
+ if (key[0] === '$' || key[0] === '_') {
9374
+ warn$1(`setup() return property ${JSON.stringify(key)} should not start with "$" or "_" ` +
9375
+ `which are reserved prefixes for Vue internals.`);
9376
+ return;
9377
+ }
9378
+ Object.defineProperty(ctx, key, {
9379
+ enumerable: true,
9380
+ configurable: true,
9381
+ get: () => setupState[key],
9382
+ set: NOOP
9383
+ });
9375
9384
  }
9376
- Object.defineProperty(ctx, key, {
9377
- enumerable: true,
9378
- configurable: true,
9379
- get: () => setupState[key],
9380
- set: NOOP
9381
- });
9382
9385
  });
9383
9386
  }
9384
9387
 
@@ -10137,11 +10140,18 @@ var Vue = (function () {
10137
10140
  // 2. If a component is unmounted during a parent component's update,
10138
10141
  // its update can be skipped.
10139
10142
  queue.sort((a, b) => getId(a) - getId(b));
10143
+ // conditional usage of checkRecursiveUpdate must be determined out of
10144
+ // try ... catch block since Rollup by default de-optimizes treeshaking
10145
+ // inside try-catch. This can leave all warning code unshaked. Although
10146
+ // they would get eventually shaken by a minifier like terser, some minifiers
10147
+ // would fail to do that (e.g. https://github.com/evanw/esbuild/issues/1610)
10148
+ const check = (job) => checkRecursiveUpdates(seen, job)
10149
+ ;
10140
10150
  try {
10141
10151
  for (flushIndex = 0; flushIndex < queue.length; flushIndex++) {
10142
10152
  const job = queue[flushIndex];
10143
10153
  if (job && job.active !== false) {
10144
- if (true && checkRecursiveUpdates(seen, job)) {
10154
+ if (true && check(job)) {
10145
10155
  continue;
10146
10156
  }
10147
10157
  // console.log(`running:`, job.id)
@@ -10829,7 +10839,7 @@ var Vue = (function () {
10829
10839
  }
10830
10840
 
10831
10841
  // Core API ------------------------------------------------------------------
10832
- const version = "3.2.11";
10842
+ const version = "3.2.12";
10833
10843
  /**
10834
10844
  * SSR utils for \@vue/server-renderer. Only exposed in cjs builds.
10835
10845
  * @internal
@@ -11355,6 +11365,7 @@ var Vue = (function () {
11355
11365
  this._instance = null;
11356
11366
  this._connected = false;
11357
11367
  this._resolved = false;
11368
+ this._numberProps = null;
11358
11369
  if (this.shadowRoot && hydrate) {
11359
11370
  hydrate(this._createVNode(), this.shadowRoot);
11360
11371
  }
@@ -11370,18 +11381,17 @@ var Vue = (function () {
11370
11381
  this._setAttr(this.attributes[i].name);
11371
11382
  }
11372
11383
  // watch future attr changes
11373
- const observer = new MutationObserver(mutations => {
11384
+ new MutationObserver(mutations => {
11374
11385
  for (const m of mutations) {
11375
11386
  this._setAttr(m.attributeName);
11376
11387
  }
11377
- });
11378
- observer.observe(this, { attributes: true });
11388
+ }).observe(this, { attributes: true });
11379
11389
  }
11380
11390
  connectedCallback() {
11381
11391
  this._connected = true;
11382
11392
  if (!this._instance) {
11383
11393
  this._resolveDef();
11384
- render(this._createVNode(), this.shadowRoot);
11394
+ this._update();
11385
11395
  }
11386
11396
  }
11387
11397
  disconnectedCallback() {
@@ -11402,15 +11412,31 @@ var Vue = (function () {
11402
11412
  }
11403
11413
  const resolve = (def) => {
11404
11414
  this._resolved = true;
11415
+ const { props, styles } = def;
11416
+ const hasOptions = !isArray(props);
11417
+ const rawKeys = props ? (hasOptions ? Object.keys(props) : props) : [];
11418
+ // cast Number-type props set before resolve
11419
+ let numberProps;
11420
+ if (hasOptions) {
11421
+ for (const key in this._props) {
11422
+ const opt = props[key];
11423
+ if (opt === Number || (opt && opt.type === Number)) {
11424
+ this._props[key] = toNumber(this._props[key]);
11425
+ (numberProps || (numberProps = Object.create(null)))[key] = true;
11426
+ }
11427
+ }
11428
+ }
11429
+ if (numberProps) {
11430
+ this._numberProps = numberProps;
11431
+ this._update();
11432
+ }
11405
11433
  // check if there are props set pre-upgrade or connect
11406
11434
  for (const key of Object.keys(this)) {
11407
11435
  if (key[0] !== '_') {
11408
11436
  this._setProp(key, this[key]);
11409
11437
  }
11410
11438
  }
11411
- const { props, styles } = def;
11412
11439
  // defining getter/setters on prototype
11413
- const rawKeys = props ? (isArray(props) ? props : Object.keys(props)) : [];
11414
11440
  for (const key of rawKeys.map(camelize)) {
11415
11441
  Object.defineProperty(this, key, {
11416
11442
  get() {
@@ -11432,7 +11458,11 @@ var Vue = (function () {
11432
11458
  }
11433
11459
  }
11434
11460
  _setAttr(key) {
11435
- this._setProp(camelize(key), toNumber(this.getAttribute(key)), false);
11461
+ let value = this.getAttribute(key);
11462
+ if (this._numberProps && this._numberProps[key]) {
11463
+ value = toNumber(value);
11464
+ }
11465
+ this._setProp(camelize(key), value, false);
11436
11466
  }
11437
11467
  /**
11438
11468
  * @internal
@@ -11447,7 +11477,7 @@ var Vue = (function () {
11447
11477
  if (val !== this._props[key]) {
11448
11478
  this._props[key] = val;
11449
11479
  if (this._instance) {
11450
- render(this._createVNode(), this.shadowRoot);
11480
+ this._update();
11451
11481
  }
11452
11482
  // reflect
11453
11483
  if (shouldReflect) {
@@ -11463,6 +11493,9 @@ var Vue = (function () {
11463
11493
  }
11464
11494
  }
11465
11495
  }
11496
+ _update() {
11497
+ render(this._createVNode(), this.shadowRoot);
11498
+ }
11466
11499
  _createVNode() {
11467
11500
  const vnode = createVNode(this._def, extend({}, this._props));
11468
11501
  if (!this._instance) {
@@ -11483,7 +11516,7 @@ var Vue = (function () {
11483
11516
  if (!this._def.__asyncLoader) {
11484
11517
  // reload
11485
11518
  this._instance = null;
11486
- render(this._createVNode(), this.shadowRoot);
11519
+ this._update();
11487
11520
  }
11488
11521
  };
11489
11522
  }
@@ -16776,7 +16809,7 @@ var Vue = (function () {
16776
16809
  };
16777
16810
  }
16778
16811
 
16779
- const fnExpRE = /^\s*([\w$_]+|\([^)]*?\))\s*=>|^\s*function(?:\s+[\w$]+)?\s*\(/;
16812
+ const fnExpRE = /^\s*([\w$_]+|(async\s*)?\([^)]*?\))\s*=>|^\s*(async\s+)?function(?:\s+[\w$]+)?\s*\(/;
16780
16813
  const transformOn = (dir, node, context, augmentor) => {
16781
16814
  const { loc, modifiers, arg } = dir;
16782
16815
  if (!dir.exp && !modifiers.length) {