@vue/runtime-dom 3.1.0 → 3.1.4

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.
@@ -500,34 +500,38 @@ var VueRuntimeDOM = (function (exports) {
500
500
  const shallowGet = /*#__PURE__*/ createGetter(false, true);
501
501
  const readonlyGet = /*#__PURE__*/ createGetter(true);
502
502
  const shallowReadonlyGet = /*#__PURE__*/ createGetter(true, true);
503
- const arrayInstrumentations = {};
504
- ['includes', 'indexOf', 'lastIndexOf'].forEach(key => {
505
- const method = Array.prototype[key];
506
- arrayInstrumentations[key] = function (...args) {
507
- const arr = toRaw(this);
508
- for (let i = 0, l = this.length; i < l; i++) {
509
- track(arr, "get" /* GET */, i + '');
510
- }
511
- // we run the method using the original args first (which may be reactive)
512
- const res = method.apply(arr, args);
513
- if (res === -1 || res === false) {
514
- // if that didn't work, run it again using raw values.
515
- return method.apply(arr, args.map(toRaw));
516
- }
517
- else {
503
+ const arrayInstrumentations = /*#__PURE__*/ createArrayInstrumentations();
504
+ function createArrayInstrumentations() {
505
+ const instrumentations = {};
506
+ ['includes', 'indexOf', 'lastIndexOf'].forEach(key => {
507
+ const method = Array.prototype[key];
508
+ instrumentations[key] = function (...args) {
509
+ const arr = toRaw(this);
510
+ for (let i = 0, l = this.length; i < l; i++) {
511
+ track(arr, "get" /* GET */, i + '');
512
+ }
513
+ // we run the method using the original args first (which may be reactive)
514
+ const res = method.apply(arr, args);
515
+ if (res === -1 || res === false) {
516
+ // if that didn't work, run it again using raw values.
517
+ return method.apply(arr, args.map(toRaw));
518
+ }
519
+ else {
520
+ return res;
521
+ }
522
+ };
523
+ });
524
+ ['push', 'pop', 'shift', 'unshift', 'splice'].forEach(key => {
525
+ const method = Array.prototype[key];
526
+ instrumentations[key] = function (...args) {
527
+ pauseTracking();
528
+ const res = method.apply(this, args);
529
+ resetTracking();
518
530
  return res;
519
- }
520
- };
521
- });
522
- ['push', 'pop', 'shift', 'unshift', 'splice'].forEach(key => {
523
- const method = Array.prototype[key];
524
- arrayInstrumentations[key] = function (...args) {
525
- pauseTracking();
526
- const res = method.apply(this, args);
527
- resetTracking();
528
- return res;
529
- };
530
- });
531
+ };
532
+ });
533
+ return instrumentations;
534
+ }
531
535
  function createGetter(isReadonly = false, shallow = false) {
532
536
  return function get(target, key, receiver) {
533
537
  if (key === "__v_isReactive" /* IS_REACTIVE */) {
@@ -646,14 +650,14 @@ var VueRuntimeDOM = (function (exports) {
646
650
  return true;
647
651
  }
648
652
  };
649
- const shallowReactiveHandlers = extend({}, mutableHandlers, {
653
+ const shallowReactiveHandlers = /*#__PURE__*/ extend({}, mutableHandlers, {
650
654
  get: shallowGet,
651
655
  set: shallowSet
652
656
  });
653
657
  // Props handlers are special in the sense that it should not unwrap top-level
654
658
  // refs (in order to allow refs to be explicitly passed down), but should
655
659
  // retain the reactivity of the normal readonly object.
656
- const shallowReadonlyHandlers = extend({}, readonlyHandlers, {
660
+ const shallowReadonlyHandlers = /*#__PURE__*/ extend({}, readonlyHandlers, {
657
661
  get: shallowReadonlyGet
658
662
  });
659
663
 
@@ -823,73 +827,82 @@ var VueRuntimeDOM = (function (exports) {
823
827
  return type === "delete" /* DELETE */ ? false : this;
824
828
  };
825
829
  }
826
- const mutableInstrumentations = {
827
- get(key) {
828
- return get$1(this, key);
829
- },
830
- get size() {
831
- return size(this);
832
- },
833
- has: has$1,
834
- add,
835
- set: set$1,
836
- delete: deleteEntry,
837
- clear,
838
- forEach: createForEach(false, false)
839
- };
840
- const shallowInstrumentations = {
841
- get(key) {
842
- return get$1(this, key, false, true);
843
- },
844
- get size() {
845
- return size(this);
846
- },
847
- has: has$1,
848
- add,
849
- set: set$1,
850
- delete: deleteEntry,
851
- clear,
852
- forEach: createForEach(false, true)
853
- };
854
- const readonlyInstrumentations = {
855
- get(key) {
856
- return get$1(this, key, true);
857
- },
858
- get size() {
859
- return size(this, true);
860
- },
861
- has(key) {
862
- return has$1.call(this, key, true);
863
- },
864
- add: createReadonlyMethod("add" /* ADD */),
865
- set: createReadonlyMethod("set" /* SET */),
866
- delete: createReadonlyMethod("delete" /* DELETE */),
867
- clear: createReadonlyMethod("clear" /* CLEAR */),
868
- forEach: createForEach(true, false)
869
- };
870
- const shallowReadonlyInstrumentations = {
871
- get(key) {
872
- return get$1(this, key, true, true);
873
- },
874
- get size() {
875
- return size(this, true);
876
- },
877
- has(key) {
878
- return has$1.call(this, key, true);
879
- },
880
- add: createReadonlyMethod("add" /* ADD */),
881
- set: createReadonlyMethod("set" /* SET */),
882
- delete: createReadonlyMethod("delete" /* DELETE */),
883
- clear: createReadonlyMethod("clear" /* CLEAR */),
884
- forEach: createForEach(true, true)
885
- };
886
- const iteratorMethods = ['keys', 'values', 'entries', Symbol.iterator];
887
- iteratorMethods.forEach(method => {
888
- mutableInstrumentations[method] = createIterableMethod(method, false, false);
889
- readonlyInstrumentations[method] = createIterableMethod(method, true, false);
890
- shallowInstrumentations[method] = createIterableMethod(method, false, true);
891
- shallowReadonlyInstrumentations[method] = createIterableMethod(method, true, true);
892
- });
830
+ function createInstrumentations() {
831
+ const mutableInstrumentations = {
832
+ get(key) {
833
+ return get$1(this, key);
834
+ },
835
+ get size() {
836
+ return size(this);
837
+ },
838
+ has: has$1,
839
+ add,
840
+ set: set$1,
841
+ delete: deleteEntry,
842
+ clear,
843
+ forEach: createForEach(false, false)
844
+ };
845
+ const shallowInstrumentations = {
846
+ get(key) {
847
+ return get$1(this, key, false, true);
848
+ },
849
+ get size() {
850
+ return size(this);
851
+ },
852
+ has: has$1,
853
+ add,
854
+ set: set$1,
855
+ delete: deleteEntry,
856
+ clear,
857
+ forEach: createForEach(false, true)
858
+ };
859
+ const readonlyInstrumentations = {
860
+ get(key) {
861
+ return get$1(this, key, true);
862
+ },
863
+ get size() {
864
+ return size(this, true);
865
+ },
866
+ has(key) {
867
+ return has$1.call(this, key, true);
868
+ },
869
+ add: createReadonlyMethod("add" /* ADD */),
870
+ set: createReadonlyMethod("set" /* SET */),
871
+ delete: createReadonlyMethod("delete" /* DELETE */),
872
+ clear: createReadonlyMethod("clear" /* CLEAR */),
873
+ forEach: createForEach(true, false)
874
+ };
875
+ const shallowReadonlyInstrumentations = {
876
+ get(key) {
877
+ return get$1(this, key, true, true);
878
+ },
879
+ get size() {
880
+ return size(this, true);
881
+ },
882
+ has(key) {
883
+ return has$1.call(this, key, true);
884
+ },
885
+ add: createReadonlyMethod("add" /* ADD */),
886
+ set: createReadonlyMethod("set" /* SET */),
887
+ delete: createReadonlyMethod("delete" /* DELETE */),
888
+ clear: createReadonlyMethod("clear" /* CLEAR */),
889
+ forEach: createForEach(true, true)
890
+ };
891
+ const iteratorMethods = ['keys', 'values', 'entries', Symbol.iterator];
892
+ iteratorMethods.forEach(method => {
893
+ mutableInstrumentations[method] = createIterableMethod(method, false, false);
894
+ readonlyInstrumentations[method] = createIterableMethod(method, true, false);
895
+ shallowInstrumentations[method] = createIterableMethod(method, false, true);
896
+ shallowReadonlyInstrumentations[method] = createIterableMethod(method, true, true);
897
+ });
898
+ return [
899
+ mutableInstrumentations,
900
+ readonlyInstrumentations,
901
+ shallowInstrumentations,
902
+ shallowReadonlyInstrumentations
903
+ ];
904
+ }
905
+ const [mutableInstrumentations, readonlyInstrumentations, shallowInstrumentations, shallowReadonlyInstrumentations] = /* #__PURE__*/ createInstrumentations();
893
906
  function createInstrumentationGetter(isReadonly, shallow) {
894
907
  const instrumentations = shallow
895
908
  ? isReadonly
@@ -914,16 +927,16 @@ var VueRuntimeDOM = (function (exports) {
914
927
  };
915
928
  }
916
929
  const mutableCollectionHandlers = {
917
- get: createInstrumentationGetter(false, false)
930
+ get: /*#__PURE__*/ createInstrumentationGetter(false, false)
918
931
  };
919
932
  const shallowCollectionHandlers = {
920
- get: createInstrumentationGetter(false, true)
933
+ get: /*#__PURE__*/ createInstrumentationGetter(false, true)
921
934
  };
922
935
  const readonlyCollectionHandlers = {
923
- get: createInstrumentationGetter(true, false)
936
+ get: /*#__PURE__*/ createInstrumentationGetter(true, false)
924
937
  };
925
938
  const shallowReadonlyCollectionHandlers = {
926
- get: createInstrumentationGetter(true, true)
939
+ get: /*#__PURE__*/ createInstrumentationGetter(true, true)
927
940
  };
928
941
  function checkIdentityKeys(target, has, key) {
929
942
  const rawKey = toRaw(key);
@@ -1049,7 +1062,7 @@ var VueRuntimeDOM = (function (exports) {
1049
1062
  return createRef(value, true);
1050
1063
  }
1051
1064
  class RefImpl {
1052
- constructor(_rawValue, _shallow = false) {
1065
+ constructor(_rawValue, _shallow) {
1053
1066
  this._rawValue = _rawValue;
1054
1067
  this._shallow = _shallow;
1055
1068
  this.__v_isRef = true;
@@ -1305,6 +1318,7 @@ var VueRuntimeDOM = (function (exports) {
1305
1318
  }
1306
1319
 
1307
1320
  const ErrorTypeStrings = {
1321
+ ["sp" /* SERVER_PREFETCH */]: 'serverPrefetch hook',
1308
1322
  ["bc" /* BEFORE_CREATE */]: 'beforeCreate hook',
1309
1323
  ["c" /* CREATED */]: 'created hook',
1310
1324
  ["bm" /* BEFORE_MOUNT */]: 'beforeMount hook',
@@ -2170,11 +2184,12 @@ var VueRuntimeDOM = (function (exports) {
2170
2184
  const onceHandler = props[handlerName + `Once`];
2171
2185
  if (onceHandler) {
2172
2186
  if (!instance.emitted) {
2173
- (instance.emitted = {})[handlerName] = true;
2187
+ instance.emitted = {};
2174
2188
  }
2175
2189
  else if (instance.emitted[handlerName]) {
2176
2190
  return;
2177
2191
  }
2192
+ instance.emitted[handlerName] = true;
2178
2193
  callWithAsyncErrorHandling(onceHandler, instance, 6 /* COMPONENT_EVENT_HANDLER */, args);
2179
2194
  }
2180
2195
  }
@@ -2645,6 +2660,12 @@ var VueRuntimeDOM = (function (exports) {
2645
2660
  // Force-casted public typing for h and TSX props inference
2646
2661
  const Suspense = (SuspenseImpl
2647
2662
  );
2663
+ function triggerEvent(vnode, name) {
2664
+ const eventListener = vnode.props && vnode.props[name];
2665
+ if (isFunction(eventListener)) {
2666
+ eventListener();
2667
+ }
2668
+ }
2648
2669
  function mountSuspense(vnode, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized, rendererInternals) {
2649
2670
  const { p: patch, o: { createElement } } = rendererInternals;
2650
2671
  const hiddenContainer = createElement('div');
@@ -2654,6 +2675,9 @@ var VueRuntimeDOM = (function (exports) {
2654
2675
  // now check if we have encountered any async deps
2655
2676
  if (suspense.deps > 0) {
2656
2677
  // has async
2678
+ // invoke @fallback event
2679
+ triggerEvent(vnode, 'onPending');
2680
+ triggerEvent(vnode, 'onFallback');
2657
2681
  // mount the fallback tree
2658
2682
  patch(null, vnode.ssFallback, container, anchor, parentComponent, null, // fallback tree will not have suspense context
2659
2683
  isSVG, slotScopeIds);
@@ -2741,10 +2765,7 @@ var VueRuntimeDOM = (function (exports) {
2741
2765
  else {
2742
2766
  // root node toggled
2743
2767
  // invoke @pending event
2744
- const onPending = n2.props && n2.props.onPending;
2745
- if (isFunction(onPending)) {
2746
- onPending();
2747
- }
2768
+ triggerEvent(n2, 'onPending');
2748
2769
  // mount pending branch in off-dom container
2749
2770
  suspense.pendingBranch = newBranch;
2750
2771
  suspense.pendingId++;
@@ -2857,10 +2878,7 @@ var VueRuntimeDOM = (function (exports) {
2857
2878
  }
2858
2879
  suspense.effects = [];
2859
2880
  // invoke @resolve event
2860
- const onResolve = vnode.props && vnode.props.onResolve;
2861
- if (isFunction(onResolve)) {
2862
- onResolve();
2863
- }
2881
+ triggerEvent(vnode, 'onResolve');
2864
2882
  },
2865
2883
  fallback(fallbackVNode) {
2866
2884
  if (!suspense.pendingBranch) {
@@ -2868,10 +2886,7 @@ var VueRuntimeDOM = (function (exports) {
2868
2886
  }
2869
2887
  const { vnode, activeBranch, parentComponent, container, isSVG } = suspense;
2870
2888
  // invoke @fallback event
2871
- const onFallback = vnode.props && vnode.props.onFallback;
2872
- if (isFunction(onFallback)) {
2873
- onFallback();
2874
- }
2889
+ triggerEvent(vnode, 'onFallback');
2875
2890
  const anchor = next(activeBranch);
2876
2891
  const mountFallback = () => {
2877
2892
  if (!suspense.isInFallback) {
@@ -2886,11 +2901,11 @@ var VueRuntimeDOM = (function (exports) {
2886
2901
  if (delayEnter) {
2887
2902
  activeBranch.transition.afterLeave = mountFallback;
2888
2903
  }
2904
+ suspense.isInFallback = true;
2889
2905
  // unmount current active branch
2890
2906
  unmount(activeBranch, parentComponent, null, // no suspense so unmount hooks fire now
2891
2907
  true // shouldRemove
2892
2908
  );
2893
- suspense.isInFallback = true;
2894
2909
  if (!delayEnter) {
2895
2910
  mountFallback();
2896
2911
  }
@@ -3085,7 +3100,7 @@ var VueRuntimeDOM = (function (exports) {
3085
3100
  }
3086
3101
  else if (arguments.length > 1) {
3087
3102
  return treatDefaultAsFactory && isFunction(defaultValue)
3088
- ? defaultValue()
3103
+ ? defaultValue.call(instance.proxy)
3089
3104
  : defaultValue;
3090
3105
  }
3091
3106
  else {
@@ -4301,13 +4316,16 @@ var VueRuntimeDOM = (function (exports) {
4301
4316
  registerLifecycleHook(onServerPrefetch, serverPrefetch);
4302
4317
  if (isArray(expose)) {
4303
4318
  if (expose.length) {
4304
- const exposed = instance.exposed || (instance.exposed = proxyRefs({}));
4319
+ const exposed = instance.exposed || (instance.exposed = {});
4305
4320
  expose.forEach(key => {
4306
- exposed[key] = toRef(publicThis, key);
4321
+ Object.defineProperty(exposed, key, {
4322
+ get: () => publicThis[key],
4323
+ set: val => (publicThis[key] = val)
4324
+ });
4307
4325
  });
4308
4326
  }
4309
4327
  else if (!instance.exposed) {
4310
- instance.exposed = EMPTY_OBJ;
4328
+ instance.exposed = {};
4311
4329
  }
4312
4330
  }
4313
4331
  // options that are handled when creating the instance but also need to be
@@ -4444,25 +4462,23 @@ var VueRuntimeDOM = (function (exports) {
4444
4462
  methods: mergeObjectOptions,
4445
4463
  computed: mergeObjectOptions,
4446
4464
  // lifecycle
4447
- beforeCreate: mergeHook,
4448
- created: mergeHook,
4449
- beforeMount: mergeHook,
4450
- mounted: mergeHook,
4451
- beforeUpdate: mergeHook,
4452
- updated: mergeHook,
4453
- beforeDestroy: mergeHook,
4454
- destroyed: mergeHook,
4455
- activated: mergeHook,
4456
- deactivated: mergeHook,
4457
- errorCaptured: mergeHook,
4458
- serverPrefetch: mergeHook,
4465
+ beforeCreate: mergeAsArray,
4466
+ created: mergeAsArray,
4467
+ beforeMount: mergeAsArray,
4468
+ mounted: mergeAsArray,
4469
+ beforeUpdate: mergeAsArray,
4470
+ updated: mergeAsArray,
4471
+ beforeDestroy: mergeAsArray,
4472
+ destroyed: mergeAsArray,
4473
+ activated: mergeAsArray,
4474
+ deactivated: mergeAsArray,
4475
+ errorCaptured: mergeAsArray,
4476
+ serverPrefetch: mergeAsArray,
4459
4477
  // assets
4460
4478
  components: mergeObjectOptions,
4461
4479
  directives: mergeObjectOptions,
4462
- // watch has special merge behavior in v2, but isn't actually needed in v3.
4463
- // since we are only exposing these for compat and nobody should be relying
4464
- // on the watch-specific behavior, just expose the object merge strat.
4465
- watch: mergeObjectOptions,
4480
+ // watch
4481
+ watch: mergeWatchOptions,
4466
4482
  // provide / inject
4467
4483
  provide: mergeDataFn,
4468
4484
  inject: mergeInject
@@ -4491,11 +4507,22 @@ var VueRuntimeDOM = (function (exports) {
4491
4507
  }
4492
4508
  return raw;
4493
4509
  }
4494
- function mergeHook(to, from) {
4510
+ function mergeAsArray(to, from) {
4495
4511
  return to ? [...new Set([].concat(to, from))] : from;
4496
4512
  }
4497
4513
  function mergeObjectOptions(to, from) {
4498
4514
  return to ? extend(extend(Object.create(null), to), from) : from;
4515
+ }
4516
+ function mergeWatchOptions(to, from) {
4517
+ if (!to)
4518
+ return from;
4519
+ if (!from)
4520
+ return to;
4521
+ const merged = extend(Object.create(null), to);
4522
+ for (const key in from) {
4523
+ merged[key] = mergeAsArray(to[key], from[key]);
4524
+ }
4525
+ return merged;
4499
4526
  }
4500
4527
 
4501
4528
  function initProps(instance, rawProps, isStateful, // result of bitwise flag comparison
@@ -5152,6 +5179,7 @@ var VueRuntimeDOM = (function (exports) {
5152
5179
  _props: rootProps,
5153
5180
  _container: null,
5154
5181
  _context: context,
5182
+ _instance: null,
5155
5183
  version,
5156
5184
  get config() {
5157
5185
  return context.config;
@@ -5239,6 +5267,7 @@ var VueRuntimeDOM = (function (exports) {
5239
5267
  app._container = rootContainer;
5240
5268
  rootContainer.__vue_app__ = app;
5241
5269
  {
5270
+ app._instance = vnode.component;
5242
5271
  devtoolsInitApp(app, version);
5243
5272
  }
5244
5273
  return vnode.component.proxy;
@@ -5254,6 +5283,7 @@ var VueRuntimeDOM = (function (exports) {
5254
5283
  if (isMounted) {
5255
5284
  render(null, app._container);
5256
5285
  {
5286
+ app._instance = null;
5257
5287
  devtoolsUnmountApp(app);
5258
5288
  }
5259
5289
  delete app._container.__vue_app__;
@@ -5290,8 +5320,9 @@ var VueRuntimeDOM = (function (exports) {
5290
5320
  const hydrate = (vnode, container) => {
5291
5321
  if (!container.hasChildNodes()) {
5292
5322
  warn(`Attempting to hydrate existing markup but container is empty. ` +
5293
- `Performing full mount instead.`);
5323
+ `Performing full mount instead.`);
5294
5324
  patch(null, vnode, container);
5325
+ flushPostFlushCbs();
5295
5326
  return;
5296
5327
  }
5297
5328
  hasMismatch = false;
@@ -5428,19 +5459,24 @@ var VueRuntimeDOM = (function (exports) {
5428
5459
  };
5429
5460
  const hydrateElement = (el, vnode, parentComponent, parentSuspense, slotScopeIds, optimized) => {
5430
5461
  optimized = optimized || !!vnode.dynamicChildren;
5431
- const { props, patchFlag, shapeFlag, dirs } = vnode;
5462
+ const { type, props, patchFlag, shapeFlag, dirs } = vnode;
5463
+ // #4006 for form elements with non-string v-model value bindings
5464
+ // e.g. <option :value="obj">, <input type="checkbox" :true-value="1">
5465
+ const forcePatchValue = (type === 'input' && dirs) || type === 'option';
5432
5466
  // skip props & children if this is hoisted static nodes
5433
- if (patchFlag !== -1 /* HOISTED */) {
5467
+ if (forcePatchValue || patchFlag !== -1 /* HOISTED */) {
5434
5468
  if (dirs) {
5435
5469
  invokeDirectiveHook(vnode, null, parentComponent, 'created');
5436
5470
  }
5437
5471
  // props
5438
5472
  if (props) {
5439
- if (!optimized ||
5473
+ if (forcePatchValue ||
5474
+ !optimized ||
5440
5475
  (patchFlag & 16 /* FULL_PROPS */ ||
5441
5476
  patchFlag & 32 /* HYDRATE_EVENTS */)) {
5442
5477
  for (const key in props) {
5443
- if (!isReservedProp(key) && isOn(key)) {
5478
+ if ((forcePatchValue && key.endsWith('value')) ||
5479
+ (isOn(key) && !isReservedProp(key))) {
5444
5480
  patchProp(el, key, null, props[key]);
5445
5481
  }
5446
5482
  }
@@ -5654,7 +5690,7 @@ var VueRuntimeDOM = (function (exports) {
5654
5690
  return;
5655
5691
  }
5656
5692
  const refValue = vnode.shapeFlag & 4 /* STATEFUL_COMPONENT */
5657
- ? vnode.component.exposed || vnode.component.proxy
5693
+ ? getExposeProxy(vnode.component) || vnode.component.proxy
5658
5694
  : vnode.el;
5659
5695
  const value = isUnmount ? null : refValue;
5660
5696
  const { i: owner, r: ref } = rawRef;
@@ -5824,7 +5860,19 @@ var VueRuntimeDOM = (function (exports) {
5824
5860
  }
5825
5861
  };
5826
5862
  const mountStaticNode = (n2, container, anchor, isSVG) => {
5827
- [n2.el, n2.anchor] = hostInsertStaticContent(n2.children, container, anchor, isSVG);
5863
+ // static nodes are only present when used with compiler-dom/runtime-dom
5864
+ // which guarantees presence of hostInsertStaticContent.
5865
+ const nodes = hostInsertStaticContent(n2.children, container, anchor, isSVG,
5866
+ // pass cached nodes if the static node is being mounted multiple times
5867
+ // so that runtime-dom can simply cloneNode() instead of inserting new
5868
+ // HTML
5869
+ n2.staticCache);
5870
+ // first mount - this is the orignal hoisted vnode. cache nodes.
5871
+ if (!n2.el) {
5872
+ n2.staticCache = nodes;
5873
+ }
5874
+ n2.el = nodes[0];
5875
+ n2.anchor = nodes[nodes.length - 1];
5828
5876
  };
5829
5877
  /**
5830
5878
  * Dev / HMR only
@@ -7456,7 +7504,6 @@ var VueRuntimeDOM = (function (exports) {
7456
7504
  anchor: null,
7457
7505
  target: null,
7458
7506
  targetAnchor: null,
7459
- staticCount: 0,
7460
7507
  shapeFlag,
7461
7508
  patchFlag,
7462
7509
  dynamicProps,
@@ -7518,6 +7565,7 @@ var VueRuntimeDOM = (function (exports) {
7518
7565
  target: vnode.target,
7519
7566
  targetAnchor: vnode.targetAnchor,
7520
7567
  staticCount: vnode.staticCount,
7568
+ staticCache: vnode.staticCache,
7521
7569
  shapeFlag: vnode.shapeFlag,
7522
7570
  // if the vnode is cloned with extra props, we can no longer assume its
7523
7571
  // existing patch flag to be reliable and need to add the FULL_PROPS flag.
@@ -7833,7 +7881,7 @@ var VueRuntimeDOM = (function (exports) {
7833
7881
  if (!i)
7834
7882
  return null;
7835
7883
  if (isStatefulComponent(i))
7836
- return i.exposed ? i.exposed : i.proxy;
7884
+ return getExposeProxy(i) || i.proxy;
7837
7885
  return getPublicInstance(i.parent);
7838
7886
  };
7839
7887
  const publicPropertiesMap = extend(Object.create(null), {
@@ -7855,14 +7903,19 @@ var VueRuntimeDOM = (function (exports) {
7855
7903
  const PublicInstanceProxyHandlers = {
7856
7904
  get({ _: instance }, key) {
7857
7905
  const { ctx, setupState, data, props, accessCache, type, appContext } = instance;
7858
- // let @vue/reactivity know it should never observe Vue public instances.
7859
- if (key === "__v_skip" /* SKIP */) {
7860
- return true;
7861
- }
7862
7906
  // for internal formatters to know that this is a Vue instance
7863
7907
  if (key === '__isVue') {
7864
7908
  return true;
7865
7909
  }
7910
+ // prioritize <script setup> bindings during dev.
7911
+ // this allows even properties that start with _ or $ to be used - so that
7912
+ // it aligns with the production behavior where the render fn is inlined and
7913
+ // indeed has access to all declared variables.
7914
+ if (setupState !== EMPTY_OBJ &&
7915
+ setupState.__isScriptSetup &&
7916
+ hasOwn(setupState, key)) {
7917
+ return setupState[key];
7918
+ }
7866
7919
  // data / props / ctx
7867
7920
  // This getter gets called for every property access on the render context
7868
7921
  // during render and is a major hotspot. The most expensive part of this
@@ -8062,7 +8115,7 @@ var VueRuntimeDOM = (function (exports) {
8062
8115
  function exposeSetupStateOnRenderContext(instance) {
8063
8116
  const { ctx, setupState } = instance;
8064
8117
  Object.keys(toRaw(setupState)).forEach(key => {
8065
- if (key[0] === '$' || key[0] === '_') {
8118
+ if (!setupState.__isScriptSetup && (key[0] === '$' || key[0] === '_')) {
8066
8119
  warn(`setup() return property ${JSON.stringify(key)} should not start with "$" or "_" ` +
8067
8120
  `which are reserved prefixes for Vue internals.`);
8068
8121
  return;
@@ -8095,6 +8148,7 @@ var VueRuntimeDOM = (function (exports) {
8095
8148
  render: null,
8096
8149
  proxy: null,
8097
8150
  exposed: null,
8151
+ exposeProxy: null,
8098
8152
  withProxy: null,
8099
8153
  effects: null,
8100
8154
  provides: parent ? parent.provides : Object.create(appContext.provides),
@@ -8210,7 +8264,7 @@ var VueRuntimeDOM = (function (exports) {
8210
8264
  instance.accessCache = Object.create(null);
8211
8265
  // 1. create public instance / render proxy
8212
8266
  // also mark it raw so it's never observed
8213
- instance.proxy = new Proxy(instance.ctx, PublicInstanceProxyHandlers);
8267
+ instance.proxy = markRaw(new Proxy(instance.ctx, PublicInstanceProxyHandlers));
8214
8268
  {
8215
8269
  exposePropsOnRenderContext(instance);
8216
8270
  }
@@ -8225,6 +8279,10 @@ var VueRuntimeDOM = (function (exports) {
8225
8279
  resetTracking();
8226
8280
  currentInstance = null;
8227
8281
  if (isPromise(setupResult)) {
8282
+ const unsetInstance = () => {
8283
+ currentInstance = null;
8284
+ };
8285
+ setupResult.then(unsetInstance, unsetInstance);
8228
8286
  if (isSSR) {
8229
8287
  // return the promise so server-renderer can wait on it
8230
8288
  return setupResult
@@ -8340,11 +8398,9 @@ var VueRuntimeDOM = (function (exports) {
8340
8398
  }
8341
8399
  }
8342
8400
  }
8343
- const attrHandlers = {
8401
+ const attrDevProxyHandlers = {
8344
8402
  get: (target, key) => {
8345
- {
8346
- markAttrsAccessed();
8347
- }
8403
+ markAttrsAccessed();
8348
8404
  return target[key];
8349
8405
  },
8350
8406
  set: () => {
@@ -8361,14 +8417,15 @@ var VueRuntimeDOM = (function (exports) {
8361
8417
  if (instance.exposed) {
8362
8418
  warn(`expose() should be called only once per setup().`);
8363
8419
  }
8364
- instance.exposed = proxyRefs(exposed);
8420
+ instance.exposed = exposed || {};
8365
8421
  };
8366
8422
  {
8423
+ let attrs;
8367
8424
  // We use getters in dev in case libs like test-utils overwrite instance
8368
8425
  // properties (overwrites should not be done in prod)
8369
8426
  return Object.freeze({
8370
8427
  get attrs() {
8371
- return new Proxy(instance.attrs, attrHandlers);
8428
+ return (attrs || (attrs = new Proxy(instance.attrs, attrDevProxyHandlers)));
8372
8429
  },
8373
8430
  get slots() {
8374
8431
  return shallowReadonly(instance.slots);
@@ -8380,6 +8437,21 @@ var VueRuntimeDOM = (function (exports) {
8380
8437
  });
8381
8438
  }
8382
8439
  }
8440
+ function getExposeProxy(instance) {
8441
+ if (instance.exposed) {
8442
+ return (instance.exposeProxy ||
8443
+ (instance.exposeProxy = new Proxy(proxyRefs(markRaw(instance.exposed)), {
8444
+ get(target, key) {
8445
+ if (key in target) {
8446
+ return target[key];
8447
+ }
8448
+ else if (key in publicPropertiesMap) {
8449
+ return publicPropertiesMap[key](instance);
8450
+ }
8451
+ }
8452
+ })));
8453
+ }
8454
+ }
8383
8455
  // record effects created during a component's setup() so that they can be
8384
8456
  // stopped when the component unmounts
8385
8457
  function recordInstanceBoundEffect(effect, instance = currentInstance) {
@@ -8428,30 +8500,133 @@ var VueRuntimeDOM = (function (exports) {
8428
8500
  return c;
8429
8501
  }
8430
8502
 
8503
+ // dev only
8504
+ const warnRuntimeUsage = (method) => warn(`${method}() is a compiler-hint helper that is only usable inside ` +
8505
+ `<script setup> of a single file component. Its arguments should be ` +
8506
+ `compiled away and passing it at runtime has no effect.`);
8431
8507
  // implementation
8432
8508
  function defineProps() {
8433
8509
  {
8434
- warn(`defineProps() is a compiler-hint helper that is only usable inside ` +
8435
- `<script setup> of a single file component. Its arguments should be ` +
8436
- `compiled away and passing it at runtime has no effect.`);
8510
+ warnRuntimeUsage(`defineProps`);
8437
8511
  }
8438
8512
  return null;
8439
8513
  }
8440
8514
  // implementation
8441
- function defineEmit() {
8515
+ function defineEmits() {
8442
8516
  {
8443
- warn(`defineEmit() is a compiler-hint helper that is only usable inside ` +
8444
- `<script setup> of a single file component. Its arguments should be ` +
8445
- `compiled away and passing it at runtime has no effect.`);
8517
+ warnRuntimeUsage(`defineEmits`);
8446
8518
  }
8447
8519
  return null;
8448
8520
  }
8521
+ /**
8522
+ * @deprecated use `defineEmits` instead.
8523
+ */
8524
+ const defineEmit = defineEmits;
8525
+ /**
8526
+ * Vue `<script setup>` compiler macro for declaring a component's exposed
8527
+ * instance properties when it is accessed by a parent component via template
8528
+ * refs.
8529
+ *
8530
+ * `<script setup>` components are closed by default - i.e. varaibles inside
8531
+ * the `<script setup>` scope is not exposed to parent unless explicitly exposed
8532
+ * via `defineExpose`.
8533
+ *
8534
+ * This is only usable inside `<script setup>`, is compiled away in the
8535
+ * output and should **not** be actually called at runtime.
8536
+ */
8537
+ function defineExpose(exposed) {
8538
+ {
8539
+ warnRuntimeUsage(`defineExpose`);
8540
+ }
8541
+ }
8542
+ /**
8543
+ * Vue `<script setup>` compiler macro for providing props default values when
8544
+ * using type-based `defineProps` decalration.
8545
+ *
8546
+ * Example usage:
8547
+ * ```ts
8548
+ * withDefaults(defineProps<{
8549
+ * size?: number
8550
+ * labels?: string[]
8551
+ * }>(), {
8552
+ * size: 3,
8553
+ * labels: () => ['default label']
8554
+ * })
8555
+ * ```
8556
+ *
8557
+ * This is only usable inside `<script setup>`, is compiled away in the output
8558
+ * and should **not** be actually called at runtime.
8559
+ */
8560
+ function withDefaults(props, defaults) {
8561
+ {
8562
+ warnRuntimeUsage(`withDefaults`);
8563
+ }
8564
+ return null;
8565
+ }
8566
+ /**
8567
+ * @deprecated use `useSlots` and `useAttrs` instead.
8568
+ */
8449
8569
  function useContext() {
8570
+ {
8571
+ warn(`\`useContext()\` has been deprecated and will be removed in the ` +
8572
+ `next minor release. Use \`useSlots()\` and \`useAttrs()\` instead.`);
8573
+ }
8574
+ return getContext();
8575
+ }
8576
+ function useSlots() {
8577
+ return getContext().slots;
8578
+ }
8579
+ function useAttrs() {
8580
+ return getContext().attrs;
8581
+ }
8582
+ function getContext() {
8450
8583
  const i = getCurrentInstance();
8451
8584
  if (!i) {
8452
8585
  warn(`useContext() called without active instance.`);
8453
8586
  }
8454
8587
  return i.setupContext || (i.setupContext = createSetupContext(i));
8588
+ }
8589
+ /**
8590
+ * Runtime helper for merging default declarations. Imported by compiled code
8591
+ * only.
8592
+ * @internal
8593
+ */
8594
+ function mergeDefaults(
8595
+ // the base props is compiler-generated and guaranteed to be in this shape.
8596
+ props, defaults) {
8597
+ for (const key in defaults) {
8598
+ const val = props[key];
8599
+ if (val) {
8600
+ val.default = defaults[key];
8601
+ }
8602
+ else if (val === null) {
8603
+ props[key] = { default: defaults[key] };
8604
+ }
8605
+ else {
8606
+ warn(`props default key "${key}" has no corresponding declaration.`);
8607
+ }
8608
+ }
8609
+ return props;
8610
+ }
8611
+ /**
8612
+ * Runtime helper for storing and resuming current instance context in
8613
+ * async setup().
8614
+ */
8615
+ function withAsyncContext(awaitable) {
8616
+ const ctx = getCurrentInstance();
8617
+ setCurrentInstance(null); // unset after storing instance
8618
+ if (!ctx) {
8619
+ warn(`withAsyncContext() called when there is no active context instance.`);
8620
+ }
8621
+ return isPromise(awaitable)
8622
+ ? awaitable.then(res => {
8623
+ setCurrentInstance(ctx);
8624
+ return res;
8625
+ }, err => {
8626
+ setCurrentInstance(ctx);
8627
+ throw err;
8628
+ })
8629
+ : awaitable;
8455
8630
  }
8456
8631
 
8457
8632
  // Actual implementation
@@ -8679,7 +8854,7 @@ var VueRuntimeDOM = (function (exports) {
8679
8854
  }
8680
8855
 
8681
8856
  // Core API ------------------------------------------------------------------
8682
- const version = "3.1.0";
8857
+ const version = "3.1.4";
8683
8858
  /**
8684
8859
  * SSR utils for \@vue/server-renderer. Only exposed in cjs builds.
8685
8860
  * @internal
@@ -8696,8 +8871,6 @@ var VueRuntimeDOM = (function (exports) {
8696
8871
 
8697
8872
  const svgNS = 'http://www.w3.org/2000/svg';
8698
8873
  const doc = (typeof document !== 'undefined' ? document : null);
8699
- let tempContainer;
8700
- let tempSVGContainer;
8701
8874
  const nodeOps = {
8702
8875
  insert: (child, parent, anchor) => {
8703
8876
  parent.insertBefore(child, anchor || null);
@@ -8748,24 +8921,60 @@ var VueRuntimeDOM = (function (exports) {
8748
8921
  return cloned;
8749
8922
  },
8750
8923
  // __UNSAFE__
8751
- // Reason: innerHTML.
8924
+ // Reason: insertAdjacentHTML.
8752
8925
  // Static content here can only come from compiled templates.
8753
8926
  // As long as the user only uses trusted templates, this is safe.
8754
- insertStaticContent(content, parent, anchor, isSVG) {
8755
- const temp = isSVG
8756
- ? tempSVGContainer ||
8757
- (tempSVGContainer = doc.createElementNS(svgNS, 'svg'))
8758
- : tempContainer || (tempContainer = doc.createElement('div'));
8759
- temp.innerHTML = content;
8760
- const first = temp.firstChild;
8761
- let node = first;
8762
- let last = node;
8763
- while (node) {
8764
- last = node;
8765
- nodeOps.insert(node, parent, anchor);
8766
- node = temp.firstChild;
8927
+ insertStaticContent(content, parent, anchor, isSVG, cached) {
8928
+ if (cached) {
8929
+ let first;
8930
+ let last;
8931
+ let i = 0;
8932
+ let l = cached.length;
8933
+ for (; i < l; i++) {
8934
+ const node = cached[i].cloneNode(true);
8935
+ if (i === 0)
8936
+ first = node;
8937
+ if (i === l - 1)
8938
+ last = node;
8939
+ parent.insertBefore(node, anchor);
8940
+ }
8941
+ return [first, last];
8942
+ }
8943
+ // <parent> before | first ... last | anchor </parent>
8944
+ const before = anchor ? anchor.previousSibling : parent.lastChild;
8945
+ if (anchor) {
8946
+ let insertionPoint;
8947
+ let usingTempInsertionPoint = false;
8948
+ if (anchor instanceof Element) {
8949
+ insertionPoint = anchor;
8950
+ }
8951
+ else {
8952
+ // insertAdjacentHTML only works for elements but the anchor is not an
8953
+ // element...
8954
+ usingTempInsertionPoint = true;
8955
+ insertionPoint = isSVG
8956
+ ? doc.createElementNS(svgNS, 'g')
8957
+ : doc.createElement('div');
8958
+ parent.insertBefore(insertionPoint, anchor);
8959
+ }
8960
+ insertionPoint.insertAdjacentHTML('beforebegin', content);
8961
+ if (usingTempInsertionPoint) {
8962
+ parent.removeChild(insertionPoint);
8963
+ }
8767
8964
  }
8768
- return [first, last];
8965
+ else {
8966
+ parent.insertAdjacentHTML('beforeend', content);
8967
+ }
8968
+ let first = before ? before.nextSibling : parent.firstChild;
8969
+ const last = anchor ? anchor.previousSibling : parent.lastChild;
8970
+ const ret = [];
8971
+ while (first) {
8972
+ ret.push(first);
8973
+ if (first === last)
8974
+ break;
8975
+ first = first.nextSibling;
8976
+ }
8977
+ return ret;
8769
8978
  }
8770
8979
  };
8771
8980
 
@@ -10071,6 +10280,8 @@ var VueRuntimeDOM = (function (exports) {
10071
10280
  exports.defineAsyncComponent = defineAsyncComponent;
10072
10281
  exports.defineComponent = defineComponent;
10073
10282
  exports.defineEmit = defineEmit;
10283
+ exports.defineEmits = defineEmits;
10284
+ exports.defineExpose = defineExpose;
10074
10285
  exports.defineProps = defineProps;
10075
10286
  exports.getCurrentInstance = getCurrentInstance;
10076
10287
  exports.getTransitionRawChildren = getTransitionRawChildren;
@@ -10086,6 +10297,7 @@ var VueRuntimeDOM = (function (exports) {
10086
10297
  exports.isRuntimeOnly = isRuntimeOnly;
10087
10298
  exports.isVNode = isVNode;
10088
10299
  exports.markRaw = markRaw;
10300
+ exports.mergeDefaults = mergeDefaults;
10089
10301
  exports.mergeProps = mergeProps;
10090
10302
  exports.nextTick = nextTick;
10091
10303
  exports.onActivated = onActivated;
@@ -10135,10 +10347,12 @@ var VueRuntimeDOM = (function (exports) {
10135
10347
  exports.transformVNodeArgs = transformVNodeArgs;
10136
10348
  exports.triggerRef = triggerRef;
10137
10349
  exports.unref = unref;
10350
+ exports.useAttrs = useAttrs;
10138
10351
  exports.useContext = useContext;
10139
10352
  exports.useCssModule = useCssModule;
10140
10353
  exports.useCssVars = useCssVars;
10141
10354
  exports.useSSRContext = useSSRContext;
10355
+ exports.useSlots = useSlots;
10142
10356
  exports.useTransitionState = useTransitionState;
10143
10357
  exports.vModelCheckbox = vModelCheckbox;
10144
10358
  exports.vModelDynamic = vModelDynamic;
@@ -10150,7 +10364,9 @@ var VueRuntimeDOM = (function (exports) {
10150
10364
  exports.warn = warn;
10151
10365
  exports.watch = watch;
10152
10366
  exports.watchEffect = watchEffect;
10367
+ exports.withAsyncContext = withAsyncContext;
10153
10368
  exports.withCtx = withCtx;
10369
+ exports.withDefaults = withDefaults;
10154
10370
  exports.withDirectives = withDirectives;
10155
10371
  exports.withKeys = withKeys;
10156
10372
  exports.withModifiers = withModifiers;