@imaginario27/air-ui-ds 1.0.12 → 1.0.14

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.
@@ -40,7 +40,7 @@
40
40
  <!-- Icon -->
41
41
  <span class="text-icon-neutral-subtler">
42
42
  <MdiIcon
43
- icon="mdiMagnify"
43
+ :icon
44
44
  size="20"
45
45
  preserveAspectRatio="xMidYMid meet"
46
46
  />
@@ -100,6 +100,10 @@ const props = defineProps({
100
100
  default: 'Search',
101
101
  },
102
102
  helpText: String as PropType<string>,
103
+ icon: {
104
+ type: String as PropType<any>,
105
+ default: 'mdiMagnify',
106
+ },
103
107
  size: {
104
108
  type: String as PropType<InputSize>,
105
109
  default: InputSize.MD,
@@ -142,6 +142,10 @@ const props = defineProps({
142
142
  type: Boolean as PropType<boolean>,
143
143
  default: false,
144
144
  },
145
+ showLoadingState: {
146
+ type: Boolean as PropType<boolean>,
147
+ default: true,
148
+ },
145
149
  isLoading: {
146
150
  type: Boolean as PropType<boolean>,
147
151
  default: true,
@@ -154,10 +158,6 @@ const props = defineProps({
154
158
  type: String as PropType<string>,
155
159
  default: 'Options are being loaded',
156
160
  },
157
- showLoadingState: {
158
- type: Boolean as PropType<boolean>,
159
- default: true,
160
- },
161
161
  })
162
162
 
163
163
  // Emits
@@ -125,10 +125,7 @@ const props = defineProps({
125
125
  label: String as PropType<string>,
126
126
  legend: String as PropType<string>,
127
127
  helpText: String as PropType<string>,
128
- required: {
129
- type: Boolean as PropType<boolean>,
130
- default: false,
131
- },
128
+
132
129
  modelValue: {
133
130
  type: Boolean as PropType<boolean>,
134
131
  default: false,
@@ -141,6 +138,10 @@ const props = defineProps({
141
138
  type: String as PropType<string>,
142
139
  default: '',
143
140
  },
141
+ required: {
142
+ type: Boolean as PropType<boolean>,
143
+ default: false,
144
+ },
144
145
  disabled: {
145
146
  type: Boolean as PropType<boolean>,
146
147
  default: false,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@imaginario27/air-ui-ds",
3
- "version": "1.0.12",
3
+ "version": "1.0.14",
4
4
  "author": "imaginario27",
5
5
  "type": "module",
6
6
  "homepage": "https://air-ui.netlify.app/",
@@ -19,6 +19,7 @@
19
19
  "postinstall": "nuxt prepare",
20
20
  "test": "vitest",
21
21
  "generate-theme": "ts-node scripts/generate-theme.ts",
22
+ "update-theme-colors": "ts-node scripts/update-ui-theme-colors.ts",
22
23
  "typecheck": "vue-tsc --noEmit -p tsconfig.typecheck.json"
23
24
  },
24
25
  "dependencies": {
@@ -0,0 +1,160 @@
1
+ #!/usr/bin/env node
2
+
3
+ import fs from "node:fs"
4
+ import path from "node:path"
5
+ import readline from "node:readline"
6
+
7
+ // ----------------------------------------------------
8
+ // CONFIGURATION
9
+ // ----------------------------------------------------
10
+ const ASSETS_THEME_PATH = "assets/css/theme"
11
+ const UI_THEME_FILE = "ui-theme.css"
12
+ const COLORS_FILE = "colors.css"
13
+
14
+ const THEMES = [
15
+ "primary-brand",
16
+ "secondary-brand",
17
+ "neutral",
18
+ "success",
19
+ "warning",
20
+ "info",
21
+ "danger",
22
+ ] as const
23
+
24
+ type Theme = typeof THEMES[number]
25
+
26
+ interface Replacement {
27
+ theme: Theme
28
+ from: string
29
+ to: string
30
+ }
31
+
32
+ // ----------------------------------------------------
33
+ // HELPERS
34
+ // ----------------------------------------------------
35
+ const rl = readline.createInterface({
36
+ input: process.stdin,
37
+ output: process.stdout,
38
+ })
39
+
40
+ const ask = (question: string): Promise<string> =>
41
+ new Promise(resolve => rl.question(question, answer => resolve(answer.trim())))
42
+
43
+ const readFile = (filePath: string): string =>
44
+ fs.readFileSync(filePath, "utf8")
45
+
46
+ const writeFile = (filePath: string, content: string): void =>
47
+ fs.writeFileSync(filePath, content)
48
+
49
+ const getColorSchemesFromColorsCss = (content: string): Set<string> => {
50
+ const regex = /--color-([a-z0-9-]+)-50:/g
51
+ const schemes = new Set<string>()
52
+
53
+ let match: RegExpExecArray | null
54
+ while ((match = regex.exec(content))) {
55
+ const scheme = match[1]
56
+
57
+ if (scheme) {
58
+ schemes.add(scheme)
59
+ }
60
+ }
61
+
62
+ return schemes
63
+ }
64
+
65
+ const extractCurrentSchemeForTheme = (
66
+ css: string,
67
+ theme: Theme
68
+ ): string | null => {
69
+ const regex = new RegExp(
70
+ String.raw`--color-theme-${theme}-\d+:\s*var\(--([a-z0-9-]+)-\d+\)`,
71
+ "i"
72
+ )
73
+
74
+ const match = regex.exec(css)
75
+ return match?.[1] ?? null
76
+ }
77
+
78
+ // ----------------------------------------------------
79
+ // MAIN
80
+ // ----------------------------------------------------
81
+ const run = async (): Promise<void> => {
82
+ const themePath = path.resolve(process.cwd(), ASSETS_THEME_PATH)
83
+ const uiThemePath = path.join(themePath, UI_THEME_FILE)
84
+ const colorsPath = path.join(themePath, COLORS_FILE)
85
+
86
+ if (!fs.existsSync(uiThemePath)) {
87
+ console.error(`❌ ui-theme.css not found at ${uiThemePath}`)
88
+ process.exit(1)
89
+ }
90
+
91
+ if (!fs.existsSync(colorsPath)) {
92
+ console.error(`❌ colors.css not found at ${colorsPath}`)
93
+ process.exit(1)
94
+ }
95
+
96
+ let uiThemeCss = readFile(uiThemePath)
97
+ const colorsCss = readFile(colorsPath)
98
+ const availableSchemes = getColorSchemesFromColorsCss(colorsCss)
99
+
100
+ const replacements: Replacement[] = []
101
+
102
+ console.log("\n🎨 UI Theme color scheme configuration\n")
103
+
104
+ for (const theme of THEMES) {
105
+ const currentScheme = extractCurrentSchemeForTheme(uiThemeCss, theme)
106
+
107
+ if (!currentScheme) {
108
+ console.log(`⚠️ Could not detect current scheme for "${theme}", skipping`)
109
+ continue
110
+ }
111
+
112
+ const answer = await ask(
113
+ `Do you want to replace "${theme}" color scheme? (current: ${currentScheme}) [y/N]: `
114
+ )
115
+
116
+ if (answer.toLowerCase() !== "y") {
117
+ continue
118
+ }
119
+
120
+ const newScheme = await ask(
121
+ `→ Enter new color scheme name (must exist in colors.css, ex.: lavender): `
122
+ )
123
+
124
+ if (!availableSchemes.has(newScheme)) {
125
+ console.error(
126
+ `❌ Color scheme "${newScheme}" does not exist in colors.css — skipping "${theme}"`
127
+ )
128
+ continue
129
+ }
130
+
131
+ replacements.push({
132
+ theme,
133
+ from: currentScheme,
134
+ to: newScheme,
135
+ })
136
+ }
137
+
138
+ rl.close()
139
+
140
+ if (replacements.length === 0) {
141
+ console.log("\nℹ️ No changes applied")
142
+ return
143
+ }
144
+
145
+ // Apply replacements AFTER all questions
146
+ for (const { theme, from, to } of replacements) {
147
+ const regex = new RegExp(
148
+ String.raw`(--color-theme-${theme}-\d+:\s*var\()--${from}-(\d+\))`,
149
+ "g"
150
+ )
151
+
152
+ uiThemeCss = uiThemeCss.replace(regex, `$1--${to}-$2`)
153
+ }
154
+
155
+ writeFile(uiThemePath, uiThemeCss)
156
+
157
+ console.log("\n✅ ui-theme.css updated successfully\n")
158
+ }
159
+
160
+ run()