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 +1 -1
- package/dist/module.mjs +6 -0
- package/dist/runtime/components/Icon.vue +5 -5
- package/dist/runtime/middlewares/LoadColor.d.ts +2 -0
- package/dist/runtime/middlewares/LoadColor.mjs +21 -0
- package/dist/runtime/plugins/tailwindColor.d.ts +0 -0
- package/dist/runtime/plugins/tailwindColor.mjs +0 -0
- package/dist/runtime/scripts/store/tc.d.ts +1 -0
- package/dist/runtime/scripts/store/tc.mjs +15 -0
- package/dist/runtime/stores/GloriousStore.d.ts +38 -5
- package/dist/runtime/stores/GloriousStore.mjs +12 -1
- package/package.json +1 -1
package/dist/module.json
CHANGED
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:
|
|
6
|
-
color?:
|
|
7
|
-
hoverColor?:
|
|
8
|
-
size?:
|
|
9
|
-
strokeWidth?:
|
|
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,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
|
-
|
|
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
|
-
|
|
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:
|
|
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-
|
|
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",
|