@folijs/view 0.5.0 → 0.6.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/CHANGELOG.md +33 -0
- package/dist/clipboard.d.ts +3 -1
- package/dist/clipboard.d.ts.map +1 -1
- package/dist/clipboard.js.map +1 -1
- package/dist/layout/flow.d.ts +193 -20
- package/dist/layout/flow.d.ts.map +1 -1
- package/dist/layout/flow.js +789 -101
- package/dist/layout/flow.js.map +1 -1
- package/dist/print.d.ts +22 -0
- package/dist/print.d.ts.map +1 -0
- package/dist/print.js +31 -0
- package/dist/print.js.map +1 -0
- package/dist/view.d.ts +220 -7
- package/dist/view.d.ts.map +1 -1
- package/dist/view.js +1753 -208
- package/dist/view.js.map +1 -1
- package/dist/word/blocks.d.ts +30 -1
- package/dist/word/blocks.d.ts.map +1 -1
- package/dist/word/blocks.js +193 -40
- package/dist/word/blocks.js.map +1 -1
- package/dist/word/columns.d.ts +23 -0
- package/dist/word/columns.d.ts.map +1 -0
- package/dist/word/columns.js +51 -0
- package/dist/word/columns.js.map +1 -0
- package/dist/word/controls.d.ts +63 -0
- package/dist/word/controls.d.ts.map +1 -0
- package/dist/word/controls.js +411 -0
- package/dist/word/controls.js.map +1 -0
- package/dist/word/edit.d.ts +17 -5
- package/dist/word/edit.d.ts.map +1 -1
- package/dist/word/edit.js +157 -26
- package/dist/word/edit.js.map +1 -1
- package/dist/word/matches.d.ts +23 -0
- package/dist/word/matches.d.ts.map +1 -0
- package/dist/word/matches.js +97 -0
- package/dist/word/matches.js.map +1 -0
- package/dist/word/notes.d.ts +105 -0
- package/dist/word/notes.d.ts.map +1 -0
- package/dist/word/notes.js +392 -0
- package/dist/word/notes.js.map +1 -0
- package/dist/word/pages.d.ts +18 -13
- package/dist/word/pages.d.ts.map +1 -1
- package/dist/word/pages.js +420 -229
- package/dist/word/pages.js.map +1 -1
- package/dist/word/regions.d.ts +113 -0
- package/dist/word/regions.d.ts.map +1 -0
- package/dist/word/regions.js +374 -0
- package/dist/word/regions.js.map +1 -0
- package/package.json +2 -2
- package/src/clipboard.ts +3 -0
- package/src/layout/flow.ts +945 -110
- package/src/print.ts +48 -0
- package/src/view.ts +1957 -229
- package/src/word/blocks.ts +219 -36
- package/src/word/columns.ts +66 -0
- package/src/word/controls.ts +447 -0
- package/src/word/edit.ts +175 -23
- package/src/word/matches.ts +99 -0
- package/src/word/notes.ts +451 -0
- package/src/word/pages.ts +501 -220
- package/src/word/regions.ts +469 -0
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Footnotes and endnotes on pages (11.10, ADR-0007), for both renderers: a note measured as lines
|
|
3
|
+
* for the flow, and its pieces drawn at the column's foot or, for endnotes, after the text. A note
|
|
4
|
+
* is drawn from the model by the read-only blocks renderer, its number filled in.
|
|
5
|
+
*/
|
|
6
|
+
import { type FoliDocument, type NoteNumber, type Resolver, type SectionJSON, type StoryJSON } from "@folijs/core";
|
|
7
|
+
import { type FlowNote, type FlowRules, type NotePiece } from "../layout/flow.js";
|
|
8
|
+
import { type RegionOptions } from "./regions.js";
|
|
9
|
+
/** On a piece of a note drawn on a page: the story. */
|
|
10
|
+
export declare const NOTE_ATTR = "data-foli-note";
|
|
11
|
+
/** The class of what holds a column's notes. */
|
|
12
|
+
export declare const NOTES_CLASS = "foli-notes";
|
|
13
|
+
/**
|
|
14
|
+
* The bottom of each line of a rendered block, from its top. Lines are the vertical clusters of
|
|
15
|
+
* its contents' client rects; a boundary is halfway between one line's content and the next's,
|
|
16
|
+
* the last line ends at the block's bottom.
|
|
17
|
+
*
|
|
18
|
+
* shortcut: line boxes are inferred from content rects (exact for even line heights); a
|
|
19
|
+
* superscript or a much larger run on a line moves that line's boundaries slightly.
|
|
20
|
+
*/
|
|
21
|
+
export declare function lineBottoms(element: HTMLElement): number[];
|
|
22
|
+
/** A note at a width, with its number, as drawn and measured. */
|
|
23
|
+
interface Drawn {
|
|
24
|
+
serial: number;
|
|
25
|
+
template: HTMLElement;
|
|
26
|
+
/** The bottom of each line, from its top. */
|
|
27
|
+
lines: number[];
|
|
28
|
+
}
|
|
29
|
+
export type NoteCache = WeakMap<StoryJSON, Map<string, Drawn>>;
|
|
30
|
+
/** The notes at a band's foot, or after the text of one of its columns. */
|
|
31
|
+
export interface NoteGroup {
|
|
32
|
+
page: number;
|
|
33
|
+
band: number;
|
|
34
|
+
/** In the flow, its column. */
|
|
35
|
+
column: number;
|
|
36
|
+
/** In the text's flow: endnotes, and footnotes set beneath the text. */
|
|
37
|
+
inFlow: boolean;
|
|
38
|
+
pieces: NotePiece[];
|
|
39
|
+
/** The section whose columns they are in. */
|
|
40
|
+
section: number;
|
|
41
|
+
}
|
|
42
|
+
/** What a document's pages need to know of its notes. */
|
|
43
|
+
export declare class PageNotes {
|
|
44
|
+
private readonly doc;
|
|
45
|
+
private readonly options;
|
|
46
|
+
cache: NoteCache;
|
|
47
|
+
private document;
|
|
48
|
+
private sections;
|
|
49
|
+
private resolver;
|
|
50
|
+
private references;
|
|
51
|
+
private numbers;
|
|
52
|
+
/** The note being edited: whole, one line to the flow. */
|
|
53
|
+
open: string | null;
|
|
54
|
+
constructor(doc: Document, options: RegionOptions, cache: NoteCache);
|
|
55
|
+
/** What is laid out now: the references shown, in order, with their numbers. */
|
|
56
|
+
setDocument(document: Omit<FoliDocument, "content">, sections: readonly SectionJSON[], resolver: Resolver, references: readonly NoteNumber[]): void;
|
|
57
|
+
private story;
|
|
58
|
+
/** The separator of `kind`, the document's own or Word's. */
|
|
59
|
+
private separator;
|
|
60
|
+
private storyFor;
|
|
61
|
+
private drawn;
|
|
62
|
+
/** The lines of story `id` in `width`; the note being edited is one, whole. */
|
|
63
|
+
private linesOf;
|
|
64
|
+
private flowNote;
|
|
65
|
+
private widths;
|
|
66
|
+
/** The footnote `story` as the flow takes it, when its reference is shown. */
|
|
67
|
+
footnote(story: string, section: number): FlowNote | null;
|
|
68
|
+
/** What goes above footnotes, when the document has any on its pages. */
|
|
69
|
+
flowRules(): FlowRules["notes"];
|
|
70
|
+
/** The endnotes that follow the last block of each section, with their separator. */
|
|
71
|
+
endnotes(): Map<number, FlowNote[]>;
|
|
72
|
+
/** A change in what any of these measures means a new flow. */
|
|
73
|
+
key(): string;
|
|
74
|
+
/** The notes of each column of each page, foot and flow apart. */
|
|
75
|
+
groups(pieces: readonly NotePiece[], sectionOf: (page: number, band: number) => number): NoteGroup[];
|
|
76
|
+
private widthOf;
|
|
77
|
+
private pieceHeight;
|
|
78
|
+
/** A group as it is set: its separators, then each piece in its column. */
|
|
79
|
+
private arranged;
|
|
80
|
+
/** How tall a group is. */
|
|
81
|
+
heightOf(group: NoteGroup): number;
|
|
82
|
+
/** What identifies how a group looks: the same key, the same drawing. */
|
|
83
|
+
keyOf(group: NoteGroup): string;
|
|
84
|
+
/** A piece of a note: the note's lines shown, clipped to them unless it is whole. */
|
|
85
|
+
pieceElement(piece: NotePiece, group: NoteGroup): HTMLElement;
|
|
86
|
+
/** The element of a group, its pieces given by `pieceOf` (one kept while it is being edited). */
|
|
87
|
+
groupElement(group: NoteGroup, place: {
|
|
88
|
+
left: number;
|
|
89
|
+
bottom: number;
|
|
90
|
+
} | null, pieceOf?: (piece: NotePiece) => HTMLElement,
|
|
91
|
+
/** Above a group in the flow: the space after the text it follows. */
|
|
92
|
+
lead?: number): HTMLElement;
|
|
93
|
+
/** Where the foot of a band is: from the page's left edge and bottom edge. */
|
|
94
|
+
footPlace(margins: {
|
|
95
|
+
left: number;
|
|
96
|
+
bottom: number;
|
|
97
|
+
}, stacked: number): {
|
|
98
|
+
left: number;
|
|
99
|
+
bottom: number;
|
|
100
|
+
};
|
|
101
|
+
/** How much of the foot the bands below a group's take, on its page. */
|
|
102
|
+
stacked(group: NoteGroup, groups: readonly NoteGroup[]): number;
|
|
103
|
+
}
|
|
104
|
+
export {};
|
|
105
|
+
//# sourceMappingURL=notes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"notes.d.ts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,QAAQ,CAAC,KAAK,EAAE,SAAS,GAAG,MAAM,CAGjC;IAED,yEAAyE;IACzE,KAAK,CAAC,KAAK,EAAE,SAAS,GAAG,MAAM,CAQ9B;IAED,qFAAqF;IACrF,YAAY,CAAC,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE,SAAS,GAAG,WAAW,CAoB5D;IAED,iGAAiG;IACjG,YAAY,CACV,KAAK,EAAE,SAAS,EAChB,KAAK,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,EAC9C,OAAO,GAAE,CAAC,KAAK,EAAE,SAAS,KAAK,WAAwD;IACvF,sEAAsE;IACtE,IAAI,SAAI,GACP,WAAW,CAmCb;IAED,8EAA8E;IAC9E,SAAS,CAAC,OAAO,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,EAAE,OAAO,EAAE,MAAM;QACzD,IAAI;QAAgB,MAAM;MACpC;IAED,wEAAwE;IACxE,OAAO,CAAC,KAAK,EAAE,SAAS,EAAE,MAAM,EAAE,SAAS,SAAS,EAAE,GAAG,MAAM,CAM9D;CACF"}
|
|
@@ -0,0 +1,392 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Footnotes and endnotes on pages (11.10, ADR-0007), for both renderers: a note measured as lines
|
|
3
|
+
* for the flow, and its pieces drawn at the column's foot or, for endnotes, after the text. A note
|
|
4
|
+
* is drawn from the model by the read-only blocks renderer, its number filled in.
|
|
5
|
+
*/
|
|
6
|
+
import { noteKindOf, noteProperties, } from "@folijs/core";
|
|
7
|
+
import { arrangeNotes } from "../layout/flow.js";
|
|
8
|
+
import { renderBlocks } from "./blocks.js";
|
|
9
|
+
import { columnsPx } from "./columns.js";
|
|
10
|
+
import { REGION_CLASS, REGION_CONTENT_CLASS, stack } from "./regions.js";
|
|
11
|
+
/** On a piece of a note drawn on a page: the story. */
|
|
12
|
+
export const NOTE_ATTR = "data-foli-note";
|
|
13
|
+
/** The class of what holds a column's notes. */
|
|
14
|
+
export const NOTES_CLASS = "foli-notes";
|
|
15
|
+
/**
|
|
16
|
+
* The bottom of each line of a rendered block, from its top. Lines are the vertical clusters of
|
|
17
|
+
* its contents' client rects; a boundary is halfway between one line's content and the next's,
|
|
18
|
+
* the last line ends at the block's bottom.
|
|
19
|
+
*
|
|
20
|
+
* shortcut: line boxes are inferred from content rects (exact for even line heights); a
|
|
21
|
+
* superscript or a much larger run on a line moves that line's boundaries slightly.
|
|
22
|
+
*/
|
|
23
|
+
export function lineBottoms(element) {
|
|
24
|
+
const box = element.getBoundingClientRect();
|
|
25
|
+
const doc = element.ownerDocument;
|
|
26
|
+
const range = doc.createRange();
|
|
27
|
+
const rects = [];
|
|
28
|
+
// Text and line breaks only: a range over the whole block also has the boxes of the
|
|
29
|
+
// elements inside it (a table's), which span many lines.
|
|
30
|
+
const walker = doc.createTreeWalker(element, NodeFilter.SHOW_TEXT | NodeFilter.SHOW_ELEMENT);
|
|
31
|
+
for (let node = walker.nextNode(); node; node = walker.nextNode()) {
|
|
32
|
+
if (node.nodeType === Node.TEXT_NODE) {
|
|
33
|
+
// A raised number says nothing about where its line is.
|
|
34
|
+
if (node.parentElement?.style.verticalAlign === "super")
|
|
35
|
+
continue;
|
|
36
|
+
range.selectNodeContents(node);
|
|
37
|
+
for (const rect of range.getClientRects())
|
|
38
|
+
rects.push({ rect, text: true });
|
|
39
|
+
}
|
|
40
|
+
else if (node.nodeName === "BR")
|
|
41
|
+
rects.push({ rect: node.getBoundingClientRect(), text: false });
|
|
42
|
+
}
|
|
43
|
+
rects.sort((a, b) => a.rect.top - b.rect.top);
|
|
44
|
+
const lines = [];
|
|
45
|
+
for (const { rect, text } of rects) {
|
|
46
|
+
if (rect.height <= 0)
|
|
47
|
+
continue;
|
|
48
|
+
const last = lines[lines.length - 1];
|
|
49
|
+
// Same line: it starts above the middle of the line so far.
|
|
50
|
+
if (last && rect.top < (last.top + last.bottom) / 2) {
|
|
51
|
+
// A line's text says where it is; a <br> only for a line without text (engines size
|
|
52
|
+
// its box differently).
|
|
53
|
+
if (text && !last.text)
|
|
54
|
+
Object.assign(last, { top: rect.top, bottom: rect.bottom, text });
|
|
55
|
+
else if (text === last.text) {
|
|
56
|
+
last.top = Math.min(last.top, rect.top);
|
|
57
|
+
last.bottom = Math.max(last.bottom, rect.bottom);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
else
|
|
61
|
+
lines.push({ top: rect.top, bottom: rect.bottom, text });
|
|
62
|
+
}
|
|
63
|
+
const bottoms = lines.slice(1).map((line, i) => {
|
|
64
|
+
const above = lines[i];
|
|
65
|
+
return (above.bottom + line.top) / 2 - box.top;
|
|
66
|
+
});
|
|
67
|
+
bottoms.push(box.height);
|
|
68
|
+
return bottoms;
|
|
69
|
+
}
|
|
70
|
+
/** Word's separators when a document has none of its own. */
|
|
71
|
+
const defaultSeparator = (type) => ({
|
|
72
|
+
kind: "footnote",
|
|
73
|
+
noteType: type,
|
|
74
|
+
content: {
|
|
75
|
+
type: "doc",
|
|
76
|
+
content: [
|
|
77
|
+
{
|
|
78
|
+
type: "paragraph",
|
|
79
|
+
attrs: { spacing: { after: 0, line: 240, lineRule: "auto" } },
|
|
80
|
+
content: [{ type: "opaqueInline", attrs: { xml: `<w:r><w:${type}/></w:r>`, label: type } }],
|
|
81
|
+
},
|
|
82
|
+
],
|
|
83
|
+
},
|
|
84
|
+
});
|
|
85
|
+
const DEFAULT_SEPARATOR = defaultSeparator("separator");
|
|
86
|
+
/**
|
|
87
|
+
* What a story shows: a separator single spaced with nothing before or after it, whatever its
|
|
88
|
+
* paragraph says (Word's PDFs: a bare separator and one with that spacing sit alike).
|
|
89
|
+
*/
|
|
90
|
+
function asWordSets(story) {
|
|
91
|
+
if ((story.noteType ?? "normal") === "normal")
|
|
92
|
+
return story.content;
|
|
93
|
+
const spacing = { before: 0, after: 0, line: 240, lineRule: "auto" };
|
|
94
|
+
return {
|
|
95
|
+
...story.content,
|
|
96
|
+
content: (story.content.content ?? []).map((block) => block.type === "paragraph"
|
|
97
|
+
? { ...block, attrs: { ...block.attrs, spacing: { ...spacing } } }
|
|
98
|
+
: block),
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
const DEFAULT_CONTINUATION = defaultSeparator("continuationSeparator");
|
|
102
|
+
let serial = 0;
|
|
103
|
+
/** What a document's pages need to know of its notes. */
|
|
104
|
+
export class PageNotes {
|
|
105
|
+
doc;
|
|
106
|
+
options;
|
|
107
|
+
cache;
|
|
108
|
+
document = null;
|
|
109
|
+
sections = [];
|
|
110
|
+
resolver = null;
|
|
111
|
+
references = [];
|
|
112
|
+
numbers = new Map();
|
|
113
|
+
/** The note being edited: whole, one line to the flow. */
|
|
114
|
+
open = null;
|
|
115
|
+
constructor(doc, options, cache) {
|
|
116
|
+
this.doc = doc;
|
|
117
|
+
this.options = options;
|
|
118
|
+
this.cache = cache;
|
|
119
|
+
}
|
|
120
|
+
/** What is laid out now: the references shown, in order, with their numbers. */
|
|
121
|
+
setDocument(document, sections, resolver, references) {
|
|
122
|
+
this.document = document;
|
|
123
|
+
this.sections = sections;
|
|
124
|
+
this.resolver = resolver;
|
|
125
|
+
this.references = references;
|
|
126
|
+
this.numbers = new Map(references.map((n) => [n.story, n.text]));
|
|
127
|
+
}
|
|
128
|
+
story(id) {
|
|
129
|
+
const stories = this.document?.stories;
|
|
130
|
+
return stories && Object.hasOwn(stories, id) ? stories[id] : undefined;
|
|
131
|
+
}
|
|
132
|
+
/** The separator of `kind`, the document's own or Word's. */
|
|
133
|
+
separator(kind, type) {
|
|
134
|
+
const found = Object.entries(this.document?.stories ?? {}).find(([, story]) => story.kind === kind && story.noteType === type);
|
|
135
|
+
return found
|
|
136
|
+
? { id: found[0], story: found[1] }
|
|
137
|
+
: {
|
|
138
|
+
id: `${kind}:${type}`,
|
|
139
|
+
story: type === "separator" ? DEFAULT_SEPARATOR : DEFAULT_CONTINUATION,
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
storyFor(id) {
|
|
143
|
+
if (id === "footnote:separator" || id === "endnote:separator")
|
|
144
|
+
return DEFAULT_SEPARATOR;
|
|
145
|
+
if (id.endsWith(":continuationSeparator"))
|
|
146
|
+
return DEFAULT_CONTINUATION;
|
|
147
|
+
return this.story(id);
|
|
148
|
+
}
|
|
149
|
+
drawn(id, width) {
|
|
150
|
+
const story = this.storyFor(id);
|
|
151
|
+
const mark = this.numbers.get(id) ?? "";
|
|
152
|
+
let byKey = this.cache.get(story);
|
|
153
|
+
if (!byKey) {
|
|
154
|
+
byKey = new Map();
|
|
155
|
+
this.cache.set(story, byKey);
|
|
156
|
+
}
|
|
157
|
+
const key = `${mark}|${width}`;
|
|
158
|
+
let found = byKey.get(key);
|
|
159
|
+
if (!found) {
|
|
160
|
+
const template = this.doc.createElement("div");
|
|
161
|
+
template.className = REGION_CONTENT_CLASS;
|
|
162
|
+
template.style.paddingTop = "0.01px";
|
|
163
|
+
const options = {
|
|
164
|
+
...this.options,
|
|
165
|
+
notes: { mark },
|
|
166
|
+
...(this.resolver ? { resolver: this.resolver } : {}),
|
|
167
|
+
};
|
|
168
|
+
const blocks = renderBlocks({ ...this.document, content: asWordSets(story) }, this.doc, options);
|
|
169
|
+
const after = stack(blocks, template, !!this.resolver?.addsParagraphSpacing);
|
|
170
|
+
const { style } = template;
|
|
171
|
+
style.position = "absolute";
|
|
172
|
+
style.visibility = "hidden";
|
|
173
|
+
style.width = `${width}px`;
|
|
174
|
+
this.options.measureIn().append(template);
|
|
175
|
+
const scale = this.options.scale?.() ?? 1;
|
|
176
|
+
const top = template.getBoundingClientRect().top;
|
|
177
|
+
const lines = blocks.flatMap(({ element }) => {
|
|
178
|
+
const offset = (element.getBoundingClientRect().top - top) / scale;
|
|
179
|
+
return lineBottoms(element).map((bottom) => offset + bottom / scale);
|
|
180
|
+
});
|
|
181
|
+
template.remove();
|
|
182
|
+
style.position = "";
|
|
183
|
+
style.visibility = "";
|
|
184
|
+
style.width = "";
|
|
185
|
+
// The last space after is the note's: the next one starts below it.
|
|
186
|
+
if (lines.length)
|
|
187
|
+
lines[lines.length - 1] = lines.at(-1) + after;
|
|
188
|
+
found = { serial: ++serial, template, lines: lines.length ? lines : [0] };
|
|
189
|
+
byKey.set(key, found);
|
|
190
|
+
}
|
|
191
|
+
return found;
|
|
192
|
+
}
|
|
193
|
+
/** The lines of story `id` in `width`; the note being edited is one, whole. */
|
|
194
|
+
linesOf(id, width) {
|
|
195
|
+
const { lines } = this.drawn(id, width);
|
|
196
|
+
return id === this.open ? [lines.at(-1)] : lines;
|
|
197
|
+
}
|
|
198
|
+
flowNote(id, widths) {
|
|
199
|
+
return { id, lines: (column) => this.linesOf(id, widths[column] ?? widths[0]) };
|
|
200
|
+
}
|
|
201
|
+
widths(section) {
|
|
202
|
+
return columnsPx(this.sections[section] ?? {}).widths;
|
|
203
|
+
}
|
|
204
|
+
/** The footnote `story` as the flow takes it, when its reference is shown. */
|
|
205
|
+
footnote(story, section) {
|
|
206
|
+
return noteKindOf(story) === "footnote" && this.numbers.has(story) && this.story(story)
|
|
207
|
+
? this.flowNote(story, this.widths(section))
|
|
208
|
+
: null;
|
|
209
|
+
}
|
|
210
|
+
/** What goes above footnotes, when the document has any on its pages. */
|
|
211
|
+
flowRules() {
|
|
212
|
+
if (!this.references.some((n) => n.kind === "footnote" && this.story(n.story)))
|
|
213
|
+
return undefined;
|
|
214
|
+
const widths = this.widths(0);
|
|
215
|
+
return {
|
|
216
|
+
separator: this.flowNote(this.separator("footnote", "separator").id, widths),
|
|
217
|
+
continuation: this.flowNote(this.separator("footnote", "continuationSeparator").id, widths),
|
|
218
|
+
};
|
|
219
|
+
}
|
|
220
|
+
/** The endnotes that follow the last block of each section, with their separator. */
|
|
221
|
+
endnotes() {
|
|
222
|
+
const out = new Map();
|
|
223
|
+
const lastSection = Math.max(this.sections.length - 1, 0);
|
|
224
|
+
const document = this.document;
|
|
225
|
+
if (!document)
|
|
226
|
+
return out;
|
|
227
|
+
const atSectionEnd = noteProperties(document, "endnote").position === "sectEnd";
|
|
228
|
+
for (const { story, kind, section } of this.references) {
|
|
229
|
+
if (kind !== "endnote" || !this.story(story))
|
|
230
|
+
continue;
|
|
231
|
+
const at = atSectionEnd ? section : lastSection;
|
|
232
|
+
const list = out.get(at) ?? [
|
|
233
|
+
this.flowNote(this.separator("endnote", "separator").id, this.widths(at)),
|
|
234
|
+
];
|
|
235
|
+
list.push(this.flowNote(story, this.widths(at)));
|
|
236
|
+
out.set(at, list);
|
|
237
|
+
}
|
|
238
|
+
return out;
|
|
239
|
+
}
|
|
240
|
+
/** A change in what any of these measures means a new flow. */
|
|
241
|
+
key() {
|
|
242
|
+
if (!this.references.length)
|
|
243
|
+
return "";
|
|
244
|
+
const heights = this.references
|
|
245
|
+
.filter((n) => this.story(n.story))
|
|
246
|
+
.map(({ story, section }) => {
|
|
247
|
+
const lines = this.linesOf(story, this.widths(section)[0]);
|
|
248
|
+
return `${lines.length}:${lines.at(-1)}`;
|
|
249
|
+
});
|
|
250
|
+
return `${this.open ?? ""}|${heights.join(" ")}`;
|
|
251
|
+
}
|
|
252
|
+
/** The notes of each column of each page, foot and flow apart. */
|
|
253
|
+
groups(pieces, sectionOf) {
|
|
254
|
+
const groups = new Map();
|
|
255
|
+
for (const piece of pieces) {
|
|
256
|
+
const band = piece.band ?? 0;
|
|
257
|
+
const column = piece.column ?? 0;
|
|
258
|
+
const section = sectionOf(piece.page, band);
|
|
259
|
+
const setup = this.sections[section];
|
|
260
|
+
// Beneath the text: with one column, whose text they then follow.
|
|
261
|
+
const beneath = !!this.document &&
|
|
262
|
+
this.widths(section).length === 1 &&
|
|
263
|
+
noteProperties(this.document, "footnote", setup).position === "beneathText";
|
|
264
|
+
const inFlow = !!piece.end || (beneath && noteKindOf(piece.id) === "footnote");
|
|
265
|
+
const key = `${piece.page}|${band}|${inFlow ? column : 0}|${inFlow}`;
|
|
266
|
+
let group = groups.get(key);
|
|
267
|
+
if (!group) {
|
|
268
|
+
group = { page: piece.page, band, column, inFlow, pieces: [], section };
|
|
269
|
+
groups.set(key, group);
|
|
270
|
+
}
|
|
271
|
+
group.pieces.push(piece);
|
|
272
|
+
}
|
|
273
|
+
return [...groups.values()];
|
|
274
|
+
}
|
|
275
|
+
widthOf(group) {
|
|
276
|
+
const widths = this.widths(group.section);
|
|
277
|
+
return widths[group.column] ?? widths[0];
|
|
278
|
+
}
|
|
279
|
+
pieceHeight(piece, width) {
|
|
280
|
+
const lines = this.linesOf(piece.id, width);
|
|
281
|
+
const to = Math.min(piece.toLine, lines.length);
|
|
282
|
+
return ((piece.lead ?? 0) +
|
|
283
|
+
(lines[to - 1] ?? 0) -
|
|
284
|
+
(piece.fromLine ? (lines[piece.fromLine - 1] ?? 0) : 0));
|
|
285
|
+
}
|
|
286
|
+
/** A group as it is set: its separators, then each piece in its column. */
|
|
287
|
+
arranged(group) {
|
|
288
|
+
const width = this.widthOf(group);
|
|
289
|
+
const isSeparator = (piece) => (this.storyFor(piece.id)?.noteType ?? "normal") !== "normal";
|
|
290
|
+
const separators = group.pieces.filter(isSeparator);
|
|
291
|
+
const notes = group.pieces.filter((piece) => !isSeparator(piece));
|
|
292
|
+
const columns = group.inFlow ? 1 : this.widths(group.section).length;
|
|
293
|
+
const heights = notes.map((piece) => this.pieceHeight(piece, width));
|
|
294
|
+
const { height, columnOf } = arrangeNotes(heights, columns);
|
|
295
|
+
const above = separators.reduce((sum, piece) => sum + this.pieceHeight(piece, width), 0);
|
|
296
|
+
return { separators, notes, columnOf, columns, above, height };
|
|
297
|
+
}
|
|
298
|
+
/** How tall a group is. */
|
|
299
|
+
heightOf(group) {
|
|
300
|
+
const { above, height } = this.arranged(group);
|
|
301
|
+
return above + height;
|
|
302
|
+
}
|
|
303
|
+
/** What identifies how a group looks: the same key, the same drawing. */
|
|
304
|
+
keyOf(group) {
|
|
305
|
+
const width = this.widthOf(group);
|
|
306
|
+
return group.pieces
|
|
307
|
+
.map((p) => {
|
|
308
|
+
const { serial: drawing } = this.drawn(p.id, width);
|
|
309
|
+
return `${p.id}|${drawing}|${p.fromLine}|${p.toLine}|${p.lead ?? 0}|${p.id === this.open}`;
|
|
310
|
+
})
|
|
311
|
+
.join(";");
|
|
312
|
+
}
|
|
313
|
+
/** A piece of a note: the note's lines shown, clipped to them unless it is whole. */
|
|
314
|
+
pieceElement(piece, group) {
|
|
315
|
+
const width = this.widthOf(group);
|
|
316
|
+
const { lines, template } = this.drawn(piece.id, width);
|
|
317
|
+
const outer = this.doc.createElement("div");
|
|
318
|
+
outer.setAttribute(NOTE_ATTR, piece.id);
|
|
319
|
+
if (piece.lead)
|
|
320
|
+
outer.style.marginTop = `${piece.lead}px`;
|
|
321
|
+
const copy = template.cloneNode(true);
|
|
322
|
+
const whole = piece.fromLine === 0 && piece.toLine >= lines.length;
|
|
323
|
+
if (whole || piece.id === this.open) {
|
|
324
|
+
outer.append(copy);
|
|
325
|
+
return outer;
|
|
326
|
+
}
|
|
327
|
+
const top = piece.fromLine ? lines[piece.fromLine - 1] : 0;
|
|
328
|
+
const bottom = lines[Math.min(piece.toLine, lines.length) - 1];
|
|
329
|
+
outer.style.overflow = "hidden";
|
|
330
|
+
outer.style.height = `${bottom - top}px`;
|
|
331
|
+
copy.style.marginTop = `${-top}px`;
|
|
332
|
+
if (piece.fromLine)
|
|
333
|
+
copy.setAttribute("aria-hidden", "true");
|
|
334
|
+
outer.append(copy);
|
|
335
|
+
return outer;
|
|
336
|
+
}
|
|
337
|
+
/** The element of a group, its pieces given by `pieceOf` (one kept while it is being edited). */
|
|
338
|
+
groupElement(group, place, pieceOf = (piece) => this.pieceElement(piece, group),
|
|
339
|
+
/** Above a group in the flow: the space after the text it follows. */
|
|
340
|
+
lead = 0) {
|
|
341
|
+
const element = this.doc.createElement("div");
|
|
342
|
+
element.className = `${REGION_CLASS} ${NOTES_CLASS}`;
|
|
343
|
+
element.setAttribute("contenteditable", "false");
|
|
344
|
+
const { style } = element;
|
|
345
|
+
style.userSelect = "none";
|
|
346
|
+
style.setProperty("-webkit-user-select", "none");
|
|
347
|
+
style.width = `${this.widthOf(group)}px`;
|
|
348
|
+
if (lead)
|
|
349
|
+
style.marginTop = `${lead}px`;
|
|
350
|
+
if (place) {
|
|
351
|
+
style.position = "absolute";
|
|
352
|
+
style.left = `${place.left}px`;
|
|
353
|
+
style.bottom = `${place.bottom}px`;
|
|
354
|
+
}
|
|
355
|
+
const { separators, notes, columnOf, columns, above } = this.arranged(group);
|
|
356
|
+
if (columns === 1) {
|
|
357
|
+
element.append(...group.pieces.map(pieceOf));
|
|
358
|
+
return element;
|
|
359
|
+
}
|
|
360
|
+
// In the section's columns: the separator over the first, the others level with its notes.
|
|
361
|
+
const { widths, gaps } = columnsPx(this.sections[group.section] ?? {});
|
|
362
|
+
style.width = "auto";
|
|
363
|
+
style.display = "flex";
|
|
364
|
+
style.alignItems = "flex-start";
|
|
365
|
+
for (let c = 0; c < columns; c++) {
|
|
366
|
+
const column = this.doc.createElement("div");
|
|
367
|
+
column.style.flex = "none";
|
|
368
|
+
column.style.width = `${widths[c]}px`;
|
|
369
|
+
column.style.marginRight = `${gaps[c] ?? 0}px`;
|
|
370
|
+
if (c)
|
|
371
|
+
column.style.paddingTop = `${above}px`;
|
|
372
|
+
else
|
|
373
|
+
column.append(...separators.map(pieceOf));
|
|
374
|
+
column.append(...notes.filter((_, n) => columnOf[n] === c).map(pieceOf));
|
|
375
|
+
element.append(column);
|
|
376
|
+
}
|
|
377
|
+
return element;
|
|
378
|
+
}
|
|
379
|
+
/** Where the foot of a band is: from the page's left edge and bottom edge. */
|
|
380
|
+
footPlace(margins, stacked) {
|
|
381
|
+
return { left: margins.left, bottom: margins.bottom + stacked };
|
|
382
|
+
}
|
|
383
|
+
/** How much of the foot the bands below a group's take, on its page. */
|
|
384
|
+
stacked(group, groups) {
|
|
385
|
+
const below = new Map();
|
|
386
|
+
for (const other of groups)
|
|
387
|
+
if (other.page === group.page && !other.inFlow && other.band > group.band)
|
|
388
|
+
below.set(other.band, Math.max(below.get(other.band) ?? 0, this.heightOf(other)));
|
|
389
|
+
return [...below.values()].reduce((sum, height) => sum + height, 0);
|
|
390
|
+
}
|
|
391
|
+
}
|
|
392
|
+
//# sourceMappingURL=notes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"notes.js","sourceRoot":"","sources":["../../src/word/notes.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAGL,UAAU,EACV,cAAc,GAIf,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,YAAY,EAAiD,MAAM,mBAAmB,CAAC;AAChG,OAAO,EAAqB,YAAY,EAAE,MAAM,aAAa,CAAC;AAC9D,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,YAAY,EAAE,oBAAoB,EAAsB,KAAK,EAAE,MAAM,cAAc,CAAC;AAE7F,uDAAuD;AACvD,MAAM,CAAC,MAAM,SAAS,GAAG,gBAAgB,CAAC;AAC1C,gDAAgD;AAChD,MAAM,CAAC,MAAM,WAAW,GAAG,YAAY,CAAC;AAExC;;;;;;;GAOG;AACH,MAAM,UAAU,WAAW,CAAC,OAAoB;IAC9C,MAAM,GAAG,GAAG,OAAO,CAAC,qBAAqB,EAAE,CAAC;IAC5C,MAAM,GAAG,GAAG,OAAO,CAAC,aAAa,CAAC;IAClC,MAAM,KAAK,GAAG,GAAG,CAAC,WAAW,EAAE,CAAC;IAChC,MAAM,KAAK,GAAuC,EAAE,CAAC;IACrD,oFAAoF;IACpF,yDAAyD;IACzD,MAAM,MAAM,GAAG,GAAG,CAAC,gBAAgB,CAAC,OAAO,EAAE,UAAU,CAAC,SAAS,GAAG,UAAU,CAAC,YAAY,CAAC,CAAC;IAC7F,KAAK,IAAI,IAAI,GAAG,MAAM,CAAC,QAAQ,EAAE,EAAE,IAAI,EAAE,IAAI,GAAG,MAAM,CAAC,QAAQ,EAAE,EAAE,CAAC;QAClE,IAAI,IAAI,CAAC,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AC,IAAI;gBACvE,KAAK,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,EAAE,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;QACtF,OAAO,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,MAAM,EAAE,EAAE,CAAC,GAAG,GAAG,MAAM,EAAE,CAAC,CAAC,CAAC;IACtE,CAAC;CACF"}
|
package/dist/word/pages.d.ts
CHANGED
|
@@ -4,9 +4,11 @@
|
|
|
4
4
|
* Word's spacing, keep rules, widow and orphan control and explicit breaks. Editing moves to
|
|
5
5
|
* v3 in 8.7.
|
|
6
6
|
*/
|
|
7
|
-
import type
|
|
7
|
+
import { type FieldLayout, type FoliDocument } from "@folijs/core";
|
|
8
8
|
import { type BlockOptions } from "./blocks.js";
|
|
9
|
+
import { lineBottoms } from "./notes.js";
|
|
9
10
|
export type { ReviewView } from "./blocks.js";
|
|
11
|
+
export { lineBottoms };
|
|
10
12
|
/** The class of each page element. */
|
|
11
13
|
export declare const WORD_PAGE_CLASS = "foli-word-page";
|
|
12
14
|
export interface DocumentPages {
|
|
@@ -27,6 +29,18 @@ export interface DocumentPages {
|
|
|
27
29
|
page: number;
|
|
28
30
|
text: string;
|
|
29
31
|
}[];
|
|
32
|
+
/**
|
|
33
|
+
* Where body positions are on these pages, for `updateFields` (`PAGE`, `NUMPAGES`, `PAGEREF`,
|
|
34
|
+
* a table of contents' page numbers).
|
|
35
|
+
* shortcut: a position's page is the one its top-level block starts on (a bookmark in a paragraph or table carried to the next page gets the page it starts on); use the lines when a document needs it.
|
|
36
|
+
*/
|
|
37
|
+
readonly fieldLayout: FieldLayout;
|
|
38
|
+
/**
|
|
39
|
+
* Print rules for these pages, as the editor's: one sheet of its section's size per page (named
|
|
40
|
+
* pages where sections differ), no gaps. For a web page holding these pages only (`@page`
|
|
41
|
+
* applies to the whole web page).
|
|
42
|
+
*/
|
|
43
|
+
printStyles(): string;
|
|
30
44
|
/** Removes the pages. */
|
|
31
45
|
destroy(): void;
|
|
32
46
|
}
|
|
@@ -36,18 +50,9 @@ export interface DocumentPages {
|
|
|
36
50
|
*/
|
|
37
51
|
export declare function measureLineRatio(container: HTMLElement): (family: string) => number;
|
|
38
52
|
/**
|
|
39
|
-
*
|
|
40
|
-
*
|
|
41
|
-
*
|
|
42
|
-
*
|
|
43
|
-
* shortcut: line boxes are inferred from content rects (exact for even line heights); a
|
|
44
|
-
* superscript or a much larger run on a line moves that line's boundaries slightly.
|
|
45
|
-
*/
|
|
46
|
-
export declare function lineBottoms(element: HTMLElement): number[];
|
|
47
|
-
/**
|
|
48
|
-
* Lays a v3 document out on pages inside `container`. Headers, footers, footnotes and floating
|
|
49
|
-
* content are not laid out yet (Phase 11); tables are shown from their verbatim XML until
|
|
50
|
-
* Phase 10.
|
|
53
|
+
* Lays a v3 document out on pages inside `container`: every section's page setup, its columns
|
|
54
|
+
* (a band per section on a page), continuous sections, Word's blank pages, headers and footers
|
|
55
|
+
* with their page fields, footnotes at their columns' feet and endnotes after the text.
|
|
51
56
|
*/
|
|
52
57
|
export declare function renderDocument(document: FoliDocument, container: HTMLElement, options?: Omit<BlockOptions, "lineRatio">): DocumentPages;
|
|
53
58
|
//# sourceMappingURL=pages.d.ts.map
|
package/dist/word/pages.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pages.d.ts","sourceRoot":"","sources":["../../src/word/pages.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"pages.d.ts","sourceRoot":"","sources":["../../src/word/pages.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EACL,KAAK,WAAW,EAChB,KAAK,YAAY,EAOlB,MAAM,cAAc,CAAC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