oasis-editor 0.0.391 → 0.0.393

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.
@@ -4,7 +4,15 @@ import { FieldStorySpan } from './fieldStoryGraph.js';
4
4
  export type NumericFieldCommand = "PAGE" | "NUMPAGES" | "SECTION" | "SECTIONPAGES";
5
5
  export type ReferenceFieldCommand = "REF" | "PAGEREF";
6
6
  export type TemporalFieldCommand = "DATE" | "TIME" | "CREATEDATE" | "SAVEDATE" | "PRINTDATE";
7
- export type EvaluatableField = {
7
+ export interface SequenceField {
8
+ type: "SEQ";
9
+ identifier: string;
10
+ operation: "next" | "repeat" | "reset";
11
+ reset?: number;
12
+ headingLevel?: number;
13
+ format?: PageNumberFormat;
14
+ }
15
+ export type EvaluatableField = SequenceField | {
8
16
  type: TemporalFieldCommand;
9
17
  temporal: true;
10
18
  picture?: string;
@@ -23,6 +31,9 @@ export type FieldDependency = {
23
31
  name: string;
24
32
  } | {
25
33
  kind: "clock" | "created" | "saved" | "printed";
34
+ } | {
35
+ kind: "sequence";
36
+ name: string;
26
37
  };
27
38
  /** All numbers are the caller's one-based display values, not array indexes.
28
39
  * No DOM, clock, mutable editor state or layout service is consulted here.
@@ -30,6 +41,8 @@ export type FieldDependency = {
30
41
  * when it has positively established that the target does not exist. */
31
42
  export interface FieldEvaluationContext {
32
43
  temporal?: TemporalFieldContext;
44
+ /** Precomputed value for this exact SEQ occurrence, never a mutable counter. */
45
+ sequenceValue?: number;
33
46
  pageNumber?: number;
34
47
  totalPages?: number;
35
48
  sectionNumber?: number;
@@ -5,8 +5,11 @@ export declare const IMAGE_CAPTION_FIELD_INSTRUCTION = " SEQ Figure \\* ARABIC "
5
5
  export declare function createImageCaptionParagraph(captionText: string, label: string, sequenceNumber: number): EditorParagraphNode;
6
6
  export declare function isImageCaptionParagraph(paragraph: EditorParagraphNode | undefined): paragraph is EditorParagraphNode;
7
7
  export declare function getImageCaptionText(paragraph: EditorParagraphNode | undefined): string;
8
- export declare function updateImageCaptionParagraph(paragraph: EditorParagraphNode, captionText: string, label: string): EditorParagraphNode;
9
- export declare function renumberImageCaptionParagraphs(paragraphs: EditorParagraphNode[]): EditorParagraphNode[];
8
+ /** Edit the label and caption only; preserve the original instruction,
9
+ * marker flags, cached field result, OOXML source and all field run IDs. */
10
+ export declare function updateImageCaptionParagraph(p: EditorParagraphNode, captionText: string, label: string): EditorParagraphNode;
11
+ /** Shared SEQ computation includes non-caption Figure occurrences. */
12
+ export declare function renumberImageCaptionParagraphs(paragraphs: EditorParagraphNode[], styles?: EditorDocument["styles"]): EditorParagraphNode[];
10
13
  export declare function renumberImageCaptionsInDocument(document: EditorDocument): EditorDocument;
11
- export declare function getCaptionSelectionOffset(paragraph: EditorParagraphNode): number;
14
+ export declare function getCaptionSelectionOffset(p: EditorParagraphNode): number;
12
15
  export declare function cloneParagraphsWithRenumberedCaptions(paragraphs: EditorParagraphNode[]): EditorParagraphNode[];
@@ -0,0 +1,11 @@
1
+ import { EditorDocument, EditorParagraphNode } from '../model.js';
2
+ export declare function sequenceOccurrenceKey(paragraphId: string, runIndex: number): string;
3
+ /** Resolve main-story occurrences in XML order, independently of selection,
4
+ * pagination and cached display text. A malformed/ambiguous story is not
5
+ * evaluated. Unsupported sequence operations poison their own identifier
6
+ * until a definite reset; unrelated sequences are unaffected. */
7
+ /** One ordered SEQ authority for field refresh, caption authoring and export. */
8
+ export declare function resolveOrderedSequences(paragraphs: readonly EditorParagraphNode[], styles?: EditorDocument["styles"], scopes?: readonly string[]): Map<string, number>;
9
+ /** Row-major body order includes table cells; each cell is its own story.
10
+ * Headers, notes and text boxes do not consume main-body numbering. */
11
+ export declare function resolveBodySequences(document: EditorDocument): Map<string, number>;