sdaia-ui 1.5.0 → 1.6.0
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/dist/index.js +80 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -129,6 +129,65 @@ var DEFAULT_UTILS_DIR = "src/lib";
|
|
|
129
129
|
var TAILWIND_IMPORT = '@import "tailwindcss";';
|
|
130
130
|
var TOKENS_IMPORT = '@import "@sdaia-ds/tokens/css";';
|
|
131
131
|
var DARK_VARIANT_RULE = "@custom-variant dark (&:where(.dark, .dark *, .theme-dark, .theme-dark *));";
|
|
132
|
+
var GLASS_SURFACE_RULE = `/* \u2500\u2500 Liquid-glass surface \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500
|
|
133
|
+
* Reusable translucent "glass" material, applied via \`surface="glass"\`
|
|
134
|
+
* on supporting components (DatePicker first, more to follow). The manual
|
|
135
|
+
* bevel box-shadow + backdrop blur come from Figma
|
|
136
|
+
* (Background/background-liquid-glass). Single source of truth: any element
|
|
137
|
+
* carrying \`.glass-surface\` adapts to light & dark scopes automatically
|
|
138
|
+
* because the bg + bevel are driven by theme-aware custom properties. */
|
|
139
|
+
:root {
|
|
140
|
+
--ds-glass-blur: 5.4px;
|
|
141
|
+
|
|
142
|
+
--ds-glass-bg-light: rgba(255, 255, 255, 0.5);
|
|
143
|
+
--ds-glass-bg-dark: rgba(38, 38, 38, 0.45);
|
|
144
|
+
|
|
145
|
+
--ds-glass-shadow-light:
|
|
146
|
+
0 0 35.294px 0 #f2f2f2 inset,
|
|
147
|
+
0 0 6.618px 0 rgba(255, 255, 255, 0.5) inset,
|
|
148
|
+
-2.206px -2.206px 1.103px -2.206px #fff inset,
|
|
149
|
+
2.206px 2.206px 1.103px -2.206px #fff inset,
|
|
150
|
+
-2.206px -2.206px 0 -1.103px #262626 inset,
|
|
151
|
+
2.206px 2.206px 0 -1.103px #333 inset,
|
|
152
|
+
0 4px 4px 0 rgba(0, 0, 0, 0.05);
|
|
153
|
+
--ds-glass-shadow-dark:
|
|
154
|
+
0 0 35.294px 0 rgba(255, 255, 255, 0.04) inset,
|
|
155
|
+
0 0 6.618px 0 rgba(255, 255, 255, 0.06) inset,
|
|
156
|
+
-2.206px -2.206px 1.103px -2.206px rgba(255, 255, 255, 0.2) inset,
|
|
157
|
+
2.206px 2.206px 1.103px -2.206px rgba(255, 255, 255, 0.2) inset,
|
|
158
|
+
-2.206px -2.206px 0 -1.103px rgba(0, 0, 0, 0.7) inset,
|
|
159
|
+
2.206px 2.206px 0 -1.103px rgba(0, 0, 0, 0.55) inset,
|
|
160
|
+
0 4px 4px 0 rgba(0, 0, 0, 0.3);
|
|
161
|
+
|
|
162
|
+
--ds-glass-bg: var(--ds-glass-bg-light);
|
|
163
|
+
--ds-glass-shadow: var(--ds-glass-shadow-light);
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
.dark,
|
|
167
|
+
.theme-dark,
|
|
168
|
+
.preview-theme-dark {
|
|
169
|
+
--ds-glass-bg: var(--ds-glass-bg-dark);
|
|
170
|
+
--ds-glass-shadow: var(--ds-glass-shadow-dark);
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
.preview-theme-light {
|
|
174
|
+
--ds-glass-bg: var(--ds-glass-bg-light);
|
|
175
|
+
--ds-glass-shadow: var(--ds-glass-shadow-light);
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
.glass-surface {
|
|
179
|
+
background: var(--ds-glass-bg);
|
|
180
|
+
box-shadow: var(--ds-glass-shadow);
|
|
181
|
+
-webkit-backdrop-filter: blur(var(--ds-glass-blur));
|
|
182
|
+
backdrop-filter: blur(var(--ds-glass-blur));
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
@supports not ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) {
|
|
186
|
+
:root {
|
|
187
|
+
--ds-glass-bg-light: rgba(255, 255, 255, 0.88);
|
|
188
|
+
--ds-glass-bg-dark: rgba(38, 38, 38, 0.92);
|
|
189
|
+
}
|
|
190
|
+
}`;
|
|
132
191
|
function isTailwindInstalled() {
|
|
133
192
|
const pkgJsonPath = path3.resolve(process.cwd(), "package.json");
|
|
134
193
|
if (!fs3.existsSync(pkgJsonPath)) return false;
|
|
@@ -185,6 +244,16 @@ ${content}`);
|
|
|
185
244
|
}
|
|
186
245
|
return true;
|
|
187
246
|
}
|
|
247
|
+
function ensureGlassSurfaceRule(cssFilePath) {
|
|
248
|
+
const content = fs3.readFileSync(cssFilePath, "utf-8");
|
|
249
|
+
if (/\.glass-surface\s*\{/.test(content)) return false;
|
|
250
|
+
const trimmed = content.replace(/\s*$/, "");
|
|
251
|
+
fs3.writeFileSync(cssFilePath, `${trimmed}
|
|
252
|
+
|
|
253
|
+
${GLASS_SURFACE_RULE}
|
|
254
|
+
`);
|
|
255
|
+
return true;
|
|
256
|
+
}
|
|
188
257
|
async function init() {
|
|
189
258
|
logger.break();
|
|
190
259
|
logger.info("Initializing SDAIA Design System in your project...");
|
|
@@ -341,11 +410,21 @@ export default config;
|
|
|
341
410
|
} else {
|
|
342
411
|
logger.info("Dark variant rule already present in CSS file");
|
|
343
412
|
}
|
|
413
|
+
const addedGlass = ensureGlassSurfaceRule(cssFilePath);
|
|
414
|
+
if (addedGlass) {
|
|
415
|
+
logger.success(
|
|
416
|
+
`Added liquid-glass surface styles to ${path3.relative(process.cwd(), cssFilePath)}`
|
|
417
|
+
);
|
|
418
|
+
} else {
|
|
419
|
+
logger.info("Liquid-glass surface styles already present in CSS file");
|
|
420
|
+
}
|
|
344
421
|
} else {
|
|
345
422
|
logger.warn(
|
|
346
423
|
`Could not find a CSS entry file. Add these to your main CSS file:
|
|
347
424
|
${TOKENS_IMPORT}
|
|
348
|
-
${DARK_VARIANT_RULE}
|
|
425
|
+
${DARK_VARIANT_RULE}
|
|
426
|
+
|
|
427
|
+
${GLASS_SURFACE_RULE}`
|
|
349
428
|
);
|
|
350
429
|
}
|
|
351
430
|
const utilsPath = path3.resolve(process.cwd(), config.utilsDir);
|