MCPcopy
hub / github.com/typestyle/typestyle / convertToStyles

Function convertToStyles

src/internal/formatting.ts:10–35  ·  view source on GitHub ↗
(object: types.NestedCSSProperties)

Source from the content-addressed store, hash-verified

8 * - For any `$debugName` directive return the debug name
9 */
10export function convertToStyles(object: types.NestedCSSProperties): Styles {
11 /** The final result we will return */
12 const styles: Styles = {};
13 for (const key in object) {
14
15 /** Grab the value upfront */
16 const val = (object as any)[key as any];
17
18 /** TypeStyle configuration options */
19 if (key === '$nest') {
20 const nested = val!;
21 for (let selector in nested) {
22 const subproperties = nested[selector]!;
23 styles[selector] = convertToStyles(subproperties);
24 }
25 }
26 else if (key === '$debugName') {
27 styles.$displayName = val;
28 }
29 else {
30 styles[key] = val
31 }
32 }
33
34 return styles;
35}
36
37// todo: better name here
38export function convertToKeyframes(frames: types.KeyFrames): Styles {

Callers 2

TypeStyleClass · 0.90
styleMethod · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…