@tokenami/css 0.0.72 → 0.0.74
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 +6 -7
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +6 -7
- package/package.json +4 -4
package/dist/index.cjs
CHANGED
|
@@ -42,11 +42,11 @@ var cache = {
|
|
|
42
42
|
this.cache.set(key, value);
|
|
43
43
|
}
|
|
44
44
|
};
|
|
45
|
-
function createCss(config, options) {
|
|
46
|
-
globalThis[_TOKENAMI_CSS] = options
|
|
47
|
-
const globalOptions = globalThis[_TOKENAMI_CSS];
|
|
45
|
+
function createCss(config, options = { escapeSpecialChars: true }) {
|
|
46
|
+
globalThis[_TOKENAMI_CSS] = options;
|
|
48
47
|
const css2 = (baseStyles, ...overrides) => {
|
|
49
48
|
let overriddenStyles = {};
|
|
49
|
+
const globalOptions = globalThis[_TOKENAMI_CSS];
|
|
50
50
|
const cacheId = JSON.stringify({ baseStyles, overrides });
|
|
51
51
|
const cached = cache.get(cacheId);
|
|
52
52
|
if (cached)
|
|
@@ -79,7 +79,6 @@ function createCss(config, options) {
|
|
|
79
79
|
css2.compose = (config2) => {
|
|
80
80
|
const { variants, responsiveVariants, ...baseStyles } = config2;
|
|
81
81
|
return function generate(selectedVariants = {}, ...overrides) {
|
|
82
|
-
var _a, _b;
|
|
83
82
|
const cacheId = JSON.stringify({ config: config2, selectedVariants, overrides });
|
|
84
83
|
const cached = cache.get(cacheId);
|
|
85
84
|
if (cached)
|
|
@@ -89,11 +88,11 @@ function createCss(config, options) {
|
|
|
89
88
|
if (!variant)
|
|
90
89
|
continue;
|
|
91
90
|
const [type, bp] = key.split("_").reverse();
|
|
92
|
-
const responsive =
|
|
91
|
+
const responsive = responsiveVariants?.[type]?.[variant];
|
|
93
92
|
if (bp && responsive) {
|
|
94
93
|
variantStyles.push(convertToMediaStyles(bp, responsive));
|
|
95
94
|
} else {
|
|
96
|
-
variantStyles.push(
|
|
95
|
+
variantStyles.push(variants?.[type]?.[variant] ?? responsive);
|
|
97
96
|
}
|
|
98
97
|
}
|
|
99
98
|
const styles = css2(baseStyles, ...variantStyles, ...overrides);
|
|
@@ -130,7 +129,7 @@ function convertToMediaStyles(bp, styles) {
|
|
|
130
129
|
});
|
|
131
130
|
return Object.fromEntries(updatedEntries);
|
|
132
131
|
}
|
|
133
|
-
var css = createCss({}
|
|
132
|
+
var css = createCss({});
|
|
134
133
|
|
|
135
134
|
Object.defineProperty(exports, "createConfig", {
|
|
136
135
|
enumerable: true,
|
package/dist/index.d.cts
CHANGED
|
@@ -8,7 +8,7 @@ type TokenamiCSS = {
|
|
|
8
8
|
};
|
|
9
9
|
type VariantsConfig = Record<string, Record<string, TokenamiProperties>>;
|
|
10
10
|
type VariantValue<T> = T extends 'true' | 'false' ? boolean : T;
|
|
11
|
-
type ReponsiveKey = Extract<keyof TokenamiFinalConfig['responsive']
|
|
11
|
+
type ReponsiveKey = Extract<keyof NonNullable<TokenamiFinalConfig['responsive']>, string>;
|
|
12
12
|
type ResponsiveValue<T> = T extends string ? `${ReponsiveKey}_${T}` : never;
|
|
13
13
|
type Override = TokenamiProperties | TokenamiCSS | false | undefined;
|
|
14
14
|
type Variants$1<C> = undefined extends C ? {} : {
|
package/dist/index.d.ts
CHANGED
|
@@ -8,7 +8,7 @@ type TokenamiCSS = {
|
|
|
8
8
|
};
|
|
9
9
|
type VariantsConfig = Record<string, Record<string, TokenamiProperties>>;
|
|
10
10
|
type VariantValue<T> = T extends 'true' | 'false' ? boolean : T;
|
|
11
|
-
type ReponsiveKey = Extract<keyof TokenamiFinalConfig['responsive']
|
|
11
|
+
type ReponsiveKey = Extract<keyof NonNullable<TokenamiFinalConfig['responsive']>, string>;
|
|
12
12
|
type ResponsiveValue<T> = T extends string ? `${ReponsiveKey}_${T}` : never;
|
|
13
13
|
type Override = TokenamiProperties | TokenamiCSS | false | undefined;
|
|
14
14
|
type Variants$1<C> = undefined extends C ? {} : {
|
package/dist/index.js
CHANGED
|
@@ -21,11 +21,11 @@ var cache = {
|
|
|
21
21
|
this.cache.set(key, value);
|
|
22
22
|
}
|
|
23
23
|
};
|
|
24
|
-
function createCss(config, options) {
|
|
25
|
-
globalThis[_TOKENAMI_CSS] = options
|
|
26
|
-
const globalOptions = globalThis[_TOKENAMI_CSS];
|
|
24
|
+
function createCss(config, options = { escapeSpecialChars: true }) {
|
|
25
|
+
globalThis[_TOKENAMI_CSS] = options;
|
|
27
26
|
const css2 = (baseStyles, ...overrides) => {
|
|
28
27
|
let overriddenStyles = {};
|
|
28
|
+
const globalOptions = globalThis[_TOKENAMI_CSS];
|
|
29
29
|
const cacheId = JSON.stringify({ baseStyles, overrides });
|
|
30
30
|
const cached = cache.get(cacheId);
|
|
31
31
|
if (cached)
|
|
@@ -58,7 +58,6 @@ function createCss(config, options) {
|
|
|
58
58
|
css2.compose = (config2) => {
|
|
59
59
|
const { variants, responsiveVariants, ...baseStyles } = config2;
|
|
60
60
|
return function generate(selectedVariants = {}, ...overrides) {
|
|
61
|
-
var _a, _b;
|
|
62
61
|
const cacheId = JSON.stringify({ config: config2, selectedVariants, overrides });
|
|
63
62
|
const cached = cache.get(cacheId);
|
|
64
63
|
if (cached)
|
|
@@ -68,11 +67,11 @@ function createCss(config, options) {
|
|
|
68
67
|
if (!variant)
|
|
69
68
|
continue;
|
|
70
69
|
const [type, bp] = key.split("_").reverse();
|
|
71
|
-
const responsive =
|
|
70
|
+
const responsive = responsiveVariants?.[type]?.[variant];
|
|
72
71
|
if (bp && responsive) {
|
|
73
72
|
variantStyles.push(convertToMediaStyles(bp, responsive));
|
|
74
73
|
} else {
|
|
75
|
-
variantStyles.push(
|
|
74
|
+
variantStyles.push(variants?.[type]?.[variant] ?? responsive);
|
|
76
75
|
}
|
|
77
76
|
}
|
|
78
77
|
const styles = css2(baseStyles, ...variantStyles, ...overrides);
|
|
@@ -109,6 +108,6 @@ function convertToMediaStyles(bp, styles) {
|
|
|
109
108
|
});
|
|
110
109
|
return Object.fromEntries(updatedEntries);
|
|
111
110
|
}
|
|
112
|
-
var css = createCss({}
|
|
111
|
+
var css = createCss({});
|
|
113
112
|
|
|
114
113
|
export { createCss, css };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tokenami/css",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.74",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
@@ -34,10 +34,10 @@
|
|
|
34
34
|
"test:watch": "vitest"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@tokenami/config": "0.0.
|
|
37
|
+
"@tokenami/config": "0.0.74"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
|
-
"@tokenami/dev": "0.0.
|
|
40
|
+
"@tokenami/dev": "0.0.74",
|
|
41
41
|
"tsup": "^7.0.0",
|
|
42
42
|
"typescript": "^5.1.3",
|
|
43
43
|
"vitest": "^0.34.6"
|
|
@@ -46,5 +46,5 @@
|
|
|
46
46
|
"@tokenami/dev": ">= 0",
|
|
47
47
|
"typescript": ">= 5"
|
|
48
48
|
},
|
|
49
|
-
"gitHead": "
|
|
49
|
+
"gitHead": "eab35bee7eb2892db9a5ada8fe8fd8ee0fa16708"
|
|
50
50
|
}
|