oasis-editor 0.0.148 → 0.0.150

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 (48) hide show
  1. package/dist/{OasisEditorApp-B1b1iJOQ.js → OasisEditorApp-CZNfjaj2.js} +661 -79
  2. package/dist/app/controllers/EditorCommandsController.d.ts +4 -0
  3. package/dist/app/controllers/createCropSession.d.ts +1 -0
  4. package/dist/app/controllers/useEditorImageOperations.d.ts +3 -0
  5. package/dist/app/controllers/useEditorSurfaceEvents.d.ts +1 -0
  6. package/dist/assets/importDocxWorker-Ddoy1WwF.js +12 -0
  7. package/dist/core/commands/builtinCommands.d.ts +1 -1
  8. package/dist/core/commands/image.d.ts +16 -1
  9. package/dist/core/commands/publicCommandTypes.d.ts +11 -1
  10. package/dist/core/commands/text.d.ts +1 -1
  11. package/dist/core/commands/textEditing.d.ts +3 -1
  12. package/dist/core/document/clone.d.ts +2 -1
  13. package/dist/core/math/linear.d.ts +5 -0
  14. package/dist/core/model/index.d.ts +4 -2
  15. package/dist/core/model/runKind.d.ts +3 -0
  16. package/dist/core/model/types/layout.d.ts +2 -0
  17. package/dist/core/model/types/math.d.ts +95 -0
  18. package/dist/core/model/types/nodes.d.ts +4 -0
  19. package/dist/core/model/types/primitives.d.ts +16 -0
  20. package/dist/export/docx/docxTypes.d.ts +3 -1
  21. package/dist/export/docx/text/mathXml.d.ts +3 -0
  22. package/dist/export/pdf/OasisPdfWriter.d.ts +2 -1
  23. package/dist/export/pdf/writer/PdfContentStream.d.ts +3 -1
  24. package/dist/i18n/locales/en.d.ts +13 -0
  25. package/dist/i18n/locales/pt-BR.d.ts +13 -0
  26. package/dist/import/docx/math.d.ts +5 -0
  27. package/dist/import/docx/runs/types.d.ts +2 -1
  28. package/dist/{index-CpZO1PF4.js → index-DgN6KXYw.js} +2405 -1510
  29. package/dist/index.d.ts +1 -0
  30. package/dist/oasis-editor.css +1 -1
  31. package/dist/oasis-editor.js +79 -79
  32. package/dist/oasis-editor.umd.cjs +4 -4
  33. package/dist/plugins/internal/essentialsCapabilities.d.ts +14 -1
  34. package/dist/ui/OasisEditorEditorProps.d.ts +3 -0
  35. package/dist/ui/app/EditorDialogsLayer.d.ts +2 -0
  36. package/dist/ui/app/buildEditorViewProps.d.ts +1 -0
  37. package/dist/ui/app/createAppCommandsController.d.ts +8 -0
  38. package/dist/ui/app/createEditorCommandRuntime.d.ts +9 -0
  39. package/dist/ui/app/createEditorInteractionRuntime.d.ts +4 -0
  40. package/dist/ui/app/essentials/types.d.ts +1 -0
  41. package/dist/ui/app/useEditorDialogs.d.ts +11 -0
  42. package/dist/ui/app/useEditorInteractionWiring.d.ts +1 -0
  43. package/dist/ui/components/Dialogs/EquationDialog.d.ts +10 -0
  44. package/dist/ui/cropGeometry.d.ts +4 -3
  45. package/dist/ui/math/mathPainter.d.ts +10 -0
  46. package/dist/ui/overlays/ImageCropPreviewOverlay.d.ts +16 -0
  47. package/package.json +1 -1
  48. package/dist/assets/importDocxWorker-BLm3QMHu.js +0 -12
