You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Companion to the DocumentPackage promotion (umbrella in ExaDev/document-schema.js#20). This package becomes the migration path and then re-charters around the artefact.
Phase 1 (now): add decompose(pkg: DocumentPackage): PackageNode[] and flatten(nodes): ContentDocument over the current package shape, with the bijection property tests (decompose(flatten(x)) === x and both ways) run over real corpus documents of all five kinds -- these tests are the gate for the whole promotion. Hashing and equality helpers resolve over effective properties so they are stable across serialisation choices. The existing buildOutline stays; it is the TOC projection and can be expressed over decompose's output.
Phase 2 (at promotion): the builder logic migrates into documents.js's package boundary (one implementation, one authority -- no second copy of the grouping semantics); buildOutline deprecates in favour of the boundary's decompose. The package survives as artefact utilities for consumers holding a package JSON without importing the producer: TOC projection, flatten-to-leaves, leaf text, stable content hash -- the small, tree-shakeable dependency shape the edge-runtime consumers are asking for (ExaDev/documents.js#582's read-only pressure).
The grouping semantics (stack behaviour on headingLevel skips, list nesting resets at plain paragraphs, synthetic group labels) are already implemented and reviewed here; phase 2 ports rather than redesigns them, so the bijection tests travel unchanged.
Companion to the DocumentPackage promotion (umbrella in ExaDev/document-schema.js#20). This package becomes the migration path and then re-charters around the artefact.
Phase 1 (now): add
decompose(pkg: DocumentPackage): PackageNode[]andflatten(nodes): ContentDocumentover the current package shape, with the bijection property tests (decompose(flatten(x)) === x and both ways) run over real corpus documents of all five kinds -- these tests are the gate for the whole promotion. Hashing and equality helpers resolve over effective properties so they are stable across serialisation choices. The existing buildOutline stays; it is the TOC projection and can be expressed over decompose's output.Phase 2 (at promotion): the builder logic migrates into documents.js's package boundary (one implementation, one authority -- no second copy of the grouping semantics); buildOutline deprecates in favour of the boundary's decompose. The package survives as artefact utilities for consumers holding a package JSON without importing the producer: TOC projection, flatten-to-leaves, leaf text, stable content hash -- the small, tree-shakeable dependency shape the edge-runtime consumers are asking for (ExaDev/documents.js#582's read-only pressure).
The grouping semantics (stack behaviour on headingLevel skips, list nesting resets at plain paragraphs, synthetic group labels) are already implemented and reviewed here; phase 2 ports rather than redesigns them, so the bijection tests travel unchanged.