@breadstone-infrastructure/style-dictionary 0.0.173 → 0.0.175
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/CHANGELOG.md +24 -0
- package/formats/tailwind/DesignTokenType.d.ts +10 -0
- package/formats/tailwind/DesignTokenType.d.ts.map +1 -0
- package/formats/tailwind/DesignTokenType.js +3 -0
- package/formats/tailwind/DesignTokenType.js.map +1 -0
- package/formats/tailwind/TailwindPropertyMapping.d.ts +66 -0
- package/formats/tailwind/TailwindPropertyMapping.d.ts.map +1 -0
- package/formats/tailwind/TailwindPropertyMapping.js +188 -0
- package/formats/tailwind/TailwindPropertyMapping.js.map +1 -0
- package/formats/tailwind/buildTailwindConfig.d.ts +23 -0
- package/formats/tailwind/buildTailwindConfig.d.ts.map +1 -0
- package/formats/tailwind/buildTailwindConfig.js +191 -0
- package/formats/tailwind/buildTailwindConfig.js.map +1 -0
- package/formats/tailwind/index.d.ts +2 -0
- package/formats/tailwind/index.d.ts.map +1 -0
- package/formats/tailwind/index.js +18 -0
- package/formats/tailwind/index.js.map +1 -0
- package/formats/tailwind/tailwindFormat.d.ts +17 -0
- package/formats/tailwind/tailwindFormat.d.ts.map +1 -0
- package/formats/tailwind/tailwindFormat.js +58 -0
- package/formats/tailwind/tailwindFormat.js.map +1 -0
- package/index.d.ts +9 -0
- package/index.d.ts.map +1 -0
- package/index.js +32 -0
- package/index.js.map +1 -0
- package/package.json +8 -7
- package/{Preprocessors/Shadow.d.ts → preprocessors/expandShadowPreprocessor.d.ts} +1 -1
- package/preprocessors/expandShadowPreprocessor.d.ts.map +1 -0
- package/{Preprocessors/Shadow.js → preprocessors/expandShadowPreprocessor.js} +1 -12
- package/preprocessors/expandShadowPreprocessor.js.map +1 -0
- package/preprocessors/lint/engine/preprocessor.d.ts +12 -0
- package/preprocessors/lint/engine/preprocessor.d.ts.map +1 -0
- package/preprocessors/lint/engine/preprocessor.js +44 -0
- package/preprocessors/lint/engine/preprocessor.js.map +1 -0
- package/preprocessors/lint/engine/types.d.ts +21 -0
- package/preprocessors/lint/engine/types.d.ts.map +1 -0
- package/preprocessors/lint/engine/types.js +4 -0
- package/preprocessors/lint/engine/types.js.map +1 -0
- package/preprocessors/lint/engine/walker.d.ts +13 -0
- package/preprocessors/lint/engine/walker.d.ts.map +1 -0
- package/preprocessors/lint/engine/walker.js +30 -0
- package/preprocessors/lint/engine/walker.js.map +1 -0
- package/preprocessors/lint/index.d.ts +4 -0
- package/preprocessors/lint/index.d.ts.map +1 -0
- package/preprocessors/lint/index.js +19 -0
- package/preprocessors/lint/index.js.map +1 -0
- package/preprocessors/lint/rules/forbiddenTokenName.d.ts +25 -0
- package/preprocessors/lint/rules/forbiddenTokenName.d.ts.map +1 -0
- package/preprocessors/lint/rules/forbiddenTokenName.js +40 -0
- package/preprocessors/lint/rules/forbiddenTokenName.js.map +1 -0
- package/preprocessors/lint/rules/forbiddenValue.d.ts +31 -0
- package/preprocessors/lint/rules/forbiddenValue.d.ts.map +1 -0
- package/preprocessors/lint/rules/forbiddenValue.js +48 -0
- package/preprocessors/lint/rules/forbiddenValue.js.map +1 -0
- package/preprocessors/lint/rules/index.d.ts +9 -0
- package/preprocessors/lint/rules/index.d.ts.map +1 -0
- package/preprocessors/lint/rules/index.js +25 -0
- package/preprocessors/lint/rules/index.js.map +1 -0
- package/preprocessors/lint/rules/namingConvention.d.ts +26 -0
- package/preprocessors/lint/rules/namingConvention.d.ts.map +1 -0
- package/preprocessors/lint/rules/namingConvention.js +35 -0
- package/preprocessors/lint/rules/namingConvention.js.map +1 -0
- package/preprocessors/lint/rules/noDollarProps.d.ts +6 -0
- package/preprocessors/lint/rules/noDollarProps.d.ts.map +1 -0
- package/preprocessors/lint/rules/noDollarProps.js +27 -0
- package/preprocessors/lint/rules/noDollarProps.js.map +1 -0
- package/preprocessors/lint/rules/requireType.d.ts +6 -0
- package/preprocessors/lint/rules/requireType.d.ts.map +1 -0
- package/preprocessors/lint/rules/requireType.js +21 -0
- package/preprocessors/lint/rules/requireType.js.map +1 -0
- package/preprocessors/lint/rules/requireValue.d.ts +6 -0
- package/preprocessors/lint/rules/requireValue.d.ts.map +1 -0
- package/preprocessors/lint/rules/requireValue.js +21 -0
- package/preprocessors/lint/rules/requireValue.js.map +1 -0
- package/preprocessors/lint/rules/validType.d.ts +25 -0
- package/preprocessors/lint/rules/validType.d.ts.map +1 -0
- package/preprocessors/lint/rules/validType.js +41 -0
- package/preprocessors/lint/rules/validType.js.map +1 -0
- package/preprocessors/lint/rules/valueTypeByTokenType.d.ts +40 -0
- package/preprocessors/lint/rules/valueTypeByTokenType.d.ts.map +1 -0
- package/preprocessors/lint/rules/valueTypeByTokenType.js +80 -0
- package/preprocessors/lint/rules/valueTypeByTokenType.js.map +1 -0
- package/transforms/gradientCssTransform.d.ts +3 -0
- package/transforms/gradientCssTransform.d.ts.map +1 -0
- package/{Transforms/Gradient.js → transforms/gradientCssTransform.js} +6 -6
- package/transforms/gradientCssTransform.js.map +1 -0
- package/transforms/letterSpacingCalcCssTransform.d.ts +3 -0
- package/transforms/letterSpacingCalcCssTransform.d.ts.map +1 -0
- package/{Transforms/LetterSpacing.js → transforms/letterSpacingCalcCssTransform.js} +4 -4
- package/transforms/letterSpacingCalcCssTransform.js.map +1 -0
- package/transforms/listScssTransform.d.ts +3 -0
- package/transforms/listScssTransform.d.ts.map +1 -0
- package/transforms/listScssTransform.js +14 -0
- package/transforms/listScssTransform.js.map +1 -0
- package/{Transforms/QuoteString.d.ts → transforms/quoteStringTransform.d.ts} +1 -1
- package/transforms/quoteStringTransform.d.ts.map +1 -0
- package/{Transforms/QuoteString.js → transforms/quoteStringTransform.js} +4 -4
- package/transforms/quoteStringTransform.js.map +1 -0
- package/{Transforms/Shadow.d.ts → transforms/shadowCssTransform.d.ts} +1 -1
- package/transforms/shadowCssTransform.d.ts.map +1 -0
- package/{Transforms/Shadow.js → transforms/shadowCssTransform.js} +4 -4
- package/transforms/shadowCssTransform.js.map +1 -0
- package/{Utilities/Extract.d.ts → utilities/extractTokensByType.d.ts} +1 -1
- package/utilities/extractTokensByType.d.ts.map +1 -0
- package/{Utilities/Extract.js → utilities/extractTokensByType.js} +2 -2
- package/utilities/extractTokensByType.js.map +1 -0
- package/utilities/getType.d.ts +9 -0
- package/utilities/getType.d.ts.map +1 -0
- package/utilities/getType.js +14 -0
- package/utilities/getType.js.map +1 -0
- package/{Utilities/GetValue.d.ts → utilities/getValue.d.ts} +4 -4
- package/utilities/getValue.d.ts.map +1 -0
- package/{Utilities/GetValue.js → utilities/getValue.js} +4 -4
- package/utilities/getValue.js.map +1 -0
- package/Index.d.ts +0 -9
- package/Index.d.ts.map +0 -1
- package/Index.js +0 -20
- package/Index.js.map +0 -1
- package/Preprocessors/Lint.d.ts +0 -3
- package/Preprocessors/Lint.d.ts.map +0 -1
- package/Preprocessors/Lint.js +0 -65
- package/Preprocessors/Lint.js.map +0 -1
- package/Preprocessors/Shadow.d.ts.map +0 -1
- package/Preprocessors/Shadow.js.map +0 -1
- package/Transforms/Gradient.d.ts +0 -3
- package/Transforms/Gradient.d.ts.map +0 -1
- package/Transforms/Gradient.js.map +0 -1
- package/Transforms/LetterSpacing.d.ts +0 -3
- package/Transforms/LetterSpacing.d.ts.map +0 -1
- package/Transforms/LetterSpacing.js.map +0 -1
- package/Transforms/List.d.ts +0 -3
- package/Transforms/List.d.ts.map +0 -1
- package/Transforms/List.js +0 -14
- package/Transforms/List.js.map +0 -1
- package/Transforms/NameSnakeUpperCase.d.ts +0 -6
- package/Transforms/NameSnakeUpperCase.d.ts.map +0 -1
- package/Transforms/NameSnakeUpperCase.js +0 -20
- package/Transforms/NameSnakeUpperCase.js.map +0 -1
- package/Transforms/QuoteString.d.ts.map +0 -1
- package/Transforms/QuoteString.js.map +0 -1
- package/Transforms/Shadow.d.ts.map +0 -1
- package/Transforms/Shadow.js.map +0 -1
- package/Utilities/Extract.d.ts.map +0 -1
- package/Utilities/Extract.js.map +0 -1
- package/Utilities/GetValue.d.ts.map +0 -1
- package/Utilities/GetValue.js.map +0 -1
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ruleDollarProps = ruleDollarProps;
|
|
4
|
+
/**
|
|
5
|
+
* Rule: "value" and "type" properties are forbidden.
|
|
6
|
+
*/
|
|
7
|
+
function ruleDollarProps(severity = 'warn') {
|
|
8
|
+
return (token, path) => {
|
|
9
|
+
const issues = [];
|
|
10
|
+
if ('value' in token) {
|
|
11
|
+
issues.push({
|
|
12
|
+
message: '"value" is not allowed. Use "$value".',
|
|
13
|
+
severity,
|
|
14
|
+
path
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
if ('type' in token) {
|
|
18
|
+
issues.push({
|
|
19
|
+
message: '"type" is not allowed. Use "$type".',
|
|
20
|
+
severity,
|
|
21
|
+
path
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
return issues;
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=noDollarProps.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"noDollarProps.js","sourceRoot":"","sources":["../../../../src/preprocessors/lint/rules/noDollarProps.ts"],"names":[],"mappings":";;AAKA,0CAuBC;AA1BD;;GAEG;AACH,SAAgB,eAAe,CAC3B,WAAyB,MAAM;IAE/B,OAAO,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE;QACnB,MAAM,MAAM,GAAG,EAAE,CAAC;QAElB,IAAI,OAAO,IAAI,KAAK,EAAE,CAAC;YACnB,MAAM,CAAC,IAAI,CAAC;gBACR,OAAO,EAAE,uCAAuC;gBAChD,QAAQ;gBACR,IAAI;aACP,CAAC,CAAC;QACP,CAAC;QACD,IAAI,MAAM,IAAI,KAAK,EAAE,CAAC;YAClB,MAAM,CAAC,IAAI,CAAC;gBACR,OAAO,EAAE,qCAAqC;gBAC9C,QAAQ;gBACR,IAAI;aACP,CAAC,CAAC;QACP,CAAC;QAED,OAAO,MAAM,CAAC;IAClB,CAAC,CAAC;AACN,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"requireType.d.ts","sourceRoot":"","sources":["../../../../src/preprocessors/lint/rules/requireType.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAEjE;;GAEG;AACH,wBAAgB,eAAe,CAC3B,QAAQ,GAAE,YAAsB,GACjC,QAAQ,CAaV"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ruleRequireType = ruleRequireType;
|
|
4
|
+
/**
|
|
5
|
+
* Rule: The token must contain a "type" property.
|
|
6
|
+
*/
|
|
7
|
+
function ruleRequireType(severity = 'error') {
|
|
8
|
+
return (token, path) => {
|
|
9
|
+
if (!('type' in token || '$type' in token)) {
|
|
10
|
+
return [
|
|
11
|
+
{
|
|
12
|
+
message: 'Token is missing required "type" property.',
|
|
13
|
+
severity,
|
|
14
|
+
path
|
|
15
|
+
}
|
|
16
|
+
];
|
|
17
|
+
}
|
|
18
|
+
return [];
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=requireType.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"requireType.js","sourceRoot":"","sources":["../../../../src/preprocessors/lint/rules/requireType.ts"],"names":[],"mappings":";;AAKA,0CAeC;AAlBD;;GAEG;AACH,SAAgB,eAAe,CAC3B,WAAyB,OAAO;IAEhC,OAAO,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE;QACnB,IAAI,CAAC,CAAC,MAAM,IAAI,KAAK,IAAI,OAAO,IAAI,KAAK,CAAC,EAAE,CAAC;YACzC,OAAO;gBACH;oBACI,OAAO,EAAE,4CAA4C;oBACrD,QAAQ;oBACR,IAAI;iBACP;aACJ,CAAC;QACN,CAAC;QACD,OAAO,EAAE,CAAC;IACd,CAAC,CAAC;AACN,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"requireValue.d.ts","sourceRoot":"","sources":["../../../../src/preprocessors/lint/rules/requireValue.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAEjE;;GAEG;AACH,wBAAgB,gBAAgB,CAC5B,QAAQ,GAAE,YAAsB,GACjC,QAAQ,CAaV"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ruleRequireValue = ruleRequireValue;
|
|
4
|
+
/**
|
|
5
|
+
* Rule: The token must contain a "value" property.
|
|
6
|
+
*/
|
|
7
|
+
function ruleRequireValue(severity = 'error') {
|
|
8
|
+
return (token, path) => {
|
|
9
|
+
if (!('value' in token || '$value' in token)) {
|
|
10
|
+
return [
|
|
11
|
+
{
|
|
12
|
+
message: 'Token is missing required "value" property.',
|
|
13
|
+
severity,
|
|
14
|
+
path
|
|
15
|
+
}
|
|
16
|
+
];
|
|
17
|
+
}
|
|
18
|
+
return [];
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=requireValue.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"requireValue.js","sourceRoot":"","sources":["../../../../src/preprocessors/lint/rules/requireValue.ts"],"names":[],"mappings":";;AAKA,4CAeC;AAlBD;;GAEG;AACH,SAAgB,gBAAgB,CAC5B,WAAyB,OAAO;IAEhC,OAAO,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE;QACnB,IAAI,CAAC,CAAC,OAAO,IAAI,KAAK,IAAI,QAAQ,IAAI,KAAK,CAAC,EAAE,CAAC;YAC3C,OAAO;gBACH;oBACI,OAAO,EAAE,6CAA6C;oBACtD,QAAQ;oBACR,IAAI;iBACP;aACJ,CAAC;QACN,CAAC;QACD,OAAO,EAAE,CAAC;IACd,CAAC,CAAC;AACN,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { LintRule, LintSeverity } from '../engine/types';
|
|
2
|
+
/**
|
|
3
|
+
* Options for the valid type rule.
|
|
4
|
+
*/
|
|
5
|
+
export interface ValidTypeRuleOptions {
|
|
6
|
+
/**
|
|
7
|
+
* Allowed token type values (e.g. ["color", "borderRadius", "spacing"]).
|
|
8
|
+
*/
|
|
9
|
+
readonly allowedTypes: ReadonlyArray<string>;
|
|
10
|
+
/**
|
|
11
|
+
* Severity when an invalid type is detected.
|
|
12
|
+
* Defaults to "error".
|
|
13
|
+
*/
|
|
14
|
+
readonly severity?: LintSeverity;
|
|
15
|
+
/**
|
|
16
|
+
* If true, missing "type" properties are reported as issues.
|
|
17
|
+
* Defaults to false (missing type is ignored).
|
|
18
|
+
*/
|
|
19
|
+
readonly requireType?: boolean;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Rule: token.type must exist (optional) and must be part of a known set.
|
|
23
|
+
*/
|
|
24
|
+
export declare function ruleValidType(options: ValidTypeRuleOptions): LintRule;
|
|
25
|
+
//# sourceMappingURL=validType.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validType.d.ts","sourceRoot":"","sources":["../../../../src/preprocessors/lint/rules/validType.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE9D;;GAEG;AACH,MAAM,WAAW,oBAAoB;IAEjC;;OAEG;IACH,QAAQ,CAAC,YAAY,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;IAE7C;;;OAGG;IACH,QAAQ,CAAC,QAAQ,CAAC,EAAE,YAAY,CAAC;IAEjC;;;OAGG;IACH,QAAQ,CAAC,WAAW,CAAC,EAAE,OAAO,CAAC;CAClC;AAED;;GAEG;AACH,wBAAgB,aAAa,CACzB,OAAO,EAAE,oBAAoB,GAC9B,QAAQ,CA8CV"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ruleValidType = ruleValidType;
|
|
4
|
+
/**
|
|
5
|
+
* Rule: token.type must exist (optional) and must be part of a known set.
|
|
6
|
+
*/
|
|
7
|
+
function ruleValidType(options) {
|
|
8
|
+
const { allowedTypes, severity = 'error', requireType = false } = options;
|
|
9
|
+
const allowed = new Set(allowedTypes);
|
|
10
|
+
return (token, path) => {
|
|
11
|
+
const issues = [];
|
|
12
|
+
if (!('type' in token)) {
|
|
13
|
+
if (requireType) {
|
|
14
|
+
issues.push({
|
|
15
|
+
message: 'Token is missing required "type" property.',
|
|
16
|
+
severity,
|
|
17
|
+
path
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
return issues;
|
|
21
|
+
}
|
|
22
|
+
const typeValue = token.type;
|
|
23
|
+
if (typeof typeValue !== 'string') {
|
|
24
|
+
issues.push({
|
|
25
|
+
message: `Token "type" must be a string, but is "${typeof typeValue}".`,
|
|
26
|
+
severity,
|
|
27
|
+
path
|
|
28
|
+
});
|
|
29
|
+
return issues;
|
|
30
|
+
}
|
|
31
|
+
if (!allowed.has(typeValue)) {
|
|
32
|
+
issues.push({
|
|
33
|
+
message: `Token type "${typeValue}" is not in the allowed list: [${Array.from(allowed).join(', ')}].`,
|
|
34
|
+
severity,
|
|
35
|
+
path
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
return issues;
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
//# sourceMappingURL=validType.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validType.js","sourceRoot":"","sources":["../../../../src/preprocessors/lint/rules/validType.ts"],"names":[],"mappings":";;AA4BA,sCAgDC;AAnDD;;GAEG;AACH,SAAgB,aAAa,CACzB,OAA6B;IAE7B,MAAM,EACF,YAAY,EACZ,QAAQ,GAAG,OAAO,EAClB,WAAW,GAAG,KAAK,EACtB,GAAG,OAAO,CAAC;IAEZ,MAAM,OAAO,GAAG,IAAI,GAAG,CAAC,YAAY,CAAC,CAAC;IAEtC,OAAO,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE;QACnB,MAAM,MAAM,GAAG,EAAE,CAAC;QAElB,IAAI,CAAC,CAAC,MAAM,IAAI,KAAK,CAAC,EAAE,CAAC;YACrB,IAAI,WAAW,EAAE,CAAC;gBACd,MAAM,CAAC,IAAI,CAAC;oBACR,OAAO,EAAE,4CAA4C;oBACrD,QAAQ;oBACR,IAAI;iBACP,CAAC,CAAC;YACP,CAAC;YACD,OAAO,MAAM,CAAC;QAClB,CAAC;QAED,MAAM,SAAS,GAAI,KAAa,CAAC,IAAI,CAAC;QAEtC,IAAI,OAAO,SAAS,KAAK,QAAQ,EAAE,CAAC;YAChC,MAAM,CAAC,IAAI,CAAC;gBACR,OAAO,EAAE,0CAA0C,OAAO,SAAS,IAAI;gBACvE,QAAQ;gBACR,IAAI;aACP,CAAC,CAAC;YACH,OAAO,MAAM,CAAC;QAClB,CAAC;QAED,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,SAAS,CAAC,EAAE,CAAC;YAC1B,MAAM,CAAC,IAAI,CAAC;gBACR,OAAO,EAAE,eAAe,SAAS,kCAAkC,KAAK,CAAC,IAAI,CACzE,OAAO,CACV,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI;gBAChB,QAAQ;gBACR,IAAI;aACP,CAAC,CAAC;QACP,CAAC;QAED,OAAO,MAAM,CAAC;IAClB,CAAC,CAAC;AACN,CAAC"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { LintRule, LintSeverity } from '../engine/types';
|
|
2
|
+
/**
|
|
3
|
+
* Supported JS-level classifications for token values.
|
|
4
|
+
*/
|
|
5
|
+
export type ValueKind = 'string' | 'number' | 'boolean' | 'object' | 'array';
|
|
6
|
+
/**
|
|
7
|
+
* Mapping from token.type -> allowed JS value kinds.
|
|
8
|
+
*/
|
|
9
|
+
export type ValueTypeMap = Record<string, ValueKind | Array<ValueKind>>;
|
|
10
|
+
/**
|
|
11
|
+
* Options for the value-type-by-token-type rule.
|
|
12
|
+
*/
|
|
13
|
+
export interface ValueTypeByTokenTypeRuleOptions {
|
|
14
|
+
/**
|
|
15
|
+
* Mapping from token.type (e.g. "color") to allowed JS value kinds (e.g. "string").
|
|
16
|
+
*/
|
|
17
|
+
readonly map: ValueTypeMap;
|
|
18
|
+
/**
|
|
19
|
+
* Severity when a mismatch is detected.
|
|
20
|
+
* Defaults to "error".
|
|
21
|
+
*/
|
|
22
|
+
readonly severity?: LintSeverity;
|
|
23
|
+
/**
|
|
24
|
+
* If true, tokens without "type" will be reported as issues.
|
|
25
|
+
* If false, tokens without "type" are ignored by this rule.
|
|
26
|
+
* Defaults to false.
|
|
27
|
+
*/
|
|
28
|
+
readonly requireType?: boolean;
|
|
29
|
+
/**
|
|
30
|
+
* If true, tokens without "value" are reported as issues.
|
|
31
|
+
* Defaults to false (usually covered by a separate rule).
|
|
32
|
+
*/
|
|
33
|
+
readonly requireValue?: boolean;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Rule: enforces that token.value has a JS type compatible with token.type,
|
|
37
|
+
* based on a provided mapping.
|
|
38
|
+
*/
|
|
39
|
+
export declare function ruleValueTypeByTokenType(options: ValueTypeByTokenTypeRuleOptions): LintRule;
|
|
40
|
+
//# sourceMappingURL=valueTypeByTokenType.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"valueTypeByTokenType.d.ts","sourceRoot":"","sources":["../../../../src/preprocessors/lint/rules/valueTypeByTokenType.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAa,QAAQ,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAEzE;;GAEG;AACH,MAAM,MAAM,SAAS,GAAG,QAAQ,GAAG,QAAQ,GAAG,SAAS,GAAG,QAAQ,GAAG,OAAO,CAAC;AAE7E;;GAEG;AACH,MAAM,MAAM,YAAY,GAAG,MAAM,CAAC,MAAM,EAAE,SAAS,GAAG,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC;AAExE;;GAEG;AACH,MAAM,WAAW,+BAA+B;IAE5C;;OAEG;IACH,QAAQ,CAAC,GAAG,EAAE,YAAY,CAAC;IAE3B;;;OAGG;IACH,QAAQ,CAAC,QAAQ,CAAC,EAAE,YAAY,CAAC;IAEjC;;;;OAIG;IACH,QAAQ,CAAC,WAAW,CAAC,EAAE,OAAO,CAAC;IAE/B;;;OAGG;IACH,QAAQ,CAAC,YAAY,CAAC,EAAE,OAAO,CAAC;CACnC;AAED;;;GAGG;AACH,wBAAgB,wBAAwB,CACpC,OAAO,EAAE,+BAA+B,GACzC,QAAQ,CA8DV"}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ruleValueTypeByTokenType = ruleValueTypeByTokenType;
|
|
4
|
+
/**
|
|
5
|
+
* Rule: enforces that token.value has a JS type compatible with token.type,
|
|
6
|
+
* based on a provided mapping.
|
|
7
|
+
*/
|
|
8
|
+
function ruleValueTypeByTokenType(options) {
|
|
9
|
+
const { map, severity = 'error', requireType = false, requireValue = false } = options;
|
|
10
|
+
return (token, path) => {
|
|
11
|
+
const issues = [];
|
|
12
|
+
if (!('value' in token)) {
|
|
13
|
+
if (requireValue) {
|
|
14
|
+
issues.push({
|
|
15
|
+
message: 'Token is missing required "value" property.',
|
|
16
|
+
severity,
|
|
17
|
+
path
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
return issues;
|
|
21
|
+
}
|
|
22
|
+
if (!('type' in token)) {
|
|
23
|
+
if (requireType) {
|
|
24
|
+
issues.push({
|
|
25
|
+
message: 'Token is missing required "type" property.',
|
|
26
|
+
severity,
|
|
27
|
+
path
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
return issues;
|
|
31
|
+
}
|
|
32
|
+
const typeValue = token.type;
|
|
33
|
+
const rawValue = token.value;
|
|
34
|
+
if (typeof typeValue !== 'string') {
|
|
35
|
+
issues.push({
|
|
36
|
+
message: 'Token "type" must be a string for value-type validation.',
|
|
37
|
+
severity,
|
|
38
|
+
path
|
|
39
|
+
});
|
|
40
|
+
return issues;
|
|
41
|
+
}
|
|
42
|
+
const allowed = map[typeValue];
|
|
43
|
+
const allowedKinds = Array.isArray(allowed) ? allowed : [allowed];
|
|
44
|
+
const actualKind = classifyValueKind(rawValue);
|
|
45
|
+
if (!allowedKinds.includes(actualKind)) {
|
|
46
|
+
issues.push({
|
|
47
|
+
message: `Token value type "${actualKind}" is not allowed for token type "${typeValue}". Allowed kinds: [${allowedKinds.join(', ')}].`,
|
|
48
|
+
severity,
|
|
49
|
+
path
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
return issues;
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Classifies a JS value into a ValueKind.
|
|
57
|
+
*/
|
|
58
|
+
function classifyValueKind(value) {
|
|
59
|
+
if (Array.isArray(value)) {
|
|
60
|
+
return 'array';
|
|
61
|
+
}
|
|
62
|
+
const t = typeof value;
|
|
63
|
+
switch (t) {
|
|
64
|
+
case 'string':
|
|
65
|
+
return 'string';
|
|
66
|
+
case 'number':
|
|
67
|
+
case 'bigint':
|
|
68
|
+
return 'number';
|
|
69
|
+
case 'boolean':
|
|
70
|
+
return 'boolean';
|
|
71
|
+
case 'object':
|
|
72
|
+
return 'object';
|
|
73
|
+
case 'undefined':
|
|
74
|
+
case 'function':
|
|
75
|
+
case 'symbol':
|
|
76
|
+
default:
|
|
77
|
+
return 'object';
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
//# sourceMappingURL=valueTypeByTokenType.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"valueTypeByTokenType.js","sourceRoot":"","sources":["../../../../src/preprocessors/lint/rules/valueTypeByTokenType.ts"],"names":[],"mappings":";;AA8CA,4DAgEC;AApED;;;GAGG;AACH,SAAgB,wBAAwB,CACpC,OAAwC;IAExC,MAAM,EACF,GAAG,EACH,QAAQ,GAAG,OAAO,EAClB,WAAW,GAAG,KAAK,EACnB,YAAY,GAAG,KAAK,EACvB,GAAG,OAAO,CAAC;IAEZ,OAAO,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE;QACnB,MAAM,MAAM,GAAqB,EAAE,CAAC;QAEpC,IAAI,CAAC,CAAC,OAAO,IAAI,KAAK,CAAC,EAAE,CAAC;YACtB,IAAI,YAAY,EAAE,CAAC;gBACf,MAAM,CAAC,IAAI,CAAC;oBACR,OAAO,EAAE,6CAA6C;oBACtD,QAAQ;oBACR,IAAI;iBACP,CAAC,CAAC;YACP,CAAC;YACD,OAAO,MAAM,CAAC;QAClB,CAAC;QAED,IAAI,CAAC,CAAC,MAAM,IAAI,KAAK,CAAC,EAAE,CAAC;YACrB,IAAI,WAAW,EAAE,CAAC;gBACd,MAAM,CAAC,IAAI,CAAC;oBACR,OAAO,EAAE,4CAA4C;oBACrD,QAAQ;oBACR,IAAI;iBACP,CAAC,CAAC;YACP,CAAC;YACD,OAAO,MAAM,CAAC;QAClB,CAAC;QAED,MAAM,SAAS,GAAG,KAAK,CAAC,IAAI,CAAC;QAC7B,MAAM,QAAQ,GAAG,KAAK,CAAC,KAAK,CAAC;QAE7B,IAAI,OAAO,SAAS,KAAK,QAAQ,EAAE,CAAC;YAChC,MAAM,CAAC,IAAI,CAAC;gBACR,OAAO,EAAE,0DAA0D;gBACnE,QAAQ;gBACR,IAAI;aACP,CAAC,CAAC;YACH,OAAO,MAAM,CAAC;QAClB,CAAC;QAED,MAAM,OAAO,GAAG,GAAG,CAAC,SAAS,CAAC,CAAC;QAE/B,MAAM,YAAY,GAAG,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC;QAClE,MAAM,UAAU,GAAG,iBAAiB,CAAC,QAAQ,CAAC,CAAC;QAE/C,IAAI,CAAC,YAAY,CAAC,QAAQ,CAAC,UAAU,CAAC,EAAE,CAAC;YACrC,MAAM,CAAC,IAAI,CAAC;gBACR,OAAO,EAAE,qBAAqB,UAAU,oCAAoC,SAAS,sBAAsB,YAAY,CAAC,IAAI,CACxH,IAAI,CACP,IAAI;gBACL,QAAQ;gBACR,IAAI;aACP,CAAC,CAAC;QACP,CAAC;QAED,OAAO,MAAM,CAAC;IAClB,CAAC,CAAC;AACN,CAAC;AAED;;GAEG;AACH,SAAS,iBAAiB,CAAC,KAAc;IACrC,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;QACvB,OAAO,OAAO,CAAC;IACnB,CAAC;IACD,MAAM,CAAC,GAAG,OAAO,KAAK,CAAC;IACvB,QAAQ,CAAC,EAAE,CAAC;QACR,KAAK,QAAQ;YACT,OAAO,QAAQ,CAAC;QACpB,KAAK,QAAQ,CAAC;QACd,KAAK,QAAQ;YACT,OAAO,QAAQ,CAAC;QACpB,KAAK,SAAS;YACV,OAAO,SAAS,CAAC;QACrB,KAAK,QAAQ;YACT,OAAO,QAAQ,CAAC;QACpB,KAAK,WAAW,CAAC;QACjB,KAAK,UAAU,CAAC;QAChB,KAAK,QAAQ,CAAC;QACd;YACI,OAAO,QAAQ,CAAC;IACxB,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gradientCssTransform.d.ts","sourceRoot":"","sources":["../../src/transforms/gradientCssTransform.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAoB,MAAM,wBAAwB,CAAC;AAU1E,eAAO,MAAM,oBAAoB,EAAE,SAalC,CAAC"}
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
// #region Imports
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.
|
|
5
|
-
const
|
|
6
|
-
exports.
|
|
7
|
-
name: 'gradient/css',
|
|
4
|
+
exports.gradientCssTransform = void 0;
|
|
5
|
+
const getValue_js_1 = require("../utilities/getValue.js");
|
|
6
|
+
exports.gradientCssTransform = {
|
|
7
|
+
name: 'gradient/css/value',
|
|
8
8
|
type: 'value',
|
|
9
9
|
transitive: true,
|
|
10
10
|
filter: (token) => token.$type === 'gradient' || token.type === 'gradient',
|
|
11
11
|
transform: (token) => {
|
|
12
|
-
const tokenValue = (0,
|
|
12
|
+
const tokenValue = (0, getValue_js_1.getValue)(token);
|
|
13
13
|
const stops = tokenValue
|
|
14
14
|
.map((stop) => `${stop.color}${stop.position ? ` ${Math.floor(stop.position * 100)}%` : ''}`)
|
|
15
15
|
.join(', ');
|
|
16
16
|
return `${token.angle ? `${token.angle}, ` : ''}${stops}`;
|
|
17
17
|
}
|
|
18
18
|
};
|
|
19
|
-
//# sourceMappingURL=
|
|
19
|
+
//# sourceMappingURL=gradientCssTransform.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gradientCssTransform.js","sourceRoot":"","sources":["../../src/transforms/gradientCssTransform.ts"],"names":[],"mappings":";AAAA,kBAAkB;;;AAGlB,0DAAoD;AASvC,QAAA,oBAAoB,GAAc;IAC3C,IAAI,EAAE,oBAAoB;IAC1B,IAAI,EAAE,OAAO;IACb,UAAU,EAAE,IAAI;IAChB,MAAM,EAAE,CAAC,KAAuB,EAAW,EAAE,CAAC,KAAK,CAAC,KAAK,KAAK,UAAU,IAAI,KAAK,CAAC,IAAI,KAAK,UAAU;IACrG,SAAS,EAAE,CAAC,KAAuB,EAAE,EAAE;QACnC,MAAM,UAAU,GAAG,IAAA,sBAAQ,EAAuB,KAAK,CAAC,CAAC;QACzD,MAAM,KAAK,GAAG,UAAU;aACnB,GAAG,CAAC,CAAC,IAAmB,EAAE,EAAE,CAAC,GAAG,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,QAAQ,GAAG,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC;aAC3G,IAAI,CAAC,IAAI,CAAC,CAAC;QAEhB,OAAO,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,KAAK,IAAI,CAAC,CAAC,CAAC,EAAE,GAAG,KAAK,EAAE,CAAC;IAC9D,CAAC;CACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"letterSpacingCalcCssTransform.d.ts","sourceRoot":"","sources":["../../src/transforms/letterSpacingCalcCssTransform.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAIxD,eAAO,MAAM,6BAA6B,EAAE,SAgB3C,CAAC"}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
// #region Imports
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.
|
|
4
|
+
exports.letterSpacingCalcCssTransform = void 0;
|
|
5
5
|
// #endregion
|
|
6
|
-
exports.
|
|
6
|
+
exports.letterSpacingCalcCssTransform = {
|
|
7
7
|
type: 'value',
|
|
8
8
|
transitive: true,
|
|
9
|
-
name: '
|
|
9
|
+
name: 'letterSpacingCalc/css/value',
|
|
10
10
|
filter: (token) => token.type === 'letterSpacing' && typeof token.value === 'string' && token.value === '' && Boolean(token.attributes),
|
|
11
11
|
transform: (token) => {
|
|
12
12
|
if (token.attributes) {
|
|
@@ -18,4 +18,4 @@ exports.letterSpacingTransform = {
|
|
|
18
18
|
return token.value;
|
|
19
19
|
}
|
|
20
20
|
};
|
|
21
|
-
//# sourceMappingURL=
|
|
21
|
+
//# sourceMappingURL=letterSpacingCalcCssTransform.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"letterSpacingCalcCssTransform.js","sourceRoot":"","sources":["../../src/transforms/letterSpacingCalcCssTransform.ts"],"names":[],"mappings":";AAAA,kBAAkB;;;AAIlB,aAAa;AAEA,QAAA,6BAA6B,GAAc;IACpD,IAAI,EAAE,OAAO;IACb,UAAU,EAAE,IAAI;IAChB,IAAI,EAAE,6BAA6B;IACnC,MAAM,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,KAAK,eAAe,IAAI,OAAO,KAAK,CAAC,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,KAAK,KAAK,EAAE,IAAI,OAAO,CAAC,KAAK,CAAC,UAAU,CAAC;IACvI,SAAS,EAAE,CAAC,KAAK,EAAE,EAAE;QACjB,IAAI,KAAK,CAAC,UAAU,EAAE,CAAC;YACnB,MAAM,QAAQ,GAAG,KAAK,CAAC,UAAU,CAAC,QAAkB,CAAC;YACrD,MAAM,OAAO,GAAG,KAAK,CAAC,UAAU,CAAC,OAAiB,CAAC;YAEnD,MAAM,EAAE,GAAG,GAAG,QAAQ,GAAG,OAAO,IAAI,CAAC;YACrC,OAAO,EAAE,CAAC;QACd,CAAC;QAED,OAAO,KAAK,CAAC,KAAK,CAAC;IACvB,CAAC;CACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"listScssTransform.d.ts","sourceRoot":"","sources":["../../src/transforms/listScssTransform.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAoB,MAAM,wBAAwB,CAAC;AAK1E,eAAO,MAAM,iBAAiB,EAAE,SAM/B,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// #region Imports
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.listScssTransform = void 0;
|
|
5
|
+
const getValue_1 = require("../utilities/getValue");
|
|
6
|
+
// #endregion
|
|
7
|
+
exports.listScssTransform = {
|
|
8
|
+
name: 'list/scss/value',
|
|
9
|
+
type: 'value',
|
|
10
|
+
transitive: true,
|
|
11
|
+
filter: (token) => Array.isArray(token.value),
|
|
12
|
+
transform: (token) => `(${(0, getValue_1.getValue)(token).join(', ')})`
|
|
13
|
+
};
|
|
14
|
+
//# sourceMappingURL=listScssTransform.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"listScssTransform.js","sourceRoot":"","sources":["../../src/transforms/listScssTransform.ts"],"names":[],"mappings":";AAAA,kBAAkB;;;AAGlB,oDAAiD;AAEjD,aAAa;AAEA,QAAA,iBAAiB,GAAc;IACxC,IAAI,EAAE,iBAAiB;IACvB,IAAI,EAAE,OAAO;IACb,UAAU,EAAE,IAAI;IAChB,MAAM,EAAE,CAAC,KAAK,EAAW,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC;IACtD,SAAS,EAAE,CAAC,KAAuB,EAAE,EAAE,CAAC,IAAI,IAAA,mBAAQ,EAAgB,KAAK,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG;CAC3F,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"quoteStringTransform.d.ts","sourceRoot":"","sources":["../../src/transforms/quoteStringTransform.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAoB,MAAM,wBAAwB,CAAC;AAK1E,eAAO,MAAM,oBAAoB,EAAE,SAMlC,CAAC"}
|
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
// #region Imports
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
exports.quoteStringTransform = void 0;
|
|
5
|
-
const
|
|
5
|
+
const getValue_1 = require("../utilities/getValue");
|
|
6
6
|
// #endregion
|
|
7
7
|
exports.quoteStringTransform = {
|
|
8
|
-
name: 'value
|
|
8
|
+
name: 'quoteString/value',
|
|
9
9
|
type: 'value',
|
|
10
10
|
transitive: true,
|
|
11
11
|
filter: (token) => token.$type === 'string' || token.type === 'string',
|
|
12
|
-
transform: (token) => `"${(0,
|
|
12
|
+
transform: (token) => `"${(0, getValue_1.getValue)(token)}"`
|
|
13
13
|
};
|
|
14
|
-
//# sourceMappingURL=
|
|
14
|
+
//# sourceMappingURL=quoteStringTransform.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"quoteStringTransform.js","sourceRoot":"","sources":["../../src/transforms/quoteStringTransform.ts"],"names":[],"mappings":";AAAA,kBAAkB;;;AAGlB,oDAAiD;AAEjD,aAAa;AAEA,QAAA,oBAAoB,GAAc;IAC3C,IAAI,EAAE,mBAAmB;IACzB,IAAI,EAAE,OAAO;IACb,UAAU,EAAE,IAAI;IAChB,MAAM,EAAE,CAAC,KAAK,EAAW,EAAE,CAAC,KAAK,CAAC,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,IAAI,KAAK,QAAQ;IAC/E,SAAS,EAAE,CAAC,KAAuB,EAAE,EAAE,CAAC,IAAI,IAAA,mBAAQ,EAAS,KAAK,CAAC,GAAG;CACzE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shadowCssTransform.d.ts","sourceRoot":"","sources":["../../src/transforms/shadowCssTransform.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAoB,MAAM,wBAAwB,CAAC;AAyB1E,eAAO,MAAM,kBAAkB,EAAE,SAkBhC,CAAC"}
|
|
@@ -2,17 +2,17 @@
|
|
|
2
2
|
// #region Imports
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
exports.shadowCssTransform = void 0;
|
|
5
|
-
const
|
|
5
|
+
const getValue_js_1 = require("../utilities/getValue.js");
|
|
6
6
|
function formatShadow({ offsetX = '0', offsetY = '0', blur = '0', spread = '0', color, inset = false }) {
|
|
7
7
|
return `${offsetX} ${offsetY} ${blur} ${spread} ${color} ${inset ? 'inset' : ''}`.trim();
|
|
8
8
|
}
|
|
9
9
|
exports.shadowCssTransform = {
|
|
10
|
-
name: 'shadow/css',
|
|
10
|
+
name: 'shadow/css/value',
|
|
11
11
|
type: 'value',
|
|
12
12
|
transitive: true,
|
|
13
13
|
filter: (token) => token.$type === 'shadow' || token.type === 'shadow',
|
|
14
14
|
transform: (token) => {
|
|
15
|
-
const tokenValue = (0,
|
|
15
|
+
const tokenValue = (0, getValue_js_1.getValue)(token);
|
|
16
16
|
if (Array.isArray(tokenValue)) {
|
|
17
17
|
return tokenValue.map(formatShadow).join(', ');
|
|
18
18
|
}
|
|
@@ -22,4 +22,4 @@ exports.shadowCssTransform = {
|
|
|
22
22
|
return tokenValue;
|
|
23
23
|
}
|
|
24
24
|
};
|
|
25
|
-
//# sourceMappingURL=
|
|
25
|
+
//# sourceMappingURL=shadowCssTransform.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shadowCssTransform.js","sourceRoot":"","sources":["../../src/transforms/shadowCssTransform.ts"],"names":[],"mappings":";AAAA,kBAAkB;;;AAGlB,0DAAoD;AAapD,SAAS,YAAY,CAAC,EAClB,OAAO,GAAG,GAAG,EACb,OAAO,GAAG,GAAG,EACb,IAAI,GAAG,GAAG,EACV,MAAM,GAAG,GAAG,EACZ,KAAK,EACL,KAAK,GAAG,KAAK,EACF;IACX,OAAO,GAAG,OAAO,IAAI,OAAO,IAAI,IAAI,IAAI,MAAM,IAAI,KAAK,IAAI,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,EAAE,CAAC;AAC7F,CAAC;AAEY,QAAA,kBAAkB,GAAc;IACzC,IAAI,EAAE,kBAAkB;IACxB,IAAI,EAAE,OAAO;IACb,UAAU,EAAE,IAAI;IAChB,MAAM,EAAE,CAAC,KAAK,EAAW,EAAE,CAAC,KAAK,CAAC,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,IAAI,KAAK,QAAQ;IAC/E,SAAS,EAAE,CAAC,KAAuB,EAAE,EAAE;QACnC,MAAM,UAAU,GAAG,IAAA,sBAAQ,EAAe,KAAK,CAAC,CAAC;QAEjD,IAAI,KAAK,CAAC,OAAO,CAAC,UAAU,CAAC,EAAE,CAAC;YAC5B,OAAO,UAAU,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACnD,CAAC;QAED,IAAI,OAAO,UAAU,KAAK,QAAQ,EAAE,CAAC;YACjC,OAAO,YAAY,CAAC,UAAU,CAAC,CAAC;QACpC,CAAC;QAED,OAAO,UAAU,CAAC;IACtB,CAAC;CACJ,CAAC"}
|
|
@@ -7,4 +7,4 @@ import type { DesignToken } from 'style-dictionary/types';
|
|
|
7
7
|
* @returns Flat map of tokens with dot-path keys
|
|
8
8
|
*/
|
|
9
9
|
export declare function extractTokensByType(tokens: Record<string, any>, matchType: string): Record<string, DesignToken>;
|
|
10
|
-
//# sourceMappingURL=
|
|
10
|
+
//# sourceMappingURL=extractTokensByType.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"extractTokensByType.d.ts","sourceRoot":"","sources":["../../src/utilities/extractTokensByType.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAI1D;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CAC/B,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAC3B,SAAS,EAAE,MAAM,GAClB,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,CA6B7B"}
|
|
@@ -18,7 +18,7 @@ function extractTokensByType(tokens, matchType) {
|
|
|
18
18
|
}
|
|
19
19
|
const type = node?.type ?? node?.$type;
|
|
20
20
|
const value = node?.value ?? node?.$value;
|
|
21
|
-
const isToken = typeof value !== 'undefined' && (type
|
|
21
|
+
const isToken = typeof value !== 'undefined' && (type ?? node?.name ?? node?.comment);
|
|
22
22
|
if (isToken && type === matchType) {
|
|
23
23
|
const key = path.join('.');
|
|
24
24
|
result[key] = {
|
|
@@ -35,4 +35,4 @@ function extractTokensByType(tokens, matchType) {
|
|
|
35
35
|
walk(tokens);
|
|
36
36
|
return result;
|
|
37
37
|
}
|
|
38
|
-
//# sourceMappingURL=
|
|
38
|
+
//# sourceMappingURL=extractTokensByType.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"extractTokensByType.js","sourceRoot":"","sources":["../../src/utilities/extractTokensByType.ts"],"names":[],"mappings":";AAAA,kBAAkB;;AAalB,kDAgCC;AAzCD,aAAa;AAEb;;;;;;GAMG;AACH,SAAgB,mBAAmB,CAC/B,MAA2B,EAC3B,SAAiB;IAEjB,MAAM,MAAM,GAAgC,EAAE,CAAC;IAE/C,MAAM,IAAI,GAAG,CAAC,IAAS,EAAE,OAAsB,EAAE,EAAQ,EAAE;QACvD,IAAI,OAAO,IAAI,KAAK,QAAQ,IAAI,IAAI,KAAK,IAAI,EAAE,CAAC;YAAC,OAAO;QAAC,CAAC;QAE1D,MAAM,IAAI,GAAG,IAAI,EAAE,IAAI,IAAI,IAAI,EAAE,KAAK,CAAC;QACvC,MAAM,KAAK,GAAG,IAAI,EAAE,KAAK,IAAI,IAAI,EAAE,MAAM,CAAC;QAE1C,MAAM,OAAO,GAAG,OAAO,KAAK,KAAK,WAAW,IAAI,CAAC,IAAI,IAAI,IAAI,EAAE,IAAI,IAAI,IAAI,EAAE,OAAO,CAAC,CAAC;QAEtF,IAAI,OAAO,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;YAChC,MAAM,GAAG,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;YAC3B,MAAM,CAAC,GAAG,CAAC,GAAG;gBACV,GAAG,IAAI;gBACP,GAAG;aACN,CAAC;QACN,CAAC;QAED,KAAK,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC;YACxC,IAAI,OAAO,CAAC,KAAK,QAAQ,EAAE,CAAC;gBACxB,IAAI,CAAC,CAAC,EAAE,CAAC,GAAG,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;YAC1B,CAAC;QACL,CAAC;IACL,CAAC,CAAC;IAEF,IAAI,CAAC,MAAM,CAAC,CAAC;IAEb,OAAO,MAAM,CAAC;AAClB,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { TransformedToken } from 'style-dictionary/types';
|
|
2
|
+
/**
|
|
3
|
+
* Returns the type of the design token, either token.type or token.$type
|
|
4
|
+
*
|
|
5
|
+
* @param token The design token
|
|
6
|
+
* @returns token type
|
|
7
|
+
*/
|
|
8
|
+
export declare const getType: (token: TransformedToken | Record<string, string>) => string | undefined;
|
|
9
|
+
//# sourceMappingURL=getType.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getType.d.ts","sourceRoot":"","sources":["../../src/utilities/getType.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAI/D;;;;;GAKG;AACH,eAAO,MAAM,OAAO,GAAI,OAAO,gBAAgB,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,KAAG,MAAM,GAAG,SAAsC,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// #region Imports
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.getType = void 0;
|
|
5
|
+
// #endregion
|
|
6
|
+
/**
|
|
7
|
+
* Returns the type of the design token, either token.type or token.$type
|
|
8
|
+
*
|
|
9
|
+
* @param token The design token
|
|
10
|
+
* @returns token type
|
|
11
|
+
*/
|
|
12
|
+
const getType = (token) => token.type ?? token.$type;
|
|
13
|
+
exports.getType = getType;
|
|
14
|
+
//# sourceMappingURL=getType.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getType.js","sourceRoot":"","sources":["../../src/utilities/getType.ts"],"names":[],"mappings":";AAAA,kBAAkB;;;AAIlB,aAAa;AAEb;;;;;GAKG;AACI,MAAM,OAAO,GAAG,CAAC,KAAgD,EAAsB,EAAE,CAAC,KAAK,CAAC,IAAI,IAAI,KAAK,CAAC,KAAK,CAAC;AAA9G,QAAA,OAAO,WAAuG"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { TransformedToken } from 'style-dictionary/types';
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
* @param token
|
|
3
|
+
* Returns the value of the design token, either token.value or token.$value
|
|
4
|
+
*
|
|
5
|
+
* @param token The design token
|
|
6
6
|
* @returns token value
|
|
7
7
|
*/
|
|
8
8
|
export declare const getValue: <T>(token: TransformedToken | Record<string, unknown>) => T;
|
|
9
|
-
//# sourceMappingURL=
|
|
9
|
+
//# sourceMappingURL=getValue.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getValue.d.ts","sourceRoot":"","sources":["../../src/utilities/getValue.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAI/D;;;;;GAKG;AACH,eAAO,MAAM,QAAQ,GAAI,CAAC,EAAE,OAAO,gBAAgB,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAG,CAAgC,CAAC"}
|
|
@@ -4,11 +4,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
4
4
|
exports.getValue = void 0;
|
|
5
5
|
// #endregion
|
|
6
6
|
/**
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
* @param token
|
|
7
|
+
* Returns the value of the design token, either token.value or token.$value
|
|
8
|
+
*
|
|
9
|
+
* @param token The design token
|
|
10
10
|
* @returns token value
|
|
11
11
|
*/
|
|
12
12
|
const getValue = (token) => token.value ?? token.$value;
|
|
13
13
|
exports.getValue = getValue;
|
|
14
|
-
//# sourceMappingURL=
|
|
14
|
+
//# sourceMappingURL=getValue.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getValue.js","sourceRoot":"","sources":["../../src/utilities/getValue.ts"],"names":[],"mappings":";AAAA,kBAAkB;;;AAIlB,aAAa;AAEb;;;;;GAKG;AACI,MAAM,QAAQ,GAAG,CAAI,KAAiD,EAAK,EAAE,CAAC,KAAK,CAAC,KAAK,IAAI,KAAK,CAAC,MAAM,CAAC;AAApG,QAAA,QAAQ,YAA4F"}
|
package/Index.d.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
export { letterSpacingTransform } from './Transforms/LetterSpacing';
|
|
2
|
-
export { shadowCssTransform } from './Transforms/Shadow';
|
|
3
|
-
export { nameSnakeUpperCaseTransform } from './Transforms/NameSnakeUpperCase';
|
|
4
|
-
export { gradientTransform } from './Transforms/Gradient';
|
|
5
|
-
export { quoteStringTransform } from './Transforms/QuoteString';
|
|
6
|
-
export { listTransform } from './Transforms/List';
|
|
7
|
-
export { expandShadowPreprocessor } from './Preprocessors/Shadow';
|
|
8
|
-
export { lintPreprocessor } from './Preprocessors/Lint';
|
|
9
|
-
//# sourceMappingURL=Index.d.ts.map
|
package/Index.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Index.d.ts","sourceRoot":"","sources":["../src/Index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;AACpE,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,EAAE,2BAA2B,EAAE,MAAM,iCAAiC,CAAC;AAC9E,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAChE,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAElD,OAAO,EAAE,wBAAwB,EAAE,MAAM,wBAAwB,CAAC;AAClE,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC"}
|