* The fields every level shares, so a new level cannot forget one. * * A builder that returned an object literal of its own would be one `terms: []` * away from an undefined array in a renderer, and the renderer would find out * about it in a browser rather than in a type error.
(
ir: SemanticIR,
presentation: ResolvedPresentation,
mode: TwinRenderMode,
)
| 401 | * about it in a browser rather than in a type error. |
| 402 | */ |
| 403 | function emptyModel( |
| 404 | ir: SemanticIR, |
| 405 | presentation: ResolvedPresentation, |
| 406 | mode: TwinRenderMode, |
| 407 | ): TwinViewModel { |
| 408 | return { |
| 409 | mode, |
| 410 | depth: presentation.depth, |
| 411 | terminology: presentation.terminology, |
| 412 | question: LEVEL_QUESTIONS[presentation.depth] ?? '', |
| 413 | subject: subjectLine(ir), |
| 414 | context: contextLines(ir, presentation.facets), |
| 415 | paragraphs: [], |
| 416 | chips: [], |
| 417 | notes: [], |
| 418 | steps: [], |
| 419 | terms: [], |
| 420 | facts: [], |
| 421 | sections: [], |
| 422 | blocks: [], |
| 423 | limits: [], |
| 424 | rewritable: [] |
| 425 | }; |
| 426 | } |
| 427 | |
| 428 | // --------------------------------------------------------------------------- |
| 429 | // section selection, shared by every depth |