@vue/compat 3.2.8 → 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.
@@ -1548,41 +1548,33 @@ function registerHMR(instance) {
1548
1548
  const id = instance.type.__hmrId;
1549
1549
  let record = map.get(id);
1550
1550
  if (!record) {
1551
- createRecord(id, instance.type);
1551
+ createRecord(id);
1552
1552
  record = map.get(id);
1553
1553
  }
1554
- record.instances.add(instance);
1554
+ record.add(instance);
1555
1555
  }
1556
1556
  function unregisterHMR(instance) {
1557
- map.get(instance.type.__hmrId).instances.delete(instance);
1557
+ map.get(instance.type.__hmrId).delete(instance);
1558
1558
  }
1559
- function createRecord(id, component) {
1560
- if (!component) {
1561
- warn$1(`HMR API usage is out of date.\n` +
1562
- `Please upgrade vue-loader/vite/rollup-plugin-vue or other relevant ` +
1563
- `dependency that handles Vue SFC compilation.`);
1564
- component = {};
1565
- }
1559
+ function createRecord(id) {
1566
1560
  if (map.has(id)) {
1567
1561
  return false;
1568
1562
  }
1569
- map.set(id, {
1570
- component: isClassComponent(component) ? component.__vccOpts : component,
1571
- instances: new Set()
1572
- });
1563
+ map.set(id, new Set());
1573
1564
  return true;
1574
1565
  }
1566
+ function normalizeClassComponent(component) {
1567
+ return isClassComponent(component) ? component.__vccOpts : component;
1568
+ }
1575
1569
  function rerender(id, newRender) {
1576
1570
  const record = map.get(id);
1577
- if (!record)
1571
+ if (!record) {
1578
1572
  return;
1579
- if (newRender)
1580
- record.component.render = newRender;
1581
- // Array.from creates a snapshot which avoids the set being mutated during
1582
- // updates
1583
- Array.from(record.instances).forEach(instance => {
1573
+ }
1574
+ [...record].forEach(instance => {
1584
1575
  if (newRender) {
1585
1576
  instance.render = newRender;
1577
+ normalizeClassComponent(instance.type).render = newRender;
1586
1578
  }
1587
1579
  instance.renderCache = [];
1588
1580
  // this flag forces child components with slot content to update
@@ -1595,34 +1587,31 @@ function reload(id, newComp) {
1595
1587
  const record = map.get(id);
1596
1588
  if (!record)
1597
1589
  return;
1598
- // Array.from creates a snapshot which avoids the set being mutated during
1599
- // updates
1600
- const { component, instances } = record;
1601
- if (!hmrDirtyComponents.has(component)) {
1602
- // 1. Update existing comp definition to match new one
1603
- newComp = isClassComponent(newComp) ? newComp.__vccOpts : newComp;
1604
- extend(component, newComp);
1605
- for (const key in component) {
1606
- if (key !== '__file' && !(key in newComp)) {
1607
- delete component[key];
1608
- }
1609
- }
1610
- // 2. Mark component dirty. This forces the renderer to replace the component
1611
- // on patch.
1612
- hmrDirtyComponents.add(component);
1613
- // 3. Make sure to unmark the component after the reload.
1614
- queuePostFlushCb(() => {
1615
- hmrDirtyComponents.delete(component);
1616
- });
1617
- }
1618
- Array.from(instances).forEach(instance => {
1619
- // invalidate options resolution cache
1590
+ newComp = normalizeClassComponent(newComp);
1591
+ // create a snapshot which avoids the set being mutated during updates
1592
+ const instances = [...record];
1593
+ for (const instance of instances) {
1594
+ const oldComp = normalizeClassComponent(instance.type);
1595
+ if (!hmrDirtyComponents.has(oldComp)) {
1596
+ // 1. Update existing comp definition to match new one
1597
+ extend(oldComp, newComp);
1598
+ for (const key in oldComp) {
1599
+ if (key !== '__file' && !(key in newComp)) {
1600
+ delete oldComp[key];
1601
+ }
1602
+ }
1603
+ // 2. mark definition dirty. This forces the renderer to replace the
1604
+ // component on patch.
1605
+ hmrDirtyComponents.add(oldComp);
1606
+ }
1607
+ // 3. invalidate options resolution cache
1620
1608
  instance.appContext.optionsCache.delete(instance.type);
1609
+ // 4. actually update
1621
1610
  if (instance.ceReload) {
1622
1611
  // custom element
1623
- hmrDirtyComponents.add(component);
1612
+ hmrDirtyComponents.add(oldComp);
1624
1613
  instance.ceReload(newComp.styles);
1625
- hmrDirtyComponents.delete(component);
1614
+ hmrDirtyComponents.delete(oldComp);
1626
1615
  }
1627
1616
  else if (instance.parent) {
1628
1617
  // 4. Force the parent instance to re-render. This will cause all updated
@@ -1647,6 +1636,12 @@ function reload(id, newComp) {
1647
1636
  else {
1648
1637
  console.warn('[HMR] Root or manually mounted instance modified. Full reload required.');
1649
1638
  }
1639
+ }
1640
+ // 5. make sure to cleanup dirty hmr components after update
1641
+ queuePostFlushCb(() => {
1642
+ for (const instance of instances) {
1643
+ hmrDirtyComponents.delete(normalizeClassComponent(instance.type));
1644
+ }
1650
1645
  });
1651
1646
  }
1652
1647
  function tryWrap(fn) {
@@ -2463,12 +2458,12 @@ function markAttrsAccessed() {
2463
2458
  function renderComponentRoot(instance) {
2464
2459
  const { type: Component, vnode, proxy, withProxy, props, propsOptions: [propsOptions], slots, attrs, emit, render, renderCache, data, setupState, ctx, inheritAttrs } = instance;
2465
2460
  let result;
2461
+ let fallthroughAttrs;
2466
2462
  const prev = setCurrentRenderingInstance(instance);
2467
2463
  if ((process.env.NODE_ENV !== 'production')) {
2468
2464
  accessedAttrs = false;
2469
2465
  }
2470
2466
  try {
2471
- let fallthroughAttrs;
2472
2467
  if (vnode.shapeFlag & 4 /* STATEFUL_COMPONENT */) {
2473
2468
  // withProxy is a proxy with a different `has` trap only for
2474
2469
  // runtime-compiled render functions using `with` block.
@@ -2499,108 +2494,106 @@ function renderComponentRoot(instance) {
2499
2494
  ? attrs
2500
2495
  : getFunctionalFallthrough(attrs);
2501
2496
  }
2502
- // attr merging
2503
- // in dev mode, comments are preserved, and it's possible for a template
2504
- // to have comments along side the root element which makes it a fragment
2505
- let root = result;
2506
- let setRoot = undefined;
2507
- if ((process.env.NODE_ENV !== 'production') &&
2508
- result.patchFlag > 0 &&
2509
- result.patchFlag & 2048 /* DEV_ROOT_FRAGMENT */) {
2510
- ;
2511
- [root, setRoot] = getChildRoot(result);
2512
- }
2513
- if (fallthroughAttrs && inheritAttrs !== false) {
2514
- const keys = Object.keys(fallthroughAttrs);
2515
- const { shapeFlag } = root;
2516
- if (keys.length) {
2517
- if (shapeFlag & (1 /* ELEMENT */ | 6 /* COMPONENT */)) {
2518
- if (propsOptions && keys.some(isModelListener)) {
2519
- // If a v-model listener (onUpdate:xxx) has a corresponding declared
2520
- // prop, it indicates this component expects to handle v-model and
2521
- // it should not fallthrough.
2522
- // related: #1543, #1643, #1989
2523
- fallthroughAttrs = filterModelListeners(fallthroughAttrs, propsOptions);
2524
- }
2525
- root = cloneVNode(root, fallthroughAttrs);
2526
- }
2527
- else if ((process.env.NODE_ENV !== 'production') && !accessedAttrs && root.type !== Comment) {
2528
- const allAttrs = Object.keys(attrs);
2529
- const eventAttrs = [];
2530
- const extraAttrs = [];
2531
- for (let i = 0, l = allAttrs.length; i < l; i++) {
2532
- const key = allAttrs[i];
2533
- if (isOn(key)) {
2534
- // ignore v-model handlers when they fail to fallthrough
2535
- if (!isModelListener(key)) {
2536
- // remove `on`, lowercase first letter to reflect event casing
2537
- // accurately
2538
- eventAttrs.push(key[2].toLowerCase() + key.slice(3));
2539
- }
2540
- }
2541
- else {
2542
- extraAttrs.push(key);
2497
+ }
2498
+ catch (err) {
2499
+ blockStack.length = 0;
2500
+ handleError(err, instance, 1 /* RENDER_FUNCTION */);
2501
+ result = createVNode(Comment);
2502
+ }
2503
+ // attr merging
2504
+ // in dev mode, comments are preserved, and it's possible for a template
2505
+ // to have comments along side the root element which makes it a fragment
2506
+ let root = result;
2507
+ let setRoot = undefined;
2508
+ if ((process.env.NODE_ENV !== 'production') &&
2509
+ result.patchFlag > 0 &&
2510
+ result.patchFlag & 2048 /* DEV_ROOT_FRAGMENT */) {
2511
+ [root, setRoot] = getChildRoot(result);
2512
+ }
2513
+ if (fallthroughAttrs && inheritAttrs !== false) {
2514
+ const keys = Object.keys(fallthroughAttrs);
2515
+ const { shapeFlag } = root;
2516
+ if (keys.length) {
2517
+ if (shapeFlag & (1 /* ELEMENT */ | 6 /* COMPONENT */)) {
2518
+ if (propsOptions && keys.some(isModelListener)) {
2519
+ // If a v-model listener (onUpdate:xxx) has a corresponding declared
2520
+ // prop, it indicates this component expects to handle v-model and
2521
+ // it should not fallthrough.
2522
+ // related: #1543, #1643, #1989
2523
+ fallthroughAttrs = filterModelListeners(fallthroughAttrs, propsOptions);
2524
+ }
2525
+ root = cloneVNode(root, fallthroughAttrs);
2526
+ }
2527
+ else if ((process.env.NODE_ENV !== 'production') && !accessedAttrs && root.type !== Comment) {
2528
+ const allAttrs = Object.keys(attrs);
2529
+ const eventAttrs = [];
2530
+ const extraAttrs = [];
2531
+ for (let i = 0, l = allAttrs.length; i < l; i++) {
2532
+ const key = allAttrs[i];
2533
+ if (isOn(key)) {
2534
+ // ignore v-model handlers when they fail to fallthrough
2535
+ if (!isModelListener(key)) {
2536
+ // remove `on`, lowercase first letter to reflect event casing
2537
+ // accurately
2538
+ eventAttrs.push(key[2].toLowerCase() + key.slice(3));
2543
2539
  }
2544
2540
  }
2545
- if (extraAttrs.length) {
2546
- warn$1(`Extraneous non-props attributes (` +
2547
- `${extraAttrs.join(', ')}) ` +
2548
- `were passed to component but could not be automatically inherited ` +
2549
- `because component renders fragment or text root nodes.`);
2550
- }
2551
- if (eventAttrs.length) {
2552
- warn$1(`Extraneous non-emits event listeners (` +
2553
- `${eventAttrs.join(', ')}) ` +
2554
- `were passed to component but could not be automatically inherited ` +
2555
- `because component renders fragment or text root nodes. ` +
2556
- `If the listener is intended to be a component custom event listener only, ` +
2557
- `declare it using the "emits" option.`);
2541
+ else {
2542
+ extraAttrs.push(key);
2558
2543
  }
2559
2544
  }
2560
- }
2561
- }
2562
- if (true &&
2563
- isCompatEnabled("INSTANCE_ATTRS_CLASS_STYLE" /* INSTANCE_ATTRS_CLASS_STYLE */, instance) &&
2564
- vnode.shapeFlag & 4 /* STATEFUL_COMPONENT */ &&
2565
- root.shapeFlag & (1 /* ELEMENT */ | 6 /* COMPONENT */)) {
2566
- const { class: cls, style } = vnode.props || {};
2567
- if (cls || style) {
2568
- if ((process.env.NODE_ENV !== 'production') && inheritAttrs === false) {
2569
- warnDeprecation("INSTANCE_ATTRS_CLASS_STYLE" /* INSTANCE_ATTRS_CLASS_STYLE */, instance, getComponentName(instance.type));
2545
+ if (extraAttrs.length) {
2546
+ warn$1(`Extraneous non-props attributes (` +
2547
+ `${extraAttrs.join(', ')}) ` +
2548
+ `were passed to component but could not be automatically inherited ` +
2549
+ `because component renders fragment or text root nodes.`);
2550
+ }
2551
+ if (eventAttrs.length) {
2552
+ warn$1(`Extraneous non-emits event listeners (` +
2553
+ `${eventAttrs.join(', ')}) ` +
2554
+ `were passed to component but could not be automatically inherited ` +
2555
+ `because component renders fragment or text root nodes. ` +
2556
+ `If the listener is intended to be a component custom event listener only, ` +
2557
+ `declare it using the "emits" option.`);
2570
2558
  }
2571
- root = cloneVNode(root, {
2572
- class: cls,
2573
- style: style
2574
- });
2575
- }
2576
- }
2577
- // inherit directives
2578
- if (vnode.dirs) {
2579
- if ((process.env.NODE_ENV !== 'production') && !isElementRoot(root)) {
2580
- warn$1(`Runtime directive used on component with non-element root node. ` +
2581
- `The directives will not function as intended.`);
2582
2559
  }
2583
- root.dirs = root.dirs ? root.dirs.concat(vnode.dirs) : vnode.dirs;
2584
2560
  }
2585
- // inherit transition data
2586
- if (vnode.transition) {
2587
- if ((process.env.NODE_ENV !== 'production') && !isElementRoot(root)) {
2588
- warn$1(`Component inside <Transition> renders non-element root node ` +
2589
- `that cannot be animated.`);
2561
+ }
2562
+ if (isCompatEnabled("INSTANCE_ATTRS_CLASS_STYLE" /* INSTANCE_ATTRS_CLASS_STYLE */, instance) &&
2563
+ vnode.shapeFlag & 4 /* STATEFUL_COMPONENT */ &&
2564
+ root.shapeFlag & (1 /* ELEMENT */ | 6 /* COMPONENT */)) {
2565
+ const { class: cls, style } = vnode.props || {};
2566
+ if (cls || style) {
2567
+ if ((process.env.NODE_ENV !== 'production') && inheritAttrs === false) {
2568
+ warnDeprecation("INSTANCE_ATTRS_CLASS_STYLE" /* INSTANCE_ATTRS_CLASS_STYLE */, instance, getComponentName(instance.type));
2590
2569
  }
2591
- root.transition = vnode.transition;
2570
+ root = cloneVNode(root, {
2571
+ class: cls,
2572
+ style: style
2573
+ });
2592
2574
  }
2593
- if ((process.env.NODE_ENV !== 'production') && setRoot) {
2594
- setRoot(root);
2575
+ }
2576
+ // inherit directives
2577
+ if (vnode.dirs) {
2578
+ if ((process.env.NODE_ENV !== 'production') && !isElementRoot(root)) {
2579
+ warn$1(`Runtime directive used on component with non-element root node. ` +
2580
+ `The directives will not function as intended.`);
2595
2581
  }
2596
- else {
2597
- result = root;
2582
+ root.dirs = root.dirs ? root.dirs.concat(vnode.dirs) : vnode.dirs;
2583
+ }
2584
+ // inherit transition data
2585
+ if (vnode.transition) {
2586
+ if ((process.env.NODE_ENV !== 'production') && !isElementRoot(root)) {
2587
+ warn$1(`Component inside <Transition> renders non-element root node ` +
2588
+ `that cannot be animated.`);
2598
2589
  }
2590
+ root.transition = vnode.transition;
2599
2591
  }
2600
- catch (err) {
2601
- blockStack.length = 0;
2602
- handleError(err, instance, 1 /* RENDER_FUNCTION */);
2603
- result = createVNode(Comment);
2592
+ if ((process.env.NODE_ENV !== 'production') && setRoot) {
2593
+ setRoot(root);
2594
+ }
2595
+ else {
2596
+ result = root;
2604
2597
  }
2605
2598
  setCurrentRenderingInstance(prev);
2606
2599
  return result;
@@ -3135,8 +3128,8 @@ function normalizeSuspenseChildren(vnode) {
3135
3128
  function normalizeSuspenseSlot(s) {
3136
3129
  let block;
3137
3130
  if (isFunction(s)) {
3138
- const isCompiledSlot = s._c;
3139
- if (isCompiledSlot) {
3131
+ const trackBlock = isBlockTreeEnabled && s._c;
3132
+ if (trackBlock) {
3140
3133
  // disableTracking: false
3141
3134
  // allow block tracking for compiled slots
3142
3135
  // (see ./componentRenderContext.ts)
@@ -3144,7 +3137,7 @@ function normalizeSuspenseSlot(s) {
3144
3137
  openBlock();
3145
3138
  }
3146
3139
  s = s();
3147
- if (isCompiledSlot) {
3140
+ if (trackBlock) {
3148
3141
  s._d = true;
3149
3142
  block = currentBlock;
3150
3143
  closeBlock();
@@ -5309,7 +5302,7 @@ function createCompatVue(createApp, createSingletonApp) {
5309
5302
  return vm;
5310
5303
  }
5311
5304
  }
5312
- Vue.version = "3.2.8";
5305
+ Vue.version = "3.2.12";
5313
5306
  Vue.config = singletonApp.config;
5314
5307
  Vue.use = (p, ...options) => {
5315
5308
  if (p && isFunction(p.install)) {
@@ -8010,7 +8003,11 @@ function resolveAsset(type, name, warnMissing = true, maybeSelfReference = false
8010
8003
  return Component;
8011
8004
  }
8012
8005
  if ((process.env.NODE_ENV !== 'production') && warnMissing && !res) {
8013
- warn$1(`Failed to resolve ${type.slice(0, -1)}: ${name}`);
8006
+ const extra = type === COMPONENTS
8007
+ ? `\nIf this is a native custom element, make sure to exclude it from ` +
8008
+ `component resolution via compilerOptions.isCustomElement.`
8009
+ : ``;
8010
+ warn$1(`Failed to resolve ${type.slice(0, -1)}: ${name}${extra}`);
8014
8011
  }
8015
8012
  return res;
8016
8013
  }
@@ -9457,17 +9454,19 @@ function exposePropsOnRenderContext(instance) {
9457
9454
  function exposeSetupStateOnRenderContext(instance) {
9458
9455
  const { ctx, setupState } = instance;
9459
9456
  Object.keys(toRaw(setupState)).forEach(key => {
9460
- if (!setupState.__isScriptSetup && (key[0] === '$' || key[0] === '_')) {
9461
- warn$1(`setup() return property ${JSON.stringify(key)} should not start with "$" or "_" ` +
9462
- `which are reserved prefixes for Vue internals.`);
9463
- return;
9457
+ if (!setupState.__isScriptSetup) {
9458
+ if (key[0] === '$' || key[0] === '_') {
9459
+ warn$1(`setup() return property ${JSON.stringify(key)} should not start with "$" or "_" ` +
9460
+ `which are reserved prefixes for Vue internals.`);
9461
+ return;
9462
+ }
9463
+ Object.defineProperty(ctx, key, {
9464
+ enumerable: true,
9465
+ configurable: true,
9466
+ get: () => setupState[key],
9467
+ set: NOOP
9468
+ });
9464
9469
  }
9465
- Object.defineProperty(ctx, key, {
9466
- enumerable: true,
9467
- configurable: true,
9468
- get: () => setupState[key],
9469
- set: NOOP
9470
- });
9471
9470
  });
9472
9471
  }
9473
9472
 
@@ -10251,11 +10250,19 @@ function flushJobs(seen) {
10251
10250
  // 2. If a component is unmounted during a parent component's update,
10252
10251
  // its update can be skipped.
10253
10252
  queue.sort((a, b) => getId(a) - getId(b));
10253
+ // conditional usage of checkRecursiveUpdate must be determined out of
10254
+ // try ... catch block since Rollup by default de-optimizes treeshaking
10255
+ // inside try-catch. This can leave all warning code unshaked. Although
10256
+ // they would get eventually shaken by a minifier like terser, some minifiers
10257
+ // would fail to do that (e.g. https://github.com/evanw/esbuild/issues/1610)
10258
+ const check = (process.env.NODE_ENV !== 'production')
10259
+ ? (job) => checkRecursiveUpdates(seen, job)
10260
+ : NOOP;
10254
10261
  try {
10255
10262
  for (flushIndex = 0; flushIndex < queue.length; flushIndex++) {
10256
10263
  const job = queue[flushIndex];
10257
10264
  if (job && job.active !== false) {
10258
- if ((process.env.NODE_ENV !== 'production') && checkRecursiveUpdates(seen, job)) {
10265
+ if ((process.env.NODE_ENV !== 'production') && check(job)) {
10259
10266
  continue;
10260
10267
  }
10261
10268
  // console.log(`running:`, job.id)
@@ -10601,7 +10608,7 @@ function defineExpose(exposed) {
10601
10608
  }
10602
10609
  /**
10603
10610
  * Vue `<script setup>` compiler macro for providing props default values when
10604
- * using type-based `defineProps` decalration.
10611
+ * using type-based `defineProps` declaration.
10605
10612
  *
10606
10613
  * Example usage:
10607
10614
  * ```ts
@@ -10950,7 +10957,7 @@ function isMemoSame(cached, memo) {
10950
10957
  }
10951
10958
 
10952
10959
  // Core API ------------------------------------------------------------------
10953
- const version = "3.2.8";
10960
+ const version = "3.2.12";
10954
10961
  const _ssrUtils = {
10955
10962
  createComponentInstance,
10956
10963
  setupComponent,
@@ -11087,19 +11094,13 @@ function patchClass(el, value, isSVG) {
11087
11094
 
11088
11095
  function patchStyle(el, prev, next) {
11089
11096
  const style = el.style;
11097
+ const currentDisplay = style.display;
11090
11098
  if (!next) {
11091
11099
  el.removeAttribute('style');
11092
11100
  }
11093
11101
  else if (isString(next)) {
11094
11102
  if (prev !== next) {
11095
- const current = style.display;
11096
11103
  style.cssText = next;
11097
- // indicates that the `display` of the element is controlled by `v-show`,
11098
- // so we always keep the current `display` value regardless of the `style` value,
11099
- // thus handing over control to `v-show`.
11100
- if ('_vod' in el) {
11101
- style.display = current;
11102
- }
11103
11104
  }
11104
11105
  }
11105
11106
  else {
@@ -11114,6 +11115,12 @@ function patchStyle(el, prev, next) {
11114
11115
  }
11115
11116
  }
11116
11117
  }
11118
+ // indicates that the `display` of the element is controlled by `v-show`,
11119
+ // so we always keep the current `display` value regardless of the `style` value,
11120
+ // thus handing over control to `v-show`.
11121
+ if ('_vod' in el) {
11122
+ style.display = currentDisplay;
11123
+ }
11117
11124
  }
11118
11125
  const importantRE = /\s*!important$/;
11119
11126
  function setStyle(style, name, val) {
@@ -11485,6 +11492,7 @@ class VueElement extends BaseClass {
11485
11492
  this._instance = null;
11486
11493
  this._connected = false;
11487
11494
  this._resolved = false;
11495
+ this._numberProps = null;
11488
11496
  if (this.shadowRoot && hydrate) {
11489
11497
  hydrate(this._createVNode(), this.shadowRoot);
11490
11498
  }
@@ -11500,18 +11508,17 @@ class VueElement extends BaseClass {
11500
11508
  this._setAttr(this.attributes[i].name);
11501
11509
  }
11502
11510
  // watch future attr changes
11503
- const observer = new MutationObserver(mutations => {
11511
+ new MutationObserver(mutations => {
11504
11512
  for (const m of mutations) {
11505
11513
  this._setAttr(m.attributeName);
11506
11514
  }
11507
- });
11508
- observer.observe(this, { attributes: true });
11515
+ }).observe(this, { attributes: true });
11509
11516
  }
11510
11517
  connectedCallback() {
11511
11518
  this._connected = true;
11512
11519
  if (!this._instance) {
11513
11520
  this._resolveDef();
11514
- render(this._createVNode(), this.shadowRoot);
11521
+ this._update();
11515
11522
  }
11516
11523
  }
11517
11524
  disconnectedCallback() {
@@ -11532,15 +11539,31 @@ class VueElement extends BaseClass {
11532
11539
  }
11533
11540
  const resolve = (def) => {
11534
11541
  this._resolved = true;
11542
+ const { props, styles } = def;
11543
+ const hasOptions = !isArray(props);
11544
+ const rawKeys = props ? (hasOptions ? Object.keys(props) : props) : [];
11545
+ // cast Number-type props set before resolve
11546
+ let numberProps;
11547
+ if (hasOptions) {
11548
+ for (const key in this._props) {
11549
+ const opt = props[key];
11550
+ if (opt === Number || (opt && opt.type === Number)) {
11551
+ this._props[key] = toNumber(this._props[key]);
11552
+ (numberProps || (numberProps = Object.create(null)))[key] = true;
11553
+ }
11554
+ }
11555
+ }
11556
+ if (numberProps) {
11557
+ this._numberProps = numberProps;
11558
+ this._update();
11559
+ }
11535
11560
  // check if there are props set pre-upgrade or connect
11536
11561
  for (const key of Object.keys(this)) {
11537
11562
  if (key[0] !== '_') {
11538
11563
  this._setProp(key, this[key]);
11539
11564
  }
11540
11565
  }
11541
- const { props, styles } = def;
11542
11566
  // defining getter/setters on prototype
11543
- const rawKeys = props ? (isArray(props) ? props : Object.keys(props)) : [];
11544
11567
  for (const key of rawKeys.map(camelize)) {
11545
11568
  Object.defineProperty(this, key, {
11546
11569
  get() {
@@ -11562,7 +11585,11 @@ class VueElement extends BaseClass {
11562
11585
  }
11563
11586
  }
11564
11587
  _setAttr(key) {
11565
- this._setProp(camelize(key), toNumber(this.getAttribute(key)), false);
11588
+ let value = this.getAttribute(key);
11589
+ if (this._numberProps && this._numberProps[key]) {
11590
+ value = toNumber(value);
11591
+ }
11592
+ this._setProp(camelize(key), value, false);
11566
11593
  }
11567
11594
  /**
11568
11595
  * @internal
@@ -11577,7 +11604,7 @@ class VueElement extends BaseClass {
11577
11604
  if (val !== this._props[key]) {
11578
11605
  this._props[key] = val;
11579
11606
  if (this._instance) {
11580
- render(this._createVNode(), this.shadowRoot);
11607
+ this._update();
11581
11608
  }
11582
11609
  // reflect
11583
11610
  if (shouldReflect) {
@@ -11593,6 +11620,9 @@ class VueElement extends BaseClass {
11593
11620
  }
11594
11621
  }
11595
11622
  }
11623
+ _update() {
11624
+ render(this._createVNode(), this.shadowRoot);
11625
+ }
11596
11626
  _createVNode() {
11597
11627
  const vnode = createVNode(this._def, extend({}, this._props));
11598
11628
  if (!this._instance) {
@@ -11613,7 +11643,7 @@ class VueElement extends BaseClass {
11613
11643
  if (!this._def.__asyncLoader) {
11614
11644
  // reload
11615
11645
  this._instance = null;
11616
- render(this._createVNode(), this.shadowRoot);
11646
+ this._update();
11617
11647
  }
11618
11648
  };
11619
11649
  }
@@ -14075,6 +14105,13 @@ function parseAttributes(context, type) {
14075
14105
  emitError(context, 3 /* END_TAG_WITH_ATTRIBUTES */);
14076
14106
  }
14077
14107
  const attr = parseAttribute(context, attributeNames);
14108
+ // Trim whitespace between class
14109
+ // https://github.com/vuejs/vue-next/issues/4251
14110
+ if (attr.type === 6 /* ATTRIBUTE */ &&
14111
+ attr.value &&
14112
+ attr.name === 'class') {
14113
+ attr.value.content = attr.value.content.replace(/\s+/g, ' ').trim();
14114
+ }
14078
14115
  if (type === 0 /* Start */) {
14079
14116
  props.push(attr);
14080
14117
  }
@@ -14137,8 +14174,11 @@ function parseAttribute(context, nameSet) {
14137
14174
  isStatic = false;
14138
14175
  if (!content.endsWith(']')) {
14139
14176
  emitError(context, 27 /* X_MISSING_DYNAMIC_DIRECTIVE_ARGUMENT_END */);
14177
+ content = content.substr(1);
14178
+ }
14179
+ else {
14180
+ content = content.substr(1, content.length - 2);
14140
14181
  }
14141
- content = content.substr(1, content.length - 2);
14142
14182
  }
14143
14183
  else if (isSlot) {
14144
14184
  // #1241 special case for v-slot: vuetify relies extensively on slot
@@ -15604,7 +15644,7 @@ function processExpression(node, context,
15604
15644
  // function params
15605
15645
  asParams = false,
15606
15646
  // v-on handler values may contain multiple statements
15607
- asRawStatements = false) {
15647
+ asRawStatements = false, localVars = Object.create(context.identifiers)) {
15608
15648
  {
15609
15649
  if ((process.env.NODE_ENV !== 'production')) {
15610
15650
  // simple in-browser validation (same logic in 2.x)
@@ -16922,7 +16962,7 @@ function processSlotOutlet(node, context) {
16922
16962
  };
16923
16963
  }
16924
16964
 
16925
- const fnExpRE = /^\s*([\w$_]+|\([^)]*?\))\s*=>|^\s*function(?:\s+[\w$]+)?\s*\(/;
16965
+ const fnExpRE = /^\s*([\w$_]+|(async\s*)?\([^)]*?\))\s*=>|^\s*(async\s+)?function(?:\s+[\w$]+)?\s*\(/;
16926
16966
  const transformOn = (dir, node, context, augmentor) => {
16927
16967
  const { loc, modifiers, arg } = dir;
16928
16968
  if (!dir.exp && !modifiers.length) {