@@ -1,2 +1,2 @@
1
- export declare const OASIS_BUILTIN_COMMANDS: readonly ["selectAll", "insertFootnote", "insertText", "insertTableOfContents", "updateTableOfContents", "pastePlainText", "bold", "italic", "underline", "strike", "superscript", "subscript", "link", "unlink", "alignLeft", "alignCenter", "alignRight", "alignJustify", "orderedList", "bulletList", "find", "replace", "toggleTrackChanges", "acceptRevisions", "rejectRevisions", "toggleShowMargins", "toggleShowParagraphMarks", "togglePreciseFonts", "undo", "redo", "pageBreak", "lineBreak", "splitBlock", "setFontFamily", "setFontSize", "increaseFontSize", "decreaseFontSize", "changeTextCase", "clearFormatting", "setColor", "setHighlight", "setTextShading", "setStyleId", "setCharacterStyleId", "setUnderlineStyle", "documentStyles", "print", "copy", "newDocument", "exportDocx", "exportPdf", "importDocument", "insertImage", "editImageAlt", "insertImageCaption", "imageContext", "imageWidthCm", "imageHeightCm", "imageCrop", "imageCropAspect", "imageBorder", "outdent", "indent", "togglePageBreakBefore", "toggleKeepWithNext", "setSpacingAfter", "setSpacingBefore", "setIndentLeft", "setIndentRight", "setIndentFirstLine", "setIndentHanging", "setSpecialIndent", "setParagraphShading", "applyParagraphBorders", "setLineHeight", "setListFormat", "setListStartAt", "toggleOrientation", "setOrientation", "sectionBreakNextPage", "sectionBreakContinuous", "setPageMargins", "tableContext", "tableMerge", "tableSplit", "tableInsertColumnBefore", "tableInsertColumnAfter", "tableDeleteColumn", "tableInsertRowBefore", "tableInsertRowAfter", "tableDeleteRow", "tableCellShading", "tableCellBorders", "tableCellNoBorders", "tableApplyBorderPreset", "toggleTableDrawBorders", "toggleTableGridlines", "tableWidth100", "tableAlignLeft", "tableAlignCenter", "tableAlignRight", "tableSetCellWidth", "tableToggleHeaderRow", "tableToggleTotalRow", "tableToggleBandedRows", "tableToggleFirstColumn", "tableToggleLastColumn", "tableToggleBandedColumns", "setTableStyle", "tableToggleAutoFit", "tableDistributeColumns", "tableDistributeRows", "insertTable", "insertShape", "openSymbolDialog"];
1
+ export declare const OASIS_BUILTIN_COMMANDS: readonly ["selectAll", "insertFootnote", "insertText", "insertEquation", "updateEquation", "insertTableOfContents", "updateTableOfContents", "pastePlainText", "bold", "italic", "underline", "strike", "superscript", "subscript", "link", "unlink", "alignLeft", "alignCenter", "alignRight", "alignJustify", "orderedList", "bulletList", "find", "replace", "toggleTrackChanges", "acceptRevisions", "rejectRevisions", "toggleShowMargins", "toggleShowParagraphMarks", "togglePreciseFonts", "undo", "redo", "pageBreak", "lineBreak", "splitBlock", "setFontFamily", "setFontSize", "increaseFontSize", "decreaseFontSize", "changeTextCase", "clearFormatting", "setColor", "setHighlight", "setTextShading", "setStyleId", "setCharacterStyleId", "setUnderlineStyle", "documentStyles", "print", "copy", "newDocument", "exportDocx", "exportPdf", "importDocument", "insertImage", "editImageAlt", "insertImageCaption", "imageContext", "imageWidthCm", "imageHeightCm", "imageCrop", "imageCropAspect", "imageCropShape", "imageCropFill", "imageCropFit", "imageCropReset", "imageBorder", "outdent", "indent", "togglePageBreakBefore", "toggleKeepWithNext", "setSpacingAfter", "setSpacingBefore", "setIndentLeft", "setIndentRight", "setIndentFirstLine", "setIndentHanging", "setSpecialIndent", "setParagraphShading", "applyParagraphBorders", "setLineHeight", "setListFormat", "setListStartAt", "toggleOrientation", "setOrientation", "sectionBreakNextPage", "sectionBreakContinuous", "setPageMargins", "tableContext", "tableMerge", "tableSplit", "tableInsertColumnBefore", "tableInsertColumnAfter", "tableDeleteColumn", "tableInsertRowBefore", "tableInsertRowAfter", "tableDeleteRow", "tableCellShading", "tableCellBorders", "tableCellNoBorders", "tableApplyBorderPreset", "toggleTableDrawBorders", "toggleTableGridlines", "tableWidth100", "tableAlignLeft", "tableAlignCenter", "tableAlignRight", "tableSetCellWidth", "tableToggleHeaderRow", "tableToggleTotalRow", "tableToggleBandedRows", "tableToggleFirstColumn", "tableToggleLastColumn", "tableToggleBandedColumns", "setTableStyle", "tableToggleAutoFit", "tableDistributeColumns", "tableDistributeRows", "insertTable", "insertShape", "openSymbolDialog", "openEquationDialog"];
2
2
  export type OasisBuiltinCommand = (typeof OASIS_BUILTIN_COMMANDS)[number];
