nuxt-glorious 2.0.0-develop-34 → 2.0.0-develop-36

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,5 +1,5 @@
1
1
  {
2
2
  "name": "nuxt-glorious",
3
3
  "configKey": "glorious",
4
- "version": "2.0.0-develop-34"
4
+ "version": "2.0.0-develop-36"
5
5
  }
package/dist/module.mjs CHANGED
@@ -62,6 +62,7 @@ const module = defineNuxtModule({
62
62
  });
63
63
  addPlugin(resolver.resolve("./runtime/plugins/modalClose"));
64
64
  addPlugin(resolver.resolve("./runtime/plugins/InputComponent"));
65
+ addPlugin(resolver.resolve("./runtime/plugins/tailwindColor"));
65
66
  addRouteMiddleware({
66
67
  name: "g-auth-strategy",
67
68
  path: resolver.resolve("./runtime/middlewares/AuthStrategy"),
@@ -76,6 +77,11 @@ const module = defineNuxtModule({
76
77
  name: "g-auth",
77
78
  path: resolver.resolve("./runtime/middlewares/Auth")
78
79
  });
80
+ addRouteMiddleware({
81
+ name: "g-load-color",
82
+ path: resolver.resolve("./runtime/middlewares/LoadColor"),
83
+ global: true
84
+ });
79
85
  }
80
86
  });
81
87
 
@@ -2,11 +2,11 @@
2
2
  import { ref, watch } from '#imports'
3
3
 
4
4
  interface iconPropInterface {
5
- name: String
6
- color?: String
7
- hoverColor?: String
8
- size?: Number
9
- strokeWidth?: Number
5
+ name: string
6
+ color?: string
7
+ hoverColor?: string
8
+ size?: number
9
+ strokeWidth?: number
10
10
  }
11
11
 
12
12
  const props: any = withDefaults(defineProps<iconPropInterface>(), {
@@ -0,0 +1,2 @@
1
+ declare const _default: any;
2
+ export default _default;
@@ -0,0 +1,21 @@
1
+ import { defineNuxtRouteMiddleware, useNuxtApp } from "#imports";
2
+ import { GloriousStore } from "../stores/GloriousStore.mjs";
3
+ import colors from "tailwindcss/colors";
4
+ export default defineNuxtRouteMiddleware(() => {
5
+ const nuxtApp = useNuxtApp();
6
+ const gs = GloriousStore();
7
+ nuxtApp.hook("app:mounted", () => {
8
+ const styles = getComputedStyle(document.documentElement);
9
+ let colorVars = {};
10
+ for (let i = 0; i < styles.length; i++) {
11
+ const name = styles[i];
12
+ if (name.startsWith("--color-")) {
13
+ colorVars[name] = styles.getPropertyValue(name).trim();
14
+ }
15
+ }
16
+ gs.ui.colors = {
17
+ tailwind: colors,
18
+ dom: colorVars
19
+ };
20
+ });
21
+ });
File without changes
File without changes
@@ -0,0 +1 @@
1
+ export default function (color: string, state: any): any;
@@ -0,0 +1,15 @@
1
+ export default function(color, state) {
2
+ const domColor = state.ui.colors.dom["--color-" + color];
3
+ if (typeof domColor !== "undefined") {
4
+ return domColor;
5
+ }
6
+ const [colorName, range] = color.split("-");
7
+ const tailwindColor = state.ui.colors.tailwind;
8
+ const base = tailwindColor[colorName];
9
+ if (typeof base === "string") {
10
+ return base;
11
+ }
12
+ if (typeof base === "object" && base !== null && range in base) {
13
+ return base[range];
14
+ }
15
+ }
@@ -1,9 +1,42 @@
1
- export declare const GloriousStore: import("pinia").StoreDefinition<"GloriousStore", any, {
1
+ interface AuthState {
2
+ loaded: boolean;
3
+ user: Record<string, any>;
4
+ }
5
+ interface UIColors {
6
+ dom: Record<string, string>;
7
+ tailwind: Record<string, string | Record<string, string>>;
8
+ }
9
+ interface UIState {
10
+ colors: UIColors;
11
+ isDark: boolean;
12
+ }
13
+ interface FormsState {
14
+ [key: string]: {
15
+ form: Record<string, any>;
16
+ errors: any[];
17
+ };
18
+ }
19
+ interface GloriousState {
20
+ auth: AuthState;
21
+ loading: Record<string, any>;
22
+ keepData: Record<string, any>;
23
+ forms: FormsState;
24
+ response: Record<string, any>;
25
+ modals: Record<string, any>;
26
+ keepResponse: any[];
27
+ ui: UIState;
28
+ }
29
+ interface GloriousGetters {
30
+ [key: string]: (...args: any[]) => any;
2
31
  authIsLogin(): boolean;
3
- }, {
4
- formCreate(key: string | Array<string>): void;
32
+ }
33
+ interface GloriousActions {
34
+ tc(color: string): string | undefined;
35
+ formCreate(key: string | string[]): void;
5
36
  authLogout(): void;
6
37
  authSetToken(token: string, to?: string | null): void;
7
- authParseToken(token: any): any;
38
+ authParseToken(token: string): any;
8
39
  authGetUser(token?: string): void;
9
- }>;
40
+ }
41
+ export declare const GloriousStore: import("pinia").StoreDefinition<"GloriousStore", GloriousState, GloriousGetters, GloriousActions>;
42
+ export {};
@@ -1,5 +1,6 @@
1
1
  import { defineStore } from "pinia";
2
2
  import { navigateTo, useCookie, useRuntimeConfig, useFetch } from "#imports";
3
+ import tc from "../scripts/store/tc.mjs";
3
4
  export const GloriousStore = defineStore("GloriousStore", {
4
5
  state: () => ({
5
6
  auth: {
@@ -11,7 +12,14 @@ export const GloriousStore = defineStore("GloriousStore", {
11
12
  forms: {},
12
13
  response: {},
13
14
  modals: {},
14
- keepResponse: []
15
+ keepResponse: [],
16
+ ui: {
17
+ colors: {
18
+ dom: {},
19
+ tailwind: {}
20
+ },
21
+ isDark: false
22
+ }
15
23
  }),
16
24
  getters: {
17
25
  authIsLogin() {
@@ -21,6 +29,9 @@ export const GloriousStore = defineStore("GloriousStore", {
21
29
  }
22
30
  },
23
31
  actions: {
32
+ tc(color) {
33
+ return tc(color, this);
34
+ },
24
35
  formCreate(key) {
25
36
  this.forms = {};
26
37
  if (typeof key === "string")
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "2.0.0-develop-34",
2
+ "version": "2.0.0-develop-36",
3
3
  "name": "nuxt-glorious",
4
4
  "description": "This package provides many things needed by a project, including server requests and authentication, SEO and other requirements of a project.",
5
5
  "repository": "sajadhzj/nuxt-glorious",