MCPcopy Create free account
hub / github.com/alibaba/lowcode-engine / toCss

Function toCss

packages/utils/src/css-helper.ts:107–139  ·  view source on GitHub ↗
(runtime)

Source from the content-addressed store, hash-verified

105}
106
107function toCss(runtime) {
108 if (!runtime) {
109 return (
110 `:root {
111
112}`);
113 }
114
115 if (runtime.default) {
116 const css: string[] = [];
117 Object.keys(runtime).forEach((pseudo) => {
118 if (pseudo === 'extra') {
119 Array.isArray(runtime.extra) && css.push(runtime.extra.join('\n'));
120 return;
121 }
122 // 只需要对这四种做兼容
123 const prefix = pseudoMap.indexOf(pseudo) > -1 ? ':' : '';
124 css.push(
125 `:root${pseudo === 'default' ? '' : `${prefix}${pseudo}`} {
126${runtimeToCss(normalizeStyle(runtime[pseudo]))}
127}\n`,
128);
129 });
130 return css.join('\n');
131 }
132
133 return (
134 `:root {
135${runtimeToCss(normalizeStyle(runtime))}
136}
137`
138 );
139}
140
141function cssToRuntime(css: string) {
142 if (!css) {

Callers

nothing calls this directly

Calls 5

runtimeToCssFunction · 0.85
normalizeStyleFunction · 0.85
pushMethod · 0.80
forEachMethod · 0.65
indexOfMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…