@@ -1,4 +1,4 @@
1
- import { EditorPosition, EditorState, EditorImageRunData, EditorImageBorder, EditorImageCrop, EditorLineDash } from '../model.js';
1
+ import { EditorPosition, EditorState, EditorImageRunData, EditorImageBorder, EditorImageCrop, EditorImageCropShape, EditorLineDash } from '../model.js';
2
2
  import { SelectedObjectRun } from './selectedObjectRun.js';
3
3
  import { WrapPreset } from './floatingLayout.js';
4
4
 
@@ -42,6 +42,21 @@ export type ImageCropAspectMode = number | "reset";
42
42
  export declare function computeImageAspectCrop(image: EditorImageRunData, mode: ImageCropAspectMode): ImageCropUpdate;
43
43
  /** Applies an aspect-ratio crop preset to the selected image. */
44
44
  export declare function applySelectedImageCropAspect(state: EditorState, mode: ImageCropAspectMode): EditorState;
45
+ /** Returns the selected picture's clipping geometry, or `null`. */
46
+ export declare function getSelectedImageCropShape(state: EditorState): EditorImageCropShape | null;
47
+ /** Applies/removes a DrawingML preset geometry used as a picture mask. */
48
+ export declare function setSelectedImageCropShape(state: EditorState, preset: string | null): EditorState;
49
+ /**
50
+ * Computes a centred source crop that covers the existing display frame. The
51
+ * frame dimensions are unchanged, matching Word's Fill command.
52
+ */
53
+ export declare function computeImageFillCrop(image: EditorImageRunData): EditorImageCrop;
54
+ /** Applies Word's Fill behaviour while keeping the picture frame stable. */
55
+ export declare function applySelectedImageCropFill(state: EditorState): EditorState;
56
+ /** Shows the complete source image inside the frame (Word's Adjust command). */
57
+ export declare function applySelectedImageCropFit(state: EditorState): EditorState;
58
+ /** Removes crop, fit/fill state and picture mask, restoring a plain picture. */
59
+ export declare function resetSelectedImageCrop(state: EditorState): EditorState;
45
60
  /** Outline of the selected image (`pic:spPr/a:ln`), or `null`. */
46
61
  export declare function getSelectedImageBorder(state: EditorState): EditorImageBorder | null;
47
62
  /**
@@ -1,5 +1,5 @@
1
1
  import { CommandRef } from './CommandRef.js';
2
- import { EditorPageMargins } from '../model.js';
2
+ import { EditorPageMargins, EditorMathExpression } from '../model.js';
3
3
  import { TextCaseMode } from './text.js';
4
4
  import { TableBorderPreset } from './table.js';
5
5
 
@@ -33,6 +33,11 @@ export interface OasisCommandPayloads {
33
33
  selectAll: undefined;
34
34
  insertFootnote: undefined;
35
35
  insertText: string | InsertTextPayload;
36
+ insertEquation: EditorMathExpression;
37
+ updateEquation: {
38
+ runId: string;
39
+ expression: EditorMathExpression;
40
+ };
36
41
  pastePlainText: undefined;
37
42
  bold: undefined;
38
43
  italic: undefined;
@@ -88,6 +93,10 @@ export interface OasisCommandPayloads {
88
93
  imageHeightCm: number | string | null;
89
94
  imageCrop: undefined;
90
95
  imageCropAspect: string;
96
+ imageCropShape: string;
97
+ imageCropFill: undefined;
98
+ imageCropFit: undefined;
99
+ imageCropReset: undefined;
91
100
  outdent: undefined;
92
101
  indent: undefined;
93
102
  togglePageBreakBefore: undefined;
@@ -141,6 +150,7 @@ export interface OasisCommandPayloads {
141
150
  tableDistributeRows: undefined;
142
151
  insertTable: InsertTablePayload;
143
152
  openSymbolDialog: undefined;
153
+ openEquationDialog: undefined;
144
154
  }
145
155
  /** Maps commands to their typed return values. Commands not listed return `unknown`. */
