oasis-editor 0.0.398 → 0.0.400
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-CTBmAdAP.js +1 -0
- package/dist/core/commands/tableOfContents.d.ts +5 -1
- package/dist/core/document/tocConvergence.d.ts +22 -0
- package/dist/core/document/tocFields.d.ts +22 -0
- package/dist/defaultToolbar-DVaYtiao.js +1 -0
- package/dist/oasis-editor.js +1 -1
- package/dist/oasis-editor.umd.cjs +1 -1
- package/dist/sourcePackage-JAsDEd_R.js +1 -0
- package/package.json +1 -1
- package/dist/OasisEditorApp-Bzk0rSbq.js +0 -1
- package/dist/defaultToolbar-Bc3d9BXm.js +0 -1
- package/dist/sourcePackage-D_eKi6F8.js +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { EditorState } from '../model.js';
|
|
1
|
+
import { EditorState, EditorLayoutDocument } from '../model.js';
|
|
2
2
|
/** Default TOC scope: outline levels 1–3, matching Word's `TOC \o "1-3"`. */
|
|
3
3
|
export declare const DEFAULT_TOC_MAX_LEVEL = 3;
|
|
4
4
|
/** A heading captured for a TOC entry. */
|
|
@@ -27,5 +27,9 @@ export declare function insertTableOfContents(state: EditorState, resolvePage?:
|
|
|
27
27
|
* the unchanged state when no TOC field is present.
|
|
28
28
|
*/
|
|
29
29
|
export declare function updateTableOfContents(state: EditorState, resolvePage?: TocPageNumberResolver, maxLevel?: number): EditorState;
|
|
30
|
+
/** Update a qualified TOC from a known completed layout snapshot. This is
|
|
31
|
+
* intentionally not automatic convergence; callers must remeasure if pages
|
|
32
|
+
* shift after regeneration. Missing page facts are kept blank. */
|
|
33
|
+
export declare function updateTableOfContentsFromLayout(state: EditorState, layout: EditorLayoutDocument, maxLevel?: number): EditorState;
|
|
30
34
|
/** Whether a TOC field exists in the active section (for menu enablement). */
|
|
31
35
|
export declare function hasTableOfContents(state: EditorState): boolean;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { EditorDocument, EditorLayoutDocument, EditorState } from '../model.js';
|
|
2
|
+
export type TocPaginate = (document: EditorDocument) => EditorLayoutDocument;
|
|
3
|
+
export type TocConvergenceStatus = "unchanged" | "updated" | "unsupported" | "unresolved" | "nonconvergent";
|
|
4
|
+
export interface TocConvergenceResult {
|
|
5
|
+
state: EditorState;
|
|
6
|
+
/** Layout of exactly the returned state, never a discarded candidate. */
|
|
7
|
+
layout?: EditorLayoutDocument;
|
|
8
|
+
status: TocConvergenceStatus;
|
|
9
|
+
passes: number;
|
|
10
|
+
updatedEntries: number;
|
|
11
|
+
}
|
|
12
|
+
export declare const MAX_TOC_CONVERGENCE_PASSES = 6;
|
|
13
|
+
/** A pure, all-or-nothing TOC refresh. On each pass it paginates the current
|
|
14
|
+
* candidate, resolves the *printed* page for every qualified heading, then
|
|
15
|
+
* regenerates the flat TOC. It commits only when a subsequent page measurement
|
|
16
|
+
* agrees with every cached label. Any missing page, oscillation, unqualified
|
|
17
|
+
* field or exhausted pass budget returns the original EditorState object.
|
|
18
|
+
*
|
|
19
|
+
* The caller must apply the returned state in ONE undo/redo transaction.
|
|
20
|
+
* No mutations, UI actions, clock or global caches occur here.
|
|
21
|
+
*/
|
|
22
|
+
export declare function refreshTableOfContentsConvergently(original: EditorState, paginate?: TocPaginate, maxPasses?: number, maxLevel?: number): TocConvergenceResult;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { EditorBlockNode, EditorDocument, EditorLayoutDocument } from '../model.js';
|
|
2
|
+
export interface TocFieldSettings {
|
|
3
|
+
startLevel: number;
|
|
4
|
+
endLevel: number;
|
|
5
|
+
hyperlinks: boolean;
|
|
6
|
+
hideWebNumbers: boolean;
|
|
7
|
+
useOutline: boolean;
|
|
8
|
+
}
|
|
9
|
+
export interface QualifiedTocRegion extends TocFieldSettings {
|
|
10
|
+
startBlockIndex: number;
|
|
11
|
+
endBlockIndex: number;
|
|
12
|
+
}
|
|
13
|
+
/** Word TOC switch grammar (bounded F3A subset). Unknown and duplicate
|
|
14
|
+
* switches are not ignored; quoted field-name occurrences are not commands. */
|
|
15
|
+
export declare function parseTocInstruction(raw: string): TocFieldSettings | undefined;
|
|
16
|
+
/** Only regenerate complete, flat TOC regions: the begin/instruction/separator
|
|
17
|
+
* occupy one marker paragraph; a separate end marker closes plain text entries.
|
|
18
|
+
* Other document content is never rewritten, even on malformed TOC markup. */
|
|
19
|
+
export declare function findQualifiedTocRegion(blocks: readonly EditorBlockNode[]): QualifiedTocRegion | undefined;
|
|
20
|
+
/** Read-only, geometry-certified heading page numbers; never infer from
|
|
21
|
+
* paragraph order. A missing or uncertain physical section/page is unresolved. */
|
|
22
|
+
export declare function createTocPageNumberResolver(document: EditorDocument, layout: EditorLayoutDocument): (headingId: string) => number | undefined;
|