@vueuse/components 10.0.1 → 10.1.0

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.
package/index.mjs CHANGED
@@ -1,7 +1,6 @@
1
1
  import { defineComponent, ref, h, watch, computed, reactive, shallowRef, nextTick, getCurrentInstance, onMounted, watchEffect, toRefs } from 'vue-demi';
2
- import { onClickOutside as onClickOutside$1, useActiveElement, useBattery, useBrowserLocation, useDark, useDeviceMotion, useDeviceOrientation, useDevicePixelRatio, useDevicesList, useDocumentVisibility, useStorage as useStorage$1, isClient as isClient$1, useDraggable, useElementBounding, useElementSize as useElementSize$1, useElementVisibility as useElementVisibility$1, useEyeDropper, useFullscreen, useGeolocation, useIdle, useMouse, useMouseInElement, useMousePressed, useNetwork, useNow, useObjectUrl, useOffsetPagination, useOnline, usePageLeave, usePointer, usePointerLock, usePreferredColorScheme, usePreferredContrast, usePreferredDark as usePreferredDark$1, usePreferredLanguages, usePreferredReducedMotion, useMutationObserver, useTimeAgo, useTimestamp, useVirtualList, useWindowFocus, useWindowSize } from '@vueuse/core';
3
- import { toValue, isClient, noop, tryOnScopeDispose, isIOS, directiveHooks, pausableWatch, toRef, tryOnMounted, useToggle, notNullish, promiseTimeout, useDebounceFn, useThrottleFn } from '@vueuse/shared';
4
- import { computed as computed$1 } from '@vue/reactivity';
2
+ import { onClickOutside as onClickOutside$1, useActiveElement, useBattery, useBrowserLocation, useDark, useDeviceMotion, useDeviceOrientation, useDevicePixelRatio, useDevicesList, useDocumentVisibility, useStorage as useStorage$1, isClient as isClient$1, useDraggable, useElementBounding, useElementSize as useElementSize$1, useElementVisibility as useElementVisibility$1, useEyeDropper, useFullscreen, useGeolocation, useIdle, useMouse, useMouseInElement, useMousePressed, useNetwork, useNow, useObjectUrl, useOffsetPagination, useOnline, usePageLeave, usePointer, usePointerLock, usePreferredColorScheme, usePreferredContrast, usePreferredDark as usePreferredDark$1, usePreferredLanguages, usePreferredReducedMotion, useTimeAgo, useTimestamp, useVirtualList, useWindowFocus, useWindowSize } from '@vueuse/core';
3
+ import { toValue, isClient, noop, tryOnScopeDispose, isIOS, directiveHooks, pausableWatch, toRef, tryOnMounted, useToggle, notNullish, promiseTimeout, until, useDebounceFn, useThrottleFn } from '@vueuse/shared';
5
4
 