146
156
  export interface OasisCommandResults {
@@ -1,4 +1,4 @@
1
- export { moveOrCopySelectionToPosition, insertTextAtSelection, insertPlainTextAtSelection, } from './textEditing.js';
1
+ export { moveOrCopySelectionToPosition, insertTextAtSelection, insertPlainTextAtSelection, insertMathAtSelection, updateMathRun, } from './textEditing.js';
2
2
  export { deleteBackward, deleteForward } from './textDeletion.js';
3
3
  export { toggleTextStyle, clearSelectedTextFormatting, setTextStyleValue, } from './textFormatting.js';
4
4
  export { type TextCaseMode, transformSelectedText, changeSelectedTextCase, } from './textCase.js';
@@ -1,7 +1,9 @@
1
- import { EditorPosition, EditorState, EditorTextStyle } from '../model.js';
1
+ import { EditorPosition, EditorState, EditorTextStyle, EditorMathExpression } from '../model.js';
2
2
 
3
3
  export declare function moveOrCopySelectionToPosition(state: EditorState, targetPosition: EditorPosition, options?: {
4
4
  copy?: boolean;
5
5
  }): EditorState;
6
6
  export declare function insertTextAtSelection(state: EditorState, text: string, styleOverride?: EditorTextStyle): EditorState;
7
+ export declare function insertMathAtSelection(state: EditorState, expression: EditorMathExpression): EditorState;
8
+ export declare function updateMathRun(state: EditorState, runId: string, expression: EditorMathExpression): EditorState;
7
9
  export declare function insertPlainTextAtSelection(state: EditorState, text: string, styleOverride?: EditorTextStyle): EditorState;
@@ -1,6 +1,7 @@
1
- import { EditorBlockNode, EditorParagraphListStyle, EditorParagraphNode, EditorTextBoxData, EditorTextRun } from '../model.js';
1
+ import { EditorBlockNode, EditorParagraphListStyle, EditorParagraphNode, EditorTextBoxData, EditorTextRun, EditorMathExpression } from '../model.js';
2
2
 
3
3
  export declare function cloneTextBox(textBox: EditorTextBoxData): EditorTextBoxData;
4
+ export declare function cloneMathExpression(expression: EditorMathExpression): EditorMathExpression;
4
5
  export declare function cloneRun(run: EditorTextRun): EditorTextRun;
5
6
  export declare function cloneParagraph(paragraph: EditorParagraphNode): EditorParagraphNode;
6
7
  export declare function cloneParagraphList(list?: EditorParagraphListStyle): EditorParagraphListStyle | undefined;
@@ -0,0 +1,5 @@
1
+ import { EditorMathExpression, EditorMathNode } from '../model.js';
2
+
3
+ export declare function parseLinearMath(linear: string): EditorMathExpression;
4
+ export declare function serializeLinearMathNodes(nodes: EditorMathNode[]): string;
5
+ export declare function serializeLinearMath(expression: EditorMathExpression): string;
@@ -6,11 +6,13 @@
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, EditorImageFillMode, EditorLineDash, EditorImageBorder, EditorImageFloatingPosition, EditorImageFloatingLayout, EditorImageRunData, EditorWrapPolygonPoint, EditorFieldData, EditorFieldChar, EditorFootnoteReferenceData, EditorEndnoteReferenceData, EditorRevision, EditorRevisionMetadata, 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, EditorFootnoteReferenceData, EditorEndnoteReferenceData, EditorRevision, EditorRevisionMetadata, 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, EditorTextRun, EditorTextBoxShape, EditorTextBoxBody, EditorTextBoxData, EditorDropCap, EditorSdtBlockWrapper, EditorSdtPr, EditorSdtSubtype, EditorSdtListItem, EditorSdtDataBinding, EditorParagraphNode, EditorTableCellNode, EditorTableRowStyle, EditorTableRowNode, EditorTableNode, EditorBlockNode, } from './types/nodes.js';
12
+ export type { EditorMathNode, EditorMathText, EditorMathFraction, EditorMathRadical, EditorMathScript, EditorMathDelimiter, EditorMathAccent, EditorMathNary, EditorMathLimit, EditorMathMatrix, EditorMathBox, EditorMathGroup, EditorMathRaw, EditorMathStyle, EditorMathExpression, } from './types/math.js';
13
+ export { EMPTY_EDITOR_MATH_EXPRESSION, MATH_OBJECT_REPLACEMENT, } from './types/math.js';
12
14
  export type { RunKind, RunOfKind, RunVisitor } from './runKind.js';
13
- export { getRunKind, isInlineObjectRun, visitRun, getRunImage, getRunTextBox, getRunField, getRunFieldChar, getRunFieldInstruction, getRunFootnoteReference, getRunEndnoteReference, getRunSym, } from './runKind.js';
15
+ export { getRunKind, isInlineObjectRun, visitRun, getRunImage, getRunTextBox, getRunField, getRunFieldChar, getRunFieldInstruction, getRunFootnoteReference, getRunEndnoteReference, getRunSym, getRunMath, } from './runKind.js';
14
16
  export type { EditorFootnote } from './types/documentFootnotes.js';
15
17
  export type { EditorEndnote } from './types/documentEndnotes.js';
16
18
  export type { EditorBookmark, EditorBookmarkAnchor, EditorBookmarks, } from './types/documentBookmarks.js';
