dispersa 0.4.2 → 0.4.3
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 +8 -9
- package/dist/builders.cjs +14 -2
- package/dist/builders.cjs.map +1 -1
- package/dist/builders.d.cts +3 -2
- package/dist/builders.d.ts +3 -2
- package/dist/builders.js +14 -2
- package/dist/builders.js.map +1 -1
- package/dist/index.cjs +14 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +14 -2
- package/dist/index.js.map +1 -1
- package/dist/transforms.cjs +0 -12
- package/dist/transforms.cjs.map +1 -1
- package/dist/transforms.d.cts +1 -5
- package/dist/transforms.d.ts +1 -5
- package/dist/transforms.js +1 -12
- package/dist/transforms.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -4,6 +4,7 @@ import { constants } from 'fs';
|
|
|
4
4
|
import { mkdir, writeFile, access, readFile } from 'fs/promises';
|
|
5
5
|
import * as path from 'path';
|
|
6
6
|
import { JsonPointer } from 'json-ptr';
|
|
7
|
+
import { kebabCase } from 'change-case';
|
|
7
8
|
import { converter, formatHex8, formatHex } from 'culori';
|
|
8
9
|
import prettier from 'prettier';
|
|
9
10
|
|
|
@@ -3290,7 +3291,7 @@ function indentStr(width, level) {
|
|
|
3290
3291
|
function buildGeneratedFileHeader() {
|
|
3291
3292
|
return [
|
|
3292
3293
|
"// Generated by Dispersa - do not edit manually",
|
|
3293
|
-
"// https://github.com/
|
|
3294
|
+
"// https://github.com/dispersa-core/dispersa"
|
|
3294
3295
|
].join("\n");
|
|
3295
3296
|
}
|
|
3296
3297
|
function toSafeIdentifier(name, keywords, capitalize) {
|
|
@@ -6514,6 +6515,17 @@ function isTransitionToken(token) {
|
|
|
6514
6515
|
function isGradientToken(token) {
|
|
6515
6516
|
return token.$type === "gradient";
|
|
6516
6517
|
}
|
|
6518
|
+
function nameKebabCase() {
|
|
6519
|
+
return {
|
|
6520
|
+
transform: (token) => {
|
|
6521
|
+
const name = kebabCase(token.path.join(" "));
|
|
6522
|
+
return {
|
|
6523
|
+
...token,
|
|
6524
|
+
name
|
|
6525
|
+
};
|
|
6526
|
+
}
|
|
6527
|
+
};
|
|
6528
|
+
}
|
|
6517
6529
|
function isColorObject(value) {
|
|
6518
6530
|
return typeof value === "object" && value !== null && "colorSpace" in value && "components" in value;
|
|
6519
6531
|
}
|
|
@@ -9460,7 +9472,7 @@ function css(config) {
|
|
|
9460
9472
|
file,
|
|
9461
9473
|
renderer: cssRenderer(),
|
|
9462
9474
|
options: { preset, ...rendererOptions },
|
|
9463
|
-
transforms,
|
|
9475
|
+
transforms: [nameKebabCase(), ...transforms ?? []],
|
|
9464
9476
|
filters,
|
|
9465
9477
|
hooks
|
|
9466
9478
|
};
|