@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.
@@ -2366,12 +2366,12 @@ var Vue = (function () {
2366
2366
  function renderComponentRoot(instance) {
2367
2367
  const { type: Component, vnode, proxy, withProxy, props, propsOptions: [propsOptions], slots, attrs, emit, render, renderCache, data, setupState, ctx, inheritAttrs } = instance;
2368
2368
  let result;
2369
+ let fallthroughAttrs;
2369
2370
  const prev = setCurrentRenderingInstance(instance);
2370
2371
  {
2371
2372
  accessedAttrs = false;
2372
2373
  }
2373
2374
  try {
2374
- let fallthroughAttrs;
2375
2375
  if (vnode.shapeFlag & 4 /* STATEFUL_COMPONENT */) {
2376
2376
  // withProxy is a proxy with a different `has` trap only for
2377
2377
  // runtime-compiled render functions using `with` block.
@@ -2402,108 +2402,105 @@ var Vue = (function () {
2402
2402
  ? attrs
2403
2403
  : getFunctionalFallthrough(attrs);
2404
2404
  }
2405
- // attr merging
2406
- // in dev mode, comments are preserved, and it's possible for a template
2407
- // to have comments along side the root element which makes it a fragment
2408
- let root = result;
2409
- let setRoot = undefined;
2410
- if (true &&
2411
- result.patchFlag > 0 &&
2412
- result.patchFlag & 2048 /* DEV_ROOT_FRAGMENT */) {
2413
- ;
2414
- [root, setRoot] = getChildRoot(result);
2415
- }
2416
- if (fallthroughAttrs && inheritAttrs !== false) {
2417
- const keys = Object.keys(fallthroughAttrs);
2418
- const { shapeFlag } = root;
2419
- if (keys.length) {
2420
- if (shapeFlag & (1 /* ELEMENT */ | 6 /* COMPONENT */)) {
2421
- if (propsOptions && keys.some(isModelListener)) {
2422
- // If a v-model listener (onUpdate:xxx) has a corresponding declared
2423
- // prop, it indicates this component expects to handle v-model and
2424
- // it should not fallthrough.
2425
- // related: #1543, #1643, #1989
2426
- fallthroughAttrs = filterModelListeners(fallthroughAttrs, propsOptions);
2427
- }
2428
- root = cloneVNode(root, fallthroughAttrs);
2429
- }
2430
- else if (true && !accessedAttrs && root.type !== Comment) {
2431
- const allAttrs = Object.keys(attrs);
2432
- const eventAttrs = [];
2433
- const extraAttrs = [];
2434
- for (let i = 0, l = allAttrs.length; i < l; i++) {
2435
- const key = allAttrs[i];
2436
- if (isOn(key)) {
2437
- // ignore v-model handlers when they fail to fallthrough
2438
- if (!isModelListener(key)) {
2439
- // remove `on`, lowercase first letter to reflect event casing
2440
- // accurately
2441
- eventAttrs.push(key[2].toLowerCase() + key.slice(3));
2442
- }
2443
- }
2444
- else {
2445
- extraAttrs.push(key);
2405
+ }
2406
+ catch (err) {
2407
+ blockStack.length = 0;
2408
+ handleError(err, instance, 1 /* RENDER_FUNCTION */);
2409
+ result = createVNode(Comment);
2410
+ }
2411
+ // attr merging
2412
+ // in dev mode, comments are preserved, and it's possible for a template
2413
+ // to have comments along side the root element which makes it a fragment
2414
+ let root = result;
2415
+ let setRoot = undefined;
2416
+ if (result.patchFlag > 0 &&
2417
+ result.patchFlag & 2048 /* DEV_ROOT_FRAGMENT */) {
2418
+ [root, setRoot] = getChildRoot(result);
2419
+ }
2420
+ if (fallthroughAttrs && inheritAttrs !== false) {
2421
+ const keys = Object.keys(fallthroughAttrs);
2422
+ const { shapeFlag } = root;
2423
+ if (keys.length) {
2424
+ if (shapeFlag & (1 /* ELEMENT */ | 6 /* COMPONENT */)) {
2425
+ if (propsOptions && keys.some(isModelListener)) {
2426
+ // If a v-model listener (onUpdate:xxx) has a corresponding declared
2427
+ // prop, it indicates this component expects to handle v-model and
2428
+ // it should not fallthrough.
2429
+ // related: #1543, #1643, #1989
2430
+ fallthroughAttrs = filterModelListeners(fallthroughAttrs, propsOptions);
2431
+ }
2432
+ root = cloneVNode(root, fallthroughAttrs);
2433
+ }
2434
+ else if (!accessedAttrs && root.type !== Comment) {
2435
+ const allAttrs = Object.keys(attrs);
2436
+ const eventAttrs = [];
2437
+ const extraAttrs = [];
2438
+ for (let i = 0, l = allAttrs.length; i < l; i++) {
2439
+ const key = allAttrs[i];
2440
+ if (isOn(key)) {
2441
+ // ignore v-model handlers when they fail to fallthrough
2442
+ if (!isModelListener(key)) {
2443
+ // remove `on`, lowercase first letter to reflect event casing
2444
+ // accurately
2445
+ eventAttrs.push(key[2].toLowerCase() + key.slice(3));
2446
2446
  }
2447
2447
  }
2448
- if (extraAttrs.length) {
2449
- warn$1(`Extraneous non-props attributes (` +
2450
- `${extraAttrs.join(', ')}) ` +
2451
- `were passed to component but could not be automatically inherited ` +
2452
- `because component renders fragment or text root nodes.`);
2453
- }
2454
- if (eventAttrs.length) {
2455
- warn$1(`Extraneous non-emits event listeners (` +
2456
- `${eventAttrs.join(', ')}) ` +
2457
- `were passed to component but could not be automatically inherited ` +
2458
- `because component renders fragment or text root nodes. ` +
2459
- `If the listener is intended to be a component custom event listener only, ` +
2460
- `declare it using the "emits" option.`);
2448
+ else {
2449
+ extraAttrs.push(key);
2461
2450
  }
2462
2451
  }
2463
- }
2464
- }
2465
- if (true &&
2466
- isCompatEnabled("INSTANCE_ATTRS_CLASS_STYLE" /* INSTANCE_ATTRS_CLASS_STYLE */, instance) &&
2467
- vnode.shapeFlag & 4 /* STATEFUL_COMPONENT */ &&
2468
- root.shapeFlag & (1 /* ELEMENT */ | 6 /* COMPONENT */)) {
2469
- const { class: cls, style } = vnode.props || {};
2470
- if (cls || style) {
2471
- if (true && inheritAttrs === false) {
2472
- warnDeprecation("INSTANCE_ATTRS_CLASS_STYLE" /* INSTANCE_ATTRS_CLASS_STYLE */, instance, getComponentName(instance.type));
2452
+ if (extraAttrs.length) {
2453
+ warn$1(`Extraneous non-props attributes (` +
2454
+ `${extraAttrs.join(', ')}) ` +
2455
+ `were passed to component but could not be automatically inherited ` +
2456
+ `because component renders fragment or text root nodes.`);
2457
+ }
2458
+ if (eventAttrs.length) {
2459
+ warn$1(`Extraneous non-emits event listeners (` +
2460
+ `${eventAttrs.join(', ')}) ` +
2461
+ `were passed to component but could not be automatically inherited ` +
2462
+ `because component renders fragment or text root nodes. ` +
2463
+ `If the listener is intended to be a component custom event listener only, ` +
2464
+ `declare it using the "emits" option.`);
2473
2465
  }
2474
- root = cloneVNode(root, {
2475
- class: cls,
2476
- style: style
2477
- });
2478
- }
2479
- }
2480
- // inherit directives
2481
- if (vnode.dirs) {
2482
- if (true && !isElementRoot(root)) {
2483
- warn$1(`Runtime directive used on component with non-element root node. ` +
2484
- `The directives will not function as intended.`);
2485
2466
  }
2486
- root.dirs = root.dirs ? root.dirs.concat(vnode.dirs) : vnode.dirs;
2487
2467
  }
2488
- // inherit transition data
2489
- if (vnode.transition) {
2490
- if (true && !isElementRoot(root)) {
2491
- warn$1(`Component inside <Transition> renders non-element root node ` +
2492
- `that cannot be animated.`);
2468
+ }
2469
+ if (isCompatEnabled("INSTANCE_ATTRS_CLASS_STYLE" /* INSTANCE_ATTRS_CLASS_STYLE */, instance) &&
2470
+ vnode.shapeFlag & 4 /* STATEFUL_COMPONENT */ &&
2471
+ root.shapeFlag & (1 /* ELEMENT */ | 6 /* COMPONENT */)) {
2472
+ const { class: cls, style } = vnode.props || {};
2473
+ if (cls || style) {
2474
+ if (inheritAttrs === false) {
2475
+ warnDeprecation("INSTANCE_ATTRS_CLASS_STYLE" /* INSTANCE_ATTRS_CLASS_STYLE */, instance, getComponentName(instance.type));
2493
2476
  }
2494
- root.transition = vnode.transition;
2477
+ root = cloneVNode(root, {
2478
+ class: cls,
2479
+ style: style
2480
+ });
2495
2481
  }
2496
- if (true && setRoot) {
2497
- setRoot(root);
2482
+ }
2483
+ // inherit directives
2484
+ if (vnode.dirs) {
2485
+ if (!isElementRoot(root)) {
2486
+ warn$1(`Runtime directive used on component with non-element root node. ` +
2487
+ `The directives will not function as intended.`);
2498
2488
  }
2499
- else {
2500
- result = root;
2489
+ root.dirs = root.dirs ? root.dirs.concat(vnode.dirs) : vnode.dirs;
2490
+ }
2491
+ // inherit transition data
2492
+ if (vnode.transition) {
2493
+ if (!isElementRoot(root)) {
2494
+ warn$1(`Component inside <Transition> renders non-element root node ` +
2495
+ `that cannot be animated.`);
2501
2496
  }
2497
+ root.transition = vnode.transition;
2502
2498
  }
2503
- catch (err) {
2504
- blockStack.length = 0;
2505
- handleError(err, instance, 1 /* RENDER_FUNCTION */);
2506
- result = createVNode(Comment);
2499
+ if (setRoot) {
2500
+ setRoot(root);
2501
+ }
2502
+ else {
2503
+ result = root;
2507
2504
  }
2508
2505
  setCurrentRenderingInstance(prev);
2509
2506
  return result;
@@ -3038,8 +3035,8 @@ var Vue = (function () {
3038
3035
  function normalizeSuspenseSlot(s) {
3039
3036
  let block;
3040
3037
  if (isFunction(s)) {
3041
- const isCompiledSlot = s._c;
3042
- if (isCompiledSlot) {
3038
+ const trackBlock = isBlockTreeEnabled && s._c;
3039
+ if (trackBlock) {
3043
3040
  // disableTracking: false
3044
3041
  // allow block tracking for compiled slots
3045
3042
  // (see ./componentRenderContext.ts)
@@ -3047,7 +3044,7 @@ var Vue = (function () {
3047
3044
  openBlock();
3048
3045
  }
3049
3046
  s = s();
3050
- if (isCompiledSlot) {
3047
+ if (trackBlock) {
3051
3048
  s._d = true;
3052
3049
  block = currentBlock;
3053
3050
  closeBlock();
@@ -5203,7 +5200,7 @@ var Vue = (function () {
5203
5200
  return vm;
5204
5201
  }
5205
5202
  }
5206
- Vue.version = "3.2.11";
5203
+ Vue.version = "3.2.12";
5207
5204
  Vue.config = singletonApp.config;
5208
5205
  Vue.use = (p, ...options) => {
5209
5206
  if (p && isFunction(p.install)) {
@@ -7851,7 +7848,11 @@ var Vue = (function () {
7851
7848
  return Component;
7852
7849
  }
7853
7850
  if (warnMissing && !res) {
7854
- warn$1(`Failed to resolve ${type.slice(0, -1)}: ${name}`);
7851
+ const extra = type === COMPONENTS
7852
+ ? `\nIf this is a native custom element, make sure to exclude it from ` +
7853
+ `component resolution via compilerOptions.isCustomElement.`
7854
+ : ``;
7855
+ warn$1(`Failed to resolve ${type.slice(0, -1)}: ${name}${extra}`);
7855
7856
  }
7856
7857
  return res;
7857
7858
  }
@@ -9293,17 +9294,19 @@ var Vue = (function () {
9293
9294
  function exposeSetupStateOnRenderContext(instance) {
9294
9295
  const { ctx, setupState } = instance;
9295
9296
  Object.keys(toRaw(setupState)).forEach(key => {
9296
- if (!setupState.__isScriptSetup && (key[0] === '$' || key[0] === '_')) {
9297
- warn$1(`setup() return property ${JSON.stringify(key)} should not start with "$" or "_" ` +
9298
- `which are reserved prefixes for Vue internals.`);
9299
- return;
9297
+ if (!setupState.__isScriptSetup) {
9298
+ if (key[0] === '$' || key[0] === '_') {
9299
+ warn$1(`setup() return property ${JSON.stringify(key)} should not start with "$" or "_" ` +
9300
+ `which are reserved prefixes for Vue internals.`);
9301
+ return;
9302
+ }
9303
+ Object.defineProperty(ctx, key, {
9304
+ enumerable: true,
9305
+ configurable: true,
9306
+ get: () => setupState[key],
9307
+ set: NOOP
9308
+ });
9300
9309
  }
9301
- Object.defineProperty(ctx, key, {
9302
- enumerable: true,
9303
- configurable: true,
9304
- get: () => setupState[key],
9305
- set: NOOP
9306
- });
9307
9310
  });
9308
9311
  }
9309
9312
 
@@ -10062,11 +10065,18 @@ var Vue = (function () {
10062
10065
  // 2. If a component is unmounted during a parent component's update,
10063
10066
  // its update can be skipped.
10064
10067
  queue.sort((a, b) => getId(a) - getId(b));
10068
+ // conditional usage of checkRecursiveUpdate must be determined out of
10069
+ // try ... catch block since Rollup by default de-optimizes treeshaking
10070
+ // inside try-catch. This can leave all warning code unshaked. Although
10071
+ // they would get eventually shaken by a minifier like terser, some minifiers
10072
+ // would fail to do that (e.g. https://github.com/evanw/esbuild/issues/1610)
10073
+ const check = (job) => checkRecursiveUpdates(seen, job)
10074
+ ;
10065
10075
  try {
10066
10076
  for (flushIndex = 0; flushIndex < queue.length; flushIndex++) {
10067
10077
  const job = queue[flushIndex];
10068
10078
  if (job && job.active !== false) {
10069
- if (true && checkRecursiveUpdates(seen, job)) {
10079
+ if (true && check(job)) {
10070
10080
  continue;
10071
10081
  }
10072
10082
  // console.log(`running:`, job.id)
@@ -10754,7 +10764,7 @@ var Vue = (function () {
10754
10764
  }
10755
10765
 
10756
10766
  // Core API ------------------------------------------------------------------
10757
- const version = "3.2.11";
10767
+ const version = "3.2.12";
10758
10768
  /**
10759
10769
  * SSR utils for \@vue/server-renderer. Only exposed in cjs builds.
10760
10770
  * @internal
@@ -11280,6 +11290,7 @@ var Vue = (function () {
11280
11290
  this._instance = null;
11281
11291
  this._connected = false;
11282
11292
  this._resolved = false;
11293
+ this._numberProps = null;
11283
11294
  if (this.shadowRoot && hydrate) {
11284
11295
  hydrate(this._createVNode(), this.shadowRoot);
11285
11296
  }
@@ -11295,18 +11306,17 @@ var Vue = (function () {
11295
11306
  this._setAttr(this.attributes[i].name);
11296
11307
  }
11297
11308
  // watch future attr changes
11298
- const observer = new MutationObserver(mutations => {
11309
+ new MutationObserver(mutations => {
11299
11310
  for (const m of mutations) {
11300
11311
  this._setAttr(m.attributeName);
11301
11312
  }
11302
- });
11303
- observer.observe(this, { attributes: true });
11313
+ }).observe(this, { attributes: true });
11304
11314
  }
11305
11315
  connectedCallback() {
11306
11316
  this._connected = true;
11307
11317
  if (!this._instance) {
11308
11318
  this._resolveDef();
11309
- render(this._createVNode(), this.shadowRoot);
11319
+ this._update();
11310
11320
  }
11311
11321
  }
11312
11322
  disconnectedCallback() {
@@ -11327,15 +11337,31 @@ var Vue = (function () {
11327
11337
  }
11328
11338
  const resolve = (def) => {
11329
11339
  this._resolved = true;
11340
+ const { props, styles } = def;
11341
+ const hasOptions = !isArray(props);
11342
+ const rawKeys = props ? (hasOptions ? Object.keys(props) : props) : [];
11343
+ // cast Number-type props set before resolve
11344
+ let numberProps;
11345
+ if (hasOptions) {
11346
+ for (const key in this._props) {
11347
+ const opt = props[key];
11348
+ if (opt === Number || (opt && opt.type === Number)) {
11349
+ this._props[key] = toNumber(this._props[key]);
11350
+ (numberProps || (numberProps = Object.create(null)))[key] = true;
11351
+ }
11352
+ }
11353
+ }
11354
+ if (numberProps) {
11355
+ this._numberProps = numberProps;
11356
+ this._update();
11357
+ }
11330
11358
  // check if there are props set pre-upgrade or connect
11331
11359
  for (const key of Object.keys(this)) {
11332
11360
  if (key[0] !== '_') {
11333
11361
  this._setProp(key, this[key]);
11334
11362
  }
11335
11363
  }
11336
- const { props, styles } = def;
11337
11364
  // defining getter/setters on prototype
11338
- const rawKeys = props ? (isArray(props) ? props : Object.keys(props)) : [];
11339
11365
  for (const key of rawKeys.map(camelize)) {
11340
11366
  Object.defineProperty(this, key, {
11341
11367
  get() {
@@ -11357,7 +11383,11 @@ var Vue = (function () {
11357
11383
  }
11358
11384
  }
11359
11385
  _setAttr(key) {
11360
- this._setProp(camelize(key), toNumber(this.getAttribute(key)), false);
11386
+ let value = this.getAttribute(key);
11387
+ if (this._numberProps && this._numberProps[key]) {
11388
+ value = toNumber(value);
11389
+ }
11390
+ this._setProp(camelize(key), value, false);
11361
11391
  }
11362
11392
  /**
11363
11393
  * @internal
@@ -11372,7 +11402,7 @@ var Vue = (function () {
11372
11402
  if (val !== this._props[key]) {
11373
11403
  this._props[key] = val;
11374
11404
  if (this._instance) {
11375
- render(this._createVNode(), this.shadowRoot);
11405
+ this._update();
11376
11406
  }
11377
11407
  // reflect
11378
11408
  if (shouldReflect) {
@@ -11388,6 +11418,9 @@ var Vue = (function () {
11388
11418
  }
11389
11419
  }
11390
11420
  }
11421
+ _update() {
11422
+ render(this._createVNode(), this.shadowRoot);
11423
+ }
11391
11424
  _createVNode() {
11392
11425
  const vnode = createVNode(this._def, extend({}, this._props));
11393
11426
  if (!this._instance) {
@@ -11408,7 +11441,7 @@ var Vue = (function () {
11408
11441
  if (!this._def.__asyncLoader) {
11409
11442
  // reload
11410
11443
  this._instance = null;
11411
- render(this._createVNode(), this.shadowRoot);
11444
+ this._update();
11412
11445
  }
11413
11446
  };
11414
11447
  }