postext 1.35.1 → 1.37.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/dist/__bench__/composedPage.bench.test.d.ts +2 -0
- package/dist/__bench__/composedPage.bench.test.d.ts.map +1 -0
- package/dist/__bench__/composedPage.bench.test.js +95 -0
- package/dist/__bench__/composedPage.bench.test.js.map +1 -0
- package/dist/__tests__/composed/continuation.test.d.ts +2 -0
- package/dist/__tests__/composed/continuation.test.d.ts.map +1 -0
- package/dist/__tests__/composed/continuation.test.js +352 -0
- package/dist/__tests__/composed/continuation.test.js.map +1 -0
- package/dist/__tests__/composed/contrast.test.d.ts +2 -0
- package/dist/__tests__/composed/contrast.test.d.ts.map +1 -0
- package/dist/__tests__/composed/contrast.test.js +124 -0
- package/dist/__tests__/composed/contrast.test.js.map +1 -0
- package/dist/__tests__/composed/corpus.test.js +7 -1
- package/dist/__tests__/composed/corpus.test.js.map +1 -1
- package/dist/__tests__/composed/fit.test.d.ts +2 -0
- package/dist/__tests__/composed/fit.test.d.ts.map +1 -0
- package/dist/__tests__/composed/fit.test.js +408 -0
- package/dist/__tests__/composed/fit.test.js.map +1 -0
- package/dist/__tests__/composed/groups.test.js +14 -0
- package/dist/__tests__/composed/groups.test.js.map +1 -1
- package/dist/__tests__/composed/headingDesigns.test.d.ts +2 -0
- package/dist/__tests__/composed/headingDesigns.test.d.ts.map +1 -0
- package/dist/__tests__/composed/headingDesigns.test.js +262 -0
- package/dist/__tests__/composed/headingDesigns.test.js.map +1 -0
- package/dist/__tests__/composed/labels.test.d.ts +2 -0
- package/dist/__tests__/composed/labels.test.d.ts.map +1 -0
- package/dist/__tests__/composed/labels.test.js +326 -0
- package/dist/__tests__/composed/labels.test.js.map +1 -0
- package/dist/__tests__/composed/layout.test.js +2 -1
- package/dist/__tests__/composed/layout.test.js.map +1 -1
- package/dist/__tests__/composed/outsidePrint.test.js +5 -2
- package/dist/__tests__/composed/outsidePrint.test.js.map +1 -1
- package/dist/__tests__/composed/pageMemo.test.d.ts +2 -0
- package/dist/__tests__/composed/pageMemo.test.d.ts.map +1 -0
- package/dist/__tests__/composed/pageMemo.test.js +128 -0
- package/dist/__tests__/composed/pageMemo.test.js.map +1 -0
- package/dist/__tests__/composed/sourceMap.test.d.ts +2 -0
- package/dist/__tests__/composed/sourceMap.test.d.ts.map +1 -0
- package/dist/__tests__/composed/sourceMap.test.js +395 -0
- package/dist/__tests__/composed/sourceMap.test.js.map +1 -0
- package/dist/__tests__/composed/spreadLabels.test.d.ts +2 -0
- package/dist/__tests__/composed/spreadLabels.test.d.ts.map +1 -0
- package/dist/__tests__/composed/spreadLabels.test.js +131 -0
- package/dist/__tests__/composed/spreadLabels.test.js.map +1 -0
- package/dist/__tests__/composed/templateFrameRects.test.d.ts +2 -0
- package/dist/__tests__/composed/templateFrameRects.test.d.ts.map +1 -0
- package/dist/__tests__/composed/templateFrameRects.test.js +37 -0
- package/dist/__tests__/composed/templateFrameRects.test.js.map +1 -0
- package/dist/__tests__/design/imageAltText.test.js +2 -1
- package/dist/__tests__/design/imageAltText.test.js.map +1 -1
- package/dist/__tests__/exports.test.js +33 -0
- package/dist/__tests__/exports.test.js.map +1 -1
- package/dist/__tests__/migrate/fixtures/textbookPort.d.ts +14 -0
- package/dist/__tests__/migrate/fixtures/textbookPort.d.ts.map +1 -0
- package/dist/__tests__/migrate/fixtures/textbookPort.js +116 -0
- package/dist/__tests__/migrate/fixtures/textbookPort.js.map +1 -0
- package/dist/__tests__/migrate/textToMarkdown.test.d.ts +2 -0
- package/dist/__tests__/migrate/textToMarkdown.test.d.ts.map +1 -0
- package/dist/__tests__/migrate/textToMarkdown.test.js +268 -0
- package/dist/__tests__/migrate/textToMarkdown.test.js.map +1 -0
- package/dist/__tests__/paragraphStyleLetterSpacing.test.d.ts +2 -0
- package/dist/__tests__/paragraphStyleLetterSpacing.test.d.ts.map +1 -0
- package/dist/__tests__/paragraphStyleLetterSpacing.test.js +89 -0
- package/dist/__tests__/paragraphStyleLetterSpacing.test.js.map +1 -0
- package/dist/__tests__/pictureBelowPrintSize.test.d.ts +2 -0
- package/dist/__tests__/pictureBelowPrintSize.test.d.ts.map +1 -0
- package/dist/__tests__/pictureBelowPrintSize.test.js +82 -0
- package/dist/__tests__/pictureBelowPrintSize.test.js.map +1 -0
- package/dist/__tests__/pipeline/contourWrap.test.d.ts +2 -0
- package/dist/__tests__/pipeline/contourWrap.test.d.ts.map +1 -0
- package/dist/__tests__/pipeline/contourWrap.test.js +412 -0
- package/dist/__tests__/pipeline/contourWrap.test.js.map +1 -0
- package/dist/__tests__/pipeline/paragraphStyleFaces.test.js +1 -1
- package/dist/__tests__/pipeline/paragraphStyleFaces.test.js.map +1 -1
- package/dist/__tests__/toc.test.js +3 -2
- package/dist/__tests__/toc.test.js.map +1 -1
- package/dist/bundle/codec.d.ts +16 -0
- package/dist/bundle/codec.d.ts.map +1 -1
- package/dist/bundle/codec.js +44 -2
- package/dist/bundle/codec.js.map +1 -1
- package/dist/bundle/index.d.ts +1 -1
- package/dist/bundle/index.d.ts.map +1 -1
- package/dist/bundle/index.js +1 -1
- package/dist/bundle/index.js.map +1 -1
- package/dist/canvas-backend/composed.d.ts +5 -2
- package/dist/canvas-backend/composed.d.ts.map +1 -1
- package/dist/canvas-backend/composed.js +10 -5
- package/dist/canvas-backend/composed.js.map +1 -1
- package/dist/canvas-backend/index.d.ts.map +1 -1
- package/dist/canvas-backend/index.js +37 -19
- package/dist/canvas-backend/index.js.map +1 -1
- package/dist/canvas-backend/renderResourceBlock.d.ts +5 -1
- package/dist/canvas-backend/renderResourceBlock.d.ts.map +1 -1
- package/dist/canvas-backend/renderResourceBlock.js +60 -1
- package/dist/canvas-backend/renderResourceBlock.js.map +1 -1
- package/dist/composed/continuation.d.ts +102 -0
- package/dist/composed/continuation.d.ts.map +1 -0
- package/dist/composed/continuation.js +87 -0
- package/dist/composed/continuation.js.map +1 -0
- package/dist/composed/contour.d.ts +21 -0
- package/dist/composed/contour.d.ts.map +1 -0
- package/dist/composed/contour.js +34 -0
- package/dist/composed/contour.js.map +1 -0
- package/dist/composed/geometry.d.ts +8 -0
- package/dist/composed/geometry.d.ts.map +1 -1
- package/dist/composed/geometry.js +26 -0
- package/dist/composed/geometry.js.map +1 -1
- package/dist/composed/ids.d.ts +22 -0
- package/dist/composed/ids.d.ts.map +1 -0
- package/dist/composed/ids.js +32 -0
- package/dist/composed/ids.js.map +1 -0
- package/dist/composed/labels.d.ts +154 -0
- package/dist/composed/labels.d.ts.map +1 -0
- package/dist/composed/labels.js +524 -0
- package/dist/composed/labels.js.map +1 -0
- package/dist/composed/pageMemo.d.ts +73 -0
- package/dist/composed/pageMemo.d.ts.map +1 -0
- package/dist/composed/pageMemo.js +289 -0
- package/dist/composed/pageMemo.js.map +1 -0
- package/dist/composed/paint.d.ts +29 -9
- package/dist/composed/paint.d.ts.map +1 -1
- package/dist/composed/paint.js +41 -7
- package/dist/composed/paint.js.map +1 -1
- package/dist/composed/reflowLog.d.ts +14 -2
- package/dist/composed/reflowLog.d.ts.map +1 -1
- package/dist/composed/reflowLog.js +64 -7
- package/dist/composed/reflowLog.js.map +1 -1
- package/dist/composed/slotChecks.d.ts.map +1 -1
- package/dist/composed/slotChecks.js +3 -1
- package/dist/composed/slotChecks.js.map +1 -1
- package/dist/composed/sourceMap.d.ts +97 -0
- package/dist/composed/sourceMap.d.ts.map +1 -0
- package/dist/composed/sourceMap.js +748 -0
- package/dist/composed/sourceMap.js.map +1 -0
- package/dist/composed/spread.d.ts +3 -0
- package/dist/composed/spread.d.ts.map +1 -1
- package/dist/composed/spread.js +11 -12
- package/dist/composed/spread.js.map +1 -1
- package/dist/composed/templates.d.ts +1 -0
- package/dist/composed/templates.d.ts.map +1 -1
- package/dist/composed/templates.js +4 -0
- package/dist/composed/templates.js.map +1 -1
- package/dist/composed/types.d.ts +15 -32
- package/dist/composed/types.d.ts.map +1 -1
- package/dist/composed/validate.d.ts.map +1 -1
- package/dist/composed/validate.js +3 -2
- package/dist/composed/validate.js.map +1 -1
- package/dist/composed/wrap.d.ts.map +1 -1
- package/dist/composed/wrap.js +7 -1
- package/dist/composed/wrap.js.map +1 -1
- package/dist/configWarnings.d.ts +15 -0
- package/dist/configWarnings.d.ts.map +1 -1
- package/dist/configWarnings.js +29 -17
- package/dist/configWarnings.js.map +1 -1
- package/dist/contour/index.d.ts +134 -0
- package/dist/contour/index.d.ts.map +1 -0
- package/dist/contour/index.js +354 -0
- package/dist/contour/index.js.map +1 -0
- package/dist/contour/png.d.ts +16 -0
- package/dist/contour/png.d.ts.map +1 -0
- package/dist/contour/png.js +173 -0
- package/dist/contour/png.js.map +1 -0
- package/dist/contrast.d.ts +5 -3
- package/dist/contrast.d.ts.map +1 -1
- package/dist/contrast.js +46 -5
- package/dist/contrast.js.map +1 -1
- package/dist/defaults/paragraphStyles.d.ts +1 -1
- package/dist/defaults/paragraphStyles.d.ts.map +1 -1
- package/dist/defaults/paragraphStyles.js +5 -1
- package/dist/defaults/paragraphStyles.js.map +1 -1
- package/dist/design/slots.d.ts +12 -10
- package/dist/design/slots.d.ts.map +1 -1
- package/dist/design/slots.js +26 -2
- package/dist/design/slots.js.map +1 -1
- package/dist/fonts/faces.d.ts.map +1 -1
- package/dist/fonts/faces.js +6 -0
- package/dist/fonts/faces.js.map +1 -1
- package/dist/highlightMarks.d.ts.map +1 -1
- package/dist/highlightMarks.js +6 -0
- package/dist/highlightMarks.js.map +1 -1
- package/dist/html-backend.d.ts.map +1 -1
- package/dist/html-backend.js +42 -4
- package/dist/html-backend.js.map +1 -1
- package/dist/index.d.ts +18 -7
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +18 -4
- package/dist/index.js.map +1 -1
- package/dist/measure/rich.d.ts.map +1 -1
- package/dist/measure/rich.js +2 -0
- package/dist/measure/rich.js.map +1 -1
- package/dist/migrate/markdownRuns.d.ts +70 -0
- package/dist/migrate/markdownRuns.d.ts.map +1 -0
- package/dist/migrate/markdownRuns.js +215 -0
- package/dist/migrate/markdownRuns.js.map +1 -0
- package/dist/migrate/pageDesign.d.ts +119 -0
- package/dist/migrate/pageDesign.d.ts.map +1 -0
- package/dist/migrate/pageDesign.js +446 -0
- package/dist/migrate/pageDesign.js.map +1 -0
- package/dist/migrate/textToMarkdown.d.ts +124 -0
- package/dist/migrate/textToMarkdown.d.ts.map +1 -0
- package/dist/migrate/textToMarkdown.js +716 -0
- package/dist/migrate/textToMarkdown.js.map +1 -0
- package/dist/parse/blockParser.d.ts.map +1 -1
- package/dist/parse/blockParser.js +44 -3
- package/dist/parse/blockParser.js.map +1 -1
- package/dist/parse/types.d.ts +20 -0
- package/dist/parse/types.d.ts.map +1 -1
- package/dist/pipeline/build.d.ts.map +1 -1
- package/dist/pipeline/build.js +298 -30
- package/dist/pipeline/build.js.map +1 -1
- package/dist/pipeline/buildMeasurement.d.ts +7 -2
- package/dist/pipeline/buildMeasurement.d.ts.map +1 -1
- package/dist/pipeline/buildMeasurement.js +21 -5
- package/dist/pipeline/buildMeasurement.js.map +1 -1
- package/dist/pipeline/calloutLayout.d.ts +39 -14
- package/dist/pipeline/calloutLayout.d.ts.map +1 -1
- package/dist/pipeline/calloutLayout.js +50 -4
- package/dist/pipeline/calloutLayout.js.map +1 -1
- package/dist/pipeline/composedLayout.d.ts +51 -6
- package/dist/pipeline/composedLayout.d.ts.map +1 -1
- package/dist/pipeline/composedLayout.js +633 -78
- package/dist/pipeline/composedLayout.js.map +1 -1
- package/dist/pipeline/contentWarnings.d.ts +15 -0
- package/dist/pipeline/contentWarnings.d.ts.map +1 -1
- package/dist/pipeline/contentWarnings.js +98 -4
- package/dist/pipeline/contentWarnings.js.map +1 -1
- package/dist/pipeline/floatPlacement.d.ts +2 -0
- package/dist/pipeline/floatPlacement.d.ts.map +1 -1
- package/dist/pipeline/floatPlacement.js +1 -0
- package/dist/pipeline/floatPlacement.js.map +1 -1
- package/dist/pipeline/frameLayout.d.ts +7 -4
- package/dist/pipeline/frameLayout.d.ts.map +1 -1
- package/dist/pipeline/frameLayout.js +5 -2
- package/dist/pipeline/frameLayout.js.map +1 -1
- package/dist/pipeline/headerFooter.d.ts +20 -1
- package/dist/pipeline/headerFooter.d.ts.map +1 -1
- package/dist/pipeline/headerFooter.js +225 -70
- package/dist/pipeline/headerFooter.js.map +1 -1
- package/dist/pipeline/measureContentBlock.d.ts.map +1 -1
- package/dist/pipeline/measureContentBlock.js +1 -0
- package/dist/pipeline/measureContentBlock.js.map +1 -1
- package/dist/pipeline/mirrorFrame.d.ts.map +1 -1
- package/dist/pipeline/mirrorFrame.js +25 -2
- package/dist/pipeline/mirrorFrame.js.map +1 -1
- package/dist/pipeline/outline.d.ts.map +1 -1
- package/dist/pipeline/outline.js +2 -0
- package/dist/pipeline/outline.js.map +1 -1
- package/dist/pipeline/resourceLayout.d.ts +28 -0
- package/dist/pipeline/resourceLayout.d.ts.map +1 -1
- package/dist/pipeline/resourceLayout.js +21 -0
- package/dist/pipeline/resourceLayout.js.map +1 -1
- package/dist/pipeline/styles.d.ts +1 -1
- package/dist/pipeline/styles.d.ts.map +1 -1
- package/dist/pipeline/styles.js +4 -0
- package/dist/pipeline/styles.js.map +1 -1
- package/dist/pipeline/textWrap.d.ts +4 -1
- package/dist/pipeline/textWrap.d.ts.map +1 -1
- package/dist/pipeline/textWrap.js +17 -3
- package/dist/pipeline/textWrap.js.map +1 -1
- package/dist/pipeline/toc.d.ts.map +1 -1
- package/dist/pipeline/toc.js +1 -0
- package/dist/pipeline/toc.js.map +1 -1
- package/dist/types.d.ts +77 -2
- package/dist/types.d.ts.map +1 -1
- package/dist/vdt.d.ts +290 -15
- package/dist/vdt.d.ts.map +1 -1
- package/dist/vdt.js.map +1 -1
- package/dist/word/toDocx.d.ts.map +1 -1
- package/dist/word/toDocx.js +14 -0
- package/dist/word/toDocx.js.map +1 -1
- package/dist/word/word.test.js +11 -1
- package/dist/word/word.test.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":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M,CAAC,aAAa,CAAC,IAAI,EAAE,MAAM,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;QAClE,MAAM,CAAC,aAAa,CAAC,IAAI,EAAE,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QACzD,MAAM,CAAC,aAAa,CAAC,OAAO,EAAE,MAAM,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,uBAAuB,CAAC,CAAC;IAC1F,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,kGAAkG,EAAE,GAAG,EAAE;QAC1G,uEAAuE;QACvE,+DAA+D;QAC/D,MAAM,IAAI,GAAG,mBAAmB,CAAC,KAAK,CAAC,GAAG,MAAM,IAAI,CAAC,EAAE,EAAE,gBAAgB,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,uBAAuB,EAAE,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAE,CAAC,SAAS,CAAC;QACtI,MAAM,CAAC,IAAI,CAAC,CAAC,SAAS,CAAC,0CAA0C,CAAC,CAAC;QACnE,MAAM,CAAC,IAAI,CAAC,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC;IACrC,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pageMemo.test.d.ts","sourceRoot":"","sources":["../../../src/__tests__/composed/pageMemo.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import { describe, it, expect, beforeEach, afterAll } from 'vitest';
|
|
2
|
+
import { buildDocument } from '../../pipeline/build';
|
|
3
|
+
import { createMeasurementCache } from '../../measure';
|
|
4
|
+
import { clearComposedPageMemo, composedPageMemoStats, setComposedPageMemo } from '../../composed/pageMemo';
|
|
5
|
+
import { page8Fixture } from './fixtures/page8';
|
|
6
|
+
// Seven px per character, whatever the face (no DOM in node).
|
|
7
|
+
class StubCtx {
|
|
8
|
+
font = '';
|
|
9
|
+
measureText(s) {
|
|
10
|
+
return { width: s.length * 7 };
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
globalThis.OffscreenCanvas = class {
|
|
14
|
+
getContext() {
|
|
15
|
+
return new StubCtx();
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
const { markdown: PAGE8, config, resources } = page8Fixture('es');
|
|
19
|
+
/** A chapter of `n` p. 8 pages, the k-th page's theme `Tema k`. */
|
|
20
|
+
const chapter = (n) => Array.from({ length: n }, (_, k) => PAGE8.replace('tema="Retos del planeta"', `tema="Tema ${k + 1}"`)).join('\n');
|
|
21
|
+
/** Change the `k`-th (0-based) page of `md` with `edit`. */
|
|
22
|
+
const onPage = (md, k, edit) => {
|
|
23
|
+
const pages = md.split(/(?=::::page\{)/);
|
|
24
|
+
pages[k] = edit(pages[k]);
|
|
25
|
+
return pages.join('');
|
|
26
|
+
};
|
|
27
|
+
const build = (md, cfg = config) => buildDocument({ markdown: md, resources }, cfg, createMeasurementCache());
|
|
28
|
+
/** What a reader of the document sees: pages, blocks and warnings. */
|
|
29
|
+
const shape = (doc) => JSON.stringify({ pages: doc.pages, blocks: doc.blocks, warnings: doc.contentWarnings ?? [] }, (k, v) => (k === 'layoutKey' ? undefined : v));
|
|
30
|
+
/** The document laid out with every composed page set afresh. */
|
|
31
|
+
const fresh = (md, cfg) => {
|
|
32
|
+
setComposedPageMemo(false);
|
|
33
|
+
try {
|
|
34
|
+
return shape(build(md, cfg));
|
|
35
|
+
}
|
|
36
|
+
finally {
|
|
37
|
+
setComposedPageMemo(true);
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
const delta = (before) => {
|
|
41
|
+
const now = composedPageMemoStats();
|
|
42
|
+
return { hits: now.hits - before.hits, misses: now.misses - before.misses, skipped: now.skipped - before.skipped };
|
|
43
|
+
};
|
|
44
|
+
describe('composed pages laid out once, reused where they did not change (#857)', () => {
|
|
45
|
+
beforeEach(() => clearComposedPageMemo());
|
|
46
|
+
afterAll(() => clearComposedPageMemo());
|
|
47
|
+
it('a reused page is the page laid out afresh, wherever the page now stands', () => {
|
|
48
|
+
const md = chapter(4);
|
|
49
|
+
const expected = fresh(md);
|
|
50
|
+
const variants = [
|
|
51
|
+
md,
|
|
52
|
+
// Two pages of text before the pages (each page keeps its side):
|
|
53
|
+
// every offset and content index moves.
|
|
54
|
+
`Una línea antes.\n\n:::pagebreak\n\nOtra línea.\n\n${md}`,
|
|
55
|
+
// Front matter: the body moves in the file.
|
|
56
|
+
`---\ntitle: Tema\n---\n${md}`,
|
|
57
|
+
// A box on the first page: the container ids of the pages after it move.
|
|
58
|
+
onPage(md, 0, (p) => p.replace('::resource{id="foto-dinero" slot="dinero-fotos"}', '::resource{id="foto-dinero" slot="dinero-fotos"}\n\n:::callout\nNota.\n:::')),
|
|
59
|
+
];
|
|
60
|
+
for (const v of variants) {
|
|
61
|
+
clearComposedPageMemo();
|
|
62
|
+
build(v);
|
|
63
|
+
const before = composedPageMemoStats();
|
|
64
|
+
const doc = build(md);
|
|
65
|
+
expect(delta(before).hits).toBeGreaterThan(0);
|
|
66
|
+
expect(shape(doc)).toBe(expected);
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
it('an edit inside one page sets that page alone', () => {
|
|
70
|
+
const md = chapter(20);
|
|
71
|
+
build(md);
|
|
72
|
+
const before = composedPageMemoStats();
|
|
73
|
+
const edited = onPage(md, 7, (p) => p.replace('El dinero nos deja', 'El dinero, que tanto cuesta ganar, nos deja'));
|
|
74
|
+
const doc = build(edited);
|
|
75
|
+
const d = delta(before);
|
|
76
|
+
expect(d.misses).toBe(1);
|
|
77
|
+
expect(d.skipped).toBe(0);
|
|
78
|
+
expect(d.hits).toBeGreaterThanOrEqual(19);
|
|
79
|
+
expect(shape(doc)).toBe(fresh(edited));
|
|
80
|
+
});
|
|
81
|
+
it('a property of one page (its fence’s attribute) sets that page alone', () => {
|
|
82
|
+
const md = chapter(20);
|
|
83
|
+
build(md);
|
|
84
|
+
const before = composedPageMemoStats();
|
|
85
|
+
const edited = onPage(md, 12, (p) => p.replace(/tema="Tema \d+"/, 'tema="Otro tema"'));
|
|
86
|
+
const doc = build(edited);
|
|
87
|
+
expect(delta(before).misses).toBe(1);
|
|
88
|
+
expect(shape(doc)).toBe(fresh(edited));
|
|
89
|
+
});
|
|
90
|
+
it('a change of the template every page uses sets every page', () => {
|
|
91
|
+
const md = chapter(5);
|
|
92
|
+
build(md);
|
|
93
|
+
const before = composedPageMemoStats();
|
|
94
|
+
const cfg = JSON.parse(JSON.stringify(config));
|
|
95
|
+
cfg.pageTemplates[0].frames[2].padding = { right: { value: 50, unit: 'mm' } };
|
|
96
|
+
const doc = build(md, cfg);
|
|
97
|
+
expect(delta(before).misses).toBe(5);
|
|
98
|
+
expect(shape(doc)).toBe(fresh(md, cfg));
|
|
99
|
+
});
|
|
100
|
+
it('a page whose layout reads what its key does not hold is always laid out afresh', () => {
|
|
101
|
+
const md = onPage(chapter(3), 1, (p) => p.replace('El dinero nos deja', 'El dinero[^n] nos deja').replace('::::\n', '::::\n\n[^n]: Una nota.\n'));
|
|
102
|
+
build(md);
|
|
103
|
+
const before = composedPageMemoStats();
|
|
104
|
+
const doc = build(md);
|
|
105
|
+
const d = delta(before);
|
|
106
|
+
expect(d.skipped).toBeGreaterThan(0);
|
|
107
|
+
expect(d.hits).toBeGreaterThan(0);
|
|
108
|
+
expect(shape(doc)).toBe(fresh(md));
|
|
109
|
+
});
|
|
110
|
+
it('the same frames carry the same layout key; a changed page another', () => {
|
|
111
|
+
const md = chapter(3);
|
|
112
|
+
const a = build(md);
|
|
113
|
+
const b = build(onPage(md, 1, (p) => p.replace('El dinero nos deja', 'El dinero hoy nos deja')));
|
|
114
|
+
const keys = (d) => d.pages.filter((p) => p.composed).map((p) => p.composed.layoutKey);
|
|
115
|
+
expect(keys(a).every((k) => typeof k === 'string')).toBe(true);
|
|
116
|
+
expect(keys(b)[0]).toBe(keys(a)[0]);
|
|
117
|
+
expect(keys(b)[1]).not.toBe(keys(a)[1]);
|
|
118
|
+
expect(keys(b)[2]).toBe(keys(a)[2]);
|
|
119
|
+
});
|
|
120
|
+
it('pages of another locale are not taken for these', () => {
|
|
121
|
+
const en = page8Fixture('en');
|
|
122
|
+
build(chapter(2));
|
|
123
|
+
const before = composedPageMemoStats();
|
|
124
|
+
buildDocument({ markdown: en.markdown, resources: en.resources }, en.config, createMeasurementCache());
|
|
125
|
+
expect(delta(before).hits).toBe(0);
|
|
126
|
+
});
|
|
127
|
+
});
|
|
128
|
+
//# sourceMappingURL=pageMemo.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pageMemo.test.js","sourceRoot":"","sources":["../../../src/__tests__/composed/pageMemo.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AACpE,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAC;AACvD,OAAO,EAAE,qBAAqB,EAAE,qBAAqB,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAE5G,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAEhD,8DAA8D;AAC9D,MAAM,OAAO;IACX,IAAI,GAAG,EAAE,CAAC;IACV,WAAW,CAAC,CAAS;QACnB,OAAO,EAAE,KAAK,EAAE,CAAC,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;IACjC,CAAC;CACF;AACA,UAAsD,CAAC,eAAe,GAAG;IACxE,UAAU;QACR,OAAO,IAAI,OAAO,EAAE,CAAC;IACvB,CAAC;CACF,CAAC;AAEF,MAAM,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE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AC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sourceMap.test.d.ts","sourceRoot":"","sources":["../../../src/__tests__/composed/sourceMap.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,395 @@
|
|
|
1
|
+
import { describe, it, expect } from 'vitest';
|
|
2
|
+
import { buildDocument } from '../../pipeline/build';
|
|
3
|
+
import { createMeasurementCache } from '../../measure';
|
|
4
|
+
import { parseMarkdown } from '../../parse';
|
|
5
|
+
import { elementsForSource, findElement, sourceAt } from '../../composed/sourceMap';
|
|
6
|
+
import { page8Fixture } from './fixtures/page8';
|
|
7
|
+
// Seven px per character, whatever the face (no DOM in node).
|
|
8
|
+
class StubCtx {
|
|
9
|
+
font = '';
|
|
10
|
+
measureText(s) {
|
|
11
|
+
return { width: s.length * 7 };
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
globalThis.OffscreenCanvas = class {
|
|
15
|
+
getContext() {
|
|
16
|
+
return new StubCtx();
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
const mm = (value) => ({ value, unit: 'mm' });
|
|
20
|
+
const PAGE = {
|
|
21
|
+
page: { width: mm(200), height: mm(260), margins: { top: mm(20), bottom: mm(20), left: mm(20), right: mm(20) } },
|
|
22
|
+
headings: { balancing: { enabled: false }, levels: [{ level: 1, breakBefore: { enabled: false } }] },
|
|
23
|
+
};
|
|
24
|
+
const page8 = (locale, edit) => {
|
|
25
|
+
const { markdown, config, resources } = page8Fixture(locale);
|
|
26
|
+
const md = edit ? edit(markdown) : markdown;
|
|
27
|
+
return { md, doc: buildDocument({ markdown: md, resources }, config, createMeasurementCache()) };
|
|
28
|
+
};
|
|
29
|
+
const composed = (doc) => doc.pages.find((p) => p.composed);
|
|
30
|
+
const frameBlocks = (page) => {
|
|
31
|
+
const ids = new Set(page.composed.frames.flatMap((f) => f.blockIds));
|
|
32
|
+
return (page.floats ?? []).filter((b) => ids.has(b.id));
|
|
33
|
+
};
|
|
34
|
+
const levels = (chain) => chain.map((e) => e.level);
|
|
35
|
+
const centre = (r) => ({ x: r.x + r.width / 2, y: r.y + r.height / 2 });
|
|
36
|
+
/** The glyphs a line paints, in logical order, spaces left out. */
|
|
37
|
+
function paintedGlyphs(line) {
|
|
38
|
+
let out = '';
|
|
39
|
+
const segs = line.segments ?? [];
|
|
40
|
+
segs.forEach((s, i) => {
|
|
41
|
+
if (s.kind === 'space' || s.inserted || s.leader !== undefined)
|
|
42
|
+
return;
|
|
43
|
+
if (s.chip) {
|
|
44
|
+
out += s.chip.runs.map((r) => r.text).join('');
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
let t = s.text;
|
|
48
|
+
if (i === segs.length - 1 && line.hyphenated && !line.hardHyphen && t.endsWith('-'))
|
|
49
|
+
t = t.slice(0, -1);
|
|
50
|
+
out += t;
|
|
51
|
+
});
|
|
52
|
+
return out.replace(/\s+/g, '');
|
|
53
|
+
}
|
|
54
|
+
describe('source map of a composed page (#857)', () => {
|
|
55
|
+
for (const locale of ['es', 'en']) {
|
|
56
|
+
it(`every glyph of the ${locale} p. 8 stand-in resolves to its exact source`, () => {
|
|
57
|
+
const { md, doc } = page8(locale);
|
|
58
|
+
const page = composed(doc);
|
|
59
|
+
let glyphs = 0;
|
|
60
|
+
for (const block of frameBlocks(page)) {
|
|
61
|
+
if (block.type === 'callout' || block.resourceBlock)
|
|
62
|
+
continue;
|
|
63
|
+
for (const line of block.lines) {
|
|
64
|
+
if (line.plainStart === undefined || line.plainEnd === undefined || line.plainEnd <= line.plainStart)
|
|
65
|
+
continue;
|
|
66
|
+
// Sweep the line: each glyph sourceAt finds, read back from the
|
|
67
|
+
// Markdown, in order, is the line as painted.
|
|
68
|
+
const y = line.bbox.y + line.bbox.height / 2;
|
|
69
|
+
const right = block.bbox.x + block.bbox.width;
|
|
70
|
+
const found = [];
|
|
71
|
+
for (let x = line.bbox.x + 0.5; x < right; x += 2) {
|
|
72
|
+
const hit = sourceAt(doc, page.index, x, y)[0];
|
|
73
|
+
if (!hit || hit.level !== 'text' || hit.source.kind !== 'markdown')
|
|
74
|
+
continue;
|
|
75
|
+
if (found[found.length - 1] !== hit.source.start)
|
|
76
|
+
found.push(hit.source.start);
|
|
77
|
+
}
|
|
78
|
+
const read = [...new Set(found)].map((o) => md[o]).join('').replace(/\s+/g, '');
|
|
79
|
+
expect(read).toBe(paintedGlyphs(line));
|
|
80
|
+
glyphs += read.length;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
expect(glyphs).toBeGreaterThan(600);
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
it('a glyph in a frame answers with its line, paragraph, frame and template', () => {
|
|
87
|
+
const { md, doc } = page8('es');
|
|
88
|
+
const page = composed(doc);
|
|
89
|
+
const f = page.composed.frames.find((x) => x.name === 'dinero');
|
|
90
|
+
const para = page.floats.find((b) => b.id === f.blockIds[1]);
|
|
91
|
+
const line = para.lines[0];
|
|
92
|
+
const chain = sourceAt(doc, page.index, line.bbox.x + 3, line.bbox.y + line.bbox.height / 2);
|
|
93
|
+
// The three boxes of the stand-in stack as one group (#856).
|
|
94
|
+
expect(levels(chain)).toEqual(['text', 'line', 'block', 'frame', 'group', 'template']);
|
|
95
|
+
const [text, , block, frame, group, template] = chain;
|
|
96
|
+
expect(group).toMatchObject({ id: 'cp0:group:cajas', source: { kind: 'config', path: '/pageTemplates/0/groups/0' } });
|
|
97
|
+
expect(text.source).toEqual({ kind: 'markdown', start: para.sourceStart, end: para.sourceStart + 1 });
|
|
98
|
+
expect(md[para.sourceStart]).toBe('E');
|
|
99
|
+
expect(block.id).toBe('cp0:dinero-c0');
|
|
100
|
+
expect(frame).toMatchObject({ id: 'cp0:dinero', source: { kind: 'config', path: '/pageTemplates/0/frames/2' }, content: { start: f.sourceStart, end: f.sourceEnd } });
|
|
101
|
+
expect(template).toMatchObject({ id: 'cp0', source: { kind: 'config', path: '/pageTemplates/0' }, content: { start: page.composed.sourceStart, end: page.composed.sourceEnd } });
|
|
102
|
+
});
|
|
103
|
+
it('a chip’s words map character by character', () => {
|
|
104
|
+
const { md, doc } = page8('es');
|
|
105
|
+
const page = composed(doc);
|
|
106
|
+
for (const block of frameBlocks(page)) {
|
|
107
|
+
for (const line of block.lines) {
|
|
108
|
+
for (const seg of line.segments ?? []) {
|
|
109
|
+
if (!seg.chip)
|
|
110
|
+
continue;
|
|
111
|
+
const words = seg.chip.runs.map((r) => r.text).join('');
|
|
112
|
+
expect(seg.chip.sourceOffsets).toHaveLength(words.length);
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
// Read through the block maps: each chip's words, written as they print.
|
|
117
|
+
const texto = page.floats.find((b) => b.id === 'cp0:texto-c1');
|
|
118
|
+
const chipSegs = texto.lines.flatMap((l) => (l.segments ?? []).filter((s) => s.chip));
|
|
119
|
+
const starts = [...md.matchAll(/:chip\[/g)].map((m) => m.index).filter((i) => i >= texto.sourceStart && i < texto.sourceEnd);
|
|
120
|
+
chipSegs.forEach((s, i) => {
|
|
121
|
+
const words = s.chip.runs.map((r) => r.text).join('');
|
|
122
|
+
expect(s.chip.sourceOffsets.map((o) => md[starts[i] + o]).join('')).toBe(words);
|
|
123
|
+
});
|
|
124
|
+
});
|
|
125
|
+
it('a frame’s tab maps to its label attribute; the decoration to the template and the fence', () => {
|
|
126
|
+
const { md, doc } = page8('es');
|
|
127
|
+
const page = composed(doc);
|
|
128
|
+
const box = page.floats.find((b) => b.id === 'cp0:dinero');
|
|
129
|
+
const tab = box.designOverlay.blocks.find((b) => b.kind === 'text');
|
|
130
|
+
const tabHit = sourceAt(doc, page.index, tab.bbox.x + tab.bbox.width / 2, tab.bbox.y + tab.bbox.height / 2);
|
|
131
|
+
expect(tabHit[0].source.kind).toBe('attr');
|
|
132
|
+
const label = tabHit[0].source;
|
|
133
|
+
expect(label.name).toBe('label');
|
|
134
|
+
// The glyph under the middle of the tab, in the attribute's value.
|
|
135
|
+
expect(label.end - label.start).toBe(1);
|
|
136
|
+
expect(md.slice(tab.sourceStart, tab.sourceEnd)).toBe('Para qué sirve el dinero');
|
|
137
|
+
expect(label.start).toBeGreaterThanOrEqual(tab.sourceStart);
|
|
138
|
+
expect(label.end).toBeLessThanOrEqual(tab.sourceEnd);
|
|
139
|
+
expect(levels(tabHit)).toEqual(['text', 'frame', 'group', 'template']);
|
|
140
|
+
const deco = page.composed.decoration.blocks;
|
|
141
|
+
const tema = deco.find((b) => b.elementId === 'tema');
|
|
142
|
+
const temaHit = sourceAt(doc, page.index, ...Object.values(centre(tema.bbox)));
|
|
143
|
+
expect(temaHit[0].source).toMatchObject({ kind: 'attr', name: 'tema' });
|
|
144
|
+
const src = temaHit[0].source;
|
|
145
|
+
expect('Retos del planeta').toContain(md[src.start]);
|
|
146
|
+
expect(temaHit[1]).toMatchObject({ level: 'design', id: 'cp0:decoration:tema', source: { kind: 'config', path: '/pageTemplates/0/decoration/elements/2' } });
|
|
147
|
+
expect(temaHit[2]).toMatchObject({ level: 'slot', source: { kind: 'config', path: '/pageTemplates/0/decoration' } });
|
|
148
|
+
expect(temaHit[3].level).toBe('template');
|
|
149
|
+
// The picture of the band, picked by `{attr.fondo}`: the attribute, the
|
|
150
|
+
// resource, the element. Probed off the white card and the frames.
|
|
151
|
+
const fondo = deco.find((b) => b.elementId === 'fondo');
|
|
152
|
+
const corner = sourceAt(doc, page.index, fondo.bbox.x + 5, fondo.bbox.y + 5);
|
|
153
|
+
expect(levels(corner)).toEqual(['attr', 'resource', 'design', 'slot', 'template']);
|
|
154
|
+
expect(corner[0].source).toMatchObject({ kind: 'attr', name: 'fondo', start: page.composed.attrSources.fondo.sourceStart });
|
|
155
|
+
expect(corner[1].source).toEqual({ kind: 'resource', resourceId: 'banda-tema' });
|
|
156
|
+
const card = deco.find((b) => b.elementId === 'tarjeta');
|
|
157
|
+
const cardHit = sourceAt(doc, page.index, card.bbox.x + 2, card.bbox.y + card.bbox.height - 2);
|
|
158
|
+
expect(cardHit[0]).toMatchObject({ level: 'design', id: 'cp0:decoration:tarjeta', source: { kind: 'config', path: '/pageTemplates/0/decoration/elements/1' } });
|
|
159
|
+
const folio = page.footer.blocks[0];
|
|
160
|
+
const folioHit = sourceAt(doc, page.index, ...Object.values(centre(folio.bbox)));
|
|
161
|
+
expect(folioHit[0]).toMatchObject({ level: 'design', id: 'cp0:footer:folio', source: { kind: 'config', path: '/footer/elements/0' } });
|
|
162
|
+
expect(folioHit[1]).toMatchObject({ level: 'slot', source: { kind: 'config', path: '/footer' } });
|
|
163
|
+
});
|
|
164
|
+
it('a picture in a frame answers with its resource', () => {
|
|
165
|
+
const { doc } = page8('es');
|
|
166
|
+
const page = composed(doc);
|
|
167
|
+
const f = page.composed.frames.find((x) => x.name === 'gasto-fotos');
|
|
168
|
+
const pic = page.floats.find((b) => b.id === f.blockIds[1]);
|
|
169
|
+
const chain = sourceAt(doc, page.index, ...Object.values(centre(pic.bbox)));
|
|
170
|
+
expect(chain[0]).toMatchObject({ level: 'resource', source: { kind: 'resource', resourceId: 'foto-gasto' } });
|
|
171
|
+
expect(chain.find((e) => e.level === 'frame').id).toBe('cp0:gasto-fotos');
|
|
172
|
+
});
|
|
173
|
+
it('a group of frames stands between the frame and the template', () => {
|
|
174
|
+
const tpl = {
|
|
175
|
+
id: 'g',
|
|
176
|
+
frames: [{ name: 'a', flow: true, width: mm(80) }, { name: 'b', width: mm(80), placement: { anchor: { to: '#a', edge: 'below' } } }],
|
|
177
|
+
groups: [{ name: 'col', frames: ['a', 'b'] }],
|
|
178
|
+
};
|
|
179
|
+
const doc = buildDocument({ markdown: '::::page{template="g"}\nFirst words.\n\n:::frame{slot="b"}\nSecond.\n:::\n::::' }, { ...PAGE, pageTemplates: [tpl] }, createMeasurementCache());
|
|
180
|
+
const page = composed(doc);
|
|
181
|
+
const b = page.floats.find((x) => x.id === 'cp0:b-c0');
|
|
182
|
+
const chain = sourceAt(doc, page.index, b.lines[0].bbox.x + 2, b.lines[0].bbox.y + 2);
|
|
183
|
+
expect(levels(chain)).toEqual(['text', 'line', 'block', 'frame', 'group', 'template']);
|
|
184
|
+
expect(chain[4]).toMatchObject({ id: 'cp0:group:col', source: { kind: 'config', path: '/pageTemplates/0/groups/0' } });
|
|
185
|
+
});
|
|
186
|
+
it('a turned frame is hit in its own upright box', () => {
|
|
187
|
+
const tpl = { id: 'r', frames: [{ name: 'a', flow: true, width: mm(60), rotate: 90, placement: { anchor: { to: 'container', edge: 'center' } } }] };
|
|
188
|
+
const doc = buildDocument({ markdown: '::::page{template="r"}\nTurned words here.\n::::' }, { ...PAGE, pageTemplates: [tpl] }, createMeasurementCache());
|
|
189
|
+
const page = composed(doc);
|
|
190
|
+
const f = page.composed.frames[0];
|
|
191
|
+
const line = page.floats.find((x) => x.id === 'cp0:a-c0').lines[0];
|
|
192
|
+
// The line's first glyph, turned a quarter clockwise about the frame's centre.
|
|
193
|
+
const cx = f.rect.x + f.rect.width / 2;
|
|
194
|
+
const cy = f.rect.y + f.rect.height / 2;
|
|
195
|
+
const ux = line.bbox.x + 3 - cx;
|
|
196
|
+
const uy = line.bbox.y + line.bbox.height / 2 - cy;
|
|
197
|
+
const chain = sourceAt(doc, page.index, cx - uy, cy + ux);
|
|
198
|
+
expect(chain[0]).toMatchObject({ level: 'text' });
|
|
199
|
+
expect(chain.find((e) => e.level === 'frame')).toMatchObject({ id: 'cp0:a', rotate: 90 });
|
|
200
|
+
});
|
|
201
|
+
it('`{attr.x}` in a composed page’s running head maps to the page fence', () => {
|
|
202
|
+
const md = '::::page{template="h" tema="Savings"}\nText.\n::::';
|
|
203
|
+
const doc = buildDocument({ markdown: md }, { ...PAGE, pageTemplates: [{ id: 'h', frames: [{ name: 'f', flow: true }] }], header: { elements: [{ kind: 'text', id: 'x', content: '{attr.tema}', placement: { anchor: { to: 'container', edge: 'top-left' } } }] } }, createMeasurementCache());
|
|
204
|
+
const page = composed(doc);
|
|
205
|
+
const head = page.header.blocks[0];
|
|
206
|
+
const chain = sourceAt(doc, page.index, head.bbox.x + 2, head.bbox.y + head.bbox.height / 2);
|
|
207
|
+
expect(chain[0].source).toMatchObject({ kind: 'attr', name: 'tema' });
|
|
208
|
+
const s = chain[0].source;
|
|
209
|
+
expect(md[s.start]).toBe('S');
|
|
210
|
+
expect(chain[1]).toMatchObject({ level: 'design', id: 'cp0:header:x', source: { kind: 'config', path: '/header/elements/0' } });
|
|
211
|
+
});
|
|
212
|
+
it('names the file the host gives', () => {
|
|
213
|
+
const { doc } = page8('es');
|
|
214
|
+
const page = composed(doc);
|
|
215
|
+
const f = page.composed.frames.find((x) => x.name === 'texto');
|
|
216
|
+
const chain = sourceAt(doc, page.index, f.rect.x + 30, f.rect.y + 30, { file: 'tema-1.md' });
|
|
217
|
+
expect(chain[0].source).toMatchObject({ file: 'tema-1.md' });
|
|
218
|
+
});
|
|
219
|
+
});
|
|
220
|
+
describe('the reverse: what a range of the Markdown became (#857)', () => {
|
|
221
|
+
it('a word finds its line, paragraph, frame and composed page', () => {
|
|
222
|
+
const { md, doc } = page8('es');
|
|
223
|
+
const at = md.indexOf('instrumento') >= 0 ? md.indexOf('instrumento') : md.indexOf('trabajo por');
|
|
224
|
+
const hits = elementsForSource(doc, at, at + 7);
|
|
225
|
+
const ids = hits.map((h) => `${h.element.level}:${h.element.id}`);
|
|
226
|
+
expect(ids).toContain('template:cp0');
|
|
227
|
+
expect(ids).toContain('frame:cp0:dinero');
|
|
228
|
+
expect(ids).toContain('block:cp0:dinero-c0');
|
|
229
|
+
expect(ids.some((i) => i.startsWith('line:cp0:dinero-c0:l'))).toBe(true);
|
|
230
|
+
expect(hits.every((h) => h.pageIndex === 0)).toBe(true);
|
|
231
|
+
});
|
|
232
|
+
it('an attribute of the page fence finds the design text that shows it', () => {
|
|
233
|
+
const { md, doc } = page8('es');
|
|
234
|
+
const at = md.indexOf('Retos');
|
|
235
|
+
const hits = elementsForSource(doc, at, at + 5);
|
|
236
|
+
expect(hits.map((h) => h.element.id)).toContain('cp0:decoration:tema');
|
|
237
|
+
});
|
|
238
|
+
it('text laid past a frame’s foot stays in the source map, marked clipped', () => {
|
|
239
|
+
const words = Array.from({ length: 200 }, (_, i) => `word${i}`).join(' ');
|
|
240
|
+
const md = `::::page{template="c"}\n${words}\n::::`;
|
|
241
|
+
const doc = buildDocument({ markdown: md }, { ...PAGE, pageTemplates: [{ id: 'c', frames: [{ name: 'a', flow: true, width: mm(40), height: mm(20) }] }] }, createMeasurementCache());
|
|
242
|
+
const at = md.indexOf('word199');
|
|
243
|
+
const hits = elementsForSource(doc, at, at + 7);
|
|
244
|
+
expect(hits.some((h) => h.element.level === 'line' && h.element.clipped)).toBe(true);
|
|
245
|
+
});
|
|
246
|
+
it('finds an element by its stable id', () => {
|
|
247
|
+
const { doc } = page8('es');
|
|
248
|
+
expect(findElement(doc, 'cp0:gasto').element).toMatchObject({ level: 'frame', source: { path: '/pageTemplates/0/frames/4' } });
|
|
249
|
+
expect(findElement(doc, 'cp0').element.level).toBe('template');
|
|
250
|
+
expect(findElement(doc, 'cp0:decoration:tema').element.level).toBe('design');
|
|
251
|
+
expect(findElement(doc, 'cp0:ahorro-c0').element.level).toBe('block');
|
|
252
|
+
expect(findElement(doc, 'cp9:nothing')).toBeUndefined();
|
|
253
|
+
});
|
|
254
|
+
});
|
|
255
|
+
describe('stable ids (#857)', () => {
|
|
256
|
+
const ids = (doc) => {
|
|
257
|
+
const page = composed(doc);
|
|
258
|
+
return [
|
|
259
|
+
...page.composed.frames.flatMap((f) => [f.id, ...f.blockIds]),
|
|
260
|
+
...(page.composed.decoration?.blocks ?? []).map((b) => b.elementId ?? ''),
|
|
261
|
+
];
|
|
262
|
+
};
|
|
263
|
+
it('are the same in both locales of the stand-in', () => {
|
|
264
|
+
expect(ids(page8('en').doc)).toEqual(ids(page8('es').doc));
|
|
265
|
+
});
|
|
266
|
+
it('survive a relayout after an edit inside a frame and before the page', () => {
|
|
267
|
+
const before = ids(page8('es').doc);
|
|
268
|
+
expect(ids(page8('es', (m) => m.replace('El dinero nos deja', 'El dinero, que cuesta ganar, nos deja')).doc)).toEqual(before);
|
|
269
|
+
expect(ids(page8('es', (m) => `---\ntitle: Tema 1\n---\n${m}`).doc)).toEqual(before);
|
|
270
|
+
});
|
|
271
|
+
it('a label of a figure on a composed page takes its id and anchor', () => {
|
|
272
|
+
const md = '::::page{template="t"}\n:::frame{slot="mapa"}\n:::figure{resource="europa"}\n::label[Madrid]{at="madrid"}\n::label[Mar]{at="62% 48%"}\n:::\n:::\n::::';
|
|
273
|
+
const blocks = parseMarkdown(md);
|
|
274
|
+
const fig = blocks.find((b) => b.figure);
|
|
275
|
+
expect(fig.figure.labels.map((l) => [l.id, l.anchorRef])).toEqual([
|
|
276
|
+
['cp0:mapa:label:madrid', 'europa#madrid'],
|
|
277
|
+
['cp0:mapa:label:@1', undefined],
|
|
278
|
+
]);
|
|
279
|
+
// Outside a composed page: the anchor, no id.
|
|
280
|
+
const flow = parseMarkdown(':::figure{resource="europa"}\n::label[Madrid]{at="madrid"}\n:::').find((b) => b.figure);
|
|
281
|
+
expect(flow.figure.labels[0]).toMatchObject({ anchorRef: 'europa#madrid' });
|
|
282
|
+
expect(flow.figure.labels[0].id).toBeUndefined();
|
|
283
|
+
});
|
|
284
|
+
});
|
|
285
|
+
describe('contents entries point at their headings (#857)', () => {
|
|
286
|
+
it('stamps the heading’s body offset on each entry', () => {
|
|
287
|
+
const md = '# Contents\n\n:::toc\n\n# One\n\nText.\n\n# Two\n\nMore.';
|
|
288
|
+
const doc = buildDocument({ markdown: md }, PAGE, createMeasurementCache());
|
|
289
|
+
const entries = doc.blocks.filter((b) => b.tocEntry);
|
|
290
|
+
const sources = entries.map((b) => b.tocEntry.headingSource);
|
|
291
|
+
expect(sources).toContain(md.indexOf('# One'));
|
|
292
|
+
expect(sources).toContain(md.indexOf('# Two'));
|
|
293
|
+
const one = entries.find((b) => b.tocEntry.headingSource === md.indexOf('# One'));
|
|
294
|
+
const chain = sourceAt(doc, one.pageIndex, one.bbox.x + 2, one.bbox.y + one.bbox.height / 2);
|
|
295
|
+
expect(chain.find((e) => e.level === 'block').heading).toBe(md.indexOf('# One'));
|
|
296
|
+
});
|
|
297
|
+
});
|
|
298
|
+
describe('figure labels in the source map (#857)', () => {
|
|
299
|
+
const resources = [{ id: 'mapa', typeId: 'figure', kind: 'bitmap', caption: '', createdAt: 0, updatedAt: 0, bitmap: { fileId: 'm.png', format: 'png', width: 100, height: 80 } }];
|
|
300
|
+
const md = '---\ntitle: Mapas\n---\n::::page{template="m"}\n:::frame{slot="pic"}\n:::figure{resource="mapa"}\n::label[Madrid]{at="madrid"}\n::label[Mar]{at="62% 48%"}\n:::\n:::\n::::';
|
|
301
|
+
const cfg = { ...PAGE, pageTemplates: [{ id: 'm', frames: [{ name: 'pic', flow: true, width: mm(100) }] }] };
|
|
302
|
+
const laid = () => {
|
|
303
|
+
const doc = buildDocument({ markdown: md, resources }, cfg, createMeasurementCache());
|
|
304
|
+
const page = composed(doc);
|
|
305
|
+
const pic = page.floats.find((b) => b.resourceBlock);
|
|
306
|
+
return { doc, page, pic };
|
|
307
|
+
};
|
|
308
|
+
it('each label carries its id, its anchor and the source of each character, in the chapter file', () => {
|
|
309
|
+
const { pic } = laid();
|
|
310
|
+
const labels = pic.resourceBlock.labels;
|
|
311
|
+
expect(labels.map((l) => [l.id, l.anchorRef])).toEqual([['cp0:pic:label:madrid', 'mapa#madrid'], ['cp0:pic:label:@1', undefined]]);
|
|
312
|
+
// Front matter counted: the offsets are the file's.
|
|
313
|
+
expect(md.slice(labels[0].sourceStart, labels[0].sourceEnd)).toBe('Madrid');
|
|
314
|
+
expect(labels[0].sourceMap.map((o) => md[o]).join('')).toBe('Madrid');
|
|
315
|
+
});
|
|
316
|
+
it('a point on a laid label answers with its glyph, the label at its anchor, the picture and the frame', () => {
|
|
317
|
+
const { doc, page, pic } = laid();
|
|
318
|
+
// Where P6 (#860) will set the label: given here by hand.
|
|
319
|
+
const label = pic.resourceBlock.labels[0];
|
|
320
|
+
label.rect = { x: pic.bbox.x + 10, y: pic.bbox.y + 10, width: 60, height: 20 };
|
|
321
|
+
const chain = sourceAt(doc, page.index, pic.bbox.x + 11, pic.bbox.y + 20);
|
|
322
|
+
expect(levels(chain).slice(0, 3)).toEqual(['text', 'label', 'resource']);
|
|
323
|
+
expect(md[chain[0].source.start]).toBe('M');
|
|
324
|
+
expect(chain[1]).toMatchObject({ id: 'cp0:pic:label:madrid', source: { kind: 'resource', resourceId: 'mapa', anchor: 'madrid' } });
|
|
325
|
+
expect(chain.find((e) => e.level === 'frame').id).toBe('cp0:pic');
|
|
326
|
+
// Off the label, the picture.
|
|
327
|
+
expect(sourceAt(doc, page.index, pic.bbox.x + pic.bbox.width - 2, pic.bbox.y + pic.bbox.height - 2)[0].level).toBe('resource');
|
|
328
|
+
});
|
|
329
|
+
it('the label’s text finds the label; its id finds it again', () => {
|
|
330
|
+
const { doc } = laid();
|
|
331
|
+
const at = md.indexOf('Madrid');
|
|
332
|
+
expect(elementsForSource(doc, at, at + 3).map((h) => `${h.element.level}:${h.element.id}`)).toContain('label:cp0:pic:label:madrid');
|
|
333
|
+
expect(findElement(doc, 'cp0:pic:label:madrid').element).toMatchObject({ level: 'label', source: { kind: 'resource', resourceId: 'mapa', anchor: 'madrid' } });
|
|
334
|
+
});
|
|
335
|
+
});
|
|
336
|
+
describe('spreads in the source map (#857, #861)', () => {
|
|
337
|
+
const tpl = {
|
|
338
|
+
id: 'tl', spread: true, gutter: mm(10), grid: { columns: 4, rows: 4, columnGap: mm(12) },
|
|
339
|
+
frames: [{ name: 'band', crossGutter: true, grid: { col: 1, row: 1, cols: 4 } }, { name: 'left', grid: { col: 1, row: 2 } }],
|
|
340
|
+
};
|
|
341
|
+
const md = ['::::page{template="tl" spread}', ':::frame{slot="band"}', 'Band across the spine with words enough to reach the other page of the sheet', ':::', '', ':::frame{slot="left"}', 'Left card', ':::', '::::'].join('\n');
|
|
342
|
+
const doc = () => buildDocument({ markdown: md }, { ...PAGE, pageTemplates: [tpl] }, createMeasurementCache());
|
|
343
|
+
it('the half of a frame on the facing page answers with the blocks it shows, flagged facing', () => {
|
|
344
|
+
const d = doc();
|
|
345
|
+
const pages = d.pages.filter((p) => p.composed?.spread);
|
|
346
|
+
const facingPage = pages.find((p) => p.composed.frames.some((f) => f.facingBlocks?.length));
|
|
347
|
+
const half = facingPage.composed.frames.find((f) => f.facingBlocks?.length);
|
|
348
|
+
const para = half.facingBlocks.find((b) => b.type !== 'callout' && b.lines.length > 0);
|
|
349
|
+
const line = para.lines[0];
|
|
350
|
+
// A point of that line inside the page's part of the sheet.
|
|
351
|
+
const clip = facingPage.composed.sheetClip;
|
|
352
|
+
const x = Math.max(line.bbox.x, clip.x) + 3;
|
|
353
|
+
const chain = sourceAt(d, facingPage.index, x, line.bbox.y + line.bbox.height / 2);
|
|
354
|
+
expect(chain[0]).toMatchObject({ level: 'text', facing: true });
|
|
355
|
+
const block = chain.find((e) => e.level === 'block');
|
|
356
|
+
expect(block.id.endsWith('-facing')).toBe(false);
|
|
357
|
+
expect(d.blocks.some((b) => b.id === block.id)).toBe(true);
|
|
358
|
+
expect(chain.find((e) => e.level === 'frame').id).toBe('cp0:band');
|
|
359
|
+
// The band's words are found on both pages of the sheet.
|
|
360
|
+
const at = md.indexOf('Band');
|
|
361
|
+
const hits = elementsForSource(d, at, at + 4).filter((h) => h.element.level === 'block');
|
|
362
|
+
expect(new Set(hits.map((h) => h.pageIndex)).size).toBe(2);
|
|
363
|
+
expect(hits.some((h) => h.element.facing)).toBe(true);
|
|
364
|
+
});
|
|
365
|
+
it('a frame across the spine is found again by a click on the part each page paints (#877)', () => {
|
|
366
|
+
// A band that starts near the spine on the verso and runs over the recto: most of its box
|
|
367
|
+
// is on the recto, so a point of its whole box on the verso falls off the page.
|
|
368
|
+
const banded = {
|
|
369
|
+
id: 'tl', spread: true, gutter: mm(10), grid: { columns: 2, rows: 4, columnGap: mm(30) },
|
|
370
|
+
frames: [
|
|
371
|
+
{ name: 'left', grid: { col: 1, row: 1 } },
|
|
372
|
+
{ name: 'band', crossGutter: true, width: 'fill', height: mm(9), padding: { left: mm(40) },
|
|
373
|
+
placement: { anchor: { to: '#left', edge: 'right-of' } } },
|
|
374
|
+
],
|
|
375
|
+
};
|
|
376
|
+
const src = ['::::page{template="tl" spread}', ':::frame{slot="left"}', 'Left', ':::', '', ':::frame{slot="band"}', 'Words on the recto', ':::', '::::'].join('\n');
|
|
377
|
+
const d = buildDocument({ markdown: src }, { ...PAGE, pageTemplates: [banded] }, createMeasurementCache());
|
|
378
|
+
const at = src.indexOf('Words');
|
|
379
|
+
const frames = elementsForSource(d, at, at + 5).filter((h) => h.element.level === 'frame' && h.element.id === 'cp0:band');
|
|
380
|
+
expect(frames.length).toBe(2);
|
|
381
|
+
for (const { pageIndex, element } of frames) {
|
|
382
|
+
const page = d.pages[pageIndex];
|
|
383
|
+
const clip = page.composed.sheetClip;
|
|
384
|
+
const r = element.rect;
|
|
385
|
+
expect(r.x).toBeGreaterThanOrEqual(clip.x - 0.01);
|
|
386
|
+
expect(r.x + r.width).toBeLessThanOrEqual(clip.x + clip.width + 0.01);
|
|
387
|
+
const c = centre(r);
|
|
388
|
+
expect(sourceAt(d, pageIndex, c.x, c.y).find((e) => e.level === 'frame')?.id).toBe('cp0:band');
|
|
389
|
+
}
|
|
390
|
+
});
|
|
391
|
+
it('a spread is laid out afresh each time: no layout key', () => {
|
|
392
|
+
expect(doc().pages.filter((p) => p.composed?.spread).every((p) => p.composed.layoutKey === undefined)).toBe(true);
|
|
393
|
+
});
|
|
394
|
+
});
|
|
395
|
+
//# sourceMappingURL=sourceMap.test.js.map
|