@vettvangur/design-system 2.0.76 → 2.0.78
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 +16 -4
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -4112,6 +4112,16 @@ function renderTheme(lines) {
|
|
|
4112
4112
|
return `@theme {\n${lines.join('\n')}\n}\n`;
|
|
4113
4113
|
}
|
|
4114
4114
|
|
|
4115
|
+
/**
|
|
4116
|
+
* Render utilities.
|
|
4117
|
+
*
|
|
4118
|
+
* @param blocks - Value.
|
|
4119
|
+
* @returns String result.
|
|
4120
|
+
*/
|
|
4121
|
+
function renderUtilities(blocks) {
|
|
4122
|
+
return blocks.length ? `${blocks.join('\n\n')}\n` : '';
|
|
4123
|
+
}
|
|
4124
|
+
|
|
4115
4125
|
/**
|
|
4116
4126
|
* Generate shadows.
|
|
4117
4127
|
*
|
|
@@ -4127,19 +4137,21 @@ function renderTheme(lines) {
|
|
|
4127
4137
|
*/
|
|
4128
4138
|
async function generateShadows(variableSet, config) {
|
|
4129
4139
|
message('generating shadows...');
|
|
4130
|
-
const
|
|
4140
|
+
const themeLines = [];
|
|
4141
|
+
const utilityBlocks = [];
|
|
4131
4142
|
for (const [rawKey, token] of Object.entries(variableSet || {})) {
|
|
4132
4143
|
const key = toShadowKey(rawKey);
|
|
4133
4144
|
const value = buildShadowValue(token?.effects);
|
|
4134
4145
|
if (!value) {
|
|
4135
4146
|
continue;
|
|
4136
4147
|
}
|
|
4137
|
-
|
|
4148
|
+
themeLines.push(` --${key}: ${value};`);
|
|
4149
|
+
utilityBlocks.push(`@utility ${key} {\n box-shadow: var(--${key});\n}`);
|
|
4138
4150
|
}
|
|
4139
|
-
const css = `/* AUTO-GENERATED - DO NOT EDIT BY HAND */\n\n${renderTheme(
|
|
4151
|
+
const css = `/* AUTO-GENERATED - DO NOT EDIT BY HAND */\n\n${renderTheme(themeLines)}\n${renderUtilities(utilityBlocks)}`;
|
|
4140
4152
|
const outPath = path.join(config.paths.styles, 'config', 'shadow.css');
|
|
4141
4153
|
await fs$1.writeFile(outPath, css, 'utf8');
|
|
4142
|
-
message(`finished generating shadows (${
|
|
4154
|
+
message(`finished generating shadows (${themeLines.length})`);
|
|
4143
4155
|
}
|
|
4144
4156
|
|
|
4145
4157
|
/**
|