(id: string, visited = new Set<string>())
| 192 | } |
| 193 | |
| 194 | function resolveInheritance(id: string, visited = new Set<string>()): StyleRaw | undefined { |
| 195 | if (visited.has(id)) return undefined |
| 196 | visited.add(id) |
| 197 | const s = styleMap.get(id) |
| 198 | if (!s) return undefined |
| 199 | if (!s.basedOn) return s |
| 200 | const parent = resolveInheritance(s.basedOn, visited) |
| 201 | if (!parent) return s |
| 202 | // Own properties override parent; undefined falls through to parent |
| 203 | return { |
| 204 | ...parent, |
| 205 | ...s, |
| 206 | fontSize: s.fontSize ?? parent.fontSize, |
| 207 | bold: s.bold ?? parent.bold, |
| 208 | color: s.color ?? parent.color, |
| 209 | font: s.font ?? parent.font, |
| 210 | themeFont: s.themeFont ?? parent.themeFont, |
| 211 | } |
| 212 | } |
| 213 | |
| 214 | // Target paragraph styles (character styles excluded — generation works at paragraph level) |
| 215 | const targetIds: string[] = ['Normal', 'BodyText', 'Body Text', 'Title', 'Subtitle'] |
no test coverage detected