@moondreamsdev/dreamer-ui 1.6.2 ā 1.6.4
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 +5 -4
- package/dist/init.js +18 -12
- package/dist/theme.css +2 -4
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -23,12 +23,13 @@ Then run the init script:
|
|
|
23
23
|
And, finally, install the stylesheets in main CSS file (recommended):
|
|
24
24
|
|
|
25
25
|
```css
|
|
26
|
-
@import "@moondreamsdev/dreamer-ui/styles";
|
|
27
|
-
@import './dreamer-ui.css';
|
|
28
|
-
/* below line is necessary for TailwindCSS styles in library to be processed */
|
|
29
|
-
@source "../node_modules/@moondreamsdev/dreamer-ui/dist/**/*.{js,jsx,ts,tsx}";
|
|
26
|
+
@import "@moondreamsdev/dreamer-ui/styles"; /* non-TailwindCSS styles */
|
|
27
|
+
@import './dreamer-ui.css'; /* customizable, theme styles */
|
|
30
28
|
|
|
31
29
|
/* other styles */
|
|
30
|
+
|
|
31
|
+
/* for TailwindCSS styles in library to be processed */
|
|
32
|
+
@source "../node_modules/@moondreamsdev/dreamer-ui/dist/**/*.{js,jsx,ts,tsx}";
|
|
32
33
|
```
|
|
33
34
|
|
|
34
35
|
## Usage
|
package/dist/init.js
CHANGED
|
@@ -11,7 +11,6 @@ function extractColorsFromSource() {
|
|
|
11
11
|
const __dirname = dirname(__filename);
|
|
12
12
|
const sourceFile = join(__dirname, 'theme.css');
|
|
13
13
|
const sourceContent = readFileSync(sourceFile, 'utf8');
|
|
14
|
-
console.warn('sourceContent', sourceContent); // REMOVE
|
|
15
14
|
|
|
16
15
|
// Extract the @theme library block content only
|
|
17
16
|
const themeMatch = sourceContent.match(/@theme library\s*\{([\s\S]*?)\}/);
|
|
@@ -19,7 +18,14 @@ function extractColorsFromSource() {
|
|
|
19
18
|
if (themeMatch) {
|
|
20
19
|
const topLevelComment = '/** Necessary theme styles for Dreamer UI library - Customize as desired! */\n';
|
|
21
20
|
const themeContent = themeMatch[1].trim();
|
|
22
|
-
|
|
21
|
+
|
|
22
|
+
// Add proper indentation to each line of theme content
|
|
23
|
+
const indentedThemeContent = themeContent
|
|
24
|
+
.split('\n')
|
|
25
|
+
.map((line) => (line.trim() ? ` ${line.trim()}` : line))
|
|
26
|
+
.join('\n');
|
|
27
|
+
|
|
28
|
+
return `${topLevelComment}\n@theme dreamer-ui {\n${indentedThemeContent}\n}`;
|
|
23
29
|
} else {
|
|
24
30
|
throw new Error('Could not find @theme library block in source file');
|
|
25
31
|
}
|
|
@@ -34,23 +40,23 @@ async function createCSSFile(targetPath, cssContent) {
|
|
|
34
40
|
// Check if file already exists
|
|
35
41
|
if (existsSync(targetPath)) {
|
|
36
42
|
console.log(`š CSS file already exists at: ${targetPath}`);
|
|
37
|
-
|
|
43
|
+
|
|
38
44
|
// Ask user if they want to overwrite (only in interactive mode)
|
|
39
45
|
const isCI = process.env.CI || process.env.NODE_ENV === 'production' || !process.stdin.isTTY;
|
|
40
|
-
|
|
46
|
+
|
|
41
47
|
if (!isCI) {
|
|
42
48
|
const rl = createInterface({
|
|
43
49
|
input: process.stdin,
|
|
44
|
-
output: process.stdout
|
|
50
|
+
output: process.stdout,
|
|
45
51
|
});
|
|
46
|
-
|
|
52
|
+
|
|
47
53
|
// Handle Ctrl+C interruption
|
|
48
54
|
rl.on('SIGINT', () => {
|
|
49
55
|
console.log('\nš Operation cancelled by user.');
|
|
50
56
|
rl.close();
|
|
51
57
|
process.exit(0);
|
|
52
58
|
});
|
|
53
|
-
|
|
59
|
+
|
|
54
60
|
return new Promise((resolve) => {
|
|
55
61
|
rl.question('Do you want to overwrite it? (y/N): ', (answer) => {
|
|
56
62
|
rl.close();
|
|
@@ -69,7 +75,7 @@ async function createCSSFile(targetPath, cssContent) {
|
|
|
69
75
|
return false;
|
|
70
76
|
}
|
|
71
77
|
}
|
|
72
|
-
|
|
78
|
+
|
|
73
79
|
writeFile();
|
|
74
80
|
return true; // Indicate file was written
|
|
75
81
|
|
|
@@ -97,7 +103,7 @@ function getDefaultPath() {
|
|
|
97
103
|
'./styles/dreamer-ui.css',
|
|
98
104
|
'./css/dreamer-ui.css',
|
|
99
105
|
'./src/dreamer-ui.css',
|
|
100
|
-
'./dreamer-ui.css'
|
|
106
|
+
'./dreamer-ui.css',
|
|
101
107
|
];
|
|
102
108
|
|
|
103
109
|
for (const p of possiblePaths) {
|
|
@@ -113,7 +119,7 @@ function getDefaultPath() {
|
|
|
113
119
|
async function promptUserForPath() {
|
|
114
120
|
const rl = createInterface({
|
|
115
121
|
input: process.stdin,
|
|
116
|
-
output: process.stdout
|
|
122
|
+
output: process.stdout,
|
|
117
123
|
});
|
|
118
124
|
|
|
119
125
|
const defaultPath = getDefaultPath();
|
|
@@ -163,8 +169,8 @@ async function main() {
|
|
|
163
169
|
|
|
164
170
|
// Run if called directly
|
|
165
171
|
// ES module-compatible entrypoint check
|
|
166
|
-
if (process.argv[1] ===
|
|
172
|
+
if (process.argv[1] === fileURLToPath(import.meta.url)) {
|
|
167
173
|
main().catch(console.error);
|
|
168
174
|
}
|
|
169
175
|
|
|
170
|
-
export default main;
|
|
176
|
+
export default main;
|
package/dist/theme.css
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
@theme library {
|
|
2
|
-
--color-primary: var(--color-violet-400);
|
|
2
|
+
--color-primary: var(--color-violet-400);
|
|
3
3
|
--color-primary-foreground: var(--color-white);
|
|
4
4
|
--color-secondary: var(--color-violet-200);
|
|
5
5
|
--color-secondary-foreground: var(--color-black);
|
|
@@ -9,7 +9,5 @@
|
|
|
9
9
|
--color-muted-foreground: var(--color-gray-800);
|
|
10
10
|
|
|
11
11
|
--color-success: var(--color-green-500);
|
|
12
|
-
--color-border: var(
|
|
13
|
-
--color-slate-600
|
|
14
|
-
); /* for input/textarea borders and dividers ā could use primary, secondary, or muted color for simplicity */
|
|
12
|
+
--color-border: var(--color-slate-600); /* for input/textarea borders and dividers */
|
|
15
13
|
}
|