@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.
@@ -1531,41 +1531,33 @@ function registerHMR(instance) {
1531
1531
  const id = instance.type.__hmrId;
1532
1532
  let record = map.get(id);
1533
1533
  if (!record) {
1534
- createRecord(id, instance.type);
1534
+ createRecord(id);
1535
1535
  record = map.get(id);
1536
1536
  }
1537
- record.instances.add(instance);
1537
+ record.add(instance);
1538
1538
  }
1539
1539
  function unregisterHMR(instance) {
1540
- map.get(instance.type.__hmrId).instances.delete(instance);
1540
+ map.get(instance.type.__hmrId).delete(instance);
1541
1541
  }
1542
- function createRecord(id, component) {
1543
- if (!component) {
1544
- warn$1(`HMR API usage is out of date.\n` +
1545
- `Please upgrade vue-loader/vite/rollup-plugin-vue or other relevant ` +
1546
- `dependency that handles Vue SFC compilation.`);
1547
- component = {};
1548
- }
1542
+ function createRecord(id) {
1549
1543
  if (map.has(id)) {
1550
1544
  return false;
1551
1545
  }
1552
- map.set(id, {
1553
- component: isClassComponent(component) ? component.__vccOpts : component,
1554
- instances: new Set()
1555
- });
1546
+ map.set(id, new Set());
1556
1547
  return true;
1557
1548
  }
1549
+ function normalizeClassComponent(component) {
1550
+ return isClassComponent(component) ? component.__vccOpts : component;
1551
+ }
1558
1552
  function rerender(id, newRender) {
1559
1553
  const record = map.get(id);
1560
- if (!record)
1554
+ if (!record) {
1561
1555
  return;
1562
- if (newRender)
1563
- record.component.render = newRender;
1564
- // Array.from creates a snapshot which avoids the set being mutated during
1565
- // updates
1566
- Array.from(record.instances).forEach(instance => {
1556
+ }
1557
+ [...record].forEach(instance => {
1567
1558
  if (newRender) {
1568
1559
  instance.render = newRender;
1560
+ normalizeClassComponent(instance.type).render = newRender;
1569
1561
  }
1570
1562
  instance.renderCache = [];
1571
1563
  // this flag forces child components with slot content to update
@@ -1578,34 +1570,31 @@ function reload(id, newComp) {
1578
1570
  const record = map.get(id);
1579
1571
  if (!record)
1580
1572
  return;
1581
- // Array.from creates a snapshot which avoids the set being mutated during
1582
- // updates
1583
- const { component, instances } = record;
1584
- if (!hmrDirtyComponents.has(component)) {
1585
- // 1. Update existing comp definition to match new one
1586
- newComp = isClassComponent(newComp) ? newComp.__vccOpts : newComp;
1587
- extend(component, newComp);
1588
- for (const key in component) {
1589
- if (key !== '__file' && !(key in newComp)) {
1590
- delete component[key];
1591
- }
1592
- }
1593
- // 2. Mark component dirty. This forces the renderer to replace the component
1594
- // on patch.
1595
- hmrDirtyComponents.add(component);
1596
- // 3. Make sure to unmark the component after the reload.
1597
- queuePostFlushCb(() => {
1598
- hmrDirtyComponents.delete(component);
1599
- });
1600
- }
1601
- Array.from(instances).forEach(instance => {
1602
- // invalidate options resolution cache
1573
+ newComp = normalizeClassComponent(newComp);
1574
+ // create a snapshot which avoids the set being mutated during updates
1575
+ const instances = [...record];
1576
+ for (const instance of instances) {
1577
+ const oldComp = normalizeClassComponent(instance.type);
1578
+ if (!hmrDirtyComponents.has(oldComp)) {
1579
+ // 1. Update existing comp definition to match new one
1580
+ extend(oldComp, newComp);
1581
+ for (const key in oldComp) {
1582
+ if (key !== '__file' && !(key in newComp)) {
1583
+ delete oldComp[key];
1584
+ }
1585
+ }
1586
+ // 2. mark definition dirty. This forces the renderer to replace the
1587
+ // component on patch.
1588
+ hmrDirtyComponents.add(oldComp);
1589
+ }
1590
+ // 3. invalidate options resolution cache
1603
1591
  instance.appContext.optionsCache.delete(instance.type);
1592
+ // 4. actually update
1604
1593
  if (instance.ceReload) {
1605
1594
  // custom element
1606
- hmrDirtyComponents.add(component);
1595
+ hmrDirtyComponents.add(oldComp);
1607
1596
  instance.ceReload(newComp.styles);
1608
- hmrDirtyComponents.delete(component);
1597
+ hmrDirtyComponents.delete(oldComp);
1609
1598
  }
1610
1599
  else if (instance.parent) {
1611
1600
  // 4. Force the parent instance to re-render. This will cause all updated
@@ -1630,6 +1619,12 @@ function reload(id, newComp) {
1630
1619
  else {
1631
1620
  console.warn('[HMR] Root or manually mounted instance modified. Full reload required.');
1632
1621
  }
1622
+ }
1623
+ // 5. make sure to cleanup dirty hmr components after update
1624
+ queuePostFlushCb(() => {
1625
+ for (const instance of instances) {
1626
+ hmrDirtyComponents.delete(normalizeClassComponent(instance.type));
1627
+ }
1633
1628
  });
1634
1629
  }
1635
1630
  function tryWrap(fn) {
@@ -2443,12 +2438,12 @@ function markAttrsAccessed() {
2443
2438
  function renderComponentRoot(instance) {
2444
2439
  const { type: Component, vnode, proxy, withProxy, props, propsOptions: [propsOptions], slots, attrs, emit, render, renderCache, data, setupState, ctx, inheritAttrs } = instance;
2445
2440
  let result;
2441
+ let fallthroughAttrs;
2446
2442
  const prev = setCurrentRenderingInstance(instance);
2447
2443
  {
2448
2444
  accessedAttrs = false;
2449
2445
  }
2450
2446
  try {
2451
- let fallthroughAttrs;
2452
2447
  if (vnode.shapeFlag & 4 /* STATEFUL_COMPONENT */) {
2453
2448
  // withProxy is a proxy with a different `has` trap only for
2454
2449
  // runtime-compiled render functions using `with` block.
@@ -2479,108 +2474,105 @@ function renderComponentRoot(instance) {
2479
2474
  ? attrs
2480
2475
  : getFunctionalFallthrough(attrs);
2481
2476
  }
2482
- // attr merging
2483
- // in dev mode, comments are preserved, and it's possible for a template
2484
- // to have comments along side the root element which makes it a fragment
2485
- let root = result;
2486
- let setRoot = undefined;
2487
- if (true &&
2488
- result.patchFlag > 0 &&
2489
- result.patchFlag & 2048 /* DEV_ROOT_FRAGMENT */) {
2490
- ;
2491
- [root, setRoot] = getChildRoot(result);
2492
- }
2493
- if (fallthroughAttrs && inheritAttrs !== false) {
2494
- const keys = Object.keys(fallthroughAttrs);
2495
- const { shapeFlag } = root;
2496
- if (keys.length) {
2497
- if (shapeFlag & (1 /* ELEMENT */ | 6 /* COMPONENT */)) {
2498
- if (propsOptions && keys.some(isModelListener)) {
2499
- // If a v-model listener (onUpdate:xxx) has a corresponding declared
2500
- // prop, it indicates this component expects to handle v-model and
2501
- // it should not fallthrough.
2502
- // related: #1543, #1643, #1989
2503
- fallthroughAttrs = filterModelListeners(fallthroughAttrs, propsOptions);
2504
- }
2505
- root = cloneVNode(root, fallthroughAttrs);
2506
- }
2507
- else if (true && !accessedAttrs && root.type !== Comment) {
2508
- const allAttrs = Object.keys(attrs);
2509
- const eventAttrs = [];
2510
- const extraAttrs = [];
2511
- for (let i = 0, l = allAttrs.length; i < l; i++) {
2512
- const key = allAttrs[i];
2513
- if (isOn(key)) {
2514
- // ignore v-model handlers when they fail to fallthrough
2515
- if (!isModelListener(key)) {
2516
- // remove `on`, lowercase first letter to reflect event casing
2517
- // accurately
2518
- eventAttrs.push(key[2].toLowerCase() + key.slice(3));
2519
- }
2520
- }
2521
- else {
2522
- extraAttrs.push(key);
2477
+ }
2478
+ catch (err) {
2479
+ blockStack.length = 0;
2480
+ handleError(err, instance, 1 /* RENDER_FUNCTION */);
2481
+ result = createVNode(Comment);
2482
+ }
2483
+ // attr merging
2484
+ // in dev mode, comments are preserved, and it's possible for a template
2485
+ // to have comments along side the root element which makes it a fragment
2486
+ let root = result;
2487
+ let setRoot = undefined;
2488
+ if (result.patchFlag > 0 &&
2489
+ result.patchFlag & 2048 /* DEV_ROOT_FRAGMENT */) {
2490
+ [root, setRoot] = getChildRoot(result);
2491
+ }
2492
+ if (fallthroughAttrs && inheritAttrs !== false) {
2493
+ const keys = Object.keys(fallthroughAttrs);
2494
+ const { shapeFlag } = root;
2495
+ if (keys.length) {
2496
+ if (shapeFlag & (1 /* ELEMENT */ | 6 /* COMPONENT */)) {
2497
+ if (propsOptions && keys.some(isModelListener)) {
2498
+ // If a v-model listener (onUpdate:xxx) has a corresponding declared
2499
+ // prop, it indicates this component expects to handle v-model and
2500
+ // it should not fallthrough.
2501
+ // related: #1543, #1643, #1989
2502
+ fallthroughAttrs = filterModelListeners(fallthroughAttrs, propsOptions);
2503
+ }
2504
+ root = cloneVNode(root, fallthroughAttrs);
2505
+ }
2506
+ else if (!accessedAttrs && root.type !== Comment) {
2507
+ const allAttrs = Object.keys(attrs);
2508
+ const eventAttrs = [];
2509
+ const extraAttrs = [];
2510
+ for (let i = 0, l = allAttrs.length; i < l; i++) {
2511
+ const key = allAttrs[i];
2512
+ if (isOn(key)) {
2513
+ // ignore v-model handlers when they fail to fallthrough
2514
+ if (!isModelListener(key)) {
2515
+ // remove `on`, lowercase first letter to reflect event casing
2516
+ // accurately
2517
+ eventAttrs.push(key[2].toLowerCase() + key.slice(3));
2523
2518
  }
2524
2519
  }
2525
- if (extraAttrs.length) {
2526
- warn$1(`Extraneous non-props attributes (` +
2527
- `${extraAttrs.join(', ')}) ` +
2528
- `were passed to component but could not be automatically inherited ` +
2529
- `because component renders fragment or text root nodes.`);
2530
- }
2531
- if (eventAttrs.length) {
2532
- warn$1(`Extraneous non-emits event listeners (` +
2533
- `${eventAttrs.join(', ')}) ` +
2534
- `were passed to component but could not be automatically inherited ` +
2535
- `because component renders fragment or text root nodes. ` +
2536
- `If the listener is intended to be a component custom event listener only, ` +
2537
- `declare it using the "emits" option.`);
2520
+ else {
2521
+ extraAttrs.push(key);
2538
2522
  }
2539
2523
  }
2540
- }
2541
- }
2542
- if (true &&
2543
- isCompatEnabled("INSTANCE_ATTRS_CLASS_STYLE" /* INSTANCE_ATTRS_CLASS_STYLE */, instance) &&
2544
- vnode.shapeFlag & 4 /* STATEFUL_COMPONENT */ &&
2545
- root.shapeFlag & (1 /* ELEMENT */ | 6 /* COMPONENT */)) {
2546
- const { class: cls, style } = vnode.props || {};
2547
- if (cls || style) {
2548
- if (true && inheritAttrs === false) {
2549
- warnDeprecation("INSTANCE_ATTRS_CLASS_STYLE" /* INSTANCE_ATTRS_CLASS_STYLE */, instance, getComponentName(instance.type));
2524
+ if (extraAttrs.length) {
2525
+ warn$1(`Extraneous non-props attributes (` +
2526
+ `${extraAttrs.join(', ')}) ` +
2527
+ `were passed to component but could not be automatically inherited ` +
2528
+ `because component renders fragment or text root nodes.`);
2529
+ }
2530
+ if (eventAttrs.length) {
2531
+ warn$1(`Extraneous non-emits event listeners (` +
2532
+ `${eventAttrs.join(', ')}) ` +
2533
+ `were passed to component but could not be automatically inherited ` +
2534
+ `because component renders fragment or text root nodes. ` +
2535
+ `If the listener is intended to be a component custom event listener only, ` +
2536
+ `declare it using the "emits" option.`);
2550
2537
  }
2551
- root = cloneVNode(root, {
2552
- class: cls,
2553
- style: style
2554
- });
2555
- }
2556
- }
2557
- // inherit directives
2558
- if (vnode.dirs) {
2559
- if (true && !isElementRoot(root)) {
2560
- warn$1(`Runtime directive used on component with non-element root node. ` +
2561
- `The directives will not function as intended.`);
2562
2538
  }
2563
- root.dirs = root.dirs ? root.dirs.concat(vnode.dirs) : vnode.dirs;
2564
2539
  }
2565
- // inherit transition data
2566
- if (vnode.transition) {
2567
- if (true && !isElementRoot(root)) {
2568
- warn$1(`Component inside <Transition> renders non-element root node ` +
2569
- `that cannot be animated.`);
2540
+ }
2541
+ if (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 (inheritAttrs === false) {
2547
+ warnDeprecation("INSTANCE_ATTRS_CLASS_STYLE" /* INSTANCE_ATTRS_CLASS_STYLE */, instance, getComponentName(instance.type));
2570
2548
  }
2571
- root.transition = vnode.transition;
2549
+ root = cloneVNode(root, {
2550
+ class: cls,
2551
+ style: style
2552
+ });
2572
2553
  }
2573
- if (true && setRoot) {
2574
- setRoot(root);
2554
+ }
2555
+ // inherit directives
2556
+ if (vnode.dirs) {
2557
+ if (!isElementRoot(root)) {
2558
+ warn$1(`Runtime directive used on component with non-element root node. ` +
2559
+ `The directives will not function as intended.`);
2575
2560
  }
2576
- else {
2577
- result = root;
2561
+ root.dirs = root.dirs ? root.dirs.concat(vnode.dirs) : vnode.dirs;
2562
+ }
2563
+ // inherit transition data
2564
+ if (vnode.transition) {
2565
+ if (!isElementRoot(root)) {
2566
+ warn$1(`Component inside <Transition> renders non-element root node ` +
2567
+ `that cannot be animated.`);
2578
2568
  }
2569
+ root.transition = vnode.transition;
2579
2570
  }
2580
- catch (err) {
2581
- blockStack.length = 0;
2582
- handleError(err, instance, 1 /* RENDER_FUNCTION */);
2583
- result = createVNode(Comment);
2571
+ if (setRoot) {
2572
+ setRoot(root);
2573
+ }
2574
+ else {
2575
+ result = root;
2584
2576
  }
2585
2577
  setCurrentRenderingInstance(prev);
2586
2578
  return result;
@@ -3115,8 +3107,8 @@ function normalizeSuspenseChildren(vnode) {
3115
3107
  function normalizeSuspenseSlot(s) {
3116
3108
  let block;
3117
3109
  if (isFunction(s)) {
3118
- const isCompiledSlot = s._c;
3119
- if (isCompiledSlot) {
3110
+ const trackBlock = isBlockTreeEnabled && s._c;
3111
+ if (trackBlock) {
3120
3112
  // disableTracking: false
3121
3113
  // allow block tracking for compiled slots
3122
3114
  // (see ./componentRenderContext.ts)
@@ -3124,7 +3116,7 @@ function normalizeSuspenseSlot(s) {
3124
3116
  openBlock();
3125
3117
  }
3126
3118
  s = s();
3127
- if (isCompiledSlot) {
3119
+ if (trackBlock) {
3128
3120
  s._d = true;
3129
3121
  block = currentBlock;
3130
3122
  closeBlock();
@@ -5280,7 +5272,7 @@ function createCompatVue(createApp, createSingletonApp) {
5280
5272
  return vm;
5281
5273
  }
5282
5274
  }
5283
- Vue.version = "3.2.8";
5275
+ Vue.version = "3.2.12";
5284
5276
  Vue.config = singletonApp.config;
5285
5277
  Vue.use = (p, ...options) => {
5286
5278
  if (p && isFunction(p.install)) {
@@ -7928,7 +7920,11 @@ function resolveAsset(type, name, warnMissing = true, maybeSelfReference = false
7928
7920
  return Component;
7929
7921
  }
7930
7922
  if (warnMissing && !res) {
7931
- warn$1(`Failed to resolve ${type.slice(0, -1)}: ${name}`);
7923
+ const extra = type === COMPONENTS
7924
+ ? `\nIf this is a native custom element, make sure to exclude it from ` +
7925
+ `component resolution via compilerOptions.isCustomElement.`
7926
+ : ``;
7927
+ warn$1(`Failed to resolve ${type.slice(0, -1)}: ${name}${extra}`);
7932
7928
  }
7933
7929
  return res;
7934
7930
  }
@@ -9370,17 +9366,19 @@ function exposePropsOnRenderContext(instance) {
9370
9366
  function exposeSetupStateOnRenderContext(instance) {
9371
9367
  const { ctx, setupState } = instance;
9372
9368
  Object.keys(toRaw(setupState)).forEach(key => {
9373
- if (!setupState.__isScriptSetup && (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;
9369
+ if (!setupState.__isScriptSetup) {
9370
+ if (key[0] === '$' || key[0] === '_') {
9371
+ warn$1(`setup() return property ${JSON.stringify(key)} should not start with "$" or "_" ` +
9372
+ `which are reserved prefixes for Vue internals.`);
9373
+ return;
9374
+ }
9375
+ Object.defineProperty(ctx, key, {
9376
+ enumerable: true,
9377
+ configurable: true,
9378
+ get: () => setupState[key],
9379
+ set: NOOP
9380
+ });
9377
9381
  }
9378
- Object.defineProperty(ctx, key, {
9379
- enumerable: true,
9380
- configurable: true,
9381
- get: () => setupState[key],
9382
- set: NOOP
9383
- });
9384
9382
  });
9385
9383
  }
9386
9384
 
@@ -10139,11 +10137,18 @@ function flushJobs(seen) {
10139
10137
  // 2. If a component is unmounted during a parent component's update,
10140
10138
  // its update can be skipped.
10141
10139
  queue.sort((a, b) => getId(a) - getId(b));
10140
+ // conditional usage of checkRecursiveUpdate must be determined out of
10141
+ // try ... catch block since Rollup by default de-optimizes treeshaking
10142
+ // inside try-catch. This can leave all warning code unshaked. Although
10143
+ // they would get eventually shaken by a minifier like terser, some minifiers
10144
+ // would fail to do that (e.g. https://github.com/evanw/esbuild/issues/1610)
10145
+ const check = (job) => checkRecursiveUpdates(seen, job)
10146
+ ;
10142
10147
  try {
10143
10148
  for (flushIndex = 0; flushIndex < queue.length; flushIndex++) {
10144
10149
  const job = queue[flushIndex];
10145
10150
  if (job && job.active !== false) {
10146
- if (true && checkRecursiveUpdates(seen, job)) {
10151
+ if (true && check(job)) {
10147
10152
  continue;
10148
10153
  }
10149
10154
  // console.log(`running:`, job.id)
@@ -10487,7 +10492,7 @@ function defineExpose(exposed) {
10487
10492
  }
10488
10493
  /**
10489
10494
  * Vue `<script setup>` compiler macro for providing props default values when
10490
- * using type-based `defineProps` decalration.
10495
+ * using type-based `defineProps` declaration.
10491
10496
  *
10492
10497
  * Example usage:
10493
10498
  * ```ts
@@ -10836,7 +10841,7 @@ function isMemoSame(cached, memo) {
10836
10841
  }
10837
10842
 
10838
10843
  // Core API ------------------------------------------------------------------
10839
- const version = "3.2.8";
10844
+ const version = "3.2.12";
10840
10845
  /**
10841
10846
  * SSR utils for \@vue/server-renderer. Only exposed in cjs builds.
10842
10847
  * @internal
@@ -10965,19 +10970,13 @@ function patchClass(el, value, isSVG) {
10965
10970
 
10966
10971
  function patchStyle(el, prev, next) {
10967
10972
  const style = el.style;
10973
+ const currentDisplay = style.display;
10968
10974
  if (!next) {
10969
10975
  el.removeAttribute('style');
10970
10976
  }
10971
10977
  else if (isString(next)) {
10972
10978
  if (prev !== next) {
10973
- const current = style.display;
10974
10979
  style.cssText = next;
10975
- // indicates that the `display` of the element is controlled by `v-show`,
10976
- // so we always keep the current `display` value regardless of the `style` value,
10977
- // thus handing over control to `v-show`.
10978
- if ('_vod' in el) {
10979
- style.display = current;
10980
- }
10981
10980
  }
10982
10981
  }
10983
10982
  else {
@@ -10992,6 +10991,12 @@ function patchStyle(el, prev, next) {
10992
10991
  }
10993
10992
  }
10994
10993
  }
10994
+ // indicates that the `display` of the element is controlled by `v-show`,
10995
+ // so we always keep the current `display` value regardless of the `style` value,
10996
+ // thus handing over control to `v-show`.
10997
+ if ('_vod' in el) {
10998
+ style.display = currentDisplay;
10999
+ }
10995
11000
  }
10996
11001
  const importantRE = /\s*!important$/;
10997
11002
  function setStyle(style, name, val) {
@@ -11362,6 +11367,7 @@ class VueElement extends BaseClass {
11362
11367
  this._instance = null;
11363
11368
  this._connected = false;
11364
11369
  this._resolved = false;
11370
+ this._numberProps = null;
11365
11371
  if (this.shadowRoot && hydrate) {
11366
11372
  hydrate(this._createVNode(), this.shadowRoot);
11367
11373
  }
@@ -11377,18 +11383,17 @@ class VueElement extends BaseClass {
11377
11383
  this._setAttr(this.attributes[i].name);
11378
11384
  }
11379
11385
  // watch future attr changes
11380
- const observer = new MutationObserver(mutations => {
11386
+ new MutationObserver(mutations => {
11381
11387
  for (const m of mutations) {
11382
11388
  this._setAttr(m.attributeName);
11383
11389
  }
11384
- });
11385
- observer.observe(this, { attributes: true });
11390
+ }).observe(this, { attributes: true });
11386
11391
  }
11387
11392
  connectedCallback() {
11388
11393
  this._connected = true;
11389
11394
  if (!this._instance) {
11390
11395
  this._resolveDef();
11391
- render(this._createVNode(), this.shadowRoot);
11396
+ this._update();
11392
11397
  }
11393
11398
  }
11394
11399
  disconnectedCallback() {
@@ -11409,15 +11414,31 @@ class VueElement extends BaseClass {
11409
11414
  }
11410
11415
  const resolve = (def) => {
11411
11416
  this._resolved = true;
11417
+ const { props, styles } = def;
11418
+ const hasOptions = !isArray(props);
11419
+ const rawKeys = props ? (hasOptions ? Object.keys(props) : props) : [];
11420
+ // cast Number-type props set before resolve
11421
+ let numberProps;
11422
+ if (hasOptions) {
11423
+ for (const key in this._props) {
11424
+ const opt = props[key];
11425
+ if (opt === Number || (opt && opt.type === Number)) {
11426
+ this._props[key] = toNumber(this._props[key]);
11427
+ (numberProps || (numberProps = Object.create(null)))[key] = true;
11428
+ }
11429
+ }
11430
+ }
11431
+ if (numberProps) {
11432
+ this._numberProps = numberProps;
11433
+ this._update();
11434
+ }
11412
11435
  // check if there are props set pre-upgrade or connect
11413
11436
  for (const key of Object.keys(this)) {
11414
11437
  if (key[0] !== '_') {
11415
11438
  this._setProp(key, this[key]);
11416
11439
  }
11417
11440
  }
11418
- const { props, styles } = def;
11419
11441
  // defining getter/setters on prototype
11420
- const rawKeys = props ? (isArray(props) ? props : Object.keys(props)) : [];
11421
11442
  for (const key of rawKeys.map(camelize)) {
11422
11443
  Object.defineProperty(this, key, {
11423
11444
  get() {
@@ -11439,7 +11460,11 @@ class VueElement extends BaseClass {
11439
11460
  }
11440
11461
  }
11441
11462
  _setAttr(key) {
11442
- this._setProp(camelize(key), toNumber(this.getAttribute(key)), false);
11463
+ let value = this.getAttribute(key);
11464
+ if (this._numberProps && this._numberProps[key]) {
11465
+ value = toNumber(value);
11466
+ }
11467
+ this._setProp(camelize(key), value, false);
11443
11468
  }
11444
11469
  /**
11445
11470
  * @internal
@@ -11454,7 +11479,7 @@ class VueElement extends BaseClass {
11454
11479
  if (val !== this._props[key]) {
11455
11480
  this._props[key] = val;
11456
11481
  if (this._instance) {
11457
- render(this._createVNode(), this.shadowRoot);
11482
+ this._update();
11458
11483
  }
11459
11484
  // reflect
11460
11485
  if (shouldReflect) {
@@ -11470,6 +11495,9 @@ class VueElement extends BaseClass {
11470
11495
  }
11471
11496
  }
11472
11497
  }
11498
+ _update() {
11499
+ render(this._createVNode(), this.shadowRoot);
11500
+ }
11473
11501
  _createVNode() {
11474
11502
  const vnode = createVNode(this._def, extend({}, this._props));
11475
11503
  if (!this._instance) {
@@ -11490,7 +11518,7 @@ class VueElement extends BaseClass {
11490
11518
  if (!this._def.__asyncLoader) {
11491
11519
  // reload
11492
11520
  this._instance = null;
11493
- render(this._createVNode(), this.shadowRoot);
11521
+ this._update();
11494
11522
  }
11495
11523
  };
11496
11524
  }
@@ -13948,6 +13976,13 @@ function parseAttributes(context, type) {
13948
13976
  emitError(context, 3 /* END_TAG_WITH_ATTRIBUTES */);
13949
13977
  }
13950
13978
  const attr = parseAttribute(context, attributeNames);
13979
+ // Trim whitespace between class
13980
+ // https://github.com/vuejs/vue-next/issues/4251
13981
+ if (attr.type === 6 /* ATTRIBUTE */ &&
13982
+ attr.value &&
13983
+ attr.name === 'class') {
13984
+ attr.value.content = attr.value.content.replace(/\s+/g, ' ').trim();
13985
+ }
13951
13986
  if (type === 0 /* Start */) {
13952
13987
  props.push(attr);
13953
13988
  }
@@ -14010,8 +14045,11 @@ function parseAttribute(context, nameSet) {
14010
14045
  isStatic = false;
14011
14046
  if (!content.endsWith(']')) {
14012
14047
  emitError(context, 27 /* X_MISSING_DYNAMIC_DIRECTIVE_ARGUMENT_END */);
14048
+ content = content.substr(1);
14049
+ }
14050
+ else {
14051
+ content = content.substr(1, content.length - 2);
14013
14052
  }
14014
- content = content.substr(1, content.length - 2);
14015
14053
  }
14016
14054
  else if (isSlot) {
14017
14055
  // #1241 special case for v-slot: vuetify relies extensively on slot
@@ -15473,7 +15511,7 @@ function processExpression(node, context,
15473
15511
  // function params
15474
15512
  asParams = false,
15475
15513
  // v-on handler values may contain multiple statements
15476
- asRawStatements = false) {
15514
+ asRawStatements = false, localVars = Object.create(context.identifiers)) {
15477
15515
  {
15478
15516
  {
15479
15517
  // simple in-browser validation (same logic in 2.x)
@@ -16785,7 +16823,7 @@ function processSlotOutlet(node, context) {
16785
16823
  };
16786
16824
  }
16787
16825
 
16788
- const fnExpRE = /^\s*([\w$_]+|\([^)]*?\))\s*=>|^\s*function(?:\s+[\w$]+)?\s*\(/;
16826
+ const fnExpRE = /^\s*([\w$_]+|(async\s*)?\([^)]*?\))\s*=>|^\s*(async\s+)?function(?:\s+[\w$]+)?\s*\(/;
16789
16827
  const transformOn = (dir, node, context, augmentor) => {
16790
16828
  const { loc, modifiers, arg } = dir;
16791
16829
  if (!dir.exp && !modifiers.length) {