@vue/compat 3.2.9 → 3.2.13

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.
@@ -1,4 +1,4 @@
1
- var Vue = (function (exports) {
1
+ var Vue = (function () {
2
2
  'use strict';
3
3
 
4
4
  /**
@@ -1488,7 +1488,8 @@ var Vue = (function (exports) {
1488
1488
  function computed(getterOrOptions, debugOptions) {
1489
1489
  let getter;
1490
1490
  let setter;
1491
- if (isFunction(getterOrOptions)) {
1491
+ const onlyGetter = isFunction(getterOrOptions);
1492
+ if (onlyGetter) {
1492
1493
  getter = getterOrOptions;
1493
1494
  setter = () => {
1494
1495
  console.warn('Write operation failed: computed value is readonly');
@@ -1499,7 +1500,7 @@ var Vue = (function (exports) {
1499
1500
  getter = getterOrOptions.get;
1500
1501
  setter = getterOrOptions.set;
1501
1502
  }
1502
- const cRef = new ComputedRefImpl(getter, setter, isFunction(getterOrOptions) || !getterOrOptions.set);
1503
+ const cRef = new ComputedRefImpl(getter, setter, onlyGetter || !setter);
1503
1504
  if (debugOptions) {
1504
1505
  cRef.effect.onTrack = debugOptions.onTrack;
1505
1506
  cRef.effect.onTrigger = debugOptions.onTrigger;
@@ -1534,41 +1535,33 @@ var Vue = (function (exports) {
1534
1535
  const id = instance.type.__hmrId;
1535
1536
  let record = map.get(id);
1536
1537
  if (!record) {
1537
- createRecord(id, instance.type);
1538
+ createRecord(id);
1538
1539
  record = map.get(id);
1539
1540
  }
1540
- record.instances.add(instance);
1541
+ record.add(instance);
1541
1542
  }
1542
1543
  function unregisterHMR(instance) {
1543
- map.get(instance.type.__hmrId).instances.delete(instance);
1544
+ map.get(instance.type.__hmrId).delete(instance);
1544
1545
  }
1545
- function createRecord(id, component) {
1546
- if (!component) {
1547
- warn$1(`HMR API usage is out of date.\n` +
1548
- `Please upgrade vue-loader/vite/rollup-plugin-vue or other relevant ` +
1549
- `dependency that handles Vue SFC compilation.`);
1550
- component = {};
1551
- }
1546
+ function createRecord(id) {
1552
1547
  if (map.has(id)) {
1553
1548
  return false;
1554
1549
  }
1555
- map.set(id, {
1556
- component: isClassComponent(component) ? component.__vccOpts : component,
1557
- instances: new Set()
1558
- });
1550
+ map.set(id, new Set());
1559
1551
  return true;
1560
1552
  }
1553
+ function normalizeClassComponent(component) {
1554
+ return isClassComponent(component) ? component.__vccOpts : component;
1555
+ }
1561
1556
  function rerender(id, newRender) {
1562
1557
  const record = map.get(id);
1563
- if (!record)
1558
+ if (!record) {
1564
1559
  return;
1565
- if (newRender)
1566
- record.component.render = newRender;
1567
- // Array.from creates a snapshot which avoids the set being mutated during
1568
- // updates
1569
- Array.from(record.instances).forEach(instance => {
1560
+ }
1561
+ [...record].forEach(instance => {
1570
1562
  if (newRender) {
1571
1563
  instance.render = newRender;
1564
+ normalizeClassComponent(instance.type).render = newRender;
1572
1565
  }
1573
1566
  instance.renderCache = [];
1574
1567
  // this flag forces child components with slot content to update
@@ -1581,34 +1574,31 @@ var Vue = (function (exports) {
1581
1574
  const record = map.get(id);
1582
1575
  if (!record)
1583
1576
  return;
1584
- // Array.from creates a snapshot which avoids the set being mutated during
1585
- // updates
1586
- const { component, instances } = record;
1587
- if (!hmrDirtyComponents.has(component)) {
1588
- // 1. Update existing comp definition to match new one
1589
- newComp = isClassComponent(newComp) ? newComp.__vccOpts : newComp;
1590
- extend(component, newComp);
1591
- for (const key in component) {
1592
- if (key !== '__file' && !(key in newComp)) {
1593
- delete component[key];
1594
- }
1595
- }
1596
- // 2. Mark component dirty. This forces the renderer to replace the component
1597
- // on patch.
1598
- hmrDirtyComponents.add(component);
1599
- // 3. Make sure to unmark the component after the reload.
1600
- queuePostFlushCb(() => {
1601
- hmrDirtyComponents.delete(component);
1602
- });
1603
- }
1604
- Array.from(instances).forEach(instance => {
1605
- // invalidate options resolution cache
1577
+ newComp = normalizeClassComponent(newComp);
1578
+ // create a snapshot which avoids the set being mutated during updates
1579
+ const instances = [...record];
1580
+ for (const instance of instances) {
1581
+ const oldComp = normalizeClassComponent(instance.type);
1582
+ if (!hmrDirtyComponents.has(oldComp)) {
1583
+ // 1. Update existing comp definition to match new one
1584
+ extend(oldComp, newComp);
1585
+ for (const key in oldComp) {
1586
+ if (key !== '__file' && !(key in newComp)) {
1587
+ delete oldComp[key];
1588
+ }
1589
+ }
1590
+ // 2. mark definition dirty. This forces the renderer to replace the
1591
+ // component on patch.
1592
+ hmrDirtyComponents.add(oldComp);
1593
+ }
1594
+ // 3. invalidate options resolution cache
1606
1595
  instance.appContext.optionsCache.delete(instance.type);
1596
+ // 4. actually update
1607
1597
  if (instance.ceReload) {
1608
1598
  // custom element
1609
- hmrDirtyComponents.add(component);
1599
+ hmrDirtyComponents.add(oldComp);
1610
1600
  instance.ceReload(newComp.styles);
1611
- hmrDirtyComponents.delete(component);
1601
+ hmrDirtyComponents.delete(oldComp);
1612
1602
  }
1613
1603
  else if (instance.parent) {
1614
1604
  // 4. Force the parent instance to re-render. This will cause all updated
@@ -1633,6 +1623,12 @@ var Vue = (function (exports) {
1633
1623
  else {
1634
1624
  console.warn('[HMR] Root or manually mounted instance modified. Full reload required.');
1635
1625
  }
1626
+ }
1627
+ // 5. make sure to cleanup dirty hmr components after update
1628
+ queuePostFlushCb(() => {
1629
+ for (const instance of instances) {
1630
+ hmrDirtyComponents.delete(normalizeClassComponent(instance.type));
1631
+ }
1636
1632
  });
1637
1633
  }
1638
1634
  function tryWrap(fn) {
@@ -1959,7 +1955,7 @@ var Vue = (function (exports) {
1959
1955
  ["PRIVATE_APIS" /* PRIVATE_APIS */]: {
1960
1956
  message: name => `"${name}" is a Vue 2 private API that no longer exists in Vue 3. ` +
1961
1957
  `If you are seeing this warning only due to a dependency, you can ` +
1962
- `suppress this warning via { PRIVATE_APIS: 'supress-warning' }.`
1958
+ `suppress this warning via { PRIVATE_APIS: 'suppress-warning' }.`
1963
1959
  }
1964
1960
  };
1965
1961
  const instanceWarned = Object.create(null);
@@ -2446,12 +2442,12 @@ var Vue = (function (exports) {
2446
2442
  function renderComponentRoot(instance) {
2447
2443
  const { type: Component, vnode, proxy, withProxy, props, propsOptions: [propsOptions], slots, attrs, emit, render, renderCache, data, setupState, ctx, inheritAttrs } = instance;
2448
2444
  let result;
2445
+ let fallthroughAttrs;
2449
2446
  const prev = setCurrentRenderingInstance(instance);
2450
2447
  {
2451
2448
  accessedAttrs = false;
2452
2449
  }
2453
2450
  try {
2454
- let fallthroughAttrs;
2455
2451
  if (vnode.shapeFlag & 4 /* STATEFUL_COMPONENT */) {
2456
2452
  // withProxy is a proxy with a different `has` trap only for
2457
2453
  // runtime-compiled render functions using `with` block.
@@ -2482,108 +2478,105 @@ var Vue = (function (exports) {
2482
2478
  ? attrs
2483
2479
  : getFunctionalFallthrough(attrs);
2484
2480
  }
2485
- // attr merging
2486
- // in dev mode, comments are preserved, and it's possible for a template
2487
- // to have comments along side the root element which makes it a fragment
2488
- let root = result;
2489
- let setRoot = undefined;
2490
- if (true &&
2491
- result.patchFlag > 0 &&
2492
- result.patchFlag & 2048 /* DEV_ROOT_FRAGMENT */) {
2493
- ;
2494
- [root, setRoot] = getChildRoot(result);
2495
- }
2496
- if (fallthroughAttrs && inheritAttrs !== false) {
2497
- const keys = Object.keys(fallthroughAttrs);
2498
- const { shapeFlag } = root;
2499
- if (keys.length) {
2500
- if (shapeFlag & (1 /* ELEMENT */ | 6 /* COMPONENT */)) {
2501
- if (propsOptions && keys.some(isModelListener)) {
2502
- // If a v-model listener (onUpdate:xxx) has a corresponding declared
2503
- // prop, it indicates this component expects to handle v-model and
2504
- // it should not fallthrough.
2505
- // related: #1543, #1643, #1989
2506
- fallthroughAttrs = filterModelListeners(fallthroughAttrs, propsOptions);
2507
- }
2508
- root = cloneVNode(root, fallthroughAttrs);
2509
- }
2510
- else if (true && !accessedAttrs && root.type !== Comment) {
2511
- const allAttrs = Object.keys(attrs);
2512
- const eventAttrs = [];
2513
- const extraAttrs = [];
2514
- for (let i = 0, l = allAttrs.length; i < l; i++) {
2515
- const key = allAttrs[i];
2516
- if (isOn(key)) {
2517
- // ignore v-model handlers when they fail to fallthrough
2518
- if (!isModelListener(key)) {
2519
- // remove `on`, lowercase first letter to reflect event casing
2520
- // accurately
2521
- eventAttrs.push(key[2].toLowerCase() + key.slice(3));
2522
- }
2523
- }
2524
- else {
2525
- extraAttrs.push(key);
2481
+ }
2482
+ catch (err) {
2483
+ blockStack.length = 0;
2484
+ handleError(err, instance, 1 /* RENDER_FUNCTION */);
2485
+ result = createVNode(Comment);
2486
+ }
2487
+ // attr merging
2488
+ // in dev mode, comments are preserved, and it's possible for a template
2489
+ // to have comments along side the root element which makes it a fragment
2490
+ let root = result;
2491
+ let setRoot = undefined;
2492
+ if (result.patchFlag > 0 &&
2493
+ result.patchFlag & 2048 /* DEV_ROOT_FRAGMENT */) {
2494
+ [root, setRoot] = getChildRoot(result);
2495
+ }
2496
+ if (fallthroughAttrs && inheritAttrs !== false) {
2497
+ const keys = Object.keys(fallthroughAttrs);
2498
+ const { shapeFlag } = root;
2499
+ if (keys.length) {
2500
+ if (shapeFlag & (1 /* ELEMENT */ | 6 /* COMPONENT */)) {
2501
+ if (propsOptions && keys.some(isModelListener)) {
2502
+ // If a v-model listener (onUpdate:xxx) has a corresponding declared
2503
+ // prop, it indicates this component expects to handle v-model and
2504
+ // it should not fallthrough.
2505
+ // related: #1543, #1643, #1989
2506
+ fallthroughAttrs = filterModelListeners(fallthroughAttrs, propsOptions);
2507
+ }
2508
+ root = cloneVNode(root, fallthroughAttrs);
2509
+ }
2510
+ else if (!accessedAttrs && root.type !== Comment) {
2511
+ const allAttrs = Object.keys(attrs);
2512
+ const eventAttrs = [];
2513
+ const extraAttrs = [];
2514
+ for (let i = 0, l = allAttrs.length; i < l; i++) {
2515
+ const key = allAttrs[i];
2516
+ if (isOn(key)) {
2517
+ // ignore v-model handlers when they fail to fallthrough
2518
+ if (!isModelListener(key)) {
2519
+ // remove `on`, lowercase first letter to reflect event casing
2520
+ // accurately
2521
+ eventAttrs.push(key[2].toLowerCase() + key.slice(3));
2526
2522
  }
2527
2523
  }
2528
- if (extraAttrs.length) {
2529
- warn$1(`Extraneous non-props attributes (` +
2530
- `${extraAttrs.join(', ')}) ` +
2531
- `were passed to component but could not be automatically inherited ` +
2532
- `because component renders fragment or text root nodes.`);
2533
- }
2534
- if (eventAttrs.length) {
2535
- warn$1(`Extraneous non-emits event listeners (` +
2536
- `${eventAttrs.join(', ')}) ` +
2537
- `were passed to component but could not be automatically inherited ` +
2538
- `because component renders fragment or text root nodes. ` +
2539
- `If the listener is intended to be a component custom event listener only, ` +
2540
- `declare it using the "emits" option.`);
2524
+ else {
2525
+ extraAttrs.push(key);
2541
2526
  }
2542
2527
  }
2543
- }
2544
- }
2545
- if (true &&
2546
- isCompatEnabled("INSTANCE_ATTRS_CLASS_STYLE" /* INSTANCE_ATTRS_CLASS_STYLE */, instance) &&
2547
- vnode.shapeFlag & 4 /* STATEFUL_COMPONENT */ &&
2548
- root.shapeFlag & (1 /* ELEMENT */ | 6 /* COMPONENT */)) {
2549
- const { class: cls, style } = vnode.props || {};
2550
- if (cls || style) {
2551
- if (true && inheritAttrs === false) {
2552
- warnDeprecation("INSTANCE_ATTRS_CLASS_STYLE" /* INSTANCE_ATTRS_CLASS_STYLE */, instance, getComponentName(instance.type));
2528
+ if (extraAttrs.length) {
2529
+ warn$1(`Extraneous non-props attributes (` +
2530
+ `${extraAttrs.join(', ')}) ` +
2531
+ `were passed to component but could not be automatically inherited ` +
2532
+ `because component renders fragment or text root nodes.`);
2533
+ }
2534
+ if (eventAttrs.length) {
2535
+ warn$1(`Extraneous non-emits event listeners (` +
2536
+ `${eventAttrs.join(', ')}) ` +
2537
+ `were passed to component but could not be automatically inherited ` +
2538
+ `because component renders fragment or text root nodes. ` +
2539
+ `If the listener is intended to be a component custom event listener only, ` +
2540
+ `declare it using the "emits" option.`);
2553
2541
  }
2554
- root = cloneVNode(root, {
2555
- class: cls,
2556
- style: style
2557
- });
2558
- }
2559
- }
2560
- // inherit directives
2561
- if (vnode.dirs) {
2562
- if (true && !isElementRoot(root)) {
2563
- warn$1(`Runtime directive used on component with non-element root node. ` +
2564
- `The directives will not function as intended.`);
2565
2542
  }
2566
- root.dirs = root.dirs ? root.dirs.concat(vnode.dirs) : vnode.dirs;
2567
2543
  }
2568
- // inherit transition data
2569
- if (vnode.transition) {
2570
- if (true && !isElementRoot(root)) {
2571
- warn$1(`Component inside <Transition> renders non-element root node ` +
2572
- `that cannot be animated.`);
2544
+ }
2545
+ if (isCompatEnabled("INSTANCE_ATTRS_CLASS_STYLE" /* INSTANCE_ATTRS_CLASS_STYLE */, instance) &&
2546
+ vnode.shapeFlag & 4 /* STATEFUL_COMPONENT */ &&
2547
+ root.shapeFlag & (1 /* ELEMENT */ | 6 /* COMPONENT */)) {
2548
+ const { class: cls, style } = vnode.props || {};
2549
+ if (cls || style) {
2550
+ if (inheritAttrs === false) {
2551
+ warnDeprecation("INSTANCE_ATTRS_CLASS_STYLE" /* INSTANCE_ATTRS_CLASS_STYLE */, instance, getComponentName(instance.type));
2573
2552
  }
2574
- root.transition = vnode.transition;
2553
+ root = cloneVNode(root, {
2554
+ class: cls,
2555
+ style: style
2556
+ });
2575
2557
  }
2576
- if (true && setRoot) {
2577
- setRoot(root);
2558
+ }
2559
+ // inherit directives
2560
+ if (vnode.dirs) {
2561
+ if (!isElementRoot(root)) {
2562
+ warn$1(`Runtime directive used on component with non-element root node. ` +
2563
+ `The directives will not function as intended.`);
2578
2564
  }
2579
- else {
2580
- result = root;
2565
+ root.dirs = root.dirs ? root.dirs.concat(vnode.dirs) : vnode.dirs;
2566
+ }
2567
+ // inherit transition data
2568
+ if (vnode.transition) {
2569
+ if (!isElementRoot(root)) {
2570
+ warn$1(`Component inside <Transition> renders non-element root node ` +
2571
+ `that cannot be animated.`);
2581
2572
  }
2573
+ root.transition = vnode.transition;
2582
2574
  }
2583
- catch (err) {
2584
- blockStack.length = 0;
2585
- handleError(err, instance, 1 /* RENDER_FUNCTION */);
2586
- result = createVNode(Comment);
2575
+ if (setRoot) {
2576
+ setRoot(root);
2577
+ }
2578
+ else {
2579
+ result = root;
2587
2580
  }
2588
2581
  setCurrentRenderingInstance(prev);
2589
2582
  return result;
@@ -3118,8 +3111,8 @@ var Vue = (function (exports) {
3118
3111
  function normalizeSuspenseSlot(s) {
3119
3112
  let block;
3120
3113
  if (isFunction(s)) {
3121
- const isCompiledSlot = s._c;
3122
- if (isCompiledSlot) {
3114
+ const trackBlock = isBlockTreeEnabled && s._c;
3115
+ if (trackBlock) {
3123
3116
  // disableTracking: false
3124
3117
  // allow block tracking for compiled slots
3125
3118
  // (see ./componentRenderContext.ts)
@@ -3127,7 +3120,7 @@ var Vue = (function (exports) {
3127
3120
  openBlock();
3128
3121
  }
3129
3122
  s = s();
3130
- if (isCompiledSlot) {
3123
+ if (trackBlock) {
3131
3124
  s._d = true;
3132
3125
  block = currentBlock;
3133
3126
  closeBlock();
@@ -5283,7 +5276,7 @@ var Vue = (function (exports) {
5283
5276
  return vm;
5284
5277
  }
5285
5278
  }
5286
- Vue.version = "3.2.9";
5279
+ Vue.version = "3.2.13";
5287
5280
  Vue.config = singletonApp.config;
5288
5281
  Vue.use = (p, ...options) => {
5289
5282
  if (p && isFunction(p.install)) {
@@ -5814,7 +5807,7 @@ var Vue = (function (exports) {
5814
5807
  app._instance = vnode.component;
5815
5808
  devtoolsInitApp(app, version);
5816
5809
  }
5817
- return vnode.component.proxy;
5810
+ return getExposeProxy(vnode.component) || vnode.component.proxy;
5818
5811
  }
5819
5812
  else {
5820
5813
  warn$1(`App has already been mounted.\n` +
@@ -6023,14 +6016,14 @@ var Vue = (function (exports) {
6023
6016
  for (const key in props) {
6024
6017
  if ((forcePatchValue && key.endsWith('value')) ||
6025
6018
  (isOn(key) && !isReservedProp(key))) {
6026
- patchProp(el, key, null, props[key]);
6019
+ patchProp(el, key, null, props[key], false, undefined, parentComponent);
6027
6020
  }
6028
6021
  }
6029
6022
  }
6030
6023
  else if (props.onClick) {
6031
6024
  // Fast path for click listeners (which is most often) to avoid
6032
6025
  // iterating through props.
6033
- patchProp(el, 'onClick', null, props.onClick);
6026
+ patchProp(el, 'onClick', null, props.onClick, false, undefined, parentComponent);
6034
6027
  }
6035
6028
  }
6036
6029
  // vnode / directive hooks
@@ -7931,7 +7924,11 @@ var Vue = (function (exports) {
7931
7924
  return Component;
7932
7925
  }
7933
7926
  if (warnMissing && !res) {
7934
- warn$1(`Failed to resolve ${type.slice(0, -1)}: ${name}`);
7927
+ const extra = type === COMPONENTS
7928
+ ? `\nIf this is a native custom element, make sure to exclude it from ` +
7929
+ `component resolution via compilerOptions.isCustomElement.`
7930
+ : ``;
7931
+ warn$1(`Failed to resolve ${type.slice(0, -1)}: ${name}${extra}`);
7935
7932
  }
7936
7933
  return res;
7937
7934
  }
@@ -9373,17 +9370,19 @@ var Vue = (function (exports) {
9373
9370
  function exposeSetupStateOnRenderContext(instance) {
9374
9371
  const { ctx, setupState } = instance;
9375
9372
  Object.keys(toRaw(setupState)).forEach(key => {
9376
- if (!setupState.__isScriptSetup && (key[0] === '$' || key[0] === '_')) {
9377
- warn$1(`setup() return property ${JSON.stringify(key)} should not start with "$" or "_" ` +
9378
- `which are reserved prefixes for Vue internals.`);
9379
- return;
9373
+ if (!setupState.__isScriptSetup) {
9374
+ if (key[0] === '$' || key[0] === '_') {
9375
+ warn$1(`setup() return property ${JSON.stringify(key)} should not start with "$" or "_" ` +
9376
+ `which are reserved prefixes for Vue internals.`);
9377
+ return;
9378
+ }
9379
+ Object.defineProperty(ctx, key, {
9380
+ enumerable: true,
9381
+ configurable: true,
9382
+ get: () => setupState[key],
9383
+ set: NOOP
9384
+ });
9380
9385
  }
9381
- Object.defineProperty(ctx, key, {
9382
- enumerable: true,
9383
- configurable: true,
9384
- get: () => setupState[key],
9385
- set: NOOP
9386
- });
9387
9386
  });
9388
9387
  }
9389
9388
 
@@ -10142,11 +10141,18 @@ var Vue = (function (exports) {
10142
10141
  // 2. If a component is unmounted during a parent component's update,
10143
10142
  // its update can be skipped.
10144
10143
  queue.sort((a, b) => getId(a) - getId(b));
10144
+ // conditional usage of checkRecursiveUpdate must be determined out of
10145
+ // try ... catch block since Rollup by default de-optimizes treeshaking
10146
+ // inside try-catch. This can leave all warning code unshaked. Although
10147
+ // they would get eventually shaken by a minifier like terser, some minifiers
10148
+ // would fail to do that (e.g. https://github.com/evanw/esbuild/issues/1610)
10149
+ const check = (job) => checkRecursiveUpdates(seen, job)
10150
+ ;
10145
10151
  try {
10146
10152
  for (flushIndex = 0; flushIndex < queue.length; flushIndex++) {
10147
10153
  const job = queue[flushIndex];
10148
10154
  if (job && job.active !== false) {
10149
- if (true && checkRecursiveUpdates(seen, job)) {
10155
+ if (true && check(job)) {
10150
10156
  continue;
10151
10157
  }
10152
10158
  // console.log(`running:`, job.id)
@@ -10423,7 +10429,7 @@ var Vue = (function (exports) {
10423
10429
  return cur;
10424
10430
  };
10425
10431
  }
10426
- function traverse(value, seen = new Set()) {
10432
+ function traverse(value, seen) {
10427
10433
  if (!isObject(value) || value["__v_skip" /* SKIP */]) {
10428
10434
  return value;
10429
10435
  }
@@ -10834,7 +10840,7 @@ var Vue = (function (exports) {
10834
10840
  }
10835
10841
 
10836
10842
  // Core API ------------------------------------------------------------------
10837
- const version = "3.2.9";
10843
+ const version = "3.2.13";
10838
10844
  /**
10839
10845
  * SSR utils for \@vue/server-renderer. Only exposed in cjs builds.
10840
10846
  * @internal
@@ -10963,19 +10969,13 @@ var Vue = (function (exports) {
10963
10969
 
10964
10970
  function patchStyle(el, prev, next) {
10965
10971
  const style = el.style;
10972
+ const currentDisplay = style.display;
10966
10973
  if (!next) {
10967
10974
  el.removeAttribute('style');
10968
10975
  }
10969
10976
  else if (isString(next)) {
10970
10977
  if (prev !== next) {
10971
- const current = style.display;
10972
10978
  style.cssText = next;
10973
- // indicates that the `display` of the element is controlled by `v-show`,
10974
- // so we always keep the current `display` value regardless of the `style` value,
10975
- // thus handing over control to `v-show`.
10976
- if ('_vod' in el) {
10977
- style.display = current;
10978
- }
10979
10979
  }
10980
10980
  }
10981
10981
  else {
@@ -10990,6 +10990,12 @@ var Vue = (function (exports) {
10990
10990
  }
10991
10991
  }
10992
10992
  }
10993
+ // indicates that the `display` of the element is controlled by `v-show`,
10994
+ // so we always keep the current `display` value regardless of the `style` value,
10995
+ // thus handing over control to `v-show`.
10996
+ if ('_vod' in el) {
10997
+ style.display = currentDisplay;
10998
+ }
10993
10999
  }
10994
11000
  const importantRE = /\s*!important$/;
10995
11001
  function setStyle(style, name, val) {
@@ -11360,6 +11366,7 @@ var Vue = (function (exports) {
11360
11366
  this._instance = null;
11361
11367
  this._connected = false;
11362
11368
  this._resolved = false;
11369
+ this._numberProps = null;
11363
11370
  if (this.shadowRoot && hydrate) {
11364
11371
  hydrate(this._createVNode(), this.shadowRoot);
11365
11372
  }
@@ -11375,18 +11382,17 @@ var Vue = (function (exports) {
11375
11382
  this._setAttr(this.attributes[i].name);
11376
11383
  }
11377
11384
  // watch future attr changes
11378
- const observer = new MutationObserver(mutations => {
11385
+ new MutationObserver(mutations => {
11379
11386
  for (const m of mutations) {
11380
11387
  this._setAttr(m.attributeName);
11381
11388
  }
11382
- });
11383
- observer.observe(this, { attributes: true });
11389
+ }).observe(this, { attributes: true });
11384
11390
  }
11385
11391
  connectedCallback() {
11386
11392
  this._connected = true;
11387
11393
  if (!this._instance) {
11388
11394
  this._resolveDef();
11389
- render(this._createVNode(), this.shadowRoot);
11395
+ this._update();
11390
11396
  }
11391
11397
  }
11392
11398
  disconnectedCallback() {
@@ -11407,15 +11413,31 @@ var Vue = (function (exports) {
11407
11413
  }
11408
11414
  const resolve = (def) => {
11409
11415
  this._resolved = true;
11416
+ const { props, styles } = def;
11417
+ const hasOptions = !isArray(props);
11418
+ const rawKeys = props ? (hasOptions ? Object.keys(props) : props) : [];
11419
+ // cast Number-type props set before resolve
11420
+ let numberProps;
11421
+ if (hasOptions) {
11422
+ for (const key in this._props) {
11423
+ const opt = props[key];
11424
+ if (opt === Number || (opt && opt.type === Number)) {
11425
+ this._props[key] = toNumber(this._props[key]);
11426
+ (numberProps || (numberProps = Object.create(null)))[key] = true;
11427
+ }
11428
+ }
11429
+ }
11430
+ if (numberProps) {
11431
+ this._numberProps = numberProps;
11432
+ this._update();
11433
+ }
11410
11434
  // check if there are props set pre-upgrade or connect
11411
11435
  for (const key of Object.keys(this)) {
11412
11436
  if (key[0] !== '_') {
11413
11437
  this._setProp(key, this[key]);
11414
11438
  }
11415
11439
  }
11416
- const { props, styles } = def;
11417
11440
  // defining getter/setters on prototype
11418
- const rawKeys = props ? (isArray(props) ? props : Object.keys(props)) : [];
11419
11441
  for (const key of rawKeys.map(camelize)) {
11420
11442
  Object.defineProperty(this, key, {
11421
11443
  get() {
@@ -11437,7 +11459,11 @@ var Vue = (function (exports) {
11437
11459
  }
11438
11460
  }
11439
11461
  _setAttr(key) {
11440
- this._setProp(camelize(key), toNumber(this.getAttribute(key)), false);
11462
+ let value = this.getAttribute(key);
11463
+ if (this._numberProps && this._numberProps[key]) {
11464
+ value = toNumber(value);
11465
+ }
11466
+ this._setProp(camelize(key), value, false);
11441
11467
  }
11442
11468
  /**
11443
11469
  * @internal
@@ -11452,7 +11478,7 @@ var Vue = (function (exports) {
11452
11478
  if (val !== this._props[key]) {
11453
11479
  this._props[key] = val;
11454
11480
  if (this._instance) {
11455
- render(this._createVNode(), this.shadowRoot);
11481
+ this._update();
11456
11482
  }
11457
11483
  // reflect
11458
11484
  if (shouldReflect) {
@@ -11468,6 +11494,9 @@ var Vue = (function (exports) {
11468
11494
  }
11469
11495
  }
11470
11496
  }
11497
+ _update() {
11498
+ render(this._createVNode(), this.shadowRoot);
11499
+ }
11471
11500
  _createVNode() {
11472
11501
  const vnode = createVNode(this._def, extend({}, this._props));
11473
11502
  if (!this._instance) {
@@ -11488,7 +11517,7 @@ var Vue = (function (exports) {
11488
11517
  if (!this._def.__asyncLoader) {
11489
11518
  // reload
11490
11519
  this._instance = null;
11491
- render(this._createVNode(), this.shadowRoot);
11520
+ this._update();
11492
11521
  }
11493
11522
  };
11494
11523
  }
@@ -12783,7 +12812,7 @@ var Vue = (function (exports) {
12783
12812
  // transform errors
12784
12813
  [28 /* X_V_IF_NO_EXPRESSION */]: `v-if/v-else-if is missing expression.`,
12785
12814
  [29 /* X_V_IF_SAME_KEY */]: `v-if/else branches must use unique keys.`,
12786
- [30 /* X_V_ELSE_NO_ADJACENT_IF */]: `v-else/v-else-if has no adjacent v-if.`,
12815
+ [30 /* X_V_ELSE_NO_ADJACENT_IF */]: `v-else/v-else-if has no adjacent v-if or v-else-if.`,
12787
12816
  [31 /* X_V_FOR_NO_EXPRESSION */]: `v-for is missing expression.`,
12788
12817
  [32 /* X_V_FOR_MALFORMED_EXPRESSION */]: `v-for has invalid expression.`,
12789
12818
  [33 /* X_V_FOR_TEMPLATE_KEY_PLACEMENT */]: `<template v-for> key should be placed on the <template> tag.`,
@@ -13061,7 +13090,7 @@ var Vue = (function (exports) {
13061
13090
  * inside square brackets), but it's ok since these are only used on template
13062
13091
  * expressions and false positives are invalid expressions in the first place.
13063
13092
  */
13064
- const isMemberExpression = (path) => {
13093
+ const isMemberExpressionBrowser = (path) => {
13065
13094
  // remove whitespaces around . or [ first
13066
13095
  path = path.trim().replace(whitespaceRE, s => s.trim());
13067
13096
  let state = 0 /* inMemberExp */;
@@ -13131,6 +13160,8 @@ var Vue = (function (exports) {
13131
13160
  }
13132
13161
  return !currentOpenBracketCount && !currentOpenParensCount;
13133
13162
  };
13163
+ const isMemberExpression = isMemberExpressionBrowser
13164
+ ;
13134
13165
  function getInnerRange(loc, offset, length) {
13135
13166
  const source = loc.source.substr(offset, length);
13136
13167
  const newLoc = {
@@ -13934,6 +13965,13 @@ var Vue = (function (exports) {
13934
13965
  emitError(context, 3 /* END_TAG_WITH_ATTRIBUTES */);
13935
13966
  }
13936
13967
  const attr = parseAttribute(context, attributeNames);
13968
+ // Trim whitespace between class
13969
+ // https://github.com/vuejs/vue-next/issues/4251
13970
+ if (attr.type === 6 /* ATTRIBUTE */ &&
13971
+ attr.value &&
13972
+ attr.name === 'class') {
13973
+ attr.value.content = attr.value.content.replace(/\s+/g, ' ').trim();
13974
+ }
13937
13975
  if (type === 0 /* Start */) {
13938
13976
  props.push(attr);
13939
13977
  }
@@ -13996,8 +14034,11 @@ var Vue = (function (exports) {
13996
14034
  isStatic = false;
13997
14035
  if (!content.endsWith(']')) {
13998
14036
  emitError(context, 27 /* X_MISSING_DYNAMIC_DIRECTIVE_ARGUMENT_END */);
14037
+ content = content.substr(1);
14038
+ }
14039
+ else {
14040
+ content = content.substr(1, content.length - 2);
13999
14041
  }
14000
- content = content.substr(1, content.length - 2);
14001
14042
  }
14002
14043
  else if (isSlot) {
14003
14044
  // #1241 special case for v-slot: vuetify relies extensively on slot
@@ -14267,7 +14308,7 @@ var Vue = (function (exports) {
14267
14308
  // This is only a concern for pre-stringification (via transformHoist by
14268
14309
  // @vue/compiler-dom), but doing it here allows us to perform only one full
14269
14310
  // walk of the AST and allow `stringifyStatic` to stop walking as soon as its
14270
- // stringficiation threshold is met.
14311
+ // stringification threshold is met.
14271
14312
  let canStringify = true;
14272
14313
  const { children } = node;
14273
14314
  const originalCount = children.length;
@@ -14513,7 +14554,7 @@ var Vue = (function (exports) {
14513
14554
  else if (value.type === 14 /* JS_CALL_EXPRESSION */) {
14514
14555
  // some helper calls can be hoisted,
14515
14556
  // such as the `normalizeProps` generated by the compiler for pre-normalize class,
14516
- // in this case we need to respect the ConstanType of the helper's argments
14557
+ // in this case we need to respect the ConstantType of the helper's argments
14517
14558
  valueType = getConstantTypeOfHelperCall(value, context);
14518
14559
  }
14519
14560
  else {
@@ -15026,13 +15067,14 @@ var Vue = (function (exports) {
15026
15067
  context.pure = true;
15027
15068
  const { push, newline, helper, scopeId, mode } = context;
15028
15069
  newline();
15029
- hoists.forEach((exp, i) => {
15070
+ for (let i = 0; i < hoists.length; i++) {
15071
+ const exp = hoists[i];
15030
15072
  if (exp) {
15031
- push(`const _hoisted_${i + 1} = `);
15073
+ push(`const _hoisted_${i + 1} = ${``}`);
15032
15074
  genNode(exp, context);
15033
15075
  newline();
15034
15076
  }
15035
- });
15077
+ }
15036
15078
  context.pure = false;
15037
15079
  }
15038
15080
  function isText$1(n) {
@@ -15539,6 +15581,11 @@ var Vue = (function (exports) {
15539
15581
  continue;
15540
15582
  }
15541
15583
  if (sibling && sibling.type === 9 /* IF */) {
15584
+ // Check if v-else was followed by v-else-if
15585
+ if (dir.name === 'else-if' &&
15586
+ sibling.branches[sibling.branches.length - 1].condition === undefined) {
15587
+ context.onError(createCompilerError(30 /* X_V_ELSE_NO_ADJACENT_IF */, node.loc));
15588
+ }
15542
15589
  // move the node to the if node's branches
15543
15590
  context.removeNode();
15544
15591
  const branch = createIfBranch(node, dir);
@@ -16630,7 +16677,7 @@ var Vue = (function (exports) {
16630
16677
  const name = prop.key.content;
16631
16678
  const existing = knownProps.get(name);
16632
16679
  if (existing) {
16633
- if (name === 'style' || name === 'class' || name.startsWith('on')) {
16680
+ if (name === 'style' || name === 'class' || isOn(name)) {
16634
16681
  mergeAsArray$1(existing, prop);
16635
16682
  }
16636
16683
  // unexpected duplicate, should have emitted error during parse
@@ -16705,26 +16752,24 @@ var Vue = (function (exports) {
16705
16752
  const { slotName, slotProps } = processSlotOutlet(node, context);
16706
16753
  const slotArgs = [
16707
16754
  context.prefixIdentifiers ? `_ctx.$slots` : `$slots`,
16708
- slotName
16755
+ slotName,
16756
+ '{}',
16757
+ 'undefined',
16758
+ 'true'
16709
16759
  ];
16760
+ let expectedLen = 2;
16710
16761
  if (slotProps) {
16711
- slotArgs.push(slotProps);
16762
+ slotArgs[2] = slotProps;
16763
+ expectedLen = 3;
16712
16764
  }
16713
16765
  if (children.length) {
16714
- if (!slotProps) {
16715
- slotArgs.push(`{}`);
16716
- }
16717
- slotArgs.push(createFunctionExpression([], children, false, false, loc));
16766
+ slotArgs[3] = createFunctionExpression([], children, false, false, loc);
16767
+ expectedLen = 4;
16718
16768
  }
16719
16769
  if (context.scopeId && !context.slotted) {
16720
- if (!slotProps) {
16721
- slotArgs.push(`{}`);
16722
- }
16723
- if (!children.length) {
16724
- slotArgs.push(`undefined`);
16725
- }
16726
- slotArgs.push(`true`);
16770
+ expectedLen = 5;
16727
16771
  }
16772
+ slotArgs.splice(expectedLen); // remove unused arguments
16728
16773
  node.codegenNode = createCallExpression(context.helper(RENDER_SLOT), slotArgs, loc);
16729
16774
  }
16730
16775
  };
@@ -16771,7 +16816,7 @@ var Vue = (function (exports) {
16771
16816
  };
16772
16817
  }
16773
16818
 
16774
- const fnExpRE = /^\s*([\w$_]+|\([^)]*?\))\s*=>|^\s*function(?:\s+[\w$]+)?\s*\(/;
16819
+ const fnExpRE = /^\s*([\w$_]+|(async\s*)?\([^)]*?\))\s*=>|^\s*(async\s+)?function(?:\s+[\w$]+)?\s*\(/;
16775
16820
  const transformOn = (dir, node, context, augmentor) => {
16776
16821
  const { loc, modifiers, arg } = dir;
16777
16822
  if (!dir.exp && !modifiers.length) {
@@ -17026,7 +17071,8 @@ var Vue = (function (exports) {
17026
17071
  // _unref(exp)
17027
17072
  context.bindingMetadata[rawExp];
17028
17073
  const maybeRef = !true /* SETUP_CONST */;
17029
- if (!expString.trim() || (!isMemberExpression(expString) && !maybeRef)) {
17074
+ if (!expString.trim() ||
17075
+ (!isMemberExpression(expString) && !maybeRef)) {
17030
17076
  context.onError(createCompilerError(42 /* X_V_MODEL_MALFORMED_EXPRESSION */, exp.loc));
17031
17077
  return createTransformProps();
17032
17078
  }
@@ -17732,7 +17778,8 @@ var Vue = (function (exports) {
17732
17778
  };
17733
17779
  function hasMultipleChildren(node) {
17734
17780
  // #1352 filter out potential comment nodes.
17735
- const children = (node.children = node.children.filter(c => c.type !== 3 /* COMMENT */));
17781
+ const children = (node.children = node.children.filter(c => c.type !== 3 /* COMMENT */ &&
17782
+ !(c.type === 2 /* TEXT */ && !c.content.trim())));
17736
17783
  const child = children[0];
17737
17784
  return (children.length !== 1 ||
17738
17785
  child.type === 11 /* FOR */ ||
@@ -17832,10 +17879,6 @@ var Vue = (function (exports) {
17832
17879
  const Vue = createCompatVue$1();
17833
17880
  Vue.compile = compileToFunction;
17834
17881
 
17835
- exports.default = Vue;
17836
-
17837
- Object.defineProperty(exports, '__esModule', { value: true });
17838
-
17839
- return exports;
17882
+ return Vue;
17840
17883
 
17841
- }({}));
17884
+ }());