oasis-editor 0.0.134 → 0.0.135
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-B2f15Gpe.js → OasisEditorApp-207_qEC4.js} +123 -29
- package/dist/app/controllers/EditorCommandsController.d.ts +2 -0
- package/dist/assets/{importDocxWorker-CCwhxVSR.js → importDocxWorker-B0cSSI12.js} +1 -1
- package/dist/core/commands/builtinCommands.d.ts +1 -1
- package/dist/core/commands/image.d.ts +15 -1
- package/dist/core/lineDash.d.ts +16 -0
- package/dist/core/model/index.d.ts +1 -1
- package/dist/core/model/types/primitives.d.ts +19 -0
- package/dist/export/docx/docxTypes.d.ts +2 -1
- package/dist/export/docx/text/drawingContainerXml.d.ts +7 -1
- package/dist/export/pdf/draw/drawImageObject.d.ts +14 -0
- package/dist/export/pdf/writer/pdfTypes.d.ts +2 -0
- package/dist/i18n/locales/en.d.ts +15 -0
- package/dist/i18n/locales/pt-BR.d.ts +15 -0
- package/dist/{index-ogn0S9F3.js → index-CaKZARyM.js} +835 -305
- package/dist/oasis-editor.css +1 -1
- package/dist/oasis-editor.js +49 -49
- package/dist/oasis-editor.umd.cjs +4 -4
- package/dist/plugins/internal/essentialsCapabilities.d.ts +6 -1
- package/dist/ui/app/createAppCommandsController.d.ts +2 -0
- package/dist/ui/app/createEditorCommandRuntime.d.ts +1 -0
- package/dist/ui/canvas/paragraph/canvasInlineImage.d.ts +1 -1
- package/dist/ui/components/Toolbar/pictureBorderPresets.d.ts +19 -0
- package/dist/ui/components/Toolbar/primitives/ColorGrids.d.ts +20 -0
- package/dist/ui/components/Toolbar/primitives/PictureBorderPicker.d.ts +37 -0
- package/dist/ui/components/Toolbar/primitives/WideMenuButton.d.ts +27 -0
- package/dist/ui/components/Toolbar/schema/items.d.ts +15 -1
- package/package.json +1 -1
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { EditorPageMargins } from '../../core/model.js';
|
|
1
|
+
import { EditorImageBorder, EditorPageMargins } from '../../core/model.js';
|
|
2
|
+
import { ImageBorderPatch } from '../../core/commands/image.js';
|
|
2
3
|
import { TextCaseMode } from '../../core/commands/text.js';
|
|
3
4
|
import { ToolbarStyleState } from '../../ui/toolbarStyleState.js';
|
|
4
5
|
import { OasisBuiltinCommand } from '../../core/commands/builtinCommands.js';
|
|
@@ -105,6 +106,10 @@ export interface EssentialsImageCapability {
|
|
|
105
106
|
toggleCrop: () => void;
|
|
106
107
|
/** Apply an aspect-ratio crop preset (e.g. "16:9", "1:1", "reset"). */
|
|
107
108
|
applyCropAspect: (preset: string) => void;
|
|
109
|
+
/** Outline of the selected image (`pic:spPr/a:ln`), or `null`. */
|
|
110
|
+
getBorder: () => EditorImageBorder | null;
|
|
111
|
+
/** Merge a partial outline edit; `{ color: null }` removes the outline. */
|
|
112
|
+
setBorder: (patch: ImageBorderPatch) => void;
|
|
108
113
|
}
|
|
109
114
|
export interface EssentialsBrowserCapability {
|
|
110
115
|
print: () => void;
|
|
@@ -72,6 +72,7 @@ declare function createAppCommandsControllerImpl(deps: AppCommandsControllerDeps
|
|
|
72
72
|
applyImageWidthCmCommand: (cm: number) => void;
|
|
73
73
|
applyImageHeightCmCommand: (cm: number) => void;
|
|
74
74
|
applyImageCropAspectCommand: (preset: string) => void;
|
|
75
|
+
applyImageBorderCommand: (patch: import('../../core/commands/image.js').ImageBorderPatch) => void;
|
|
75
76
|
handleListTab: (direction: "indent" | "outdent") => boolean;
|
|
76
77
|
handleListEnter: () => boolean;
|
|
77
78
|
handleListBoundaryBackspace: (event: KeyboardEvent & {
|
|
@@ -109,6 +110,7 @@ declare function createAppCommandsControllerImpl(deps: AppCommandsControllerDeps
|
|
|
109
110
|
applyImageWidthCmCommand: (cm: number) => void;
|
|
110
111
|
applyImageHeightCmCommand: (cm: number) => void;
|
|
111
112
|
applyImageCropAspectCommand: (preset: string) => void;
|
|
113
|
+
applyImageBorderCommand: (patch: import('../../core/commands/image.js').ImageBorderPatch) => void;
|
|
112
114
|
handleListTab: (direction: "indent" | "outdent") => boolean;
|
|
113
115
|
handleListEnter: () => boolean;
|
|
114
116
|
handleListBoundaryBackspace: (event: KeyboardEvent & {
|
|
@@ -87,6 +87,7 @@ declare function createEditorCommandRuntimeImpl(deps: EditorCommandRuntimeDeps):
|
|
|
87
87
|
applyImageWidthCmCommand: (cm: number) => void;
|
|
88
88
|
applyImageHeightCmCommand: (cm: number) => void;
|
|
89
89
|
applyImageCropAspectCommand: (preset: string) => void;
|
|
90
|
+
applyImageBorderCommand: (patch: import('../../core/commands/image.js').ImageBorderPatch) => void;
|
|
90
91
|
handleListTab: (direction: "indent" | "outdent") => boolean;
|
|
91
92
|
handleListEnter: () => boolean;
|
|
92
93
|
handleListBoundaryBackspace: (event: KeyboardEvent & {
|
|
@@ -2,7 +2,7 @@ import { EditorImageRunData, EditorLayoutLine, EditorPageSettings, EditorState }
|
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Draw an inline image fragment, honoring crop (`a:srcRect`), rotation
|
|
5
|
-
* (`a:xfrm/@rot`)
|
|
5
|
+
* (`a:xfrm/@rot`), horizontal/vertical flips and the picture outline.
|
|
6
6
|
*/
|
|
7
7
|
export declare function drawImageFragment(ctx: CanvasRenderingContext2D, img: CanvasImageSource & {
|
|
8
8
|
naturalWidth: number;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { EditorLineDash } from '../../../core/model.js';
|
|
2
|
+
import { TranslationKey } from '../../../i18n/index.js';
|
|
3
|
+
|
|
4
|
+
/** Border weights offered by Word's Picture Border ▸ Weight submenu, in points. */
|
|
5
|
+
export declare const PICTURE_BORDER_WEIGHTS_PT: number[];
|
|
6
|
+
/** `0.25` → `"¼"`, `1.5` → `"1½"`, `3` → `"3"`. */
|
|
7
|
+
export declare function formatBorderWeight(widthPt: number): string;
|
|
8
|
+
export interface PictureBorderDashOption {
|
|
9
|
+
value: EditorLineDash;
|
|
10
|
+
labelKey: TranslationKey;
|
|
11
|
+
}
|
|
12
|
+
/** Ordered as Word's Dashes flyout: shortest pattern first. */
|
|
13
|
+
export declare const PICTURE_BORDER_DASH_OPTIONS: PictureBorderDashOption[];
|
|
14
|
+
/**
|
|
15
|
+
* `stroke-dasharray` for a menu preview stroke, derived from the same point
|
|
16
|
+
* table the canvas and PDF renderers use — so a preview can never disagree with
|
|
17
|
+
* what gets painted. Solid yields `undefined` (no attribute).
|
|
18
|
+
*/
|
|
19
|
+
export declare function dashPreviewArray(dash: EditorLineDash): string | undefined;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { JSX } from 'solid-js';
|
|
2
|
+
import { ColorPalette } from '../schema/palette.js';
|
|
3
|
+
|
|
4
|
+
export interface ColorGridsProps {
|
|
5
|
+
palette: ColorPalette;
|
|
6
|
+
themeColorsLabel: string;
|
|
7
|
+
standardColorsLabel: string;
|
|
8
|
+
/** Lowercased hex of the currently applied colour, for the active ring. */
|
|
9
|
+
activeColor: string;
|
|
10
|
+
testId: string;
|
|
11
|
+
onPreview: (color: string | null) => void;
|
|
12
|
+
onPick: (color: string) => void;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* The theme-colour columns and standard-colour row shared by every colour popup
|
|
16
|
+
* (font colour, highlight, shading, picture border). Owns only the swatches —
|
|
17
|
+
* the surrounding "automatic"/"no colour" and "more colours" actions differ per
|
|
18
|
+
* consumer and stay with them.
|
|
19
|
+
*/
|
|
20
|
+
export declare function ColorGrids(props: ColorGridsProps): JSX.Element;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { JSX } from 'solid-js';
|
|
2
|
+
import { ColorPalette } from '../schema/palette.js';
|
|
3
|
+
import { EditorImageBorder, EditorLineDash } from '../../../../core/model.js';
|
|
4
|
+
import { ImageBorderPatch } from '../../../../core/commands/image.js';
|
|
5
|
+
|
|
6
|
+
export interface PictureBorderPickerProps {
|
|
7
|
+
/** The outline currently on the selected picture, or `null`. */
|
|
8
|
+
border: EditorImageBorder | null;
|
|
9
|
+
palette: ColorPalette;
|
|
10
|
+
disabled?: boolean;
|
|
11
|
+
testId: string;
|
|
12
|
+
label: string;
|
|
13
|
+
noOutlineLabel: string;
|
|
14
|
+
moreColorsLabel: string;
|
|
15
|
+
weightLabel: string;
|
|
16
|
+
dashesLabel: string;
|
|
17
|
+
themeColorsLabel: string;
|
|
18
|
+
standardColorsLabel: string;
|
|
19
|
+
/** Ordered dash presets with their translated names. */
|
|
20
|
+
dashOptions: Array<{
|
|
21
|
+
value: EditorLineDash;
|
|
22
|
+
label: string;
|
|
23
|
+
}>;
|
|
24
|
+
onApply: (patch: ImageBorderPatch) => void;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Word's Picture Border popup: theme/standard colour grids, "No Outline",
|
|
28
|
+
* "More Outline Colors…", and Weight/Dashes flyouts. Purely presentational —
|
|
29
|
+
* every action reports a partial patch, so a colour pick keeps the current
|
|
30
|
+
* weight and vice-versa.
|
|
31
|
+
*
|
|
32
|
+
* The flyouts render *inside* the popover panel rather than in their own
|
|
33
|
+
* portal: `Popover`'s dismiss watcher only knows about the trigger and the
|
|
34
|
+
* panel, so a portalled child would read as an outside click and close its own
|
|
35
|
+
* parent.
|
|
36
|
+
*/
|
|
37
|
+
export declare function PictureBorderPicker(props: PictureBorderPickerProps): JSX.Element;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { JSX } from 'solid-js';
|
|
2
|
+
|
|
3
|
+
export interface WideMenuButtonProps {
|
|
4
|
+
open: boolean;
|
|
5
|
+
onOpenChange: (open: boolean) => void;
|
|
6
|
+
icon?: string;
|
|
7
|
+
label: string;
|
|
8
|
+
tooltip?: string;
|
|
9
|
+
testId?: string;
|
|
10
|
+
active?: boolean;
|
|
11
|
+
disabled?: boolean;
|
|
12
|
+
/** A swatch strip under the icon, e.g. the current border colour. */
|
|
13
|
+
indicatorColor?: string | null;
|
|
14
|
+
panelClass?: string;
|
|
15
|
+
children: JSX.Element;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* A dropdown whose trigger lays icon, label and chevron out on a single
|
|
19
|
+
* horizontal line, sized to span a ribbon group's full height. This is the
|
|
20
|
+
* shape Word gives its Picture Border / Picture Effects / Picture Layout
|
|
21
|
+
* buttons, and it is the third trigger geometry in the toolbar — distinct from
|
|
22
|
+
* the icon-only (`normal`) and icon-above-label (`large`) `Button`s.
|
|
23
|
+
*
|
|
24
|
+
* Unlike `Menu`, no click inside the panel is intercepted: consumers own when
|
|
25
|
+
* the popup closes, which nested flyouts need.
|
|
26
|
+
*/
|
|
27
|
+
export declare function WideMenuButton(props: WideMenuButtonProps): JSX.Element;
|
|
@@ -143,6 +143,20 @@ export interface ColorPickerItem extends ToolbarItemBase {
|
|
|
143
143
|
labelKey?: TranslationKey;
|
|
144
144
|
label?: string;
|
|
145
145
|
}
|
|
146
|
+
/**
|
|
147
|
+
* Word's Picture Border control: a wide horizontal trigger over a popup that
|
|
148
|
+
* carries colour grids plus Weight/Dashes flyouts. Its own item type (rather
|
|
149
|
+
* than a `colorPicker` variant) because a border is three facets — colour,
|
|
150
|
+
* weight, dash — dispatched as partial patches of one command.
|
|
151
|
+
*/
|
|
152
|
+
export interface PictureBorderItem extends ToolbarItemBase {
|
|
153
|
+
type: "pictureBorder";
|
|
154
|
+
/** Command dispatched with an `ImageBorderPatch` payload. */
|
|
155
|
+
command: CommandRef;
|
|
156
|
+
palette?: ColorPalette;
|
|
157
|
+
labelKey?: TranslationKey;
|
|
158
|
+
label?: string;
|
|
159
|
+
}
|
|
146
160
|
export interface GridPickerItem extends ToolbarItemBase {
|
|
147
161
|
type: "gridPicker";
|
|
148
162
|
/** Command dispatched with `{ rows, cols }` as payload. */
|
|
@@ -171,5 +185,5 @@ export interface CustomItem extends ToolbarItemBase {
|
|
|
171
185
|
type: "custom";
|
|
172
186
|
render: (api: ToolbarActionApi) => JSX.Element;
|
|
173
187
|
}
|
|
174
|
-
export type ToolbarItem = ButtonItem | ToggleItem | SplitItem | MenuItem | SelectItem | StyleGalleryItem | ColorPickerItem | GridPickerItem | SeparatorItem | GroupItem | CustomItem;
|
|
188
|
+
export type ToolbarItem = ButtonItem | ToggleItem | SplitItem | MenuItem | SelectItem | StyleGalleryItem | ColorPickerItem | PictureBorderItem | GridPickerItem | SeparatorItem | GroupItem | CustomItem;
|
|
175
189
|
export type ToolbarItemType = ToolbarItem["type"];
|