nuxt-glorious 2.0.0-develop-43 → 2.0.0-develop-45

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-43"
4
+ "version": "2.0.0-develop-45"
5
5
  }
package/dist/module.mjs CHANGED
@@ -76,6 +76,11 @@ const module = defineNuxtModule({
76
76
  name: "g-auth",
77
77
  path: resolver.resolve("./runtime/middlewares/Auth")
78
78
  });
79
+ addRouteMiddleware({
80
+ name: "g-load-color",
81
+ path: resolver.resolve("./runtime/middlewares/LoadColor"),
82
+ global: true
83
+ });
79
84
  }
80
85
  });
81
86
 
@@ -9,11 +9,14 @@ interface iconPropInterface {
9
9
  strokeWidth?: number
10
10
  }
11
11
 
12
- const props: any = withDefaults(defineProps<iconPropInterface>(), {
13
- size: 20,
14
- color: '#000',
15
- strokeWidth: 3,
16
- })
12
+ const props: iconPropInterface = withDefaults(
13
+ defineProps<iconPropInterface>(),
14
+ {
15
+ size: 20,
16
+ color: '#000',
17
+ strokeWidth: 3,
18
+ }
19
+ )
17
20
 
18
21
  const isHover = ref(false)
19
22
  const icon = ref('')
@@ -38,11 +41,10 @@ const computeSize = (size: number | string): number => {
38
41
  return result
39
42
  }
40
43
  const computeProps = (icon: any) => {
41
- const size = computeSize(props.size)
44
+ const size = computeSize(<number>props.size)
42
45
  const color = props.color
43
- const strokeWidth = props.stroke
46
+ const strokeWidth = props.strokeWidth
44
47
  const stroke = props.color
45
-
46
48
  return icon
47
49
  .replace(
48
50
  /(?<!stroke-)width="(\d+)"/g,
@@ -72,7 +74,7 @@ const mouseover = () => {
72
74
  const mouseleave = () => {
73
75
  isHover.value = false
74
76
  const color = props.color
75
- changeColorIcon(color)
77
+ changeColorIcon(<string>color)
76
78
  }
77
79
  const getIcon = async () => {
78
80
  try {
@@ -115,10 +117,12 @@ watch(
115
117
  </script>
116
118
 
117
119
  <template>
118
- <div
119
- class="w-max h-max g-icon"
120
- @mouseover="mouseover"
121
- @mouseleave="mouseleave"
122
- v-html="icon"
123
- />
120
+ <ClientOnly>
121
+ <div
122
+ class="w-max h-max g-icon"
123
+ @mouseover="mouseover"
124
+ @mouseleave="mouseleave"
125
+ v-html="icon"
126
+ />
127
+ </ClientOnly>
124
128
  </template>
@@ -1,6 +1,22 @@
1
1
  import { defineNuxtRouteMiddleware, useNuxtApp } from "#imports";
2
2
  import { GloriousStore } from "../stores/GloriousStore.mjs";
3
+ import colors from "tailwindcss/colors";
3
4
  export default defineNuxtRouteMiddleware(() => {
4
5
  const nuxtApp = useNuxtApp();
5
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
+ console.log(gs.ui.colors);
21
+ });
6
22
  });
package/package.json CHANGED
@@ -1,8 +1,11 @@
1
1
  {
2
- "version": "2.0.0-develop-43",
2
+ "version": "2.0.0-develop-45",
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
- "repository": "sajadhzj/nuxt-glorious",
5
+ "repository": {
6
+ "type": "git",
7
+ "url": "git+https://github.com/sajadhzj/nuxt-glorious.git"
8
+ },
6
9
  "author": "sajad hossein zadeh (https://github.com/sajadhzj)",
7
10
  "license": "MIT",
8
11
  "type": "module",