postext 1.102.1 → 1.103.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.
Files changed (99) hide show
  1. package/README.md +3 -0
  2. package/dist/__tests__/annotate/anchors.test.d.ts +2 -0
  3. package/dist/__tests__/annotate/anchors.test.d.ts.map +1 -0
  4. package/dist/__tests__/annotate/anchors.test.js +161 -0
  5. package/dist/__tests__/annotate/anchors.test.js.map +1 -0
  6. package/dist/__tests__/annotate/fontPx.test.d.ts +2 -0
  7. package/dist/__tests__/annotate/fontPx.test.d.ts.map +1 -0
  8. package/dist/__tests__/annotate/fontPx.test.js +25 -0
  9. package/dist/__tests__/annotate/fontPx.test.js.map +1 -0
  10. package/dist/__tests__/annotate/marks.test.d.ts +2 -0
  11. package/dist/__tests__/annotate/marks.test.d.ts.map +1 -0
  12. package/dist/__tests__/annotate/marks.test.js +205 -0
  13. package/dist/__tests__/annotate/marks.test.js.map +1 -0
  14. package/dist/__tests__/exports.test.js +8 -0
  15. package/dist/__tests__/exports.test.js.map +1 -1
  16. package/dist/__tests__/geometry/rangeGeometry.test.d.ts +2 -0
  17. package/dist/__tests__/geometry/rangeGeometry.test.d.ts.map +1 -0
  18. package/dist/__tests__/geometry/rangeGeometry.test.js +167 -0
  19. package/dist/__tests__/geometry/rangeGeometry.test.js.map +1 -0
  20. package/dist/__tests__/paint/pageTransform.test.d.ts +2 -0
  21. package/dist/__tests__/paint/pageTransform.test.d.ts.map +1 -0
  22. package/dist/__tests__/paint/pageTransform.test.js +39 -0
  23. package/dist/__tests__/paint/pageTransform.test.js.map +1 -0
  24. package/dist/annotate/anchors.d.ts +70 -0
  25. package/dist/annotate/anchors.d.ts.map +1 -0
  26. package/dist/annotate/anchors.js +99 -0
  27. package/dist/annotate/anchors.js.map +1 -0
  28. package/dist/annotate/edits.d.ts +52 -0
  29. package/dist/annotate/edits.d.ts.map +1 -0
  30. package/dist/annotate/edits.js +84 -0
  31. package/dist/annotate/edits.js.map +1 -0
  32. package/dist/annotate/index.d.ts +17 -0
  33. package/dist/annotate/index.d.ts.map +1 -0
  34. package/dist/annotate/index.js +13 -0
  35. package/dist/annotate/index.js.map +1 -0
  36. package/dist/annotate/marks.d.ts +103 -0
  37. package/dist/annotate/marks.d.ts.map +1 -0
  38. package/dist/annotate/marks.js +398 -0
  39. package/dist/annotate/marks.js.map +1 -0
  40. package/dist/annotate/paint.d.ts +58 -0
  41. package/dist/annotate/paint.d.ts.map +1 -0
  42. package/dist/annotate/paint.js +130 -0
  43. package/dist/annotate/paint.js.map +1 -0
  44. package/dist/canvas-backend/index.d.ts.map +1 -1
  45. package/dist/canvas-backend/index.js +3 -0
  46. package/dist/canvas-backend/index.js.map +1 -1
  47. package/dist/geometry/balloonText.d.ts +75 -0
  48. package/dist/geometry/balloonText.d.ts.map +1 -0
  49. package/dist/geometry/balloonText.js +266 -0
  50. package/dist/geometry/balloonText.js.map +1 -0
  51. package/dist/geometry/bandTitle.d.ts +53 -0
  52. package/dist/geometry/bandTitle.d.ts.map +1 -0
  53. package/dist/geometry/bandTitle.js +171 -0
  54. package/dist/geometry/bandTitle.js.map +1 -0
  55. package/dist/geometry/caret.d.ts +23 -0
  56. package/dist/geometry/caret.d.ts.map +1 -0
  57. package/dist/geometry/caret.js +62 -0
  58. package/dist/geometry/caret.js.map +1 -0
  59. package/dist/geometry/fontPx.d.ts +15 -0
  60. package/dist/geometry/fontPx.d.ts.map +1 -0
  61. package/dist/geometry/fontPx.js +38 -0
  62. package/dist/geometry/fontPx.js.map +1 -0
  63. package/dist/geometry/frameSpace.d.ts +31 -0
  64. package/dist/geometry/frameSpace.d.ts.map +1 -0
  65. package/dist/geometry/frameSpace.js +68 -0
  66. package/dist/geometry/frameSpace.js.map +1 -0
  67. package/dist/geometry/hitTest.d.ts +46 -0
  68. package/dist/geometry/hitTest.d.ts.map +1 -0
  69. package/dist/geometry/hitTest.js +162 -0
  70. package/dist/geometry/hitTest.js.map +1 -0
  71. package/dist/geometry/index.d.ts +25 -0
  72. package/dist/geometry/index.d.ts.map +1 -0
  73. package/dist/geometry/index.js +18 -0
  74. package/dist/geometry/index.js.map +1 -0
  75. package/dist/geometry/measureLanguage.d.ts +17 -0
  76. package/dist/geometry/measureLanguage.d.ts.map +1 -0
  77. package/dist/geometry/measureLanguage.js +116 -0
  78. package/dist/geometry/measureLanguage.js.map +1 -0
  79. package/dist/geometry/placement.d.ts +64 -0
  80. package/dist/geometry/placement.d.ts.map +1 -0
  81. package/dist/geometry/placement.js +158 -0
  82. package/dist/geometry/placement.js.map +1 -0
  83. package/dist/geometry/rangeGeometry.d.ts +147 -0
  84. package/dist/geometry/rangeGeometry.d.ts.map +1 -0
  85. package/dist/geometry/rangeGeometry.js +352 -0
  86. package/dist/geometry/rangeGeometry.js.map +1 -0
  87. package/dist/geometry/segmentText.d.ts +57 -0
  88. package/dist/geometry/segmentText.d.ts.map +1 -0
  89. package/dist/geometry/segmentText.js +145 -0
  90. package/dist/geometry/segmentText.js.map +1 -0
  91. package/dist/geometry/textGeometry.d.ts +59 -0
  92. package/dist/geometry/textGeometry.d.ts.map +1 -0
  93. package/dist/geometry/textGeometry.js +336 -0
  94. package/dist/geometry/textGeometry.js.map +1 -0
  95. package/dist/index.d.ts +1 -0
  96. package/dist/index.d.ts.map +1 -1
  97. package/dist/index.js +1 -0
  98. package/dist/index.js.map +1 -1
  99. package/package.json +9 -1
