@imaginario27/air-ui-ds 1.0.1 → 1.0.3

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/README.md CHANGED
@@ -1,19 +1,18 @@
1
1
  # @imaginario27/air-ui-ds
2
2
 
3
- A modular Design System and UI component library built for Vue 3 and Nuxt 3. It provides a scalable architecture for building consistent interfaces, theme management, and reusable components powered by Tailwind CSS and TypeScript.
3
+ A modular Design System and UI component library built for Vue and Nuxt. It provides a scalable architecture for building consistent interfaces, theme management, and reusable components powered by Tailwind CSS and TypeScript.
4
4
 
5
5
  Documentation: [https://air-ui.netlify.app/](https://air-ui.netlify.app/)
6
6
 
7
7
  ## Features
8
8
 
9
- * Vue 3 and Nuxt 3 compatibility
9
+ * Vue and Nuxt compatibility
10
10
  * Design System tokens for colors, spacing, typography, and themes
11
11
  * Reusable and typed UI components
12
12
  * Light and dark theme system with automatic CSS variable generation
13
- * Tailwind CSS v4 integration
13
+ * Tailwind CSS latest version integration
14
14
  * Auto-import support for components and composables in Nuxt
15
15
  * Utilities for i18n, file uploads, images, PDF generation, and QR codes
16
- * Documentation support using Nuxt Content
17
16
  * Full testing setup with Vitest, Vue Test Utils, and Nuxt Test Utils
18
17
 
19
18
 
@@ -52,6 +51,8 @@ This regenerates the theme files used by Tailwind CSS and the Design System.
52
51
  This package includes a complete testing environment using:
53
52
 
54
53
  * Vitest
54
+ * Vue Test Utils
55
+ * Nuxt Test Utils
55
56
  * Happy DOM
56
57
 
57
58
  Run the tests with:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@imaginario27/air-ui-ds",
3
- "version": "1.0.1",
3
+ "version": "1.0.3",
4
4
  "author": "imaginario27",
5
5
  "type": "module",
6
6
  "homepage": "https://air-ui.netlify.app/",
@@ -0,0 +1,104 @@
1
+ import {
2
+ readFileSync,
3
+ writeFileSync,
4
+ existsSync,
5
+ mkdirSync,
6
+ unlinkSync,
7
+ } from "fs"
8
+ import { resolve, dirname } from "path"
9
+
10
+ const inputPath = resolve("assets/css/theme/ui-theme.css")
11
+ const outputPath = resolve("assets/css/main.css")
12
+
13
+ ensureOutputDir(outputPath)
14
+ deleteIfExists(outputPath)
15
+
16
+ const content = readFileSync(inputPath, "utf-8")
17
+ const { colorVars, otherVars } = extractThemeVars(content)
18
+
19
+ const finalOutput = generateThemeFile(colorVars, otherVars)
20
+ writeFileSync(outputPath, finalOutput, "utf-8")
21
+
22
+ console.log("✅ Tailwind theme file generated in assets/css/")
23
+
24
+ function ensureOutputDir(filePath: string) {
25
+ const dir = dirname(filePath)
26
+ if (!existsSync(dir)) {
27
+ mkdirSync(dir, { recursive: true })
28
+ }
29
+ }
30
+
31
+ function deleteIfExists(filePath: string) {
32
+ if (existsSync(filePath)) {
33
+ unlinkSync(filePath)
34
+ }
35
+ }
36
+
37
+ function extractThemeVars(content: string) {
38
+ const colorVars: string[] = []
39
+ const otherVars: string[] = []
40
+
41
+ const lines = content.split("\n")
42
+ let inRoot = false
43
+ let inDark = false
44
+
45
+ for (const rawLine of lines) {
46
+ const line = rawLine.trim()
47
+
48
+ if (line.startsWith(":root {")) {
49
+ inRoot = true
50
+ continue
51
+ }
52
+ if (line.startsWith(".dark {")) {
53
+ inDark = true
54
+ continue
55
+ }
56
+ if (line.startsWith("}")) {
57
+ inRoot = false
58
+ inDark = false
59
+ continue
60
+ }
61
+
62
+ if (!inRoot || inDark) continue
63
+
64
+ const key = extractVarKey(line)
65
+ if (!key || key.startsWith("--ds-")) continue
66
+
67
+ const declaration = ` ${key}: var(${key});`
68
+ if (key.startsWith("--color-")) {
69
+ colorVars.push(declaration)
70
+ } else {
71
+ otherVars.push(declaration)
72
+ }
73
+ }
74
+
75
+ return { colorVars, otherVars }
76
+ }
77
+
78
+ function extractVarKey(line: string): string | null {
79
+ const match = line.match(/^--[\w-]+:\s*[^;]+;/)
80
+ if (!match) return null
81
+ const [key] = line.split(":").map(s => s.trim().replace(/;$/, ""))
82
+ return key || null
83
+ }
84
+
85
+ function generateThemeFile(colorVars: string[], otherVars: string[]): string {
86
+ return [
87
+ `@import "tailwindcss";`,
88
+ `@source "../../node_modules/@imaginario27/air-ui-ds";`,
89
+ `@source "../../node_modules/@imaginario27/air-ui-utils";`,
90
+ ``,
91
+ `@import "./theme/primitives.css";`,
92
+ `@import "./theme/colors.css";`,
93
+ `@import "./theme/ui-theme.css";`,
94
+ ``,
95
+ `@theme {`,
96
+ ` /* Disables Tailwind default colors */`,
97
+ ` --color-*: initial;`,
98
+ ``,
99
+ ...colorVars,
100
+ ``,
101
+ ...otherVars,
102
+ `}`,
103
+ ].join("\n")
104
+ }