@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.
Files changed (127) hide show
  1. package/dist/module.d.mts +2 -2
  2. package/dist/module.json +1 -1
  3. package/dist/module.mjs +5 -3
  4. package/dist/runtime/components/alert/Alert.vue +94 -0
  5. package/dist/runtime/components/alert/Alert.vue.d.ts +32 -0
  6. package/dist/runtime/components/alert/AlertClose.vue +58 -0
  7. package/dist/runtime/components/alert/AlertClose.vue.d.ts +18 -0
  8. package/dist/runtime/components/alert/AlertDescription.vue +22 -0
  9. package/dist/runtime/components/alert/AlertDescription.vue.d.ts +15 -0
  10. package/dist/runtime/components/alert/AlertTitle.vue +22 -0
  11. package/dist/runtime/components/alert/AlertTitle.vue.d.ts +15 -0
  12. package/dist/runtime/components/alert-dialog/AlertDialog.vue +2 -2
  13. package/dist/runtime/components/alert-dialog/AlertDialog.vue.d.ts +1 -0
  14. package/dist/runtime/components/alert-dialog/AlertDialogCancel.vue +1 -1
  15. package/dist/runtime/components/alert-dialog/AlertDialogContent.vue +2 -2
  16. package/dist/runtime/components/alert-dialog/AlertDialogContent.vue.d.ts +1 -0
  17. package/dist/runtime/components/aspect-ratio/AspectRatio.vue.d.ts +1 -1
  18. package/dist/runtime/components/combobox/Combobox.vue +2 -1
  19. package/dist/runtime/components/combobox/ComboboxTrigger.vue +1 -1
  20. package/dist/runtime/components/elements/Button.vue.d.ts +3 -3
  21. package/dist/runtime/components/elements/Skeleton.vue +1 -1
  22. package/dist/runtime/components/elements/Skeleton.vue.d.ts +3 -1
  23. package/dist/runtime/components/elements/avatar/Avatar.vue +17 -15
  24. package/dist/runtime/components/elements/avatar/Avatar.vue.d.ts +6 -4
  25. package/dist/runtime/components/elements/card/Card.vue +15 -4
  26. package/dist/runtime/components/elements/card/Card.vue.d.ts +6 -4
  27. package/dist/runtime/components/elements/card/CardAction.vue +19 -0
  28. package/dist/runtime/components/elements/card/CardAction.vue.d.ts +13 -0
  29. package/dist/runtime/components/elements/card/CardContent.vue +1 -0
  30. package/dist/runtime/components/elements/card/CardDescription.vue +1 -0
  31. package/dist/runtime/components/elements/card/CardFooter.vue +1 -0
  32. package/dist/runtime/components/elements/card/CardHeader.vue +1 -0
  33. package/dist/runtime/components/elements/card/CardTitle.vue +1 -0
  34. package/dist/runtime/components/elements/dialog/Dialog.vue +73 -62
  35. package/dist/runtime/components/elements/dialog/Dialog.vue.d.ts +12 -9
  36. package/dist/runtime/components/elements/dialog/DialogClose.vue +1 -0
  37. package/dist/runtime/components/elements/dialog/DialogClose.vue.d.ts +1 -1
  38. package/dist/runtime/components/elements/dialog/DialogContent.vue +3 -2
  39. package/dist/runtime/components/elements/dialog/DialogContent.vue.d.ts +1 -0
  40. package/dist/runtime/components/elements/dialog/DialogDescription.vue +1 -0
  41. package/dist/runtime/components/elements/dialog/DialogFooter.vue +1 -0
  42. package/dist/runtime/components/elements/dialog/DialogHeader.vue +1 -0
  43. package/dist/runtime/components/elements/dialog/DialogOverlay.vue +1 -0
  44. package/dist/runtime/components/elements/dialog/DialogScrollContent.vue +2 -2
  45. package/dist/runtime/components/elements/dialog/DialogScrollContent.vue.d.ts +1 -0
  46. package/dist/runtime/components/elements/dialog/DialogTitle.vue +1 -0
  47. package/dist/runtime/components/elements/dialog/DialogTrigger.vue +16 -0
  48. package/dist/runtime/components/elements/dialog/DialogTrigger.vue.d.ts +13 -0
  49. package/dist/runtime/components/elements/dropdown-menu/DropdownMenuItem.vue.d.ts +1 -1
  50. package/dist/runtime/components/elements/pagination/PaginationFirst.vue.d.ts +1 -1
  51. package/dist/runtime/components/elements/pagination/PaginationLast.vue.d.ts +1 -1
  52. package/dist/runtime/components/elements/pagination/PaginationNext.vue.d.ts +1 -1
  53. package/dist/runtime/components/elements/pagination/PaginationPrev.vue.d.ts +1 -1
  54. package/dist/runtime/components/elements/tabs/TabsTrigger.vue +2 -2
  55. package/dist/runtime/components/elements/tabs/TabsTrigger.vue.d.ts +1 -0
  56. package/dist/runtime/components/forms/Checkbox.vue +2 -2
  57. package/dist/runtime/components/forms/Checkbox.vue.d.ts +2 -0
  58. package/dist/runtime/components/forms/FormGroup.vue +1 -1
  59. package/dist/runtime/components/forms/Input.vue.d.ts +6 -6
  60. package/dist/runtime/components/forms/Slider.vue +12 -11
  61. package/dist/runtime/components/forms/Slider.vue.d.ts +1 -0
  62. package/dist/runtime/components/forms/form/FormField.vue +1 -1
  63. package/dist/runtime/components/forms/radio-group/RadioGroupItem.vue.d.ts +1 -1
  64. package/dist/runtime/components/forms/select/SelectTrigger.vue +1 -1
  65. package/dist/runtime/components/misc/ThemeSwitcher.vue +101 -32
  66. package/dist/runtime/components/navigation/breadcrumb/BreadcrumbEllipsis.vue.d.ts +1 -1
  67. package/dist/runtime/components/navigation/breadcrumb/BreadcrumbPage.vue +1 -1
  68. package/dist/runtime/components/navigation/breadcrumb/BreadcrumbSeparator.vue.d.ts +1 -1
  69. package/dist/runtime/components/navigation-menu/NavigationMenuLink.vue.d.ts +1 -1
  70. package/dist/runtime/components/navigation-menu/NavigationMenuTrigger.vue.d.ts +1 -1
  71. package/dist/runtime/components/number-field/NumberField.vue.d.ts +1 -1
  72. package/dist/runtime/components/number-field/NumberFieldDecrement.vue.d.ts +1 -1
  73. package/dist/runtime/components/number-field/NumberFieldIncrement.vue.d.ts +1 -1
  74. package/dist/runtime/components/overlays/toast/ToastAction.vue.d.ts +1 -1
  75. package/dist/runtime/components/scroll-area/ScrollArea.vue.d.ts +1 -1
  76. package/dist/runtime/components/sheet/Sheet.vue +11 -5
  77. package/dist/runtime/components/sheet/Sheet.vue.d.ts +7 -4
  78. package/dist/runtime/components/sheet/SheetClose.vue +1 -0
  79. package/dist/runtime/components/sheet/SheetContent.vue +6 -5
  80. package/dist/runtime/components/sheet/SheetContent.vue.d.ts +4 -2
  81. package/dist/runtime/components/sheet/SheetDescription.vue +1 -0
  82. package/dist/runtime/components/sheet/SheetFooter.vue +1 -0
  83. package/dist/runtime/components/sheet/SheetHeader.vue +1 -0
  84. package/dist/runtime/components/sheet/SheetOverlay.vue +23 -0
  85. package/dist/runtime/components/sheet/SheetOverlay.vue.d.ts +12 -0
  86. package/dist/runtime/components/sheet/SheetTitle.vue +1 -0
  87. package/dist/runtime/components/sheet/SheetTrigger.vue +4 -1
  88. package/dist/runtime/components/sidebar/Sidebar.vue +8 -3
  89. package/dist/runtime/components/sidebar/SidebarContent.vue +1 -0
  90. package/dist/runtime/components/sidebar/SidebarFooter.vue +1 -0
  91. package/dist/runtime/components/sidebar/SidebarGroup.vue +1 -0
  92. package/dist/runtime/components/sidebar/SidebarGroupAction.vue +1 -0
  93. package/dist/runtime/components/sidebar/SidebarGroupContent.vue +1 -0
  94. package/dist/runtime/components/sidebar/SidebarGroupLabel.vue +1 -0
  95. package/dist/runtime/components/sidebar/SidebarHeader.vue +1 -0
  96. package/dist/runtime/components/sidebar/SidebarInput.vue +1 -0
  97. package/dist/runtime/components/sidebar/SidebarInset.vue +1 -0
  98. package/dist/runtime/components/sidebar/SidebarMenu.vue +1 -0
  99. package/dist/runtime/components/sidebar/SidebarMenuAction.vue +1 -0
  100. package/dist/runtime/components/sidebar/SidebarMenuBadge.vue +1 -0
  101. package/dist/runtime/components/sidebar/SidebarMenuButton.vue.d.ts +1 -1
  102. package/dist/runtime/components/sidebar/SidebarMenuButtonChild.vue +1 -0
  103. package/dist/runtime/components/sidebar/SidebarMenuButtonChild.vue.d.ts +1 -1
  104. package/dist/runtime/components/sidebar/SidebarMenuItem.vue +1 -0
  105. package/dist/runtime/components/sidebar/SidebarMenuSkeleton.vue +1 -0
  106. package/dist/runtime/components/sidebar/SidebarMenuSub.vue +1 -0
  107. package/dist/runtime/components/sidebar/SidebarMenuSubButton.vue +3 -1
  108. package/dist/runtime/components/sidebar/SidebarMenuSubButton.vue.d.ts +1 -1
  109. package/dist/runtime/components/sidebar/SidebarMenuSubItem.vue +2 -0
  110. package/dist/runtime/components/sidebar/SidebarProvider.vue +1 -0
  111. package/dist/runtime/components/sidebar/SidebarRail.vue +1 -0
  112. package/dist/runtime/components/sidebar/SidebarSeparator.vue +1 -0
  113. package/dist/runtime/components/sidebar/SidebarTrigger.vue +1 -0
  114. package/dist/runtime/composables/useUnaSettings.js +22 -9
  115. package/dist/runtime/composables/useUnaThemes.d.ts +5 -5
  116. package/dist/runtime/composables/useUnaThemes.js +48 -98
  117. package/dist/runtime/plugins/theme.client.js +13 -0
  118. package/dist/runtime/plugins/theme.server.js +12 -0
  119. package/dist/runtime/types/alert-dialog.d.ts +2 -2
  120. package/dist/runtime/types/alert.d.ts +30 -15
  121. package/dist/runtime/types/card.d.ts +5 -0
  122. package/dist/runtime/types/dialog.d.ts +8 -3
  123. package/dist/runtime/types/index.d.ts +10 -2
  124. package/dist/runtime/types/sheet.d.ts +2 -2
  125. package/package.json +9 -9
  126. package/dist/runtime/components/elements/Alert.vue +0 -127
  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
