mirror of
https://github.com/webstudio-is/webstudio.git
synced 2026-12-04 22:31:33 +09:00
- added radix templates to components panel - support interpolations in css tagged template - added theme with static values
21 lines
589 B
TypeScript
21 lines
589 B
TypeScript
import { parseCss } from "@webstudio-is/css-data";
|
|
import type { StyleProperty, StyleValue } from "@webstudio-is/css-engine";
|
|
|
|
export type TemplateStyleDecl = {
|
|
state?: string;
|
|
property: StyleProperty;
|
|
value: StyleValue;
|
|
};
|
|
|
|
export const css = (
|
|
strings: TemplateStringsArray,
|
|
...values: string[]
|
|
): TemplateStyleDecl[] => {
|
|
const cssString = `.styles{ ${String.raw({ raw: strings }, ...values)} }`;
|
|
const styles: TemplateStyleDecl[] = [];
|
|
for (const { state, property, value } of parseCss(cssString)) {
|
|
styles.push({ state, property, value });
|
|
}
|
|
return styles;
|
|
};
|