@vueuse/components 10.0.0 → 10.0.2
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.cjs +129 -83
- package/index.iife.js +131 -84
- package/index.iife.min.js +1 -1
- package/index.mjs +129 -83
- package/package.json +3 -3
package/index.cjs
CHANGED
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
var vueDemi = require('vue-demi');
|
|
4
4
|
var core = require('@vueuse/core');
|
|
5
5
|
var shared = require('@vueuse/shared');
|
|
6
|
-
var reactivity = require('@vue/reactivity');
|
|
7
6
|
|
|
8
7
|
const OnClickOutside = /* @__PURE__ */ /* #__PURE__ */ vueDemi.defineComponent({
|
|
9
8
|
name: "OnClickOutside",
|
|
@@ -189,17 +188,17 @@ function onKeyStroke(...args) {
|
|
|
189
188
|
}
|
|
190
189
|
|
|
191
190
|
var __defProp$d = Object.defineProperty;
|
|
192
|
-
var __getOwnPropSymbols$
|
|
193
|
-
var __hasOwnProp$
|
|
194
|
-
var __propIsEnum$
|
|
191
|
+
var __getOwnPropSymbols$f = Object.getOwnPropertySymbols;
|
|
192
|
+
var __hasOwnProp$f = Object.prototype.hasOwnProperty;
|
|
193
|
+
var __propIsEnum$f = Object.prototype.propertyIsEnumerable;
|
|
195
194
|
var __defNormalProp$d = (obj, key, value) => key in obj ? __defProp$d(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
196
195
|
var __spreadValues$d = (a, b) => {
|
|
197
196
|
for (var prop in b || (b = {}))
|
|
198
|
-
if (__hasOwnProp$
|
|
197
|
+
if (__hasOwnProp$f.call(b, prop))
|
|
199
198
|
__defNormalProp$d(a, prop, b[prop]);
|
|
200
|
-
if (__getOwnPropSymbols$
|
|
201
|
-
for (var prop of __getOwnPropSymbols$
|
|
202
|
-
if (__propIsEnum$
|
|
199
|
+
if (__getOwnPropSymbols$f)
|
|
200
|
+
for (var prop of __getOwnPropSymbols$f(b)) {
|
|
201
|
+
if (__propIsEnum$f.call(b, prop))
|
|
203
202
|
__defNormalProp$d(a, prop, b[prop]);
|
|
204
203
|
}
|
|
205
204
|
return a;
|
|
@@ -336,17 +335,17 @@ function guessSerializerType(rawInit) {
|
|
|
336
335
|
}
|
|
337
336
|
|
|
338
337
|
var __defProp$c = Object.defineProperty;
|
|
339
|
-
var __getOwnPropSymbols$
|
|
340
|
-
var __hasOwnProp$
|
|
341
|
-
var __propIsEnum$
|
|
338
|
+
var __getOwnPropSymbols$e = Object.getOwnPropertySymbols;
|
|
339
|
+
var __hasOwnProp$e = Object.prototype.hasOwnProperty;
|
|
340
|
+
var __propIsEnum$e = Object.prototype.propertyIsEnumerable;
|
|
342
341
|
var __defNormalProp$c = (obj, key, value) => key in obj ? __defProp$c(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
343
342
|
var __spreadValues$c = (a, b) => {
|
|
344
343
|
for (var prop in b || (b = {}))
|
|
345
|
-
if (__hasOwnProp$
|
|
344
|
+
if (__hasOwnProp$e.call(b, prop))
|
|
346
345
|
__defNormalProp$c(a, prop, b[prop]);
|
|
347
|
-
if (__getOwnPropSymbols$
|
|
348
|
-
for (var prop of __getOwnPropSymbols$
|
|
349
|
-
if (__propIsEnum$
|
|
346
|
+
if (__getOwnPropSymbols$e)
|
|
347
|
+
for (var prop of __getOwnPropSymbols$e(b)) {
|
|
348
|
+
if (__propIsEnum$e.call(b, prop))
|
|
350
349
|
__defNormalProp$c(a, prop, b[prop]);
|
|
351
350
|
}
|
|
352
351
|
return a;
|
|
@@ -552,17 +551,17 @@ function usePreferredDark(options) {
|
|
|
552
551
|
}
|
|
553
552
|
|
|
554
553
|
var __defProp$b = Object.defineProperty;
|
|
555
|
-
var __getOwnPropSymbols$
|
|
556
|
-
var __hasOwnProp$
|
|
557
|
-
var __propIsEnum$
|
|
554
|
+
var __getOwnPropSymbols$d = Object.getOwnPropertySymbols;
|
|
555
|
+
var __hasOwnProp$d = Object.prototype.hasOwnProperty;
|
|
556
|
+
var __propIsEnum$d = Object.prototype.propertyIsEnumerable;
|
|
558
557
|
var __defNormalProp$b = (obj, key, value) => key in obj ? __defProp$b(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
559
558
|
var __spreadValues$b = (a, b) => {
|
|
560
559
|
for (var prop in b || (b = {}))
|
|
561
|
-
if (__hasOwnProp$
|
|
560
|
+
if (__hasOwnProp$d.call(b, prop))
|
|
562
561
|
__defNormalProp$b(a, prop, b[prop]);
|
|
563
|
-
if (__getOwnPropSymbols$
|
|
564
|
-
for (var prop of __getOwnPropSymbols$
|
|
565
|
-
if (__propIsEnum$
|
|
562
|
+
if (__getOwnPropSymbols$d)
|
|
563
|
+
for (var prop of __getOwnPropSymbols$d(b)) {
|
|
564
|
+
if (__propIsEnum$d.call(b, prop))
|
|
566
565
|
__defNormalProp$b(a, prop, b[prop]);
|
|
567
566
|
}
|
|
568
567
|
return a;
|
|
@@ -743,17 +742,17 @@ const UseDocumentVisibility = /* @__PURE__ */ /* #__PURE__ */ vueDemi.defineComp
|
|
|
743
742
|
var __defProp$a = Object.defineProperty;
|
|
744
743
|
var __defProps$8 = Object.defineProperties;
|
|
745
744
|
var __getOwnPropDescs$8 = Object.getOwnPropertyDescriptors;
|
|
746
|
-
var __getOwnPropSymbols$
|
|
747
|
-
var __hasOwnProp$
|
|
748
|
-
var __propIsEnum$
|
|
745
|
+
var __getOwnPropSymbols$c = Object.getOwnPropertySymbols;
|
|
746
|
+
var __hasOwnProp$c = Object.prototype.hasOwnProperty;
|
|
747
|
+
var __propIsEnum$c = Object.prototype.propertyIsEnumerable;
|
|
749
748
|
var __defNormalProp$a = (obj, key, value) => key in obj ? __defProp$a(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
750
749
|
var __spreadValues$a = (a, b) => {
|
|
751
750
|
for (var prop in b || (b = {}))
|
|
752
|
-
if (__hasOwnProp$
|
|
751
|
+
if (__hasOwnProp$c.call(b, prop))
|
|
753
752
|
__defNormalProp$a(a, prop, b[prop]);
|
|
754
|
-
if (__getOwnPropSymbols$
|
|
755
|
-
for (var prop of __getOwnPropSymbols$
|
|
756
|
-
if (__propIsEnum$
|
|
753
|
+
if (__getOwnPropSymbols$c)
|
|
754
|
+
for (var prop of __getOwnPropSymbols$c(b)) {
|
|
755
|
+
if (__propIsEnum$c.call(b, prop))
|
|
757
756
|
__defNormalProp$a(a, prop, b[prop]);
|
|
758
757
|
}
|
|
759
758
|
return a;
|
|
@@ -864,23 +863,23 @@ const UseElementSize = /* @__PURE__ */ /* #__PURE__ */ vueDemi.defineComponent({
|
|
|
864
863
|
}
|
|
865
864
|
});
|
|
866
865
|
|
|
867
|
-
var __getOwnPropSymbols$
|
|
868
|
-
var __hasOwnProp$
|
|
869
|
-
var __propIsEnum$
|
|
870
|
-
var __objRest = (source, exclude) => {
|
|
866
|
+
var __getOwnPropSymbols$b = Object.getOwnPropertySymbols;
|
|
867
|
+
var __hasOwnProp$b = Object.prototype.hasOwnProperty;
|
|
868
|
+
var __propIsEnum$b = Object.prototype.propertyIsEnumerable;
|
|
869
|
+
var __objRest$1 = (source, exclude) => {
|
|
871
870
|
var target = {};
|
|
872
871
|
for (var prop in source)
|
|
873
|
-
if (__hasOwnProp$
|
|
872
|
+
if (__hasOwnProp$b.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
874
873
|
target[prop] = source[prop];
|
|
875
|
-
if (source != null && __getOwnPropSymbols$
|
|
876
|
-
for (var prop of __getOwnPropSymbols$
|
|
877
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum$
|
|
874
|
+
if (source != null && __getOwnPropSymbols$b)
|
|
875
|
+
for (var prop of __getOwnPropSymbols$b(source)) {
|
|
876
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum$b.call(source, prop))
|
|
878
877
|
target[prop] = source[prop];
|
|
879
878
|
}
|
|
880
879
|
return target;
|
|
881
880
|
};
|
|
882
881
|
function useResizeObserver(target, callback, options = {}) {
|
|
883
|
-
const _a = options, { window = defaultWindow } = _a, observerOptions = __objRest(_a, ["window"]);
|
|
882
|
+
const _a = options, { window = defaultWindow } = _a, observerOptions = __objRest$1(_a, ["window"]);
|
|
884
883
|
let observer;
|
|
885
884
|
const isSupported = useSupported(() => window && "ResizeObserver" in window);
|
|
886
885
|
const cleanup = () => {
|
|
@@ -994,7 +993,7 @@ function useIntersectionObserver(target, callback, options = {}) {
|
|
|
994
993
|
immediate = true
|
|
995
994
|
} = options;
|
|
996
995
|
const isSupported = useSupported(() => window && "IntersectionObserver" in window);
|
|
997
|
-
const targets =
|
|
996
|
+
const targets = vueDemi.computed(() => {
|
|
998
997
|
const _target = shared.toValue(target);
|
|
999
998
|
return (Array.isArray(_target) ? _target : [_target]).map(unrefElement).filter(shared.notNullish);
|
|
1000
999
|
});
|
|
@@ -1006,7 +1005,7 @@ function useIntersectionObserver(target, callback, options = {}) {
|
|
|
1006
1005
|
cleanup();
|
|
1007
1006
|
if (!isActive.value)
|
|
1008
1007
|
return;
|
|
1009
|
-
if (targets2.length)
|
|
1008
|
+
if (!targets2.length)
|
|
1010
1009
|
return;
|
|
1011
1010
|
const observer = new IntersectionObserver(
|
|
1012
1011
|
callback,
|
|
@@ -1174,17 +1173,17 @@ function useAsyncState(promise, initialState, options) {
|
|
|
1174
1173
|
}
|
|
1175
1174
|
|
|
1176
1175
|
var __defProp$9 = Object.defineProperty;
|
|
1177
|
-
var __getOwnPropSymbols$
|
|
1178
|
-
var __hasOwnProp$
|
|
1179
|
-
var __propIsEnum$
|
|
1176
|
+
var __getOwnPropSymbols$a = Object.getOwnPropertySymbols;
|
|
1177
|
+
var __hasOwnProp$a = Object.prototype.hasOwnProperty;
|
|
1178
|
+
var __propIsEnum$a = Object.prototype.propertyIsEnumerable;
|
|
1180
1179
|
var __defNormalProp$9 = (obj, key, value) => key in obj ? __defProp$9(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
1181
1180
|
var __spreadValues$9 = (a, b) => {
|
|
1182
1181
|
for (var prop in b || (b = {}))
|
|
1183
|
-
if (__hasOwnProp$
|
|
1182
|
+
if (__hasOwnProp$a.call(b, prop))
|
|
1184
1183
|
__defNormalProp$9(a, prop, b[prop]);
|
|
1185
|
-
if (__getOwnPropSymbols$
|
|
1186
|
-
for (var prop of __getOwnPropSymbols$
|
|
1187
|
-
if (__propIsEnum$
|
|
1184
|
+
if (__getOwnPropSymbols$a)
|
|
1185
|
+
for (var prop of __getOwnPropSymbols$a(b)) {
|
|
1186
|
+
if (__propIsEnum$a.call(b, prop))
|
|
1188
1187
|
__defNormalProp$9(a, prop, b[prop]);
|
|
1189
1188
|
}
|
|
1190
1189
|
return a;
|
|
@@ -1371,17 +1370,17 @@ function useScroll(element, options = {}) {
|
|
|
1371
1370
|
var __defProp$8 = Object.defineProperty;
|
|
1372
1371
|
var __defProps$7 = Object.defineProperties;
|
|
1373
1372
|
var __getOwnPropDescs$7 = Object.getOwnPropertyDescriptors;
|
|
1374
|
-
var __getOwnPropSymbols$
|
|
1375
|
-
var __hasOwnProp$
|
|
1376
|
-
var __propIsEnum$
|
|
1373
|
+
var __getOwnPropSymbols$9 = Object.getOwnPropertySymbols;
|
|
1374
|
+
var __hasOwnProp$9 = Object.prototype.hasOwnProperty;
|
|
1375
|
+
var __propIsEnum$9 = Object.prototype.propertyIsEnumerable;
|
|
1377
1376
|
var __defNormalProp$8 = (obj, key, value) => key in obj ? __defProp$8(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
1378
1377
|
var __spreadValues$8 = (a, b) => {
|
|
1379
1378
|
for (var prop in b || (b = {}))
|
|
1380
|
-
if (__hasOwnProp$
|
|
1379
|
+
if (__hasOwnProp$9.call(b, prop))
|
|
1381
1380
|
__defNormalProp$8(a, prop, b[prop]);
|
|
1382
|
-
if (__getOwnPropSymbols$
|
|
1383
|
-
for (var prop of __getOwnPropSymbols$
|
|
1384
|
-
if (__propIsEnum$
|
|
1381
|
+
if (__getOwnPropSymbols$9)
|
|
1382
|
+
for (var prop of __getOwnPropSymbols$9(b)) {
|
|
1383
|
+
if (__propIsEnum$9.call(b, prop))
|
|
1385
1384
|
__defNormalProp$8(a, prop, b[prop]);
|
|
1386
1385
|
}
|
|
1387
1386
|
return a;
|
|
@@ -1476,17 +1475,17 @@ const UseMouseInElement = /* @__PURE__ */ /* #__PURE__ */ vueDemi.defineComponen
|
|
|
1476
1475
|
var __defProp$7 = Object.defineProperty;
|
|
1477
1476
|
var __defProps$6 = Object.defineProperties;
|
|
1478
1477
|
var __getOwnPropDescs$6 = Object.getOwnPropertyDescriptors;
|
|
1479
|
-
var __getOwnPropSymbols$
|
|
1480
|
-
var __hasOwnProp$
|
|
1481
|
-
var __propIsEnum$
|
|
1478
|
+
var __getOwnPropSymbols$8 = Object.getOwnPropertySymbols;
|
|
1479
|
+
var __hasOwnProp$8 = Object.prototype.hasOwnProperty;
|
|
1480
|
+
var __propIsEnum$8 = Object.prototype.propertyIsEnumerable;
|
|
1482
1481
|
var __defNormalProp$7 = (obj, key, value) => key in obj ? __defProp$7(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
1483
1482
|
var __spreadValues$7 = (a, b) => {
|
|
1484
1483
|
for (var prop in b || (b = {}))
|
|
1485
|
-
if (__hasOwnProp$
|
|
1484
|
+
if (__hasOwnProp$8.call(b, prop))
|
|
1486
1485
|
__defNormalProp$7(a, prop, b[prop]);
|
|
1487
|
-
if (__getOwnPropSymbols$
|
|
1488
|
-
for (var prop of __getOwnPropSymbols$
|
|
1489
|
-
if (__propIsEnum$
|
|
1486
|
+
if (__getOwnPropSymbols$8)
|
|
1487
|
+
for (var prop of __getOwnPropSymbols$8(b)) {
|
|
1488
|
+
if (__propIsEnum$8.call(b, prop))
|
|
1490
1489
|
__defNormalProp$7(a, prop, b[prop]);
|
|
1491
1490
|
}
|
|
1492
1491
|
return a;
|
|
@@ -1519,17 +1518,17 @@ const UseNetwork = /* @__PURE__ */ /* #__PURE__ */ vueDemi.defineComponent({
|
|
|
1519
1518
|
var __defProp$6 = Object.defineProperty;
|
|
1520
1519
|
var __defProps$5 = Object.defineProperties;
|
|
1521
1520
|
var __getOwnPropDescs$5 = Object.getOwnPropertyDescriptors;
|
|
1522
|
-
var __getOwnPropSymbols$
|
|
1523
|
-
var __hasOwnProp$
|
|
1524
|
-
var __propIsEnum$
|
|
1521
|
+
var __getOwnPropSymbols$7 = Object.getOwnPropertySymbols;
|
|
1522
|
+
var __hasOwnProp$7 = Object.prototype.hasOwnProperty;
|
|
1523
|
+
var __propIsEnum$7 = Object.prototype.propertyIsEnumerable;
|
|
1525
1524
|
var __defNormalProp$6 = (obj, key, value) => key in obj ? __defProp$6(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
1526
1525
|
var __spreadValues$6 = (a, b) => {
|
|
1527
1526
|
for (var prop in b || (b = {}))
|
|
1528
|
-
if (__hasOwnProp$
|
|
1527
|
+
if (__hasOwnProp$7.call(b, prop))
|
|
1529
1528
|
__defNormalProp$6(a, prop, b[prop]);
|
|
1530
|
-
if (__getOwnPropSymbols$
|
|
1531
|
-
for (var prop of __getOwnPropSymbols$
|
|
1532
|
-
if (__propIsEnum$
|
|
1529
|
+
if (__getOwnPropSymbols$7)
|
|
1530
|
+
for (var prop of __getOwnPropSymbols$7(b)) {
|
|
1531
|
+
if (__propIsEnum$7.call(b, prop))
|
|
1533
1532
|
__defNormalProp$6(a, prop, b[prop]);
|
|
1534
1533
|
}
|
|
1535
1534
|
return a;
|
|
@@ -1565,17 +1564,17 @@ const UseObjectUrl = /* @__PURE__ */ /* #__PURE__ */ vueDemi.defineComponent({
|
|
|
1565
1564
|
var __defProp$5 = Object.defineProperty;
|
|
1566
1565
|
var __defProps$4 = Object.defineProperties;
|
|
1567
1566
|
var __getOwnPropDescs$4 = Object.getOwnPropertyDescriptors;
|
|
1568
|
-
var __getOwnPropSymbols$
|
|
1569
|
-
var __hasOwnProp$
|
|
1570
|
-
var __propIsEnum$
|
|
1567
|
+
var __getOwnPropSymbols$6 = Object.getOwnPropertySymbols;
|
|
1568
|
+
var __hasOwnProp$6 = Object.prototype.hasOwnProperty;
|
|
1569
|
+
var __propIsEnum$6 = Object.prototype.propertyIsEnumerable;
|
|
1571
1570
|
var __defNormalProp$5 = (obj, key, value) => key in obj ? __defProp$5(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
1572
1571
|
var __spreadValues$5 = (a, b) => {
|
|
1573
1572
|
for (var prop in b || (b = {}))
|
|
1574
|
-
if (__hasOwnProp$
|
|
1573
|
+
if (__hasOwnProp$6.call(b, prop))
|
|
1575
1574
|
__defNormalProp$5(a, prop, b[prop]);
|
|
1576
|
-
if (__getOwnPropSymbols$
|
|
1577
|
-
for (var prop of __getOwnPropSymbols$
|
|
1578
|
-
if (__propIsEnum$
|
|
1575
|
+
if (__getOwnPropSymbols$6)
|
|
1576
|
+
for (var prop of __getOwnPropSymbols$6(b)) {
|
|
1577
|
+
if (__propIsEnum$6.call(b, prop))
|
|
1579
1578
|
__defNormalProp$5(a, prop, b[prop]);
|
|
1580
1579
|
}
|
|
1581
1580
|
return a;
|
|
@@ -1650,17 +1649,17 @@ const UsePageLeave = /* @__PURE__ */ /* #__PURE__ */ vueDemi.defineComponent({
|
|
|
1650
1649
|
var __defProp$4 = Object.defineProperty;
|
|
1651
1650
|
var __defProps$3 = Object.defineProperties;
|
|
1652
1651
|
var __getOwnPropDescs$3 = Object.getOwnPropertyDescriptors;
|
|
1653
|
-
var __getOwnPropSymbols$
|
|
1654
|
-
var __hasOwnProp$
|
|
1655
|
-
var __propIsEnum$
|
|
1652
|
+
var __getOwnPropSymbols$5 = Object.getOwnPropertySymbols;
|
|
1653
|
+
var __hasOwnProp$5 = Object.prototype.hasOwnProperty;
|
|
1654
|
+
var __propIsEnum$5 = Object.prototype.propertyIsEnumerable;
|
|
1656
1655
|
var __defNormalProp$4 = (obj, key, value) => key in obj ? __defProp$4(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
1657
1656
|
var __spreadValues$4 = (a, b) => {
|
|
1658
1657
|
for (var prop in b || (b = {}))
|
|
1659
|
-
if (__hasOwnProp$
|
|
1658
|
+
if (__hasOwnProp$5.call(b, prop))
|
|
1660
1659
|
__defNormalProp$4(a, prop, b[prop]);
|
|
1661
|
-
if (__getOwnPropSymbols$
|
|
1662
|
-
for (var prop of __getOwnPropSymbols$
|
|
1663
|
-
if (__propIsEnum$
|
|
1660
|
+
if (__getOwnPropSymbols$5)
|
|
1661
|
+
for (var prop of __getOwnPropSymbols$5(b)) {
|
|
1662
|
+
if (__propIsEnum$5.call(b, prop))
|
|
1664
1663
|
__defNormalProp$4(a, prop, b[prop]);
|
|
1665
1664
|
}
|
|
1666
1665
|
return a;
|
|
@@ -1763,6 +1762,53 @@ const UsePreferredReducedMotion = /* @__PURE__ */ /* #__PURE__ */ vueDemi.define
|
|
|
1763
1762
|
}
|
|
1764
1763
|
});
|
|
1765
1764
|
|
|
1765
|
+
var __getOwnPropSymbols$4 = Object.getOwnPropertySymbols;
|
|
1766
|
+
var __hasOwnProp$4 = Object.prototype.hasOwnProperty;
|
|
1767
|
+
var __propIsEnum$4 = Object.prototype.propertyIsEnumerable;
|
|
1768
|
+
var __objRest = (source, exclude) => {
|
|
1769
|
+
var target = {};
|
|
1770
|
+
for (var prop in source)
|
|
1771
|
+
if (__hasOwnProp$4.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
1772
|
+
target[prop] = source[prop];
|
|
1773
|
+
if (source != null && __getOwnPropSymbols$4)
|
|
1774
|
+
for (var prop of __getOwnPropSymbols$4(source)) {
|
|
1775
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum$4.call(source, prop))
|
|
1776
|
+
target[prop] = source[prop];
|
|
1777
|
+
}
|
|
1778
|
+
return target;
|
|
1779
|
+
};
|
|
1780
|
+
function useMutationObserver(target, callback, options = {}) {
|
|
1781
|
+
const _a = options, { window = defaultWindow } = _a, mutationOptions = __objRest(_a, ["window"]);
|
|
1782
|
+
let observer;
|
|
1783
|
+
const isSupported = useSupported(() => window && "MutationObserver" in window);
|
|
1784
|
+
const cleanup = () => {
|
|
1785
|
+
if (observer) {
|
|
1786
|
+
observer.disconnect();
|
|
1787
|
+
observer = void 0;
|
|
1788
|
+
}
|
|
1789
|
+
};
|
|
1790
|
+
const stopWatch = vueDemi.watch(
|
|
1791
|
+
() => unrefElement(target),
|
|
1792
|
+
(el) => {
|
|
1793
|
+
cleanup();
|
|
1794
|
+
if (isSupported.value && window && el) {
|
|
1795
|
+
observer = new MutationObserver(callback);
|
|
1796
|
+
observer.observe(el, mutationOptions);
|
|
1797
|
+
}
|
|
1798
|
+
},
|
|
1799
|
+
{ immediate: true }
|
|
1800
|
+
);
|
|
1801
|
+
const stop = () => {
|
|
1802
|
+
cleanup();
|
|
1803
|
+
stopWatch();
|
|
1804
|
+
};
|
|
1805
|
+
shared.tryOnScopeDispose(stop);
|
|
1806
|
+
return {
|
|
1807
|
+
isSupported,
|
|
1808
|
+
stop
|
|
1809
|
+
};
|
|
1810
|
+
}
|
|
1811
|
+
|
|
1766
1812
|
function useCssVar(prop, target, options = {}) {
|
|
1767
1813
|
const { window = defaultWindow, initialValue = "", observe = false } = options;
|
|
1768
1814
|
const variable = vueDemi.ref(initialValue);
|
|
@@ -1780,7 +1826,7 @@ function useCssVar(prop, target, options = {}) {
|
|
|
1780
1826
|
}
|
|
1781
1827
|
}
|
|
1782
1828
|
if (observe) {
|
|
1783
|
-
|
|
1829
|
+
useMutationObserver(elRef, updateCssVar, {
|
|
1784
1830
|
attributes: true,
|
|
1785
1831
|
window
|
|
1786
1832
|
});
|