yc-design-vue 1.5.1 → 1.5.3
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/es/Calendar/Calendar.vue.d.ts +1 -1
- package/es/Calendar/index.d.ts +3 -3
- package/es/Layout/hooks/useSiderContext.d.ts +1 -1
- package/es/Layout/hooks/useSiderContext.js +6 -22
- package/es/Layout/hooks/useTheme.d.ts +4 -0
- package/es/Layout/hooks/useTheme.js +34 -0
- package/es/Menu/hooks/useContext.js +8 -12
- package/es/node_modules/@vueuse/core/index.js +4 -319
- package/es/node_modules/@vueuse/shared/index.js +2 -65
- package/es/style.css +1 -1
- package/lib/Calendar/Calendar.vue.d.ts +1 -1
- package/lib/Calendar/index.d.ts +3 -3
- package/lib/Layout/hooks/useSiderContext.d.ts +1 -1
- package/lib/Layout/hooks/useSiderContext.js +1 -1
- package/lib/Layout/hooks/useTheme.d.ts +4 -0
- package/lib/Layout/hooks/useTheme.js +1 -0
- package/lib/Menu/hooks/useContext.js +1 -1
- package/lib/node_modules/@vueuse/core/index.js +1 -1
- package/lib/node_modules/@vueuse/shared/index.js +1 -1
- package/lib/style.css +1 -1
- package/package.json +1 -1
@@ -20,8 +20,8 @@ declare const __VLS_component: import('vue').DefineComponent<CalendarProps, {},
|
|
20
20
|
mode: CalendarMode;
|
21
21
|
modelValue: Date;
|
22
22
|
defaultValue: Date;
|
23
|
-
modes: CalendarMode[];
|
24
23
|
defaultMode: CalendarMode;
|
24
|
+
modes: CalendarMode[];
|
25
25
|
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, HTMLDivElement>;
|
26
26
|
declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
|
27
27
|
export default _default;
|
package/es/Calendar/index.d.ts
CHANGED
@@ -17,8 +17,8 @@ declare const Calendar: {
|
|
17
17
|
mode: import('./type').CalendarMode;
|
18
18
|
modelValue: Date;
|
19
19
|
defaultValue: Date;
|
20
|
-
modes: import('./type').CalendarMode[];
|
21
20
|
defaultMode: import('./type').CalendarMode;
|
21
|
+
modes: import('./type').CalendarMode[];
|
22
22
|
}, false, {}, {}, import('vue').GlobalComponents, import('vue').GlobalDirectives, string, {}, HTMLDivElement, import('vue').ComponentProvideOptions, {
|
23
23
|
P: {};
|
24
24
|
B: {};
|
@@ -35,8 +35,8 @@ declare const Calendar: {
|
|
35
35
|
mode: import('./type').CalendarMode;
|
36
36
|
modelValue: Date;
|
37
37
|
defaultValue: Date;
|
38
|
-
modes: import('./type').CalendarMode[];
|
39
38
|
defaultMode: import('./type').CalendarMode;
|
39
|
+
modes: import('./type').CalendarMode[];
|
40
40
|
}>;
|
41
41
|
__isFragment?: never;
|
42
42
|
__isTeleport?: never;
|
@@ -55,8 +55,8 @@ declare const Calendar: {
|
|
55
55
|
mode: import('./type').CalendarMode;
|
56
56
|
modelValue: Date;
|
57
57
|
defaultValue: Date;
|
58
|
-
modes: import('./type').CalendarMode[];
|
59
58
|
defaultMode: import('./type').CalendarMode;
|
59
|
+
modes: import('./type').CalendarMode[];
|
60
60
|
}, {}, string, {}, import('vue').GlobalComponents, import('vue').GlobalDirectives, string, import('vue').ComponentProvideOptions> & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps & (new () => {
|
61
61
|
$slots: Readonly<import('./type').CalendarSlots> & import('./type').CalendarSlots;
|
62
62
|
}) & {
|
@@ -3,7 +3,7 @@ import { Props, Theme } from '../../_shared/type';
|
|
3
3
|
import { LayoutSiderEmits } from '../type';
|
4
4
|
export declare const LAYOUT_CONTEXT_KEY = "LAYOUT-CONTEXT";
|
5
5
|
export type LayoutContext = {
|
6
|
-
theme: Ref<Theme>;
|
6
|
+
theme: Ref<Theme | undefined>;
|
7
7
|
collapsed: Ref<boolean>;
|
8
8
|
};
|
9
9
|
declare const _default: () => {
|
@@ -1,27 +1,16 @@
|
|
1
1
|
import { toRefs, computed, provide, inject, ref } from "vue";
|
2
2
|
import "../../node_modules/tinycolor2/esm/tinycolor.js";
|
3
3
|
import "../../_shared/utils/dom.js";
|
4
|
-
import { isUndefined } from "../../_shared/utils/is.js";
|
5
4
|
import "../../_shared/utils/time.js";
|
6
5
|
import "../../Empty/index.js";
|
7
6
|
/* empty css */
|
8
7
|
import useControlValue from "../../_shared/utils/control.js";
|
9
|
-
import { useDark } from "../../node_modules/@vueuse/core/index.js";
|
10
8
|
const LAYOUT_CONTEXT_KEY = "LAYOUT-CONTEXT";
|
11
9
|
const useSiderContext = () => {
|
12
|
-
const isDark = useDark({
|
13
|
-
selector: "body",
|
14
|
-
attribute: "yc-design-theme",
|
15
|
-
valueDark: "dark",
|
16
|
-
valueLight: "light",
|
17
|
-
initialValue: "light"
|
18
|
-
});
|
19
10
|
const provide$1 = (props, emits) => {
|
20
|
-
const {
|
21
|
-
|
22
|
-
|
23
|
-
defaultCollapsed
|
24
|
-
} = toRefs(props);
|
11
|
+
const { collapsed, defaultCollapsed, theme } = toRefs(
|
12
|
+
props
|
13
|
+
);
|
25
14
|
const computedCollapsed = useControlValue(
|
26
15
|
collapsed,
|
27
16
|
defaultCollapsed.value,
|
@@ -29,24 +18,19 @@ const useSiderContext = () => {
|
|
29
18
|
emits("update:collapsed", val);
|
30
19
|
}
|
31
20
|
);
|
32
|
-
const
|
33
|
-
if (!isUndefined(_theme.value)) {
|
34
|
-
return _theme.value;
|
35
|
-
}
|
36
|
-
return isDark.value ? "dark" : "light";
|
37
|
-
});
|
21
|
+
const mergeTheme = computed(() => theme.value || "light");
|
38
22
|
provide(LAYOUT_CONTEXT_KEY, {
|
39
23
|
theme,
|
40
24
|
collapsed: computedCollapsed
|
41
25
|
});
|
42
26
|
return {
|
43
|
-
theme,
|
27
|
+
theme: mergeTheme,
|
44
28
|
computedCollapsed
|
45
29
|
};
|
46
30
|
};
|
47
31
|
const inject$1 = () => {
|
48
32
|
return inject(LAYOUT_CONTEXT_KEY, {
|
49
|
-
theme:
|
33
|
+
theme: ref(void 0),
|
50
34
|
collapsed: ref(false)
|
51
35
|
});
|
52
36
|
};
|
@@ -0,0 +1,34 @@
|
|
1
|
+
import { ref, onMounted } from "vue";
|
2
|
+
import { useMutationObserver } from "../../node_modules/@vueuse/core/index.js";
|
3
|
+
const useTheme = () => {
|
4
|
+
const theme = ref("light");
|
5
|
+
onMounted(() => {
|
6
|
+
const value = document.body.getAttribute("yc-design-theme");
|
7
|
+
theme.value = value === "dark" ? "dark" : "light";
|
8
|
+
});
|
9
|
+
useMutationObserver(
|
10
|
+
document.body,
|
11
|
+
(mutationsList) => {
|
12
|
+
for (const mutation of mutationsList) {
|
13
|
+
if (mutation.type === "attributes" && mutation.attributeName === "yc-design-theme") {
|
14
|
+
const value = mutation.target.getAttribute(
|
15
|
+
"yc-design-theme"
|
16
|
+
);
|
17
|
+
theme.value = value === "dark" ? "dark" : "light";
|
18
|
+
console.log(theme.value, "theme");
|
19
|
+
}
|
20
|
+
}
|
21
|
+
},
|
22
|
+
{
|
23
|
+
attributes: true,
|
24
|
+
// 明确告诉 MutationObserver 我们要监听属性的变化
|
25
|
+
attributeFilter: ["yc-design-theme"]
|
26
|
+
}
|
27
|
+
);
|
28
|
+
return {
|
29
|
+
theme
|
30
|
+
};
|
31
|
+
};
|
32
|
+
export {
|
33
|
+
useTheme as default
|
34
|
+
};
|
@@ -8,8 +8,9 @@ import "../../Empty/index.js";
|
|
8
8
|
import useControlValue from "../../_shared/utils/control.js";
|
9
9
|
import "../index.js";
|
10
10
|
import { nanoid } from "../../node_modules/nanoid/index.browser.js";
|
11
|
-
import { useResizeObserver
|
11
|
+
import { useResizeObserver } from "../../node_modules/@vueuse/core/index.js";
|
12
12
|
import useSiderContext from "../../Layout/hooks/useSiderContext.js";
|
13
|
+
import useTheme from "../../Layout/hooks/useTheme.js";
|
13
14
|
import SubMenu from "../SubMenu.vue.js";
|
14
15
|
import MenuItem from "../MenuItem.vue.js";
|
15
16
|
const MENU_CONTEXT_KEY = "menu-context";
|
@@ -115,6 +116,7 @@ const getPopupMaxHeight = (popupMaxHeight) => {
|
|
115
116
|
}
|
116
117
|
};
|
117
118
|
const useMenuContext = () => {
|
119
|
+
const { theme: sysTheme } = useTheme();
|
118
120
|
const provide$1 = (props, emits, menuRef) => {
|
119
121
|
const {
|
120
122
|
selectedKeys,
|
@@ -137,7 +139,7 @@ const useMenuContext = () => {
|
|
137
139
|
theme: _theme,
|
138
140
|
popupMaxHeight: _popupMaxHeight
|
139
141
|
} = toRefs(props);
|
140
|
-
const { theme:
|
142
|
+
const { theme: siderTheme, collapsed: injectCollapsed } = useSiderContext().inject();
|
141
143
|
const computedSelectedKeys = useControlValue(
|
142
144
|
selectedKeys,
|
143
145
|
defaultSelectedKeys.value,
|
@@ -179,7 +181,9 @@ const useMenuContext = () => {
|
|
179
181
|
const menuItemWidths = ref([]);
|
180
182
|
const menuTree = computed(() => buildMenuTree(menuTreeNodes.value));
|
181
183
|
const max = ref(1e6);
|
182
|
-
const theme = computed(() =>
|
184
|
+
const theme = computed(() => {
|
185
|
+
return _theme.value || siderTheme.value || sysTheme.value;
|
186
|
+
});
|
183
187
|
if (mode.value == "horizontal") {
|
184
188
|
useResizeObserver(
|
185
189
|
menuRef,
|
@@ -231,14 +235,6 @@ const useMenuContext = () => {
|
|
231
235
|
};
|
232
236
|
};
|
233
237
|
const inject$1 = () => {
|
234
|
-
const isDark = useDark({
|
235
|
-
selector: "body",
|
236
|
-
attribute: "yc-design-theme",
|
237
|
-
valueDark: "dark",
|
238
|
-
valueLight: "light",
|
239
|
-
initialValue: "light"
|
240
|
-
});
|
241
|
-
console.log(isDark.value, "isDark");
|
242
238
|
return inject(MENU_CONTEXT_KEY, {
|
243
239
|
computedSelectedKeys: ref(""),
|
244
240
|
computedOpenKeys: ref([]),
|
@@ -250,7 +246,7 @@ const useMenuContext = () => {
|
|
250
246
|
triggerProps: ref({}),
|
251
247
|
autoOpenSelected: ref(false),
|
252
248
|
mode: ref("vertical"),
|
253
|
-
theme:
|
249
|
+
theme: sysTheme,
|
254
250
|
popupMaxHeight: ref(),
|
255
251
|
autoScrollIntoView: ref(false),
|
256
252
|
scrollConfig: ref({}),
|
@@ -1,6 +1,6 @@
|
|
1
|
-
import { tryOnScopeDispose, toArray, watchImmediate, isClient, isObject, makeDestructurable, camelize, tryOnMounted, toRefs, noop, isIOS, notNullish, useThrottleFn, useDebounceFn, pxValue,
|
2
|
-
import {
|
3
|
-
import { computed, toValue, watch, shallowRef, getCurrentInstance, onMounted, unref, defineComponent, ref, reactive, watchEffect, hasInjectionContext,
|
1
|
+
import { tryOnScopeDispose, toArray, watchImmediate, isClient, isObject, makeDestructurable, camelize, tryOnMounted, toRefs, noop, isIOS, notNullish, useThrottleFn, useDebounceFn, pxValue, injectLocal, useTimeoutFn, createSingletonPromise } from "../shared/index.js";
|
2
|
+
import { createFilterWrapper, debounceFilter, getLifeCycleTarget, throttleFilter } from "../shared/index.js";
|
3
|
+
import { computed, toValue, watch, shallowRef, getCurrentInstance, onMounted, unref, defineComponent, ref, reactive, watchEffect, hasInjectionContext, toRaw } from "vue";
|
4
4
|
function createReusableTemplate(options = {}) {
|
5
5
|
const {
|
6
6
|
inheritAttrs = true
|
@@ -439,308 +439,6 @@ function useClipboard(options = {}) {
|
|
439
439
|
copy
|
440
440
|
};
|
441
441
|
}
|
442
|
-
const _global = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
|
443
|
-
const globalKey = "__vueuse_ssr_handlers__";
|
444
|
-
const handlers = /* @__PURE__ */ getHandlers();
|
445
|
-
function getHandlers() {
|
446
|
-
if (!(globalKey in _global))
|
447
|
-
_global[globalKey] = _global[globalKey] || {};
|
448
|
-
return _global[globalKey];
|
449
|
-
}
|
450
|
-
function getSSRHandler(key, fallback) {
|
451
|
-
return handlers[key] || fallback;
|
452
|
-
}
|
453
|
-
function usePreferredDark(options) {
|
454
|
-
return useMediaQuery("(prefers-color-scheme: dark)", options);
|
455
|
-
}
|
456
|
-
function guessSerializerType(rawInit) {
|
457
|
-
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";
|
458
|
-
}
|
459
|
-
const StorageSerializers = {
|
460
|
-
boolean: {
|
461
|
-
read: (v) => v === "true",
|
462
|
-
write: (v) => String(v)
|
463
|
-
},
|
464
|
-
object: {
|
465
|
-
read: (v) => JSON.parse(v),
|
466
|
-
write: (v) => JSON.stringify(v)
|
467
|
-
},
|
468
|
-
number: {
|
469
|
-
read: (v) => Number.parseFloat(v),
|
470
|
-
write: (v) => String(v)
|
471
|
-
},
|
472
|
-
any: {
|
473
|
-
read: (v) => v,
|
474
|
-
write: (v) => String(v)
|
475
|
-
},
|
476
|
-
string: {
|
477
|
-
read: (v) => v,
|
478
|
-
write: (v) => String(v)
|
479
|
-
},
|
480
|
-
map: {
|
481
|
-
read: (v) => new Map(JSON.parse(v)),
|
482
|
-
write: (v) => JSON.stringify(Array.from(v.entries()))
|
483
|
-
},
|
484
|
-
set: {
|
485
|
-
read: (v) => new Set(JSON.parse(v)),
|
486
|
-
write: (v) => JSON.stringify(Array.from(v))
|
487
|
-
},
|
488
|
-
date: {
|
489
|
-
read: (v) => new Date(v),
|
490
|
-
write: (v) => v.toISOString()
|
491
|
-
}
|
492
|
-
};
|
493
|
-
const customStorageEventName = "vueuse-storage";
|
494
|
-
function useStorage(key, defaults, storage, options = {}) {
|
495
|
-
var _a;
|
496
|
-
const {
|
497
|
-
flush = "pre",
|
498
|
-
deep = true,
|
499
|
-
listenToStorageChanges = true,
|
500
|
-
writeDefaults = true,
|
501
|
-
mergeDefaults = false,
|
502
|
-
shallow,
|
503
|
-
window: window2 = defaultWindow,
|
504
|
-
eventFilter,
|
505
|
-
onError = (e) => {
|
506
|
-
console.error(e);
|
507
|
-
},
|
508
|
-
initOnMounted
|
509
|
-
} = options;
|
510
|
-
const data = (shallow ? shallowRef : ref)(typeof defaults === "function" ? defaults() : defaults);
|
511
|
-
const keyComputed = computed(() => toValue(key));
|
512
|
-
if (!storage) {
|
513
|
-
try {
|
514
|
-
storage = getSSRHandler("getDefaultStorage", () => {
|
515
|
-
var _a2;
|
516
|
-
return (_a2 = defaultWindow) == null ? void 0 : _a2.localStorage;
|
517
|
-
})();
|
518
|
-
} catch (e) {
|
519
|
-
onError(e);
|
520
|
-
}
|
521
|
-
}
|
522
|
-
if (!storage)
|
523
|
-
return data;
|
524
|
-
const rawInit = toValue(defaults);
|
525
|
-
const type = guessSerializerType(rawInit);
|
526
|
-
const serializer = (_a = options.serializer) != null ? _a : StorageSerializers[type];
|
527
|
-
const { pause: pauseWatch, resume: resumeWatch } = watchPausable(
|
528
|
-
data,
|
529
|
-
() => write(data.value),
|
530
|
-
{ flush, deep, eventFilter }
|
531
|
-
);
|
532
|
-
watch(keyComputed, () => update(), { flush });
|
533
|
-
if (window2 && listenToStorageChanges) {
|
534
|
-
tryOnMounted(() => {
|
535
|
-
if (storage instanceof Storage)
|
536
|
-
useEventListener(window2, "storage", update, { passive: true });
|
537
|
-
else
|
538
|
-
useEventListener(window2, customStorageEventName, updateFromCustomEvent);
|
539
|
-
if (initOnMounted)
|
540
|
-
update();
|
541
|
-
});
|
542
|
-
}
|
543
|
-
if (!initOnMounted)
|
544
|
-
update();
|
545
|
-
function dispatchWriteEvent(oldValue, newValue) {
|
546
|
-
if (window2) {
|
547
|
-
const payload = {
|
548
|
-
key: keyComputed.value,
|
549
|
-
oldValue,
|
550
|
-
newValue,
|
551
|
-
storageArea: storage
|
552
|
-
};
|
553
|
-
window2.dispatchEvent(storage instanceof Storage ? new StorageEvent("storage", payload) : new CustomEvent(customStorageEventName, {
|
554
|
-
detail: payload
|
555
|
-
}));
|
556
|
-
}
|
557
|
-
}
|
558
|
-
function write(v) {
|
559
|
-
try {
|
560
|
-
const oldValue = storage.getItem(keyComputed.value);
|
561
|
-
if (v == null) {
|
562
|
-
dispatchWriteEvent(oldValue, null);
|
563
|
-
storage.removeItem(keyComputed.value);
|
564
|
-
} else {
|
565
|
-
const serialized = serializer.write(v);
|
566
|
-
if (oldValue !== serialized) {
|
567
|
-
storage.setItem(keyComputed.value, serialized);
|
568
|
-
dispatchWriteEvent(oldValue, serialized);
|
569
|
-
}
|
570
|
-
}
|
571
|
-
} catch (e) {
|
572
|
-
onError(e);
|
573
|
-
}
|
574
|
-
}
|
575
|
-
function read(event) {
|
576
|
-
const rawValue = event ? event.newValue : storage.getItem(keyComputed.value);
|
577
|
-
if (rawValue == null) {
|
578
|
-
if (writeDefaults && rawInit != null)
|
579
|
-
storage.setItem(keyComputed.value, serializer.write(rawInit));
|
580
|
-
return rawInit;
|
581
|
-
} else if (!event && mergeDefaults) {
|
582
|
-
const value = serializer.read(rawValue);
|
583
|
-
if (typeof mergeDefaults === "function")
|
584
|
-
return mergeDefaults(value, rawInit);
|
585
|
-
else if (type === "object" && !Array.isArray(value))
|
586
|
-
return { ...rawInit, ...value };
|
587
|
-
return value;
|
588
|
-
} else if (typeof rawValue !== "string") {
|
589
|
-
return rawValue;
|
590
|
-
} else {
|
591
|
-
return serializer.read(rawValue);
|
592
|
-
}
|
593
|
-
}
|
594
|
-
function update(event) {
|
595
|
-
if (event && event.storageArea !== storage)
|
596
|
-
return;
|
597
|
-
if (event && event.key == null) {
|
598
|
-
data.value = rawInit;
|
599
|
-
return;
|
600
|
-
}
|
601
|
-
if (event && event.key !== keyComputed.value)
|
602
|
-
return;
|
603
|
-
pauseWatch();
|
604
|
-
try {
|
605
|
-
if ((event == null ? void 0 : event.newValue) !== serializer.write(data.value))
|
606
|
-
data.value = read(event);
|
607
|
-
} catch (e) {
|
608
|
-
onError(e);
|
609
|
-
} finally {
|
610
|
-
if (event)
|
611
|
-
nextTick(resumeWatch);
|
612
|
-
else
|
613
|
-
resumeWatch();
|
614
|
-
}
|
615
|
-
}
|
616
|
-
function updateFromCustomEvent(event) {
|
617
|
-
update(event.detail);
|
618
|
-
}
|
619
|
-
return data;
|
620
|
-
}
|
621
|
-
const CSS_DISABLE_TRANS = "*,*::before,*::after{-webkit-transition:none!important;-moz-transition:none!important;-o-transition:none!important;-ms-transition:none!important;transition:none!important}";
|
622
|
-
function useColorMode(options = {}) {
|
623
|
-
const {
|
624
|
-
selector = "html",
|
625
|
-
attribute = "class",
|
626
|
-
initialValue = "auto",
|
627
|
-
window: window2 = defaultWindow,
|
628
|
-
storage,
|
629
|
-
storageKey = "vueuse-color-scheme",
|
630
|
-
listenToStorageChanges = true,
|
631
|
-
storageRef,
|
632
|
-
emitAuto,
|
633
|
-
disableTransition = true
|
634
|
-
} = options;
|
635
|
-
const modes = {
|
636
|
-
auto: "",
|
637
|
-
light: "light",
|
638
|
-
dark: "dark",
|
639
|
-
...options.modes || {}
|
640
|
-
};
|
641
|
-
const preferredDark = usePreferredDark({ window: window2 });
|
642
|
-
const system = computed(() => preferredDark.value ? "dark" : "light");
|
643
|
-
const store = storageRef || (storageKey == null ? toRef(initialValue) : useStorage(storageKey, initialValue, storage, { window: window2, listenToStorageChanges }));
|
644
|
-
const state = computed(() => store.value === "auto" ? system.value : store.value);
|
645
|
-
const updateHTMLAttrs = getSSRHandler(
|
646
|
-
"updateHTMLAttrs",
|
647
|
-
(selector2, attribute2, value) => {
|
648
|
-
const el = typeof selector2 === "string" ? window2 == null ? void 0 : window2.document.querySelector(selector2) : unrefElement(selector2);
|
649
|
-
if (!el)
|
650
|
-
return;
|
651
|
-
const classesToAdd = /* @__PURE__ */ new Set();
|
652
|
-
const classesToRemove = /* @__PURE__ */ new Set();
|
653
|
-
let attributeToChange = null;
|
654
|
-
if (attribute2 === "class") {
|
655
|
-
const current = value.split(/\s/g);
|
656
|
-
Object.values(modes).flatMap((i) => (i || "").split(/\s/g)).filter(Boolean).forEach((v) => {
|
657
|
-
if (current.includes(v))
|
658
|
-
classesToAdd.add(v);
|
659
|
-
else
|
660
|
-
classesToRemove.add(v);
|
661
|
-
});
|
662
|
-
} else {
|
663
|
-
attributeToChange = { key: attribute2, value };
|
664
|
-
}
|
665
|
-
if (classesToAdd.size === 0 && classesToRemove.size === 0 && attributeToChange === null)
|
666
|
-
return;
|
667
|
-
let style;
|
668
|
-
if (disableTransition) {
|
669
|
-
style = window2.document.createElement("style");
|
670
|
-
style.appendChild(document.createTextNode(CSS_DISABLE_TRANS));
|
671
|
-
window2.document.head.appendChild(style);
|
672
|
-
}
|
673
|
-
for (const c of classesToAdd) {
|
674
|
-
el.classList.add(c);
|
675
|
-
}
|
676
|
-
for (const c of classesToRemove) {
|
677
|
-
el.classList.remove(c);
|
678
|
-
}
|
679
|
-
if (attributeToChange) {
|
680
|
-
el.setAttribute(attributeToChange.key, attributeToChange.value);
|
681
|
-
}
|
682
|
-
if (disableTransition) {
|
683
|
-
window2.getComputedStyle(style).opacity;
|
684
|
-
document.head.removeChild(style);
|
685
|
-
}
|
686
|
-
}
|
687
|
-
);
|
688
|
-
function defaultOnChanged(mode) {
|
689
|
-
var _a;
|
690
|
-
updateHTMLAttrs(selector, attribute, (_a = modes[mode]) != null ? _a : mode);
|
691
|
-
}
|
692
|
-
function onChanged(mode) {
|
693
|
-
if (options.onChanged)
|
694
|
-
options.onChanged(mode, defaultOnChanged);
|
695
|
-
else
|
696
|
-
defaultOnChanged(mode);
|
697
|
-
}
|
698
|
-
watch(state, onChanged, { flush: "post", immediate: true });
|
699
|
-
tryOnMounted(() => onChanged(state.value));
|
700
|
-
const auto = computed({
|
701
|
-
get() {
|
702
|
-
return emitAuto ? store.value : state.value;
|
703
|
-
},
|
704
|
-
set(v) {
|
705
|
-
store.value = v;
|
706
|
-
}
|
707
|
-
});
|
708
|
-
return Object.assign(auto, { store, system, state });
|
709
|
-
}
|
710
|
-
function useDark(options = {}) {
|
711
|
-
const {
|
712
|
-
valueDark = "dark",
|
713
|
-
valueLight = ""
|
714
|
-
} = options;
|
715
|
-
const mode = useColorMode({
|
716
|
-
...options,
|
717
|
-
onChanged: (mode2, defaultHandler) => {
|
718
|
-
var _a;
|
719
|
-
if (options.onChanged)
|
720
|
-
(_a = options.onChanged) == null ? void 0 : _a.call(options, mode2 === "dark", defaultHandler, mode2);
|
721
|
-
else
|
722
|
-
defaultHandler(mode2);
|
723
|
-
},
|
724
|
-
modes: {
|
725
|
-
dark: valueDark,
|
726
|
-
light: valueLight
|
727
|
-
}
|
728
|
-
});
|
729
|
-
const system = computed(() => mode.system.value);
|
730
|
-
const isDark = computed({
|
731
|
-
get() {
|
732
|
-
return mode.value === "dark";
|
733
|
-
},
|
734
|
-
set(v) {
|
735
|
-
const modeVal = v ? "dark" : "light";
|
736
|
-
if (system.value === modeVal)
|
737
|
-
mode.value = "auto";
|
738
|
-
else
|
739
|
-
mode.value = modeVal;
|
740
|
-
}
|
741
|
-
});
|
742
|
-
return isDark;
|
743
|
-
}
|
744
442
|
function useDraggable(target, options = {}) {
|
745
443
|
var _a;
|
746
444
|
const {
|
@@ -1352,18 +1050,14 @@ function useVerticalVirtualList(options, list) {
|
|
1352
1050
|
};
|
1353
1051
|
}
|
1354
1052
|
export {
|
1355
|
-
StorageSerializers,
|
1356
|
-
bypassFilter,
|
1357
1053
|
camelize,
|
1358
1054
|
createFilterWrapper,
|
1359
1055
|
createReusableTemplate,
|
1360
1056
|
createSingletonPromise,
|
1361
|
-
customStorageEventName,
|
1362
1057
|
debounceFilter,
|
1363
1058
|
defaultNavigator,
|
1364
1059
|
defaultWindow,
|
1365
1060
|
getLifeCycleTarget,
|
1366
|
-
getSSRHandler,
|
1367
1061
|
injectLocal,
|
1368
1062
|
isClient,
|
1369
1063
|
isIOS,
|
@@ -1373,19 +1067,14 @@ export {
|
|
1373
1067
|
notNullish,
|
1374
1068
|
onClickOutside,
|
1375
1069
|
onKeyStroke,
|
1376
|
-
pausableFilter,
|
1377
|
-
watchPausable as pausableWatch,
|
1378
1070
|
pxValue,
|
1379
1071
|
throttleFilter,
|
1380
1072
|
toArray,
|
1381
|
-
toRef,
|
1382
1073
|
toRefs,
|
1383
1074
|
tryOnMounted,
|
1384
1075
|
tryOnScopeDispose,
|
1385
1076
|
unrefElement,
|
1386
1077
|
useClipboard,
|
1387
|
-
useColorMode,
|
1388
|
-
useDark,
|
1389
1078
|
useDebounceFn,
|
1390
1079
|
useDraggable,
|
1391
1080
|
useElementBounding,
|
@@ -1395,16 +1084,12 @@ export {
|
|
1395
1084
|
useMounted,
|
1396
1085
|
useMutationObserver,
|
1397
1086
|
usePermission,
|
1398
|
-
usePreferredDark,
|
1399
1087
|
useResizeObserver,
|
1400
1088
|
useSSRWidth,
|
1401
1089
|
useScroll,
|
1402
|
-
useStorage,
|
1403
1090
|
useSupported,
|
1404
1091
|
useThrottleFn,
|
1405
1092
|
useTimeoutFn,
|
1406
1093
|
useVirtualList,
|
1407
|
-
watchImmediate
|
1408
|
-
watchPausable,
|
1409
|
-
watchWithFilter
|
1094
|
+
watchImmediate
|
1410
1095
|
};
|