@moondreamsdev/dreamer-ui 1.6.3 ā 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 +13 -13
- 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
|
@@ -18,13 +18,13 @@ function extractColorsFromSource() {
|
|
|
18
18
|
if (themeMatch) {
|
|
19
19
|
const topLevelComment = '/** Necessary theme styles for Dreamer UI library - Customize as desired! */\n';
|
|
20
20
|
const themeContent = themeMatch[1].trim();
|
|
21
|
-
|
|
21
|
+
|
|
22
22
|
// Add proper indentation to each line of theme content
|
|
23
23
|
const indentedThemeContent = themeContent
|
|
24
24
|
.split('\n')
|
|
25
|
-
.map(line => line.trim() ? ` ${line.trim()}` : line)
|
|
25
|
+
.map((line) => (line.trim() ? ` ${line.trim()}` : line))
|
|
26
26
|
.join('\n');
|
|
27
|
-
|
|
27
|
+
|
|
28
28
|
return `${topLevelComment}\n@theme dreamer-ui {\n${indentedThemeContent}\n}`;
|
|
29
29
|
} else {
|
|
30
30
|
throw new Error('Could not find @theme library block in source file');
|
|
@@ -40,23 +40,23 @@ async function createCSSFile(targetPath, cssContent) {
|
|
|
40
40
|
// Check if file already exists
|
|
41
41
|
if (existsSync(targetPath)) {
|
|
42
42
|
console.log(`š CSS file already exists at: ${targetPath}`);
|
|
43
|
-
|
|
43
|
+
|
|
44
44
|
// Ask user if they want to overwrite (only in interactive mode)
|
|
45
45
|
const isCI = process.env.CI || process.env.NODE_ENV === 'production' || !process.stdin.isTTY;
|
|
46
|
-
|
|
46
|
+
|
|
47
47
|
if (!isCI) {
|
|
48
48
|
const rl = createInterface({
|
|
49
49
|
input: process.stdin,
|
|
50
|
-
output: process.stdout
|
|
50
|
+
output: process.stdout,
|
|
51
51
|
});
|
|
52
|
-
|
|
52
|
+
|
|
53
53
|
// Handle Ctrl+C interruption
|
|
54
54
|
rl.on('SIGINT', () => {
|
|
55
55
|
console.log('\nš Operation cancelled by user.');
|
|
56
56
|
rl.close();
|
|
57
57
|
process.exit(0);
|
|
58
58
|
});
|
|
59
|
-
|
|
59
|
+
|
|
60
60
|
return new Promise((resolve) => {
|
|
61
61
|
rl.question('Do you want to overwrite it? (y/N): ', (answer) => {
|
|
62
62
|
rl.close();
|
|
@@ -75,7 +75,7 @@ async function createCSSFile(targetPath, cssContent) {
|
|
|
75
75
|
return false;
|
|
76
76
|
}
|
|
77
77
|
}
|
|
78
|
-
|
|
78
|
+
|
|
79
79
|
writeFile();
|
|
80
80
|
return true; // Indicate file was written
|
|
81
81
|
|
|
@@ -103,7 +103,7 @@ function getDefaultPath() {
|
|
|
103
103
|
'./styles/dreamer-ui.css',
|
|
104
104
|
'./css/dreamer-ui.css',
|
|
105
105
|
'./src/dreamer-ui.css',
|
|
106
|
-
'./dreamer-ui.css'
|
|
106
|
+
'./dreamer-ui.css',
|
|
107
107
|
];
|
|
108
108
|
|
|
109
109
|
for (const p of possiblePaths) {
|
|
@@ -119,7 +119,7 @@ function getDefaultPath() {
|
|
|
119
119
|
async function promptUserForPath() {
|
|
120
120
|
const rl = createInterface({
|
|
121
121
|
input: process.stdin,
|
|
122
|
-
output: process.stdout
|
|
122
|
+
output: process.stdout,
|
|
123
123
|
});
|
|
124
124
|
|
|
125
125
|
const defaultPath = getDefaultPath();
|
|
@@ -169,8 +169,8 @@ async function main() {
|
|
|
169
169
|
|
|
170
170
|
// Run if called directly
|
|
171
171
|
// ES module-compatible entrypoint check
|
|
172
|
-
if (process.argv[1] ===
|
|
172
|
+
if (process.argv[1] === fileURLToPath(import.meta.url)) {
|
|
173
173
|
main().catch(console.error);
|
|
174
174
|
}
|
|
175
175
|
|
|
176
|
-
export default main;
|
|
176
|
+
export default main;
|