@@ -1,4 +1,5 @@
1
1
  import { EditorTextBoxData, EditorTextRun } from './types/nodes.js';
2
+ import { EditorMathExpression } from './types/math.js';
2
3
  import { EditorFieldChar, EditorFieldData, EditorImageRunData, EditorFootnoteReferenceData, EditorEndnoteReferenceData } from './types/primitives.js';
3
4
 
4
5
  /**
@@ -26,6 +27,7 @@ export declare function getRunSym(run: EditorTextRun): {
26
27
  font: string;
27
28
  char: string;
28
29
  } | undefined;
30
+ export declare function getRunMath(run: EditorTextRun): EditorMathExpression | undefined;
29
31
  export interface RunVisitor<R> {
30
32
  text(run: RunOfKind<"text">): R;
31
33
  image(run: RunOfKind<"image">): R;
@@ -36,6 +38,7 @@ export interface RunVisitor<R> {
36
38
  footnoteReference(run: RunOfKind<"footnoteReference">): R;
37
39
  endnoteReference(run: RunOfKind<"endnoteReference">): R;
38
40
  sym(run: RunOfKind<"sym">): R;
41
+ math?(run: RunOfKind<"math">): R;
39
42
  }
40
43
  /**
41
44
  * Exhaustive dispatch over a run's kind, narrowing the run to the matching union
@@ -1,4 +1,5 @@
1
1
  import { EditorBlockNode, EditorTextBoxData } from './nodes.js';
2
+ import { EditorMathExpression } from './math.js';
2
3
  import { EditorPageSettings } from './document.js';
3
4
  import { EditorRevision, EditorImageRunData } from './primitives.js';
4
5
  import { EditorTextStyle } from './styles.js';
@@ -24,6 +25,7 @@ export interface EditorLayoutFragment {
24
25
  styles?: EditorTextStyle;
25
26
  image?: EditorImageRunData;
26
27
  textBox?: EditorTextBoxData;
28
+ math?: EditorMathExpression;
27
29
  revision?: EditorRevision;
28
30
  chars: EditorLayoutFragmentChar[];
29
31
  }
@@ -0,0 +1,95 @@
1
+ /**
2
+ * Structured Office Math Markup Language (OMML) data used by the editor.
3
+ *
4
+ * Math expressions are deliberately independent from the document tree. A
5
+ * paragraph stores one expression as an inline object; the expression itself
6
+ * is edited as this small, serialisable AST.
7
+ */
8
+ export type EditorMathNode = EditorMathText | EditorMathFraction | EditorMathRadical | EditorMathScript | EditorMathDelimiter | EditorMathAccent | EditorMathNary | EditorMathLimit | EditorMathMatrix | EditorMathBox | EditorMathGroup | EditorMathRaw;
9
+ export interface EditorMathText {
10
+ kind: "text";
11
+ value: string;
12
+ style?: EditorMathStyle;
13
+ }
14
+ export interface EditorMathFraction {
15
+ kind: "fraction";
16
+ numerator: EditorMathNode[];
17
+ denominator: EditorMathNode[];
18
+ bar?: boolean;
19
+ }
20
+ export interface EditorMathRadical {
21
+ kind: "radical";
22
+ radicand: EditorMathNode[];
23
+ degree?: EditorMathNode[];
24
+ }
25
+ export interface EditorMathScript {
26
+ kind: "script";
27
+ base: EditorMathNode[];
28
+ subscript?: EditorMathNode[];
29
+ superscript?: EditorMathNode[];
30
+ }
31
+ export interface EditorMathDelimiter {
32
+ kind: "delimiter";
33
+ children: EditorMathNode[][];
34
+ begin?: string;
35
+ end?: string;
36
+ separator?: string;
37
+ grow?: boolean;
38
+ }
39
+ export interface EditorMathAccent {
40
+ kind: "accent";
41
+ accent: string;
42
+ children: EditorMathNode[];
43
+ }
44
+ export interface EditorMathNary {
45
+ kind: "nary";
46
+ operator: string;
47
+ children: EditorMathNode[];
48
+ subscript?: EditorMathNode[];
49
+ superscript?: EditorMathNode[];
50
+ grow?: boolean;
51
+ }
52
+ export interface EditorMathLimit {
53
+ kind: "limit";
54
+ operator: "low" | "upper";
55
+ base: EditorMathNode[];
56
+ limit: EditorMathNode[];
57
+ }
58
+ export interface EditorMathMatrix {
59
+ kind: "matrix";
60
+ rows: EditorMathNode[][][];
61
+ rowGap?: number;
62
+ columnGap?: number;
63
+ }
64
+ export interface EditorMathBox {
65
+ kind: "box";
66
+ children: EditorMathNode[];
67
+ border?: boolean;
68
+ hidden?: boolean;
69
+ }
70
+ export interface EditorMathGroup {
71
+ kind: "group";
72
+ children: EditorMathNode[];
73
+ }
74
+ /** Unknown OMML is retained so importing and re-exporting remains lossless. */
75
+ export interface EditorMathRaw {
76
+ kind: "raw";
77
+ xml: string;
78
+ fallbackText?: string;
79
+ }
80
+ export interface EditorMathStyle {
81
+ fontFamily?: string;
82
+ bold?: boolean;
83
+ italic?: boolean;
84
+ normalText?: boolean;
85
+ script?: "roman" | "script" | "fraktur" | "double-struck";
86
+ }
87
+ export interface EditorMathExpression {
88
+ version: 1;
89
+ children: EditorMathNode[];
90
+ display?: boolean;
91
+ /** Original OMML for diagnostics and exact round-trip of untouched data. */
92
+ sourceXml?: string;
93
+ }
94
+ export declare const EMPTY_EDITOR_MATH_EXPRESSION: EditorMathExpression;
95
+ export declare const MATH_OBJECT_REPLACEMENT = "\uFFFC";
@@ -1,4 +1,5 @@
1
1
  import { EditorDocxWidthValue, EditorEndnoteReferenceData, EditorFieldChar, EditorFieldData, EditorFootnoteReferenceData, EditorImageFloatingLayout, EditorImageRunData, EditorParagraphListStyle, EditorRevision, EditorPropertyRevision, EditorStructuralRevision, EditorTableRowHeightRule } from './primitives.js';
