oasis-editor 0.0.384 → 0.0.386
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-CQqOpmTy.js → OasisEditorApp-Pmcpip8T.js} +1 -1
- package/dist/core/commands/crossReference.d.ts +3 -7
- package/dist/core/document/fieldDocumentContext.d.ts +11 -0
- package/dist/core/document/fieldEvaluation.d.ts +54 -0
- package/dist/defaultToolbar-COX52AZ2.js +1 -0
- package/dist/oasis-editor.js +1 -1
- package/dist/oasis-editor.umd.cjs +1 -1
- package/dist/sourcePackage-Dyc-Bhoh.js +1 -0
- package/package.json +1 -1
- package/dist/defaultToolbar-BPLBXI_R.js +0 -1
- package/dist/sourcePackage-ChMwgXKX.js +0 -1
|
@@ -8,13 +8,9 @@ export interface InsertCrossReferenceOptions {
|
|
|
8
8
|
}
|
|
9
9
|
/** Resolve a bookmark by its Word name, or undefined. */
|
|
10
10
|
export declare function findBookmarkByName(state: EditorState, name: string): EditorBookmark | undefined;
|
|
11
|
-
/**
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
* paragraph offset, or the whole start paragraph when the bookmark is
|
|
15
|
-
* zero-width). Falls back to "Error" style placeholder when the target
|
|
16
|
-
* bookmark cannot be located — mirroring a broken cross-reference.
|
|
17
|
-
*/
|
|
11
|
+
/** Resolve only the requested bookmark range. The shared field context
|
|
12
|
+
* refuses unsupported story/field dependencies instead of concatenating
|
|
13
|
+
* unrelated paragraphs or pretending missing geometry is known. */
|
|
18
14
|
export declare function resolveBookmarkReferenceText(state: EditorState, bookmark: EditorBookmark): string;
|
|
19
15
|
/**
|
|
20
16
|
* Insert a cross-reference field at the caret (any zone). When the target
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { EditorDocument, EditorLayoutDocument } from '../model.js';
|
|
2
|
+
import { FieldEvaluationContext } from './fieldEvaluation.js';
|
|
3
|
+
/** Index a document snapshot and its completed layout. No evaluation or cache
|
|
4
|
+
* mutation occurs while building the index. Rebuild for each new snapshot. */
|
|
5
|
+
export declare function createDocumentFieldContext(document: EditorDocument, layout?: EditorLayoutDocument): {
|
|
6
|
+
bookmarkText: (name: string) => string | null | undefined;
|
|
7
|
+
bookmarkPage: (name: string) => number | null | undefined;
|
|
8
|
+
pageIndexAt: (paragraphId: string, offset: number) => number | undefined;
|
|
9
|
+
forPage: (pageIndex: number) => FieldEvaluationContext;
|
|
10
|
+
forPosition: (paragraphId: string, offset: number) => FieldEvaluationContext;
|
|
11
|
+
};
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { PageNumberFormat } from '../model.js';
|
|
2
|
+
import { FieldStorySpan } from './fieldStoryGraph.js';
|
|
3
|
+
export type NumericFieldCommand = "PAGE" | "NUMPAGES" | "SECTION" | "SECTIONPAGES";
|
|
4
|
+
export type ReferenceFieldCommand = "REF" | "PAGEREF";
|
|
5
|
+
export type EvaluatableField = {
|
|
6
|
+
type: NumericFieldCommand;
|
|
7
|
+
format?: PageNumberFormat;
|
|
8
|
+
} | {
|
|
9
|
+
type: ReferenceFieldCommand;
|
|
10
|
+
bookmark: string;
|
|
11
|
+
hyperlink?: boolean;
|
|
12
|
+
};
|
|
13
|
+
export type FieldDependency = {
|
|
14
|
+
kind: "page" | "document-pages" | "section" | "section-pages";
|
|
15
|
+
} | {
|
|
16
|
+
kind: "bookmark-text" | "bookmark-page";
|
|
17
|
+
name: string;
|
|
18
|
+
};
|
|
19
|
+
/** All numbers are the caller's one-based display values, not array indexes.
|
|
20
|
+
* No DOM, clock, mutable editor state or layout service is consulted here.
|
|
21
|
+
* An absent value is unresolved; a bookmark resolver may return null only
|
|
22
|
+
* when it has positively established that the target does not exist. */
|
|
23
|
+
export interface FieldEvaluationContext {
|
|
24
|
+
pageNumber?: number;
|
|
25
|
+
totalPages?: number;
|
|
26
|
+
sectionNumber?: number;
|
|
27
|
+
sectionPages?: number;
|
|
28
|
+
bookmarkText?: (name: string) => string | null | undefined;
|
|
29
|
+
bookmarkPage?: (name: string) => number | null | undefined;
|
|
30
|
+
}
|
|
31
|
+
export type FieldEvaluation = {
|
|
32
|
+
status: "resolved";
|
|
33
|
+
text: string;
|
|
34
|
+
dependencies: readonly FieldDependency[];
|
|
35
|
+
} | {
|
|
36
|
+
status: "preserved";
|
|
37
|
+
text: string;
|
|
38
|
+
reason: "locked" | "unsupported" | "malformed" | "unresolved" | "structured";
|
|
39
|
+
dependencies: readonly FieldDependency[];
|
|
40
|
+
} | {
|
|
41
|
+
status: "error";
|
|
42
|
+
text: string;
|
|
43
|
+
reason: "missing-bookmark";
|
|
44
|
+
dependencies: readonly FieldDependency[];
|
|
45
|
+
};
|
|
46
|
+
/** Compile only the deliberately supported subset. Unknown switches are
|
|
47
|
+
* never ignored, even if the command itself is recognized. */
|
|
48
|
+
export declare function compileFieldInstruction(raw: string): EvaluatableField | undefined;
|
|
49
|
+
export declare function evaluateField(field: EvaluatableField, context: FieldEvaluationContext, cachedText: string, locked?: boolean): FieldEvaluation;
|
|
50
|
+
export declare function evaluateFieldInstruction(raw: string, context: FieldEvaluationContext, cachedText: string, locked?: boolean): FieldEvaluation;
|
|
51
|
+
/** Read-only evaluation of a scalar complex span. A caller must provide a
|
|
52
|
+
* valid graph and cached result. Nested operands/results, no separator and
|
|
53
|
+
* multi-paragraph caches are not scalar replacement candidates. */
|
|
54
|
+
export declare function evaluateScalarFieldSpan(span: FieldStorySpan, context: FieldEvaluationContext, cachedText: string): FieldEvaluation;
|