oasis-editor 0.0.412 → 0.0.414

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.
Files changed (46) hide show
  1. package/dist/OasisEditorApp-BeGnnOPx.js +1 -0
  2. package/dist/assets/{importDocxWorker-Cza4hyf3.js → importDocxWorker-C4M8keWl.js} +1243 -1126
  3. package/dist/core/commands/builtinCommands.d.ts +1 -1
  4. package/dist/core/commands/fieldCode.d.ts +18 -0
  5. package/dist/core/commands/indexEntries.d.ts +27 -0
  6. package/dist/core/commands/legacyForms.d.ts +15 -0
  7. package/dist/core/commands/mailMerge.d.ts +8 -0
  8. package/dist/core/commands/publicCommandTypes.d.ts +48 -0
  9. package/dist/core/commands/tableOfAuthorities.d.ts +22 -0
  10. package/dist/core/commands/tableOfFigures.d.ts +12 -0
  11. package/dist/core/document/bookmarkScope.d.ts +6 -0
  12. package/dist/core/document/captionEntries.d.ts +24 -0
  13. package/dist/core/document/fieldCodeDisplay.d.ts +12 -0
  14. package/dist/core/document/fieldComparison.d.ts +7 -0
  15. package/dist/core/document/formulaFields.d.ts +10 -0
  16. package/dist/core/document/indexPlan.d.ts +59 -0
  17. package/dist/core/document/indexRefresh.d.ts +35 -0
  18. package/dist/core/document/mergeFields.d.ts +64 -0
  19. package/dist/core/document/tableOfFigures.d.ts +38 -0
  20. package/dist/core/document/toaEntries.d.ts +33 -0
  21. package/dist/core/document/toaPlan.d.ts +36 -0
  22. package/dist/core/document/toaRefresh.d.ts +29 -0
  23. package/dist/core/document/tocFields.d.ts +13 -0
  24. package/dist/core/document/variableFields.d.ts +58 -0
  25. package/dist/core/document/xeEntries.d.ts +50 -0
  26. package/dist/core/document/xeRanges.d.ts +16 -0
  27. package/dist/core/format/fieldResultFormat.d.ts +19 -0
  28. package/dist/core/model/editorState.d.ts +2 -0
  29. package/dist/core/model/index.d.ts +1 -1
  30. package/dist/core/model/types/primitives.d.ts +32 -0
  31. package/dist/defaultToolbar-BFmfRwzv.js +1 -0
  32. package/dist/i18n/locales/en.d.ts +37 -0
  33. package/dist/i18n/locales/pt-BR.d.ts +37 -0
  34. package/dist/oasis-editor.css +1 -1
  35. package/dist/oasis-editor.js +1 -1
  36. package/dist/oasis-editor.umd.cjs +1 -1
  37. package/dist/ooxml/word/fieldFormatSwitches.d.ts +40 -0
  38. package/dist/ooxml/word/legacyFormFields.d.ts +5 -0
  39. package/dist/plugins/internal/essentialsCapabilities.d.ts +27 -0
  40. package/dist/sourcePackage-DWdP3w1_.js +1 -0
  41. package/dist/ui/components/Toolbar/controls/FieldFamilyPanel.d.ts +9 -0
  42. package/dist/ui/components/Toolbar/controls/IndexEntryPanel.d.ts +6 -0
  43. package/package.json +1 -1
  44. package/dist/OasisEditorApp-BALWTakH.js +0 -1
  45. package/dist/defaultToolbar-DOUMCB_G.js +0 -1
  46. package/dist/sourcePackage-CHvo6ql3.js +0 -1