2
+ import { EditorMathExpression } from './math.js';
2
3
  import { EditorParagraphStyle, EditorTableCellStyle, EditorTableStyle, EditorTableConditionalFlags, EditorTextStyle } from './styles.js';
3
4
 
4
5
  /**
@@ -127,6 +128,9 @@ export type EditorTextRun = (EditorRunBase & {
127
128
  font: string;
128
129
  char: string;
129
130
  };
131
+ }) | (EditorRunBase & {
132
+ kind: "math";
133
+ math: EditorMathExpression;
130
134
  });
131
135
  /**
132
136
  * A drop cap (Word's `w:framePr/@dropCap`): a large initial letter sunk into
@@ -109,6 +109,17 @@ export interface EditorImageCrop {
109
109
  right?: number;
110
110
  bottom?: number;
111
111
  }
112
+ /**
113
+ * DrawingML preset geometry used to clip a picture. `rawXml` keeps imported
114
+ * geometries that the renderer does not understand lossless on export.
115
+ */
116
+ export interface EditorImageCropShape {
117
+ preset: string;
118
+ adjustments?: Record<string, number>;
119
+ rawXml?: string;
120
+ }
121
+ /** How the source image is fitted into the displayed crop frame. */
122
+ export type EditorImageCropFit = "fill" | "fit";
112
123
  export type EditorImageFillMode = "stretch" | "tile";
113
124
  /**
114
125
  * Preset dash patterns for an outline, mapped from DrawingML `a:prstDash/@val`.
@@ -159,9 +170,14 @@ export interface EditorImageRunData {
159
170
  src: string;
160
171
  width: number;
161
172
  height: number;
173
+ /** Intrinsic source dimensions, when available. */
174
+ intrinsicWidth?: number;
175
+ intrinsicHeight?: number;
162
176
  alt?: string;
163
177
  linkedSrc?: string;
164
178
  crop?: EditorImageCrop;
179
+ cropFit?: EditorImageCropFit;
180
+ cropShape?: EditorImageCropShape;
165
181
  fillMode?: EditorImageFillMode;
166
182
  border?: EditorImageBorder;
167
183
  rotation?: number;
@@ -1,4 +1,4 @@
1
- import { EditorBlockNode, EditorImageBorder, EditorImageCrop, EditorImageFillMode, EditorImageFloatingLayout, EditorParagraphListStyle, EditorWrapPolygonPoint } from '../../core/model.js';
1
+ import { EditorBlockNode, EditorImageBorder, EditorImageCrop, EditorImageCropShape, EditorImageCropFit, EditorImageFillMode, EditorImageFloatingLayout, EditorParagraphListStyle, EditorWrapPolygonPoint } from '../../core/model.js';
2
2
  import { EditorListOoxmlNumberingMetadata } from '../../ooxml/word/numberingMetadata.js';
