@una-ui/nuxt 0.61.0 → 1.0.0-alpha.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/dist/module.d.mts +2 -2
- package/dist/module.json +1 -1
- package/dist/module.mjs +5 -3
- package/dist/runtime/components/alert/Alert.vue +94 -0
- package/dist/runtime/components/alert/Alert.vue.d.ts +32 -0
- package/dist/runtime/components/alert/AlertClose.vue +58 -0
- package/dist/runtime/components/alert/AlertClose.vue.d.ts +18 -0
- package/dist/runtime/components/alert/AlertDescription.vue +22 -0
- package/dist/runtime/components/alert/AlertDescription.vue.d.ts +15 -0
- package/dist/runtime/components/alert/AlertTitle.vue +22 -0
- package/dist/runtime/components/alert/AlertTitle.vue.d.ts +15 -0
- package/dist/runtime/components/alert-dialog/AlertDialog.vue +2 -2
- package/dist/runtime/components/alert-dialog/AlertDialog.vue.d.ts +1 -0
- package/dist/runtime/components/alert-dialog/AlertDialogCancel.vue +1 -1
- package/dist/runtime/components/alert-dialog/AlertDialogContent.vue +2 -2
- package/dist/runtime/components/alert-dialog/AlertDialogContent.vue.d.ts +1 -0
- package/dist/runtime/components/aspect-ratio/AspectRatio.vue.d.ts +1 -1
- package/dist/runtime/components/combobox/Combobox.vue +2 -1
- package/dist/runtime/components/combobox/ComboboxTrigger.vue +1 -1
- package/dist/runtime/components/elements/Button.vue.d.ts +3 -3
- package/dist/runtime/components/elements/Skeleton.vue +1 -1
- package/dist/runtime/components/elements/Skeleton.vue.d.ts +3 -1
- package/dist/runtime/components/elements/avatar/Avatar.vue +17 -15
- package/dist/runtime/components/elements/avatar/Avatar.vue.d.ts +6 -4
- package/dist/runtime/components/elements/card/Card.vue +15 -4
- package/dist/runtime/components/elements/card/Card.vue.d.ts +6 -4
- package/dist/runtime/components/elements/card/CardAction.vue +19 -0
- package/dist/runtime/components/elements/card/CardAction.vue.d.ts +13 -0
- package/dist/runtime/components/elements/card/CardContent.vue +1 -0
- package/dist/runtime/components/elements/card/CardDescription.vue +1 -0
- package/dist/runtime/components/elements/card/CardFooter.vue +1 -0
- package/dist/runtime/components/elements/card/CardHeader.vue +1 -0
- package/dist/runtime/components/elements/card/CardTitle.vue +1 -0
- package/dist/runtime/components/elements/dialog/Dialog.vue +73 -62
- package/dist/runtime/components/elements/dialog/Dialog.vue.d.ts +12 -9
- package/dist/runtime/components/elements/dialog/DialogClose.vue +1 -0
- package/dist/runtime/components/elements/dialog/DialogClose.vue.d.ts +1 -1
- package/dist/runtime/components/elements/dialog/DialogContent.vue +3 -2
- package/dist/runtime/components/elements/dialog/DialogContent.vue.d.ts +1 -0
- package/dist/runtime/components/elements/dialog/DialogDescription.vue +1 -0
- package/dist/runtime/components/elements/dialog/DialogFooter.vue +1 -0
- package/dist/runtime/components/elements/dialog/DialogHeader.vue +1 -0
- package/dist/runtime/components/elements/dialog/DialogOverlay.vue +1 -0
- package/dist/runtime/components/elements/dialog/DialogScrollContent.vue +2 -2
- package/dist/runtime/components/elements/dialog/DialogScrollContent.vue.d.ts +1 -0
- package/dist/runtime/components/elements/dialog/DialogTitle.vue +1 -0
- package/dist/runtime/components/elements/dialog/DialogTrigger.vue +16 -0
- package/dist/runtime/components/elements/dialog/DialogTrigger.vue.d.ts +13 -0
- package/dist/runtime/components/elements/dropdown-menu/DropdownMenuItem.vue.d.ts +1 -1
- package/dist/runtime/components/elements/pagination/PaginationFirst.vue.d.ts +1 -1
- package/dist/runtime/components/elements/pagination/PaginationLast.vue.d.ts +1 -1
- package/dist/runtime/components/elements/pagination/PaginationNext.vue.d.ts +1 -1
- package/dist/runtime/components/elements/pagination/PaginationPrev.vue.d.ts +1 -1
- package/dist/runtime/components/elements/tabs/TabsTrigger.vue +2 -2
- package/dist/runtime/components/elements/tabs/TabsTrigger.vue.d.ts +1 -0
- package/dist/runtime/components/forms/Checkbox.vue +2 -2
- package/dist/runtime/components/forms/Checkbox.vue.d.ts +2 -0
- package/dist/runtime/components/forms/FormGroup.vue +1 -1
- package/dist/runtime/components/forms/Input.vue.d.ts +6 -6
- package/dist/runtime/components/forms/Slider.vue +12 -11
- package/dist/runtime/components/forms/Slider.vue.d.ts +1 -0
- package/dist/runtime/components/forms/form/FormField.vue +1 -1
- package/dist/runtime/components/forms/radio-group/RadioGroupItem.vue.d.ts +1 -1
- package/dist/runtime/components/forms/select/SelectTrigger.vue +1 -1
- package/dist/runtime/components/misc/ThemeSwitcher.vue +101 -32
- package/dist/runtime/components/navigation/breadcrumb/BreadcrumbEllipsis.vue.d.ts +1 -1
- package/dist/runtime/components/navigation/breadcrumb/BreadcrumbPage.vue +1 -1
- package/dist/runtime/components/navigation/breadcrumb/BreadcrumbSeparator.vue.d.ts +1 -1
- package/dist/runtime/components/navigation-menu/NavigationMenuLink.vue.d.ts +1 -1
- package/dist/runtime/components/navigation-menu/NavigationMenuTrigger.vue.d.ts +1 -1
- package/dist/runtime/components/number-field/NumberField.vue.d.ts +1 -1
- package/dist/runtime/components/number-field/NumberFieldDecrement.vue.d.ts +1 -1
- package/dist/runtime/components/number-field/NumberFieldIncrement.vue.d.ts +1 -1
- package/dist/runtime/components/overlays/toast/ToastAction.vue.d.ts +1 -1
- package/dist/runtime/components/scroll-area/ScrollArea.vue.d.ts +1 -1
- package/dist/runtime/components/sheet/Sheet.vue +11 -5
- package/dist/runtime/components/sheet/Sheet.vue.d.ts +7 -4
- package/dist/runtime/components/sheet/SheetClose.vue +1 -0
- package/dist/runtime/components/sheet/SheetContent.vue +6 -5
- package/dist/runtime/components/sheet/SheetContent.vue.d.ts +4 -2
- package/dist/runtime/components/sheet/SheetDescription.vue +1 -0
- package/dist/runtime/components/sheet/SheetFooter.vue +1 -0
- package/dist/runtime/components/sheet/SheetHeader.vue +1 -0
- package/dist/runtime/components/sheet/SheetOverlay.vue +23 -0
- package/dist/runtime/components/sheet/SheetOverlay.vue.d.ts +12 -0
- package/dist/runtime/components/sheet/SheetTitle.vue +1 -0
- package/dist/runtime/components/sheet/SheetTrigger.vue +4 -1
- package/dist/runtime/components/sidebar/Sidebar.vue +8 -3
- package/dist/runtime/components/sidebar/SidebarContent.vue +1 -0
- package/dist/runtime/components/sidebar/SidebarFooter.vue +1 -0
- package/dist/runtime/components/sidebar/SidebarGroup.vue +1 -0
- package/dist/runtime/components/sidebar/SidebarGroupAction.vue +1 -0
- package/dist/runtime/components/sidebar/SidebarGroupContent.vue +1 -0
- package/dist/runtime/components/sidebar/SidebarGroupLabel.vue +1 -0
- package/dist/runtime/components/sidebar/SidebarHeader.vue +1 -0
- package/dist/runtime/components/sidebar/SidebarInput.vue +1 -0
- package/dist/runtime/components/sidebar/SidebarInset.vue +1 -0
- package/dist/runtime/components/sidebar/SidebarMenu.vue +1 -0
- package/dist/runtime/components/sidebar/SidebarMenuAction.vue +1 -0
- package/dist/runtime/components/sidebar/SidebarMenuBadge.vue +1 -0
- package/dist/runtime/components/sidebar/SidebarMenuButton.vue.d.ts +1 -1
- package/dist/runtime/components/sidebar/SidebarMenuButtonChild.vue +1 -0
- package/dist/runtime/components/sidebar/SidebarMenuButtonChild.vue.d.ts +1 -1
- package/dist/runtime/components/sidebar/SidebarMenuItem.vue +1 -0
- package/dist/runtime/components/sidebar/SidebarMenuSkeleton.vue +1 -0
- package/dist/runtime/components/sidebar/SidebarMenuSub.vue +1 -0
- package/dist/runtime/components/sidebar/SidebarMenuSubButton.vue +3 -1
- package/dist/runtime/components/sidebar/SidebarMenuSubButton.vue.d.ts +1 -1
- package/dist/runtime/components/sidebar/SidebarMenuSubItem.vue +2 -0
- package/dist/runtime/components/sidebar/SidebarProvider.vue +1 -0
- package/dist/runtime/components/sidebar/SidebarRail.vue +1 -0
- package/dist/runtime/components/sidebar/SidebarSeparator.vue +1 -0
- package/dist/runtime/components/sidebar/SidebarTrigger.vue +1 -0
- package/dist/runtime/composables/useUnaSettings.js +22 -9
- package/dist/runtime/composables/useUnaThemes.d.ts +5 -5
- package/dist/runtime/composables/useUnaThemes.js +48 -98
- package/dist/runtime/plugins/theme.client.js +13 -0
- package/dist/runtime/plugins/theme.server.js +12 -0
- package/dist/runtime/types/alert-dialog.d.ts +2 -2
- package/dist/runtime/types/alert.d.ts +30 -15
- package/dist/runtime/types/card.d.ts +5 -0
- package/dist/runtime/types/dialog.d.ts +8 -3
- package/dist/runtime/types/index.d.ts +10 -2
- package/dist/runtime/types/sheet.d.ts +2 -2
- package/package.json +9 -9
- package/dist/runtime/components/elements/Alert.vue +0 -127
- package/dist/runtime/components/elements/Alert.vue.d.ts +0 -22
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { reactiveOmit } from "@vueuse/core";
|
|
3
|
+
import { DialogOverlay } from "reka-ui";
|
|
4
|
+
import { cn } from "../../utils";
|
|
5
|
+
const props = defineProps({
|
|
6
|
+
class: { type: null, required: false },
|
|
7
|
+
una: { type: Object, required: false },
|
|
8
|
+
forceMount: { type: Boolean, required: false },
|
|
9
|
+
asChild: { type: Boolean, required: false },
|
|
10
|
+
as: { type: null, required: false }
|
|
11
|
+
});
|
|
12
|
+
const delegatedProps = reactiveOmit(props, "class");
|
|
13
|
+
</script>
|
|
14
|
+
|
|
15
|
+
<template>
|
|
16
|
+
<DialogOverlay
|
|
17
|
+
data-slot="sheet-overlay"
|
|
18
|
+
:class="cn('dialog-overlay', props.una?.sheetOverlay, props.class)"
|
|
19
|
+
v-bind="delegatedProps"
|
|
20
|
+
>
|
|
21
|
+
<slot />
|
|
22
|
+
</DialogOverlay>
|
|
23
|
+
</template>
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
declare var __VLS_6: {};
|
|
2
|
+
type __VLS_Slots = {} & {
|
|
3
|
+
default?: (props: typeof __VLS_6) => any;
|
|
4
|
+
};
|
|
5
|
+
declare const __VLS_component: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
6
|
+
declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
|
|
7
|
+
export default _default;
|
|
8
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
9
|
+
new (): {
|
|
10
|
+
$slots: S;
|
|
11
|
+
};
|
|
12
|
+
};
|
|
@@ -44,6 +44,7 @@ const [DefineSlot, ReuseSlot] = createReusableTemplate();
|
|
|
44
44
|
|
|
45
45
|
<div
|
|
46
46
|
v-if="collapsible === 'none'"
|
|
47
|
+
data-slot="sidebar"
|
|
47
48
|
:class="cn(
|
|
48
49
|
'sidebar-collapsible-none',
|
|
49
50
|
props.una?.sidebar,
|
|
@@ -59,6 +60,7 @@ const [DefineSlot, ReuseSlot] = createReusableTemplate();
|
|
|
59
60
|
:open="openMobile"
|
|
60
61
|
v-bind="$attrs"
|
|
61
62
|
:_sheet-content="{
|
|
63
|
+
dataSlot: 'sidebar',
|
|
62
64
|
dataSidebar: 'sidebar',
|
|
63
65
|
dataMobile: true,
|
|
64
66
|
sheet,
|
|
@@ -70,13 +72,16 @@ const [DefineSlot, ReuseSlot] = createReusableTemplate();
|
|
|
70
72
|
}"
|
|
71
73
|
@update:open="setOpenMobile"
|
|
72
74
|
>
|
|
73
|
-
<
|
|
74
|
-
<
|
|
75
|
-
|
|
75
|
+
<template #body>
|
|
76
|
+
<div class="sidebar-mobile-inner">
|
|
77
|
+
<ReuseSlot />
|
|
78
|
+
</div>
|
|
79
|
+
</template>
|
|
76
80
|
</Sheet>
|
|
77
81
|
|
|
78
82
|
<div
|
|
79
83
|
v-else :class="cn('group peer sidebar-desktop')"
|
|
84
|
+
data-slot="sidebar"
|
|
80
85
|
:data-state="state"
|
|
81
86
|
:data-collapsible="state === 'collapsed' ? collapsible : ''"
|
|
82
87
|
:data-variant="sidebar"
|
|
@@ -6,8 +6,8 @@ type __VLS_Slots = {} & {
|
|
|
6
6
|
default?: (props: typeof __VLS_17) => any;
|
|
7
7
|
};
|
|
8
8
|
declare const __VLS_component: import("vue").DefineComponent<NSidebarMenuButtonProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<NSidebarMenuButtonProps> & Readonly<{}>, {
|
|
9
|
-
as: import("reka-ui").AsTag | import("vue").Component;
|
|
10
9
|
size: "default" | "sm" | "lg";
|
|
10
|
+
as: import("reka-ui").AsTag | import("vue").Component;
|
|
11
11
|
variant: "default" | "outline";
|
|
12
12
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
13
13
|
declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
|
|
@@ -18,8 +18,8 @@ type __VLS_Slots = {} & {
|
|
|
18
18
|
default?: (props: typeof __VLS_6) => any;
|
|
19
19
|
};
|
|
20
20
|
declare const __VLS_component: import("vue").DefineComponent<NSidebarMenuButtonChildProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<NSidebarMenuButtonChildProps> & Readonly<{}>, {
|
|
21
|
-
as: import("reka-ui").AsTag | import("vue").Component;
|
|
22
21
|
size: "default" | "sm" | "lg";
|
|
22
|
+
as: import("reka-ui").AsTag | import("vue").Component;
|
|
23
23
|
variant: "default" | "outline";
|
|
24
24
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
25
25
|
declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
|
|
@@ -1,18 +1,20 @@
|
|
|
1
1
|
<script setup>
|
|
2
2
|
import { Primitive } from "reka-ui";
|
|
3
3
|
import { cn } from "../../utils";
|
|
4
|
+
import NLink from "../elements/Link.vue";
|
|
4
5
|
const props = defineProps({
|
|
5
6
|
isActive: { type: Boolean, required: false },
|
|
6
7
|
size: { type: String, required: false, default: "md" },
|
|
7
8
|
class: { type: null, required: false },
|
|
8
9
|
una: { type: Object, required: false },
|
|
9
10
|
asChild: { type: Boolean, required: false },
|
|
10
|
-
as: { type: null, required: false, default:
|
|
11
|
+
as: { type: null, required: false, default: NLink }
|
|
11
12
|
});
|
|
12
13
|
</script>
|
|
13
14
|
|
|
14
15
|
<template>
|
|
15
16
|
<Primitive
|
|
17
|
+
data-slot="sidebar-menu-sub-button"
|
|
16
18
|
data-sidebar="menu-sub-button"
|
|
17
19
|
:as="as"
|
|
18
20
|
:as-child="asChild"
|
|
@@ -4,8 +4,8 @@ type __VLS_Slots = {} & {
|
|
|
4
4
|
default?: (props: typeof __VLS_6) => any;
|
|
5
5
|
};
|
|
6
6
|
declare const __VLS_component: import("vue").DefineComponent<NSidebarMenuSubButtonProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<NSidebarMenuSubButtonProps> & Readonly<{}>, {
|
|
7
|
-
as: import("reka-ui").AsTag | import("vue").Component;
|
|
8
7
|
size: "sm" | "md";
|
|
8
|
+
as: import("reka-ui").AsTag | import("vue").Component;
|
|
9
9
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
10
10
|
declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
|
|
11
11
|
export default _default;
|
|
@@ -1,27 +1,40 @@
|
|
|
1
|
-
import { useAppConfig } from "#imports";
|
|
1
|
+
import { useAppConfig, watch } from "#imports";
|
|
2
2
|
import { useStorage } from "@vueuse/core";
|
|
3
3
|
import { defu } from "defu";
|
|
4
|
-
import { watchEffect } from "vue";
|
|
5
4
|
import { useUnaThemes } from "./useUnaThemes.js";
|
|
6
5
|
export function useUnaSettings() {
|
|
7
6
|
const { una } = useAppConfig();
|
|
8
7
|
const { getPrimaryColors, getGrayColors } = useUnaThemes();
|
|
9
8
|
const defaultSettings = {
|
|
10
|
-
primaryColors: getPrimaryColors(una.primary),
|
|
11
|
-
grayColors: getGrayColors(una.gray),
|
|
9
|
+
primaryColors: una.primary ? getPrimaryColors(una.primary) : {},
|
|
10
|
+
grayColors: una.gray ? getGrayColors(una.gray) : {},
|
|
12
11
|
primary: una.primary,
|
|
13
12
|
gray: una.gray,
|
|
14
13
|
radius: una.radius,
|
|
15
|
-
fontSize: una.fontSize
|
|
14
|
+
fontSize: una.fontSize,
|
|
15
|
+
theme: una.theme,
|
|
16
|
+
themes: una.themes
|
|
16
17
|
};
|
|
17
18
|
const settings = useStorage("una-settings", defaultSettings, void 0, {
|
|
18
19
|
mergeDefaults: defu
|
|
19
20
|
});
|
|
20
|
-
|
|
21
|
-
settings.value.
|
|
22
|
-
settings.value.
|
|
23
|
-
|
|
21
|
+
watch(settings, () => {
|
|
22
|
+
console.log("settings.value.primary", settings.value.primary);
|
|
23
|
+
console.log("settings.value.gray", settings.value.gray);
|
|
24
|
+
if (settings.value.primary) {
|
|
25
|
+
settings.value.primaryColors = getPrimaryColors(settings.value.primary);
|
|
26
|
+
}
|
|
27
|
+
if (settings.value.gray) {
|
|
28
|
+
settings.value.grayColors = getGrayColors(settings.value.gray);
|
|
29
|
+
}
|
|
30
|
+
}, { immediate: true, deep: true });
|
|
24
31
|
function reset() {
|
|
32
|
+
if (una.theme) {
|
|
33
|
+
settings.value.theme = una.theme;
|
|
34
|
+
settings.value.primary = false;
|
|
35
|
+
settings.value.gray = false;
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
25
38
|
settings.value.primary = defaultSettings.primary;
|
|
26
39
|
settings.value.gray = defaultSettings.gray;
|
|
27
40
|
settings.value.fontSize = defaultSettings.fontSize;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { Colors } from '../types/index.js';
|
|
2
|
-
export
|
|
2
|
+
export declare function useUnaThemes(): {
|
|
3
3
|
primaryThemes: [string, Colors][];
|
|
4
4
|
grayThemes: [string, Colors][];
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
themes: never[];
|
|
6
|
+
getPrimaryColors: (color: string, defaultColor?: string) => Colors;
|
|
7
|
+
getGrayColors: (color: string, defaultColor?: string) => Colors;
|
|
8
|
+
};
|
|
@@ -1,100 +1,39 @@
|
|
|
1
|
-
import { colors } from "@unocss/preset-
|
|
2
|
-
|
|
3
|
-
const
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
)
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
300: "#f8b4b4",
|
|
33
|
-
400: "#f98080",
|
|
34
|
-
500: "#f05252",
|
|
35
|
-
600: "#e02424",
|
|
36
|
-
700: "#c81e1e",
|
|
37
|
-
800: "#9b1c1c",
|
|
38
|
-
900: "#771d1d",
|
|
39
|
-
950: "#3f0708"
|
|
40
|
-
};
|
|
1
|
+
import { colors } from "@unocss/preset-wind4/colors";
|
|
2
|
+
const filteredPrimaryColors = (() => {
|
|
3
|
+
const primaryColors = Object.fromEntries(
|
|
4
|
+
Object.entries(colors).filter(([key]) => [
|
|
5
|
+
"blue",
|
|
6
|
+
"cyan",
|
|
7
|
+
"sky",
|
|
8
|
+
"amber",
|
|
9
|
+
"yellow",
|
|
10
|
+
"emerald",
|
|
11
|
+
"lime",
|
|
12
|
+
"orange",
|
|
13
|
+
"purple",
|
|
14
|
+
"indigo",
|
|
15
|
+
"pink",
|
|
16
|
+
"tomato",
|
|
17
|
+
"green",
|
|
18
|
+
"fuchsia",
|
|
19
|
+
"violet",
|
|
20
|
+
"rose",
|
|
21
|
+
"red",
|
|
22
|
+
"teal"
|
|
23
|
+
].includes(key)).map(([key, value]) => [
|
|
24
|
+
key,
|
|
25
|
+
Object.fromEntries(
|
|
26
|
+
Object.entries(value).filter(([key2]) => ["50", "100", "200", "300", "400", "500", "600", "700", "800", "900", "950"].includes(key2))
|
|
27
|
+
)
|
|
28
|
+
])
|
|
29
|
+
);
|
|
30
|
+
return primaryColors;
|
|
31
|
+
})();
|
|
41
32
|
const filteredGrayColors = Object.fromEntries(
|
|
42
33
|
Object.entries(colors).filter(([key]) => ["slate", "gray", "zinc", "neutral", "stone"].includes(key)).map(([key, value]) => [key, Object.fromEntries(
|
|
43
34
|
Object.entries(value).filter(([key2]) => ["50", "100", "200", "300", "400", "500", "600", "700", "800", "900", "950"].includes(key2))
|
|
44
35
|
)])
|
|
45
36
|
);
|
|
46
|
-
filteredGrayColors.sage = {
|
|
47
|
-
50: "#f2f2f2",
|
|
48
|
-
100: "#e6e6e6",
|
|
49
|
-
200: "#d9d9d9",
|
|
50
|
-
300: "#b8b8b8",
|
|
51
|
-
400: "#939393",
|
|
52
|
-
500: "#6f6f6f",
|
|
53
|
-
600: "#4b4b4b",
|
|
54
|
-
700: "#323232",
|
|
55
|
-
800: "#1f1f1f",
|
|
56
|
-
900: "#0b0b0b",
|
|
57
|
-
950: "#000000"
|
|
58
|
-
};
|
|
59
|
-
filteredGrayColors.ash = {
|
|
60
|
-
50: "#f9f9f8",
|
|
61
|
-
100: "#f1f0ee",
|
|
62
|
-
200: "#dad7d3",
|
|
63
|
-
300: "#c3beb8",
|
|
64
|
-
400: "#a9a49e",
|
|
65
|
-
500: "#908c84",
|
|
66
|
-
600: "#777168",
|
|
67
|
-
700: "#5e5950",
|
|
68
|
-
800: "#45403a",
|
|
69
|
-
900: "#2c2823",
|
|
70
|
-
950: "#161511"
|
|
71
|
-
};
|
|
72
|
-
filteredGrayColors.olive = {
|
|
73
|
-
50: "#fafaf2",
|
|
74
|
-
100: "#f5f5e6",
|
|
75
|
-
200: "#ebebd9",
|
|
76
|
-
300: "#d6d6b8",
|
|
77
|
-
400: "#b3b393",
|
|
78
|
-
500: "#8f8f6f",
|
|
79
|
-
600: "#6b6b4b",
|
|
80
|
-
700: "#4a4a32",
|
|
81
|
-
800: "#2a2a1f",
|
|
82
|
-
900: "#0e0e0b",
|
|
83
|
-
950: "#000000"
|
|
84
|
-
};
|
|
85
|
-
filteredGrayColors.leaf = {
|
|
86
|
-
50: "#f2faf2",
|
|
87
|
-
100: "#e6f5e6",
|
|
88
|
-
200: "#d9ebd9",
|
|
89
|
-
300: "#b8d6b8",
|
|
90
|
-
400: "#93b393",
|
|
91
|
-
500: "#6f8f6f",
|
|
92
|
-
600: "#4b6b4b",
|
|
93
|
-
700: "#326432",
|
|
94
|
-
800: "#1f2a1f",
|
|
95
|
-
900: "#0b0e0b",
|
|
96
|
-
950: "#000000"
|
|
97
|
-
};
|
|
98
37
|
const filteredColors = {
|
|
99
38
|
...filteredPrimaryColors,
|
|
100
39
|
...filteredGrayColors
|
|
@@ -113,20 +52,31 @@ export function useUnaThemes() {
|
|
|
113
52
|
if (!colorPalette)
|
|
114
53
|
throw new Error(`Invalid primary color: ${color}`);
|
|
115
54
|
const colors2 = {};
|
|
55
|
+
for (const shade of Object.keys(colorPalette)) {
|
|
56
|
+
const value = colorPalette[shade];
|
|
57
|
+
if (value.startsWith("oklch("))
|
|
58
|
+
colors2[`--una-${prefix}-${shade}`] = value.replace("oklch(", "").replace(")", "");
|
|
59
|
+
}
|
|
116
60
|
colors2[`--una-${prefix}-hex`] = colorPalette[600];
|
|
117
|
-
for (const shade of Object.keys(colorPalette))
|
|
118
|
-
colors2[`--una-${prefix}-${shade}`] = hexToRgb(colorPalette[shade]).join(", ");
|
|
119
61
|
return colors2;
|
|
120
62
|
}
|
|
121
|
-
function getPrimaryColors(color) {
|
|
122
|
-
|
|
63
|
+
function getPrimaryColors(color, defaultColor = "yellow") {
|
|
64
|
+
const theme = primaryThemes.find(([colorName, _]) => colorName === color);
|
|
65
|
+
if (!theme)
|
|
66
|
+
return getPrimaryColors(defaultColor);
|
|
67
|
+
return theme[1];
|
|
123
68
|
}
|
|
124
|
-
function getGrayColors(color) {
|
|
125
|
-
|
|
69
|
+
function getGrayColors(color, defaultColor = "stone") {
|
|
70
|
+
const theme = grayThemes.find(([colorName, _]) => colorName === color);
|
|
71
|
+
if (!theme)
|
|
72
|
+
return getGrayColors(defaultColor);
|
|
73
|
+
return theme[1];
|
|
126
74
|
}
|
|
75
|
+
const themes = [];
|
|
127
76
|
return {
|
|
128
77
|
primaryThemes,
|
|
129
78
|
grayThemes,
|
|
79
|
+
themes,
|
|
130
80
|
getPrimaryColors,
|
|
131
81
|
getGrayColors
|
|
132
82
|
};
|
|
@@ -10,6 +10,19 @@ export default defineNuxtPlugin(() => {
|
|
|
10
10
|
const html = document.documentElement;
|
|
11
11
|
html.removeAttribute("style");
|
|
12
12
|
const computedStyles = computed(() => {
|
|
13
|
+
const theme = settings.value.themes.find((t) => t.name === settings.value.theme);
|
|
14
|
+
if (settings.value.theme && theme) {
|
|
15
|
+
return `
|
|
16
|
+
:root {
|
|
17
|
+
${Object.entries(theme.cssVars.light).map(([k, v]) => `${k}: ${v};`).join("\n")}
|
|
18
|
+
--una-radius: ${settings.value.radius}rem;
|
|
19
|
+
--una-font-size: ${settings.value.fontSize}px;
|
|
20
|
+
}
|
|
21
|
+
.dark {
|
|
22
|
+
${Object.entries(theme.cssVars.dark).map(([k, v]) => `${k}: ${v};`).join("\n")}
|
|
23
|
+
}
|
|
24
|
+
`;
|
|
25
|
+
}
|
|
13
26
|
return `
|
|
14
27
|
:root {
|
|
15
28
|
${Object.entries(settings.value.primaryColors).map(([k, v]) => `${k}: ${v};`).join("\n")}
|
|
@@ -16,6 +16,18 @@ export default defineNuxtPlugin(() => {
|
|
|
16
16
|
const html = document.documentElement
|
|
17
17
|
${process.dev ? "console.log({ settings })" : ""}
|
|
18
18
|
|
|
19
|
+
if (settings.theme) {
|
|
20
|
+
const theme = settings.themes.find(t => t.name === settings.theme)
|
|
21
|
+
if (theme) {
|
|
22
|
+
Object.entries(theme.cssVars.light).map(i => html.style.setProperty(i[0], i[1]))
|
|
23
|
+
Object.entries(theme.cssVars.dark).map(i => html.style.setProperty(i[0], i[1]))
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
html.style.setProperty('--una-radius', settings.radius + 'rem')
|
|
27
|
+
html.style.setProperty('--una-font-size', settings.fontSize + 'px')
|
|
28
|
+
return
|
|
29
|
+
}
|
|
30
|
+
|
|
19
31
|
if (settings.primary)
|
|
20
32
|
Object.entries(settings.primaryColors).map(i => html.style.setProperty(i[0], i[1]))
|
|
21
33
|
if (settings.gray)
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { AlertDialogActionProps, AlertDialogCancelProps, AlertDialogContentProps, AlertDialogDescriptionProps, AlertDialogOverlayProps, AlertDialogProps, AlertDialogTitleProps, AlertDialogTriggerProps } from 'reka-ui';
|
|
2
2
|
import type { HTMLAttributes } from 'vue';
|
|
3
3
|
import type { NButtonProps } from './button.js';
|
|
4
|
-
export interface NAlertDialogProps extends AlertDialogProps, Pick<NAlertDialogContentProps, '
|
|
4
|
+
export interface NAlertDialogProps extends AlertDialogProps, Pick<NAlertDialogContentProps, 'dismissible' | 'overlay' | '_alertDialogCancel' | '_alertDialogAction' | '_alertDialogOverlay'> {
|
|
5
5
|
/**
|
|
6
6
|
* The title of the dialog.
|
|
7
7
|
*/
|
|
@@ -40,7 +40,7 @@ export interface NAlertDialogContentProps extends AlertDialogContentProps, BaseE
|
|
|
40
40
|
*
|
|
41
41
|
* @default true
|
|
42
42
|
*/
|
|
43
|
-
|
|
43
|
+
dismissible?: boolean;
|
|
44
44
|
/**
|
|
45
45
|
* Show overlay.
|
|
46
46
|
*
|