@@ -0,0 +1,58 @@
1
+ import { EditorState } from '../model.js';
2
+ import { ComparisonOperator } from './fieldComparison.js';
3
+ export interface SetInstruction {
4
+ type: "SET";
5
+ name: string;
6
+ value: string;
7
+ }
8
+ export interface AskInstruction {
9
+ type: "ASK";
10
+ name: string;
11
+ prompt: string;
12
+ defaultValue?: string;
13
+ once: boolean;
14
+ }
15
+ export interface FillInInstruction {
16
+ type: "FILLIN";
17
+ prompt: string;
18
+ defaultValue?: string;
19
+ once: boolean;
20
+ }
21
+ export interface CompareInstruction {
22
+ type: "COMPARE";
23
+ left: string;
24
+ operator: ComparisonOperator;
25
+ right: string;
26
+ quoted: [boolean, boolean];
27
+ }
28
+ export interface FormulaInstruction {
29
+ type: "FORMULA";
30
+ expression: string;
31
+ picture?: string;
32
+ }
33
+ export type VariableInstruction = SetInstruction | AskInstruction | FillInInstruction | CompareInstruction | FormulaInstruction;
34
+ export interface VariableFieldContext {
35
+ /** Immutable variable snapshot threaded through document order. */
36
+ variables?: Readonly<Record<string, string>>;
37
+ /** Explicit user/data callback. Absent means "preserve cached result". */
38
+ prompt?: (prompt: string, defaultValue?: string) => string | undefined;
39
+ record?: Readonly<Record<string, string>>;
40
+ }
41
+ /** Strict compiler for SET/ASK/FILLIN/COMPARE and `=`. Nested fields and
42
+ * unknown switches stay opaque; formulas are parsed by evaluateFormula. */
43
+ export declare function parseVariableFieldInstruction(raw: string): VariableInstruction | undefined;
44
+ export interface VariableEvaluationResult {
45
+ text: string;
46
+ variables: Readonly<Record<string, string>>;
47
+ status: "resolved" | "preserved";
48
+ }
49
+ /** Evaluate one instruction against an immutable variable snapshot. */
50
+ export declare function evaluateVariableInstruction(instruction: VariableInstruction, context: VariableFieldContext, variables: Readonly<Record<string, string>>, cachedText: string): VariableEvaluationResult;
51
+ export interface VariableRefreshResult {
52
+ state: EditorState;
53
+ updated: number;
54
+ variables: Readonly<Record<string, string>>;
55
+ }
56
+ /** Walk top-level variable fields in document order, threading their variable
57
+ * state. Unqualified fields and locked markers are left untouched. */
58
+ export declare function refreshVariableFieldCaches(original: EditorState, context?: VariableFieldContext): VariableRefreshResult;
@@ -0,0 +1,50 @@
1
+ import { EditorDocument, EditorLayoutDocument } from '../model.js';
2
+ export type XeReference = {
3
+ kind: "page";
4
+ } | {
5
+ kind: "crossReference";
6
+ text: string;
7
+ } | {
8
+ kind: "bookmarkRange";
9
+ bookmark: string;
10
+ };
11
+ export interface XeInstruction {
12
+ /** Display path; keep authored case and whitespace. */
13
+ path: readonly string[];
14
+ /** Explicit index type; default selection is a separate INDEX policy. */
15
+ identifier?: string;
16
+ boldPage: boolean;
17
+ italicPage: boolean;
18
+ reference: XeReference;
19
+ }
20
+ export interface XeOccurrence extends XeInstruction {
21
+ sectionIndex: number;
22
+ paragraphId: string;
23
+ runId: string;
24
+ offset: number;
25
+ raw: string;
26
+ }
27
+ export interface XePage {
28
+ physicalPageIndex: number;
29
+ label: string;
30
+ }
31
+ /** Bounded XE compiler. No index mutation, locale sorting or range expansion.
32
+ * Colon-separated plain labels qualify; escaped colons, formatting within
33
+ * the instruction and unknown switches must remain opaque until qualified.
34
+ */
35
+ export declare function parseXeInstruction(raw: string): XeInstruction | undefined;
36
+ /** Complete inventory for the deliberately narrow top-level main story.
37
+ * Refuse malformed XE instead of silently dropping it from a future INDEX.
38
+ * Other stories and nested containers are not scanned or rewritten.
39
+ */
40
+ export declare function collectXeOccurrences(document: EditorDocument): XeOccurrence[] | undefined;
41
+ /** Physical order and printed labels are distinct (section restarts may
42
+ * repeat labels). Cross-references and bookmark ranges are not point pages.
43
+ */
44
+ export declare function resolveXePointPage(document: EditorDocument, layout: EditorLayoutDocument, entry: XeOccurrence, context?: {
45
+ bookmarkText: (name: string) => string | null | undefined;
46
+ bookmarkPage: (name: string) => number | null | undefined;
47
+ pageIndexAt: (paragraphId: string, offset: number) => number | undefined;
48
+ forPage: (pageIndex: number) => import('./fieldEvaluation.js').FieldEvaluationContext;
49
+ forPosition: (paragraphId: string, offset: number) => import('./fieldEvaluation.js').FieldEvaluationContext;
50
+ }): XePage | undefined;
@@ -0,0 +1,16 @@
1
+ import { EditorDocument, EditorLayoutDocument } from '../model.js';
2
+ import { XePage } from './xeEntries.js';
3
+ export interface XeRangePage extends XePage {
4
+ sectionIndex: number;
5
+ }
6
+ /** Resolve a nonempty main-story bookmark as an exclusive-end range.
7
+ * Keep every physical page and its own section's printed label. Rendering
8
+ * a compact range across a numbering restart is a separate policy.
9
+ */
10
+ export declare function resolveXeBookmarkRange(document: EditorDocument, layout: EditorLayoutDocument, name: string, context?: {
11
+ bookmarkText: (name: string) => string | null | undefined;
12
+ bookmarkPage: (name: string) => number | null | undefined;
13
+ pageIndexAt: (paragraphId: string, offset: number) => number | undefined;
14
+ forPage: (pageIndex: number) => import('./fieldEvaluation.js').FieldEvaluationContext;
15
+ forPosition: (paragraphId: string, offset: number) => import('./fieldEvaluation.js').FieldEvaluationContext;
16
+ }): XeRangePage[] | undefined;
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Deterministic rendering for general Word field formatting switches.
3
+ * All formatters are bounded and fail closed: an unsupported picture or value
4
+ * returns undefined so the caller preserves the cached result instead of
5
+ * inventing a formatted value. No locale other than the explicit en-US
6
+ * numeric mask is implied; date pictures are handled by temporalFieldFormat.
7
+ */
8
+ /** `\*` switch names, duplicated here to keep the format layer independent
9
+ * of the OOXML parser (no import cycle). */
10
+ export type FormatSwitchName = "MERGEFORMAT" | "CHARFORMAT" | "Caps" | "FirstCap" | "Upper" | "Lower" | "alphabetic" | "ALPHABETIC" | "Arabic" | "ArabicDash" | "CardText" | "DollarText" | "Hex" | "OrdText" | "Ordinal" | "roman" | "ROMAN";
11
+ /** `\*` number words. Case-sensitive names match Word's serialized switch. */
12
+ export declare function formatNumberWord(value: number, name: FormatSwitchName): string | undefined;
13
+ /** `\*` capitalization words applied after any numeric/date rendering. */
14
+ export declare function formatCapitalization(text: string, name: FormatSwitchName): string;
15
+ /** Apply a qualified `\*` name to an already resolved result string. */
16
+ export declare function applyStarFormat(text: string, name: FormatSwitchName): string | undefined;
17
+ export declare function supportsNumericPicture(picture: string): boolean;
18
+ /** `\#` numeric picture. Unrepresentable inputs return undefined. */
19
+ export declare function formatNumericPicture(value: number, picture: string): string | undefined;
@@ -21,6 +21,8 @@ export interface EditorState {
21
21
  trackChangesEnabled?: boolean;
22
22
  showMargins?: boolean;
23
23
  showParagraphMarks?: boolean;
24
+ /** Presentation toggle: show field instructions instead of cached results. */
25
+ showFieldCodes?: boolean;
24
26
  /**
25
27
  * Display for Review: how tracked revisions render in the canvas.
26
28
  * "all" — show markup (default)
@@ -6,7 +6,7 @@
6
6
  * statements that pointed there continue to work via the barrel
7
7
  * re-export in `src/core/model.ts`.
8
8
  */
9
- export type { EditorUnderlineStyle, EditorLigatures, EditorNumberSpacing, EditorNumberForm, EditorTextLanguage, EditorBorderStyle, EditorEmphasisMark, EditorTabStop, EditorParagraphListStyle, EditorImageCrop, EditorImageCropShape, EditorImageCropFit, EditorImageFillMode, EditorLineDash, EditorImageBorder, EditorImageFloatingPosition, EditorImageFloatingLayout, EditorImageRunData, EditorWrapPolygonPoint, EditorFieldData, EditorFieldChar, EditorFootnoteReferenceData, EditorEndnoteReferenceData, PageNumberFormat, EditorRevision, EditorRevisionMetadata, EditorMoveRangeMarker, EditorNumberingRevision, EditorStructuralRevision, EditorPropertyRevision, EditorAsset, EditorFootnoteNumberFormat, EditorFootnoteRestart, EditorDocxWidthValue, EditorTableLayout, EditorTableRowHeightRule, EditorGradientStop, EditorTextFill, EditorTextOutline, EditorTextShadow, EditorGlow, EditorReflection, } from './types/primitives.js';
9
+ export type { EditorUnderlineStyle, EditorLigatures, EditorNumberSpacing, EditorNumberForm, EditorTextLanguage, EditorBorderStyle, EditorEmphasisMark, EditorTabStop, EditorParagraphListStyle, EditorImageCrop, EditorImageCropShape, EditorImageCropFit, EditorImageFillMode, EditorLineDash, EditorImageBorder, EditorImageFloatingPosition, EditorImageFloatingLayout, EditorImageRunData, EditorWrapPolygonPoint, EditorFieldData, EditorFieldChar, EditorLegacyFormFieldData, EditorFootnoteReferenceData, EditorEndnoteReferenceData, PageNumberFormat, EditorRevision, EditorRevisionMetadata, EditorMoveRangeMarker, EditorNumberingRevision, EditorStructuralRevision, EditorPropertyRevision, EditorAsset, EditorFootnoteNumberFormat, EditorFootnoteRestart, EditorDocxWidthValue, EditorTableLayout, EditorTableRowHeightRule, EditorGradientStop, EditorTextFill, EditorTextOutline, EditorTextShadow, EditorGlow, EditorReflection, } from './types/primitives.js';
10
10
  export type { EditorTextStyle, EditorParagraphStyle, EditorTableStyle, EditorTableFloatingLayout, EditorTableConditionalFormat, EditorConditionalRowStyle, EditorTableConditionalType, EditorTableConditionalFlags, EditorTableCellStyle, EditorNamedStyle, } from './types/styles.js';
11
11
  export type { EditorRunBase, EditorOpaqueRunData, EditorTextRun, EditorTextBoxShape, EditorTextBoxBody, EditorTextBoxData, EditorDropCap, EditorSdtBlockWrapper, EditorSdtPr, EditorSdtSubtype, EditorSdtListItem, EditorSdtDataBinding, EditorParagraphNode, EditorTableCellNode, EditorTableRowStyle, EditorTableRowNode, EditorTableNode, EditorBlockNode, } from './types/nodes.js';
12
12
  export type { EditorMathNode, EditorMathText, EditorMathFraction, EditorMathRadical, EditorMathScript, EditorMathDelimiter, EditorMathAccent, EditorMathNary, EditorMathLimit, EditorMathMatrix, EditorMathBox, EditorMathGroup, EditorMathRaw, EditorMathStyle, EditorMathExpression, } from './types/math.js';
@@ -223,12 +223,44 @@ export interface EditorFieldData {
223
223
  * {@link EditorTextRun.fieldInstruction}. A field may span multiple paragraphs
224
224
  * (e.g. a TOC); document order reconstructs the structure on export.
225
225
  */
226
+ export interface EditorLegacyFormFieldData {
227
+ /** `w:ffData/w:name`; legacy form fields are addressed by this name. */
228
+ name: string;
229
+ control: "text" | "checkBox" | "dropDown";
230
+ /** Current cached value shown between `separate` and `end`. */
231
+ value: string;
232
+ enabled: boolean;
233
+ calcOnExit: boolean;
234
+ helpText?: string;
235
+ statusText?: string;
236
+ /** Preserved as opaque strings; never executed. */
237
+ entryMacro?: string;
238
+ exitMacro?: string;
239
+ textInput?: {
240
+ default?: string;
241
+ format?: string;
242
+ maxLength?: number;
243
+ type?: string;
244
+ };
245
+ checkBox?: {
246
+ checked: boolean;
247
+ default: boolean;
248
+ size?: number;
249
+ sizeAuto?: boolean;
250
+ };
251
+ ddList?: {
252
+ defaultResult?: string;
253
+ listEntries: readonly string[];
254
+ };
255
+ }
226
256
  export interface EditorFieldChar {
227
257
  kind: "begin" | "separate" | "end";
228
258
  /** `w:fldChar/@w:fldLock`. */
229
259
  fieldLock?: boolean;
230
260
  /** `w:fldChar/@w:dirty`. */
231
261
  dirty?: boolean;
262
+ /** `w:ffData` on a legacy FORMTEXT/FORMCHECKBOX/FORMDROPDOWN field. */
263
+ formField?: EditorLegacyFormFieldData;
232
264
  }
233
265
  export interface EditorFootnoteReferenceData {
234
266
  footnoteId: string;