@tokenami/css 0.0.98 → 0.0.99--canary.514.27860876148.0
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 +121 -94
- package/dist/index.d.cts +4 -4
- package/dist/index.d.ts +4 -4
- package/dist/index.js +121 -94
- package/package.json +4 -4
package/dist/index.cjs
CHANGED
|
@@ -24,121 +24,148 @@ var Tokenami__namespace = /*#__PURE__*/_interopNamespace(Tokenami);
|
|
|
24
24
|
|
|
25
25
|
// src/index.ts
|
|
26
26
|
var _TOKENAMI_CSS = Symbol.for("@tokenami/css");
|
|
27
|
-
var cssCache = Tokenami__namespace.createLRUCache();
|
|
28
|
-
var calcCache = Tokenami__namespace.createLRUCache();
|
|
29
|
-
var composeStylesMap = /* @__PURE__ */ new WeakMap();
|
|
30
27
|
function createCss(config, options = { escapeSpecialChars: true }) {
|
|
31
28
|
globalThis[_TOKENAMI_CSS] = options;
|
|
29
|
+
let cssCache = Tokenami__namespace.createLRUCache();
|
|
30
|
+
let calcCache = /* @__PURE__ */ new Set();
|
|
31
|
+
let propCache = /* @__PURE__ */ new Map();
|
|
32
|
+
let composeMap = /* @__PURE__ */ new WeakMap();
|
|
32
33
|
function css2(...allStyles) {
|
|
33
|
-
|
|
34
|
-
|
|
34
|
+
let id = generateId(allStyles);
|
|
35
|
+
let cached = cssCache.get(id);
|
|
35
36
|
if (cached) return cached;
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
for (
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
target[parsedProperty] = value;
|
|
60
|
-
if (isComposedProperty) continue;
|
|
61
|
-
if (propertyConfig.isCalc) {
|
|
62
|
-
overriddenStyles[calcToggle] = "/*on*/";
|
|
63
|
-
calcCache.set(parsedProperty, 1);
|
|
64
|
-
} else if (value === "inherit" && calcCache.get(parsedProperty)) {
|
|
65
|
-
overriddenStyles[calcToggle] = "inherit";
|
|
66
|
-
} else {
|
|
67
|
-
delete overriddenStyles[calcToggle];
|
|
68
|
-
}
|
|
37
|
+
let opts = globalThis[_TOKENAMI_CSS];
|
|
38
|
+
let result = {};
|
|
39
|
+
let composeResult = {};
|
|
40
|
+
composeMap.set(result, composeResult);
|
|
41
|
+
function add(key, value, composed) {
|
|
42
|
+
let config2 = getProperty(key, opts);
|
|
43
|
+
if (!config2) {
|
|
44
|
+
result[key] = value;
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
for (let [prop, prop__calc] of config2) {
|
|
48
|
+
overrideLonghands(result, prop);
|
|
49
|
+
let composeValue = composeResult[prop];
|
|
50
|
+
let target = composed && composeValue == null ? composeResult : result;
|
|
51
|
+
target[prop] = value;
|
|
52
|
+
if (composed) continue;
|
|
53
|
+
if (typeof value === "number" && value !== 0) {
|
|
54
|
+
result[prop__calc] = "/*on*/";
|
|
55
|
+
calcCache.add(prop);
|
|
56
|
+
} else if (value === "inherit" && calcCache.has(prop)) {
|
|
57
|
+
result[prop__calc] = "inherit";
|
|
58
|
+
} else {
|
|
59
|
+
delete result[prop__calc];
|
|
69
60
|
}
|
|
70
61
|
}
|
|
71
62
|
}
|
|
72
|
-
|
|
73
|
-
|
|
63
|
+
for (let styles of allStyles) {
|
|
64
|
+
if (!styles) continue;
|
|
65
|
+
let composeSx = composeMap.get(styles) ?? {};
|
|
66
|
+
for (let key in composeSx) {
|
|
67
|
+
add(key, composeSx[key], true);
|
|
68
|
+
}
|
|
69
|
+
for (let key in styles) {
|
|
70
|
+
add(key, styles[key], composeSx[key] != null);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
cssCache.set(id, result);
|
|
74
|
+
return result;
|
|
74
75
|
}
|
|
75
|
-
css2.compose = (
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
76
|
+
css2.compose = (input) => {
|
|
77
|
+
let { includes = [], variants, ...baseSx } = input;
|
|
78
|
+
let cn = Tokenami__namespace.generateClassName(baseSx);
|
|
79
|
+
let cache = Tokenami__namespace.createLRUCache();
|
|
80
|
+
return function generate(currVariants = {}) {
|
|
81
|
+
let id = Object.entries(currVariants).join("|");
|
|
82
|
+
let cached = cache.get(id);
|
|
81
83
|
if (cached) return cached;
|
|
82
|
-
|
|
83
|
-
let
|
|
84
|
-
let
|
|
85
|
-
let
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
includeStyles.push(styles());
|
|
84
|
+
let variantSx = [];
|
|
85
|
+
let includeSx = [];
|
|
86
|
+
let includeCn = [];
|
|
87
|
+
for (let incl of includes) {
|
|
88
|
+
if (typeof incl === "function") {
|
|
89
|
+
let [cn2, sx] = incl(currVariants);
|
|
90
|
+
includeCn.push(cn2());
|
|
91
|
+
includeSx.push(sx());
|
|
91
92
|
} else {
|
|
92
|
-
|
|
93
|
+
includeSx.push(incl);
|
|
93
94
|
}
|
|
94
95
|
}
|
|
95
|
-
for (
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
if (
|
|
96
|
+
for (let [key, variant] of Object.entries(currVariants)) {
|
|
97
|
+
let group = variants?.[key];
|
|
98
|
+
let value = group?.[variant];
|
|
99
|
+
if (value) variantSx.push(value);
|
|
99
100
|
}
|
|
100
|
-
|
|
101
|
-
(...
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
composeStylesMap.set(styles, baseStyles);
|
|
107
|
-
return css2.apply(null, [...includeStyles, styles, ...variantStyles, ...overrides]);
|
|
101
|
+
let result = [
|
|
102
|
+
(...cns) => [...includeCn, cn, ...cns].filter(Boolean).join(" "),
|
|
103
|
+
(...sx) => {
|
|
104
|
+
let base = {};
|
|
105
|
+
composeMap.set(base, baseSx);
|
|
106
|
+
return css2(...includeSx, base, ...variantSx, ...sx);
|
|
108
107
|
}
|
|
109
108
|
];
|
|
110
|
-
|
|
109
|
+
cache.set(id, result);
|
|
111
110
|
return result;
|
|
112
111
|
};
|
|
113
112
|
};
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
if (
|
|
119
|
-
|
|
113
|
+
function getProperty(key, opts) {
|
|
114
|
+
let cached = propCache.get(key);
|
|
115
|
+
if (cached !== void 0) return cached;
|
|
116
|
+
let tokenProperty = Tokenami__namespace.TokenProperty.safeParse(key);
|
|
117
|
+
if (!tokenProperty.success) {
|
|
118
|
+
propCache.set(key, 0);
|
|
119
|
+
return 0;
|
|
120
120
|
}
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
121
|
+
let parts = Tokenami__namespace.getTokenPropertySplit(tokenProperty.output);
|
|
122
|
+
let cssProperties = config.aliases?.[parts.alias] || [parts.alias];
|
|
123
|
+
let properties = [];
|
|
124
|
+
for (let cssProperty of cssProperties) {
|
|
125
|
+
let longProperty = Tokenami__namespace.createLonghandProperty(tokenProperty.output, cssProperty);
|
|
126
|
+
let parsedProperty = Tokenami__namespace.parseProperty(longProperty, opts);
|
|
127
|
+
let calcToggle = Tokenami__namespace.calcProperty(parsedProperty);
|
|
128
|
+
properties.push([parsedProperty, calcToggle]);
|
|
129
|
+
}
|
|
130
|
+
propCache.set(key, properties);
|
|
131
|
+
return properties;
|
|
132
|
+
}
|
|
133
|
+
function generateId(objs) {
|
|
134
|
+
let id = "";
|
|
135
|
+
for (let obj of objs) {
|
|
136
|
+
if (!obj) continue;
|
|
137
|
+
let composeSx = composeMap.get(obj);
|
|
138
|
+
if (composeSx) {
|
|
139
|
+
for (let key in composeSx) {
|
|
140
|
+
id += key + ":" + String(composeSx[key]) + ";";
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
for (let key in obj) {
|
|
144
|
+
id += key + ":" + String(obj[key]) + ";";
|
|
145
|
+
}
|
|
139
146
|
}
|
|
140
|
-
|
|
147
|
+
return id;
|
|
141
148
|
}
|
|
149
|
+
function overrideLonghands(result, tokenProperty) {
|
|
150
|
+
let parts = Tokenami__namespace.getTokenPropertySplit(tokenProperty);
|
|
151
|
+
let longhands = Tokenami__namespace.mapShorthandToLonghands.get(parts.alias) || [];
|
|
152
|
+
for (let long of longhands) {
|
|
153
|
+
let longProp = Tokenami__namespace.createLonghandProperty(tokenProperty, long);
|
|
154
|
+
let calcProp = Tokenami__namespace.calcProperty(longProp);
|
|
155
|
+
let composeSx = composeMap.get(result);
|
|
156
|
+
let composeValue = composeSx?.[longProp];
|
|
157
|
+
if (composeValue) {
|
|
158
|
+
let value = composeValue ?? result[longProp];
|
|
159
|
+
if (typeof value === "number") result[calcProp] = "initial";
|
|
160
|
+
result[longProp] = "initial";
|
|
161
|
+
} else {
|
|
162
|
+
delete result[longProp];
|
|
163
|
+
delete result[calcProp];
|
|
164
|
+
}
|
|
165
|
+
overrideLonghands(result, longProp);
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
return css2;
|
|
142
169
|
}
|
|
143
170
|
var css = createCss({});
|
|
144
171
|
|
package/dist/index.d.cts
CHANGED
|
@@ -15,10 +15,10 @@ type VariantsConfig<T> = {
|
|
|
15
15
|
type VariantNumber<T> = T extends `${infer N extends number}` ? N : T;
|
|
16
16
|
type VariantBoolean<T> = T extends 'true' | 'false' ? boolean : T;
|
|
17
17
|
type VariantValue<T> = VariantNumber<VariantBoolean<T>>;
|
|
18
|
-
type ClassName = string | undefined | null | false;
|
|
19
18
|
type Variants$1<C> = undefined extends C ? {} : {
|
|
20
19
|
[V in keyof C]?: VariantValue<keyof C[V]>;
|
|
21
20
|
};
|
|
21
|
+
type ClassName = string | undefined | null | false;
|
|
22
22
|
type TokenamiComposeInput<T> = TokenamiProperties & {
|
|
23
23
|
includes?: (TokenamiComposeOutput<any> | TokenamiCSS)[];
|
|
24
24
|
variants?: VariantsConfig<T>;
|
|
@@ -39,11 +39,11 @@ type CreateCssOptions = {
|
|
|
39
39
|
};
|
|
40
40
|
declare function createCss(config: Pick<Tokenami.Config, 'aliases'>, options?: CreateCssOptions): {
|
|
41
41
|
(allStyles_0: TokenamiProperties, ...allStyles_1: TokenamiOverride[]): TokenamiCSS;
|
|
42
|
-
compose<T>(
|
|
42
|
+
compose<T>(input: TokenamiComposeInput<T>): TokenamiComposeOutput<T>;
|
|
43
43
|
};
|
|
44
|
-
declare
|
|
44
|
+
declare let css: {
|
|
45
45
|
(allStyles_0: TokenamiProperties, ...allStyles_1: TokenamiOverride[]): TokenamiCSS;
|
|
46
|
-
compose<T>(
|
|
46
|
+
compose<T>(input: TokenamiComposeInput<T>): TokenamiComposeOutput<T>;
|
|
47
47
|
};
|
|
48
48
|
|
|
49
49
|
type TokenamiStyle<P> = P & {
|
package/dist/index.d.ts
CHANGED
|
@@ -15,10 +15,10 @@ type VariantsConfig<T> = {
|
|
|
15
15
|
type VariantNumber<T> = T extends `${infer N extends number}` ? N : T;
|
|
16
16
|
type VariantBoolean<T> = T extends 'true' | 'false' ? boolean : T;
|
|
17
17
|
type VariantValue<T> = VariantNumber<VariantBoolean<T>>;
|
|
18
|
-
type ClassName = string | undefined | null | false;
|
|
19
18
|
type Variants$1<C> = undefined extends C ? {} : {
|
|
20
19
|
[V in keyof C]?: VariantValue<keyof C[V]>;
|
|
21
20
|
};
|
|
21
|
+
type ClassName = string | undefined | null | false;
|
|
22
22
|
type TokenamiComposeInput<T> = TokenamiProperties & {
|
|
23
23
|
includes?: (TokenamiComposeOutput<any> | TokenamiCSS)[];
|
|
24
24
|
variants?: VariantsConfig<T>;
|
|
@@ -39,11 +39,11 @@ type CreateCssOptions = {
|
|
|
39
39
|
};
|
|
40
40
|
declare function createCss(config: Pick<Tokenami.Config, 'aliases'>, options?: CreateCssOptions): {
|
|
41
41
|
(allStyles_0: TokenamiProperties, ...allStyles_1: TokenamiOverride[]): TokenamiCSS;
|
|
42
|
-
compose<T>(
|
|
42
|
+
compose<T>(input: TokenamiComposeInput<T>): TokenamiComposeOutput<T>;
|
|
43
43
|
};
|
|
44
|
-
declare
|
|
44
|
+
declare let css: {
|
|
45
45
|
(allStyles_0: TokenamiProperties, ...allStyles_1: TokenamiOverride[]): TokenamiCSS;
|
|
46
|
-
compose<T>(
|
|
46
|
+
compose<T>(input: TokenamiComposeInput<T>): TokenamiComposeOutput<T>;
|
|
47
47
|
};
|
|
48
48
|
|
|
49
49
|
type TokenamiStyle<P> = P & {
|
package/dist/index.js
CHANGED
|
@@ -3,121 +3,148 @@ export { createConfig } from '@tokenami/config';
|
|
|
3
3
|
|
|
4
4
|
// src/index.ts
|
|
5
5
|
var _TOKENAMI_CSS = Symbol.for("@tokenami/css");
|
|
6
|
-
var cssCache = Tokenami.createLRUCache();
|
|
7
|
-
var calcCache = Tokenami.createLRUCache();
|
|
8
|
-
var composeStylesMap = /* @__PURE__ */ new WeakMap();
|
|
9
6
|
function createCss(config, options = { escapeSpecialChars: true }) {
|
|
10
7
|
globalThis[_TOKENAMI_CSS] = options;
|
|
8
|
+
let cssCache = Tokenami.createLRUCache();
|
|
9
|
+
let calcCache = /* @__PURE__ */ new Set();
|
|
10
|
+
let propCache = /* @__PURE__ */ new Map();
|
|
11
|
+
let composeMap = /* @__PURE__ */ new WeakMap();
|
|
11
12
|
function css2(...allStyles) {
|
|
12
|
-
|
|
13
|
-
|
|
13
|
+
let id = generateId(allStyles);
|
|
14
|
+
let cached = cssCache.get(id);
|
|
14
15
|
if (cached) return cached;
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
for (
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
target[parsedProperty] = value;
|
|
39
|
-
if (isComposedProperty) continue;
|
|
40
|
-
if (propertyConfig.isCalc) {
|
|
41
|
-
overriddenStyles[calcToggle] = "/*on*/";
|
|
42
|
-
calcCache.set(parsedProperty, 1);
|
|
43
|
-
} else if (value === "inherit" && calcCache.get(parsedProperty)) {
|
|
44
|
-
overriddenStyles[calcToggle] = "inherit";
|
|
45
|
-
} else {
|
|
46
|
-
delete overriddenStyles[calcToggle];
|
|
47
|
-
}
|
|
16
|
+
let opts = globalThis[_TOKENAMI_CSS];
|
|
17
|
+
let result = {};
|
|
18
|
+
let composeResult = {};
|
|
19
|
+
composeMap.set(result, composeResult);
|
|
20
|
+
function add(key, value, composed) {
|
|
21
|
+
let config2 = getProperty(key, opts);
|
|
22
|
+
if (!config2) {
|
|
23
|
+
result[key] = value;
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
for (let [prop, prop__calc] of config2) {
|
|
27
|
+
overrideLonghands(result, prop);
|
|
28
|
+
let composeValue = composeResult[prop];
|
|
29
|
+
let target = composed && composeValue == null ? composeResult : result;
|
|
30
|
+
target[prop] = value;
|
|
31
|
+
if (composed) continue;
|
|
32
|
+
if (typeof value === "number" && value !== 0) {
|
|
33
|
+
result[prop__calc] = "/*on*/";
|
|
34
|
+
calcCache.add(prop);
|
|
35
|
+
} else if (value === "inherit" && calcCache.has(prop)) {
|
|
36
|
+
result[prop__calc] = "inherit";
|
|
37
|
+
} else {
|
|
38
|
+
delete result[prop__calc];
|
|
48
39
|
}
|
|
49
40
|
}
|
|
50
41
|
}
|
|
51
|
-
|
|
52
|
-
|
|
42
|
+
for (let styles of allStyles) {
|
|
43
|
+
if (!styles) continue;
|
|
44
|
+
let composeSx = composeMap.get(styles) ?? {};
|
|
45
|
+
for (let key in composeSx) {
|
|
46
|
+
add(key, composeSx[key], true);
|
|
47
|
+
}
|
|
48
|
+
for (let key in styles) {
|
|
49
|
+
add(key, styles[key], composeSx[key] != null);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
cssCache.set(id, result);
|
|
53
|
+
return result;
|
|
53
54
|
}
|
|
54
|
-
css2.compose = (
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
55
|
+
css2.compose = (input) => {
|
|
56
|
+
let { includes = [], variants, ...baseSx } = input;
|
|
57
|
+
let cn = Tokenami.generateClassName(baseSx);
|
|
58
|
+
let cache = Tokenami.createLRUCache();
|
|
59
|
+
return function generate(currVariants = {}) {
|
|
60
|
+
let id = Object.entries(currVariants).join("|");
|
|
61
|
+
let cached = cache.get(id);
|
|
60
62
|
if (cached) return cached;
|
|
61
|
-
|
|
62
|
-
let
|
|
63
|
-
let
|
|
64
|
-
let
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
includeStyles.push(styles());
|
|
63
|
+
let variantSx = [];
|
|
64
|
+
let includeSx = [];
|
|
65
|
+
let includeCn = [];
|
|
66
|
+
for (let incl of includes) {
|
|
67
|
+
if (typeof incl === "function") {
|
|
68
|
+
let [cn2, sx] = incl(currVariants);
|
|
69
|
+
includeCn.push(cn2());
|
|
70
|
+
includeSx.push(sx());
|
|
70
71
|
} else {
|
|
71
|
-
|
|
72
|
+
includeSx.push(incl);
|
|
72
73
|
}
|
|
73
74
|
}
|
|
74
|
-
for (
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
if (
|
|
75
|
+
for (let [key, variant] of Object.entries(currVariants)) {
|
|
76
|
+
let group = variants?.[key];
|
|
77
|
+
let value = group?.[variant];
|
|
78
|
+
if (value) variantSx.push(value);
|
|
78
79
|
}
|
|
79
|
-
|
|
80
|
-
(...
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
composeStylesMap.set(styles, baseStyles);
|
|
86
|
-
return css2.apply(null, [...includeStyles, styles, ...variantStyles, ...overrides]);
|
|
80
|
+
let result = [
|
|
81
|
+
(...cns) => [...includeCn, cn, ...cns].filter(Boolean).join(" "),
|
|
82
|
+
(...sx) => {
|
|
83
|
+
let base = {};
|
|
84
|
+
composeMap.set(base, baseSx);
|
|
85
|
+
return css2(...includeSx, base, ...variantSx, ...sx);
|
|
87
86
|
}
|
|
88
87
|
];
|
|
89
|
-
|
|
88
|
+
cache.set(id, result);
|
|
90
89
|
return result;
|
|
91
90
|
};
|
|
92
91
|
};
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
if (
|
|
98
|
-
|
|
92
|
+
function getProperty(key, opts) {
|
|
93
|
+
let cached = propCache.get(key);
|
|
94
|
+
if (cached !== void 0) return cached;
|
|
95
|
+
let tokenProperty = Tokenami.TokenProperty.safeParse(key);
|
|
96
|
+
if (!tokenProperty.success) {
|
|
97
|
+
propCache.set(key, 0);
|
|
98
|
+
return 0;
|
|
99
99
|
}
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
100
|
+
let parts = Tokenami.getTokenPropertySplit(tokenProperty.output);
|
|
101
|
+
let cssProperties = config.aliases?.[parts.alias] || [parts.alias];
|
|
102
|
+
let properties = [];
|
|
103
|
+
for (let cssProperty of cssProperties) {
|
|
104
|
+
let longProperty = Tokenami.createLonghandProperty(tokenProperty.output, cssProperty);
|
|
105
|
+
let parsedProperty = Tokenami.parseProperty(longProperty, opts);
|
|
106
|
+
let calcToggle = Tokenami.calcProperty(parsedProperty);
|
|
107
|
+
properties.push([parsedProperty, calcToggle]);
|
|
108
|
+
}
|
|
109
|
+
propCache.set(key, properties);
|
|
110
|
+
return properties;
|
|
111
|
+
}
|
|
112
|
+
function generateId(objs) {
|
|
113
|
+
let id = "";
|
|
114
|
+
for (let obj of objs) {
|
|
115
|
+
if (!obj) continue;
|
|
116
|
+
let composeSx = composeMap.get(obj);
|
|
117
|
+
if (composeSx) {
|
|
118
|
+
for (let key in composeSx) {
|
|
119
|
+
id += key + ":" + String(composeSx[key]) + ";";
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
for (let key in obj) {
|
|
123
|
+
id += key + ":" + String(obj[key]) + ";";
|
|
124
|
+
}
|
|
118
125
|
}
|
|
119
|
-
|
|
126
|
+
return id;
|
|
120
127
|
}
|
|
128
|
+
function overrideLonghands(result, tokenProperty) {
|
|
129
|
+
let parts = Tokenami.getTokenPropertySplit(tokenProperty);
|
|
130
|
+
let longhands = Tokenami.mapShorthandToLonghands.get(parts.alias) || [];
|
|
131
|
+
for (let long of longhands) {
|
|
132
|
+
let longProp = Tokenami.createLonghandProperty(tokenProperty, long);
|
|
133
|
+
let calcProp = Tokenami.calcProperty(longProp);
|
|
134
|
+
let composeSx = composeMap.get(result);
|
|
135
|
+
let composeValue = composeSx?.[longProp];
|
|
136
|
+
if (composeValue) {
|
|
137
|
+
let value = composeValue ?? result[longProp];
|
|
138
|
+
if (typeof value === "number") result[calcProp] = "initial";
|
|
139
|
+
result[longProp] = "initial";
|
|
140
|
+
} else {
|
|
141
|
+
delete result[longProp];
|
|
142
|
+
delete result[calcProp];
|
|
143
|
+
}
|
|
144
|
+
overrideLonghands(result, longProp);
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
return css2;
|
|
121
148
|
}
|
|
122
149
|
var css = createCss({});
|
|
123
150
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tokenami/css",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.99--canary.514.27860876148.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
@@ -34,10 +34,10 @@
|
|
|
34
34
|
"typecheck": "tsc --noEmit"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@tokenami/config": "0.0.
|
|
37
|
+
"@tokenami/config": "0.0.99--canary.514.27860876148.0"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
|
-
"tokenami": "0.0.
|
|
40
|
+
"tokenami": "0.0.99--canary.514.27860876148.0",
|
|
41
41
|
"tsup": "^8.4.0",
|
|
42
42
|
"typescript": "^5.1.3",
|
|
43
43
|
"vitest": "^3.2.6"
|
|
@@ -46,5 +46,5 @@
|
|
|
46
46
|
"tokenami": ">= 0",
|
|
47
47
|
"typescript": ">= 5"
|
|
48
48
|
},
|
|
49
|
-
"gitHead": "
|
|
49
|
+
"gitHead": "8ea0af0f2447a32aea039dadb24e28b698fc4531"
|
|
50
50
|
}
|