@vue/runtime-dom 3.2.32 → 3.2.33

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.
@@ -536,10 +536,17 @@ var VueRuntimeDOM = (function (exports) {
536
536
  activeEffect = this.parent;
537
537
  shouldTrack = lastShouldTrack;
538
538
  this.parent = undefined;
539
+ if (this.deferStop) {
540
+ this.stop();
541
+ }
539
542
  }
540
543
  }
541
544
  stop() {
542
- if (this.active) {
545
+ // stopped while running itself - defer the cleanup
546
+ if (activeEffect === this) {
547
+ this.deferStop = true;
548
+ }
549
+ else if (this.active) {
543
550
  cleanupEffect(this);
544
551
  if (this.onStop) {
545
552
  this.onStop();
@@ -714,7 +721,9 @@ var VueRuntimeDOM = (function (exports) {
714
721
  }
715
722
 
716
723
  const isNonTrackableKeys = /*#__PURE__*/ makeMap(`__proto__,__v_isRef,__isVue`);
717
- const builtInSymbols = new Set(Object.getOwnPropertyNames(Symbol)
724
+ const builtInSymbols = new Set(
725
+ /*#__PURE__*/
726
+ Object.getOwnPropertyNames(Symbol)
718
727
  .map(key => Symbol[key])
719
728
  .filter(isSymbol));
720
729
  const get = /*#__PURE__*/ createGetter();
@@ -866,13 +875,13 @@ var VueRuntimeDOM = (function (exports) {
866
875
  get: readonlyGet,
867
876
  set(target, key) {
868
877
  {
869
- console.warn(`Set operation on key "${String(key)}" failed: target is readonly.`, target);
878
+ warn(`Set operation on key "${String(key)}" failed: target is readonly.`, target);
870
879
  }
871
880
  return true;
872
881
  },
873
882
  deleteProperty(target, key) {
874
883
  {
875
- console.warn(`Delete operation on key "${String(key)}" failed: target is readonly.`, target);
884
+ warn(`Delete operation on key "${String(key)}" failed: target is readonly.`, target);
876
885
  }
877
886
  return true;
878
887
  }
@@ -1700,7 +1709,7 @@ var VueRuntimeDOM = (function (exports) {
1700
1709
  const pendingPostFlushCbs = [];
1701
1710
  let activePostFlushCbs = null;
1702
1711
  let postFlushIndex = 0;
1703
- const resolvedPromise = Promise.resolve();
1712
+ const resolvedPromise = /*#__PURE__*/ Promise.resolve();
1704
1713
  let currentFlushPromise = null;
1705
1714
  let currentPreFlushParentJob = null;
1706
1715
  const RECURSION_LIMIT = 100;
@@ -2115,6 +2124,8 @@ var VueRuntimeDOM = (function (exports) {
2115
2124
  }
2116
2125
 
2117
2126
  function emit$1(instance, event, ...rawArgs) {
2127
+ if (instance.isUnmounted)
2128
+ return;
2118
2129
  const props = instance.vnode.props || EMPTY_OBJ;
2119
2130
  {
2120
2131
  const { emitsOptions, propsOptions: [propsOptions] } = instance;
@@ -3391,10 +3402,22 @@ var VueRuntimeDOM = (function (exports) {
3391
3402
  if (!children || !children.length) {
3392
3403
  return;
3393
3404
  }
3394
- // warn multiple elements
3405
+ let child = children[0];
3395
3406
  if (children.length > 1) {
3396
- warn$1('<transition> can only be used on a single element or component. Use ' +
3397
- '<transition-group> for lists.');
3407
+ let hasFound = false;
3408
+ // locate first non-comment child
3409
+ for (const c of children) {
3410
+ if (c.type !== Comment) {
3411
+ if (hasFound) {
3412
+ // warn more than one non-comment child
3413
+ warn$1('<transition> can only be used on a single element or component. ' +
3414
+ 'Use <transition-group> for lists.');
3415
+ break;
3416
+ }
3417
+ child = c;
3418
+ hasFound = true;
3419
+ }
3420
+ }
3398
3421
  }
3399
3422
  // there's no need to track reactivity for these props so use the raw
3400
3423
  // props for a bit better perf
@@ -3407,8 +3430,6 @@ var VueRuntimeDOM = (function (exports) {
3407
3430
  mode !== 'default') {
3408
3431
  warn$1(`invalid <transition> mode: ${mode}`);
3409
3432
  }
3410
- // at this point children has a guaranteed length of 1.
3411
- const child = children[0];
3412
3433
  if (state.isLeaving) {
3413
3434
  return emptyPlaceholder(child);
3414
3435
  }
@@ -6930,7 +6951,22 @@ var VueRuntimeDOM = (function (exports) {
6930
6951
  const remove = vnode => {
6931
6952
  const { type, el, anchor, transition } = vnode;
6932
6953
  if (type === Fragment) {
6933
- removeFragment(el, anchor);
6954
+ if (vnode.patchFlag > 0 &&
6955
+ vnode.patchFlag & 2048 /* DEV_ROOT_FRAGMENT */ &&
6956
+ transition &&
6957
+ !transition.persisted) {
6958
+ vnode.children.forEach(child => {
6959
+ if (child.type === Comment) {
6960
+ hostRemove(child.el);
6961
+ }
6962
+ else {
6963
+ remove(child);
6964
+ }
6965
+ });
6966
+ }
6967
+ else {
6968
+ removeFragment(el, anchor);
6969
+ }
6934
6970
  return;
6935
6971
  }
6936
6972
  if (type === Static) {
@@ -7949,7 +7985,10 @@ var VueRuntimeDOM = (function (exports) {
7949
7985
  // this is not a user-facing function, so the fallback is always generated by
7950
7986
  // the compiler and guaranteed to be a function returning an array
7951
7987
  fallback, noSlotted) {
7952
- if (currentRenderingInstance.isCE) {
7988
+ if (currentRenderingInstance.isCE ||
7989
+ (currentRenderingInstance.parent &&
7990
+ isAsyncWrapper(currentRenderingInstance.parent) &&
7991
+ currentRenderingInstance.parent.isCE)) {
7953
7992
  return createVNode('slot', name === 'default' ? null : { name }, fallback && fallback());
7954
7993
  }
7955
7994
  let slot = slots[name];
@@ -8022,7 +8061,10 @@ var VueRuntimeDOM = (function (exports) {
8022
8061
  return getExposeProxy(i) || i.proxy;
8023
8062
  return getPublicInstance(i.parent);
8024
8063
  };
8025
- const publicPropertiesMap = extend(Object.create(null), {
8064
+ const publicPropertiesMap =
8065
+ // Move PURE marker to new line to workaround compiler discarding it
8066
+ // due to type annotation
8067
+ /*#__PURE__*/ extend(Object.create(null), {
8026
8068
  $: i => i,
8027
8069
  $el: i => i.vnode.el,
8028
8070
  $data: i => i.data,
@@ -8192,7 +8234,7 @@ var VueRuntimeDOM = (function (exports) {
8192
8234
  defineProperty(target, key, descriptor) {
8193
8235
  if (descriptor.get != null) {
8194
8236
  // invalidate key cache of a getter based property #5417
8195
- target.$.accessCache[key] = 0;
8237
+ target._.accessCache[key] = 0;
8196
8238
  }
8197
8239
  else if (hasOwn(descriptor, 'value')) {
8198
8240
  this.set(target, key, descriptor.value, null);
@@ -8400,6 +8442,7 @@ var VueRuntimeDOM = (function (exports) {
8400
8442
  return setupResult;
8401
8443
  }
8402
8444
  function setupStatefulComponent(instance, isSSR) {
8445
+ var _a;
8403
8446
  const Component = instance.type;
8404
8447
  {
8405
8448
  if (Component.name) {
@@ -8457,6 +8500,13 @@ var VueRuntimeDOM = (function (exports) {
8457
8500
  // async setup returned Promise.
8458
8501
  // bail here and wait for re-entry.
8459
8502
  instance.asyncDep = setupResult;
8503
+ if (!instance.suspense) {
8504
+ const name = (_a = Component.name) !== null && _a !== void 0 ? _a : 'Anonymous';
8505
+ warn$1(`Component <${name}>: setup function returned a promise, but no ` +
8506
+ `<Suspense> boundary was found in the parent component tree. ` +
8507
+ `A component with async setup() must be nested in a <Suspense> ` +
8508
+ `in order to be rendered.`);
8509
+ }
8460
8510
  }
8461
8511
  }
8462
8512
  else {
@@ -9068,7 +9118,7 @@ var VueRuntimeDOM = (function (exports) {
9068
9118
  }
9069
9119
 
9070
9120
  // Core API ------------------------------------------------------------------
9071
- const version = "3.2.32";
9121
+ const version = "3.2.33";
9072
9122
  /**
9073
9123
  * SSR utils for \@vue/server-renderer. Only exposed in cjs builds.
9074
9124
  * @internal
@@ -9085,7 +9135,7 @@ var VueRuntimeDOM = (function (exports) {
9085
9135
 
9086
9136
  const svgNS = 'http://www.w3.org/2000/svg';
9087
9137
  const doc = (typeof document !== 'undefined' ? document : null);
9088
- const templateContainer = doc && doc.createElement('template');
9138
+ const templateContainer = doc && /*#__PURE__*/ doc.createElement('template');
9089
9139
  const nodeOps = {
9090
9140
  insert: (child, parent, anchor) => {
9091
9141
  parent.insertBefore(child, anchor || null);
@@ -9236,6 +9286,8 @@ var VueRuntimeDOM = (function (exports) {
9236
9286
  val.forEach(v => setStyle(style, name, v));
9237
9287
  }
9238
9288
  else {
9289
+ if (val == null)
9290
+ val = '';
9239
9291
  if (name.startsWith('--')) {
9240
9292
  // custom property definition
9241
9293
  style.setProperty(name, val);
@@ -9330,31 +9382,28 @@ var VueRuntimeDOM = (function (exports) {
9330
9382
  }
9331
9383
  return;
9332
9384
  }
9385
+ let needRemove = false;
9333
9386
  if (value === '' || value == null) {
9334
9387
  const type = typeof el[key];
9335
9388
  if (type === 'boolean') {
9336
9389
  // e.g. <select multiple> compiles to { multiple: '' }
9337
- el[key] = includeBooleanAttr(value);
9338
- return;
9390
+ value = includeBooleanAttr(value);
9339
9391
  }
9340
9392
  else if (value == null && type === 'string') {
9341
9393
  // e.g. <div :id="null">
9342
- el[key] = '';
9343
- el.removeAttribute(key);
9344
- return;
9394
+ value = '';
9395
+ needRemove = true;
9345
9396
  }
9346
9397
  else if (type === 'number') {
9347
9398
  // e.g. <img :width="null">
9348
9399
  // the value of some IDL attr must be greater than 0, e.g. input.size = 0 -> error
9349
- try {
9350
- el[key] = 0;
9351
- }
9352
- catch (_a) { }
9353
- el.removeAttribute(key);
9354
- return;
9400
+ value = 0;
9401
+ needRemove = true;
9355
9402
  }
9356
9403
  }
9357
- // some properties perform value validation and throw
9404
+ // some properties perform value validation and throw,
9405
+ // some properties has getter, no setter, will error in 'use strict'
9406
+ // eg. <select :type="null"></select> <select :willValidate="null"></select>
9358
9407
  try {
9359
9408
  el[key] = value;
9360
9409
  }
@@ -9364,31 +9413,35 @@ var VueRuntimeDOM = (function (exports) {
9364
9413
  `value ${value} is invalid.`, e);
9365
9414
  }
9366
9415
  }
9416
+ needRemove && el.removeAttribute(key);
9367
9417
  }
9368
9418
 
9369
9419
  // Async edge case fix requires storing an event listener's attach timestamp.
9370
- let _getNow = Date.now;
9371
- let skipTimestampCheck = false;
9372
- if (typeof window !== 'undefined') {
9373
- // Determine what event timestamp the browser is using. Annoyingly, the
9374
- // timestamp can either be hi-res (relative to page load) or low-res
9375
- // (relative to UNIX epoch), so in order to compare time we have to use the
9376
- // same timestamp type when saving the flush timestamp.
9377
- if (_getNow() > document.createEvent('Event').timeStamp) {
9378
- // if the low-res timestamp which is bigger than the event timestamp
9379
- // (which is evaluated AFTER) it means the event is using a hi-res timestamp,
9380
- // and we need to use the hi-res version for event listeners as well.
9381
- _getNow = () => performance.now();
9382
- }
9383
- // #3485: Firefox <= 53 has incorrect Event.timeStamp implementation
9384
- // and does not fire microtasks in between event propagation, so safe to exclude.
9385
- const ffMatch = navigator.userAgent.match(/firefox\/(\d+)/i);
9386
- skipTimestampCheck = !!(ffMatch && Number(ffMatch[1]) <= 53);
9387
- }
9420
+ const [_getNow, skipTimestampCheck] = /*#__PURE__*/ (() => {
9421
+ let _getNow = Date.now;
9422
+ let skipTimestampCheck = false;
9423
+ if (typeof window !== 'undefined') {
9424
+ // Determine what event timestamp the browser is using. Annoyingly, the
9425
+ // timestamp can either be hi-res (relative to page load) or low-res
9426
+ // (relative to UNIX epoch), so in order to compare time we have to use the
9427
+ // same timestamp type when saving the flush timestamp.
9428
+ if (Date.now() > document.createEvent('Event').timeStamp) {
9429
+ // if the low-res timestamp which is bigger than the event timestamp
9430
+ // (which is evaluated AFTER) it means the event is using a hi-res timestamp,
9431
+ // and we need to use the hi-res version for event listeners as well.
9432
+ _getNow = () => performance.now();
9433
+ }
9434
+ // #3485: Firefox <= 53 has incorrect Event.timeStamp implementation
9435
+ // and does not fire microtasks in between event propagation, so safe to exclude.
9436
+ const ffMatch = navigator.userAgent.match(/firefox\/(\d+)/i);
9437
+ skipTimestampCheck = !!(ffMatch && Number(ffMatch[1]) <= 53);
9438
+ }
9439
+ return [_getNow, skipTimestampCheck];
9440
+ })();
9388
9441
  // To avoid the overhead of repeatedly calling performance.now(), we cache
9389
9442
  // and use the same timestamp for all event listeners attached in the same tick.
9390
9443
  let cachedNow = 0;
9391
- const p = Promise.resolve();
9444
+ const p = /*#__PURE__*/ Promise.resolve();
9392
9445
  const reset = () => {
9393
9446
  cachedNow = 0;
9394
9447
  };
@@ -9513,13 +9566,13 @@ var VueRuntimeDOM = (function (exports) {
9513
9566
  }
9514
9567
  return false;
9515
9568
  }
9516
- // spellcheck and draggable are numerated attrs, however their
9517
- // corresponding DOM properties are actually booleans - this leads to
9518
- // setting it with a string "false" value leading it to be coerced to
9519
- // `true`, so we need to always treat them as attributes.
9569
+ // these are enumerated attrs, however their corresponding DOM properties
9570
+ // are actually booleans - this leads to setting it with a string "false"
9571
+ // value leading it to be coerced to `true`, so we need to always treat
9572
+ // them as attributes.
9520
9573
  // Note that `contentEditable` doesn't have this problem: its DOM
9521
9574
  // property is also enumerated string values.
9522
- if (key === 'spellcheck' || key === 'draggable') {
9575
+ if (key === 'spellcheck' || key === 'draggable' || key === 'translate') {
9523
9576
  return false;
9524
9577
  }
9525
9578
  // #1787, #2840 form property on form elements is readonly and must be set as
@@ -10574,7 +10627,7 @@ var VueRuntimeDOM = (function (exports) {
10574
10627
  el.style.display = value ? el._vod : 'none';
10575
10628
  }
10576
10629
 
10577
- const rendererOptions = extend({ patchProp }, nodeOps);
10630
+ const rendererOptions = /*#__PURE__*/ extend({ patchProp }, nodeOps);
10578
10631
  // lazy create the renderer - this makes core renderer logic tree-shakable
10579
10632
  // in case the user only imports reactivity utilities from Vue.
10580
10633
  let renderer;