| 219 | // Emit the declarations (and any conditional sub-rules) for a single element, |
| 220 | // indented by `indent`. Nested `&`-conditions are relative to the enclosing rule. |
| 221 | let emitProperties = (properties: Record<string, any>, indent: string) => { |
| 222 | let css = ''; |
| 223 | for (let property in properties) { |
| 224 | let value = properties[property]; |
| 225 | let prop = property.replace(/([a-z])([A-Z])/g, (_, a, b) => `${a}-${b.toLowerCase()}`); |
| 226 | if (typeof value === 'object') { |
| 227 | if (value.default) { |
| 228 | css += `${indent}${prop}: ${value.default};\n`; |
| 229 | } |
| 230 | for (let condition in value) { |
| 231 | // eslint-disable-next-line max-depth |
| 232 | if (condition === 'default') { |
| 233 | continue; |
| 234 | } |
| 235 | css += `${indent}${condition.startsWith(':') ? '&' : ''}${condition} { ${prop}: ${value[condition]}; }\n`; |
| 236 | } |
| 237 | } else { |
| 238 | css += `${indent}${prop}: ${value};\n`; |
| 239 | } |
| 240 | } |
| 241 | return css; |
| 242 | }; |
| 243 | |
| 244 | let css = '.prose {\n'; |
| 245 | for (let key in rules) { |