piloti 1.0.0 → 1.0.1
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/bin/piloti.js
CHANGED
|
@@ -27,13 +27,13 @@ Usage:
|
|
|
27
27
|
|
|
28
28
|
Options:
|
|
29
29
|
-c, --config <path> Path to custom config.json (default: ./piloti.config.json)
|
|
30
|
-
-o, --output <path> Output directory for generated CSS (default: ./piloti
|
|
30
|
+
-o, --output <path> Output directory for generated CSS (default: ./piloti)
|
|
31
31
|
-h, --help Show this help message
|
|
32
32
|
|
|
33
33
|
Examples:
|
|
34
34
|
npx piloti
|
|
35
35
|
npx piloti --config ./my-tokens.json
|
|
36
|
-
npx piloti --config ./tokens.json --output ./styles
|
|
36
|
+
npx piloti --config ./tokens.json --output ./styles
|
|
37
37
|
`);
|
|
38
38
|
process.exit(0);
|
|
39
39
|
}
|
|
@@ -54,7 +54,7 @@ configPath = configPath
|
|
|
54
54
|
|
|
55
55
|
outputDir = outputDir
|
|
56
56
|
? path.resolve(cwd, outputDir)
|
|
57
|
-
: path.join(cwd, 'piloti
|
|
57
|
+
: path.join(cwd, 'piloti');
|
|
58
58
|
|
|
59
59
|
// Load config
|
|
60
60
|
if (!fs.existsSync(configPath)) {
|
|
@@ -102,6 +102,56 @@ const sanitizeClassName = (name) => {
|
|
|
102
102
|
return name.replace(/\//g, '\\/');
|
|
103
103
|
};
|
|
104
104
|
|
|
105
|
+
/**
|
|
106
|
+
* Copy file from package to output
|
|
107
|
+
*/
|
|
108
|
+
const copyFile = (src, dest) => {
|
|
109
|
+
if (fs.existsSync(src)) {
|
|
110
|
+
fs.copyFileSync(src, dest);
|
|
111
|
+
return true;
|
|
112
|
+
}
|
|
113
|
+
return false;
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
// =============================================================================
|
|
117
|
+
// COPY BASE FILES (reset, compositions)
|
|
118
|
+
// =============================================================================
|
|
119
|
+
|
|
120
|
+
console.log('Copying base files...');
|
|
121
|
+
|
|
122
|
+
const srcDir = path.join(packageDir, 'src');
|
|
123
|
+
let baseFilesCount = 0;
|
|
124
|
+
|
|
125
|
+
// Reset
|
|
126
|
+
if (copyFile(path.join(srcDir, '1-reset/reset.css'), path.join(outputDir, 'reset.css'))) {
|
|
127
|
+
console.log(' ✓ reset.css');
|
|
128
|
+
baseFilesCount++;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
// Base
|
|
132
|
+
if (copyFile(path.join(srcDir, '2-base/global.css'), path.join(outputDir, 'base.css'))) {
|
|
133
|
+
console.log(' ✓ base.css');
|
|
134
|
+
baseFilesCount++;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
// Compositions - combine into one file
|
|
138
|
+
const compositionsDir = path.join(srcDir, '3-compositions');
|
|
139
|
+
if (fs.existsSync(compositionsDir)) {
|
|
140
|
+
let compositionsContent = '/* Piloti Compositions */\n\n';
|
|
141
|
+
const compositionFiles = ['stack.css', 'cluster.css', 'flow.css'];
|
|
142
|
+
|
|
143
|
+
compositionFiles.forEach(file => {
|
|
144
|
+
const filePath = path.join(compositionsDir, file);
|
|
145
|
+
if (fs.existsSync(filePath)) {
|
|
146
|
+
compositionsContent += fs.readFileSync(filePath, 'utf8') + '\n';
|
|
147
|
+
}
|
|
148
|
+
});
|
|
149
|
+
|
|
150
|
+
fs.writeFileSync(path.join(outputDir, 'compositions.css'), compositionsContent);
|
|
151
|
+
console.log(' ✓ compositions.css (stack, cluster, flow)');
|
|
152
|
+
baseFilesCount++;
|
|
153
|
+
}
|
|
154
|
+
|
|
105
155
|
// =============================================================================
|
|
106
156
|
// GENERATE VARIABLES CSS
|
|
107
157
|
// =============================================================================
|
|
@@ -230,6 +280,9 @@ if (Object.keys(breakpoints).length > 0) {
|
|
|
230
280
|
// =============================================================================
|
|
231
281
|
|
|
232
282
|
let mainContent = `/* Piloti CSS Framework - Generated Entry Point */\n`;
|
|
283
|
+
mainContent += `@import url('./reset.css');\n`;
|
|
284
|
+
mainContent += `@import url('./base.css');\n`;
|
|
285
|
+
mainContent += `@import url('./compositions.css');\n`;
|
|
233
286
|
mainContent += `@import url('./variables.css');\n`;
|
|
234
287
|
mainContent += `@import url('./utilities.css');\n`;
|
|
235
288
|
if (responsiveCount > 0) {
|
|
@@ -254,11 +307,12 @@ if (warnings.length > 0) {
|
|
|
254
307
|
console.log('\n' + '='.repeat(50));
|
|
255
308
|
console.log('✅ Build complete!');
|
|
256
309
|
console.log('='.repeat(50));
|
|
310
|
+
console.log(` Base files: ${baseFilesCount} (reset, base, compositions)`);
|
|
257
311
|
console.log(` Variables: ${variableCount}`);
|
|
258
312
|
console.log(` Utilities: ${utilityCount}`);
|
|
259
313
|
console.log(` Responsive: ${responsiveCount}`);
|
|
260
|
-
console.log(` Total: ${variableCount + utilityCount + responsiveCount}`);
|
|
314
|
+
console.log(` Total: ${baseFilesCount + variableCount + utilityCount + responsiveCount}`);
|
|
261
315
|
console.log('='.repeat(50));
|
|
262
316
|
console.log(`\nImport in your project:`);
|
|
263
|
-
console.log(` @import url('
|
|
317
|
+
console.log(` @import url('./${path.relative(cwd, outputDir)}/index.css');`);
|
|
264
318
|
console.log('');
|
package/package.json
CHANGED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
:root {
|
|
2
|
+
color-scheme: light dark;
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
/* Styles du body */
|
|
6
|
+
body {
|
|
7
|
+
font-family: system-ui, sans-serif;
|
|
8
|
+
line-height: 1.5;
|
|
9
|
+
color: var(--color-dark);
|
|
10
|
+
background-color: var(--color-light);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
/* Liens par défaut */
|
|
14
|
+
a {
|
|
15
|
+
color: var(--color-primary);
|
|
16
|
+
text-decoration: none;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/* Dark mode */
|
|
20
|
+
@media (prefers-color-scheme: dark) {
|
|
21
|
+
body {
|
|
22
|
+
color: var(--color-light);
|
|
23
|
+
background-color: var(--color-dark);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/* Piloti Compositions */
|
|
2
|
+
|
|
3
|
+
/* Stack - Empilement vertical */
|
|
4
|
+
.stack {
|
|
5
|
+
display: flex;
|
|
6
|
+
flex-direction: column;
|
|
7
|
+
gap: var(--stack-space, var(--spacing-4));
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.stack[data-space="sm"] {
|
|
11
|
+
--stack-space: var(--spacing-2);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.stack[data-space="lg"] {
|
|
15
|
+
--stack-space: var(--spacing-8);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/* Cluster - Groupement horizontal */
|
|
19
|
+
.cluster {
|
|
20
|
+
display: flex;
|
|
21
|
+
flex-wrap: wrap;
|
|
22
|
+
gap: var(--cluster-space, var(--spacing-4));
|
|
23
|
+
align-items: center;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.cluster[data-justify="between"] {
|
|
27
|
+
justify-content: space-between;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.cluster[data-justify="center"] {
|
|
31
|
+
justify-content: center;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/* Flow - Espacement */
|
|
35
|
+
.flow > * + * {
|
|
36
|
+
margin-top: var(--flow-space, var(--spacing-4));
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.test {
|
|
40
|
+
padding: var(--spacing-3)
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.flow[data-space="sm"] {
|
|
44
|
+
--flow-space: 0.5rem;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
.flow[data-space="lg"] {
|
|
48
|
+
--flow-space: 2rem;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/* Plus d'espace avant les titres */
|
|
52
|
+
.flow > * + h2,
|
|
53
|
+
.flow > * + h3 {
|
|
54
|
+
margin-top: calc(var(--flow-space, 1rem) * 2);
|
|
55
|
+
}
|
|
56
|
+
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/* 1. Use a more-intuitive box-sizing model */
|
|
2
|
+
*, *::before, *::after {
|
|
3
|
+
box-sizing: border-box;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
/* 2. Remove default margin */
|
|
7
|
+
* {
|
|
8
|
+
margin: 0;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
/* 3. Enable keyword animations */
|
|
12
|
+
@media (prefers-reduced-motion: no-preference) {
|
|
13
|
+
html {
|
|
14
|
+
interpolate-size: allow-keywords;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
body {
|
|
19
|
+
/* 4. Add accessible line-height */
|
|
20
|
+
line-height: 1.5;
|
|
21
|
+
/* 5. Improve text rendering */
|
|
22
|
+
-webkit-font-smoothing: antialiased;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/* 6. Improve media defaults */
|
|
26
|
+
img, picture, video, canvas, svg {
|
|
27
|
+
display: block;
|
|
28
|
+
max-width: 100%;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/* 7. Inherit fonts for form controls */
|
|
32
|
+
input, button, textarea, select {
|
|
33
|
+
font: inherit;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/* 8. Avoid text overflows */
|
|
37
|
+
p, h1, h2, h3, h4, h5, h6 {
|
|
38
|
+
overflow-wrap: break-word;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/* 9. Improve line wrapping */
|
|
42
|
+
p {
|
|
43
|
+
text-wrap: pretty;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
h1, h2, h3, h4, h5, h6 {
|
|
47
|
+
text-wrap: balance;
|
|
48
|
+
}
|