@tokenami/config 0.0.57 → 0.0.58
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.cjs +10 -3
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +10 -3
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -230,12 +230,11 @@ function getTokenPropertySplit(property) {
|
|
|
230
230
|
return { alias, variants: variants.reverse() };
|
|
231
231
|
}
|
|
232
232
|
function getTokenPropertyParts(tokenProperty2, config) {
|
|
233
|
-
var _a;
|
|
234
233
|
const { alias, variants } = getTokenPropertySplit(tokenProperty2);
|
|
235
234
|
const [firstVariant, secondVariant] = variants;
|
|
236
235
|
const firstSelector = getValidSelector(firstVariant, config);
|
|
237
236
|
const secondSelector = getValidSelector(secondVariant, config);
|
|
238
|
-
const responsive = (
|
|
237
|
+
const responsive = getValidResponsive(firstVariant, config);
|
|
239
238
|
const selector = firstSelector || secondSelector;
|
|
240
239
|
const validVariant = [responsive, selector].filter(Boolean).join("_");
|
|
241
240
|
const variantProp = variantProperty(validVariant, alias);
|
|
@@ -247,7 +246,15 @@ function getValidSelector(selector, config) {
|
|
|
247
246
|
var _a;
|
|
248
247
|
if (!selector)
|
|
249
248
|
return;
|
|
250
|
-
|
|
249
|
+
const configSelector = (_a = config.selectors) == null ? void 0 : _a[selector];
|
|
250
|
+
return (getArbitrarySelector(selector) || configSelector) && selector;
|
|
251
|
+
}
|
|
252
|
+
function getValidResponsive(responsive, config) {
|
|
253
|
+
var _a;
|
|
254
|
+
if (!responsive)
|
|
255
|
+
return;
|
|
256
|
+
const configResponsive = (_a = config.responsive) == null ? void 0 : _a[responsive];
|
|
257
|
+
return configResponsive && responsive;
|
|
251
258
|
}
|
|
252
259
|
function getArbitrarySelector(selector) {
|
|
253
260
|
const [, arbitrarySelector] = (selector == null ? void 0 : selector.match(/^{(.+)}$/)) || [];
|
package/dist/index.d.cts
CHANGED
|
@@ -39,7 +39,7 @@ interface Config {
|
|
|
39
39
|
aliases?: Aliases;
|
|
40
40
|
themeSelector?: (mode: string) => string;
|
|
41
41
|
theme: ThemeConfig;
|
|
42
|
-
properties?: Partial<Record<CSSProperty |
|
|
42
|
+
properties?: Partial<Record<CSSProperty | (string & {}), PropertiesOptions>>;
|
|
43
43
|
}
|
|
44
44
|
declare const defaultConfig: {
|
|
45
45
|
include: never[];
|
package/dist/index.d.ts
CHANGED
|
@@ -39,7 +39,7 @@ interface Config {
|
|
|
39
39
|
aliases?: Aliases;
|
|
40
40
|
themeSelector?: (mode: string) => string;
|
|
41
41
|
theme: ThemeConfig;
|
|
42
|
-
properties?: Partial<Record<CSSProperty |
|
|
42
|
+
properties?: Partial<Record<CSSProperty | (string & {}), PropertiesOptions>>;
|
|
43
43
|
}
|
|
44
44
|
declare const defaultConfig: {
|
|
45
45
|
include: never[];
|
package/dist/index.js
CHANGED
|
@@ -228,12 +228,11 @@ function getTokenPropertySplit(property) {
|
|
|
228
228
|
return { alias, variants: variants.reverse() };
|
|
229
229
|
}
|
|
230
230
|
function getTokenPropertyParts(tokenProperty2, config) {
|
|
231
|
-
var _a;
|
|
232
231
|
const { alias, variants } = getTokenPropertySplit(tokenProperty2);
|
|
233
232
|
const [firstVariant, secondVariant] = variants;
|
|
234
233
|
const firstSelector = getValidSelector(firstVariant, config);
|
|
235
234
|
const secondSelector = getValidSelector(secondVariant, config);
|
|
236
|
-
const responsive = (
|
|
235
|
+
const responsive = getValidResponsive(firstVariant, config);
|
|
237
236
|
const selector = firstSelector || secondSelector;
|
|
238
237
|
const validVariant = [responsive, selector].filter(Boolean).join("_");
|
|
239
238
|
const variantProp = variantProperty(validVariant, alias);
|
|
@@ -245,7 +244,15 @@ function getValidSelector(selector, config) {
|
|
|
245
244
|
var _a;
|
|
246
245
|
if (!selector)
|
|
247
246
|
return;
|
|
248
|
-
|
|
247
|
+
const configSelector = (_a = config.selectors) == null ? void 0 : _a[selector];
|
|
248
|
+
return (getArbitrarySelector(selector) || configSelector) && selector;
|
|
249
|
+
}
|
|
250
|
+
function getValidResponsive(responsive, config) {
|
|
251
|
+
var _a;
|
|
252
|
+
if (!responsive)
|
|
253
|
+
return;
|
|
254
|
+
const configResponsive = (_a = config.responsive) == null ? void 0 : _a[responsive];
|
|
255
|
+
return configResponsive && responsive;
|
|
249
256
|
}
|
|
250
257
|
function getArbitrarySelector(selector) {
|
|
251
258
|
const [, arbitrarySelector] = (selector == null ? void 0 : selector.match(/^{(.+)}$/)) || [];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tokenami/config",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.58",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
@@ -36,5 +36,5 @@
|
|
|
36
36
|
"tsup": "^7.0.0",
|
|
37
37
|
"typescript": "^5.1.3"
|
|
38
38
|
},
|
|
39
|
-
"gitHead": "
|
|
39
|
+
"gitHead": "0de260489adfa2fb0a60eeb7f6adf9a2c7fdbfe9"
|
|
40
40
|
}
|