oasis-editor 0.0.401 → 0.0.403

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.
@@ -1,4 +1,5 @@
1
1
  import { EditorState, EditorLayoutDocument } from '../model.js';
2
+ import { TocFieldSettings } from '../document/tocFields.js';
2
3
  /** Default TOC scope: outline levels 1–3, matching Word's `TOC \o "1-3"`. */
3
4
  export declare const DEFAULT_TOC_MAX_LEVEL = 3;
4
5
  /** A heading captured for a TOC entry. */
@@ -8,13 +9,18 @@ export interface TocHeading {
8
9
  text: string;
9
10
  }
10
11
  /** Page number resolver: heading paragraph id → printed page number. */
11
- export type TocPageNumberResolver = (headingId: string) => number | undefined;
12
+ export type TocPageNumberResolver = (headingId: string) => number | string | undefined;
12
13
  /**
13
14
  * Collect heading paragraphs (levels 1..maxLevel) in document order. Headings
14
15
  * are detected case-insensitively via {@link getHeadingLevel}, so both the
15
16
  * editor's own `heading1` and Word's imported `Heading1` styles qualify.
16
17
  */
17
18
  export declare function collectTocHeadings(state: EditorState, maxLevel?: number): TocHeading[];
19
+ /** Resolve explicit TOC style names against the paragraph-style catalog.
20
+ * Refuse missing/ambiguous names and conflicting mappings; never silently
21
+ * remove an imported cache because a style could not be resolved.
22
+ */
23
+ export declare function collectQualifiedTocHeadings(state: EditorState, options: TocFieldSettings, maxLevel?: number): TocHeading[] | undefined;
18
24
  /**
19
25
  * Insert a generated table of contents after the block holding the caret.
20
26
  * Operates on section blocks (not the flattened paragraph list) so it is safe
@@ -5,6 +5,12 @@ export interface TocFieldSettings {
5
5
  hyperlinks: boolean;
6
6
  hideWebNumbers: boolean;
7
7
  useOutline: boolean;
8
+ /** Present only for an explicit custom paragraph-style mapping. */
9
+ styleMappings?: readonly {
10
+ name: string;
11
+ level: number;
12
+ }[];
13
+ customOnly?: true;
8
14
  }
9
15
  export interface QualifiedTocRegion extends TocFieldSettings {
10
16
  startBlockIndex: number;
@@ -19,4 +25,4 @@ export declare function parseTocInstruction(raw: string): TocFieldSettings | und
19
25
  export declare function findQualifiedTocRegion(blocks: readonly EditorBlockNode[]): QualifiedTocRegion | undefined;
20
26
  /** Read-only, geometry-certified heading page numbers; never infer from
21
27
  * paragraph order. A missing or uncertain physical section/page is unresolved. */
22
- export declare function createTocPageNumberResolver(document: EditorDocument, layout: EditorLayoutDocument): (headingId: string) => number | undefined;
28
+ export declare function createTocPageNumberResolver(document: EditorDocument, layout: EditorLayoutDocument): (headingId: string) => number | string | undefined;
@@ -9,3 +9,11 @@ export declare function pageNumberFormatToSwitch(format: PageNumberFormat | unde
9
9
  export declare function pageNumberFormatFromSwitch(switchValue: string | undefined): PageNumberFormat | undefined;
10
10
  /** Convert a page number to its displayed form under the given format. */
11
11
  export declare function formatPageNumber(value: number, format: PageNumberFormat | undefined): string;
12
+ /** Section w:pgNumType/@w:fmt is ST_NumberFormat, not a PAGE field
13
+ * general-format switch. Qualify only bounded, deterministic labels.
14
+ * WordprocessingML letter numbering repeats the same glyph after Z
15
+ * (AA, BB, ...), unlike the legacy alphabetic field formatter.
16
+ */
17
+ export declare function formatSectionPageLabel(value: number, format: string | undefined): number | string | undefined;
18
+ /** Validate both legacy numeric resolvers and bounded formatted labels. */
19
+ export declare function isValidTocPageLabel(value: number | string): boolean;