@@ -0,0 +1,53 @@
1
+ import type { VDTBlock, VDTDesignTextBlock, VDTDocument } from '../vdt.js';
2
+ /**
3
+ * Geometry and source mapping for design-band text that mirrors document
4
+ * text — the `{titleText}` of a chapter opener or a `:::part` page. Shared
5
+ * by the caret/selection overlay and the click-to-source hit test.
6
+ */
7
+ export interface BandLineBox {
8
+ x: number;
9
+ y: number;
10
+ width: number;
11
+ height: number;
12
+ text: string;
13
+ font: string;
14
+ /** Index of the line's first character in the block's title text. */
15
+ plainStart: number;
16
+ /** The language the layout measured the line in and the page paints it
17
+ * in (`documentShapingLanguage`), which its characters are measured in
18
+ * here (#770). Absent: the host's. */
19
+ lang?: string;
20
+ }
21
+ /** Design text blocks of a page that carry a source range: the opener
22
+ * band, the running heads, and the advanced-design overlays of the page's
23
+ * headings (cover pages, in-column openers, `:::toc` part rows). */
24
+ export declare function bandTitleBlocks(doc: VDTDocument, pageIndex: number): VDTDesignTextBlock[];
25
+ /** The id of the block whose design overlay draws `title` (one
26
+ * {@link bandTitleBlocks} returned): the overlay is painted in that
27
+ * block's composed frame, if any (#910). Undefined for the opener band
28
+ * and the running heads. */
29
+ export declare function bandTitleOwner(title: VDTDesignTextBlock): string | undefined;
30
+ /** A flow heading rendered through an opener band keeps invisible lines
31
+ * under the band; its text is drawn by the band, so caret, selection and
32
+ * clicks should be routed through the band block instead. */
33
+ export declare function isHiddenUnderBand(block: VDTBlock, titles: readonly VDTDesignTextBlock[]): boolean;
34
+ /** Approximate line boxes for a design text block. The band layout keeps
35
+ * absolute baselines only, so the line pitch comes from consecutive
36
+ * baselines (or lineHeight × fontSize for a single line). Each box also
37
+ * records where its text starts in the title text, so characters can be
38
+ * mapped to source offsets, and `lang`, the language the document's text
39
+ * was measured in (`documentShapingLanguage(doc)`; undefined: the
40
+ * host's), which the caret and the hit test measure its characters in. */
41
+ export declare function bandLineBoxes(block: VDTDesignTextBlock, lang?: string): BandLineBox[];
42
+ /** X coordinate of the caret placed before character `chars` of the line. */
43
+ export declare function bandPrefixX(box: BandLineBox, chars: number): number;
44
+ /** Character index (0..text.length) closest to an x coordinate on the line. */
45
+ export declare function bandCharAtX(box: BandLineBox, x: number): number;
46
+ /** Source offset of character `plainIdx` of the title text (clamped). */
47
+ export declare function bandPlainToSource(block: VDTDesignTextBlock, plainIdx: number): number;
48
+ /** Index of the first title character whose source offset is ≥ `offset`
49
+ * (the title's end when the offset lies past the title). What the design
50
+ * prints before the title (a heading number, #546) is never reached: the
51
+ * title starts after it. */
52
+ export declare function bandSourceToPlain(block: VDTDesignTextBlock, offset: number): number;
53
+ //# sourceM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,kBAAkB,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CASrF;AAED;;;6BAG6B;AAC7B,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,kBAAkB,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAoBnF"}
@@ -0,0 +1,171 @@
1
+ import { measureInLanguage } from './measureLanguage.js';
2
+ import { fontPx } from './fontPx.js';
3
+ /** Design text blocks of a page that carry a source range: the opener
4
+ * band, the running heads, and the advanced-design overlays of the page's
5
+ * headings (cover pages, in-column openers, `:::toc` part rows). */
6
+ export function bandTitleBlocks(doc, pageIndex) {
7
+ const page = doc.pages[pageIndex];
8
+ if (!page)
9
+ return [];
10
+ const slots = [page.openerBand, page.header, page.footer].map((slot) => ({ slot }));
11
+ for (const b of doc.blocks) {
12
+ if (b.pageIndex === pageIndex && b.designOverlay)
13
+ slots.push({ slot: b.designOverlay, owner: b.id });
14
+ }
15
+ for (const b of page.floats ?? []) {
16
+ if (b.designOverlay)
17
+ slots.push({ slot: b.designOverlay, owner: b.id });
18
+ }
19
+ const out = [];
20
+ for (const { slot, owner } of slots) {
21
+ if (!slot)
22
+ continue;
23
+ for (const b of slot.blocks) {
24
+ if (b.kind !== 'text' || b.sourceStart === undefined || b.sourceEnd === undefined)
25
+ continue;
26
+ out.push(b);
27
+ if (owner !== undefined)
28
+ owners.set(b, owner);
29
+ }
30
+ }
31
+ return out;
32
+ }
33
+ /** The block whose design overlay draws each title {@link bandTitleBlocks}
34
+ * returned (a heading, a box), by title. */
35
+ const owners = new WeakMap();
36
+ /** The id of the block whose design overlay draws `title` (one
37
+ * {@link bandTitleBlocks} returned): the overlay is painted in that
38
+ * block's composed frame, if any (#910). Undefined for the opener band
39
+ * and the running heads. */
40
+ export function bandTitleOwner(title) {
41
+ return owners.get(title);
42
+ }
43
+ /** A flow heading rendered through an opener band keeps invisible lines
44
+ * under the band; its text is drawn by the band, so caret, selection and
45
+ * clicks should be routed through the band block instead. */
46
+ export function isHiddenUnderBand(block, titles) {
47
+ return block.type === 'heading'
48
+ && block.sourceStart !== undefined
49
+ && block.sourceEnd !== undefined
50
+ && titles.some((t) => block.sourceStart <= t.sourceStart && block.sourceEnd >= t.sourceEnd);
51
+ }
52
+ /** The title text the block renders: `sourceText` when known, else the
53
+ * laid-out lines joined by newlines. */
54
+ function titleTextOf(block) {
55
+ return block.sourceText ?? block.lines.map((l) => l.text).join('\n');
56
+ }
57
+ /** Approximate line boxes for a design text block. The band layout keeps
58
+ * absolute baselines only, so the line pitch comes from consecutive
59
+ * baselines (or lineHeight × fontSize for a single line). Each box also
60
+ * records where its text starts in the title text, so characters can be
61
+ * mapped to source offsets, and `lang`, the language the document's text
62
+ * was measured in (`documentShapingLanguage(doc)`; undefined: the
63
+ * host's), which the caret and the hit test measure its characters in. */
64
+ export function bandLineBoxes(block, lang) {
65
+ const lines = block.lines;
66
+ const fontSizePx = fontPx(block.fontString) ?? block.bbox.height;
67
+ const pitch = lines.length > 1 ? lines[1].baselineY - lines[0].baselineY : fontSizePx * 1.2;
68
+ const ascent = pitch * 0.8;
69
+ const title = titleTextOf(block);
70
+ let pos = 0;
71
+ return lines.map((l) => {
72
+ // Wrapping trims spaces and breaks at newlines: skip them, then find the
73
+ // line's text at (or after) the cursor.
74
+ while (pos < title.length && /\s/.test(title[pos]))
75
+ pos++;
76
+ const at = l.text.length > 0 ? title.indexOf(l.text, pos) : pos;
77
+ const plainStart = at >= 0 ? at : pos;
78
+ pos = plainStart + l.text.length;
79
+ return {
80
+ x: block.bbox.x + l.xOffset,
81
+ y: l.baselineY - ascent,
82
+ width: l.width,
83
+ height: pitch,
84
+ text: l.text,
85
+ font: block.fontString,
86
+ plainStart,
87
+ ...(lang !== undefined ? { lang } : {}),
88
+ };
89
+ });
90
+ }
91
+ /** Width of the first `chars` characters of a line, measured with its font
92
+ * in the language the layout measured the line in ({@link BandLineBox.lang})
93
+ * and scaled so the whole text spans the laid-out line width (absorbing
94
+ * letter-spacing or kerning applied by the layout). */
95
+ function prefixWidth(box, chars) {
96
+ const n = Math.max(0, Math.min(box.text.length, chars));
97
+ if (box.text.length === 0)
98
+ return 0;
99
+ const full = measureInLanguage(box.lang, box.text, box.font);
100
+ if (full === null || !(full > 0))
101
+ return (n / box.text.length) * box.width;
102
+ const prefix = measureInLanguage(box.lang, box.text.slice(0, n), box.font);
103
+ if (prefix === null)
104
+ return (n / box.text.length) * box.width;
105
+ return (prefix / full) * box.width;
106
+ }
107
+ /** X coordinate of the caret placed before character `chars` of the line. */
108
+ export function bandPrefixX(box, chars) {
109
+ return box.x + prefixWidth(box, chars);
110
+ }
111
+ /** Character index (0..text.length) closest to an x coordinate on the line. */
112
+ export function bandCharAtX(box, x) {
113
+ const rel = x - box.x;
114
+ if (rel <= 0)
115
+ return 0;
116
+ if (rel >= box.width)
117
+ return box.text.length;
118
+ // Smallest caret position whose following glyph's midpoint lies past x.
119
+ let lo = 0;
120
+ let hi = box.text.length;
121
+ while (lo < hi) {
122
+ const mid = (lo + hi) >> 1;
123
+ const midpoint = (prefixWidth(box, mid) + prefixWidth(box, mid + 1)) / 2;
124
+ if (midpoint < rel)
125
+ lo = mid + 1;
126
+ else
127
+ hi = mid;
128
+ }
129
+ return lo;
130
+ }
131
+ /** Source offset of character `plainIdx` of the title text (clamped). */
132
+ export function bandPlainToSource(block, plainIdx) {
133
+ const map = block.sourceMap;
134
+ if (map && map.length > 0) {
135
+ if (plainIdx >= map.length)
136
+ return (block.sourceEnd ?? map[map.length - 1] + 1);
137
+ return map[Math.max(0, plainIdx)];
138
+ }
139
+ const len = titleTextOf(block).length || 1;
140
+ const ratio = Math.max(0, Math.min(1, plainIdx / len));
141
+ return (block.sourceStart ?? 0) + Math.round(ratio * ((block.sourceEnd ?? 0) - (block.sourceStart ?? 0)));
142
+ }
143
+ /** Index of the first title character whose source offset is ≥ `offset`
144
+ * (the title's end when the offset lies past the title). What the design
145
+ * prints before the title (a heading number, #546) is never reached: the
146
+ * title starts after it. */
147
+ export function bandSourceToPlain(block, offset) {
148
+ const map = block.sourceMap;
149
+ const len = titleTextOf(block).length;
150
+ if (map && map.length > 0) {
151
+ const end = block.sourceEnd ?? Infinity;
152
+ // Past the title: where it ends, before what the design prints after it.
153
+ if (offset >= end)
154
+ offset = end;
155
+ let lo = Math.min(map.length, Math.max(0, block.sourcePrefixLen ?? 0));
156
+ let hi = map.length;
157
+ while (lo < hi) {
158
+ const mid = (lo + hi) >> 1;
159
+ if (map[mid] < offset)
160
+ lo = mid + 1;
161
+ else
162
+ hi = mid;
163
+ }
164
+ return lo;
165
+ }
166
+ const start = block.sourceStart ?? 0;
167
+ const end = block.sourceEnd ?? start + len;
168
+ const ratio = end > start ? (offset - start) / (end - start) : 0;
169
+ return Math.max(0, Math.min(len, Math.round(ratio * len)));
170
+ }
171
+ //# sourceMappingURL=bandTitle.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bandTitle.js","sourceRoot":"","sources":["../../src/geometry/bandTitle.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAuBrC;;qEAEqE;AACrE,MAAM,UAAU,eAAe,CAAC,GAAgB,EAAE,SAAiB;IACjE,MAAM,IAAI,GAAG,GAAG,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;IAClC,IAAI,CAAC,IAAI;QAAE,OAAO,EAAE,CAAC;IACrB,MAAM,KAAK,GAA+D,CAAC,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;IAChJ,KAAK,MAAM,CAAC,IAAI,GAAG,CAAC,MAAM,EAAE,CAAC;QAC3B,IAAI,CAAC,CAAC,SAAS,KAAK,SAAS,IAAI,CAAC,CAAC,aAAa;YAAE,KAAK,CAAC,IAAI,C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G,CAAC,EAAE,CAAC;QAC1B,MAAM,GAAG,GAAG,KAAK,CAAC,SAAS,IAAI,QAAQ,CAAC;QACxC,yEAAyE;QACzE,IAAI,MAAM,IAAI,GAAG;YAAE,MAAM,GAAG,GAAG,CAAC;QAChC,IAAI,EAAE,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,MAAM,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,CAAC,eAAe,IAAI,CAAC,CAAC,CAAC,CAAC;QACvE,IAAI,EAAE,GAAG,GAAG,CAAC,MAAM,CAAC;QACpB,OAAO,EAAE,GAAG,EAAE,EAAE,CAAC;YACf,MAAM,GAAG,GAAG,CAAC,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,CAAC;YAC3B,IAAI,GAAG,CAAC,GAAG,CAAE,GAAG,MAAM;gBAAE,EAAE,GAAG,GAAG,GAAG,CAAC,CAAC;;gBAChC,EAAE,GAAG,GAAG,CAAC;QAChB,CAAC;QACD,OAAO,EAAE,CAAC;IACZ,CAAC;IACD,MAAM,KAAK,GAAG,KAAK,CAAC,WAAW,IAAI,CAAC,CAAC;IACrC,MAAM,GAAG,GAAG,KAAK,CAAC,SAAS,IAAI,KAAK,GAAG,GAAG,CAAC;IAC3C,MAAM,KAAK,GAAG,GAAG,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,GAAG,KAAK,CAAC,GAAG,CAAC,GAAG,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IACjE,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,IAAI,CAAC,KAAK,CAAC,KAAK,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC;AAC7D,CAAC"}
@@ -0,0 +1,23 @@
1
+ import type { VDTDocument } from '../vdt.js';
2
+ /**
3
+ * Resolve which block should host the caret given a source offset.
4
+ * Prefers the block that actually contains the offset; a caret between two
5
+ * blocks (a blank line, text the page has not laid out yet) goes to the
6
+ * nearer one, and on a tie to the block before it: what is typed after a
7
+ * paragraph shows at its end, never at the head of the next one.
8
+ *
9
+ * `pages` narrows the search to the blocks of a page range (`[from, to)`):
10
+ * a whole-book canvas holds every chapter's blocks with chapter offsets, so
11
+ * the caret of the active chapter is looked up among its own pages only.
12
+ */
13
+ export declare function findCaretBlockIdx(doc: VDTDocument, head: number, pages?: {
14
+ from: number;
15
+ to: number;
16
+ }): number;
17
+ /**
18
+ * The block of a story carried in from chapter `chapter` (#943, #988) that
19
+ * holds the caret `head`, an offset in that chapter's file, on page
20
+ * `pageIndex` (one with lines: not the box around them); -1 when none does.
21
+ */
22
+ export declare function findCarriedCaretBlockIdx(doc: VDTDocument, head: number, chapter: number, pageIndex: number): number;
23
+ //# sourceMappingURL=caret.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"caret.d.ts","sourceRoot":"","sources":["../../src/geometry/caret.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAE7C;;;;;;;;;;GAUG;AACH,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,WAAW,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,EAAE,EAAE,MAAM,CAAA;CAAE,GAAG,MAAM,CA0B9G;AAED;;;;GAIG;AACH,wBAAgB,wBAAwB,CAAC,GAAG,EAAE,WAAW,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,CAOnH"}
@@ -0,0 +1,62 @@
1
+ /**
2
+ * Resolve which block should host the caret given a source offset.
3
+ * Prefers the block that actually contains the offset; a caret between two
4
+ * blocks (a blank line, text the page has not laid out yet) goes to the
5
+ * nearer one, and on a tie to the block before it: what is typed after a
6
+ * paragraph shows at its end, never at the head of the next one.
7
+ *
8
+ * `pages` narrows the search to the blocks of a page range (`[from, to)`):
9
+ * a whole-book canvas holds every chapter's blocks with chapter offsets, so
10
+ * the caret of the active chapter is looked up among its own pages only.
11
+ */
12
+ export function findCaretBlockIdx(doc, head, pages) {
13
+ const inRange = (b) => !pages || (b.pageIndex >= pages.from && b.pageIndex < pages.to);
14
+ let last = -1;
15
+ let before = -1;
16
+ let after = -1;
17
+ for (let i = 0; i < doc.blocks.length; i++) {
18
+ const b = doc.blocks[i];
19
+ if (!inRange(b))
20
+ continue;
21
+ // Text carried in from another chapter (#943) has that file's offsets.
22
+ if (b.sourceChapter !== undefined)
23
+ continue;
24
+ last = i;
25
+ if (b.sourceStart === undefined || b.sourceEnd === undefined)
26
+ continue;
27
+ if (head >= b.sourceStart && head <= b.sourceEnd)
28
+ return i;
29
+ // The block with lines wins over the box round it (same end or start).
30
+ if (b.sourceEnd < head) {
31
+ const held = doc.blocks[before];
32
+ if (!held || b.sourceEnd > held.sourceEnd || (b.sourceEnd === held.sourceEnd && b.lines.length > 0))
33
+ before = i;
34
+ }
35
+ else {
36
+ const held = doc.blocks[after];
37
+ if (!held || b.sourceStart < held.sourceStart || (b.sourceStart === held.sourceStart && held.lines.length === 0 && b.lines.length > 0))
38
+ after = i;
39
+ }
40
+ }
41
+ if (before === -1)
42
+ return after === -1 ? last : after;
43
+ if (after === -1)
44
+ return before;
45
+ return head - doc.blocks[before].sourceEnd <= doc.blocks[after].sourceStart - head ? before : after;
46
+ }
47
+ /**
48
+ * The block of a story carried in from chapter `chapter` (#943, #988) that
49
+ * holds the caret `head`, an offset in that chapter's file, on page
50
+ * `pageIndex` (one with lines: not the box around them); -1 when none does.
51
+ */
52
+ export function findCarriedCaretBlockIdx(doc, head, chapter, pageIndex) {
53
+ for (let i = 0; i < doc.blocks.length; i++) {
54
+ const b = doc.blocks[i];
55
+ if (b.pageIndex !== pageIndex || b.sourceChapter !== chapter || b.lines.length === 0 || b.sourceStart === undefined || b.sourceEnd === undefined)
56
+ continue;
57
+ if (head >= b.sourceStart && head <= b.sourceEnd)
58
+ return i;
59
+ }
60
+ return -1;
61
+ }
62
+ //# sourceMappingURL=caret.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"caret.js","sourceRoot":"","sources":["../../src/geometry/caret.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;GAUG;AACH,MAAM,UAAU,iBAAiB,CAAC,GAAgB,EAAE,IAAY,EAAE,KAAoC;IACpG,MAAM,OAAO,GAAG,CAAC,CAAgC,EAAW,EAAE,CAC5D,CAAC,KAAK,IAAI,CAAC,CAAC,CAAC,SAAS,IAAI,KAAK,CAAC,IAAI,IAAI,CAAC,CAAC,SAAS,GAAG,KAAK,CAAC,EAAE,CAAC,CAAC;IAClE,IAAI,IAAI,GAAG,CAAC,CAAC,CAAC;IACd,IAAI,MAAM,GAAG,CAAC,CAAC,CAAC;IAChB,IAAI,KAAK,GAAG,CAAC,CAAC,CAAC;IACf,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,GAAG,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QAC3C,MAAM,CAAC,GAAG,GAAG,CAAC,MAAM,CAAC,CAAC,CAAE,CAAC;QACzB,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC;YAAE,SAAS;QAC1B,uEAAuE;QACvE,IAAI,CAAC,CAAC,aAAa,KAAK,SAAS;YAAE,SAAS;QAC5C,IAAI,GAAG,CAAC,CAAC;QACT,IAAI,CAAC,CAAC,WAAW,KAAK,SAAS,IAAI,CAAC,CAAC,SAAS,KAAK,SAAS;YAAE,SAAS;QACvE,IAAI,IAAI,IAAI,CAAC,CAAC,WAAW,IAAI,IAAI,IAAI,CAAC,CAAC,SAAS;YAAE,OAAO,CAAC,CAAC;QAC3D,uEAAuE;QACvE,IAAI,CAAC,CAAC,SAAS,GAAG,IAAI,EAAE,CAAC;YACvB,MAAM,IAAI,GAAG,GAAG,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;YAChC,IAAI,CA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C;QACzB,IAAI,CAAC,CAAC,SAAS,KAAK,SAAS,IAAI,CAAC,CAAC,aAAa,KAAK,OAAO,IAAI,CAAC,CAAC,KAAK,CAAC,MAAM,KAAK,CAAC,IAAI,CAAC,CAAC,WAAW,KAAK,SAAS,IAAI,CAAC,CAAC,SAAS,KAAK,SAAS;YAAE,SAAS;QAC3J,IAAI,IAAI,IAAI,CAAC,CAAC,WAAW,IAAI,IAAI,IAAI,CAAC,CAAC,SAAS;YAAE,OAAO,CAAC,CAAC;IAC7D,CAAC;IACD,OAAO,CAAC,CAAC,CAAC;AACZ,CAAC"}
@@ -0,0 +1,15 @@
1
+ /**
2
+ * The px size a CSS font shorthand names (`"italic 600 11.5px Lora"` →
3
+ * 11.5), read in one pass without a regular expression: font strings
4
+ * reach these calls from documents and hosts.
5
+ */
6
+ export declare function fontPx(font: string | undefined): number | undefined;
7
+ /** The family list after the size in a CSS font shorthand, and whether its
8
+ * style and weight words ask for italic or bold. */
9
+ export declare function fontParts(font: string): {
10
+ size?: number;
11
+ family?: string;
12
+ weight?: string;
13
+ style?: string;
14
+ };
15
+ //# sourceMappingURL=fontPx.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fontPx.d.ts","sourceRoot":"","sources":["../../src/geometry/fontPx.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,wBAAgB,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,CAYnE;AAMD;qDACqD;AACrD,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG;IAAE,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,CAS3G"}
@@ -0,0 +1,38 @@
1
+ /**
2
+ * The px size a CSS font shorthand names (`"italic 600 11.5px Lora"` →
3
+ * 11.5), read in one pass without a regular expression: font strings
4
+ * reach these calls from documents and hosts.
5
+ */
6
+ export function fontPx(font) {
7
+ if (!font)
8
+ return undefined;
9
+ const at = font.indexOf('px');
10
+ for (let end = at; end >= 0; end = font.indexOf('px', end + 2)) {
11
+ let start = end;
12
+ while (start > 0 && isNumberChar(font.charCodeAt(start - 1)))
13
+ start--;
14
+ if (start < end) {
15
+ const v = Number(font.slice(start, end));
16
+ if (Number.isFinite(v) && v > 0)
17
+ return v;
18
+ }
19
+ }
20
+ return undefined;
21
+ }
22
+ function isNumberChar(c) {
23
+ return (c >= 48 && c <= 57) || c === 46;
24
+ }
25
+ /** The family list after the size in a CSS font shorthand, and whether its
26
+ * style and weight words ask for italic or bold. */
27
+ export function fontParts(font) {
28
+ const words = font.trim().split(/\s+/);
29
+ const i = words.findIndex((w) => w.endsWith('px') && fontPx(w) !== undefined);
30
+ if (i < 0)
31
+ return {};
32
+ const lead = words.slice(0, i);
33
+ const weight = lead.find((w) => w === 'bold' || /^[1-9]00$/.test(w));
34
+ const style = lead.find((w) => w === 'italic' || w === 'oblique');
35
+ const family = words.slice(i + 1).join(' ');
36
+ return { size: fontPx(words[i]), ...(family ? { family } : {}), ...(weight ? { weight } : {}), ...(style ? { style } : {}) };
37
+ }
38
+ //# sourceMappingURL=fontPx.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fontPx.js","sourceRoot":"","sources":["../../src/geometry/fontPx.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,UAAU,MAAM,CAAC,IAAwB;IAC7C,IAAI,CAAC,IAAI;QAAE,OAAO,SAAS,CAAC;IAC5B,MAAM,EAAE,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IAC9B,KAAK,IAAI,GAAG,GAAG,EAAE,EAAE,GAAG,IAAI,CAAC,EAAE,GAAG,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,GAAG,GAAG,CAAC,CAAC,EAAE,CAAC;QAC/D,IAAI,KAAK,GAAG,GAA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AC,CAAC,KAAK,QAAQ,IAAI,CAAC,KAAK,SAAS,CAAC,CAAC;IAClE,MAAM,MAAM,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAC5C,OAAO,EAAE,IAAI,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC;AAC/H,CAAC"}
@@ -0,0 +1,31 @@
1
+ import type { VDTComicBalloon, VDTComposedPage, VDTPage, VDTPoint } from '../vdt.js';
2
+ /** A 2D affine matrix `[a b c d e f]` (canvas `transform` order, y down). */
3
+ export type FrameAffine = [number, number, number, number, number, number];
4
+ /** A point in px. */
5
+ export interface FramePoint {
6
+ x: number;
7
+ y: number;
8
+ }
9
+ /** A page, or anything that carries a composed page. */
10
+ export type ComposedPageLike = Pick<VDTPage, 'composed'> | {
11
+ composed?: VDTComposedPage;
12
+ };
13
+ /** The matrix that puts the blocks of the frame holding block `blockId`
14
+ * on the page's flow (`frameMatrix`), null when the block is in no frame
15
+ * or its frame is upright at full size. */
16
+ export declare function blockFrameMatrix(page: ComposedPageLike | null | undefined, blockId: string): FrameAffine | null;
17
+ /** Whether a point in a frame block's own coordinates (see
18
+ * {@link intoBlockSpace}) is painted: false past the foot of a frame
19
+ * whose content overflows its box, where the backends clip it. */
20
+ export declare function blockPointShown(page: ComposedPageLike | null | undefined, blockId: string, p: FramePoint): boolean;
21
+ /** A point of the page's flow in the blocks' own coordinates of a frame
22
+ * whose matrix is `m` (the inverse of {@link blockFrameMatrix}); the
23
+ * point itself when `m` is null. */
24
+ export declare function intoBlockSpace(m: FrameAffine | null, x: number, y: number): FramePoint;
25
+ /** A point of a frame's blocks on the page's flow (through `m`, as painted). */
26
+ export declare function fromBlockSpace(m: FrameAffine | null, x: number, y: number): FramePoint;
27
+ /** A sheet point in a balloon's own frame (the inverse of its turn and lean). */
28
+ export declare function toBalloonFrame(b: Pick<VDTComicBalloon, 'bbox' | 'rotate' | 'skew'>, p: VDTPoint): VDTPoint;
29
+ /** A point of a balloon's own frame on the sheet. */
30
+ export declare function fromBalloonFrame(b: Pick<VDTComicBalloon, 'bbox' | 'rotate' | 'skew'>, p: VDTPoint): VDTPoint;
31
+ //# sourceMappingURL=frameSpace.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"frameSpace.d.ts","sourceRoot":"","sources":["../../src/geometry/frameSpace.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,eAAe,EAAE,eAAe,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAErF,6EAA6E;AAC7E,MAAM,MAAM,WAAW,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;AAE3E,qBAAqB;AACrB,MAAM,WAAW,UAAU;IACzB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX;AAED,wDAAwD;AACxD,MAAM,MAAM,gBAAgB,GAAG,IAAI,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG;IAAE,QAAQ,CAAC,EAAE,eAAe,CAAA;CAAE,CAAC;AAE1F;;4CAE4C;AAC5C,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,gBAAgB,GAAG,IAAI,GAAG,SAAS,EAAE,OAAO,EAAE,MAAM,GAAG,WAAW,GAAG,IAAI,CAK/G;AAED;;mEAEmE;AACnE,wBAAgB,eAAe,CAAC,IAAI,EAAE,gBAAgB,GAAG,IAAI,GAAG,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC,EAAE,UAAU,GAAG,OAAO,CAOlH;AAED;;qCAEqC;AACrC,wBAAgB,cAAc,CAAC,CAAC,EAAE,WAAW,GAAG,IAAI,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,UAAU,CAQtF;AAED,gFAAgF;AAChF,wBAAgB,cAAc,CAAC,CAAC,EAAE,WAAW,GAAG,IAAI,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,UAAU,CAGtF;AAED,iFAAiF;AACjF,wBAAgB,cAAc,CAAC,CAAC,EAAE,IAAI,CAAC,eAAe,EAAE,MAAM,GAAG,QAAQ,GAAG,MAAM,CAAC,EAAE,CAAC,EAAE,QAAQ,GAAG,QAAQ,CAQ1G;AAED,qDAAqD;AACrD,wBAAgB,gBAAgB,CAAC,CAAC,EAAE,IAAI,CAAC,eAAe,EAAE,MAAM,GAAG,QAAQ,GAAG,MAAM,CAAC,EAAE,CAAC,EAAE,QAAQ,GAAG,QAAQ,CAG5G"}
@@ -0,0 +1,68 @@
1
+ /**
2
+ * The coordinates the geometry reads text in (#1761): a composed frame's
3
+ * blocks keep the frame's own coordinates (its text scale, #858, and its
4
+ * turn, #910), put on the page's flow by the frame's matrix; a comic
5
+ * balloon keeps its own, put on the sheet by its turn and lean.
6
+ */
7
+ import { frameClips, frameContentRect, frameMatrix, frameOfBlock } from '../composed/paint.js';
8
+ import { comicBalloonMatrix } from '../comics/paint.js';
9
+ /** The matrix that puts the blocks of the frame holding block `blockId`
10
+ * on the page's flow (`frameMatrix`), null when the block is in no frame
11
+ * or its frame is upright at full size. */
12
+ export function blockFrameMatrix(page, blockId) {
13
+ const composed = page?.composed;
14
+ if (!composed || composed.frames.length === 0)
15
+ return null;
16
+ const frame = frameOfBlock(composed, blockId);
17
+ return (frame && frameMatrix(frame)) ?? null;
18
+ }
19
+ /** Whether a point in a frame block's own coordinates (see
20
+ * {@link intoBlockSpace}) is painted: false past the foot of a frame
21
+ * whose content overflows its box, where the backends clip it. */
22
+ export function blockPointShown(page, blockId, p) {
23
+ const composed = page?.composed;
24
+ if (!composed || composed.frames.length === 0)
25
+ return true;
26
+ const frame = frameOfBlock(composed, blockId);
27
+ if (!frame || !frameClips(frame))
28
+ return true;
29
+ const r = frameContentRect(frame);
30
+ return p.x >= r.x && p.x <= r.x + r.width && p.y >= r.y && p.y <= r.y + r.height;
31
+ }
32
+ /** A point of the page's flow in the blocks' own coordinates of a frame
33
+ * whose matrix is `m` (the inverse of {@link blockFrameMatrix}); the
34
+ * point itself when `m` is null. */
35
+ export function intoBlockSpace(m, x, y) {
36
+ if (!m)
37
+ return { x, y };
38
+ const [a, b, c, d, e, f] = m;
39
+ const det = a * d - b * c;
40
+ if (!det)
41
+ return { x, y };
42
+ const dx = x - e;
43
+ const dy = y - f;
44
+ return { x: (d * dx - c * dy) / det, y: (-b * dx + a * dy) / det };
45
+ }
46
+ /** A point of a frame's blocks on the page's flow (through `m`, as painted). */
47
+ export function fromBlockSpace(m, x, y) {
48
+ if (!m)
49
+ return { x, y };
50
+ return { x: m[0] * x + m[2] * y + m[4], y: m[1] * x + m[3] * y + m[5] };
51
+ }
52
+ /** A sheet point in a balloon's own frame (the inverse of its turn and lean). */
53
+ export function toBalloonFrame(b, p) {
54
+ const m = comicBalloonMatrix(b);
55
+ if (!m)
56
+ return p;
57
+ const [a, bb, c, d, e, f] = m;
58
+ const det = a * d - bb * c;
59
+ const x = p.x - e;
60
+ const y = p.y - f;
61
+ return { x: (d * x - c * y) / det, y: (-bb * x + a * y) / det };
62
+ }
63
+ /** A point of a balloon's own frame on the sheet. */
64
+ export function fromBalloonFrame(b, p) {
65
+ const m = comicBalloonMatrix(b);
66
+ return m ? { x: m[0] * p.x + m[2] * p.y + m[4], y: m[1] * p.x + m[3] * p.y + m[5] } : p;
67
+ }
68
+ //# sourceMappingURL=frameSpace.js.map
@@ -0,0 +1 @@
1
+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t.js';
2
+ import { type ResourceLocation } from './placement.js';
3
+ /**
4
+ * The image a design slot draws under a page pixel — an opener band's cover
5
+ * picture, a header logo, an advanced heading design's plate — as the blob
6
+ * id the block was resolved to, or null when none is there. Slots paint in
7
+ * order (in-column overlays, then the opener band, header and footer) and
8
+ * later blocks over earlier ones, so the last hit wins. The point is on the
9
+ * sheet: on a vertical page it is turned into the flow frame for every slot
10
+ * but the header and the footer.
11
+ */
12
+ export declare function designImageFileIdAtPixel(doc: VDTDocument, pageIndex: number, xPage: number, yPage: number): string | null;
13
+ export declare function refResourceIdAtPixel(doc: VDTDocument, pageIndex: number, xPage: number, yPage: number): string | null;
14
+ /** What a click on a linked segment goes to (#265): a resource or an
15
+ * anchor a `:ref` names (with the book page the anchor landed on, when
16
+ * known), a footnote's note, a book page (an index page number) or a URL
17
+ * (a Markdown link). */
18
+ export type LinkTarget = {
19
+ kind: 'resource';
20
+ id: string;
21
+ } | {
22
+ kind: 'anchor';
23
+ id: string;
24
+ pageIndex?: number;
25
+ } | {
26
+ kind: 'footnote';
27
+ id: string;
28
+ } | {
29
+ kind: 'page';
30
+ pageIndex: number;
31
+ } | {
32
+ kind: 'url';
33
+ href: string;
34
+ };
35
+ /** The link of the segment at page-space pixel coordinates, or null. */
36
+ export declare function linkTargetAtPixel(doc: VDTDocument, pageIndex: number, xPage: number, yPage: number): LinkTarget | null;
37
+ /** Where an anchor or a footnote's note landed in `doc` (#265), or null
38
+ * when it is not in this document. */
39
+ export declare function findLinkLocation(doc: VDTDocument, target: LinkTarget): ResourceLocation | null;
40
+ /**
41
+ * Hit-test a row of the contents (`:::toc`) at page-space pixel
42
+ * coordinates: the book page index the row points at, or null when the
43
+ * click isn't on a row that knows its page.
44
+ */
45
+ export declare function pageTargetAtPixel(doc: VDTDocument, pageIndex: number, xPage: number, yPage: number): number | null;
46
+ //# sourceMappingURL=hitTest.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hitTest.d.ts","sourceRoot":"","sources":["../../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