postext 1.72.0 → 1.73.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/__tests__/exports.test.js +6 -0
- package/dist/__tests__/exports.test.js.map +1 -1
- package/dist/__tests__/fonts/symbolFont.test.d.ts +2 -0
- package/dist/__tests__/fonts/symbolFont.test.d.ts.map +1 -0
- package/dist/__tests__/fonts/symbolFont.test.js +74 -0
- package/dist/__tests__/fonts/symbolFont.test.js.map +1 -0
- package/dist/__tests__/fonts/symbolFontScope.test.d.ts +2 -0
- package/dist/__tests__/fonts/symbolFontScope.test.d.ts.map +1 -0
- package/dist/__tests__/fonts/symbolFontScope.test.js +140 -0
- package/dist/__tests__/fonts/symbolFontScope.test.js.map +1 -0
- package/dist/__tests__/knuthPlass/stacks.test.d.ts +2 -0
- package/dist/__tests__/knuthPlass/stacks.test.d.ts.map +1 -0
- package/dist/__tests__/knuthPlass/stacks.test.js +226 -0
- package/dist/__tests__/knuthPlass/stacks.test.js.map +1 -0
- package/dist/__tests__/knuthPlass/wasmLineBreaker.test.js +36 -1
- package/dist/__tests__/knuthPlass/wasmLineBreaker.test.js.map +1 -1
- package/dist/__tests__/knuthPlass/wasmSources.test.d.ts +2 -0
- package/dist/__tests__/knuthPlass/wasmSources.test.d.ts.map +1 -0
- package/dist/__tests__/knuthPlass/wasmSources.test.js +17 -0
- package/dist/__tests__/knuthPlass/wasmSources.test.js.map +1 -0
- package/dist/__tests__/pipeline/floats/floatPlacement.test.js +3 -3
- package/dist/__tests__/pipeline/floats/floatPlacement.test.js.map +1 -1
- package/dist/__tests__/pipeline/plates/fixture.d.ts +28 -0
- package/dist/__tests__/pipeline/plates/fixture.d.ts.map +1 -0
- package/dist/__tests__/pipeline/plates/fixture.js +57 -0
- package/dist/__tests__/pipeline/plates/fixture.js.map +1 -0
- package/dist/__tests__/pipeline/plates/lengthSlots.test.d.ts +2 -0
- package/dist/__tests__/pipeline/plates/lengthSlots.test.d.ts.map +1 -0
- package/dist/__tests__/pipeline/plates/lengthSlots.test.js +42 -0
- package/dist/__tests__/pipeline/plates/lengthSlots.test.js.map +1 -0
- package/dist/__tests__/pipeline/plates/placementLength.test.d.ts +2 -0
- package/dist/__tests__/pipeline/plates/placementLength.test.d.ts.map +1 -0
- package/dist/__tests__/pipeline/plates/placementLength.test.js +75 -0
- package/dist/__tests__/pipeline/plates/placementLength.test.js.map +1 -0
- package/dist/__tests__/pipeline/plates/plate.test.d.ts +2 -0
- package/dist/__tests__/pipeline/plates/plate.test.d.ts.map +1 -0
- package/dist/__tests__/pipeline/plates/plate.test.js +177 -0
- package/dist/__tests__/pipeline/plates/plate.test.js.map +1 -0
- package/dist/__tests__/pipeline/plates/plateFlow.test.d.ts +2 -0
- package/dist/__tests__/pipeline/plates/plateFlow.test.d.ts.map +1 -0
- package/dist/__tests__/pipeline/plates/plateFlow.test.js +118 -0
- package/dist/__tests__/pipeline/plates/plateFlow.test.js.map +1 -0
- package/dist/__tests__/pipeline/plates/plateRole.test.d.ts +2 -0
- package/dist/__tests__/pipeline/plates/plateRole.test.d.ts.map +1 -0
- package/dist/__tests__/pipeline/plates/plateRole.test.js +70 -0
- package/dist/__tests__/pipeline/plates/plateRole.test.js.map +1 -0
- package/dist/__tests__/pipeline/resources/rotatedResource.test.js +1 -1
- package/dist/__tests__/pipeline/resources/rotatedResource.test.js.map +1 -1
- package/dist/__tests__/pipeline/text/chips.test.js +3 -3
- package/dist/__tests__/pipeline/text/chips.test.js.map +1 -1
- package/dist/checks/configWarnings/choices.d.ts.map +1 -1
- package/dist/checks/configWarnings/choices.js +1 -0
- package/dist/checks/configWarnings/choices.js.map +1 -1
- package/dist/checks/stacks.d.ts +39 -0
- package/dist/checks/stacks.d.ts.map +1 -0
- package/dist/checks/stacks.js +122 -0
- package/dist/checks/stacks.js.map +1 -0
- package/dist/defaults/text/bodyText/defaults.d.ts.map +1 -1
- package/dist/defaults/text/bodyText/defaults.js +3 -0
- package/dist/defaults/text/bodyText/defaults.js.map +1 -1
- package/dist/defaults/text/bodyText/resolve.d.ts.map +1 -1
- package/dist/defaults/text/bodyText/resolve.js +3 -0
- package/dist/defaults/text/bodyText/resolve.js.map +1 -1
- package/dist/defaults/text/bodyText/strip.d.ts.map +1 -1
- package/dist/defaults/text/bodyText/strip.js +12 -0
- package/dist/defaults/text/bodyText/strip.js.map +1 -1
- package/dist/design/elementKeys.d.ts +1 -0
- package/dist/design/elementKeys.d.ts.map +1 -1
- package/dist/design/elementKeys.js +1 -1
- package/dist/design/elementKeys.js.map +1 -1
- package/dist/design/layout/primitives.d.ts +3 -1
- package/dist/design/layout/primitives.d.ts.map +1 -1
- package/dist/design/layout/primitives.js +5 -1
- package/dist/design/layout/primitives.js.map +1 -1
- package/dist/fonts/faces.d.ts.map +1 -1
- package/dist/fonts/faces.js +9 -0
- package/dist/fonts/faces.js.map +1 -1
- package/dist/fonts/glyphFallback.d.ts +21 -2
- package/dist/fonts/glyphFallback.d.ts.map +1 -1
- package/dist/fonts/glyphFallback.js +13 -3
- package/dist/fonts/glyphFallback.js.map +1 -1
- package/dist/fonts/glyphPlaces.d.ts +32 -0
- package/dist/fonts/glyphPlaces.d.ts.map +1 -0
- package/dist/fonts/glyphPlaces.js +104 -0
- package/dist/fonts/glyphPlaces.js.map +1 -0
- package/dist/fonts/usage.d.ts.map +1 -1
- package/dist/fonts/usage.js +7 -0
- package/dist/fonts/usage.js.map +1 -1
- package/dist/html-backend/styles.d.ts +16 -0
- package/dist/html-backend/styles.d.ts.map +1 -1
- package/dist/html-backend/styles.js +40 -20
- package/dist/html-backend/styles.js.map +1 -1
- package/dist/index.d.ts +7 -7
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -2
- package/dist/index.js.map +1 -1
- package/dist/knuthPlass/breakpoints/edges.d.ts +68 -0
- package/dist/knuthPlass/breakpoints/edges.d.ts.map +1 -0
- package/dist/knuthPlass/breakpoints/edges.js +269 -0
- package/dist/knuthPlass/breakpoints/edges.js.map +1 -0
- package/dist/knuthPlass/breakpoints/search.d.ts +21 -6
- package/dist/knuthPlass/breakpoints/search.d.ts.map +1 -1
- package/dist/knuthPlass/breakpoints/search.js +85 -8
- package/dist/knuthPlass/breakpoints/search.js.map +1 -1
- package/dist/knuthPlass/breakpoints.d.ts +2 -0
- package/dist/knuthPlass/breakpoints.d.ts.map +1 -1
- package/dist/knuthPlass/breakpoints.js +13 -7
- package/dist/knuthPlass/breakpoints.js.map +1 -1
- package/dist/knuthPlass/constants.d.ts +8 -0
- package/dist/knuthPlass/constants.d.ts.map +1 -1
- package/dist/knuthPlass/constants.js +8 -0
- package/dist/knuthPlass/constants.js.map +1 -1
- package/dist/knuthPlass/pretextAdapter.d.ts +4 -1
- package/dist/knuthPlass/pretextAdapter.d.ts.map +1 -1
- package/dist/knuthPlass/pretextAdapter.js +16 -4
- package/dist/knuthPlass/pretextAdapter.js.map +1 -1
- package/dist/knuthPlass/richAdapter.d.ts +6 -1
- package/dist/knuthPlass/richAdapter.d.ts.map +1 -1
- package/dist/knuthPlass/richAdapter.js +18 -2
- package/dist/knuthPlass/richAdapter.js.map +1 -1
- package/dist/knuthPlass/types.d.ts +22 -0
- package/dist/knuthPlass/types.d.ts.map +1 -1
- package/dist/knuthPlass/wasm/abi.d.ts.map +1 -1
- package/dist/knuthPlass/wasm/abi.js +55 -0
- package/dist/knuthPlass/wasm/abi.js.map +1 -1
- package/dist/knuthPlass/wasm/bytes.generated.d.ts +4 -0
- package/dist/knuthPlass/wasm/bytes.generated.d.ts.map +1 -1
- package/dist/knuthPlass/wasm/bytes.generated.js +523 -404
- package/dist/knuthPlass/wasm/bytes.generated.js.map +1 -1
- package/dist/measure/cache.js +1 -1
- package/dist/measure/cache.js.map +1 -1
- package/dist/measure/canvas/state.d.ts.map +1 -1
- package/dist/measure/canvas/state.js +7 -3
- package/dist/measure/canvas/state.js.map +1 -1
- package/dist/measure/font.d.ts +17 -0
- package/dist/measure/font.d.ts.map +1 -1
- package/dist/measure/font.js +36 -1
- package/dist/measure/font.js.map +1 -1
- package/dist/measure/index.d.ts +1 -1
- package/dist/measure/index.d.ts.map +1 -1
- package/dist/measure/index.js +1 -1
- package/dist/measure/index.js.map +1 -1
- package/dist/measure/plain.d.ts.map +1 -1
- package/dist/measure/plain.js +2 -1
- package/dist/measure/plain.js.map +1 -1
- package/dist/measure/rich/measure.js +2 -1
- package/dist/measure/rich/measure.js.map +1 -1
- package/dist/measure/rich/tokens.d.ts +3 -0
- package/dist/measure/rich/tokens.d.ts.map +1 -1
- package/dist/measure/rich/tokens.js.map +1 -1
- package/dist/measure/rich/wordBreaks.js +1 -1
- package/dist/measure/rich/wordBreaks.js.map +1 -1
- package/dist/measure/types.d.ts +6 -0
- package/dist/measure/types.d.ts.map +1 -1
- package/dist/measure/types.js.map +1 -1
- package/dist/pipeline/blocks/measureContentBlock/measureOptions.d.ts +4 -0
- package/dist/pipeline/blocks/measureContentBlock/measureOptions.d.ts.map +1 -1
- package/dist/pipeline/blocks/measureContentBlock/measureOptions.js +4 -0
- package/dist/pipeline/blocks/measureContentBlock/measureOptions.js.map +1 -1
- package/dist/pipeline/blocks/measureContentBlock.d.ts +1 -0
- package/dist/pipeline/blocks/measureContentBlock.d.ts.map +1 -1
- package/dist/pipeline/blocks/measureContentBlock.js +20 -2
- package/dist/pipeline/blocks/measureContentBlock.js.map +1 -1
- package/dist/pipeline/build/drivers.d.ts.map +1 -1
- package/dist/pipeline/build/drivers.js +10 -3
- package/dist/pipeline/build/drivers.js.map +1 -1
- package/dist/pipeline/build/pass/blocks/resourceBlock.d.ts.map +1 -1
- package/dist/pipeline/build/pass/blocks/resourceBlock.js +8 -4
- package/dist/pipeline/build/pass/blocks/resourceBlock.js.map +1 -1
- package/dist/pipeline/build/pass/callouts/calloutCommit.d.ts +1 -1
- package/dist/pipeline/build/pass/callouts/calloutCommit.d.ts.map +1 -1
- package/dist/pipeline/build/pass/callouts/calloutCommit.js +11 -4
- package/dist/pipeline/build/pass/callouts/calloutCommit.js.map +1 -1
- package/dist/pipeline/build/pass/floats/floatBands.d.ts +5 -2
- package/dist/pipeline/build/pass/floats/floatBands.d.ts.map +1 -1
- package/dist/pipeline/build/pass/floats/floatBands.js +20 -12
- package/dist/pipeline/build/pass/floats/floatBands.js.map +1 -1
- package/dist/pipeline/build/pass/floats/floatFlush.d.ts +1 -0
- package/dist/pipeline/build/pass/floats/floatFlush.d.ts.map +1 -1
- package/dist/pipeline/build/pass/floats/floatFlush.js +8 -4
- package/dist/pipeline/build/pass/floats/floatFlush.js.map +1 -1
- package/dist/pipeline/build/pass/floats/floatMeasure.d.ts +5 -4
- package/dist/pipeline/build/pass/floats/floatMeasure.d.ts.map +1 -1
- package/dist/pipeline/build/pass/floats/floatMeasure.js +31 -9
- package/dist/pipeline/build/pass/floats/floatMeasure.js.map +1 -1
- package/dist/pipeline/build/pass/floats/floatPlace.d.ts +6 -2
- package/dist/pipeline/build/pass/floats/floatPlace.d.ts.map +1 -1
- package/dist/pipeline/build/pass/floats/floatPlace.js +47 -8
- package/dist/pipeline/build/pass/floats/floatPlace.js.map +1 -1
- package/dist/pipeline/build/pass/state.d.ts +3 -0
- package/dist/pipeline/build/pass/state.d.ts.map +1 -1
- package/dist/pipeline/build/pass/types.d.ts +9 -0
- package/dist/pipeline/build/pass/types.d.ts.map +1 -1
- package/dist/pipeline/build/pass.d.ts.map +1 -1
- package/dist/pipeline/build/pass.js +11 -4
- package/dist/pipeline/build/pass.js.map +1 -1
- package/dist/pipeline/composedPages/composedLayout/trialPasses.d.ts.map +1 -1
- package/dist/pipeline/composedPages/composedLayout/trialPasses.js +4 -1
- package/dist/pipeline/composedPages/composedLayout/trialPasses.js.map +1 -1
- package/dist/pipeline/config.d.ts.map +1 -1
- package/dist/pipeline/config.js +3 -0
- package/dist/pipeline/config.js.map +1 -1
- package/dist/pipeline/contentWarnings/formatWarning.d.ts.map +1 -1
- package/dist/pipeline/contentWarnings/formatWarning.js +10 -0
- package/dist/pipeline/contentWarnings/formatWarning.js.map +1 -1
- package/dist/pipeline/contentWarnings/layoutWarnings.d.ts +5 -0
- package/dist/pipeline/contentWarnings/layoutWarnings.d.ts.map +1 -1
- package/dist/pipeline/contentWarnings/layoutWarnings.js +24 -1
- package/dist/pipeline/contentWarnings/layoutWarnings.js.map +1 -1
- package/dist/pipeline/contentWarnings.d.ts +1 -1
- package/dist/pipeline/contentWarnings.d.ts.map +1 -1
- package/dist/pipeline/contentWarnings.js +1 -1
- package/dist/pipeline/contentWarnings.js.map +1 -1
- package/dist/pipeline/floats/floatPlacement.d.ts +22 -1
- package/dist/pipeline/floats/floatPlacement.d.ts.map +1 -1
- package/dist/pipeline/floats/floatPlacement.js +37 -8
- package/dist/pipeline/floats/floatPlacement.js.map +1 -1
- package/dist/pipeline/floats/placementLength.d.ts +43 -0
- package/dist/pipeline/floats/placementLength.d.ts.map +1 -0
- package/dist/pipeline/floats/placementLength.js +63 -0
- package/dist/pipeline/floats/placementLength.js.map +1 -0
- package/dist/pipeline/floats/textWrap.d.ts +3 -0
- package/dist/pipeline/floats/textWrap.d.ts.map +1 -1
- package/dist/pipeline/floats/textWrap.js +5 -2
- package/dist/pipeline/floats/textWrap.js.map +1 -1
- package/dist/pipeline/pages/headerFooter/edgePlates.d.ts +17 -0
- package/dist/pipeline/pages/headerFooter/edgePlates.d.ts.map +1 -0
- package/dist/pipeline/pages/headerFooter/edgePlates.js +63 -0
- package/dist/pipeline/pages/headerFooter/edgePlates.js.map +1 -0
- package/dist/pipeline/pages/headerFooter/layoutHeadersAndFooters.d.ts.map +1 -1
- package/dist/pipeline/pages/headerFooter/layoutHeadersAndFooters.js +9 -0
- package/dist/pipeline/pages/headerFooter/layoutHeadersAndFooters.js.map +1 -1
- package/dist/pipeline/pages/pageRoles.d.ts +5 -0
- package/dist/pipeline/pages/pageRoles.d.ts.map +1 -1
- package/dist/pipeline/pages/pageRoles.js +14 -0
- package/dist/pipeline/pages/pageRoles.js.map +1 -1
- package/dist/pipeline/resources/captionInside.d.ts +5 -2
- package/dist/pipeline/resources/captionInside.d.ts.map +1 -1
- package/dist/pipeline/resources/captionInside.js +15 -4
- package/dist/pipeline/resources/captionInside.js.map +1 -1
- package/dist/pipeline/resources/resourceLayout/captions.d.ts.map +1 -1
- package/dist/pipeline/resources/resourceLayout/captions.js +2 -2
- package/dist/pipeline/resources/resourceLayout/captions.js.map +1 -1
- package/dist/pipeline/resources/resourceLayout/input.d.ts +6 -0
- package/dist/pipeline/resources/resourceLayout/input.d.ts.map +1 -1
- package/dist/pipeline/resources/resourceLayout/resourceBlock/captionNotes.js +2 -2
- package/dist/pipeline/resources/resourceLayout/resourceBlock/captionNotes.js.map +1 -1
- package/dist/pipeline/resources/resourceLayout/resourceBlock.d.ts.map +1 -1
- package/dist/pipeline/resources/resourceLayout/resourceBlock.js +21 -4
- package/dist/pipeline/resources/resourceLayout/resourceBlock.js.map +1 -1
- package/dist/pipeline/resources/resourceLayout/snippets.d.ts +12 -2
- package/dist/pipeline/resources/resourceLayout/snippets.d.ts.map +1 -1
- package/dist/pipeline/resources/resourceLayout/snippets.js +19 -0
- package/dist/pipeline/resources/resourceLayout/snippets.js.map +1 -1
- package/dist/pipeline/resources/resourceLayout/tableLayout.d.ts +3 -0
- package/dist/pipeline/resources/resourceLayout/tableLayout.d.ts.map +1 -1
- package/dist/pipeline/resources/resourceLayout/tableLayout.js +3 -3
- package/dist/pipeline/resources/resourceLayout/tableLayout.js.map +1 -1
- package/dist/pipeline/resources/safeArea.d.ts +4 -0
- package/dist/pipeline/resources/safeArea.d.ts.map +1 -1
- package/dist/pipeline/resources/safeArea.js +15 -0
- package/dist/pipeline/resources/safeArea.js.map +1 -1
- package/dist/pipeline/text/annotations.d.ts.map +1 -1
- package/dist/pipeline/text/annotations.js +8 -2
- package/dist/pipeline/text/annotations.js.map +1 -1
- package/dist/pipeline/text/chips.d.ts.map +1 -1
- package/dist/pipeline/text/chips.js +3 -1
- package/dist/pipeline/text/chips.js.map +1 -1
- package/dist/pipeline/text/stacks.d.ts +7 -0
- package/dist/pipeline/text/stacks.d.ts.map +1 -0
- package/dist/pipeline/text/stacks.js +5 -0
- package/dist/pipeline/text/stacks.js.map +1 -0
- package/dist/types/config.d.ts +9 -0
- package/dist/types/config.d.ts.map +1 -1
- package/dist/types/designPlacement.d.ts +6 -2
- package/dist/types/designPlacement.d.ts.map +1 -1
- package/dist/types/resources/resourceTypes.d.ts +36 -1
- package/dist/types/resources/resourceTypes.d.ts.map +1 -1
- package/dist/types/text/bodyText/config.d.ts +26 -0
- package/dist/types/text/bodyText/config.d.ts.map +1 -1
- package/dist/types/text/bodyText/resolved.d.ts +3 -0
- package/dist/types/text/bodyText/resolved.d.ts.map +1 -1
- package/dist/vdt/contentWarnings/layout.d.ts +19 -0
- package/dist/vdt/contentWarnings/layout.d.ts.map +1 -1
- package/dist/vdt/contentWarnings/text.d.ts +16 -0
- package/dist/vdt/contentWarnings/text.d.ts.map +1 -1
- package/dist/vdt/document.d.ts +3 -0
- package/dist/vdt/document.d.ts.map +1 -1
- package/dist/vdt/document.js.map +1 -1
- package/dist/vdt/pages.d.ts +5 -0
- package/dist/vdt/pages.d.ts.map +1 -1
- package/dist/vdt/resources.d.ts +8 -0
- package/dist/vdt/resources.d.ts.map +1 -1
- package/dist/word/anchors/bookmarks.d.ts +5 -0
- package/dist/word/anchors/bookmarks.d.ts.map +1 -1
- package/dist/word/anchors/bookmarks.js +11 -0
- package/dist/word/anchors/bookmarks.js.map +1 -1
- package/dist/word/anchors/index.d.ts +1 -0
- package/dist/word/anchors/index.d.ts.map +1 -1
- package/dist/word/anchors/index.js +1 -0
- package/dist/word/anchors/index.js.map +1 -1
- package/dist/word/anchors/trace.d.ts +45 -0
- package/dist/word/anchors/trace.d.ts.map +1 -0
- package/dist/word/anchors/trace.js +138 -0
- package/dist/word/anchors/trace.js.map +1 -0
- package/dist/word/anchors/trace.test.d.ts +2 -0
- package/dist/word/anchors/trace.test.d.ts.map +1 -0
- package/dist/word/anchors/trace.test.js +75 -0
- package/dist/word/anchors/trace.test.js.map +1 -0
- package/dist/word/anchors/types.d.ts +3 -0
- package/dist/word/anchors/types.d.ts.map +1 -1
- package/dist/word/formatted/index.d.ts +15 -3
- package/dist/word/formatted/index.d.ts.map +1 -1
- package/dist/word/formatted/index.js +21 -11
- package/dist/word/formatted/index.js.map +1 -1
- package/dist/word/formatted/runs.d.ts.map +1 -1
- package/dist/word/formatted/runs.js +7 -3
- package/dist/word/formatted/runs.js.map +1 -1
- package/dist/word/formatted/symbolFont.test.d.ts +2 -0
- package/dist/word/formatted/symbolFont.test.d.ts.map +1 -0
- package/dist/word/formatted/symbolFont.test.js +82 -0
- package/dist/word/formatted/symbolFont.test.js.map +1 -0
- package/dist/word/formatted/symbols.d.ts +26 -4
- package/dist/word/formatted/symbols.d.ts.map +1 -1
- package/dist/word/formatted/symbols.js +77 -14
- package/dist/word/formatted/symbols.js.map +1 -1
- package/dist/word/index.d.ts +21 -14
- package/dist/word/index.d.ts.map +1 -1
- package/dist/word/index.js +17 -11
- package/dist/word/index.js.map +1 -1
- package/dist/word/integration/plain.test.d.ts +2 -0
- package/dist/word/integration/plain.test.d.ts.map +1 -0
- package/dist/word/integration/plain.test.js +102 -0
- package/dist/word/integration/plain.test.js.map +1 -0
- package/dist/word/omml.d.ts.map +1 -1
- package/dist/word/omml.js +8 -1
- package/dist/word/omml.js.map +1 -1
- package/dist/word/ooxml/package.d.ts.map +1 -1
- package/dist/word/ooxml/package.js +6 -0
- package/dist/word/ooxml/package.js.map +1 -1
- package/dist/word/ooxml/package.test.js +18 -0
- package/dist/word/ooxml/package.test.js.map +1 -1
- package/dist/word/roundtrip/added.d.ts +4 -1
- package/dist/word/roundtrip/added.d.ts.map +1 -1
- package/dist/word/roundtrip/added.js +13 -3
- package/dist/word/roundtrip/added.js.map +1 -1
- package/dist/word/roundtrip/align.d.ts +37 -0
- package/dist/word/roundtrip/align.d.ts.map +1 -0
- package/dist/word/roundtrip/align.js +206 -0
- package/dist/word/roundtrip/align.js.map +1 -0
- package/dist/word/roundtrip/align.test.d.ts +2 -0
- package/dist/word/roundtrip/align.test.d.ts.map +1 -0
- package/dist/word/roundtrip/align.test.js +66 -0
- package/dist/word/roundtrip/align.test.js.map +1 -0
- package/dist/word/roundtrip/apply.d.ts +8 -1
- package/dist/word/roundtrip/apply.d.ts.map +1 -1
- package/dist/word/roundtrip/apply.js +246 -10
- package/dist/word/roundtrip/apply.js.map +1 -1
- package/dist/word/roundtrip/blocks.d.ts +18 -2
- package/dist/word/roundtrip/blocks.d.ts.map +1 -1
- package/dist/word/roundtrip/blocks.js +18 -4
- package/dist/word/roundtrip/blocks.js.map +1 -1
- package/dist/word/roundtrip/diff.d.ts +3 -0
- package/dist/word/roundtrip/diff.d.ts.map +1 -1
- package/dist/word/roundtrip/diff.js +5 -0
- package/dist/word/roundtrip/diff.js.map +1 -1
- package/dist/word/roundtrip/editors.test.d.ts +2 -0
- package/dist/word/roundtrip/editors.test.d.ts.map +1 -0
- package/dist/word/roundtrip/editors.test.js +291 -0
- package/dist/word/roundtrip/editors.test.js.map +1 -0
- package/dist/word/roundtrip/edits.d.ts +2 -0
- package/dist/word/roundtrip/edits.d.ts.map +1 -1
- package/dist/word/roundtrip/edits.js +97 -2
- package/dist/word/roundtrip/edits.js.map +1 -1
- package/dist/word/roundtrip/formats.d.ts.map +1 -1
- package/dist/word/roundtrip/formats.js +20 -3
- package/dist/word/roundtrip/formats.js.map +1 -1
- package/dist/word/roundtrip/googleDocs.test-helper.d.ts +13 -0
- package/dist/word/roundtrip/googleDocs.test-helper.d.ts.map +1 -0
- package/dist/word/roundtrip/googleDocs.test-helper.js +136 -0
- package/dist/word/roundtrip/googleDocs.test-helper.js.map +1 -0
- package/dist/word/roundtrip/googleDocs.test.d.ts +2 -0
- package/dist/word/roundtrip/googleDocs.test.d.ts.map +1 -0
- package/dist/word/roundtrip/googleDocs.test.js +400 -0
- package/dist/word/roundtrip/googleDocs.test.js.map +1 -0
- package/dist/word/roundtrip/index.d.ts +3 -2
- package/dist/word/roundtrip/index.d.ts.map +1 -1
- package/dist/word/roundtrip/index.js +2 -1
- package/dist/word/roundtrip/index.js.map +1 -1
- package/dist/word/roundtrip/looks.d.ts +20 -0
- package/dist/word/roundtrip/looks.d.ts.map +1 -0
- package/dist/word/roundtrip/looks.js +109 -0
- package/dist/word/roundtrip/looks.js.map +1 -0
- package/dist/word/roundtrip/looks.test.d.ts +2 -0
- package/dist/word/roundtrip/looks.test.d.ts.map +1 -0
- package/dist/word/roundtrip/looks.test.js +99 -0
- package/dist/word/roundtrip/looks.test.js.map +1 -0
- package/dist/word/roundtrip/looseTex.d.ts +11 -0
- package/dist/word/roundtrip/looseTex.d.ts.map +1 -0
- package/dist/word/roundtrip/looseTex.js +197 -0
- package/dist/word/roundtrip/looseTex.js.map +1 -0
- package/dist/word/roundtrip/looseTex.test.d.ts +2 -0
- package/dist/word/roundtrip/looseTex.test.d.ts.map +1 -0
- package/dist/word/roundtrip/looseTex.test.js +43 -0
- package/dist/word/roundtrip/looseTex.test.js.map +1 -0
- package/dist/word/roundtrip/lost.d.ts +63 -0
- package/dist/word/roundtrip/lost.d.ts.map +1 -0
- package/dist/word/roundtrip/lost.js +425 -0
- package/dist/word/roundtrip/lost.js.map +1 -0
- package/dist/word/roundtrip/lost.test.d.ts +2 -0
- package/dist/word/roundtrip/lost.test.d.ts.map +1 -0
- package/dist/word/roundtrip/lost.test.js +323 -0
- package/dist/word/roundtrip/lost.test.js.map +1 -0
- package/dist/word/roundtrip/markup.d.ts +5 -3
- package/dist/word/roundtrip/markup.d.ts.map +1 -1
- package/dist/word/roundtrip/markup.js +19 -6
- package/dist/word/roundtrip/markup.js.map +1 -1
- package/dist/word/roundtrip/math.d.ts.map +1 -1
- package/dist/word/roundtrip/math.js +41 -1
- package/dist/word/roundtrip/math.js.map +1 -1
- package/dist/word/roundtrip/merge.d.ts.map +1 -1
- package/dist/word/roundtrip/merge.js +81 -13
- package/dist/word/roundtrip/merge.js.map +1 -1
- package/dist/word/roundtrip/read.d.ts +69 -6
- package/dist/word/roundtrip/read.d.ts.map +1 -1
- package/dist/word/roundtrip/read.js +159 -17
- package/dist/word/roundtrip/read.js.map +1 -1
- package/dist/word/roundtrip/rebuild.d.ts +41 -0
- package/dist/word/roundtrip/rebuild.d.ts.map +1 -0
- package/dist/word/roundtrip/rebuild.js +324 -0
- package/dist/word/roundtrip/rebuild.js.map +1 -0
- package/dist/word/roundtrip/selfRead.d.ts +21 -0
- package/dist/word/roundtrip/selfRead.d.ts.map +1 -0
- package/dist/word/roundtrip/selfRead.js +55 -0
- package/dist/word/roundtrip/selfRead.js.map +1 -0
- package/dist/word/roundtrip/settle.d.ts +13 -0
- package/dist/word/roundtrip/settle.d.ts.map +1 -0
- package/dist/word/roundtrip/settle.js +93 -0
- package/dist/word/roundtrip/settle.js.map +1 -0
- package/dist/word/roundtrip/types.d.ts +37 -0
- package/dist/word/roundtrip/types.d.ts.map +1 -1
- package/dist/word/roundtrip/walk.d.ts +10 -1
- package/dist/word/roundtrip/walk.d.ts.map +1 -1
- package/dist/word/roundtrip/walk.js +135 -13
- package/dist/word/roundtrip/walk.js.map +1 -1
- package/dist/word/semantic/blocks.d.ts.map +1 -1
- package/dist/word/semantic/blocks.js +20 -4
- package/dist/word/semantic/blocks.js.map +1 -1
- package/dist/word/semantic/chapter.d.ts.map +1 -1
- package/dist/word/semantic/chapter.js +5 -0
- package/dist/word/semantic/chapter.js.map +1 -1
- package/dist/word/semantic/containers.d.ts.map +1 -1
- package/dist/word/semantic/containers.js +7 -1
- package/dist/word/semantic/containers.js.map +1 -1
- package/dist/word/semantic/context.d.ts +22 -0
- package/dist/word/semantic/context.d.ts.map +1 -1
- package/dist/word/semantic/context.js.map +1 -1
- package/dist/word/semantic/design/bands.d.ts +4 -0
- package/dist/word/semantic/design/bands.d.ts.map +1 -1
- package/dist/word/semantic/design/bands.js +25 -7
- package/dist/word/semantic/design/bands.js.map +1 -1
- package/dist/word/semantic/design/foot.d.ts +36 -0
- package/dist/word/semantic/design/foot.d.ts.map +1 -0
- package/dist/word/semantic/design/foot.js +56 -0
- package/dist/word/semantic/design/foot.js.map +1 -0
- package/dist/word/semantic/design/ground.d.ts +19 -0
- package/dist/word/semantic/design/ground.d.ts.map +1 -0
- package/dist/word/semantic/design/ground.js +100 -0
- package/dist/word/semantic/design/ground.js.map +1 -0
- package/dist/word/semantic/design/ground.test.d.ts +2 -0
- package/dist/word/semantic/design/ground.test.d.ts.map +1 -0
- package/dist/word/semantic/design/ground.test.js +123 -0
- package/dist/word/semantic/design/ground.test.js.map +1 -0
- package/dist/word/semantic/design/heading.d.ts.map +1 -1
- package/dist/word/semantic/design/heading.js +20 -2
- package/dist/word/semantic/design/heading.js.map +1 -1
- package/dist/word/semantic/design/part.d.ts.map +1 -1
- package/dist/word/semantic/design/part.js +13 -1
- package/dist/word/semantic/design/part.js.map +1 -1
- package/dist/word/semantic/design/partColor.d.ts +7 -0
- package/dist/word/semantic/design/partColor.d.ts.map +1 -1
- package/dist/word/semantic/design/partColor.js +13 -0
- package/dist/word/semantic/design/partColor.js.map +1 -1
- package/dist/word/semantic/design/pictures.d.ts +8 -3
- package/dist/word/semantic/design/pictures.d.ts.map +1 -1
- package/dist/word/semantic/design/pictures.js +12 -5
- package/dist/word/semantic/design/pictures.js.map +1 -1
- package/dist/word/semantic/design/side.d.ts +30 -0
- package/dist/word/semantic/design/side.d.ts.map +1 -0
- package/dist/word/semantic/design/side.js +52 -0
- package/dist/word/semantic/design/side.js.map +1 -0
- package/dist/word/semantic/design/side.test.d.ts +2 -0
- package/dist/word/semantic/design/side.test.d.ts.map +1 -0
- package/dist/word/semantic/design/side.test.js +66 -0
- package/dist/word/semantic/design/side.test.js.map +1 -0
- package/dist/word/semantic/design/text.d.ts.map +1 -1
- package/dist/word/semantic/design/text.js +23 -1
- package/dist/word/semantic/design/text.js.map +1 -1
- package/dist/word/semantic/design/values.d.ts +2 -2
- package/dist/word/semantic/design/values.d.ts.map +1 -1
- package/dist/word/semantic/design/values.js +7 -4
- package/dist/word/semantic/design/values.js.map +1 -1
- package/dist/word/semantic/design/write.d.ts +35 -1
- package/dist/word/semantic/design/write.d.ts.map +1 -1
- package/dist/word/semantic/design/write.js +137 -29
- package/dist/word/semantic/design/write.js.map +1 -1
- package/dist/word/semantic/directives.d.ts.map +1 -1
- package/dist/word/semantic/directives.js +13 -0
- package/dist/word/semantic/directives.js.map +1 -1
- package/dist/word/semantic/exercises/exerciseBody.d.ts.map +1 -1
- package/dist/word/semantic/exercises/exerciseBody.js +21 -19
- package/dist/word/semantic/exercises/exerciseBody.js.map +1 -1
- package/dist/word/semantic/exercises/exerciseStyles.d.ts +8 -0
- package/dist/word/semantic/exercises/exerciseStyles.d.ts.map +1 -0
- package/dist/word/semantic/exercises/exerciseStyles.js +24 -0
- package/dist/word/semantic/exercises/exerciseStyles.js.map +1 -0
- package/dist/word/semantic/exercises/exercises.d.ts.map +1 -1
- package/dist/word/semantic/exercises/exercises.js +9 -4
- package/dist/word/semantic/exercises/exercises.js.map +1 -1
- package/dist/word/semantic/fields.d.ts.map +1 -1
- package/dist/word/semantic/fields.js +3 -2
- package/dist/word/semantic/fields.js.map +1 -1
- package/dist/word/semantic/index.d.ts +30 -0
- package/dist/word/semantic/index.d.ts.map +1 -1
- package/dist/word/semantic/index.js +68 -12
- package/dist/word/semantic/index.js.map +1 -1
- package/dist/word/semantic/inline.d.ts +3 -0
- package/dist/word/semantic/inline.d.ts.map +1 -1
- package/dist/word/semantic/inline.js +22 -7
- package/dist/word/semantic/inline.js.map +1 -1
- package/dist/word/semantic/layout/pageSpan.d.ts +24 -0
- package/dist/word/semantic/layout/pageSpan.d.ts.map +1 -1
- package/dist/word/semantic/layout/pageSpan.js +106 -15
- package/dist/word/semantic/layout/pageSpan.js.map +1 -1
- package/dist/word/semantic/layout/review1458.test.d.ts +2 -0
- package/dist/word/semantic/layout/review1458.test.d.ts.map +1 -0
- package/dist/word/semantic/layout/review1458.test.js +152 -0
- package/dist/word/semantic/layout/review1458.test.js.map +1 -0
- package/dist/word/semantic/layout/sides.test.d.ts +2 -0
- package/dist/word/semantic/layout/sides.test.d.ts.map +1 -0
- package/dist/word/semantic/layout/sides.test.js +44 -0
- package/dist/word/semantic/layout/sides.test.js.map +1 -0
- package/dist/word/semantic/media/captions.d.ts.map +1 -1
- package/dist/word/semantic/media/captions.js +6 -1
- package/dist/word/semantic/media/captions.js.map +1 -1
- package/dist/word/semantic/media/comics.d.ts.map +1 -1
- package/dist/word/semantic/media/comics.js +3 -0
- package/dist/word/semantic/media/comics.js.map +1 -1
- package/dist/word/semantic/media/figures.d.ts +5 -1
- package/dist/word/semantic/media/figures.d.ts.map +1 -1
- package/dist/word/semantic/media/figures.js +61 -15
- package/dist/word/semantic/media/figures.js.map +1 -1
- package/dist/word/semantic/media/frames.d.ts.map +1 -1
- package/dist/word/semantic/media/frames.js +7 -1
- package/dist/word/semantic/media/frames.js.map +1 -1
- package/dist/word/semantic/media/pageOpener.d.ts +8 -1
- package/dist/word/semantic/media/pageOpener.d.ts.map +1 -1
- package/dist/word/semantic/media/pageOpener.js +29 -5
- package/dist/word/semantic/media/pageOpener.js.map +1 -1
- package/dist/word/semantic/media/pages.d.ts +1 -1
- package/dist/word/semantic/media/pages.d.ts.map +1 -1
- package/dist/word/semantic/media/pages.js +31 -16
- package/dist/word/semantic/media/pages.js.map +1 -1
- package/dist/word/semantic/media/pages.test.js +2 -2
- package/dist/word/semantic/media/pages.test.js.map +1 -1
- package/dist/word/semantic/media/plates.test.d.ts +2 -0
- package/dist/word/semantic/media/plates.test.d.ts.map +1 -0
- package/dist/word/semantic/media/plates.test.js +54 -0
- package/dist/word/semantic/media/plates.test.js.map +1 -0
- package/dist/word/semantic/media/strip.d.ts.map +1 -1
- package/dist/word/semantic/media/strip.js +5 -4
- package/dist/word/semantic/media/strip.js.map +1 -1
- package/dist/word/semantic/page/composed.d.ts.map +1 -1
- package/dist/word/semantic/page/composed.js +2 -1
- package/dist/word/semantic/page/composed.js.map +1 -1
- package/dist/word/semantic/page/furniture.d.ts +8 -0
- package/dist/word/semantic/page/furniture.d.ts.map +1 -1
- package/dist/word/semantic/page/furniture.js +49 -16
- package/dist/word/semantic/page/furniture.js.map +1 -1
- package/dist/word/semantic/page/margin.d.ts +4 -3
- package/dist/word/semantic/page/margin.d.ts.map +1 -1
- package/dist/word/semantic/page/margin.js +17 -13
- package/dist/word/semantic/page/margin.js.map +1 -1
- package/dist/word/semantic/page/round4.test.js +21 -5
- package/dist/word/semantic/page/round4.test.js.map +1 -1
- package/dist/word/semantic/plain/config.d.ts +13 -0
- package/dist/word/semantic/plain/config.d.ts.map +1 -0
- package/dist/word/semantic/plain/config.js +316 -0
- package/dist/word/semantic/plain/config.js.map +1 -0
- package/dist/word/semantic/plain/corpus.part1.test.d.ts +2 -0
- package/dist/word/semantic/plain/corpus.part1.test.d.ts.map +1 -0
- package/dist/word/semantic/plain/corpus.part1.test.js +12 -0
- package/dist/word/semantic/plain/corpus.part1.test.js.map +1 -0
- package/dist/word/semantic/plain/corpus.part2.test.d.ts +2 -0
- package/dist/word/semantic/plain/corpus.part2.test.d.ts.map +1 -0
- package/dist/word/semantic/plain/corpus.part2.test.js +12 -0
- package/dist/word/semantic/plain/corpus.part2.test.js.map +1 -0
- package/dist/word/semantic/plain/corpus.part3.test.d.ts +2 -0
- package/dist/word/semantic/plain/corpus.part3.test.d.ts.map +1 -0
- package/dist/word/semantic/plain/corpus.part3.test.js +12 -0
- package/dist/word/semantic/plain/corpus.part3.test.js.map +1 -0
- package/dist/word/semantic/plain/corpus.part4.test.d.ts +2 -0
- package/dist/word/semantic/plain/corpus.part4.test.d.ts.map +1 -0
- package/dist/word/semantic/plain/corpus.part4.test.js +16 -0
- package/dist/word/semantic/plain/corpus.part4.test.js.map +1 -0
- package/dist/word/semantic/plain/corpus.part5.test.d.ts +2 -0
- package/dist/word/semantic/plain/corpus.part5.test.d.ts.map +1 -0
- package/dist/word/semantic/plain/corpus.part5.test.js +16 -0
- package/dist/word/semantic/plain/corpus.part5.test.js.map +1 -0
- package/dist/word/semantic/plain/corpus.test-helper.d.ts +32 -0
- package/dist/word/semantic/plain/corpus.test-helper.d.ts.map +1 -0
- package/dist/word/semantic/plain/corpus.test-helper.js +168 -0
- package/dist/word/semantic/plain/corpus.test-helper.js.map +1 -0
- package/dist/word/semantic/plain/design.d.ts +30 -0
- package/dist/word/semantic/plain/design.d.ts.map +1 -0
- package/dist/word/semantic/plain/design.js +106 -0
- package/dist/word/semantic/plain/design.js.map +1 -0
- package/dist/word/semantic/plain/plain.test.d.ts +2 -0
- package/dist/word/semantic/plain/plain.test.d.ts.map +1 -0
- package/dist/word/semantic/plain/plain.test.js +327 -0
- package/dist/word/semantic/plain/plain.test.js.map +1 -0
- package/dist/word/semantic/plain/styles.d.ts +4 -0
- package/dist/word/semantic/plain/styles.d.ts.map +1 -0
- package/dist/word/semantic/plain/styles.js +36 -0
- package/dist/word/semantic/plain/styles.js.map +1 -0
- package/dist/word/semantic/prose/chips.d.ts.map +1 -1
- package/dist/word/semantic/prose/chips.js +8 -3
- package/dist/word/semantic/prose/chips.js.map +1 -1
- package/dist/word/semantic/prose/citations.d.ts +42 -0
- package/dist/word/semantic/prose/citations.d.ts.map +1 -0
- package/dist/word/semantic/prose/citations.js +138 -0
- package/dist/word/semantic/prose/citations.js.map +1 -0
- package/dist/word/semantic/prose/citations.test.d.ts +2 -0
- package/dist/word/semantic/prose/citations.test.d.ts.map +1 -0
- package/dist/word/semantic/prose/citations.test.js +66 -0
- package/dist/word/semantic/prose/citations.test.js.map +1 -0
- package/dist/word/semantic/prose/leading.d.ts +36 -0
- package/dist/word/semantic/prose/leading.d.ts.map +1 -0
- package/dist/word/semantic/prose/leading.js +115 -0
- package/dist/word/semantic/prose/leading.js.map +1 -0
- package/dist/word/semantic/prose/leading.test.d.ts +2 -0
- package/dist/word/semantic/prose/leading.test.d.ts.map +1 -0
- package/dist/word/semantic/prose/leading.test.js +116 -0
- package/dist/word/semantic/prose/leading.test.js.map +1 -0
- package/dist/word/semantic/prose/tocEntry.d.ts +8 -0
- package/dist/word/semantic/prose/tocEntry.d.ts.map +1 -1
- package/dist/word/semantic/prose/tocEntry.js +40 -0
- package/dist/word/semantic/prose/tocEntry.js.map +1 -1
- package/dist/word/semantic/sections.d.ts +6 -0
- package/dist/word/semantic/sections.d.ts.map +1 -1
- package/dist/word/semantic/sections.js +11 -4
- package/dist/word/semantic/sections.js.map +1 -1
- package/dist/word/semantic/styles.d.ts +5 -1
- package/dist/word/semantic/styles.d.ts.map +1 -1
- package/dist/word/semantic/styles.js +22 -5
- package/dist/word/semantic/styles.js.map +1 -1
- package/dist/word/semantic/tables.d.ts.map +1 -1
- package/dist/word/semantic/tables.js +2 -1
- package/dist/word/semantic/tables.js.map +1 -1
- package/dist/word/semantic/wml.d.ts +3 -0
- package/dist/word/semantic/wml.d.ts.map +1 -1
- package/dist/word/semantic/wml.js +1 -1
- package/dist/word/semantic/wml.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import type { KPItem } from '../types.js';
|
|
2
|
+
/** Text as stacks compare it: lower-cased and without its accents and
|
|
3
|
+
* other marks (`sól` is `sol`: a stack reads alike to the eye however it
|
|
4
|
+
* is accented). Recomposed afterwards, so a syllable block stays one
|
|
5
|
+
* character. */
|
|
6
|
+
export declare function foldEdge(text: string): string;
|
|
7
|
+
/** What stands in the text for a box that paints no letters (a formula, a
|
|
8
|
+
* chip, a swatch): an edge that reaches it is not compared, so a formula
|
|
9
|
+
* is never read by its TeX source nor credited the word before it. */
|
|
10
|
+
export declare const OPAQUE = "\uFFFC";
|
|
11
|
+
/** A word longer than this has no word edge: it is no repeated word the
|
|
12
|
+
* eye catches, and it bounds what an edge reads. */
|
|
13
|
+
export declare const MAX_EDGE_WORD = 48;
|
|
14
|
+
/** One edge of a line: its word and its characters (`''`: none), and how
|
|
15
|
+
* far each reaches into the line from that edge, in UTF-16 units of the
|
|
16
|
+
* text the edge was read from (a line shorter than the reach does not
|
|
17
|
+
* hold that edge). */
|
|
18
|
+
export interface Edge {
|
|
19
|
+
word: string;
|
|
20
|
+
chars: string;
|
|
21
|
+
wordReach: number;
|
|
22
|
+
charsReach: number;
|
|
23
|
+
}
|
|
24
|
+
/** The end (or start) edge of a line's text, as stacks compare it. */
|
|
25
|
+
export declare function textEdges(text: string, minChars: number, end: boolean, clipped?: boolean): Edge;
|
|
26
|
+
/** An edge whose reach a line of `length` units holds; else none of it. */
|
|
27
|
+
export declare function edgeWithin(edge: Edge, length: number): Edge;
|
|
28
|
+
/** The line edges of a paragraph's items, each worked out once per break
|
|
29
|
+
* position and kept. A position is an item index; `-1` is the paragraph's
|
|
30
|
+
* start (the edge before its first line). Built once per paragraph and
|
|
31
|
+
* shared by every search over it. */
|
|
32
|
+
export declare class LineEdges {
|
|
33
|
+
readonly minChars: number;
|
|
34
|
+
private readonly text;
|
|
35
|
+
private readonly at;
|
|
36
|
+
private readonly ends;
|
|
37
|
+
private readonly starts;
|
|
38
|
+
constructor(items: readonly KPItem[], minChars: number);
|
|
39
|
+
/** Where item `k` starts in the paragraph's text (`k` = the item
|
|
40
|
+
* count: its end). */
|
|
41
|
+
offset(k: number): number;
|
|
42
|
+
/** The length, in units of the paragraph's text, of the line from the
|
|
43
|
+
* break at `from` to the one at `to`. */
|
|
44
|
+
lineLength(from: number, to: number): number;
|
|
45
|
+
/** The end edge of a line that ends at break `pos` (whatever its start). */
|
|
46
|
+
end(pos: number): Edge;
|
|
47
|
+
/** The start edge of the line after break `pos` (whatever its end). */
|
|
48
|
+
start(pos: number): Edge;
|
|
49
|
+
/** The end edge of the line from break `from` to break `to`. */
|
|
50
|
+
lineEnd(from: number, to: number): Edge;
|
|
51
|
+
/** The start edge of the line from break `from` to break `to`. */
|
|
52
|
+
lineStart(from: number, to: number): Edge;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Whether a folded word is a monosyllable (`a`, `y`, `de`, `la`, `que`,
|
|
56
|
+
* `bien`, `и`, `на`, `και`): one run of vowels at most, in a word written
|
|
57
|
+
* in one of the scripts of {@link VOWELS}. Two lines ending (or starting)
|
|
58
|
+
* on the same one cost twice `stackPenalty`: the eye catches a short
|
|
59
|
+
* repeated word at once.
|
|
60
|
+
*/
|
|
61
|
+
export declare function isMonosyllable(word: string): boolean;
|
|
62
|
+
/** Whether the same edge of two consecutive lines stacks: they end (or
|
|
63
|
+
* start) on the same word, or on the same characters, spaces included. */
|
|
64
|
+
export declare function edgesStack(a: Edge, b: Edge): boolean;
|
|
65
|
+
/** What a stack between edges `a` and `b` costs, in units of
|
|
66
|
+
* `stackPenalty`: 2 for a repeated monosyllable, else 1 (0: no stack). */
|
|
67
|
+
export declare function stackWeight(a: Edge, b: Edge): number;
|
|
68
|
+
//# sourceMappingURL=edges.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"edges.d.ts","sourceRoot":"","sources":["../../../src/knuthPlass/breakpoints/edges.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAG1C;;;iBAGiB;AACjB,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAW7C;AAcD;;uEAEuE;AACvE,eAAO,MAAM,MAAM,WAAM,CAAC;AAa1B;qDACqD;AACrD,eAAO,MAAM,aAAa,KAAK,CAAC;AAKhC;;;uBAGuB;AACvB,MAAM,WAAW,IAAI;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;CACpB;AAgED,sEAAsE;AACtE,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,GAAG,EAAE,OAAO,EAAE,OAAO,UAAQ,GAAG,IAAI,CAS7F;AAED,2EAA2E;AAC3E,wBAAgB,UAAU,CAAC,IAAI,EAAE,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+
* other marks (`sól` is `sol`: a stack reads alike to the eye however it
|
|
4
|
+
* is accented). Recomposed afterwards, so a syllable block stays one
|
|
5
|
+
* character. */
|
|
6
|
+
export function foldEdge(text) {
|
|
7
|
+
// ASCII has no marks to drop: most edges of Latin text (#1463, a
|
|
8
|
+
// paragraph folds one or two per break it could take).
|
|
9
|
+
if (ASCII.test(text))
|
|
10
|
+
return text.toLowerCase();
|
|
11
|
+
let folded = FOLDED.get(text);
|
|
12
|
+
if (folded === undefined) {
|
|
13
|
+
folded = text.normalize('NFD').replace(/\p{M}/gu, '').normalize('NFC').toLowerCase();
|
|
14
|
+
if (FOLDED.size >= 4096)
|
|
15
|
+
FOLDED.clear();
|
|
16
|
+
FOLDED.set(text, folded);
|
|
17
|
+
}
|
|
18
|
+
return folded;
|
|
19
|
+
}
|
|
20
|
+
const ASCII = /^[\x00-\x7f]*$/;
|
|
21
|
+
/** Folded edges outside ASCII, kept across paragraphs (words repeat). */
|
|
22
|
+
const FOLDED = new Map();
|
|
23
|
+
/** Whether a UTF-16 unit separates words: whitespace or a zero-width
|
|
24
|
+
* break. */
|
|
25
|
+
function separates(ch) {
|
|
26
|
+
const c = ch.charCodeAt(0);
|
|
27
|
+
if (c === 32)
|
|
28
|
+
return true;
|
|
29
|
+
if (c < 128)
|
|
30
|
+
return c >= 9 && c <= 13;
|
|
31
|
+
return SEPARATOR.test(ch);
|
|
32
|
+
}
|
|
33
|
+
/** What stands in the text for a box that paints no letters (a formula, a
|
|
34
|
+
* chip, a swatch): an edge that reaches it is not compared, so a formula
|
|
35
|
+
* is never read by its TeX source nor credited the word before it. */
|
|
36
|
+
export const OPAQUE = '';
|
|
37
|
+
/** A break between two words with nothing painted (a zero-width space). */
|
|
38
|
+
const WORD_BREAK = '';
|
|
39
|
+
/** Scripts that do not separate their words with spaces: Chinese, Japanese
|
|
40
|
+
* kana, Thai, Lao, Khmer, Myanmar, Tibetan. Their lines are set on a grid
|
|
41
|
+
* or broken between syllables, and a "word" at a line's edge is no unit a
|
|
42
|
+
* reader sees repeated, so an edge in one of them has no stack (#1463). */
|
|
43
|
+
const UNSPACED = /[\p{Script=Han}\p{Script=Hiragana}\p{Script=Katakana}\p{Script=Bopomofo}\p{Script=Thai}\p{Script=Lao}\p{Script=Khmer}\p{Script=Myanmar}\p{Script=Tibetan}]/u;
|
|
44
|
+
const SEPARATOR = /[\s]/u;
|
|
45
|
+
const EDGE_PUNCT_END = /[^\p{L}\p{N}]+$/u;
|
|
46
|
+
const EDGE_PUNCT_START = /^[^\p{L}\p{N}]+/u;
|
|
47
|
+
/** A word longer than this has no word edge: it is no repeated word the
|
|
48
|
+
* eye catches, and it bounds what an edge reads. */
|
|
49
|
+
export const MAX_EDGE_WORD = 48;
|
|
50
|
+
/** Characters of text an edge looks at: the longest word and the
|
|
51
|
+
* punctuation and spaces after it. */
|
|
52
|
+
const EDGE_WINDOW = 96;
|
|
53
|
+
const NO_EDGE = { word: '', chars: '', wordReach: 0, charsReach: 0 };
|
|
54
|
+
/** A token at a line's edge as a word: without soft hyphens and the
|
|
55
|
+
* punctuation at either end, folded; `''` when it holds no letter or
|
|
56
|
+
* number, a box with no text, a character of a script without spaces, or
|
|
57
|
+
* is longer than {@link MAX_EDGE_WORD}. */
|
|
58
|
+
function edgeWord(token) {
|
|
59
|
+
if (token.includes(OPAQUE) || UNSPACED.test(token))
|
|
60
|
+
return '';
|
|
61
|
+
const bare = token.replace(//g, '').replace(EDGE_PUNCT_START, '').replace(EDGE_PUNCT_END, '');
|
|
62
|
+
return bare.length > MAX_EDGE_WORD ? '' : foldEdge(bare);
|
|
63
|
+
}
|
|
64
|
+
/** The characters an edge compares: `minChars` of them, spaces included
|
|
65
|
+
* (zero-width breaks and soft hyphens are nothing), past the punctuation
|
|
66
|
+
* at the edge; `''` when the text is shorter, or they reach a box with no
|
|
67
|
+
* text or a script without spaces. Returns them with their reach. */
|
|
68
|
+
function edgeChars(text, minChars, end) {
|
|
69
|
+
const clean = text.includes('') || text.includes(WORD_BREAK) ? text.replace(/[]/g, '') : text;
|
|
70
|
+
const trimmed = end ? clean.replace(EDGE_PUNCT_END, '') : clean.replace(EDGE_PUNCT_START, '');
|
|
71
|
+
if (trimmed.length < minChars)
|
|
72
|
+
return { chars: '', reach: 0 };
|
|
73
|
+
const chars = end ? trimmed.slice(-minChars) : trimmed.slice(0, minChars);
|
|
74
|
+
if (chars.includes(OPAQUE) || UNSPACED.test(chars))
|
|
75
|
+
return { chars: '', reach: 0 };
|
|
76
|
+
// Reach in the text as given (soft hyphens and zero-width breaks
|
|
77
|
+
// counted), so a caller can hold it against a line's length.
|
|
78
|
+
return { chars: foldEdge(chars), reach: rawReach(text, clean.length - trimmed.length + minChars, end) };
|
|
79
|
+
}
|
|
80
|
+
/** How many UTF-16 units of `text`, from its end (or start), hold `n`
|
|
81
|
+
* units once soft hyphens and zero-width breaks are left out. */
|
|
82
|
+
function rawReach(text, n, end) {
|
|
83
|
+
let seen = 0;
|
|
84
|
+
for (let k = 0; k < text.length; k++) {
|
|
85
|
+
const ch = text[end ? text.length - 1 - k : k];
|
|
86
|
+
if (ch !== '' && ch !== WORD_BREAK)
|
|
87
|
+
seen++;
|
|
88
|
+
if (seen >= n)
|
|
89
|
+
return k + 1;
|
|
90
|
+
}
|
|
91
|
+
return text.length;
|
|
92
|
+
}
|
|
93
|
+
/** The word at one edge of `text`: the last (first) token holding a letter
|
|
94
|
+
* or a number, past the punctuation and spaces at the edge, with its
|
|
95
|
+
* reach. A box with no text met on the way stops it. A token cut by the
|
|
96
|
+
* start of `text` while `clipped` (the text is a window of a longer one)
|
|
97
|
+
* is too long to be a word. */
|
|
98
|
+
function edgeToken(text, end, clipped) {
|
|
99
|
+
const n = text.length;
|
|
100
|
+
let k = 0;
|
|
101
|
+
while (k < n) {
|
|
102
|
+
// Skip separators and punctuation-only tokens.
|
|
103
|
+
while (k < n && separates(text[end ? n - 1 - k : k]))
|
|
104
|
+
k++;
|
|
105
|
+
const from = k;
|
|
106
|
+
while (k < n && !separates(text[end ? n - 1 - k : k]))
|
|
107
|
+
k++;
|
|
108
|
+
if (k === from)
|
|
109
|
+
break;
|
|
110
|
+
const token = end ? text.slice(n - k, n - from) : text.slice(from, k);
|
|
111
|
+
if (token.includes(OPAQUE))
|
|
112
|
+
return { word: '', reach: 0 };
|
|
113
|
+
if (!/[\p{L}\p{N}]/u.test(token))
|
|
114
|
+
continue;
|
|
115
|
+
if (clipped && k === n)
|
|
116
|
+
return { word: '', reach: 0 };
|
|
117
|
+
return { word: edgeWord(token), reach: k };
|
|
118
|
+
}
|
|
119
|
+
return { word: '', reach: 0 };
|
|
120
|
+
}
|
|
121
|
+
/** The end (or start) edge of a line's text, as stacks compare it. */
|
|
122
|
+
export function textEdges(text, minChars, end, clipped = false) {
|
|
123
|
+
const { word, reach: wordReach } = edgeToken(text, end, clipped);
|
|
124
|
+
// The characters lie near the edge: read them off a short piece of it
|
|
125
|
+
// first, the whole text only when punctuation fills that piece.
|
|
126
|
+
const near = minChars + 16;
|
|
127
|
+
let { chars, reach: charsReach } = edgeChars(text.length > near ? (end ? text.slice(-near) : text.slice(0, near)) : text, minChars, end);
|
|
128
|
+
if (chars === '' && text.length > near)
|
|
129
|
+
({ chars, reach: charsReach } = edgeChars(text, minChars, end));
|
|
130
|
+
if (word === '' && chars === '')
|
|
131
|
+
return NO_EDGE;
|
|
132
|
+
return { word, chars, wordReach: word === '' ? 0 : wordReach, charsReach };
|
|
133
|
+
}
|
|
134
|
+
/** An edge whose reach a line of `length` units holds; else none of it. */
|
|
135
|
+
export function edgeWithin(edge, length) {
|
|
136
|
+
if (edge.wordReach <= length && edge.charsReach <= length)
|
|
137
|
+
return edge;
|
|
138
|
+
const word = edge.wordReach <= length ? edge.word : '';
|
|
139
|
+
const chars = edge.charsReach <= length ? edge.chars : '';
|
|
140
|
+
return { word, chars, wordReach: word === '' ? 0 : edge.wordReach, charsReach: chars === '' ? 0 : edge.charsReach };
|
|
141
|
+
}
|
|
142
|
+
/** The paragraph as one text, as its lines would print it: a word space is
|
|
143
|
+
* a space, a forced break a line feed, a zero-width break U+200B, a box
|
|
144
|
+
* with no text {@link OPAQUE}, the closing glue nothing; soft hyphens are
|
|
145
|
+
* kept (and skipped by the edges). `at[k]` is where item k starts. */
|
|
146
|
+
function paragraphText(items) {
|
|
147
|
+
const parts = [];
|
|
148
|
+
const at = new Array(items.length + 1);
|
|
149
|
+
let length = 0;
|
|
150
|
+
for (let k = 0; k < items.length; k++) {
|
|
151
|
+
at[k] = length;
|
|
152
|
+
const item = items[k];
|
|
153
|
+
let part = '';
|
|
154
|
+
if (item.type === 'box')
|
|
155
|
+
part = item.text ?? OPAQUE;
|
|
156
|
+
else if (item.type === 'glue')
|
|
157
|
+
part = item.sourceIndex >= 0 ? ' ' : '';
|
|
158
|
+
else if (item.penalty <= -KP_INFINITY)
|
|
159
|
+
part = '\n';
|
|
160
|
+
else if (item.separates)
|
|
161
|
+
part = WORD_BREAK;
|
|
162
|
+
if (part !== '') {
|
|
163
|
+
parts.push(part);
|
|
164
|
+
length += part.length;
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
at[items.length] = length;
|
|
168
|
+
return { text: parts.join(''), at };
|
|
169
|
+
}
|
|
170
|
+
/** The line edges of a paragraph's items, each worked out once per break
|
|
171
|
+
* position and kept. A position is an item index; `-1` is the paragraph's
|
|
172
|
+
* start (the edge before its first line). Built once per paragraph and
|
|
173
|
+
* shared by every search over it. */
|
|
174
|
+
export class LineEdges {
|
|
175
|
+
minChars;
|
|
176
|
+
text;
|
|
177
|
+
at;
|
|
178
|
+
ends;
|
|
179
|
+
starts;
|
|
180
|
+
constructor(items, minChars) {
|
|
181
|
+
this.minChars = minChars;
|
|
182
|
+
const { text, at } = paragraphText(items);
|
|
183
|
+
this.text = text;
|
|
184
|
+
this.at = at;
|
|
185
|
+
this.ends = new Array(items.length);
|
|
186
|
+
this.starts = new Array(items.length + 1);
|
|
187
|
+
}
|
|
188
|
+
/** Where item `k` starts in the paragraph's text (`k` = the item
|
|
189
|
+
* count: its end). */
|
|
190
|
+
offset(k) {
|
|
191
|
+
return this.at[k];
|
|
192
|
+
}
|
|
193
|
+
/** The length, in units of the paragraph's text, of the line from the
|
|
194
|
+
* break at `from` to the one at `to`. */
|
|
195
|
+
lineLength(from, to) {
|
|
196
|
+
return this.at[to] - this.at[from + 1];
|
|
197
|
+
}
|
|
198
|
+
/** The end edge of a line that ends at break `pos` (whatever its start). */
|
|
199
|
+
end(pos) {
|
|
200
|
+
if (pos < 0)
|
|
201
|
+
return NO_EDGE;
|
|
202
|
+
let e = this.ends[pos];
|
|
203
|
+
if (e === undefined) {
|
|
204
|
+
const to = this.at[pos];
|
|
205
|
+
const from = Math.max(0, to - EDGE_WINDOW);
|
|
206
|
+
// A break inside a word of a script without spaces (between two
|
|
207
|
+
// ideographs) has no edge: decided on the character before it.
|
|
208
|
+
e = to > 0 && UNSPACED.test(this.text[to - 1]) ? NO_EDGE : textEdges(this.text.slice(from, to), this.minChars, true, from > 0);
|
|
209
|
+
this.ends[pos] = e;
|
|
210
|
+
}
|
|
211
|
+
return e;
|
|
212
|
+
}
|
|
213
|
+
/** The start edge of the line after break `pos` (whatever its end). */
|
|
214
|
+
start(pos) {
|
|
215
|
+
let e = this.starts[pos + 1];
|
|
216
|
+
if (e === undefined) {
|
|
217
|
+
const from = this.at[pos + 1];
|
|
218
|
+
const to = Math.min(this.text.length, from + EDGE_WINDOW);
|
|
219
|
+
e = from < this.text.length && UNSPACED.test(this.text[from]) ? NO_EDGE : textEdges(this.text.slice(from, to), this.minChars, false, to < this.text.length);
|
|
220
|
+
this.starts[pos + 1] = e;
|
|
221
|
+
}
|
|
222
|
+
return e;
|
|
223
|
+
}
|
|
224
|
+
/** The end edge of the line from break `from` to break `to`. */
|
|
225
|
+
lineEnd(from, to) {
|
|
226
|
+
return edgeWithin(this.end(to), this.lineLength(from, to));
|
|
227
|
+
}
|
|
228
|
+
/** The start edge of the line from break `from` to break `to`. */
|
|
229
|
+
lineStart(from, to) {
|
|
230
|
+
return edgeWithin(this.start(from), this.lineLength(from, to));
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
/** The vowels of each script whose monosyllables count (#1463): Latin,
|
|
234
|
+
* Greek and Cyrillic, folded (no accents). A word of any other script is
|
|
235
|
+
* never a monosyllable. */
|
|
236
|
+
const VOWELS = [
|
|
237
|
+
[/^\p{Script=Latin}+$/u, /[aeiouyæœø]+/g],
|
|
238
|
+
[/^\p{Script=Greek}+$/u, /[αεηιουω]+/g],
|
|
239
|
+
[/^\p{Script=Cyrillic}+$/u, /[аеёиоуыэюяіїєў]+/g],
|
|
240
|
+
];
|
|
241
|
+
/**
|
|
242
|
+
* Whether a folded word is a monosyllable (`a`, `y`, `de`, `la`, `que`,
|
|
243
|
+
* `bien`, `и`, `на`, `και`): one run of vowels at most, in a word written
|
|
244
|
+
* in one of the scripts of {@link VOWELS}. Two lines ending (or starting)
|
|
245
|
+
* on the same one cost twice `stackPenalty`: the eye catches a short
|
|
246
|
+
* repeated word at once.
|
|
247
|
+
*/
|
|
248
|
+
export function isMonosyllable(word) {
|
|
249
|
+
if (word === '')
|
|
250
|
+
return false;
|
|
251
|
+
for (const [script, vowels] of VOWELS) {
|
|
252
|
+
if (script.test(word))
|
|
253
|
+
return (word.match(vowels)?.length ?? 0) <= 1;
|
|
254
|
+
}
|
|
255
|
+
return false;
|
|
256
|
+
}
|
|
257
|
+
/** Whether the same edge of two consecutive lines stacks: they end (or
|
|
258
|
+
* start) on the same word, or on the same characters, spaces included. */
|
|
259
|
+
export function edgesStack(a, b) {
|
|
260
|
+
return (a.word !== '' && a.word === b.word) || (a.chars !== '' && a.chars === b.chars);
|
|
261
|
+
}
|
|
262
|
+
/** What a stack between edges `a` and `b` costs, in units of
|
|
263
|
+
* `stackPenalty`: 2 for a repeated monosyllable, else 1 (0: no stack). */
|
|
264
|
+
export function stackWeight(a, b) {
|
|
265
|
+
if (!edgesStack(a, b))
|
|
266
|
+
return 0;
|
|
267
|
+
return a.word !== '' && a.word === b.word && isMonosyllable(a.word) ? 2 : 1;
|
|
268
|
+
}
|
|
269
|
+
//# sourceMappingURL=edges.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"edges.js","sourceRoot":"","sources":["../../../src/knuthPlass/breakpoints/edges.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAE9C;;;iBAGiB;AACjB,MAAM,UAAU,QAAQ,CAAC,IAAY;IACnC,iEAAiE;IACjE,uDAAuD;IACvD,IAAI,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC;QAAE,OAAO,IAAI,CAAC,WAAW,EAAE,CAAC;IAChD,IAAI,MAAM,GAAG,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IAC9B,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;QACzB,MAAM,GAAG,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,SAAS,EAAE,EAAE,CAAC,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,WAAW,EAAE,CAAC;QACrF,IAAI,MAAM,CAAC,IAAI,IAAI,IAAI;YAAE,MAAM,CAAC,KAAK,EAAE,CAAC;QACxC,MAAM,CAAC,GAAG,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;IAC3B,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC;AACD,MAAM,KAAK,GAAG,gBAAgB,CAAC;AAC/B,yEAAyE;AACzE,MAAM,MAAM,GAAG,IAAI,GAAG,EAAkB,CAAC;AAEzC;aACa;AACb,SAAS,SAAS,CAAC,EAAU;IAC3B,MAAM,CAAC,GAAG,EAAE,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;IAC3B,IAAI,CAAC,KAAK,EAAE;QAAE,OAAO,IAAI,CAAC;IAC1B,IAAI,CAAC,GAAG,GAAG;QAAE,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;I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
|
4
|
+
* {@link search} under the document's stacks (#1463). Merging nodes by
|
|
5
|
+
* line and fitness alone forgets what a stack's cost depends on (the edge
|
|
6
|
+
* a node's line starts on), so the chain kept may set a stack another one
|
|
7
|
+
* avoids for less. A paragraph whose setting keeps a stack is set again
|
|
8
|
+
* with that state kept apart, which is exact but dearer: that search gives
|
|
9
|
+
* up past {@link EXACT_MAX_ACTIVE} active nodes, and the first setting
|
|
10
|
+
* stands. The exact one is taken when it has as many lines and costs
|
|
11
|
+
* less (a tie keeps the first). `edges` are the paragraph's, built once
|
|
12
|
+
* for every search over it; none when stacks cost nothing.
|
|
8
13
|
*/
|
|
9
|
-
export declare function
|
|
14
|
+
export declare function limited(items: KPItem[], options: KPOptions, edges: LineEdges | undefined, longerTo?: number, maxStacks?: number): SearchResult | null;
|
|
15
|
+
/** The edges stacks compare in a paragraph, when they are compared: not
|
|
16
|
+
* when a stack costs nothing, which sets the lines of no stacks at all. */
|
|
17
|
+
export declare function lineEdgesFor(items: KPItem[], options: KPOptions): LineEdges | undefined;
|
|
18
|
+
/** A search's breaks, how many stacks they set (`ActiveNode.stacks`) and
|
|
19
|
+
* what they cost. */
|
|
20
|
+
export interface SearchResult {
|
|
21
|
+
breaks: number[];
|
|
22
|
+
stacks: number;
|
|
23
|
+
demerits: number;
|
|
24
|
+
}
|
|
10
25
|
//# sourceMappingURL=search.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"search.d.ts","sourceRoot":"","sources":["../../../src/knuthPlass/breakpoints/search.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"search.d.ts","sourceRoot":"","sources":["../../../src/knuthPlass/breakpoints/search.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,MAAM,EAAE,SAAS,EAAa,MAAM,aAAa,CAAC;AAGhE,OAAO,EAAa,SAAS,EAAe,MAAM,YAAY,CAAC;AAqE/D;;;;;;;;;;GAUG;AACH,wBAAgB,OAAO,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,SAAS,GAAG,SAAS,EAAE,QAAQ,CAAC,EAAE,MAAM,EAAE,SAAS,SAAW,GAAG,YAAY,GAAG,IAAI,CAKvJ;AAED;4EAC4E;AAC5E,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,OAAO,EAAE,SAAS,GAAG,SAAS,GAAG,SAAS,CAEvF;AAED;sBACsB;AACtB,MAAM,WAAW,YAAY;IAC3B,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;CAClB"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { BADNESS_CAP, DEFAULT_CONSECUTIVE_HYPHEN_DEMERIT, DEFAULT_FITNESS_CLASS_DEMERIT, KP_INFINITY, OVER_STRETCH_BADNESS, COLUMN_END_HYPHEN_BADNESS, TRACKING_BADNESS, RAGGED_SPACE_RATIO } from '../constants.js';
|
|
1
|
+
import { BADNESS_CAP, DEFAULT_CONSECUTIVE_HYPHEN_DEMERIT, DEFAULT_FITNESS_CLASS_DEMERIT, KP_INFINITY, OVER_STRETCH_BADNESS, COLUMN_END_HYPHEN_BADNESS, TRACKING_BADNESS, RAGGED_SPACE_RATIO, EXACT_MAX_ACTIVE } from '../constants.js';
|
|
2
2
|
import { adjustLine } from './adjust.js';
|
|
3
|
+
import { LineEdges, stackWeight } from './edges.js';
|
|
3
4
|
function classifyFitness(r) {
|
|
4
5
|
if (r < -0.5)
|
|
5
6
|
return 0; // tight
|
|
@@ -14,6 +15,10 @@ function computeBadness(r) {
|
|
|
14
15
|
const b = Math.round(100 * absR * absR * absR);
|
|
15
16
|
return Math.min(b, BADNESS_CAP);
|
|
16
17
|
}
|
|
18
|
+
/** A search's result: the chain ending at `node`. */
|
|
19
|
+
function resultOf(node) {
|
|
20
|
+
return { breaks: traceBreaks(node), stacks: node.stacks, demerits: node.totalDemerits };
|
|
21
|
+
}
|
|
17
22
|
/** The positions of the chain ending at `node`, first line first. */
|
|
18
23
|
function traceBreaks(node) {
|
|
19
24
|
const breaks = [];
|
|
@@ -21,14 +26,44 @@ function traceBreaks(node) {
|
|
|
21
26
|
breaks.push(n.position);
|
|
22
27
|
return breaks.reverse();
|
|
23
28
|
}
|
|
29
|
+
/**
|
|
30
|
+
* {@link search} under the document's stacks (#1463). Merging nodes by
|
|
31
|
+
* line and fitness alone forgets what a stack's cost depends on (the edge
|
|
32
|
+
* a node's line starts on), so the chain kept may set a stack another one
|
|
33
|
+
* avoids for less. A paragraph whose setting keeps a stack is set again
|
|
34
|
+
* with that state kept apart, which is exact but dearer: that search gives
|
|
35
|
+
* up past {@link EXACT_MAX_ACTIVE} active nodes, and the first setting
|
|
36
|
+
* stands. The exact one is taken when it has as many lines and costs
|
|
37
|
+
* less (a tie keeps the first). `edges` are the paragraph's, built once
|
|
38
|
+
* for every search over it; none when stacks cost nothing.
|
|
39
|
+
*/
|
|
40
|
+
export function limited(items, options, edges, longerTo, maxStacks = Infinity) {
|
|
41
|
+
const first = search(items, options, edges, false, longerTo, maxStacks);
|
|
42
|
+
if (first === null || first.stacks === 0 || !edges)
|
|
43
|
+
return first;
|
|
44
|
+
const exact = search(items, options, edges, true, longerTo, maxStacks);
|
|
45
|
+
return exact !== null && exact.breaks.length === first.breaks.length && exact.demerits < first.demerits ? exact : first;
|
|
46
|
+
}
|
|
47
|
+
/** The edges stacks compare in a paragraph, when they are compared: not
|
|
48
|
+
* when a stack costs nothing, which sets the lines of no stacks at all. */
|
|
49
|
+
export function lineEdgesFor(items, options) {
|
|
50
|
+
return options.stacks && options.stacks.demerits > 0 ? new LineEdges(items, options.stacks.minChars) : undefined;
|
|
51
|
+
}
|
|
52
|
+
/** The validity bits of a line's end edge the next line compares with
|
|
53
|
+
* (word, characters): part of an exact node's key. */
|
|
54
|
+
function reachBits(e) {
|
|
55
|
+
return (e.word !== '' ? 1 : 0) | (e.chars !== '' ? 2 : 0);
|
|
56
|
+
}
|
|
24
57
|
/**
|
|
25
58
|
* The dynamic programme. Without `longerTo`: the natural breaks, or for a
|
|
26
59
|
* negative looseness the shorter setting when it passes its gates (null
|
|
27
60
|
* only when nothing could be set). With `longerTo`: the cheapest setting
|
|
28
|
-
* of exactly that many lines with no very loose line
|
|
29
|
-
* when there is none.
|
|
61
|
+
* of exactly that many lines with no very loose line and no more than
|
|
62
|
+
* `maxStacks` stacks, or null when there is none. `exactLimits` keys the
|
|
63
|
+
* nodes by the state the stacks' costs depend on (see {@link limited}),
|
|
64
|
+
* and gives up (null) past {@link EXACT_MAX_ACTIVE} active nodes.
|
|
30
65
|
*/
|
|
31
|
-
|
|
66
|
+
function search(items, options, edges, exactLimits, longerTo, maxStacks = Infinity) {
|
|
32
67
|
const longer = longerTo !== undefined;
|
|
33
68
|
const { lineWidth, consecutiveHyphenDemerit = DEFAULT_CONSECUTIVE_HYPHEN_DEMERIT, fitnessClassDemerit = DEFAULT_FITNESS_CLASS_DEMERIT, runtPenalty = 0, runtMinWidth = 0, runtGraded = false, } = options;
|
|
34
69
|
const trackingPerChar = options.trackingPerChar ?? 0;
|
|
@@ -132,6 +167,7 @@ export function search(items, options, longerTo) {
|
|
|
132
167
|
sumWordSpaceWidthAt.push(sumWordSpaceWidth);
|
|
133
168
|
}
|
|
134
169
|
}
|
|
170
|
+
const stackCost = options.stacks?.demerits ?? 0;
|
|
135
171
|
// Seed active node list with a "start of paragraph" sentinel
|
|
136
172
|
let activeNodes = [{
|
|
137
173
|
position: -1,
|
|
@@ -148,6 +184,7 @@ export function search(items, options, longerTo) {
|
|
|
148
184
|
ragged: 0,
|
|
149
185
|
totalWordSpaces: 0,
|
|
150
186
|
totalWordSpaceWidth: 0,
|
|
187
|
+
stacks: 0,
|
|
151
188
|
previous: null,
|
|
152
189
|
}];
|
|
153
190
|
// Candidate nodes for the current breakpoint, deduplicated on the fly by
|
|
@@ -155,6 +192,10 @@ export function search(items, options, longerTo) {
|
|
|
155
192
|
// Nodes at different breakpoint positions are never merged — every entry
|
|
156
193
|
// here shares the current position `i`. Hoisted out of the loop and
|
|
157
194
|
// cleared per breakpoint to avoid one Map allocation per legal break.
|
|
195
|
+
// With stacks, the exact pass keys nodes also by the edge their line
|
|
196
|
+
// starts on, which the next line's cost depends on (else a cheaper node
|
|
197
|
+
// that starts as the next line would stack on takes the place of one
|
|
198
|
+
// that keeps the rule, and the rule breaks where it need not).
|
|
158
199
|
const bestNewNodeByKey = new Map();
|
|
159
200
|
for (let i = 0; i < items.length; i++) {
|
|
160
201
|
const item = items[i];
|
|
@@ -262,6 +303,28 @@ export function search(items, options, longerTo) {
|
|
|
262
303
|
const runtCost = isRunt ? (runtGraded ? runtPenalty * (1 - contentWidth / runtMinWidth) : runtPenalty) : 0;
|
|
263
304
|
// A hyphen ending a line that closes a column or a page (EF-86).
|
|
264
305
|
const columnEndHyphen = isFlagged && avoidHyphenAt?.has(a.line + 1) ? COLUMN_END_HYPHEN_BADNESS : 0;
|
|
306
|
+
// Stacks (#1463): this line and the one before end, or start, alike.
|
|
307
|
+
// An edge counts only where the line holds it (a short last line
|
|
308
|
+
// does not reach into the line above). Charged as demerits, added
|
|
309
|
+
// as two hyphenated lines in a row are (TeX's \doublehyphendemerits):
|
|
310
|
+
// a stack is a fault of a pair of lines, not of this line's spacing,
|
|
311
|
+
// and on that scale `stackPenalty` and `consecutiveHyphenDemerit`
|
|
312
|
+
// weigh against each other directly.
|
|
313
|
+
let stackDemerits = 0;
|
|
314
|
+
let stacked = 0;
|
|
315
|
+
let lineStart;
|
|
316
|
+
let lineEnd;
|
|
317
|
+
if (edges) {
|
|
318
|
+
lineStart = edges.lineStart(a.position, i);
|
|
319
|
+
lineEnd = edges.lineEnd(a.position, i);
|
|
320
|
+
if (a.position >= 0 && a.previous) {
|
|
321
|
+
const before = a.previous.position;
|
|
322
|
+
const atEnd = stackWeight(lineEnd, edges.lineEnd(before, a.position));
|
|
323
|
+
const atStart = stackWeight(lineStart, edges.lineStart(before, a.position));
|
|
324
|
+
stackDemerits = stackCost * (atEnd + atStart);
|
|
325
|
+
stacked = (atEnd > 0 ? 1 : 0) + (atStart > 0 ? 1 : 0);
|
|
326
|
+
}
|
|
327
|
+
}
|
|
265
328
|
const effectiveBadness = badness + overStretch + runtCost + columnEndHyphen
|
|
266
329
|
+ (trackingShare > 0 ? TRACKING_BADNESS * trackingShare * trackingShare : 0);
|
|
267
330
|
let d;
|
|
@@ -281,6 +344,7 @@ export function search(items, options, longerTo) {
|
|
|
281
344
|
if (isFlagged && prevIsFlagged) {
|
|
282
345
|
d += consecutiveHyphenDemerit;
|
|
283
346
|
}
|
|
347
|
+
d += stackDemerits;
|
|
284
348
|
// Fitness class demerit
|
|
285
349
|
const fc = classifyFitness(r);
|
|
286
350
|
if (Math.abs(fc - a.fitnessClass) > 1) {
|
|
@@ -312,7 +376,10 @@ export function search(items, options, longerTo) {
|
|
|
312
376
|
}
|
|
313
377
|
// Keys of merged nodes (fc alone, 0–3) never collide with the
|
|
314
378
|
// per-line keys, which start at 4.
|
|
315
|
-
const
|
|
379
|
+
const baseKey = uniformFrom !== undefined && a.line + 1 >= uniformFrom ? fc : (a.line + 1) * 4 + fc;
|
|
380
|
+
const key = exactLimits && lineStart && lineEnd
|
|
381
|
+
? `${baseKey}|${lineStart.word}\u0001${lineStart.chars}\u0001${reachBits(lineEnd)}`
|
|
382
|
+
: baseKey;
|
|
316
383
|
const existing = bestNewNodeByKey.get(key);
|
|
317
384
|
if (existing && existing.totalDemerits <= totalDemerits) {
|
|
318
385
|
continue;
|
|
@@ -338,6 +405,7 @@ export function search(items, options, longerTo) {
|
|
|
338
405
|
ragged,
|
|
339
406
|
totalWordSpaces: gateShort ? sumWordSpacesAt[i + 1] : 0,
|
|
340
407
|
totalWordSpaceWidth: gateShort ? sumWordSpaceWidthAt[i + 1] : 0,
|
|
408
|
+
stacks: a.stacks + stacked,
|
|
341
409
|
previous: a,
|
|
342
410
|
});
|
|
343
411
|
}
|
|
@@ -345,6 +413,11 @@ export function search(items, options, longerTo) {
|
|
|
345
413
|
for (const node of bestNewNodeByKey.values()) {
|
|
346
414
|
activeNodes.push(node);
|
|
347
415
|
}
|
|
416
|
+
// The exact search keeps one node per edge a line may start on: on a
|
|
417
|
+
// long paragraph with many breaks in reach that is dear, and past the
|
|
418
|
+
// cap it gives up (the merged setting stands, #1463).
|
|
419
|
+
if (exactLimits && activeNodes.length > EXACT_MAX_ACTIVE)
|
|
420
|
+
return null;
|
|
348
421
|
// Forced breaks: when penalty = -INFINITY, remove all active nodes that
|
|
349
422
|
// are NOT at this position. The break is mandatory — no line can skip it.
|
|
350
423
|
if (item.type === 'penalty' && item.penalty <= -KP_INFINITY) {
|
|
@@ -370,6 +443,7 @@ export function search(items, options, longerTo) {
|
|
|
370
443
|
ragged: 0,
|
|
371
444
|
totalWordSpaces: gateShort ? sumWordSpacesAt[i + 1] : 0,
|
|
372
445
|
totalWordSpaceWidth: gateShort ? sumWordSpaceWidthAt[i + 1] : 0,
|
|
446
|
+
stacks: 0,
|
|
373
447
|
previous: null,
|
|
374
448
|
});
|
|
375
449
|
}
|
|
@@ -382,14 +456,14 @@ export function search(items, options, longerTo) {
|
|
|
382
456
|
for (const a of activeNodes) {
|
|
383
457
|
if (a.position !== lastBreakPosition)
|
|
384
458
|
continue;
|
|
385
|
-
if (longer && a.line !== longerTo)
|
|
459
|
+
if (longer && (a.line !== longerTo || a.stacks > maxStacks))
|
|
386
460
|
continue;
|
|
387
461
|
if (best === null || a.totalDemerits < best.totalDemerits) {
|
|
388
462
|
best = a;
|
|
389
463
|
}
|
|
390
464
|
}
|
|
391
465
|
if (longer)
|
|
392
|
-
return best ?
|
|
466
|
+
return best ? resultOf(best) : null;
|
|
393
467
|
// A shorter setting (TeX \looseness < 0: one line short, to pull up a
|
|
394
468
|
// runt last line or take a line out of a column that runs over): among
|
|
395
469
|
// the surviving final nodes, the lowest-demerit sequence with exactly
|
|
@@ -416,6 +490,9 @@ export function search(items, options, longerTo) {
|
|
|
416
490
|
continue;
|
|
417
491
|
if (gateShort && (a.loosest > loosestAllowed || a.ragged > best.ragged))
|
|
418
492
|
continue;
|
|
493
|
+
// Nor more stacks than the natural setting (#1463).
|
|
494
|
+
if (a.stacks > best.stacks)
|
|
495
|
+
continue;
|
|
419
496
|
if (alternative === null || a.totalDemerits < alternative.totalDemerits)
|
|
420
497
|
alternative = a;
|
|
421
498
|
}
|
|
@@ -434,6 +511,6 @@ export function search(items, options, longerTo) {
|
|
|
434
511
|
}
|
|
435
512
|
}
|
|
436
513
|
}
|
|
437
|
-
return best ?
|
|
514
|
+
return best ? resultOf(best) : { breaks: [], stacks: 0, demerits: 0 };
|
|
438
515
|
}
|
|
439
516
|
//# sourceMappingURL=search.js.map
|