oasis-editor 0.0.149 → 0.0.151

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 (31) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +6 -0
  3. package/dist/{OasisEditorApp-CmqlSXEk.js → OasisEditorApp-CZNfjaj2.js} +360 -35
  4. package/dist/app/controllers/EditorCommandsController.d.ts +4 -0
  5. package/dist/app/controllers/createCropSession.d.ts +1 -0
  6. package/dist/app/controllers/useEditorImageOperations.d.ts +3 -0
  7. package/dist/assets/{importDocxWorker-CpQR2fwx.js → importDocxWorker-Ddoy1WwF.js} +1 -1
  8. package/dist/core/commands/builtinCommands.d.ts +1 -1
  9. package/dist/core/commands/image.d.ts +16 -1
  10. package/dist/core/commands/publicCommandTypes.d.ts +4 -0
  11. package/dist/core/model/index.d.ts +1 -1
  12. package/dist/core/model/types/primitives.d.ts +16 -0
  13. package/dist/export/docx/docxTypes.d.ts +3 -1
  14. package/dist/export/pdf/OasisPdfWriter.d.ts +2 -1
  15. package/dist/export/pdf/writer/PdfContentStream.d.ts +3 -1
  16. package/dist/i18n/locales/en.d.ts +8 -0
  17. package/dist/i18n/locales/pt-BR.d.ts +8 -0
  18. package/dist/{index-B7V7kbjr.js → index-DgN6KXYw.js} +547 -227
  19. package/dist/index.d.ts +1 -1
  20. package/dist/oasis-editor.css +1 -1
  21. package/dist/oasis-editor.js +1 -1
  22. package/dist/oasis-editor.umd.cjs +4 -4
  23. package/dist/plugins/internal/essentialsCapabilities.d.ts +10 -0
  24. package/dist/ui/OasisEditorEditorProps.d.ts +3 -0
  25. package/dist/ui/app/buildEditorViewProps.d.ts +1 -0
  26. package/dist/ui/app/createAppCommandsController.d.ts +8 -0
  27. package/dist/ui/app/createEditorCommandRuntime.d.ts +4 -0
  28. package/dist/ui/app/createEditorInteractionRuntime.d.ts +3 -0
  29. package/dist/ui/cropGeometry.d.ts +4 -3
  30. package/dist/ui/overlays/ImageCropPreviewOverlay.d.ts +16 -0
  31. package/package.json +2 -1
@@ -120,6 +120,16 @@ export interface EssentialsImageCapability {
120
120
  toggleCrop: () => void;
121
121
  /** Apply an aspect-ratio crop preset (e.g. "16:9", "1:1", "reset"). */
122
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;
123
133
  /** Outline of the selected image (`pic:spPr/a:ln`), or `null`. */
124
134
  getBorder: () => EditorImageBorder | null;
125
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;
@@ -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;
@@ -105,6 +105,10 @@ declare function createEditorCommandRuntimeImpl(deps: EditorCommandRuntimeDeps):
105
105
  applyImageWidthCmCommand: (cm: number) => void;
106
106
  applyImageHeightCmCommand: (cm: number) => void;
107
107
  applyImageCropAspectCommand: (preset: string) => void;
108
+ applyImageCropShapeCommand: (preset: string) => void;
109
+ applyImageCropFillCommand: () => void;
110
+ applyImageCropFitCommand: () => void;
111
+ resetImageCropCommand: () => void;
108
112
  applyImageBorderCommand: (patch: import('../../core/commands/image.js').ImageBorderPatch) => void;
109
113
  handleListTab: (direction: "indent" | "outdent") => boolean;
110
114
  handleListEnter: () => boolean;
@@ -124,6 +124,9 @@ declare function createEditorInteractionRuntimeImpl(deps: EditorInteractionRunti
124
124
  handleImageCropHandleMouseDown: (paragraphId: string, paragraphOffset: number, direction: import('../resizeGeometry.js').ResizeHandleDirection, event: MouseEvent & {
125
125
  currentTarget: HTMLElement;
126
126
  }) => void;
127
+ handleImageCropBodyMouseDown: (paragraphId: string, paragraphOffset: number, event: MouseEvent & {
128
+ currentTarget: HTMLElement;
129
+ }) => void;
127
130
  };
128
131
  textBoxOps: {
129
132
  handleTextBoxResizeHandleMouseDown: (paragraphId: string, paragraphOffset: number, direction: import('../resizeGeometry.js').ResizeHandleDirection, event: MouseEvent & {
@@ -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,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,7 @@
1
1
  {
2
2
  "name": "oasis-editor",
3
- "version": "0.0.149",
3
+ "version": "0.0.151",
4
+ "license": "MIT",
4
5
  "type": "module",
5
6
  "repository": {
6
7
  "type": "git",