6
5
  const OnClickOutside = /* @__PURE__ */ /* #__PURE__ */ defineComponent({
7
6
  name: "OnClickOutside",
@@ -186,19 +185,19 @@ function onKeyStroke(...args) {
186
185
  return useEventListener(target, eventName, listener, passive);
187
186
  }
188
187
 
189
- var __defProp$d = Object.defineProperty;
190
- var __getOwnPropSymbols$e = Object.getOwnPropertySymbols;
191
- var __hasOwnProp$e = Object.prototype.hasOwnProperty;
192
- var __propIsEnum$e = Object.prototype.propertyIsEnumerable;
193
- var __defNormalProp$d = (obj, key, value) => key in obj ? __defProp$d(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
194
- var __spreadValues$d = (a, b) => {
188
+ var __defProp$e = Object.defineProperty;
189
+ var __getOwnPropSymbols$g = Object.getOwnPropertySymbols;
190
+ var __hasOwnProp$g = Object.prototype.hasOwnProperty;
191
+ var __propIsEnum$g = Object.prototype.propertyIsEnumerable;
192
+ var __defNormalProp$e = (obj, key, value) => key in obj ? __defProp$e(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
193
+ var __spreadValues$e = (a, b) => {
195
194
  for (var prop in b || (b = {}))
196
- if (__hasOwnProp$e.call(b, prop))
197
- __defNormalProp$d(a, prop, b[prop]);
198
- if (__getOwnPropSymbols$e)
199
- for (var prop of __getOwnPropSymbols$e(b)) {
200
- if (__propIsEnum$e.call(b, prop))
201
- __defNormalProp$d(a, prop, b[prop]);
195
+ if (__hasOwnProp$g.call(b, prop))
196
+ __defNormalProp$e(a, prop, b[prop]);
197
+ if (__getOwnPropSymbols$g)
198
+ for (var prop of __getOwnPropSymbols$g(b)) {
199
+ if (__propIsEnum$g.call(b, prop))
200
+ __defNormalProp$e(a, prop, b[prop]);
202
201
  }
203
202
  return a;
204
203
  };
@@ -212,7 +211,7 @@ const vOnKeyStroke = {
212
211
  });
213
212
  } else {
214
213
  const [handler, options] = binding.value;
215
- onKeyStroke(keys, handler, __spreadValues$d({
214
+ onKeyStroke(keys, handler, __spreadValues$e({
216
215
  target: el
217
216
  }, options));
218
217
  }
@@ -333,19 +332,19 @@ function guessSerializerType(rawInit) {
333
332
  return rawInit == null ? "any" : rawInit instanceof Set ? "set" : rawInit instanceof Map ? "map" : rawInit instanceof Date ? "date" : typeof rawInit === "boolean" ? "boolean" : typeof rawInit === "string" ? "string" : typeof rawInit === "object" ? "object" : !Number.isNaN(rawInit) ? "number" : "any";
334
333
  }
335
334
 
336
- var __defProp$c = Object.defineProperty;
337
- var __getOwnPropSymbols$d = Object.getOwnPropertySymbols;
338
- var __hasOwnProp$d = Object.prototype.hasOwnProperty;
339
- var __propIsEnum$d = Object.prototype.propertyIsEnumerable;
340
- var __defNormalProp$c = (obj, key, value) => key in obj ? __defProp$c(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
341
- var __spreadValues$c = (a, b) => {
335
+ var __defProp$d = Object.defineProperty;
336
+ var __getOwnPropSymbols$f = Object.getOwnPropertySymbols;
337
+ var __hasOwnProp$f = Object.prototype.hasOwnProperty;
338
+ var __propIsEnum$f = Object.prototype.propertyIsEnumerable;
339
+ var __defNormalProp$d = (obj, key, value) => key in obj ? __defProp$d(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
340
+ var __spreadValues$d = (a, b) => {
342
341
  for (var prop in b || (b = {}))
343
- if (__hasOwnProp$d.call(b, prop))
344
- __defNormalProp$c(a, prop, b[prop]);
345
- if (__getOwnPropSymbols$d)
346
- for (var prop of __getOwnPropSymbols$d(b)) {
347
- if (__propIsEnum$d.call(b, prop))
348
- __defNormalProp$c(a, prop, b[prop]);
342
+ if (__hasOwnProp$f.call(b, prop))
343
+ __defNormalProp$d(a, prop, b[prop]);
344
+ if (__getOwnPropSymbols$f)
345
+ for (var prop of __getOwnPropSymbols$f(b)) {
346
+ if (__propIsEnum$f.call(b, prop))
347
+ __defNormalProp$d(a, prop, b[prop]);
349
348
  }
350
349
  return a;
351
350
  };
@@ -462,7 +461,7 @@ function useStorage(key, defaults, storage, options = {}) {
462
461
  if (typeof mergeDefaults === "function")
463
462
  return mergeDefaults(value, rawInit);
464
463
  else if (type === "object" && !Array.isArray(value))
465
- return __spreadValues$c(__spreadValues$c({}, rawInit), value);
464
+ return __spreadValues$d(__spreadValues$d({}, rawInit), value);
466
465
  return value;
467
466
  } else if (typeof rawValue !== "string") {
468
467
  return rawValue;
@@ -549,19 +548,19 @@ function usePreferredDark(options) {
549
548
  return useMediaQuery("(prefers-color-scheme: dark)", options);
550
549
  }
551
550
 
552
- var __defProp$b = Object.defineProperty;
553
- var __getOwnPropSymbols$c = Object.getOwnPropertySymbols;
554
- var __hasOwnProp$c = Object.prototype.hasOwnProperty;
555
- var __propIsEnum$c = Object.prototype.propertyIsEnumerable;
556
- var __defNormalProp$b = (obj, key, value) => key in obj ? __defProp$b(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
557
- var __spreadValues$b = (a, b) => {
551
+ var __defProp$c = Object.defineProperty;
552
+ var __getOwnPropSymbols$e = Object.getOwnPropertySymbols;
553
+ var __hasOwnProp$e = Object.prototype.hasOwnProperty;
554
+ var __propIsEnum$e = Object.prototype.propertyIsEnumerable;
555
+ var __defNormalProp$c = (obj, key, value) => key in obj ? __defProp$c(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
556
+ var __spreadValues$c = (a, b) => {
558
557
  for (var prop in b || (b = {}))
559
- if (__hasOwnProp$c.call(b, prop))
560
- __defNormalProp$b(a, prop, b[prop]);
561
- if (__getOwnPropSymbols$c)
562
- for (var prop of __getOwnPropSymbols$c(b)) {
563
- if (__propIsEnum$c.call(b, prop))
564
- __defNormalProp$b(a, prop, b[prop]);
558
+ if (__hasOwnProp$e.call(b, prop))
559
+ __defNormalProp$c(a, prop, b[prop]);
560
+ if (__getOwnPropSymbols$e)
561
+ for (var prop of __getOwnPropSymbols$e(b)) {
562
+ if (__propIsEnum$e.call(b, prop))
563
+ __defNormalProp$c(a, prop, b[prop]);
565
564
  }
566
565
  return a;
567
566
  };
@@ -578,26 +577,21 @@ function useColorMode(options = {}) {
578
577
  emitAuto,
579
578
  disableTransition = true
580
579
  } = options;
581
- const modes = __spreadValues$b({
580
+ const modes = __spreadValues$c({
582
581
  auto: "",
583
582
  light: "light",
584
583
  dark: "dark"
585
584
  }, options.modes || {});
586
585
  const preferredDark = usePreferredDark({ window });
587
586
  const system = computed(() => preferredDark.value ? "dark" : "light");
588
- const store = storageRef || (storageKey == null ? ref(initialValue) : useStorage(storageKey, initialValue, storage, { window, listenToStorageChanges }));
589
- const state = computed({
590
- get() {
591
- return store.value === "auto" && !emitAuto ? system.value : store.value;
592
- },
593
- set(v) {
594
- store.value = v;
595
- }
596
- });
587
+ const store = storageRef || (storageKey == null ? toRef(initialValue) : useStorage(storageKey, initialValue, storage, { window, listenToStorageChanges }));
588
+ const state = computed(
589
+ () => store.value === "auto" ? system.value : store.value
590
+ );
597
591
  const updateHTMLAttrs = getSSRHandler(
598
592
  "updateHTMLAttrs",
599
593
  (selector2, attribute2, value) => {
600
- const el = typeof selector2 === "string" ? window == null ? void 0 : window.document.querySelector(selector2) : toValue(selector2);
594
+ const el = typeof selector2 === "string" ? window == null ? void 0 : window.document.querySelector(selector2) : unrefElement(selector2);
601
595
  if (!el)
602
596
  return;
603
597
  let style;
@@ -625,8 +619,7 @@ function useColorMode(options = {}) {
625
619
  );
626
620
  function defaultOnChanged(mode) {
627
621
  var _a;
628
- const resolvedMode = mode === "auto" ? system.value : mode;
629
- updateHTMLAttrs(selector, attribute, (_a = modes[resolvedMode]) != null ? _a : resolvedMode);
622
+ updateHTMLAttrs(selector, attribute, (_a = modes[mode]) != null ? _a : mode);
630
623
  }
631
624
  function onChanged(mode) {
632
625
  if (options.onChanged)
@@ -635,13 +628,19 @@ function useColorMode(options = {}) {
635
628
  defaultOnChanged(mode);
636
629
  }
637
630
  watch(state, onChanged, { flush: "post", immediate: true });
638
- if (emitAuto)
639
- watch(system, () => onChanged(state.value), { flush: "post" });
640
631
  tryOnMounted(() => onChanged(state.value));
632
+ const auto = computed({
633
+ get() {
634
+ return emitAuto ? store.value : state.value;
635
+ },
636
+ set(v) {
637
+ store.value = v;
638
+ }
639
+ });
641
640
  try {
642
- return Object.assign(state, { store, system });
641
+ return Object.assign(auto, { store, system, state });
643
642
  } catch (e) {
644
- return state;
643
+ return auto;
645
644
  }
646
645
  }
647
646
 
@@ -738,25 +737,25 @@ const UseDocumentVisibility = /* @__PURE__ */ /* #__PURE__ */ defineComponent({
738
737
  }
739
738
  });
740
739
 
741
- var __defProp$a = Object.defineProperty;
742
- var __defProps$8 = Object.defineProperties;
743
- var __getOwnPropDescs$8 = Object.getOwnPropertyDescriptors;
744
- var __getOwnPropSymbols$b = Object.getOwnPropertySymbols;
745
- var __hasOwnProp$b = Object.prototype.hasOwnProperty;
746
- var __propIsEnum$b = Object.prototype.propertyIsEnumerable;
747
- var __defNormalProp$a = (obj, key, value) => key in obj ? __defProp$a(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
748
- var __spreadValues$a = (a, b) => {
740
+ var __defProp$b = Object.defineProperty;
741
+ var __defProps$9 = Object.defineProperties;
742
+ var __getOwnPropDescs$9 = Object.getOwnPropertyDescriptors;
743
+ var __getOwnPropSymbols$d = Object.getOwnPropertySymbols;
744
+ var __hasOwnProp$d = Object.prototype.hasOwnProperty;
745
+ var __propIsEnum$d = Object.prototype.propertyIsEnumerable;
746
+ var __defNormalProp$b = (obj, key, value) => key in obj ? __defProp$b(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
747
+ var __spreadValues$b = (a, b) => {
749
748
  for (var prop in b || (b = {}))
750
- if (__hasOwnProp$b.call(b, prop))
751
- __defNormalProp$a(a, prop, b[prop]);
752
- if (__getOwnPropSymbols$b)
753
- for (var prop of __getOwnPropSymbols$b(b)) {
754
- if (__propIsEnum$b.call(b, prop))
755
- __defNormalProp$a(a, prop, b[prop]);
749
+ if (__hasOwnProp$d.call(b, prop))
750
+ __defNormalProp$b(a, prop, b[prop]);
751
+ if (__getOwnPropSymbols$d)
752
+ for (var prop of __getOwnPropSymbols$d(b)) {
753
+ if (__propIsEnum$d.call(b, prop))
754
+ __defNormalProp$b(a, prop, b[prop]);
756
755
  }
757
756
  return a;
758
757
  };
759
- var __spreadProps$8 = (a, b) => __defProps$8(a, __getOwnPropDescs$8(b));
758
+ var __spreadProps$9 = (a, b) => __defProps$9(a, __getOwnPropDescs$9(b));
760
759
  const UseDraggable = /* @__PURE__ */ /* #__PURE__ */ defineComponent({
761
760
  name: "UseDraggable",
762
761
  props: [
@@ -789,7 +788,7 @@ const UseDraggable = /* @__PURE__ */ /* #__PURE__ */ defineComponent({
789
788
  storageValue.value.x = position.x;
790
789
  storageValue.value.y = position.y;
791
790
  };
792
- const data = reactive(useDraggable(target, __spreadProps$8(__spreadValues$a({}, props), {
791
+ const data = reactive(useDraggable(target, __spreadProps$9(__spreadValues$b({}, props), {
793
792
  handle,
794
793
  initialValue,
795
794
  onEnd
@@ -862,23 +861,23 @@ const UseElementSize = /* @__PURE__ */ /* #__PURE__ */ defineComponent({
862
861
  }
863
862
  });
864
863
 
865
- var __getOwnPropSymbols$a = Object.getOwnPropertySymbols;
866
- var __hasOwnProp$a = Object.prototype.hasOwnProperty;
867
- var __propIsEnum$a = Object.prototype.propertyIsEnumerable;
868
- var __objRest = (source, exclude) => {
864
+ var __getOwnPropSymbols$c = Object.getOwnPropertySymbols;
865
+ var __hasOwnProp$c = Object.prototype.hasOwnProperty;
866
+ var __propIsEnum$c = Object.prototype.propertyIsEnumerable;
867
+ var __objRest$1 = (source, exclude) => {
869
868
  var target = {};
870
869
  for (var prop in source)
871
- if (__hasOwnProp$a.call(source, prop) && exclude.indexOf(prop) < 0)
870
+ if (__hasOwnProp$c.call(source, prop) && exclude.indexOf(prop) < 0)
872
871
  target[prop] = source[prop];
873
- if (source != null && __getOwnPropSymbols$a)
874
- for (var prop of __getOwnPropSymbols$a(source)) {
875
- if (exclude.indexOf(prop) < 0 && __propIsEnum$a.call(source, prop))
872
+ if (source != null && __getOwnPropSymbols$c)
873
+ for (var prop of __getOwnPropSymbols$c(source)) {
874
+ if (exclude.indexOf(prop) < 0 && __propIsEnum$c.call(source, prop))
876
875
  target[prop] = source[prop];
877
876
  }
878
877
  return target;
879
878
  };
880
879
  function useResizeObserver(target, callback, options = {}) {
881
- const _a = options, { window = defaultWindow } = _a, observerOptions = __objRest(_a, ["window"]);
880
+ const _a = options, { window = defaultWindow } = _a, observerOptions = __objRest$1(_a, ["window"]);
882
881
  let observer;
883
882
  const isSupported = useSupported(() => window && "ResizeObserver" in window);
884
883
  const cleanup = () => {
@@ -992,7 +991,7 @@ function useIntersectionObserver(target, callback, options = {}) {
992
991
  immediate = true
993
992
  } = options;
994
993
  const isSupported = useSupported(() => window && "IntersectionObserver" in window);
995
- const targets = computed$1(() => {
994
+ const targets = computed(() => {
996
995
  const _target = toValue(target);
997
996
  return (Array.isArray(_target) ? _target : [_target]).map(unrefElement).filter(notNullish);
998
997
  });
@@ -1122,6 +1121,25 @@ const UseIdle = /* @__PURE__ */ /* #__PURE__ */ defineComponent({
1122
1121
  }
1123
1122
  });
1124
1123
 
1124
+ var __defProp$a = Object.defineProperty;
1125
+ var __defProps$8 = Object.defineProperties;
1126
+ var __getOwnPropDescs$8 = Object.getOwnPropertyDescriptors;
1127
+ var __getOwnPropSymbols$b = Object.getOwnPropertySymbols;
1128
+ var __hasOwnProp$b = Object.prototype.hasOwnProperty;
1129
+ var __propIsEnum$b = Object.prototype.propertyIsEnumerable;
1130
+ var __defNormalProp$a = (obj, key, value) => key in obj ? __defProp$a(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
1131
+ var __spreadValues$a = (a, b) => {
1132
+ for (var prop in b || (b = {}))
1133
+ if (__hasOwnProp$b.call(b, prop))
1134
+ __defNormalProp$a(a, prop, b[prop]);
1135
+ if (__getOwnPropSymbols$b)
1136
+ for (var prop of __getOwnPropSymbols$b(b)) {
1137
+ if (__propIsEnum$b.call(b, prop))
1138
+ __defNormalProp$a(a, prop, b[prop]);
1139
+ }
1140
+ return a;
1141
+ };
1142
+ var __spreadProps$8 = (a, b) => __defProps$8(a, __getOwnPropDescs$8(b));
1125
1143
  function useAsyncState(promise, initialState, options) {
1126
1144
  const {
1127
1145
  immediate = true,
@@ -1162,27 +1180,37 @@ function useAsyncState(promise, initialState, options) {
1162
1180
  }
1163
1181
  if (immediate)
1164
1182
  execute(delay);
1165
- return {
1183
+ const shell = {
1166
1184
  state,
1167
1185
  isReady,
1168
1186
  isLoading,
1169
1187
  error,
1170
1188
  execute
1171
1189
  };
1190
+ function waitUntilIsLoaded() {
1191
+ return new Promise((resolve, reject) => {
1192
+ until(isLoading).toBe(false).then(() => resolve(shell)).catch(reject);
1193
+ });
1194
+ }
1195
+ return __spreadProps$8(__spreadValues$a({}, shell), {
1196
+ then(onFulfilled, onRejected) {
1197
+ return waitUntilIsLoaded().then(onFulfilled, onRejected);
1198
+ }
1199
+ });
1172
1200
  }
1173
1201
 
1174
1202
  var __defProp$9 = Object.defineProperty;
1175
- var __getOwnPropSymbols$9 = Object.getOwnPropertySymbols;
1176
- var __hasOwnProp$9 = Object.prototype.hasOwnProperty;
1177
- var __propIsEnum$9 = Object.prototype.propertyIsEnumerable;
1203
+ var __getOwnPropSymbols$a = Object.getOwnPropertySymbols;
1204
+ var __hasOwnProp$a = Object.prototype.hasOwnProperty;
1205
+ var __propIsEnum$a = Object.prototype.propertyIsEnumerable;
1178
1206
  var __defNormalProp$9 = (obj, key, value) => key in obj ? __defProp$9(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
1179
1207
  var __spreadValues$9 = (a, b) => {
1180
1208
  for (var prop in b || (b = {}))
1181
- if (__hasOwnProp$9.call(b, prop))
1209
+ if (__hasOwnProp$a.call(b, prop))
1182
1210
  __defNormalProp$9(a, prop, b[prop]);
1183
- if (__getOwnPropSymbols$9)
1184
- for (var prop of __getOwnPropSymbols$9(b)) {
1185
- if (__propIsEnum$9.call(b, prop))
1211
+ if (__getOwnPropSymbols$a)
1212
+ for (var prop of __getOwnPropSymbols$a(b)) {
1213
+ if (__propIsEnum$a.call(b, prop))
1186
1214
  __defNormalProp$9(a, prop, b[prop]);
1187
1215
  }
1188
1216
  return a;
@@ -1369,17 +1397,17 @@ function useScroll(element, options = {}) {
1369
1397
  var __defProp$8 = Object.defineProperty;
1370
1398
  var __defProps$7 = Object.defineProperties;
1371
1399
  var __getOwnPropDescs$7 = Object.getOwnPropertyDescriptors;
1372
- var __getOwnPropSymbols$8 = Object.getOwnPropertySymbols;
1373
- var __hasOwnProp$8 = Object.prototype.hasOwnProperty;
1374
- var __propIsEnum$8 = Object.prototype.propertyIsEnumerable;
1400
+ var __getOwnPropSymbols$9 = Object.getOwnPropertySymbols;
1401
+ var __hasOwnProp$9 = Object.prototype.hasOwnProperty;
1402
+ var __propIsEnum$9 = Object.prototype.propertyIsEnumerable;
1375
1403
  var __defNormalProp$8 = (obj, key, value) => key in obj ? __defProp$8(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
1376
1404
  var __spreadValues$8 = (a, b) => {
1377
1405
  for (var prop in b || (b = {}))
1378
- if (__hasOwnProp$8.call(b, prop))
1406
+ if (__hasOwnProp$9.call(b, prop))
1379
1407
  __defNormalProp$8(a, prop, b[prop]);
1380
- if (__getOwnPropSymbols$8)
1381
- for (var prop of __getOwnPropSymbols$8(b)) {
1382
- if (__propIsEnum$8.call(b, prop))
1408
+ if (__getOwnPropSymbols$9)
1409
+ for (var prop of __getOwnPropSymbols$9(b)) {
1410
+ if (__propIsEnum$9.call(b, prop))
1383
1411
  __defNormalProp$8(a, prop, b[prop]);
1384
1412
  }
1385
1413
  return a;
@@ -1474,17 +1502,17 @@ const UseMouseInElement = /* @__PURE__ */ /* #__PURE__ */ defineComponent({
1474
1502
  var __defProp$7 = Object.defineProperty;
1475
1503
  var __defProps$6 = Object.defineProperties;
1476
1504
  var __getOwnPropDescs$6 = Object.getOwnPropertyDescriptors;
1477
- var __getOwnPropSymbols$7 = Object.getOwnPropertySymbols;
1478
- var __hasOwnProp$7 = Object.prototype.hasOwnProperty;
1479
- var __propIsEnum$7 = Object.prototype.propertyIsEnumerable;
1505
+ var __getOwnPropSymbols$8 = Object.getOwnPropertySymbols;
1506
+ var __hasOwnProp$8 = Object.prototype.hasOwnProperty;
1507
+ var __propIsEnum$8 = Object.prototype.propertyIsEnumerable;
1480
1508
  var __defNormalProp$7 = (obj, key, value) => key in obj ? __defProp$7(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
1481
1509
  var __spreadValues$7 = (a, b) => {
1482
1510
  for (var prop in b || (b = {}))
1483
- if (__hasOwnProp$7.call(b, prop))
1511
+ if (__hasOwnProp$8.call(b, prop))
1484
1512
  __defNormalProp$7(a, prop, b[prop]);
1485
- if (__getOwnPropSymbols$7)
1486
- for (var prop of __getOwnPropSymbols$7(b)) {
1487
- if (__propIsEnum$7.call(b, prop))
1513
+ if (__getOwnPropSymbols$8)
1514
+ for (var prop of __getOwnPropSymbols$8(b)) {
1515
+ if (__propIsEnum$8.call(b, prop))
1488
1516
  __defNormalProp$7(a, prop, b[prop]);
1489
1517
  }
1490
1518
  return a;
@@ -1517,17 +1545,17 @@ const UseNetwork = /* @__PURE__ */ /* #__PURE__ */ defineComponent({
1517
1545
  var __defProp$6 = Object.defineProperty;
1518
1546
  var __defProps$5 = Object.defineProperties;
1519
1547
  var __getOwnPropDescs$5 = Object.getOwnPropertyDescriptors;
1520
- var __getOwnPropSymbols$6 = Object.getOwnPropertySymbols;
1521
- var __hasOwnProp$6 = Object.prototype.hasOwnProperty;
1522
- var __propIsEnum$6 = Object.prototype.propertyIsEnumerable;
1548
+ var __getOwnPropSymbols$7 = Object.getOwnPropertySymbols;
1549
+ var __hasOwnProp$7 = Object.prototype.hasOwnProperty;
1550
+ var __propIsEnum$7 = Object.prototype.propertyIsEnumerable;
1523
1551
  var __defNormalProp$6 = (obj, key, value) => key in obj ? __defProp$6(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
1524
1552
  var __spreadValues$6 = (a, b) => {
1525
1553
  for (var prop in b || (b = {}))
1526
- if (__hasOwnProp$6.call(b, prop))
1554
+ if (__hasOwnProp$7.call(b, prop))
1527
1555
  __defNormalProp$6(a, prop, b[prop]);
1528
- if (__getOwnPropSymbols$6)
1529
- for (var prop of __getOwnPropSymbols$6(b)) {
1530
- if (__propIsEnum$6.call(b, prop))
1556
+ if (__getOwnPropSymbols$7)
1557
+ for (var prop of __getOwnPropSymbols$7(b)) {
1558
+ if (__propIsEnum$7.call(b, prop))
1531
1559
  __defNormalProp$6(a, prop, b[prop]);
1532
1560
  }
1533
1561
  return a;
@@ -1563,17 +1591,17 @@ const UseObjectUrl = /* @__PURE__ */ /* #__PURE__ */ defineComponent({
1563
1591
  var __defProp$5 = Object.defineProperty;
1564
1592
  var __defProps$4 = Object.defineProperties;
1565
1593
  var __getOwnPropDescs$4 = Object.getOwnPropertyDescriptors;
1566
- var __getOwnPropSymbols$5 = Object.getOwnPropertySymbols;
1567
- var __hasOwnProp$5 = Object.prototype.hasOwnProperty;
1568
- var __propIsEnum$5 = Object.prototype.propertyIsEnumerable;
1594
+ var __getOwnPropSymbols$6 = Object.getOwnPropertySymbols;
1595
+ var __hasOwnProp$6 = Object.prototype.hasOwnProperty;
1596
+ var __propIsEnum$6 = Object.prototype.propertyIsEnumerable;
1569
1597
  var __defNormalProp$5 = (obj, key, value) => key in obj ? __defProp$5(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
1570
1598
  var __spreadValues$5 = (a, b) => {
1571
1599
  for (var prop in b || (b = {}))
1572
- if (__hasOwnProp$5.call(b, prop))
1600
+ if (__hasOwnProp$6.call(b, prop))
1573
1601
  __defNormalProp$5(a, prop, b[prop]);
1574
- if (__getOwnPropSymbols$5)
1575
- for (var prop of __getOwnPropSymbols$5(b)) {
1576
- if (__propIsEnum$5.call(b, prop))
1602
+ if (__getOwnPropSymbols$6)
1603
+ for (var prop of __getOwnPropSymbols$6(b)) {
1604
+ if (__propIsEnum$6.call(b, prop))
1577
1605
  __defNormalProp$5(a, prop, b[prop]);
1578
1606
  }
1579
1607
  return a;
@@ -1648,17 +1676,17 @@ const UsePageLeave = /* @__PURE__ */ /* #__PURE__ */ defineComponent({
1648
1676
  var __defProp$4 = Object.defineProperty;
1649
1677
  var __defProps$3 = Object.defineProperties;
1650
1678
  var __getOwnPropDescs$3 = Object.getOwnPropertyDescriptors;
1651
- var __getOwnPropSymbols$4 = Object.getOwnPropertySymbols;
1652
- var __hasOwnProp$4 = Object.prototype.hasOwnProperty;
1653
- var __propIsEnum$4 = Object.prototype.propertyIsEnumerable;
1679
+ var __getOwnPropSymbols$5 = Object.getOwnPropertySymbols;
1680
+ var __hasOwnProp$5 = Object.prototype.hasOwnProperty;
1681
+ var __propIsEnum$5 = Object.prototype.propertyIsEnumerable;
1654
1682
  var __defNormalProp$4 = (obj, key, value) => key in obj ? __defProp$4(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
1655
1683
  var __spreadValues$4 = (a, b) => {
1656
1684
  for (var prop in b || (b = {}))
1657
- if (__hasOwnProp$4.call(b, prop))
1685
+ if (__hasOwnProp$5.call(b, prop))
1658
1686
  __defNormalProp$4(a, prop, b[prop]);
1659
- if (__getOwnPropSymbols$4)
1660
- for (var prop of __getOwnPropSymbols$4(b)) {
1661
- if (__propIsEnum$4.call(b, prop))
1687
+ if (__getOwnPropSymbols$5)
1688
+ for (var prop of __getOwnPropSymbols$5(b)) {
1689
+ if (__propIsEnum$5.call(b, prop))
1662
1690
  __defNormalProp$4(a, prop, b[prop]);
1663
1691
  }
1664
1692
  return a;
@@ -1761,6 +1789,53 @@ const UsePreferredReducedMotion = /* @__PURE__ */ /* #__PURE__ */ defineComponen
1761
1789
  }
1762
1790
  });
1763
1791
 
1792
+ var __getOwnPropSymbols$4 = Object.getOwnPropertySymbols;
1793
+ var __hasOwnProp$4 = Object.prototype.hasOwnProperty;
1794
+ var __propIsEnum$4 = Object.prototype.propertyIsEnumerable;
1795
+ var __objRest = (source, exclude) => {
1796
+ var target = {};
1797
+ for (var prop in source)
1798
+ if (__hasOwnProp$4.call(source, prop) && exclude.indexOf(prop) < 0)
1799
+ target[prop] = source[prop];
1800
+ if (source != null && __getOwnPropSymbols$4)
1801
+ for (var prop of __getOwnPropSymbols$4(source)) {
1802
+ if (exclude.indexOf(prop) < 0 && __propIsEnum$4.call(source, prop))
1803
+ target[prop] = source[prop];
1804
+ }
1805
+ return target;
1806
+ };
1807
+ function useMutationObserver(target, callback, options = {}) {
1808
+ const _a = options, { window = defaultWindow } = _a, mutationOptions = __objRest(_a, ["window"]);
1809
+ let observer;
1810
+ const isSupported = useSupported(() => window && "MutationObserver" in window);
1811
+ const cleanup = () => {
1812
+ if (observer) {
1813
+ observer.disconnect();
1814
+ observer = void 0;
1815
+ }
1816
+ };
1817
+ const stopWatch = watch(
1818
+ () => unrefElement(target),
1819
+ (el) => {
1820
+ cleanup();
1821
+ if (isSupported.value && window && el) {
1822
+ observer = new MutationObserver(callback);
1823
+ observer.observe(el, mutationOptions);
1824
+ }
1825
+ },
1826
+ { immediate: true }
1827
+ );
1828
+ const stop = () => {
1829
+ cleanup();
1830
+ stopWatch();
1831
+ };
1832
+ tryOnScopeDispose(stop);
1833
+ return {
1834
+ isSupported,
1835
+ stop
1836
+ };
1837
+ }
1838
+
1764
1839
  function useCssVar(prop, target, options = {}) {
1765
1840
  const { window = defaultWindow, initialValue = "", observe = false } = options;
1766
1841
  const variable = ref(initialValue);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vueuse/components",
3
- "version": "10.0.1",
3
+ "version": "10.1.0",
4
4
  "description": "Renderless components for VueUse",
5
5
  "author": "Jacob Clevenger<https://github.com/wheatjs>",
6
6
  "license": "MIT",
@@ -33,8 +33,8 @@
33
33
  "jsdelivr": "./index.iife.min.js",
34
34
  "types": "./index.d.ts",
35
35
  "dependencies": {
36
- "@vueuse/core": "10.0.1",
37
- "@vueuse/shared": "10.0.1",
36
+ "@vueuse/core": "10.1.0",
37
+ "@vueuse/shared": "10.1.0",
38
38
  "vue-demi": ">=0.14.0"
39
39
  }
40
40
  }