3
3
  import { BookmarkEventsByParagraph } from './bookmarksXml.js';
4
4
  import { CommentEventsByParagraph } from './commentsXml.js';
@@ -37,6 +37,8 @@ export interface DocContext {
37
37
  cy: number;
38
38
  alt?: string;
39
39
  crop?: EditorImageCrop;
40
+ cropShape?: EditorImageCropShape;
41
+ cropFit?: EditorImageCropFit;
40
42
  fillMode?: EditorImageFillMode;
41
43
  border?: EditorImageBorder;
42
44
  rotation?: number;
@@ -0,0 +1,3 @@
1
+ import { EditorMathExpression } from '../../../core/model.js';
2
+
3
+ export declare function serializeMathExpression(expression: EditorMathExpression): string;
@@ -1,4 +1,4 @@
1
- import { OasisPdfAxialGradient, OasisPdfLinkAnnotation, OasisPdfNamedDestination, OasisPdfOutlineItem, OasisPdfDocumentInfo, OasisPdfFontResource, OasisPdfImageOptions, OasisPdfImageResource, OasisPdfLineOptions, OasisPdfPageSize, OasisPdfPathOptions, OasisPdfRectOptions, OasisPdfTextOptions } from './writer/pdfTypes.js';
1
+ import { OasisPdfAxialGradient, OasisPdfLinkAnnotation, OasisPdfNamedDestination, OasisPdfOutlineItem, OasisPdfDocumentInfo, OasisPdfFontResource, OasisPdfImageOptions, OasisPdfImageResource, OasisPdfLineOptions, OasisPdfPageSize, OasisPdfPathOptions, OasisPdfPathSegment, OasisPdfRectOptions, OasisPdfTextOptions } from './writer/pdfTypes.js';
2
2
 
3
3
  export type { OasisPdfPageSize, OasisPdfPage, OasisPdfRectOptions, OasisPdfLineOptions, OasisPdfPathSegment, OasisPdfPathOptions, OasisPdfTextOptions, OasisPdfImageResource, OasisPdfImageOptions, OasisPdfFontResource, OasisPdfBase14FontResource, OasisPdfUnicodeFontResource, OasisPdfLinkAnnotation, OasisPdfAnnotation, OasisPdfNamedDestination, OasisPdfOutlineItem, OasisPdfDocumentInfo, } from './writer/pdfTypes.js';
4
4
  export declare class OasisPdfWriter {
@@ -21,6 +21,7 @@ export declare class OasisPdfWriter {
21
21
  restoreGraphicsState(pageIndex: number): void;
22
22
  rotateAbout(pageIndex: number, centerX: number, centerY: number, degrees: number): void;
23
23
  clipRect(pageIndex: number, x: number, y: number, width: number, height: number): void;
24
+ clipPath(pageIndex: number, segments: OasisPdfPathSegment[]): void;
24
25
  drawText(pageIndex: number, options: OasisPdfTextOptions): void;
25
26
  /**
26
27
  * Registers an axial (linear) gradient on a page for use as a glyph fill, and
@@ -1,4 +1,4 @@
1
- import { OasisPdfAxialGradient, OasisPdfImageOptions, OasisPdfLineOptions, OasisPdfPage, OasisPdfPathOptions, OasisPdfRectOptions, OasisPdfTextOptions } from './pdfTypes.js';
1
+ import { OasisPdfAxialGradient, OasisPdfImageOptions, OasisPdfLineOptions, OasisPdfPage, OasisPdfPathOptions, OasisPdfPathSegment, OasisPdfRectOptions, OasisPdfTextOptions } from './pdfTypes.js';
2
2
  import { PdfFontTable } from './PdfFontTable.js';
3
3
  import { PdfImageTable } from './PdfImageTable.js';
4
4
  import { PdfShadingTable } from './PdfShadingTable.js';
@@ -22,6 +22,8 @@ export declare class PdfContentStream {
22
22
  restoreGraphicsState(): void;
23
23
  rotateAbout(centerX: number, centerY: number, degrees: number): void;
24
24
  clipRect(x: number, y: number, width: number, height: number): void;
25
+ /** Intersects the current clip with an arbitrary top-left-origin path. */
26
+ clipPath(segments: OasisPdfPathSegment[]): void;
25
27
  drawText(options: OasisPdfTextOptions): void;
26
28
  private textSetupCommands;
27
29
  private emitTextBlock;
@@ -351,6 +351,11 @@ export declare const en: {
351
351
  "dialog.symbol.recent": string;
352
352
  "dialog.symbol.code": string;
353
353
  "dialog.symbol.doubleClickHelp": string;
354
+ "dialog.equation.title": string;
355
+ "dialog.equation.insert": string;
356
+ "dialog.equation.structures": string;
357
+ "dialog.equation.linear": string;
358
+ "dialog.equation.empty": string;
354
359
  "dialog.newDocument.title": string;
355
360
  "dialog.newDocument.message": string;
356
361
  "dialog.newDocument.discard": string;
@@ -403,6 +408,7 @@ export declare const en: {
403
408
  "ribbon.group.paragraph": string;
404
409
  "ribbon.group.styles": string;
405
410
  "ribbon.group.illustrations": string;
411
+ "ribbon.group.symbols": string;
406
412
  "ribbon.group.tables": string;
407
413
  "ribbon.group.links": string;
408
414
  "ribbon.group.footnotes": string;
@@ -421,10 +427,17 @@ export declare const en: {
421
427
  "ribbon.group.size": string;
422
428
  "ribbon.group.imageStyles": string;
423
429
  "image.crop": string;
430
+ "image.cropToShape": string;
431
+ "image.cropAspectRatio": string;
432
+ "image.cropFill": string;
433
+ "image.cropFit": string;
424
434
  "image.height": string;
425
435
  "image.width": string;
426
436
  "image.cropReset": string;
427
437
  "image.cropRatio.square": string;
438
+ "image.cropRatio.squareGroup": string;
439
+ "image.cropRatio.portrait": string;
440
+ "image.cropRatio.landscape": string;
428
441
  "image.cropRatio.16x9": string;
429
442
  "image.cropRatio.4x3": string;
430
443
  "image.cropRatio.3x2": string;
@@ -351,6 +351,11 @@ export declare const ptBR: {
351
351
  "dialog.symbol.recent": string;
352
352
  "dialog.symbol.code": string;
353
353
  "dialog.symbol.doubleClickHelp": string;
354
+ "dialog.equation.title": string;
355
+ "dialog.equation.insert": string;
356
+ "dialog.equation.structures": string;
357
+ "dialog.equation.linear": string;
358
+ "dialog.equation.empty": string;
354
359
  "dialog.newDocument.title": string;
355
360
  "dialog.newDocument.message": string;
356
361
  "dialog.newDocument.discard": string;
@@ -403,6 +408,7 @@ export declare const ptBR: {
403
408
  "ribbon.group.paragraph": string;
404
409
  "ribbon.group.styles": string;
405
410
  "ribbon.group.illustrations": string;
411
+ "ribbon.group.symbols": string;
406
412
  "ribbon.group.tables": string;
407
413
  "ribbon.group.links": string;
408
414
  "ribbon.group.footnotes": string;
@@ -421,10 +427,17 @@ export declare const ptBR: {
421
427
  "ribbon.group.size": string;
422
428
  "ribbon.group.imageStyles": string;
423
429
  "image.crop": string;
430
+ "image.cropToShape": string;
431
+ "image.cropAspectRatio": string;
432
+ "image.cropFill": string;
433
+ "image.cropFit": string;
424
434
  "image.height": string;
425
435
  "image.width": string;
426
436
  "image.cropReset": string;
427
437
  "image.cropRatio.square": string;
438
+ "image.cropRatio.squareGroup": string;
439
+ "image.cropRatio.portrait": string;
440
+ "image.cropRatio.landscape": string;
428
441
  "image.cropRatio.16x9": string;
429
442
  "image.cropRatio.4x3": string;
430
443
  "image.cropRatio.3x2": string;
@@ -0,0 +1,5 @@
1
+ import { Element as XmlElement } from '@xmldom/xmldom';
2
+ import { EditorMathExpression } from '../../core/model.js';
3
+
4
+ export declare const MATH_NS = "http://schemas.openxmlformats.org/officeDocument/2006/math";
5
+ export declare function parseMathExpression(element: XmlElement): EditorMathExpression;
@@ -1,5 +1,5 @@
1
1
  import { Element as XmlElement } from '@xmldom/xmldom';
2
- import { EditorBlockNode, EditorTextStyle, EditorImageRunData, EditorTextBoxData } from '../../../core/model.js';
2
+ import { EditorBlockNode, EditorTextStyle, EditorImageRunData, EditorTextBoxData, EditorMathExpression } from '../../../core/model.js';
3
3
 
4
4
  export type ParseNestedBlocks = (container: XmlElement) => Promise<EditorBlockNode[]>;
5
5
  /**
@@ -53,4 +53,5 @@ export interface ImportedRun {
53
53
  font: string;
54
54
  char: string;
55
55
  };
56
+ math?: EditorMathExpression;
56
57
  }