oasis-editor 0.0.84 → 0.0.86
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/{OasisEditorApp-lNYRC99y.js → OasisEditorApp-CE15GH_N.js} +1 -1
- package/dist/assets/{importDocxWorker-8fivvDCX.js → importDocxWorker-C94l6-O5.js} +1 -1
- package/dist/core/endnotes.d.ts +0 -5
- package/dist/core/footnotes.d.ts +0 -5
- package/dist/core/noteTraversal.d.ts +77 -0
- package/dist/{index-9_ibx79n.js → index-DFKc0jbc.js} +195 -271
- package/dist/layoutProjection/footnotePagination.d.ts +2 -2
- package/dist/layoutProjection/headerFooterFootnotes.d.ts +3 -3
- package/dist/layoutProjection/headerFooterLayoutContext.d.ts +14 -0
- package/dist/layoutProjection/headerFooterProjection.d.ts +2 -1
- package/dist/layoutProjection/sectionPagination.d.ts +2 -2
- package/dist/oasis-editor.js +1 -1
- package/dist/oasis-editor.umd.cjs +4 -4
- package/package.json +1 -1
package/dist/core/endnotes.d.ts
CHANGED
|
@@ -1,10 +1,5 @@
|
|
|
1
1
|
import { EditorBlockNode, EditorDocument, EditorEndnote, EditorEndnotes, EditorParagraphNode, EditorTextRun } from './model.js';
|
|
2
2
|
|
|
3
|
-
/**
|
|
4
|
-
* Iterate every paragraph in document order (endnote bodies excluded), yielding
|
|
5
|
-
* each endnote reference run with its owning paragraph. Order matches reading
|
|
6
|
-
* order, which is what numbering depends on.
|
|
7
|
-
*/
|
|
8
3
|
export declare function iterateEndnoteReferenceRuns(document: EditorDocument): Generator<{
|
|
9
4
|
paragraph: EditorParagraphNode;
|
|
10
5
|
run: EditorTextRun;
|
package/dist/core/footnotes.d.ts
CHANGED
|
@@ -1,10 +1,5 @@
|
|
|
1
1
|
import { EditorBlockNode, EditorDocument, EditorFootnote, EditorFootnoteNumberFormat, EditorFootnotes, EditorParagraphNode, EditorTextRun } from './model.js';
|
|
2
2
|
|
|
3
|
-
/**
|
|
4
|
-
* Iterate every paragraph in document order (sections + footnotes excluded),
|
|
5
|
-
* yielding each footnote reference run along with the owning paragraph. Order
|
|
6
|
-
* matches reading order, which is what numbering depends on.
|
|
7
|
-
*/
|
|
8
3
|
export declare function iterateFootnoteReferenceRuns(document: EditorDocument): Generator<{
|
|
9
4
|
paragraph: EditorParagraphNode;
|
|
10
5
|
run: EditorTextRun;
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { EditorBlockNode, EditorDocument, EditorFootnoteNumberFormat, EditorParagraphNode, EditorSection, EditorTextRun } from './model.js';
|
|
2
|
+
|
|
3
|
+
/** Discriminant of a note reference run. */
|
|
4
|
+
export type NoteReferenceRunKind = "footnoteReference" | "endnoteReference";
|
|
5
|
+
/** Neutral view of a note reference run's data (id + optional custom mark). */
|
|
6
|
+
export interface NoteRef {
|
|
7
|
+
id: string;
|
|
8
|
+
customMark?: string;
|
|
9
|
+
}
|
|
10
|
+
/** Minimal shape of a note body shared by footnotes and endnotes. */
|
|
11
|
+
interface NoteBody {
|
|
12
|
+
blocks: EditorBlockNode[];
|
|
13
|
+
}
|
|
14
|
+
/** Minimal shape of a note collection (footnotes/endnotes registry). */
|
|
15
|
+
interface NoteCollection<TNote extends NoteBody> {
|
|
16
|
+
items: Record<string, TNote>;
|
|
17
|
+
settings?: {
|
|
18
|
+
numberFormat?: EditorFootnoteNumberFormat;
|
|
19
|
+
startAt?: number;
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Describes one note family so the shared algorithm can operate on either.
|
|
24
|
+
*/
|
|
25
|
+
export interface NoteTraversal {
|
|
26
|
+
/** Reference run discriminant for this family. */
|
|
27
|
+
runKind: NoteReferenceRunKind;
|
|
28
|
+
/** Read neutral reference data from a run, or undefined if not this kind. */
|
|
29
|
+
getRef(run: EditorTextRun): NoteRef | undefined;
|
|
30
|
+
/** Map a one-based index + format to display marker text. */
|
|
31
|
+
formatMarker(oneBasedIndex: number, format: EditorFootnoteNumberFormat): string;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Iterate every paragraph in document order (note bodies excluded), yielding
|
|
35
|
+
* each reference run of `runKind` with its owning paragraph. Order matches
|
|
36
|
+
* reading order, which is what numbering depends on.
|
|
37
|
+
*/
|
|
38
|
+
export declare function iterateNoteReferenceRuns(document: EditorDocument, runKind: NoteReferenceRunKind): Generator<{
|
|
39
|
+
paragraph: EditorParagraphNode;
|
|
40
|
+
run: EditorTextRun;
|
|
41
|
+
}, void, void>;
|
|
42
|
+
export declare function collectNoteReferences(document: EditorDocument, runKind: NoteReferenceRunKind): Array<{
|
|
43
|
+
paragraph: EditorParagraphNode;
|
|
44
|
+
run: EditorTextRun;
|
|
45
|
+
}>;
|
|
46
|
+
/** Find the note body that contains the given paragraph id (neutral id). */
|
|
47
|
+
export declare function findNoteBodyByParagraphId<TNote extends NoteBody>(items: Record<string, TNote> | undefined, paragraphId: string): {
|
|
48
|
+
id: string;
|
|
49
|
+
body: TNote;
|
|
50
|
+
} | null;
|
|
51
|
+
/** Find the first reference run for a given note id. */
|
|
52
|
+
export declare function findNoteReference(document: EditorDocument, traversal: NoteTraversal, noteId: string): {
|
|
53
|
+
paragraph: EditorParagraphNode;
|
|
54
|
+
run: EditorTextRun;
|
|
55
|
+
} | null;
|
|
56
|
+
/** Neutral per-reference info (id + custom mark + computed reading-order index). */
|
|
57
|
+
export interface NoteReferenceInfo {
|
|
58
|
+
id: string;
|
|
59
|
+
customMark?: string;
|
|
60
|
+
index: number;
|
|
61
|
+
}
|
|
62
|
+
export declare function listReferencedNotes(document: EditorDocument, traversal: NoteTraversal): NoteReferenceInfo[];
|
|
63
|
+
/** Result of {@link computeNoteRenumber}: rewritten sections + pruned items. */
|
|
64
|
+
export interface NoteRenumberResult<TNote extends NoteBody> {
|
|
65
|
+
sections: EditorSection[];
|
|
66
|
+
sectionsChanged: boolean;
|
|
67
|
+
nextItems: Record<string, TNote>;
|
|
68
|
+
itemsChanged: boolean;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Compute the renumbering of a note family: assign a marker per referenced note
|
|
72
|
+
* in reading order, rewrite reference run text where it differs, and prune note
|
|
73
|
+
* bodies that are no longer referenced. Pure — the caller assembles the new
|
|
74
|
+
* document with the correct collection field.
|
|
75
|
+
*/
|
|
76
|
+
export declare function computeNoteRenumber<TNote extends NoteBody>(document: EditorDocument, collection: NoteCollection<TNote>, traversal: NoteTraversal): NoteRenumberResult<TNote>;
|
|
77
|
+
export {};
|