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,4 +1,4 @@
1
- import { EditorImageBorder, EditorPageMargins } from '../../core/model.js';
1
+ import { EditorImageBorder, EditorPageMargins, EditorMathExpression } from '../../core/model.js';
2
2
  import { ImageBorderPatch } from '../../core/commands/image.js';
3
3
  import { TextCaseMode } from '../../core/commands/text.js';
4
4
  import { ToolbarStyleState } from '../../ui/toolbarStyleState.js';
@@ -24,6 +24,8 @@ export interface EssentialsFormattingCapability {
24
24
  selectAll: () => boolean;
25
25
  insertFootnote: () => boolean;
26
26
  insertText: (text: string, fontFamily?: string | null) => boolean;
27
+ insertEquation: (expression: EditorMathExpression) => boolean;
28
+ updateEquation: (runId: string, expression: EditorMathExpression) => boolean;
27
29
  pastePlainText: () => boolean;
28
30
  bold: () => boolean;
29
31
  italic: () => boolean;
@@ -92,6 +94,7 @@ export interface EssentialsDocumentCapability {
92
94
  insertImage: () => void;
93
95
  insertShape: (preset: string) => void;
94
96
  openSymbolDialog: () => void;
97
+ openEquationDialog: () => void;
95
98
  }
96
99
  export interface EssentialsLinkCapability {
97
100
  prompt: () => void;
@@ -117,6 +120,16 @@ export interface EssentialsImageCapability {
117
120
  toggleCrop: () => void;
118
121
  /** Apply an aspect-ratio crop preset (e.g. "16:9", "1:1", "reset"). */
119
122
  applyCropAspect: (preset: string) => void;
123
+ /** Current DrawingML picture mask preset, or `null` for a rectangle. */
124
+ getCropShape: () => string | null;
125
+ /** Apply/remove a DrawingML picture mask preset. */
126
+ applyCropShape: (preset: string) => void;
127
+ /** Fill the current picture frame by cropping the source. */
128
+ applyCropFill: () => void;
129
+ /** Fit the complete source image inside the current picture frame. */
130
+ applyCropFit: () => void;
131
+ /** Clear source crop, fit/fill mode and picture mask. */
132
+ resetCrop: () => void;
120
133
  /** Outline of the selected image (`pic:spPr/a:ln`), or `null`. */
121
134
  getBorder: () => EditorImageBorder | null;
122
135
  /** Merge a partial outline edit; `{ color: null }` removes the outline. */
@@ -71,6 +71,9 @@ export interface OasisEditorEditorSurfaceHandlers {
71
71
  onImageCropHandleMouseDown?: (paragraphId: string, paragraphOffset: number, direction: ResizeHandleDirection, event: MouseEvent & {
72
72
  currentTarget: HTMLElement;
73
73
  }) => void;
74
+ onImageCropBodyMouseDown?: (paragraphId: string, paragraphOffset: number, event: MouseEvent & {
75
+ currentTarget: HTMLElement;
76
+ }) => void;
74
77
  onTextBoxRotateHandleMouseDown: (paragraphId: string, paragraphOffset: number, event: MouseEvent & {
75
78
  currentTarget: HTMLElement;
76
79
  }) => void;
@@ -2,6 +2,7 @@ import { ComponentProps, JSX } from 'solid-js';
2
2
  import { FontDialog } from '../components/Dialogs/FontDialog.js';
3
3
  import { ParagraphDialog } from '../components/Dialogs/ParagraphDialog.js';
4
4
  import { TablePropertiesDialog } from '../components/Dialogs/TablePropertiesDialog.js';
5
+ import { EditorMathExpression } from '../../core/model.js';
5
6
  import { FindReplaceDialog } from '../components/FindReplace/FindReplaceDialog.js';
6
7
  import { ContextMenu } from '../components/ContextMenu/ContextMenu.js';
7
8
  import { createEditorDialogs } from './useEditorDialogs.js';
@@ -23,6 +24,7 @@ export interface EditorDialogsLayerProps {
23
24
  applyTablePropertiesDialogValues: ComponentProps<typeof TablePropertiesDialog>["onApply"];
24
25
  confirmNewDocument: () => void;
25
26
  insertSymbol: (symbol: string, fontFamily: string) => void;
27
+ applyEquation: (expression: EditorMathExpression, targetRunId?: string) => void;
26
28
  closeContextMenu: () => void;
27
29
  }
28
30
  /**
@@ -61,6 +61,7 @@ export interface EditorViewSurfaceInput {
61
61
  handleTextBoxResizeHandleMouseDown: OasisEditorEditorSurfaceHandlers["onTextBoxResizeHandleMouseDown"];
62
62
  handleImageRotateHandleMouseDown: OasisEditorEditorSurfaceHandlers["onImageRotateHandleMouseDown"];
63
63
  handleImageCropHandleMouseDown: NonNullable<OasisEditorEditorSurfaceHandlers["onImageCropHandleMouseDown"]>;
64
+ handleImageCropBodyMouseDown: NonNullable<OasisEditorEditorSurfaceHandlers["onImageCropBodyMouseDown"]>;
64
65
  handleTextBoxRotateHandleMouseDown: OasisEditorEditorSurfaceHandlers["onTextBoxRotateHandleMouseDown"];
65
66
  handleEditorContextMenu: (event: MouseEvent) => void;
66
67
  }
@@ -72,6 +72,10 @@ declare function createAppCommandsControllerImpl(deps: AppCommandsControllerDeps
72
72
  applyImageWidthCmCommand: (cm: number) => void;
73
73
  applyImageHeightCmCommand: (cm: number) => void;
74
74
  applyImageCropAspectCommand: (preset: string) => void;
75
+ applyImageCropShapeCommand: (preset: string) => void;
76
+ applyImageCropFillCommand: () => void;
77
+ applyImageCropFitCommand: () => void;
78
+ resetImageCropCommand: () => void;
75
79
  applyImageBorderCommand: (patch: import('../../core/commands/image.js').ImageBorderPatch) => void;
76
80
  handleListTab: (direction: "indent" | "outdent") => boolean;
77
81
  handleListEnter: () => boolean;
@@ -110,6 +114,10 @@ declare function createAppCommandsControllerImpl(deps: AppCommandsControllerDeps
110
114
  applyImageWidthCmCommand: (cm: number) => void;
111
115
  applyImageHeightCmCommand: (cm: number) => void;
112
116
  applyImageCropAspectCommand: (preset: string) => void;
117
+ applyImageCropShapeCommand: (preset: string) => void;
118
+ applyImageCropFillCommand: () => void;
119
+ applyImageCropFitCommand: () => void;
120
+ resetImageCropCommand: () => void;
113
121
  applyImageBorderCommand: (patch: import('../../core/commands/image.js').ImageBorderPatch) => void;
114
122
  handleListTab: (direction: "indent" | "outdent") => boolean;
115
123
  handleListEnter: () => boolean;
@@ -51,6 +51,11 @@ export interface EditorCommandRuntimeDeps {
51
51
  setSymbolDialog: (state: {
52
52
  isOpen: boolean;
53
53
  }) => void;
54
+ setEquationDialog: (state: {
55
+ isOpen: boolean;
56
+ initial?: import('../../core/model.js').EditorMathExpression;
57
+ targetRunId?: string;
58
+ }) => void;
54
59
  getUiState: () => OasisEditorUiState;
55
60
  updateUiState: (patch: OasisEditorUiState) => OasisEditorUiState;
56
61
  zoom: {
@@ -100,6 +105,10 @@ declare function createEditorCommandRuntimeImpl(deps: EditorCommandRuntimeDeps):
100
105
  applyImageWidthCmCommand: (cm: number) => void;
101
106
  applyImageHeightCmCommand: (cm: number) => void;
102
107
  applyImageCropAspectCommand: (preset: string) => void;
108
+ applyImageCropShapeCommand: (preset: string) => void;
109
+ applyImageCropFillCommand: () => void;
110
+ applyImageCropFitCommand: () => void;
111
+ resetImageCropCommand: () => void;
103
112
  applyImageBorderCommand: (patch: import('../../core/commands/image.js').ImageBorderPatch) => void;
104
113
  handleListTab: (direction: "indent" | "outdent") => boolean;
105
114
  handleListEnter: () => boolean;
@@ -33,6 +33,7 @@ export interface EditorInteractionRuntimeDeps {
33
33
  measuredParagraphLayouts: DocRuntime["measuredParagraphLayouts"];
34
34
  documentLayout: DocRuntime["documentLayout"];
35
35
  canvasSnapshotProvider: DocRuntime["canvasSnapshotProvider"];
36
+ openEquationDialog: (initial?: import('../../core/model.js').EditorMathExpression, targetRunId?: string) => void;
36
37
  }
37
38
  /**
38
39
  * Phase B of the editor runtime: selection queries, the hit resolver, find &
@@ -123,6 +124,9 @@ declare function createEditorInteractionRuntimeImpl(deps: EditorInteractionRunti
123
124
  handleImageCropHandleMouseDown: (paragraphId: string, paragraphOffset: number, direction: import('../resizeGeometry.js').ResizeHandleDirection, event: MouseEvent & {
124
125
  currentTarget: HTMLElement;
125
126
  }) => void;
127
+ handleImageCropBodyMouseDown: (paragraphId: string, paragraphOffset: number, event: MouseEvent & {
128
+ currentTarget: HTMLElement;
129
+ }) => void;
126
130
  };
127
131
  textBoxOps: {
128
132
  handleTextBoxResizeHandleMouseDown: (paragraphId: string, paragraphOffset: number, direction: import('../resizeGeometry.js').ResizeHandleDirection, event: MouseEvent & {
@@ -28,6 +28,7 @@ export interface CreateEditorEssentialsPluginOptions {
28
28
  };
29
29
  newDocument: () => void;
30
30
  openSymbolDialog: () => void;
31
+ openEquationDialog: () => void;
31
32
  importInputRef: () => HTMLInputElement | undefined;
32
33
  imageInputRef: () => HTMLInputElement | undefined;
33
34
  selectedImageRun: () => SelectedImageRun | null;
@@ -2,6 +2,7 @@ import { Accessor, Setter } from 'solid-js';
2
2
  import { FontDialogInitialValues } from '../components/Dialogs/FontDialog.js';
3
3
  import { ParagraphDialogInitialValues } from '../components/Dialogs/ParagraphDialog.js';
4
4
  import { TablePropertiesDialogInitialValues } from '../components/Dialogs/TablePropertiesDialog.js';
5
+ import { EditorMathExpression } from '../../core/model.js';
5
6
 
6
7
  export interface EditorDialogsState {
7
8
  newDocumentDialog: Accessor<{
@@ -16,6 +17,16 @@ export interface EditorDialogsState {
16
17
  setSymbolDialog: Setter<{
17
18
  isOpen: boolean;
18
19
  }>;
20
+ equationDialog: Accessor<{
21
+ isOpen: boolean;
22
+ initial?: EditorMathExpression;
23
+ targetRunId?: string;
24
+ }>;
25
+ setEquationDialog: Setter<{
26
+ isOpen: boolean;
27
+ initial?: EditorMathExpression;
28
+ targetRunId?: string;
29
+ }>;
19
30
  linkDialog: Accessor<{
20
31
  isOpen: boolean;
21
32
  initialHref: string;
@@ -50,6 +50,7 @@ export interface EditorInteractionWiringContext {
50
50
  getForcePlainTextPaste: () => boolean;
51
51
  setForcePlainTextPaste: (value: boolean) => void;
52
52
  insertImageFromFile: ClipboardParams["insertImageFromFile"];
53
+ openEquationDialog: (initial?: import('../../core/model.js').EditorMathExpression, targetRunId?: string) => void;
53
54
  }
54
55
  export interface EditorInteractionWiring {
55
56
  tableResize: ReturnType<typeof createEditorTableResize>;
@@ -0,0 +1,10 @@
1
+ import { JSX } from 'solid-js';
2
+ import { EditorMathExpression } from '../../../core/model.js';
3
+
4
+ export interface EquationDialogProps {
5
+ isOpen: boolean;
6
+ initial?: EditorMathExpression;
7
+ onClose: () => void;
8
+ onApply: (expression: EditorMathExpression) => void;
9
+ }
10
+ export declare function EquationDialog(props: EquationDialogProps): JSX.Element;
@@ -16,8 +16,9 @@ export interface CropResult {
16
16
  }
17
17
  /**
18
18
  * Resolves the next crop + displayed size for a crop-handle drag. `deltaX`/
19
- * `deltaY` are pointer deltas in document px (already divided by zoom). Growing
20
- * a side is bounded by that side's original crop (you cannot un-crop past the
21
- * source image).
19
+ * `deltaY` are pointer deltas in document px (already divided by zoom). The
20
+ * display dimensions follow the handle so the source image keeps its scale.
22
21
  */
23
22
  export declare function resolveCroppedImage(geometry: CropSessionGeometry, deltaX: number, deltaY: number): CropResult;
23
+ /** Moves the source image inside the fixed crop frame. */
24
+ export declare function resolveMovedImageCrop(geometry: CropSessionGeometry, deltaX: number, deltaY: number): CropResult;
@@ -0,0 +1,10 @@
1
+ import { EditorMathExpression, EditorMathNode } from '../../core/model.js';
2
+
3
+ export declare function mathDisplayText(expression: EditorMathExpression): string;
4
+ export interface MathMeasure {
5
+ width: number;
6
+ height: number;
7
+ }
8
+ export declare function measureMathExpression(expression: EditorMathExpression, fontSize: number): MathMeasure;
9
+ export declare function drawMathExpression(ctx: CanvasRenderingContext2D, expression: EditorMathExpression, x: number, baseline: number, fontSize: number, color: string): void;
10
+ export declare function mathNodeText(node: EditorMathNode): string;
@@ -0,0 +1,16 @@
1
+ import { JSX } from 'solid-js';
2
+ import { EditorImageRunData } from '../../core/model.js';
3
+
4
+ export interface ImageCropPreviewOverlayProps {
5
+ box: () => {
6
+ left: number;
7
+ top: number;
8
+ width: number;
9
+ height: number;
10
+ } | null;
11
+ image: () => EditorImageRunData | null;
12
+ src: () => string;
13
+ rotation: () => number;
14
+ }
15
+ /** Shows the uncropped source below the crop mask, as Word does while editing. */
16
+ export declare function ImageCropPreviewOverlay(props: ImageCropPreviewOverlayProps): JSX.Element;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "oasis-editor",
3
- "version": "0.0.148",
3
+ "version": "0.0.150",
4
4
  "type": "module",
5
5
  "repository": {
6
6
  "type": "git",