@styleframe/core 1.0.0 → 1.0.2
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 +12 -0
- package/LICENSE +21 -0
- package/dist/styleframe.d.ts +301 -0
- package/dist/styleframe.js +528 -0
- package/dist/styleframe.umd.cjs +1 -0
- package/package.json +13 -3
- package/.tsbuildinfo +0 -1
- package/src/index.ts +0 -5
- package/src/styleframe.ts +0 -64
- package/src/tokens/atRule.test.ts +0 -1013
- package/src/tokens/atRule.ts +0 -67
- package/src/tokens/css.test.ts +0 -404
- package/src/tokens/css.ts +0 -23
- package/src/tokens/declarations.test.ts +0 -584
- package/src/tokens/declarations.ts +0 -71
- package/src/tokens/index.ts +0 -11
- package/src/tokens/modifier.test.ts +0 -90
- package/src/tokens/modifier.ts +0 -86
- package/src/tokens/recipe.test.ts +0 -105
- package/src/tokens/recipe.ts +0 -32
- package/src/tokens/ref.test.ts +0 -430
- package/src/tokens/ref.ts +0 -24
- package/src/tokens/root.test.ts +0 -70
- package/src/tokens/root.ts +0 -14
- package/src/tokens/selector.test.ts +0 -440
- package/src/tokens/selector.ts +0 -47
- package/src/tokens/theme.test.ts +0 -338
- package/src/tokens/theme.ts +0 -26
- package/src/tokens/utility.test.ts +0 -1456
- package/src/tokens/utility.ts +0 -92
- package/src/tokens/variable.test.ts +0 -235
- package/src/tokens/variable.ts +0 -42
- package/src/typeGuards.test.ts +0 -33
- package/src/typeGuards.ts +0 -98
- package/src/types/declarations.ts +0 -42
- package/src/types/index.ts +0 -3
- package/src/types/options.ts +0 -22
- package/src/types/tokens.ts +0 -149
- package/src/utils/capitalizeFirst.ts +0 -9
- package/src/utils/deepClone.ts +0 -317
- package/src/utils/getters.test.ts +0 -399
- package/src/utils/getters.ts +0 -36
- package/src/utils/index.ts +0 -4
- package/src/utils/merge.test.ts +0 -978
- package/src/utils/merge.ts +0 -73
- package/src/vite-env.d.ts +0 -1
- package/tsconfig.json +0 -7
- package/vite.config.ts +0 -5
package/src/tokens/atRule.ts
DELETED
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
AtRule,
|
|
3
|
-
Container,
|
|
4
|
-
DeclarationsBlock,
|
|
5
|
-
DeclarationsCallback,
|
|
6
|
-
Root,
|
|
7
|
-
} from "../types";
|
|
8
|
-
import {
|
|
9
|
-
createDeclarationsCallbackContext,
|
|
10
|
-
parseDeclarationsBlock,
|
|
11
|
-
} from "./declarations";
|
|
12
|
-
|
|
13
|
-
export function createAtRuleFunction(parent: Container, root: Root) {
|
|
14
|
-
return function atRule(
|
|
15
|
-
identifier: string,
|
|
16
|
-
rule: string,
|
|
17
|
-
declarationsOrCallback?: DeclarationsBlock | DeclarationsCallback,
|
|
18
|
-
): AtRule {
|
|
19
|
-
const instance: AtRule = {
|
|
20
|
-
type: "at-rule",
|
|
21
|
-
identifier,
|
|
22
|
-
rule,
|
|
23
|
-
declarations: {},
|
|
24
|
-
variables: [],
|
|
25
|
-
children: [],
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
const callbackContext = createDeclarationsCallbackContext(instance, root);
|
|
29
|
-
|
|
30
|
-
// Handle overloaded parameters
|
|
31
|
-
if (typeof declarationsOrCallback === "function") {
|
|
32
|
-
// atRule(query, callback)
|
|
33
|
-
instance.declarations = declarationsOrCallback(callbackContext) ?? {};
|
|
34
|
-
} else if (declarationsOrCallback) {
|
|
35
|
-
// atRule(query, declarations)
|
|
36
|
-
instance.declarations = declarationsOrCallback;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
parseDeclarationsBlock(instance.declarations, callbackContext);
|
|
40
|
-
|
|
41
|
-
parent.children.push(instance);
|
|
42
|
-
|
|
43
|
-
return instance;
|
|
44
|
-
};
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
export function createMediaFunction(parent: Container, root: Root) {
|
|
48
|
-
const atRule = createAtRuleFunction(parent, root);
|
|
49
|
-
|
|
50
|
-
return function media(
|
|
51
|
-
query: string,
|
|
52
|
-
declarationsOrCallback?: DeclarationsBlock | DeclarationsCallback,
|
|
53
|
-
): AtRule {
|
|
54
|
-
return atRule("media", query, declarationsOrCallback);
|
|
55
|
-
};
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
export function createKeyframesFunction(parent: Container, root: Root) {
|
|
59
|
-
const atRule = createAtRuleFunction(parent, root);
|
|
60
|
-
|
|
61
|
-
return function keyframes(
|
|
62
|
-
name: string,
|
|
63
|
-
declarations: Record<string, DeclarationsBlock>,
|
|
64
|
-
): AtRule {
|
|
65
|
-
return atRule("keyframes", name, declarations);
|
|
66
|
-
};
|
|
67
|
-
}
|
package/src/tokens/css.test.ts
DELETED
|
@@ -1,404 +0,0 @@
|
|
|
1
|
-
import type { Root, Selector } from "../types";
|
|
2
|
-
import { createCssFunction } from "./css";
|
|
3
|
-
import { createRefFunction } from "./ref";
|
|
4
|
-
import { createRoot } from "./root";
|
|
5
|
-
import { createVariableFunction } from "./variable";
|
|
6
|
-
|
|
7
|
-
describe("createCSSFunction", () => {
|
|
8
|
-
let root: Root;
|
|
9
|
-
let selector: Selector;
|
|
10
|
-
let css: ReturnType<typeof createCssFunction>;
|
|
11
|
-
let variable: ReturnType<typeof createVariableFunction>;
|
|
12
|
-
let ref: ReturnType<typeof createRefFunction>;
|
|
13
|
-
|
|
14
|
-
beforeEach(() => {
|
|
15
|
-
root = createRoot();
|
|
16
|
-
selector = {
|
|
17
|
-
type: "selector",
|
|
18
|
-
query: ".test",
|
|
19
|
-
variables: [],
|
|
20
|
-
declarations: {},
|
|
21
|
-
children: [],
|
|
22
|
-
};
|
|
23
|
-
css = createCssFunction(selector, root);
|
|
24
|
-
variable = createVariableFunction(selector, root);
|
|
25
|
-
ref = createRefFunction(selector, root);
|
|
26
|
-
});
|
|
27
|
-
|
|
28
|
-
describe("basic CSS creation", () => {
|
|
29
|
-
it("should create a CSS object with strings only", () => {
|
|
30
|
-
const result = css`color: blue;`;
|
|
31
|
-
|
|
32
|
-
expect(result).toEqual({
|
|
33
|
-
type: "css",
|
|
34
|
-
value: ["color: blue;"],
|
|
35
|
-
});
|
|
36
|
-
});
|
|
37
|
-
|
|
38
|
-
it("should create a CSS object with empty template", () => {
|
|
39
|
-
const result = css``;
|
|
40
|
-
|
|
41
|
-
expect(result).toEqual({
|
|
42
|
-
type: "css",
|
|
43
|
-
value: [""],
|
|
44
|
-
});
|
|
45
|
-
});
|
|
46
|
-
|
|
47
|
-
it("should handle multiline CSS", () => {
|
|
48
|
-
const result = css`
|
|
49
|
-
color: blue;
|
|
50
|
-
background: red;
|
|
51
|
-
`;
|
|
52
|
-
|
|
53
|
-
expect(result).toEqual({
|
|
54
|
-
type: "css",
|
|
55
|
-
value: ["\n\t\t\t\tcolor: blue;\n\t\t\t\tbackground: red;\n\t\t\t"],
|
|
56
|
-
});
|
|
57
|
-
});
|
|
58
|
-
});
|
|
59
|
-
|
|
60
|
-
describe("interpolation handling", () => {
|
|
61
|
-
it("should handle single string interpolation", () => {
|
|
62
|
-
const color = "blue";
|
|
63
|
-
const result = css`color: ${color};`;
|
|
64
|
-
|
|
65
|
-
expect(result).toEqual({
|
|
66
|
-
type: "css",
|
|
67
|
-
value: ["color: ", "blue", ";"],
|
|
68
|
-
});
|
|
69
|
-
});
|
|
70
|
-
|
|
71
|
-
it("should handle multiple string interpolations", () => {
|
|
72
|
-
const color = "blue";
|
|
73
|
-
const size = "16px";
|
|
74
|
-
const result = css`color: ${color}; font-size: ${size};`;
|
|
75
|
-
|
|
76
|
-
expect(result).toEqual({
|
|
77
|
-
type: "css",
|
|
78
|
-
value: ["color: ", "blue", "; font-size: ", "16px", ";"],
|
|
79
|
-
});
|
|
80
|
-
});
|
|
81
|
-
|
|
82
|
-
it("should handle interpolation at the beginning", () => {
|
|
83
|
-
const property = "color";
|
|
84
|
-
const result = css`${property}: blue;`;
|
|
85
|
-
|
|
86
|
-
expect(result).toEqual({
|
|
87
|
-
type: "css",
|
|
88
|
-
value: ["", "color", ": blue;"],
|
|
89
|
-
});
|
|
90
|
-
});
|
|
91
|
-
|
|
92
|
-
it("should handle interpolation at the end", () => {
|
|
93
|
-
const value = "blue";
|
|
94
|
-
const result = css`color: ${value}`;
|
|
95
|
-
|
|
96
|
-
expect(result).toEqual({
|
|
97
|
-
type: "css",
|
|
98
|
-
value: ["color: ", "blue", ""],
|
|
99
|
-
});
|
|
100
|
-
});
|
|
101
|
-
|
|
102
|
-
it("should handle consecutive interpolations", () => {
|
|
103
|
-
const value1 = "solid";
|
|
104
|
-
const value2 = "1px";
|
|
105
|
-
const result = css`border: ${value1} ${value2};`;
|
|
106
|
-
|
|
107
|
-
expect(result).toEqual({
|
|
108
|
-
type: "css",
|
|
109
|
-
value: ["border: ", "solid", " ", "1px", ";"],
|
|
110
|
-
});
|
|
111
|
-
});
|
|
112
|
-
});
|
|
113
|
-
|
|
114
|
-
describe("variable reference interpolation", () => {
|
|
115
|
-
it("should handle variable reference interpolation", () => {
|
|
116
|
-
const colorPrimary = variable("color-primary", "#006cff");
|
|
117
|
-
const result = css`color: ${ref(colorPrimary)};`;
|
|
118
|
-
|
|
119
|
-
expect(result).toEqual({
|
|
120
|
-
type: "css",
|
|
121
|
-
value: [
|
|
122
|
-
"color: ",
|
|
123
|
-
{
|
|
124
|
-
type: "reference",
|
|
125
|
-
name: "color-primary",
|
|
126
|
-
fallback: undefined,
|
|
127
|
-
},
|
|
128
|
-
";",
|
|
129
|
-
],
|
|
130
|
-
});
|
|
131
|
-
});
|
|
132
|
-
|
|
133
|
-
it("should handle multiple variable references", () => {
|
|
134
|
-
const colorPrimary = variable("color-primary", "#006cff");
|
|
135
|
-
const spacing = variable("spacing-md", "1rem");
|
|
136
|
-
|
|
137
|
-
const result = css`
|
|
138
|
-
color: ${ref(colorPrimary)};
|
|
139
|
-
padding: ${ref(spacing)};
|
|
140
|
-
`;
|
|
141
|
-
|
|
142
|
-
expect(result.value).toEqual([
|
|
143
|
-
"\n\t\t\t\tcolor: ",
|
|
144
|
-
{
|
|
145
|
-
type: "reference",
|
|
146
|
-
name: "color-primary",
|
|
147
|
-
fallback: undefined,
|
|
148
|
-
},
|
|
149
|
-
";\n\t\t\t\tpadding: ",
|
|
150
|
-
{
|
|
151
|
-
type: "reference",
|
|
152
|
-
name: "spacing-md",
|
|
153
|
-
fallback: undefined,
|
|
154
|
-
},
|
|
155
|
-
";\n\t\t\t",
|
|
156
|
-
]);
|
|
157
|
-
});
|
|
158
|
-
|
|
159
|
-
it("should handle variable references with fallbacks", () => {
|
|
160
|
-
const result = css`color: ${ref("undefined-color", "#fallback")};`;
|
|
161
|
-
|
|
162
|
-
expect(result).toEqual({
|
|
163
|
-
type: "css",
|
|
164
|
-
value: [
|
|
165
|
-
"color: ",
|
|
166
|
-
{
|
|
167
|
-
type: "reference",
|
|
168
|
-
name: "undefined-color",
|
|
169
|
-
fallback: "#fallback",
|
|
170
|
-
},
|
|
171
|
-
";",
|
|
172
|
-
],
|
|
173
|
-
});
|
|
174
|
-
});
|
|
175
|
-
});
|
|
176
|
-
|
|
177
|
-
describe("mixed interpolation types", () => {
|
|
178
|
-
it("should handle mixed string and reference interpolations", () => {
|
|
179
|
-
const colorPrimary = variable("color-primary", "#006cff");
|
|
180
|
-
const width = "100%";
|
|
181
|
-
|
|
182
|
-
const result = css`
|
|
183
|
-
color: ${ref(colorPrimary)};
|
|
184
|
-
width: ${width};
|
|
185
|
-
`;
|
|
186
|
-
|
|
187
|
-
expect(result.value).toEqual([
|
|
188
|
-
"\n\t\t\t\tcolor: ",
|
|
189
|
-
{
|
|
190
|
-
type: "reference",
|
|
191
|
-
name: "color-primary",
|
|
192
|
-
fallback: undefined,
|
|
193
|
-
},
|
|
194
|
-
";\n\t\t\t\twidth: ",
|
|
195
|
-
"100%",
|
|
196
|
-
";\n\t\t\t",
|
|
197
|
-
]);
|
|
198
|
-
});
|
|
199
|
-
|
|
200
|
-
it("should handle complex mixed interpolations", () => {
|
|
201
|
-
const primary = variable("primary", "#006cff");
|
|
202
|
-
const secondary = "#ff5733";
|
|
203
|
-
const opacity = "0.8";
|
|
204
|
-
|
|
205
|
-
const result = css`
|
|
206
|
-
background: linear-gradient(
|
|
207
|
-
to right,
|
|
208
|
-
${ref(primary)},
|
|
209
|
-
${secondary}
|
|
210
|
-
);
|
|
211
|
-
opacity: ${opacity};
|
|
212
|
-
`;
|
|
213
|
-
|
|
214
|
-
expect(result.value).toHaveLength(7); // 4 strings + 3 interpolations
|
|
215
|
-
expect(result.value[1]).toEqual({
|
|
216
|
-
type: "reference",
|
|
217
|
-
name: "primary",
|
|
218
|
-
fallback: undefined,
|
|
219
|
-
});
|
|
220
|
-
expect(result.value[3]).toBe("#ff5733");
|
|
221
|
-
expect(result.value[5]).toBe("0.8");
|
|
222
|
-
});
|
|
223
|
-
});
|
|
224
|
-
|
|
225
|
-
describe("context parameter handling", () => {
|
|
226
|
-
it("should work with root context", () => {
|
|
227
|
-
const cssWithRootContext = createCssFunction(root, root);
|
|
228
|
-
const result = cssWithRootContext`color: blue;`;
|
|
229
|
-
|
|
230
|
-
expect(result).toEqual({
|
|
231
|
-
type: "css",
|
|
232
|
-
value: ["color: blue;"],
|
|
233
|
-
});
|
|
234
|
-
});
|
|
235
|
-
|
|
236
|
-
it("should work with selector context", () => {
|
|
237
|
-
const cssWithSelectorContext = createCssFunction(selector, root);
|
|
238
|
-
const result = cssWithSelectorContext`background: red;`;
|
|
239
|
-
|
|
240
|
-
expect(result).toEqual({
|
|
241
|
-
type: "css",
|
|
242
|
-
value: ["background: red;"],
|
|
243
|
-
});
|
|
244
|
-
});
|
|
245
|
-
|
|
246
|
-
it("should work with nested selector context", () => {
|
|
247
|
-
const nestedSelector: Selector = {
|
|
248
|
-
type: "selector",
|
|
249
|
-
query: "&:hover",
|
|
250
|
-
variables: [],
|
|
251
|
-
declarations: {},
|
|
252
|
-
children: [],
|
|
253
|
-
};
|
|
254
|
-
|
|
255
|
-
const cssWithNestedContext = createCssFunction(nestedSelector, root);
|
|
256
|
-
const result = cssWithNestedContext`opacity: 0.8;`;
|
|
257
|
-
|
|
258
|
-
expect(result).toEqual({
|
|
259
|
-
type: "css",
|
|
260
|
-
value: ["opacity: 0.8;"],
|
|
261
|
-
});
|
|
262
|
-
});
|
|
263
|
-
});
|
|
264
|
-
|
|
265
|
-
describe("TokenValue types handling", () => {
|
|
266
|
-
it("should handle number interpolations", () => {
|
|
267
|
-
const fontSize = 16;
|
|
268
|
-
const result = css`font-size: ${fontSize}px;`;
|
|
269
|
-
|
|
270
|
-
expect(result).toEqual({
|
|
271
|
-
type: "css",
|
|
272
|
-
value: ["font-size: ", 16, "px;"],
|
|
273
|
-
});
|
|
274
|
-
});
|
|
275
|
-
|
|
276
|
-
it("should handle boolean interpolations", () => {
|
|
277
|
-
const isVisible = true;
|
|
278
|
-
const result = css`display: ${isVisible ? "block" : "none"};`;
|
|
279
|
-
|
|
280
|
-
expect(result).toEqual({
|
|
281
|
-
type: "css",
|
|
282
|
-
value: ["display: ", "block", ";"],
|
|
283
|
-
});
|
|
284
|
-
});
|
|
285
|
-
|
|
286
|
-
it("should handle null and undefined interpolations", () => {
|
|
287
|
-
const nullValue = null;
|
|
288
|
-
const undefinedValue = undefined;
|
|
289
|
-
|
|
290
|
-
const result1 = css`value: ${nullValue};`;
|
|
291
|
-
const result2 = css`value: ${undefinedValue};`;
|
|
292
|
-
|
|
293
|
-
expect(result1.value).toEqual(["value: ", null, ";"]);
|
|
294
|
-
expect(result2.value).toEqual(["value: ", undefined, ";"]);
|
|
295
|
-
});
|
|
296
|
-
});
|
|
297
|
-
describe("edge cases", () => {
|
|
298
|
-
it("should maintain object identity for repeated calls", () => {
|
|
299
|
-
const colorVar = variable("repeat-test", "#fff");
|
|
300
|
-
|
|
301
|
-
const ref1 = ref(colorVar);
|
|
302
|
-
const ref2 = ref(colorVar);
|
|
303
|
-
|
|
304
|
-
// Should create new objects each time
|
|
305
|
-
expect(ref1).not.toBe(ref2);
|
|
306
|
-
// But should be equal in content
|
|
307
|
-
expect(ref1).toEqual(ref2);
|
|
308
|
-
});
|
|
309
|
-
|
|
310
|
-
it("should handle null fallback values", () => {
|
|
311
|
-
const result = ref("test-var", null as any);
|
|
312
|
-
|
|
313
|
-
expect(result.fallback).toBeNull();
|
|
314
|
-
});
|
|
315
|
-
});
|
|
316
|
-
|
|
317
|
-
describe("real-world usage patterns", () => {
|
|
318
|
-
it("should support design token patterns", () => {
|
|
319
|
-
const blue500 = variable("blue-500", "#3b82f6");
|
|
320
|
-
const blue600 = variable("blue-600", "#2563eb");
|
|
321
|
-
|
|
322
|
-
const colorPrimary = variable("color-primary", ref(blue500));
|
|
323
|
-
const colorPrimaryHover = variable("color-primary-hover", ref(blue600));
|
|
324
|
-
|
|
325
|
-
expect(colorPrimary.value).toEqual({
|
|
326
|
-
type: "reference",
|
|
327
|
-
name: "blue-500",
|
|
328
|
-
fallback: undefined,
|
|
329
|
-
});
|
|
330
|
-
|
|
331
|
-
expect(colorPrimaryHover.value).toEqual({
|
|
332
|
-
type: "reference",
|
|
333
|
-
name: "blue-600",
|
|
334
|
-
fallback: undefined,
|
|
335
|
-
});
|
|
336
|
-
});
|
|
337
|
-
|
|
338
|
-
it("should work in CSS template literals", () => {
|
|
339
|
-
const colorPrimary = variable("color-primary", "#006cff");
|
|
340
|
-
const spacingMd = variable("spacing-md", "1rem");
|
|
341
|
-
|
|
342
|
-
// Simulate usage in CSS templates
|
|
343
|
-
const colorRef = ref(colorPrimary);
|
|
344
|
-
const spacingRef = ref(spacingMd);
|
|
345
|
-
const fallbackRef = ref("text-color", "#000");
|
|
346
|
-
|
|
347
|
-
expect(colorRef).toEqual({
|
|
348
|
-
type: "reference",
|
|
349
|
-
name: "color-primary",
|
|
350
|
-
fallback: undefined,
|
|
351
|
-
});
|
|
352
|
-
|
|
353
|
-
expect(spacingRef).toEqual({
|
|
354
|
-
type: "reference",
|
|
355
|
-
name: "spacing-md",
|
|
356
|
-
fallback: undefined,
|
|
357
|
-
});
|
|
358
|
-
|
|
359
|
-
expect(fallbackRef).toEqual({
|
|
360
|
-
type: "reference",
|
|
361
|
-
name: "text-color",
|
|
362
|
-
fallback: "#000",
|
|
363
|
-
});
|
|
364
|
-
});
|
|
365
|
-
|
|
366
|
-
it("should support conditional references", () => {
|
|
367
|
-
const isDark = false;
|
|
368
|
-
const lightColor = variable("light-bg", "#ffffff");
|
|
369
|
-
const darkColor = variable("dark-bg", "#000000");
|
|
370
|
-
|
|
371
|
-
const bgColor = isDark ? ref(darkColor) : ref(lightColor);
|
|
372
|
-
|
|
373
|
-
expect(bgColor).toEqual({
|
|
374
|
-
type: "reference",
|
|
375
|
-
name: "light-bg",
|
|
376
|
-
fallback: undefined,
|
|
377
|
-
});
|
|
378
|
-
});
|
|
379
|
-
});
|
|
380
|
-
|
|
381
|
-
describe("function context independence", () => {
|
|
382
|
-
it("should create independent functions for different contexts", () => {
|
|
383
|
-
const context1 = createRoot();
|
|
384
|
-
const context2: Selector = {
|
|
385
|
-
type: "selector",
|
|
386
|
-
query: ".test",
|
|
387
|
-
variables: [],
|
|
388
|
-
declarations: {},
|
|
389
|
-
children: [],
|
|
390
|
-
};
|
|
391
|
-
|
|
392
|
-
const ref1 = createRefFunction(context1, root);
|
|
393
|
-
const ref2 = createRefFunction(context2, root);
|
|
394
|
-
|
|
395
|
-
const result1 = ref1("test-var-1");
|
|
396
|
-
const result2 = ref2("test-var-2");
|
|
397
|
-
|
|
398
|
-
expect(result1.name).toBe("test-var-1");
|
|
399
|
-
expect(result2.name).toBe("test-var-2");
|
|
400
|
-
|
|
401
|
-
expect(ref1).not.toBe(ref2);
|
|
402
|
-
});
|
|
403
|
-
});
|
|
404
|
-
});
|
package/src/tokens/css.ts
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import type { Container, CSS, Root, TokenValue } from "../types";
|
|
2
|
-
|
|
3
|
-
export function createCssFunction(_parent: Container, _root: Root) {
|
|
4
|
-
return function css(
|
|
5
|
-
strings: TemplateStringsArray,
|
|
6
|
-
...interpolations: TokenValue[]
|
|
7
|
-
): CSS {
|
|
8
|
-
const value = strings.reduce<TokenValue[]>((acc, str, i) => {
|
|
9
|
-
acc.push(str);
|
|
10
|
-
|
|
11
|
-
if (i < interpolations.length) {
|
|
12
|
-
acc.push(interpolations[i]);
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
return acc;
|
|
16
|
-
}, []);
|
|
17
|
-
|
|
18
|
-
return {
|
|
19
|
-
type: "css",
|
|
20
|
-
value,
|
|
21
|
-
};
|
|
22
|
-
};
|
|
23
|
-
}
|