@tokenami/config 0.0.29 → 0.0.30
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.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +8 -9
- package/dist/index.mjs +8 -9
- package/package.json +2 -2
package/dist/index.d.mts
CHANGED
|
@@ -226,7 +226,7 @@ declare const createConfig: <T extends Config>(obj: Exact<Config, T>) => DeepRea
|
|
|
226
226
|
declare function getTokenPropertyName(tokenProperty: TokenProperty): string;
|
|
227
227
|
declare function getTokenPropertySplit(tokenProperty: TokenProperty): {
|
|
228
228
|
alias: string;
|
|
229
|
-
variants:
|
|
229
|
+
variants: string[];
|
|
230
230
|
};
|
|
231
231
|
type PropertyParts = {
|
|
232
232
|
name: string;
|
package/dist/index.d.ts
CHANGED
|
@@ -226,7 +226,7 @@ declare const createConfig: <T extends Config>(obj: Exact<Config, T>) => DeepRea
|
|
|
226
226
|
declare function getTokenPropertyName(tokenProperty: TokenProperty): string;
|
|
227
227
|
declare function getTokenPropertySplit(tokenProperty: TokenProperty): {
|
|
228
228
|
alias: string;
|
|
229
|
-
variants:
|
|
229
|
+
variants: string[];
|
|
230
230
|
};
|
|
231
231
|
type PropertyParts = {
|
|
232
232
|
name: string;
|
package/dist/index.js
CHANGED
|
@@ -111,16 +111,15 @@ function getTokenPropertyParts(tokenProperty2, config) {
|
|
|
111
111
|
var _a, _b, _c;
|
|
112
112
|
const name = getTokenPropertyName(tokenProperty2);
|
|
113
113
|
const { alias, variants } = getTokenPropertySplit(tokenProperty2);
|
|
114
|
-
const [
|
|
115
|
-
const
|
|
116
|
-
const
|
|
117
|
-
const
|
|
118
|
-
const selector =
|
|
119
|
-
const
|
|
120
|
-
|
|
121
|
-
if (invalidVariants.length || hasInvalidVariant)
|
|
114
|
+
const [firstVariant, secondVariant] = variants;
|
|
115
|
+
const firstSelector = ((_a = config.selectors) == null ? void 0 : _a[firstVariant]) && firstVariant;
|
|
116
|
+
const secondSelector = ((_b = config.selectors) == null ? void 0 : _b[secondVariant]) && secondVariant;
|
|
117
|
+
const responsive = ((_c = config.responsive) == null ? void 0 : _c[firstVariant]) && firstVariant;
|
|
118
|
+
const selector = firstSelector || secondSelector;
|
|
119
|
+
const validVariant = [responsive, selector].filter(Boolean).join("_");
|
|
120
|
+
if (firstVariant && variantProperty(validVariant, alias) !== tokenProperty2)
|
|
122
121
|
return null;
|
|
123
|
-
return { name, alias, responsive, selector, variant };
|
|
122
|
+
return { name, alias, responsive, selector, variant: validVariant };
|
|
124
123
|
}
|
|
125
124
|
function getTokenValueParts(tokenValue2) {
|
|
126
125
|
const [, property, themeKey, token] = tokenValue2.split(tokenValueRegex);
|
package/dist/index.mjs
CHANGED
|
@@ -65,16 +65,15 @@ function getTokenPropertyParts(tokenProperty2, config) {
|
|
|
65
65
|
var _a, _b, _c;
|
|
66
66
|
const name = getTokenPropertyName(tokenProperty2);
|
|
67
67
|
const { alias, variants } = getTokenPropertySplit(tokenProperty2);
|
|
68
|
-
const [
|
|
69
|
-
const
|
|
70
|
-
const
|
|
71
|
-
const
|
|
72
|
-
const selector =
|
|
73
|
-
const
|
|
74
|
-
|
|
75
|
-
if (invalidVariants.length || hasInvalidVariant)
|
|
68
|
+
const [firstVariant, secondVariant] = variants;
|
|
69
|
+
const firstSelector = ((_a = config.selectors) == null ? void 0 : _a[firstVariant]) && firstVariant;
|
|
70
|
+
const secondSelector = ((_b = config.selectors) == null ? void 0 : _b[secondVariant]) && secondVariant;
|
|
71
|
+
const responsive = ((_c = config.responsive) == null ? void 0 : _c[firstVariant]) && firstVariant;
|
|
72
|
+
const selector = firstSelector || secondSelector;
|
|
73
|
+
const validVariant = [responsive, selector].filter(Boolean).join("_");
|
|
74
|
+
if (firstVariant && variantProperty(validVariant, alias) !== tokenProperty2)
|
|
76
75
|
return null;
|
|
77
|
-
return { name, alias, responsive, selector, variant };
|
|
76
|
+
return { name, alias, responsive, selector, variant: validVariant };
|
|
78
77
|
}
|
|
79
78
|
function getTokenValueParts(tokenValue2) {
|
|
80
79
|
const [, property, themeKey, token] = tokenValue2.split(tokenValueRegex);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tokenami/config",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.30",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.mjs",
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"csstype": "^3.1.2",
|
|
15
15
|
"tsup": "^7.0.0",
|
|
16
16
|
"typescript": "^5.1.3",
|
|
17
|
-
"@tokenami/dev": "0.0.
|
|
17
|
+
"@tokenami/dev": "0.0.30"
|
|
18
18
|
},
|
|
19
19
|
"scripts": {
|
|
20
20
|
"build": "tsup src/index.ts --format=esm,cjs --dts",
|