@una-ui/nuxt-edge 1.0.0-alpha.1-29182152.ce98054 → 1.0.0-alpha.2-29182246.68e0e15

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.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@una-ui/nuxt-edge",
3
3
  "configKey": "una",
4
- "version": "1.0.0-alpha.1-29182152.ce98054",
4
+ "version": "1.0.0-alpha.2-29182246.68e0e15",
5
5
  "compatibility": {
6
6
  "nuxt": ">=3.0.0"
7
7
  },
package/dist/module.mjs CHANGED
@@ -8,7 +8,7 @@ import 'unocss';
8
8
  import 'unocss-preset-animations';
9
9
 
10
10
  const name = "@una-ui/nuxt-edge";
11
- const version = "1.0.0-alpha.1-29182152.ce98054";
11
+ const version = "1.0.0-alpha.2-29182246.68e0e15";
12
12
 
13
13
  const module = defineNuxtModule({
14
14
  meta: {
@@ -25,23 +25,23 @@ const currentPrimaryThemeName = computed(() => {
25
25
  });
26
26
  const currentGrayThemeHex = computed(() => settings.value.grayColors?.["--una-gray-hex"]);
27
27
  const currentGrayThemeName = computed(() => {
28
- if (settings.value.theme !== null) {
29
- return false;
28
+ if (settings.value.theme) {
29
+ return settings.value.theme;
30
30
  }
31
31
  const theme = grayThemes.find(([, theme2]) => theme2["--una-gray-hex"] === currentGrayThemeHex.value);
32
32
  return theme ? theme[0] : "";
33
33
  });
34
- function updateColor(theme) {
34
+ function updateTheme(theme) {
35
35
  settings.value.theme = theme;
36
- settings.value.primary = "";
37
- settings.value.gray = "";
36
+ settings.value.primary = false;
37
+ settings.value.gray = false;
38
38
  }
39
39
  function updatePrimaryTheme(theme) {
40
- settings.value.theme = null;
40
+ settings.value.theme = false;
41
41
  settings.value.primary = theme;
42
42
  }
43
43
  function updateGrayTheme(theme) {
44
- settings.value.theme = null;
44
+ settings.value.theme = false;
45
45
  settings.value.gray = theme;
46
46
  }
47
47
  function shuffleTheme() {
@@ -114,7 +114,7 @@ function shuffleTheme() {
114
114
  class="justify-start gap-2 ring-primary"
115
115
  :aria-label="`Theme: ${theme.name}`"
116
116
  :class="currentPrimaryThemeName === theme?.name && 'ring-2'"
117
- @click="updateColor(theme.name)"
117
+ @click="updateTheme(theme.name)"
118
118
  >
119
119
  <template #leading>
120
120
  <Icon
@@ -169,19 +169,25 @@ function shuffleTheme() {
169
169
  <div class="space-y-2">
170
170
  <Label for="color" class="text-xs"> Gray Color </Label>
171
171
  <div class="grid grid-cols-7 gap-3">
172
- <button
172
+ <template
173
173
  v-for="[key, theme] in grayThemes"
174
174
  :key="key"
175
- :title="capitalize(key)"
176
- :style="{ background: theme['--una-gray-hex'] }"
177
- :class="currentGrayThemeName === key ? 'ring-2' : 'scale-93'"
178
- class="transition-all"
179
- rounded="full"
180
- square="6.5"
181
- :aria-label="`Gray Color: ${key}`"
182
- ring="gray offset-4 offset-background"
183
- @click="updateGrayTheme(key)"
184
- />
175
+ >
176
+ <button
177
+ :title="capitalize(key)"
178
+ :style="{
179
+ '--c-gray': `oklch(${theme['--una-gray-600']})`,
180
+ '--c-gray-foreground': `oklch(${theme['--una-gray-500']})`
181
+ }"
182
+ class="bg-$c-gray transition-all dark:bg-$c-gray-foreground"
183
+ rounded="full"
184
+ square="6.5"
185
+ :class="[currentGrayThemeName === key ? 'ring-2' : 'scale-93']"
186
+ ring="gray offset-4 offset-background"
187
+ :aria-label="`Gray Color: ${key}`"
188
+ @click="updateGrayTheme(key)"
189
+ />
190
+ </template>
185
191
  </div>
186
192
  </div>
187
193
 
@@ -6,8 +6,8 @@ export function useUnaSettings() {
6
6
  const { una } = useAppConfig();
7
7
  const { getPrimaryColors, getGrayColors } = useUnaThemes();
8
8
  const defaultSettings = {
9
- primaryColors: getPrimaryColors(una.primary),
10
- grayColors: getGrayColors(una.gray),
9
+ primaryColors: una.primary ? getPrimaryColors(una.primary) : {},
10
+ grayColors: una.gray ? getGrayColors(una.gray) : {},
11
11
  primary: una.primary,
12
12
  gray: una.gray,
13
13
  radius: una.radius,
@@ -18,17 +18,21 @@ export function useUnaSettings() {
18
18
  const settings = useStorage("una-settings", defaultSettings, void 0, {
19
19
  mergeDefaults: defu
20
20
  });
21
- watch(
22
- () => [settings.value.primary, settings.value.gray],
23
- ([primary, gray]) => {
24
- settings.value.primaryColors = getPrimaryColors(primary, una.primary);
25
- settings.value.grayColors = getGrayColors(gray, una.gray);
26
- },
27
- { immediate: true }
28
- );
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 });
29
31
  function reset() {
30
32
  if (una.theme) {
31
33
  settings.value.theme = una.theme;
34
+ settings.value.primary = false;
35
+ settings.value.gray = false;
32
36
  return;
33
37
  }
34
38
  settings.value.primary = defaultSettings.primary;
@@ -63,9 +63,9 @@ export interface ColorPalette {
63
63
  export interface UnaSettings {
64
64
  primaryColors: Colors;
65
65
  grayColors: Colors;
66
- theme: string | null | false | undefined;
67
- primary: string;
68
- gray: string;
66
+ theme: string | false;
67
+ primary: string | false;
68
+ gray: string | false;
69
69
  fontSize: number;
70
70
  radius: number;
71
71
  themes: {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@una-ui/nuxt-edge",
3
3
  "type": "module",
4
- "version": "1.0.0-alpha.1-29182152.ce98054",
4
+ "version": "1.0.0-alpha.2-29182246.68e0e15",
5
5
  "description": "Nuxt module for @una-ui",
6
6
  "author": "Phojie Rengel <phojrengel@gmail.com>",
7
7
  "license": "MIT",
@@ -41,8 +41,8 @@
41
41
  "@nuxt/kit": "^3.17.5",
42
42
  "@nuxtjs/color-mode": "^3.5.2",
43
43
  "@tanstack/vue-table": "^8.21.3",
44
- "@una-ui/extractor-vue-script": "npm:@una-ui/extractor-vue-script-edge@1.0.0-alpha.1-29182152.ce98054",
45
- "@una-ui/preset": "npm:@una-ui/preset-edge@1.0.0-alpha.1-29182152.ce98054",
44
+ "@una-ui/extractor-vue-script": "npm:@una-ui/extractor-vue-script-edge@1.0.0-alpha.2-29182246.68e0e15",
45
+ "@una-ui/preset": "npm:@una-ui/preset-edge@1.0.0-alpha.2-29182246.68e0e15",
46
46
  "@unocss/core": "^66.2.0",
47
47
  "@unocss/nuxt": "^66.2.0",
48
48
  "@unocss/preset-attributify": "^66.2.0",