postext 1.41.0 → 1.42.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/__tests__/bundleFontFallback.test.d.ts +2 -0
- package/dist/__tests__/bundleFontFallback.test.d.ts.map +1 -0
- package/dist/__tests__/bundleFontFallback.test.js +127 -0
- package/dist/__tests__/bundleFontFallback.test.js.map +1 -0
- package/dist/__tests__/calloutBodyLetterSpacing.test.d.ts +2 -0
- package/dist/__tests__/calloutBodyLetterSpacing.test.d.ts.map +1 -0
- package/dist/__tests__/calloutBodyLetterSpacing.test.js +83 -0
- package/dist/__tests__/calloutBodyLetterSpacing.test.js.map +1 -0
- package/dist/__tests__/composed/autoWidth.test.d.ts +2 -0
- package/dist/__tests__/composed/autoWidth.test.d.ts.map +1 -0
- package/dist/__tests__/composed/autoWidth.test.js +82 -0
- package/dist/__tests__/composed/autoWidth.test.js.map +1 -0
- package/dist/__tests__/composed/crossChapterOutline.test.d.ts +2 -0
- package/dist/__tests__/composed/crossChapterOutline.test.d.ts.map +1 -0
- package/dist/__tests__/composed/crossChapterOutline.test.js +156 -0
- package/dist/__tests__/composed/crossChapterOutline.test.js.map +1 -0
- package/dist/__tests__/composed/decorationRemove.test.d.ts +2 -0
- package/dist/__tests__/composed/decorationRemove.test.d.ts.map +1 -0
- package/dist/__tests__/composed/decorationRemove.test.js +69 -0
- package/dist/__tests__/composed/decorationRemove.test.js.map +1 -0
- package/dist/__tests__/composed/figureWords.test.js +25 -0
- package/dist/__tests__/composed/figureWords.test.js.map +1 -1
- package/dist/__tests__/composed/footHold.test.d.ts +2 -0
- package/dist/__tests__/composed/footHold.test.d.ts.map +1 -0
- package/dist/__tests__/composed/footHold.test.js +83 -0
- package/dist/__tests__/composed/footHold.test.js.map +1 -0
- package/dist/__tests__/composed/frameLook.test.d.ts +2 -0
- package/dist/__tests__/composed/frameLook.test.d.ts.map +1 -0
- package/dist/__tests__/composed/frameLook.test.js +120 -0
- package/dist/__tests__/composed/frameLook.test.js.map +1 -0
- package/dist/__tests__/composed/framePictures.test.js +58 -0
- package/dist/__tests__/composed/framePictures.test.js.map +1 -1
- package/dist/__tests__/composed/headingBadge.test.d.ts +2 -0
- package/dist/__tests__/composed/headingBadge.test.d.ts.map +1 -0
- package/dist/__tests__/composed/headingBadge.test.js +91 -0
- package/dist/__tests__/composed/headingBadge.test.js.map +1 -0
- package/dist/__tests__/composed/labels.test.js +3 -0
- package/dist/__tests__/composed/labels.test.js.map +1 -1
- package/dist/__tests__/composed/labelsChecks.test.js +69 -0
- package/dist/__tests__/composed/labelsChecks.test.js.map +1 -1
- package/dist/__tests__/composed/labelsMirrored.test.js +33 -0
- package/dist/__tests__/composed/labelsMirrored.test.js.map +1 -1
- package/dist/__tests__/composed/layoutMemo.test.d.ts +2 -0
- package/dist/__tests__/composed/layoutMemo.test.d.ts.map +1 -0
- package/dist/__tests__/composed/layoutMemo.test.js +150 -0
- package/dist/__tests__/composed/layoutMemo.test.js.map +1 -0
- package/dist/__tests__/composed/tocFrame.test.d.ts +2 -0
- package/dist/__tests__/composed/tocFrame.test.d.ts.map +1 -0
- package/dist/__tests__/composed/tocFrame.test.js +167 -0
- package/dist/__tests__/composed/tocFrame.test.js.map +1 -0
- package/dist/__tests__/exports.test.js +6 -0
- package/dist/__tests__/exports.test.js.map +1 -1
- package/dist/__tests__/pipeline/calloutLabelIcon.test.d.ts +2 -0
- package/dist/__tests__/pipeline/calloutLabelIcon.test.d.ts.map +1 -0
- package/dist/__tests__/pipeline/calloutLabelIcon.test.js +107 -0
- package/dist/__tests__/pipeline/calloutLabelIcon.test.js.map +1 -0
- package/dist/bundle/adapters.d.ts +18 -4
- package/dist/bundle/adapters.d.ts.map +1 -1
- package/dist/bundle/adapters.js +61 -13
- package/dist/bundle/adapters.js.map +1 -1
- package/dist/bundle/book.d.ts.map +1 -1
- package/dist/bundle/book.js +7 -2
- package/dist/bundle/book.js.map +1 -1
- package/dist/bundle/codec.d.ts +5 -0
- package/dist/bundle/codec.d.ts.map +1 -1
- package/dist/bundle/codec.js +34 -7
- 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/layoutCache.d.ts +4 -0
- package/dist/bundle/layoutCache.d.ts.map +1 -1
- package/dist/bundle/layoutCache.js.map +1 -1
- package/dist/bundle/manifest.d.ts.map +1 -1
- package/dist/bundle/manifest.js +15 -2
- package/dist/bundle/manifest.js.map +1 -1
- package/dist/bundle/types.d.ts +6 -0
- package/dist/bundle/types.d.ts.map +1 -1
- package/dist/composed/carry.d.ts +2 -0
- package/dist/composed/carry.d.ts.map +1 -1
- package/dist/composed/carry.js +1 -1
- package/dist/composed/carry.js.map +1 -1
- package/dist/composed/document.d.ts +11 -0
- package/dist/composed/document.d.ts.map +1 -1
- package/dist/composed/document.js +24 -0
- package/dist/composed/document.js.map +1 -1
- package/dist/composed/geometry.d.ts +5 -1
- package/dist/composed/geometry.d.ts.map +1 -1
- package/dist/composed/geometry.js +14 -4
- package/dist/composed/geometry.js.map +1 -1
- package/dist/composed/labels.d.ts +23 -2
- package/dist/composed/labels.d.ts.map +1 -1
- package/dist/composed/labels.js +116 -5
- package/dist/composed/labels.js.map +1 -1
- package/dist/composed/slotChecks.d.ts +1 -1
- package/dist/composed/slotChecks.d.ts.map +1 -1
- package/dist/composed/slotChecks.js +5 -6
- package/dist/composed/slotChecks.js.map +1 -1
- package/dist/composed/sourceMap.d.ts.map +1 -1
- package/dist/composed/sourceMap.js +18 -2
- package/dist/composed/sourceMap.js.map +1 -1
- package/dist/composed/templates.d.ts +38 -1
- package/dist/composed/templates.d.ts.map +1 -1
- package/dist/composed/templates.js +68 -1
- package/dist/composed/templates.js.map +1 -1
- package/dist/composed/types.d.ts +73 -6
- package/dist/composed/types.d.ts.map +1 -1
- package/dist/composed/validate.d.ts.map +1 -1
- package/dist/composed/validate.js +20 -3
- package/dist/composed/validate.js.map +1 -1
- package/dist/composed/wrap.d.ts.map +1 -1
- package/dist/composed/wrap.js +4 -4
- package/dist/composed/wrap.js.map +1 -1
- package/dist/defaults/calloutStyles.d.ts +1 -0
- package/dist/defaults/calloutStyles.d.ts.map +1 -1
- package/dist/defaults/calloutStyles.js +6 -1
- package/dist/defaults/calloutStyles.js.map +1 -1
- package/dist/design/placeholders.d.ts +5 -0
- package/dist/design/placeholders.d.ts.map +1 -1
- package/dist/design/placeholders.js +9 -2
- package/dist/design/placeholders.js.map +1 -1
- package/dist/fonts/fallback.d.ts +26 -0
- package/dist/fonts/fallback.d.ts.map +1 -0
- package/dist/fonts/fallback.js +43 -0
- package/dist/fonts/fallback.js.map +1 -0
- package/dist/index.d.ts +7 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -2
- package/dist/index.js.map +1 -1
- package/dist/pipeline/anchors.d.ts.map +1 -1
- package/dist/pipeline/anchors.js +15 -1
- package/dist/pipeline/anchors.js.map +1 -1
- package/dist/pipeline/build.d.ts.map +1 -1
- package/dist/pipeline/build.js +22 -16
- package/dist/pipeline/build.js.map +1 -1
- package/dist/pipeline/buildHelpers.d.ts +2 -0
- package/dist/pipeline/buildHelpers.d.ts.map +1 -1
- package/dist/pipeline/buildHelpers.js +6 -0
- package/dist/pipeline/buildHelpers.js.map +1 -1
- package/dist/pipeline/calloutLayout.d.ts +2 -0
- package/dist/pipeline/calloutLayout.d.ts.map +1 -1
- package/dist/pipeline/calloutLayout.js +44 -17
- package/dist/pipeline/calloutLayout.js.map +1 -1
- package/dist/pipeline/carriedOutline.d.ts +45 -0
- package/dist/pipeline/carriedOutline.d.ts.map +1 -0
- package/dist/pipeline/carriedOutline.js +158 -0
- package/dist/pipeline/carriedOutline.js.map +1 -0
- package/dist/pipeline/composedLayout.d.ts +8 -1
- package/dist/pipeline/composedLayout.d.ts.map +1 -1
- package/dist/pipeline/composedLayout.js +126 -18
- package/dist/pipeline/composedLayout.js.map +1 -1
- package/dist/pipeline/contentWarnings.d.ts.map +1 -1
- package/dist/pipeline/contentWarnings.js +12 -1
- package/dist/pipeline/contentWarnings.js.map +1 -1
- package/dist/pipeline/figureWords.d.ts +18 -1
- package/dist/pipeline/figureWords.d.ts.map +1 -1
- package/dist/pipeline/figureWords.js +28 -0
- package/dist/pipeline/figureWords.js.map +1 -1
- package/dist/pipeline/frameLayout.d.ts +8 -0
- package/dist/pipeline/frameLayout.d.ts.map +1 -1
- package/dist/pipeline/frameLayout.js +74 -7
- package/dist/pipeline/frameLayout.js.map +1 -1
- package/dist/pipeline/headerFooter.d.ts.map +1 -1
- package/dist/pipeline/headerFooter.js +96 -41
- package/dist/pipeline/headerFooter.js.map +1 -1
- package/dist/pipeline/index.d.ts +2 -0
- package/dist/pipeline/index.d.ts.map +1 -1
- package/dist/pipeline/index.js +1 -0
- package/dist/pipeline/index.js.map +1 -1
- package/dist/pipeline/indexDirective.d.ts.map +1 -1
- package/dist/pipeline/indexDirective.js +3 -1
- package/dist/pipeline/indexDirective.js.map +1 -1
- package/dist/pipeline/layoutMemo.d.ts +72 -0
- package/dist/pipeline/layoutMemo.d.ts.map +1 -0
- package/dist/pipeline/layoutMemo.js +160 -0
- package/dist/pipeline/layoutMemo.js.map +1 -0
- package/dist/pipeline/measureMemo.d.ts +8 -0
- package/dist/pipeline/measureMemo.d.ts.map +1 -1
- package/dist/pipeline/measureMemo.js +6 -2
- package/dist/pipeline/measureMemo.js.map +1 -1
- package/dist/pipeline/outline.d.ts.map +1 -1
- package/dist/pipeline/outline.js +31 -2
- package/dist/pipeline/outline.js.map +1 -1
- package/dist/pipeline/placeholders.d.ts +13 -0
- package/dist/pipeline/placeholders.d.ts.map +1 -1
- package/dist/pipeline/placeholders.js +20 -1
- package/dist/pipeline/placeholders.js.map +1 -1
- package/dist/pipeline/styles.d.ts.map +1 -1
- package/dist/pipeline/styles.js +3 -1
- package/dist/pipeline/styles.js.map +1 -1
- package/dist/pipeline/toc.d.ts +7 -0
- package/dist/pipeline/toc.d.ts.map +1 -1
- package/dist/pipeline/toc.js +24 -0
- package/dist/pipeline/toc.js.map +1 -1
- package/dist/types.d.ts +41 -3
- package/dist/types.d.ts.map +1 -1
- package/dist/vdt.d.ts +43 -1
- package/dist/vdt.d.ts.map +1 -1
- package/dist/vdt.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Index marks, anchors and headings written in the part of a story that
|
|
3
|
+
* went on in a page of another chapter (#988, DESIGN §5.17, §5.18).
|
|
4
|
+
*
|
|
5
|
+
* The chapter that sent the story cannot place them: the words are laid by
|
|
6
|
+
* the chapter that has the page, so the sender's own location finds no line
|
|
7
|
+
* for them and falls back on the page where the story starts. The receiving
|
|
8
|
+
* chapter knows the page and reports it ({@link locateCarriedOutline},
|
|
9
|
+
* `VDTDocument.carriedOutline`); a host with every chapter's outline puts
|
|
10
|
+
* the pages into the sender's entries ({@link mergeCarriedOutline}), keyed
|
|
11
|
+
* by the sending chapter and the offset in its body.
|
|
12
|
+
*/
|
|
13
|
+
/** The line of the character at `at` among `lines` (sorted by start): the
|
|
14
|
+
* first page's line holding it; else the line before it
|
|
15
|
+
* (`attach: 'before'`) or after it, as long as that lies within the span
|
|
16
|
+
* the lines cover. */
|
|
17
|
+
function lineAt(lines, at, attach) {
|
|
18
|
+
let lo = 0;
|
|
19
|
+
let hi = lines.length;
|
|
20
|
+
while (lo < hi) {
|
|
21
|
+
const mid = (lo + hi) >> 1;
|
|
22
|
+
if (lines[mid].start <= at)
|
|
23
|
+
lo = mid + 1;
|
|
24
|
+
else
|
|
25
|
+
hi = mid;
|
|
26
|
+
}
|
|
27
|
+
const i = lo - 1;
|
|
28
|
+
let found;
|
|
29
|
+
for (let j = i; j >= 0 && j > i - 64; j--) {
|
|
30
|
+
const l = lines[j];
|
|
31
|
+
if (at >= l.start && at < l.end && (found === undefined || l.page < found.page))
|
|
32
|
+
found = l;
|
|
33
|
+
}
|
|
34
|
+
if (found)
|
|
35
|
+
return found;
|
|
36
|
+
// Outside what this chapter laid: the mark is the sender's, not ours.
|
|
37
|
+
if (i < 0 || at > lines[lines.length - 1].end)
|
|
38
|
+
return undefined;
|
|
39
|
+
return attach === 'before' ? lines[i] : lines[i + 1] ?? lines[i];
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* What the stories carried into `doc` hold: each index mark, inline anchor
|
|
43
|
+
* and heading of a story that this chapter laid (the part the sender did
|
|
44
|
+
* not), with the page it landed on here. `baseLength` is where the carried
|
|
45
|
+
* blocks start among the chapter's content blocks, `bodyOffset` this
|
|
46
|
+
* chapter's own.
|
|
47
|
+
*/
|
|
48
|
+
export function locateCarriedOutline(doc, carried, bodyOffset) {
|
|
49
|
+
const out = [];
|
|
50
|
+
const known = new Set(doc.blocks);
|
|
51
|
+
const placed = doc.blocks.filter((b) => b.pageIndex >= 0);
|
|
52
|
+
for (const page of doc.pages)
|
|
53
|
+
for (const f of page.floats ?? [])
|
|
54
|
+
if (f.pageIndex >= 0 && !known.has(f))
|
|
55
|
+
placed.push(f);
|
|
56
|
+
for (const story of carried.stories.values()) {
|
|
57
|
+
const blocks = carried.blocks.slice(story.startIdx - carried.baseLength, story.endIdx - carried.baseLength + 1);
|
|
58
|
+
// The story's own lines: offsets in the sending chapter's file.
|
|
59
|
+
const lines = [];
|
|
60
|
+
const headingAt = new Map();
|
|
61
|
+
for (const b of placed) {
|
|
62
|
+
if (b.contentIndex === undefined || b.contentIndex < story.startIdx || b.contentIndex > story.endIdx)
|
|
63
|
+
continue;
|
|
64
|
+
if (b.type === 'heading' && !headingAt.has(b.contentIndex))
|
|
65
|
+
headingAt.set(b.contentIndex, { page: b.pageIndex, x: b.bbox.x, y: b.bbox.y });
|
|
66
|
+
if (b.hidden)
|
|
67
|
+
continue;
|
|
68
|
+
for (const l of b.lines) {
|
|
69
|
+
if (l.sourceStart !== undefined && l.sourceEnd !== undefined)
|
|
70
|
+
lines.push({ start: l.sourceStart, end: l.sourceEnd, page: b.pageIndex, x: l.bbox.x, y: l.bbox.y });
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
lines.sort((a, b) => a.start - b.start || a.page - b.page);
|
|
74
|
+
const jump = story.jump;
|
|
75
|
+
// `sourceStart` of a carried block is its sender's plus this much.
|
|
76
|
+
const delta = jump.bodyOffset - bodyOffset;
|
|
77
|
+
const chapter = story.chapter;
|
|
78
|
+
blocks.forEach((block, k) => {
|
|
79
|
+
if (block.type === 'heading') {
|
|
80
|
+
const at = headingAt.get(story.startIdx + k);
|
|
81
|
+
const id = block.attrs?.id;
|
|
82
|
+
if (at) {
|
|
83
|
+
out.push({
|
|
84
|
+
chapter,
|
|
85
|
+
kind: 'heading',
|
|
86
|
+
sourceStart: block.sourceStart - delta,
|
|
87
|
+
pageIndex: at.page,
|
|
88
|
+
...(id !== undefined && id.length > 0 ? { anchor: { id, x: at.x, y: at.y } } : {}),
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
if (lines.length === 0)
|
|
93
|
+
return;
|
|
94
|
+
for (const m of block.indexMarks ?? []) {
|
|
95
|
+
if (m.anchor < 0)
|
|
96
|
+
continue;
|
|
97
|
+
const line = lineAt(lines, m.anchor + jump.bodyOffset, m.attach);
|
|
98
|
+
if (line)
|
|
99
|
+
out.push({ chapter, kind: 'indexMark', sourceStart: m.sourceStart - delta, pageIndex: line.page });
|
|
100
|
+
}
|
|
101
|
+
for (const m of block.anchorMarks ?? []) {
|
|
102
|
+
if (m.anchor < 0)
|
|
103
|
+
continue;
|
|
104
|
+
const line = lineAt(lines, m.anchor + jump.bodyOffset, m.attach);
|
|
105
|
+
if (line)
|
|
106
|
+
out.push({ chapter, kind: 'anchor', sourceStart: m.sourceStart - delta, pageIndex: line.page, anchor: { id: m.anchorId, x: line.x, y: line.y } });
|
|
107
|
+
}
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
return out;
|
|
111
|
+
}
|
|
112
|
+
/** `doc.carriedOutline` with the pages of the book. */
|
|
113
|
+
export function carriedPlaces(doc) {
|
|
114
|
+
const offset = doc.pageIndexOffset ?? 0;
|
|
115
|
+
const out = [];
|
|
116
|
+
for (const c of doc.carriedOutline ?? []) {
|
|
117
|
+
const page = doc.pages[c.pageIndex];
|
|
118
|
+
if (page)
|
|
119
|
+
out.push({ chapter: c.chapter, kind: c.kind, sourceStart: c.sourceStart, pageLabel: page.pageLabel, pageIndex: offset + page.index, pageFormat: page.pageNumberFormat });
|
|
120
|
+
}
|
|
121
|
+
return out;
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* `outlines` (one array of entries per chapter, as `outlineFromDoc` gives
|
|
125
|
+
* them) with the pages the receiving chapters found for the index marks,
|
|
126
|
+
* anchors and headings of the stories they carry (`carriedPlaces`, one
|
|
127
|
+
* list per chapter) put into the sending chapter's entries. A chapter
|
|
128
|
+
* nothing was carried from keeps its array.
|
|
129
|
+
*/
|
|
130
|
+
export function mergeCarriedOutline(outlines, places) {
|
|
131
|
+
const out = outlines.slice();
|
|
132
|
+
const copied = new Set();
|
|
133
|
+
for (const list of places) {
|
|
134
|
+
for (const c of list ?? []) {
|
|
135
|
+
const entries = out[c.chapter];
|
|
136
|
+
if (!entries)
|
|
137
|
+
continue;
|
|
138
|
+
const at = entries.findIndex((e) => (c.kind === 'indexMark' ? e.kind === 'indexMark' && e.indexMark?.sourceStart === c.sourceStart
|
|
139
|
+
: c.kind === 'anchor' ? e.kind === 'anchor' && e.anchorSource === c.sourceStart
|
|
140
|
+
: e.kind === 'heading' && e.headingSource === c.sourceStart));
|
|
141
|
+
if (at < 0)
|
|
142
|
+
continue;
|
|
143
|
+
if (!copied.has(c.chapter)) {
|
|
144
|
+
out[c.chapter] = entries.slice();
|
|
145
|
+
copied.add(c.chapter);
|
|
146
|
+
}
|
|
147
|
+
const mutable = out[c.chapter];
|
|
148
|
+
mutable[at] = {
|
|
149
|
+
...mutable[at],
|
|
150
|
+
pageLabel: c.pageLabel,
|
|
151
|
+
pageIndex: c.pageIndex,
|
|
152
|
+
...(c.kind === 'indexMark' ? { pageFormat: c.pageFormat } : {}),
|
|
153
|
+
};
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
return out;
|
|
157
|
+
}
|
|
158
|
+
//# sourceMappingURL=carriedOutline.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"carriedOutline.js","sourceRoot":"","sources":["../../src/pipeline/carriedOutline.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAeH;;;uBAGuB;AACvB,SAAS,MAAM,CAAC,KAAsB,EAAE,EAAU,EAAE,MAAsC;IACxF,IAAI,EAAE,GAAG,CAAC,CAAC;IACX,IAAI,EAAE,GAAG,KAAK,CAAC,MAAM,CAAC;IACtB,OAAO,EAAE,GAAG,EAAE,EAAE,CAAC;QACf,MAAM,GAAG,GAAG,CAAC,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,CAAC;QAC3B,IAAI,KAAK,CAAC,GAAG,CAAE,CAAC,KAAK,IAAI,EAAE;YAAE,EAAE,GAAG,GAAG,GAAG,CAAC,CAAC;;YACrC,EAAE,GAAG,GAAG,CAAC;IAChB,CAAC;IACD,MAAM,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;IACjB,IAAI,KAAuB,CAAC;IAC5B,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,EAAE,CAAC,EAAE,EAAE,CAAC;QAC1C,MAAM,CAAC,GAAG,KAAK,CAAC,CAAC,CAAE,CAAC;QACpB,IAAI,EAAE,IAAI,CAAC,CAAC,KAAK,IAAI,EAAE,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC,KAAK,KAAK,SAAS,IAAI,CAAC,CAAC,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC;YAAE,KAAK,GAAG,CAAC,CAAC;IAC7F,CAAC;IACD,IAAI,KAAK;QAAE,OAAO,KAAK,CAAC;IACxB,sEA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CAAC,GAAG,OAAO,CAAC,KAAK,EAAE,CAAC;gBACjC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC;YACxB,CAAC;YACD,MAAM,OAAO,GAAG,GAAG,CAAC,CAAC,CAAC,OAAO,CAAmB,CAAC;YACjD,OAAO,CAAC,EAAE,CAAC,GAAG;gBACZ,GAAG,OAAO,CAAC,EAAE,CAAE;gBACf,SAAS,EAAE,CAAC,CAAC,SAAS;gBACtB,SAAS,EAAE,CAAC,CAAC,SAAS;gBACtB,GAAG,CAAC,CAAC,CAAC,IAAI,KAAK,WAAW,CAAC,CAAC,CAAC,EAAE,UAAU,EAAE,CAAC,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;aAChE,CAAC;QACJ,CAAC;IACH,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC"}
|
|
@@ -36,7 +36,7 @@ import { type ContentWarning, type VDTBlock, type VDTComposedPage, type VDTPage
|
|
|
36
36
|
import { dimensionToPx } from '../units';
|
|
37
37
|
import { type FrameAreas, type Rect } from '../composed/geometry';
|
|
38
38
|
import { type ComposedContinuation, type ComposedContinuationInput } from '../composed/continuation';
|
|
39
|
-
import type { ResolvedFrame, ResolvedPageTemplate } from '../composed/types';
|
|
39
|
+
import type { FrameLook, ResolvedFrame, ResolvedPageTemplate } from '../composed/types';
|
|
40
40
|
import { type PageTemplateSource } from '../composed/templates';
|
|
41
41
|
import { type BoxExclusion, type PlannedCallout } from './calloutLayout';
|
|
42
42
|
import type { ImportedJumps } from '../composed/carry';
|
|
@@ -131,6 +131,13 @@ export declare function keepChromeAt(style: ResolvedCalloutStyleConfig, scale: n
|
|
|
131
131
|
* (side by side) and a measure that is the frame's. A style's placement,
|
|
132
132
|
* span, width and margins do not apply to a frame. */
|
|
133
133
|
export declare function frameStyleOf(base: ResolvedCalloutStyleConfig, frame: ResolvedFrame): ResolvedCalloutStyleConfig;
|
|
134
|
+
/** `base` with what a frame's `look` sets (#976) written over it: colours
|
|
135
|
+
* of the fill, border, stripe, icon, marker, title, text and label tab,
|
|
136
|
+
* and the tracking of the body. A fill colour turns the fill on. A part
|
|
137
|
+
* the style does not have (a label tab it lacks) is left out. Kept per
|
|
138
|
+
* style and look, so the pieces a measurement is keyed by (`body`,
|
|
139
|
+
* `lists`) keep their identity from one call to the next. */
|
|
140
|
+
export declare function styleWithLook(base: ResolvedCalloutStyleConfig, look: FrameLook): ResolvedCalloutStyleConfig;
|
|
134
141
|
/** The story heads of a composed page's stories, by the head frame's
|
|
135
142
|
* name, read from the boxes `wrapComposedPages` made (`FRAME_ATTR`). */
|
|
136
143
|
export declare function composedStories(startIdx: number, endIdx: number, plans: ReadonlyMap<number, PlannedCallout>): Map<string, ComposedStory>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"composedLayout.d.ts","sourceRoot":"","sources":["../../src/pipeline/composedLayout.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,OAAO,KAAK,EAAE,iBAAiB,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACtE,OAAO,KAAK,EAAa,0BAA0B,EAAE,MAAM,UAAU,CAAC;AACtE,OAAO,EAAkC,KAAK,cAAc,EAAmE,KAAK,QAAQ,EAAE,KAAK,eAAe,EAAoE,KAAK,OAAO,EAAE,MAAM,QAAQ,CAAC;AAGnQ,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAIzC,OAAO,EAAoE,KAAK,UAAU,EAAE,KAAK,IAAI,EAAE,MAAM,sBAAsB,CAAC;AAIpI,OAAO,EAAoH,KAAK,oBAAoB,EAAE,KAAK,yBAAyB,EAAE,MAAM,0BAA0B,CAAC;AACvN,OAAO,KAAK,EAAE,aAAa,EAAsB,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"composedLayout.d.ts","sourceRoot":"","sources":["../../src/pipeline/composedLayout.ts"],"names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;AAED,mEAAmE;AACnE,wBAAgB,cAAc,CAAC,KAAK,EAAE,WAAW,CAAC,MAAM,EAAE,mBAAmB,CAAC,EAAE,GAAG,EAAE,MAAM,GAAG,mBAAmB,GAAG,SAAS,CAG5H"}
|
|
@@ -15,6 +15,7 @@ import { frameElementId } from '../composed/ids';
|
|
|
15
15
|
import { frameLinePx, frameRuleBlocks } from '../composed/rules';
|
|
16
16
|
import { offsetCalloutToAbsolute } from './calloutLayout';
|
|
17
17
|
import { isMarkerBlock } from './buildHelpers';
|
|
18
|
+
import { createLayoutMemo, layoutMemoSwitch } from './layoutMemo';
|
|
18
19
|
import { createMeasureMemo } from './measureMemo';
|
|
19
20
|
import { computeOrderedListRunMetrics } from './lists';
|
|
20
21
|
import { planParagraphContainers } from './paragraphContainers';
|
|
@@ -71,7 +72,7 @@ export function layoutComposedPage(given) {
|
|
|
71
72
|
// frames collapsed).
|
|
72
73
|
// The ladder lays the page again at each step: the measurements of one
|
|
73
74
|
// step answer the next (#953).
|
|
74
|
-
const memoed = { ...given, pass: { ...given.pass, measureMemo: createMeasureMemo() } };
|
|
75
|
+
const memoed = { ...given, pass: { ...given.pass, measureMemo: createMeasureMemo(), ...(layoutMemoSwitch.enabled ? { layoutMemo: createLayoutMemo() } : {}) } };
|
|
75
76
|
const input = given.continuing ? { ...memoed, template: continuationTemplate(given.template, given.continuing) } : memoed;
|
|
76
77
|
const { template, fence, dpi } = input;
|
|
77
78
|
const fi = fence.fenceIndex;
|
|
@@ -822,13 +823,16 @@ function composePage(input, template, fit, collapsed) {
|
|
|
822
823
|
/** Whether a frame's lines are set as on a mirrored page: those of the
|
|
823
824
|
* page's own mode, not an unmirrored frame's. */
|
|
824
825
|
const mirroredIn = (frame) => input.mirrored && unmirroredAt(frame) === undefined;
|
|
825
|
-
/** The widest a picture's upright frame may be in a
|
|
826
|
-
*
|
|
827
|
-
* box's padding.
|
|
828
|
-
*
|
|
829
|
-
*
|
|
826
|
+
/** The widest a picture's upright frame may be in a frame whose lines run
|
|
827
|
+
* down the page (#960, #971): the frame's extent across its lines, less
|
|
828
|
+
* the box's padding. A vertical frame of a horizontal page is turned a
|
|
829
|
+
* quarter turn on the page, a frame of a vertical page's own mode lies in
|
|
830
|
+
* the flow, which is turned the same way; either way its pictures are
|
|
831
|
+
* laid out counter-rotated to stand upright. A horizontal frame of a
|
|
832
|
+
* vertical page is turned against the flow and already stands upright;
|
|
833
|
+
* none of that on a horizontal page's own mode. */
|
|
830
834
|
const uprightIn = (frame, across) => {
|
|
831
|
-
if (
|
|
835
|
+
if ((frame.writingMode ?? pageMode) !== 'vertical-rl')
|
|
832
836
|
return {};
|
|
833
837
|
const pad = styleOf(frame).padding;
|
|
834
838
|
const room = across - lengthPx(pad.top, dpi, input.emPx) - lengthPx(pad.bottom, dpi, input.emPx);
|
|
@@ -978,13 +982,60 @@ function composePage(input, template, fit, collapsed) {
|
|
|
978
982
|
if (known !== undefined)
|
|
979
983
|
return known;
|
|
980
984
|
const exclusions = at ? unscale(exclusionsFor(p.frame, { ...at, width }, true), s) : undefined;
|
|
981
|
-
|
|
982
|
-
|
|
985
|
+
// The room a vertical page's upright picture may take down the page
|
|
986
|
+
// is the flow's whole extent: the frame's height is what it settles.
|
|
987
|
+
const opts = { ...(exclusions ? { exclusions } : {}), ...(pic !== undefined ? { pictureScale: pic } : {}), ...(p.fromMark !== undefined ? { continuedMark: p.fromMark } : {}), ...uprightIn(p.frame, input.areas.area.height / s) };
|
|
988
|
+
const r = p.st.L.peekRange(p.st.cut, p.st.L.end, width / s, p.blockId, p.continuation, input.mirrored, Object.keys(opts).length > 0 ? opts : undefined);
|
|
983
989
|
const h = r.totalHeight * s;
|
|
984
990
|
memo.set(key, h);
|
|
985
991
|
return h;
|
|
986
992
|
};
|
|
987
993
|
};
|
|
994
|
+
/** The width an `'auto'`-width frame (#982) needs when it may take up
|
|
995
|
+
* to `room`: the right edge of its longest line (a picture counting
|
|
996
|
+
* by its own box), and what the box keeps to the right of its text
|
|
997
|
+
* (padding, a stripe). The text is set flush left whatever its
|
|
998
|
+
* alignment, so a centred title is as wide as its words, and not set
|
|
999
|
+
* to a measure it would fill. Undefined for a frame of fixed or
|
|
1000
|
+
* `'fill'` width, or one in its own writing mode. */
|
|
1001
|
+
const naturalWidthOf = (p) => {
|
|
1002
|
+
if (p.frame.width !== 'auto' || ownMode(p.frame))
|
|
1003
|
+
return undefined;
|
|
1004
|
+
const memo = new Map();
|
|
1005
|
+
return (room) => {
|
|
1006
|
+
if (!p.holds)
|
|
1007
|
+
return 0;
|
|
1008
|
+
const key = Math.round(room * 1000);
|
|
1009
|
+
const known = memo.get(key);
|
|
1010
|
+
if (known !== undefined)
|
|
1011
|
+
return known;
|
|
1012
|
+
const s = textScale(p.frame);
|
|
1013
|
+
const style = styleOf(p.frame);
|
|
1014
|
+
const flush = { ...style, body: { ...style.body, textAlign: 'left' } };
|
|
1015
|
+
const L = makeCalloutLayouter(pass, p.st.story.startIdx, p.st.story.plan, flush);
|
|
1016
|
+
// Set at a measure far wider than the room, so that nothing wraps:
|
|
1017
|
+
// the frame is then as wide as its words, and the room caps it
|
|
1018
|
+
// (text that does not fit wraps at the room, as in a shrink-wrapped
|
|
1019
|
+
// box).
|
|
1020
|
+
const r = L.layoutRange(p.st.cut, L.end, (room * 8) / s, p.blockId, p.continuation, input.mirrored);
|
|
1021
|
+
let right = 0;
|
|
1022
|
+
for (const b of r.children) {
|
|
1023
|
+
if (b.type === 'callout' || b.hidden)
|
|
1024
|
+
continue;
|
|
1025
|
+
if (b.type === 'resource' || b.lines.length === 0)
|
|
1026
|
+
right = Math.max(right, b.bbox.x + b.bbox.width);
|
|
1027
|
+
for (const l of b.lines)
|
|
1028
|
+
if (l.text.length > 0)
|
|
1029
|
+
right = Math.max(right, l.bbox.x + l.bbox.width);
|
|
1030
|
+
}
|
|
1031
|
+
const inner = r.frame.callout?.innerRect;
|
|
1032
|
+
const keep = inner ? Math.max(0, r.width - (inner.x + inner.width)) : 0;
|
|
1033
|
+
// A quarter of a pixel over: a line is never set to its exact width.
|
|
1034
|
+
const w = Math.min(room, (right + keep + 0.25) * s);
|
|
1035
|
+
memo.set(key, w);
|
|
1036
|
+
return w;
|
|
1037
|
+
};
|
|
1038
|
+
};
|
|
988
1039
|
/** The height a frame set in its own writing mode (#944) needs at
|
|
989
1040
|
* `width`: its lines run down the box, so the least height whose
|
|
990
1041
|
* lines, following each other across, fit `width`; the area's height
|
|
@@ -997,7 +1048,7 @@ function composePage(input, template, fit, collapsed) {
|
|
|
997
1048
|
if (known !== undefined)
|
|
998
1049
|
return known;
|
|
999
1050
|
const opts = { ...(pic !== undefined ? { pictureScale: pic } : {}), ...(p.fromMark !== undefined ? { continuedMark: p.fromMark } : {}), ...uprightIn(p.frame, width / s) };
|
|
1000
|
-
const across = (measure) => inMode(p.frame, () => p.st.L.
|
|
1051
|
+
const across = (measure) => inMode(p.frame, () => p.st.L.peekRange(p.st.cut, p.st.L.end, measure / s, p.blockId, p.continuation, mirroredIn(p.frame), Object.keys(opts).length > 0 ? opts : undefined).totalHeight * s);
|
|
1001
1052
|
const most = Math.max(input.areas.area.height, input.emPx);
|
|
1002
1053
|
let h = most;
|
|
1003
1054
|
if (across(most) <= width + 0.5) {
|
|
@@ -1022,8 +1073,8 @@ function composePage(input, template, fit, collapsed) {
|
|
|
1022
1073
|
* off a spread's spine band, #861), its `'auto'` height measured at the
|
|
1023
1074
|
* width it is left with. Declared and final boxes alike: the band is
|
|
1024
1075
|
* the template's, not a reflow. */
|
|
1025
|
-
const placeFitted = (frame, placeable, ctx, refs, nat) => {
|
|
1026
|
-
const r = placeBox(placeable, template, ctx, refs, nat);
|
|
1076
|
+
const placeFitted = (frame, placeable, ctx, refs, nat, natW) => {
|
|
1077
|
+
const r = placeBox(placeable, template, ctx, refs, nat, natW);
|
|
1027
1078
|
if (!input.fitBox)
|
|
1028
1079
|
return r;
|
|
1029
1080
|
const keep = (placed) => {
|
|
@@ -1037,7 +1088,7 @@ function composePage(input, template, fit, collapsed) {
|
|
|
1037
1088
|
const first = keep(r);
|
|
1038
1089
|
if (Math.abs(first.width - r.width) < 0.01)
|
|
1039
1090
|
return first;
|
|
1040
|
-
return keep(placeBox(placeable, template, ctx, refs, () => nat(first.width)));
|
|
1091
|
+
return keep(placeBox(placeable, template, ctx, refs, () => nat(first.width), natW));
|
|
1041
1092
|
};
|
|
1042
1093
|
/** A frame's height as its template declares it: its `minHeight` where
|
|
1043
1094
|
* the height follows the content, else the content's (`natural`). */
|
|
@@ -1050,16 +1101,17 @@ function composePage(input, template, fit, collapsed) {
|
|
|
1050
1101
|
const frame = p.frame;
|
|
1051
1102
|
const placeable = framePlaceable(frame);
|
|
1052
1103
|
const natural = naturalOf(p);
|
|
1104
|
+
const natW = naturalWidthOf(p);
|
|
1053
1105
|
const at = (refs) => {
|
|
1054
|
-
const r0 = placeFitted(frame, placeable, input, refs, natural);
|
|
1106
|
+
const r0 = placeFitted(frame, placeable, input, refs, natural, natW);
|
|
1055
1107
|
if (!p.holds || !exclusionsFor(frame, r0, true))
|
|
1056
1108
|
return { rect: r0, natural };
|
|
1057
1109
|
const round = naturalOf(p, r0);
|
|
1058
|
-
return { rect: placeFitted(frame, placeable, input, refs, round), natural: round };
|
|
1110
|
+
return { rect: placeFitted(frame, placeable, input, refs, round, natW), natural: round };
|
|
1059
1111
|
};
|
|
1060
1112
|
const decl = frame.pin ? at(declaredRefOf) : undefined;
|
|
1061
1113
|
const fin = decl ?? at(refOf);
|
|
1062
|
-
const declRect = placeFitted(frame, placeable, input, declaredRefOf, declaredNatural(frame, fin.natural));
|
|
1114
|
+
const declRect = placeFitted(frame, placeable, input, declaredRefOf, declaredNatural(frame, fin.natural), natW);
|
|
1063
1115
|
const rect = frame.pin ? declRect : fin.rect;
|
|
1064
1116
|
declared.set(frame.name, declRect);
|
|
1065
1117
|
rects.set(frame.name, rect);
|
|
@@ -1076,6 +1128,7 @@ function composePage(input, template, fit, collapsed) {
|
|
|
1076
1128
|
const mmPx = dpi / MM_PER_IN;
|
|
1077
1129
|
const yieldAll = fit.yieldAll.has(group.name);
|
|
1078
1130
|
const preps = members.map(prepare);
|
|
1131
|
+
const natWs = preps.map(naturalWidthOf);
|
|
1079
1132
|
const solve = (mode, naturals) => {
|
|
1080
1133
|
const refs = mode === 'final' ? refOf : declaredRefOf;
|
|
1081
1134
|
const ownBox = own ? placeBox(own, template, input, refs, () => 0) : undefined;
|
|
@@ -1088,7 +1141,7 @@ function composePage(input, template, fit, collapsed) {
|
|
|
1088
1141
|
const placeable = framePlaceable(f);
|
|
1089
1142
|
// On a spread the member's own box keeps off the spine band, and
|
|
1090
1143
|
// the negotiation starts from it (#861).
|
|
1091
|
-
const box = placeFitted(f, placeable, ctx, memberRefs, declaredNatural(f, natural));
|
|
1144
|
+
const box = placeFitted(f, placeable, ctx, memberRefs, declaredNatural(f, natural), natWs[k]);
|
|
1092
1145
|
ownRects.set(f.name, box);
|
|
1093
1146
|
const auto = f.height === 'auto' && !(f.grid && !placeable.heightSet);
|
|
1094
1147
|
const fill = f.height === 'fill';
|
|
@@ -1494,7 +1547,7 @@ function stampFrameAttrText(box, sources, attrs, bodyOffset) {
|
|
|
1494
1547
|
export function frameStyleOf(base, frame) {
|
|
1495
1548
|
const padding = frame.padding ? { ...base.padding, ...frame.padding } : base.padding;
|
|
1496
1549
|
return {
|
|
1497
|
-
...base,
|
|
1550
|
+
...(frame.look ? styleWithLook(base, frame.look) : base),
|
|
1498
1551
|
padding,
|
|
1499
1552
|
width: 'fill',
|
|
1500
1553
|
placement: 'here',
|
|
@@ -1503,6 +1556,61 @@ export function frameStyleOf(base, frame) {
|
|
|
1503
1556
|
marginBottom: { value: 0, unit: 'px' },
|
|
1504
1557
|
};
|
|
1505
1558
|
}
|
|
1559
|
+
const lookedStyles = new WeakMap();
|
|
1560
|
+
/** `base` with what a frame's `look` sets (#976) written over it: colours
|
|
1561
|
+
* of the fill, border, stripe, icon, marker, title, text and label tab,
|
|
1562
|
+
* and the tracking of the body. A fill colour turns the fill on. A part
|
|
1563
|
+
* the style does not have (a label tab it lacks) is left out. Kept per
|
|
1564
|
+
* style and look, so the pieces a measurement is keyed by (`body`,
|
|
1565
|
+
* `lists`) keep their identity from one call to the next. */
|
|
1566
|
+
export function styleWithLook(base, look) {
|
|
1567
|
+
let byLook = lookedStyles.get(base);
|
|
1568
|
+
if (!byLook)
|
|
1569
|
+
lookedStyles.set(base, (byLook = new WeakMap()));
|
|
1570
|
+
const known = byLook.get(look);
|
|
1571
|
+
if (known)
|
|
1572
|
+
return known;
|
|
1573
|
+
const out = { ...base };
|
|
1574
|
+
if (look.background) {
|
|
1575
|
+
out.background = look.background;
|
|
1576
|
+
out.backgroundEnabled = true;
|
|
1577
|
+
}
|
|
1578
|
+
if (look.border?.color)
|
|
1579
|
+
out.border = { ...base.border, color: look.border.color };
|
|
1580
|
+
if (look.stripe?.color)
|
|
1581
|
+
out.stripe = { ...base.stripe, color: look.stripe.color };
|
|
1582
|
+
if (look.icon?.color)
|
|
1583
|
+
out.icon = { ...base.icon, color: look.icon.color };
|
|
1584
|
+
if (look.marker?.color || look.marker?.rule?.color) {
|
|
1585
|
+
out.marker = {
|
|
1586
|
+
...base.marker,
|
|
1587
|
+
...(look.marker.color ? { color: look.marker.color } : {}),
|
|
1588
|
+
...(look.marker.rule?.color ? { rule: { ...base.marker.rule, color: look.marker.rule.color } } : {}),
|
|
1589
|
+
};
|
|
1590
|
+
}
|
|
1591
|
+
if (look.titleStyle?.color)
|
|
1592
|
+
out.titleStyle = { ...base.titleStyle, color: look.titleStyle.color };
|
|
1593
|
+
if (look.body) {
|
|
1594
|
+
const b = look.body;
|
|
1595
|
+
out.body = {
|
|
1596
|
+
...base.body,
|
|
1597
|
+
...(b.color ? { color: b.color } : {}),
|
|
1598
|
+
...(b.boldColor ? { boldColor: b.boldColor } : {}),
|
|
1599
|
+
...(b.italicColor ? { italicColor: b.italicColor } : {}),
|
|
1600
|
+
...(b.letterSpacing ? (b.letterSpacing.value !== 0 ? { letterSpacing: b.letterSpacing } : { letterSpacing: undefined }) : {}),
|
|
1601
|
+
};
|
|
1602
|
+
}
|
|
1603
|
+
if (look.label && base.label) {
|
|
1604
|
+
out.label = {
|
|
1605
|
+
...base.label,
|
|
1606
|
+
...(look.label.color ? { color: look.label.color } : {}),
|
|
1607
|
+
...(look.label.background ? { background: look.label.background } : {}),
|
|
1608
|
+
...(look.label.rule?.color ? { rule: { ...base.label.rule, color: look.label.rule.color } } : {}),
|
|
1609
|
+
};
|
|
1610
|
+
}
|
|
1611
|
+
byLook.set(look, out);
|
|
1612
|
+
return out;
|
|
1613
|
+
}
|
|
1506
1614
|
/** The story heads of a composed page's stories, by the head frame's
|
|
1507
1615
|
* name, read from the boxes `wrapComposedPages` made (`FRAME_ATTR`). */
|
|
1508
1616
|
export function composedStories(startIdx, endIdx, plans) {
|