+ };
@@ -13,6 +13,7 @@ const delegatedProps = reactiveOmit(props, ["class"]);
13
13
 
14
14
  <template>
15
15
  <DialogTitle
16
+ data-slot="sheet-title"
16
17
  :class="cn('sheet-title', props.una?.sheetTitle, props.class)"
17
18
  v-bind="delegatedProps"
18
19
  >
@@ -7,7 +7,10 @@ const props = defineProps({
7
7
  </script>
8
8
 
9
9
  <template>
10
- <DialogTrigger v-bind="props">
10
+ <DialogTrigger
11
+ data-slot="sheet-trigger"
12
+ v-bind="props"
13
+ >
11
14
  <slot />
12
15
  </DialogTrigger>
13
16
  </template>
@@ -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
- <div class="sidebar-mobile-inner">
74
- <ReuseSlot />
75
- </div>
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"
@@ -9,6 +9,7 @@ const props = defineProps({
9
9
 
10
10
  <template>
11
11
  <div
12
+ data-slot="sidebar-content"
12
13
  data-sidebar="content"
13
14
  :class="cn(
14
15
  'sidebar-content',
@@ -8,6 +8,7 @@ const props = defineProps({
8
8
 
9
9
  <template>
10
10
  <div
11
+ data-slot="sidebar-footer"
11
12
  data-sidebar="footer"
12
13
  :class="cn(
13
14
  'sidebar-footer',
@@ -10,6 +10,7 @@ const props = defineProps({
10
10
 
11
11
  <template>
12
12
  <div
13
+ data-slot="sidebar-group"
13
14
  data-sidebar="group"
14
15
  :class="cn(
15
16
  'sidebar-group',
@@ -11,6 +11,7 @@ const props = defineProps({
11
11
 
12
12
  <template>
13
13
  <Primitive
14
+ data-slot="sidebar-group-action"
14
15
  data-sidebar="group-action"
15
16
  :as="as"
16
17
  :as-child="asChild"
@@ -8,6 +8,7 @@ const props = defineProps({
8
8
 
9
9
  <template>
10
10
  <div
11
+ data-slot="sidebar-group-content"
11
12
  data-sidebar="group-content"
12
13
  :class="cn(
13
14
  'sidebar-group-content',
@@ -11,6 +11,7 @@ const props = defineProps({
11
11
 
12
12
  <template>
13
13
  <Primitive
14
+ data-slot="sidebar-group-label"
14
15
  data-sidebar="group-label"
15
16
  :as="as"
16
17
  :as-child="asChild"
@@ -8,6 +8,7 @@ const props = defineProps({
8
8
 
9
9
  <template>
10
10
  <div
11
+ data-slot="sidebar-header"
11
12
  data-sidebar="header"
12
13
  :class="cn(
13
14
  'sidebar-header',
@@ -25,6 +25,7 @@ const props = defineProps({
25
25
 
26
26
  <template>
27
27
  <Input
28
+ data-slot="sidebar-input"
28
29
  data-sidebar="input"
29
30
  :class="cn(
30
31
  'sidebar-input',
@@ -8,6 +8,7 @@ const props = defineProps({
8
8
 
9
9
  <template>
10
10
  <main
11
+ data-slot="sidebar-inset"
11
12
  :class="cn(
12
13
  'sidebar-inset',
13
14
  props.una?.sidebarInset,
@@ -16,6 +16,7 @@ function getKey(item) {
16
16
 
17
17
  <template>
18
18
  <ul
19
+ data-slot="sidebar-menu"
19
20
  data-sidebar="menu"
20
21
  :class="cn(
21
22
  'sidebar-menu',
@@ -12,6 +12,7 @@ const props = defineProps({
12
12
 
13
13
  <template>
14
14
  <Primitive
15
+ data-slot="sidebar-menu-action"
15
16
  data-sidebar="menu-action"
16
17
  :class="cn(
17
18
  'sidebar-menu-action',
@@ -8,6 +8,7 @@ const props = defineProps({
8
8
 
9
9
  <template>
10
10
  <div
11
+ data-slot="sidebar-menu-badge"
11
12
  data-sidebar="menu-badge"
12
13
  :class="cn(
13
14
  'sidebar-menu-badge',
@@ -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>;
@@ -35,6 +35,7 @@ const sidebarMenuButtonVariants = cva(
35
35
 
36
36
  <template>
37
37
  <Primitive
38
+ data-slot="sidebar-menu-button-child"
38
39
  data-sidebar="menu_button"
39
40
  :data-size="size"
40
41
  :data-active="isActive"
@@ -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>;
@@ -8,6 +8,7 @@ const props = defineProps({
8
8
 
9
9
  <template>
10
10
  <li
11
+ data-slot="sidebar-menu-item"
11
12
  data-sidebar="menu-item"
12
13
  :class="cn(
13
14
  'group/menu_item sidebar-menu-item',
@@ -14,6 +14,7 @@ const width = computed(() => {
14
14
 
15
15
  <template>
16
16
  <div
17
+ data-slot="sidebar-menu-skeleton"
17
18
  data-sidebar="menu-skeleton"
18
19
  :class="cn(
19
20
  'sidebar-menu-skeleton',
@@ -8,6 +8,7 @@ const props = defineProps({
8
8
 
9
9
  <template>
10
10
  <ul
11
+ data-slot="sidebar-menu-sub"
11
12
  data-sidebar="menu-badge"
12
13
  :class="cn(
13
14
  'sidebar-menu-sub',
@@ -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: "a" }
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;
@@ -8,6 +8,8 @@ const props = defineProps({
8
8
 
9
9
  <template>
10
10
  <li
11
+ data-slot="sidebar-menu-sub-item"
12
+ data-sidebar="menu-sub-item"
11
13
  :class="cn(
12
14
  'sidebar-menu-sub-item',
13
15
  props.una?.sidebarMenuSubItem,
@@ -48,6 +48,7 @@ provideSidebarContext({
48
48
  <template>
49
49
  <TooltipProvider :delay-duration="0">
50
50
  <div
51
+ data-slot="sidebar-wrapper"
51
52
  :style="{
52
53
  '--sidebar-width': SIDEBAR_WIDTH,
53
54
  '--sidebar-width-icon': SIDEBAR_WIDTH_ICON
@@ -10,6 +10,7 @@ const { toggleSidebar } = useSidebar();
10
10
 
11
11
  <template>
12
12
  <button
13
+ data-slot="sidebar-rail"
13
14
  data-sidebar="rail"
14
15
  aria-label="Toggle Sidebar"
15
16
  :tabindex="-1"
@@ -9,6 +9,7 @@ const props = defineProps({
9
9
 
10
10
  <template>
11
11
  <Separator
12
+ data-slot="sidebar-separator"
12
13
  data-sidebar="separator"
13
14
  :class="cn(
14
15
  'sidebar-separator',
@@ -38,6 +38,7 @@ const { toggleSidebar } = useSidebar();
38
38
 
39
39
  <template>
40
40
  <Button
41
+ data-slot="sidebar-trigger"
41
42
  data-sidebar="trigger"
42
43
  v-bind="props"
43
44
  :class="cn(
@@ -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
- watchEffect(() => {
21
- settings.value.primaryColors = getPrimaryColors(settings.value.primary || una.primary);
22
- settings.value.grayColors = getGrayColors(settings.value.gray || una.gray);
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 interface UseUnaThemesReturn {
2
+ export declare function useUnaThemes(): {
3
3
  primaryThemes: [string, Colors][];
4
4
  grayThemes: [string, Colors][];
5
- getPrimaryColors: (color: string) => Colors;
6
- getGrayColors: (color: string) => Colors;
7
- }
8
- export declare function useUnaThemes(): UseUnaThemesReturn;
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-mini/colors";
2
- import { hexToRgb } from "../utils/index.js";
3
- const filteredPrimaryColors = 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
- "amber",
22
- "red",
23
- "teal"
24
- ].includes(key)).map(([key, value]) => [key, Object.fromEntries(
25
- Object.entries(value).filter(([key2]) => ["50", "100", "200", "300", "400", "500", "600", "700", "800", "900", "950"].includes(key2))
26
- )])
27
- );
28
- filteredPrimaryColors.tomato = {
29
- 50: "#fdf2f2",
30
- 100: "#fde8e8",
31
- 200: "#fbd5d5",
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
- return primaryThemes.filter(([colorName, _]) => colorName === color)[0][1];
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
- return grayThemes.filter(([colorName, _]) => colorName === color)[0][1];
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, 'preventClose' | 'overlay' | '_alertDialogCancel' | '_alertDialogAction' | '_alertDialogOverlay'> {
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
- preventClose?: boolean;
43
+ dismissible?: boolean;
44
44
  /**
45
45
  * Show overlay.
46
46
  *