oasis-editor 0.0.138 → 0.0.140
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-DMI2ZfOd.js → OasisEditorApp-vqeSS8FT.js} +71 -8
- package/dist/adapters/mountController.d.ts +11 -0
- package/dist/adapters/react.d.ts +8 -0
- package/dist/adapters/ui.d.ts +1 -1
- package/dist/adapters/vue.d.ts +10 -0
- package/dist/app/bootstrap/createOasisEditorApp.d.ts +9 -0
- package/dist/app/bootstrap/createOasisEditorContainer.d.ts +9 -0
- package/dist/app/client/OasisEditorClient.d.ts +254 -1
- package/dist/app/client/publicDocumentApi.d.ts +223 -0
- package/dist/app/controllers/documentIO/DocumentExporter.d.ts +10 -2
- package/dist/app/controllers/documentIO/DocumentImporter.d.ts +6 -0
- package/dist/app/controllers/useEditorDocumentIO.d.ts +4 -2
- package/dist/app/controllers/useEditorFindReplace.d.ts +7 -0
- package/dist/app/controllers/useEditorPersistence.d.ts +10 -0
- package/dist/app/services/FindReplaceService.d.ts +9 -0
- package/dist/app/services/indexedDbPersistence.d.ts +10 -1
- package/dist/app/services/tablePropertiesService.d.ts +12 -3
- package/dist/app/services/userPreferences.d.ts +4 -0
- package/dist/assets/{importDocxWorker-DBjcGf-C.js → importDocxWorker-B1vHeo5L.js} +1 -1
- package/dist/core/Editor.d.ts +33 -1
- package/dist/core/commands/CommandBus.d.ts +26 -0
- package/dist/core/commands/publicCommandTypes.d.ts +53 -0
- package/dist/core/model/types/document.d.ts +2 -0
- package/dist/core/plugin.d.ts +60 -0
- package/dist/import/DocumentFormatImporter.d.ts +20 -4
- package/dist/import/documentImporterRegistry.d.ts +6 -2
- package/dist/{index-M7h7REmM.js → index-C_F1o38Z.js} +1191 -760
- package/dist/index.d.ts +3 -1
- package/dist/mountController.d.ts +11 -0
- package/dist/oasis-editor.js +44 -36
- package/dist/oasis-editor.umd.cjs +4 -4
- package/dist/react.d.ts +8 -0
- package/dist/ui/OasisEditorAppProps.d.ts +8 -4
- package/dist/ui/app/connectEditorClientHost.d.ts +12 -2
- package/dist/ui/app/createEditorCommandRuntime.d.ts +8 -1
- package/dist/ui/app/createEditorDocumentRuntime.d.ts +4 -2
- package/dist/ui/app/essentials/types.d.ts +2 -2
- package/dist/ui/canvas/CanvasDebug.d.ts +15 -1
- package/dist/ui/components/Menubar/menuRegistry.d.ts +11 -0
- package/dist/ui/components/Toolbar/registry/ToolbarRegistry.d.ts +43 -7
- package/dist/ui/components/Toolbar/schema/items.d.ts +39 -7
- package/dist/ui/components/Toolbar/state/createToolbarApi.d.ts +8 -4
- package/dist/ui.d.ts +1 -1
- package/dist/ui.js +29 -30
- package/dist/vue.d.ts +10 -0
- package/package.json +2 -1
package/dist/react.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
2
|
import { OasisEditorAppProps, OasisEditorClient } from '../index.ts';
|
|
3
3
|
|
|
4
|
+
/** Props for the React adapter component, extending the standard editor app props. */
|
|
4
5
|
export type ReactOasisEditorProps = OasisEditorAppProps & {
|
|
5
6
|
/**
|
|
6
7
|
* Receives the mounted Oasis client. Props are mount-only for this adapter;
|
|
@@ -8,4 +9,11 @@ export type ReactOasisEditorProps = OasisEditorAppProps & {
|
|
|
8
9
|
*/
|
|
9
10
|
onClient?: (client: OasisEditorClient) => void;
|
|
10
11
|
};
|
|
12
|
+
/**
|
|
13
|
+
* React component that mounts the Oasis editor. Mount-only — remount to
|
|
14
|
+
* apply a new configuration.
|
|
15
|
+
*
|
|
16
|
+
* @param props - The editor configuration props.
|
|
17
|
+
* @returns A React element wrapping the editor.
|
|
18
|
+
*/
|
|
11
19
|
export declare const OasisEditor: React.FC<ReactOasisEditorProps>;
|
|
@@ -6,15 +6,18 @@ import { DocumentPersistence } from '../app/controllers/useEditorPersistence.js'
|
|
|
6
6
|
import { OasisPlugin } from '../core/plugin.js';
|
|
7
7
|
import { OasisEditorClient, OasisEditorClientController } from '../app/client/OasisEditorClient.js';
|
|
8
8
|
|
|
9
|
+
/** Toolbar display mode. */
|
|
9
10
|
export type ToolbarViewMode = "ribbon" | "compact";
|
|
11
|
+
/** Toolbar overflow behavior. */
|
|
10
12
|
export type ToolbarLayoutMode = "overflow" | "wrap";
|
|
13
|
+
/** Options for the loading overlay shown during editor startup. */
|
|
11
14
|
export interface OasisEditorLoadingOptions {
|
|
12
15
|
label?: string;
|
|
13
16
|
class?: string;
|
|
14
17
|
style?: JSX.CSSProperties;
|
|
15
18
|
}
|
|
19
|
+
/** UI configuration properties for the editor app. */
|
|
16
20
|
export interface OasisEditorAppUiProps {
|
|
17
|
-
/** Visual chrome palette. Defaults to light to preserve existing embeds. */
|
|
18
21
|
theme?: "light" | "dark";
|
|
19
22
|
showChrome?: boolean;
|
|
20
23
|
shell?: "document" | "inline" | "balloon";
|
|
@@ -33,10 +36,10 @@ export interface OasisEditorAppUiProps {
|
|
|
33
36
|
style?: JSX.CSSProperties;
|
|
34
37
|
loading?: boolean | OasisEditorLoadingOptions;
|
|
35
38
|
}
|
|
39
|
+
/** Document-related configuration properties for the editor app. */
|
|
36
40
|
export interface OasisEditorAppDocumentProps {
|
|
37
41
|
initialDocument?: EditorDocument;
|
|
38
42
|
initialState?: EditorState;
|
|
39
|
-
/** Load otherwise unavailable document fonts from Google Fonts/CDNFonts. */
|
|
40
43
|
remoteWebFonts?: boolean;
|
|
41
44
|
onStateChange?: (state: EditorState) => void;
|
|
42
45
|
readOnly?: boolean;
|
|
@@ -49,6 +52,7 @@ export interface OasisEditorAppDocumentProps {
|
|
|
49
52
|
*/
|
|
50
53
|
persistenceKey?: string;
|
|
51
54
|
}
|
|
55
|
+
/** Runtime configuration properties for the editor app (plugins, customization). */
|
|
52
56
|
export interface OasisEditorAppRuntimeProps {
|
|
53
57
|
onReady?: (client: OasisEditorClient) => void;
|
|
54
58
|
plugins?: OasisPlugin[];
|
|
@@ -56,12 +60,12 @@ export interface OasisEditorAppRuntimeProps {
|
|
|
56
60
|
client?: OasisEditorClientController;
|
|
57
61
|
/**
|
|
58
62
|
* Customize the toolbar after the built-in preset and plugin contributions
|
|
59
|
-
* load. Use the registry to add/insert/replace/remove/move items.
|
|
60
|
-
* tailor the toolbar without forking.
|
|
63
|
+
* load. Use the registry to add/insert/replace/remove/move items.
|
|
61
64
|
*/
|
|
62
65
|
customizeToolbar?: (registry: ToolbarRegistry) => void;
|
|
63
66
|
customizeMenubar?: (registry: MenuRegistry) => void;
|
|
64
67
|
}
|
|
68
|
+
/** Top-level configuration props for the Oasis editor application. */
|
|
65
69
|
export interface OasisEditorAppProps {
|
|
66
70
|
ui?: OasisEditorAppUiProps;
|
|
67
71
|
document?: OasisEditorAppDocumentProps;
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { EditorDocument, EditorState } from '../../core/model.js';
|
|
2
|
-
import { OasisEditorClientController } from '../../app/client/OasisEditorClient.js';
|
|
2
|
+
import { OasisEditorClientController, OasisEditorUiState } from '../../app/client/OasisEditorClient.js';
|
|
3
3
|
import { createEditorDocumentIO } from '../../app/controllers/useEditorDocumentIO.js';
|
|
4
4
|
import { useEditorRuntimeBootstrap } from './useEditorRuntimeBootstrap.js';
|
|
5
|
+
import { ToolbarRegistry } from '../components/Toolbar/registry/ToolbarRegistry.js';
|
|
6
|
+
import { MenuRegistry } from '../components/Menubar/menuRegistry.js';
|
|
5
7
|
|
|
6
8
|
type RuntimeEditorAccessor = ReturnType<typeof useEditorRuntimeBootstrap>["runtimeEditor"];
|
|
7
9
|
type EditorDocumentIO = ReturnType<typeof createEditorDocumentIO>;
|
|
@@ -11,14 +13,22 @@ export interface ConnectEditorClientHostDeps {
|
|
|
11
13
|
getStateSnapshot: () => EditorState;
|
|
12
14
|
cloneState: (state: EditorState) => EditorState;
|
|
13
15
|
applyState: (next: EditorState) => void;
|
|
16
|
+
applyTransactionalState?: (producer: (state: EditorState) => EditorState) => void;
|
|
14
17
|
resetEditorChromeState: () => void;
|
|
15
18
|
focusInput: () => void;
|
|
16
19
|
setFocused: (focused: boolean) => void;
|
|
17
20
|
clearHistory: () => void;
|
|
21
|
+
getUiState?: () => OasisEditorUiState;
|
|
22
|
+
updateUiState?: (patch: OasisEditorUiState) => OasisEditorUiState;
|
|
23
|
+
getZoom?: () => number;
|
|
24
|
+
setZoom?: (value: number) => void;
|
|
25
|
+
adjustZoom?: (delta: number) => void;
|
|
26
|
+
toolbarRegistry?: ToolbarRegistry;
|
|
27
|
+
menuRegistry?: MenuRegistry;
|
|
18
28
|
getPersistence: () => {
|
|
19
29
|
saveDocument: (document: EditorDocument) => Promise<void> | void;
|
|
20
30
|
};
|
|
21
|
-
docIO: Pick<EditorDocumentIO, "handleImportFile" | "handleExportDocx" | "handleExportPdf">;
|
|
31
|
+
docIO: Pick<EditorDocumentIO, "handleImportFile" | "handleExportDocx" | "handleExportPdf" | "exportDocxBlob" | "exportPdfBlob">;
|
|
22
32
|
}
|
|
23
33
|
/**
|
|
24
34
|
* Wires the imperative `OasisEditorClient` host surface (get/set document,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { BooleanStyleKey } from '../toolbarStyleState.js';
|
|
2
2
|
import { EditorState } from '../../core/model.js';
|
|
3
3
|
import { EditorLogger } from '../../utils/logger.js';
|
|
4
|
-
import { OasisEditorClientController } from '../../app/client/OasisEditorClient.js';
|
|
4
|
+
import { OasisEditorClientController, OasisEditorUiState } from '../../app/client/OasisEditorClient.js';
|
|
5
5
|
import { TranslateFn } from '../../i18n/index.js';
|
|
6
6
|
import { createEditorDocumentRuntime } from './createEditorDocumentRuntime.js';
|
|
7
7
|
import { createEditorInteractionRuntime } from './createEditorInteractionRuntime.js';
|
|
@@ -45,6 +45,13 @@ export interface EditorCommandRuntimeDeps {
|
|
|
45
45
|
isOpen: boolean;
|
|
46
46
|
initialCaption: string;
|
|
47
47
|
}) => void;
|
|
48
|
+
getUiState: () => OasisEditorUiState;
|
|
49
|
+
updateUiState: (patch: OasisEditorUiState) => OasisEditorUiState;
|
|
50
|
+
zoom: {
|
|
51
|
+
zoomPercent: () => number;
|
|
52
|
+
setZoomPercent: (value: number) => void;
|
|
53
|
+
adjustZoom: (delta: number) => void;
|
|
54
|
+
};
|
|
48
55
|
}
|
|
49
56
|
/**
|
|
50
57
|
* Phase C of the editor runtime: the command controller, the public runtime
|
|
@@ -43,8 +43,10 @@ declare function createEditorDocumentRuntimeImpl(deps: EditorDocumentRuntimeDeps
|
|
|
43
43
|
docIO: {
|
|
44
44
|
importProgress: import('solid-js').Accessor<import('../../app/controllers/useEditorDocumentIO.js').ImportProgressState | null>;
|
|
45
45
|
handleImportFile: (file: File | null) => Promise<void>;
|
|
46
|
-
handleExportDocx: () => Promise<
|
|
47
|
-
handleExportPdf: () => Promise<
|
|
46
|
+
handleExportDocx: () => Promise<Blob>;
|
|
47
|
+
handleExportPdf: () => Promise<Blob>;
|
|
48
|
+
exportDocxBlob: () => Promise<Blob>;
|
|
49
|
+
exportPdfBlob: () => Promise<Blob>;
|
|
48
50
|
insertImageFromFile: (file: File, position?: import('../../core/model.js').EditorPosition | null) => Promise<void>;
|
|
49
51
|
handleInsertImage: (file: File | null) => Promise<void>;
|
|
50
52
|
};
|
|
@@ -23,8 +23,8 @@ export interface CreateEditorEssentialsPluginOptions {
|
|
|
23
23
|
styleController: ReturnType<typeof createEditorStyleController>;
|
|
24
24
|
tableOps: ReturnType<typeof createEditorTableOperations>;
|
|
25
25
|
docIO: {
|
|
26
|
-
handleExportDocx: () => Promise<
|
|
27
|
-
handleExportPdf: () => Promise<
|
|
26
|
+
handleExportDocx: () => Promise<Blob>;
|
|
27
|
+
handleExportPdf: () => Promise<Blob>;
|
|
28
28
|
};
|
|
29
29
|
importInputRef: () => HTMLInputElement | undefined;
|
|
30
30
|
imageInputRef: () => HTMLInputElement | undefined;
|
|
@@ -2,12 +2,14 @@ import { SurfaceHit } from './CanvasHitTestService.js';
|
|
|
2
2
|
import { CanvasLayoutSnapshot, CanvasSnapshotParagraph } from './CanvasLayoutSnapshot.js';
|
|
3
3
|
import { EditorEditingZone, EditorState } from '../../core/model.js';
|
|
4
4
|
|
|
5
|
+
/** Records a canvas hit-test miss for debugging purposes. */
|
|
5
6
|
export interface CanvasDebugMissEvent {
|
|
6
7
|
timestamp: number;
|
|
7
8
|
reason: string;
|
|
8
9
|
clientX: number;
|
|
9
10
|
clientY: number;
|
|
10
11
|
}
|
|
12
|
+
/** Snapshot of a single canvas hit-test result. */
|
|
11
13
|
export interface CanvasDebugHitSnapshot {
|
|
12
14
|
timestamp: number;
|
|
13
15
|
zone: SurfaceHit["zone"];
|
|
@@ -17,6 +19,7 @@ export interface CanvasDebugHitSnapshot {
|
|
|
17
19
|
missReason?: string;
|
|
18
20
|
resolvedFromParagraph: boolean;
|
|
19
21
|
}
|
|
22
|
+
/** Debug snapshot of the full canvas layout. */
|
|
20
23
|
export interface CanvasDebugLayoutSnapshot {
|
|
21
24
|
surfaceRect: {
|
|
22
25
|
left: number;
|
|
@@ -66,7 +69,6 @@ export interface CanvasDebugLayoutSnapshot {
|
|
|
66
69
|
width: number;
|
|
67
70
|
height: number;
|
|
68
71
|
};
|
|
69
|
-
/** Set when the paragraph/cell is painted with a vertical-text transform. */
|
|
70
72
|
verticalMode?: CanvasSnapshotParagraph["verticalMode"];
|
|
71
73
|
}>;
|
|
72
74
|
inlineImages: Array<{
|
|
@@ -104,11 +106,17 @@ export interface CanvasDebugLayoutSnapshot {
|
|
|
104
106
|
reason: string;
|
|
105
107
|
}>;
|
|
106
108
|
}
|
|
109
|
+
/** Debug API for inspecting canvas hit-testing and layout, exposed on `window.__oasisCanvasDebug`. */
|
|
107
110
|
export interface OasisCanvasDebugApi {
|
|
111
|
+
/** @returns The most recent hit-test result, or null. */
|
|
108
112
|
getLastHit: () => CanvasDebugHitSnapshot | null;
|
|
113
|
+
/** @returns A snapshot of the current layout, or null. */
|
|
109
114
|
getLayoutSnapshot: () => CanvasDebugLayoutSnapshot | null;
|
|
115
|
+
/** @returns A snapshot of the current selection, or null. */
|
|
110
116
|
getSelection: () => CanvasDebugSelectionSnapshot | null;
|
|
117
|
+
/** @returns All recorded miss events. */
|
|
111
118
|
getMissEvents: () => CanvasDebugMissEvent[];
|
|
119
|
+
/** Clears all recorded miss events. */
|
|
112
120
|
clearMissEvents: () => void;
|
|
113
121
|
}
|
|
114
122
|
declare global {
|
|
@@ -116,6 +124,7 @@ declare global {
|
|
|
116
124
|
__oasisCanvasDebug?: OasisCanvasDebugApi;
|
|
117
125
|
}
|
|
118
126
|
}
|
|
127
|
+
/** Debug snapshot of the editor selection state. */
|
|
119
128
|
export interface CanvasDebugSelectionSnapshot {
|
|
120
129
|
anchor: {
|
|
121
130
|
paragraphId: string;
|
|
@@ -130,10 +139,15 @@ export interface CanvasDebugSelectionSnapshot {
|
|
|
130
139
|
activeZone: EditorEditingZone;
|
|
131
140
|
activeSectionIndex: number;
|
|
132
141
|
}
|
|
142
|
+
/** Synchronizes visibility of the canvas debug API on `window.__oasisCanvasDebug`. */
|
|
133
143
|
export declare function syncCanvasDebugApiVisibility(): void;
|
|
144
|
+
/** Records a canvas hit-test result for debugging. */
|
|
134
145
|
export declare function recordCanvasDebugHit(hit: SurfaceHit | null): void;
|
|
146
|
+
/** Records a layout snapshot for canvas debugging. */
|
|
135
147
|
export declare function recordCanvasDebugLayoutSnapshot(snapshot: CanvasLayoutSnapshot | null): void;
|
|
148
|
+
/** Records the current selection state for canvas debugging. */
|
|
136
149
|
export declare function recordCanvasDebugSelection(state: EditorState): void;
|
|
150
|
+
/** Records a canvas hit-test miss event for debugging. */
|
|
137
151
|
export declare function recordCanvasDebugMissEvent(reason: string, details: {
|
|
138
152
|
clientX: number;
|
|
139
153
|
clientY: number;
|
|
@@ -7,6 +7,7 @@ import { ToolbarCommandState } from '../Toolbar/schema/items.js';
|
|
|
7
7
|
export interface MenubarHost {
|
|
8
8
|
commands: CommandBus<ToolbarCommandState>;
|
|
9
9
|
}
|
|
10
|
+
/** Descriptor for a single menu item in the menubar. */
|
|
10
11
|
export interface MenuItem {
|
|
11
12
|
id: string;
|
|
12
13
|
path: string;
|
|
@@ -19,9 +20,19 @@ export interface MenuItem {
|
|
|
19
20
|
separator?: boolean;
|
|
20
21
|
hidden?: boolean;
|
|
21
22
|
}
|
|
23
|
+
/** Registry for managing menubar items with registration, update, and query. */
|
|
22
24
|
export declare class MenuRegistry {
|
|
23
25
|
private items;
|
|
26
|
+
/**
|
|
27
|
+
* Registers or updates a menu item by id.
|
|
28
|
+
* @param item - The menu item to register.
|
|
29
|
+
*/
|
|
24
30
|
register(item: MenuItem): void;
|
|
31
|
+
/**
|
|
32
|
+
* Removes a menu item by id.
|
|
33
|
+
* @param id - The id of the item to remove.
|
|
34
|
+
*/
|
|
25
35
|
unregister(id: string): void;
|
|
36
|
+
/** @returns A copy of all registered menu items. */
|
|
26
37
|
getItems(): MenuItem[];
|
|
27
38
|
}
|
|
@@ -1,28 +1,64 @@
|
|
|
1
1
|
import { ToolbarItem } from '../schema/items.js';
|
|
2
2
|
|
|
3
|
+
/** Target for moving a toolbar item: an absolute index or relative to another item. */
|
|
3
4
|
export type ToolbarMoveTarget = number | {
|
|
4
5
|
before: string;
|
|
5
6
|
} | {
|
|
6
7
|
after: string;
|
|
7
8
|
};
|
|
9
|
+
/** Registry for managing toolbar items with positional insertion and mutation subscriptions. */
|
|
8
10
|
export interface ToolbarRegistry {
|
|
9
|
-
/**
|
|
11
|
+
/**
|
|
12
|
+
* Add or update by id (last-write-wins). New items append, then sort by `order`.
|
|
13
|
+
* @param item - The toolbar item to register.
|
|
14
|
+
*/
|
|
10
15
|
register(item: ToolbarItem): void;
|
|
11
|
-
/**
|
|
16
|
+
/**
|
|
17
|
+
* Insert positionally before an existing item.
|
|
18
|
+
* @param targetId - The id of the existing item.
|
|
19
|
+
* @param item - The item to insert.
|
|
20
|
+
*/
|
|
12
21
|
insertBefore(targetId: string, item: ToolbarItem): void;
|
|
13
|
-
/**
|
|
22
|
+
/**
|
|
23
|
+
* Insert positionally after an existing item.
|
|
24
|
+
* @param targetId - The id of the existing item.
|
|
25
|
+
* @param item - The item to insert.
|
|
26
|
+
*/
|
|
14
27
|
insertAfter(targetId: string, item: ToolbarItem): void;
|
|
15
|
-
/**
|
|
28
|
+
/**
|
|
29
|
+
* Replace an existing item in place, preserving its position.
|
|
30
|
+
* @param targetId - The id of the item to replace.
|
|
31
|
+
* @param item - The replacement item.
|
|
32
|
+
*/
|
|
16
33
|
replace(targetId: string, item: ToolbarItem): void;
|
|
34
|
+
/**
|
|
35
|
+
* Removes an item by id.
|
|
36
|
+
* @param id - The id of the item to remove.
|
|
37
|
+
*/
|
|
17
38
|
remove(id: string): void;
|
|
18
|
-
/**
|
|
39
|
+
/**
|
|
40
|
+
* Move an existing item to an absolute index or relative to another item.
|
|
41
|
+
* @param id - The id of the item to move.
|
|
42
|
+
* @param target - The target position.
|
|
43
|
+
*/
|
|
19
44
|
move(id: string, target: ToolbarMoveTarget): void;
|
|
45
|
+
/**
|
|
46
|
+
* @param id - The item id.
|
|
47
|
+
* @returns The item, or undefined.
|
|
48
|
+
*/
|
|
20
49
|
get(id: string): ToolbarItem | undefined;
|
|
50
|
+
/** @returns All items in display order. */
|
|
21
51
|
getOrdered(): ToolbarItem[];
|
|
22
|
-
/** Backward-friendly alias for getOrdered. */
|
|
52
|
+
/** Backward-friendly alias for {@link getOrdered}. */
|
|
23
53
|
getItems(): ToolbarItem[];
|
|
54
|
+
/** Removes all items. */
|
|
24
55
|
clear(): void;
|
|
25
|
-
/**
|
|
56
|
+
/**
|
|
57
|
+
* Subscribe to mutations.
|
|
58
|
+
* @param callback - The callback invoked on mutation.
|
|
59
|
+
* @returns An unsubscribe function.
|
|
60
|
+
*/
|
|
26
61
|
onChange(callback: () => void): () => void;
|
|
27
62
|
}
|
|
63
|
+
/** Creates a new, empty toolbar registry. */
|
|
28
64
|
export declare function createToolbarRegistry(): ToolbarRegistry;
|
|
@@ -39,22 +39,39 @@ export interface ToolbarDocumentStyle {
|
|
|
39
39
|
headerColor?: string;
|
|
40
40
|
};
|
|
41
41
|
}
|
|
42
|
-
/**
|
|
43
|
-
* Narrow surface every toolbar item depends on (DIP/ISP). Items only dispatch
|
|
44
|
-
* and observe commands — they never touch editor internals or `EditorState`.
|
|
45
|
-
* Even option-list data (e.g. document styles) arrives via `commandState`.
|
|
46
|
-
*/
|
|
42
|
+
/** Narrow surface every toolbar item depends on. Items only dispatch and observe commands. */
|
|
47
43
|
export interface ToolbarActionApi {
|
|
48
44
|
commands: CommandBus<ToolbarCommandState>;
|
|
45
|
+
/**
|
|
46
|
+
* @param key - The translation key.
|
|
47
|
+
* @param params - Optional interpolation parameters.
|
|
48
|
+
* @returns The translated string.
|
|
49
|
+
*/
|
|
49
50
|
t(key: TranslationKey, params?: unknown[]): string;
|
|
50
51
|
focusEditor(): void;
|
|
51
52
|
}
|
|
52
53
|
/** Per-item reactive overrides. All optional; default to command-derived. */
|
|
53
54
|
export interface ItemReactiveOverrides {
|
|
55
|
+
/**
|
|
56
|
+
* @param api - The toolbar action API.
|
|
57
|
+
* @returns Whether the item is active.
|
|
58
|
+
*/
|
|
54
59
|
isActive?: (api: ToolbarActionApi) => boolean;
|
|
60
|
+
/**
|
|
61
|
+
* @param api - The toolbar action API.
|
|
62
|
+
* @returns Whether the item is disabled.
|
|
63
|
+
*/
|
|
55
64
|
isDisabled?: (api: ToolbarActionApi) => boolean;
|
|
65
|
+
/**
|
|
66
|
+
* @param api - The toolbar action API.
|
|
67
|
+
* @returns The reactive value override.
|
|
68
|
+
*/
|
|
56
69
|
value?: (api: ToolbarActionApi) => unknown;
|
|
57
|
-
/**
|
|
70
|
+
/**
|
|
71
|
+
* Contextual visibility — item stays mounted; the renderer toggles display.
|
|
72
|
+
* @param api - The toolbar action API.
|
|
73
|
+
* @returns Whether the item should be visible.
|
|
74
|
+
*/
|
|
58
75
|
isVisible?: (api: ToolbarActionApi) => boolean;
|
|
59
76
|
}
|
|
60
77
|
interface ToolbarItemBase extends ItemReactiveOverrides {
|
|
@@ -125,6 +142,10 @@ export interface SelectItem extends ToolbarItemBase {
|
|
|
125
142
|
type: "select";
|
|
126
143
|
/** Command dispatched with the chosen value as payload. */
|
|
127
144
|
command: CommandRef;
|
|
145
|
+
/**
|
|
146
|
+
* @param api - The toolbar action API.
|
|
147
|
+
* @returns The list of selectable options.
|
|
148
|
+
*/
|
|
128
149
|
options: (api: ToolbarActionApi) => SelectOption[];
|
|
129
150
|
/** Leading "empty" option label, if any (e.g. font placeholder). */
|
|
130
151
|
placeholder?: string;
|
|
@@ -135,7 +156,10 @@ export interface SelectItem extends ToolbarItemBase {
|
|
|
135
156
|
}
|
|
136
157
|
export interface StyleGalleryItem extends ToolbarItemBase {
|
|
137
158
|
type: "styleGallery";
|
|
138
|
-
/**
|
|
159
|
+
/**
|
|
160
|
+
* @param api - The toolbar action API.
|
|
161
|
+
* @returns Reactive descriptors supplied through the command-state boundary.
|
|
162
|
+
*/
|
|
139
163
|
styles: (api: ToolbarActionApi) => ToolbarDocumentStyle[];
|
|
140
164
|
paragraphCommand: CommandRef;
|
|
141
165
|
characterCommand: CommandRef;
|
|
@@ -183,6 +207,10 @@ export interface SeparatorItem {
|
|
|
183
207
|
group?: string;
|
|
184
208
|
row?: RibbonRow;
|
|
185
209
|
ribbonGroupResize?: RibbonGroupResizePolicy;
|
|
210
|
+
/**
|
|
211
|
+
* @param api - The toolbar action API.
|
|
212
|
+
* @returns Whether the separator should be visible.
|
|
213
|
+
*/
|
|
186
214
|
isVisible?: (api: ToolbarActionApi) => boolean;
|
|
187
215
|
}
|
|
188
216
|
export interface GroupItem extends ToolbarItemBase {
|
|
@@ -191,6 +219,10 @@ export interface GroupItem extends ToolbarItemBase {
|
|
|
191
219
|
}
|
|
192
220
|
export interface CustomItem extends ToolbarItemBase {
|
|
193
221
|
type: "custom";
|
|
222
|
+
/**
|
|
223
|
+
* @param api - The toolbar action API.
|
|
224
|
+
* @returns The rendered JSX element.
|
|
225
|
+
*/
|
|
194
226
|
render: (api: ToolbarActionApi) => JSX.Element;
|
|
195
227
|
}
|
|
196
228
|
export type ToolbarItem = ButtonItem | ToggleItem | SplitItem | MenuItem | SelectItem | StyleGalleryItem | ColorPickerItem | PictureBorderItem | GridPickerItem | SeparatorItem | GroupItem | CustomItem;
|
|
@@ -3,13 +3,17 @@ import { CommandBus } from '../../../../core/commands/CommandBus.js';
|
|
|
3
3
|
import { ToolbarActionApi, ToolbarCommandState } from '../schema/items.js';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
|
-
* Narrow host the toolbar needs from its embedding editor:
|
|
7
|
-
*
|
|
8
|
-
* There is no god context and no out-of-band editor read.
|
|
6
|
+
* Narrow host the toolbar needs from its embedding editor: the command registry
|
|
7
|
+
* and focus. There is no god context and no out-of-band editor read.
|
|
9
8
|
*/
|
|
10
9
|
export interface ToolbarHost {
|
|
11
10
|
commands: CommandBus<ToolbarCommandState>;
|
|
12
11
|
focusEditor(): void;
|
|
13
12
|
}
|
|
14
|
-
/**
|
|
13
|
+
/**
|
|
14
|
+
* Builds the {@link ToolbarActionApi} from the narrow {@link ToolbarHost}.
|
|
15
|
+
* @param host - A function returning the current toolbar host.
|
|
16
|
+
* @param t - The translation function.
|
|
17
|
+
* @returns A new ToolbarActionApi.
|
|
18
|
+
*/
|
|
15
19
|
export declare function createToolbarApi(host: () => ToolbarHost, t: TranslateFn): ToolbarActionApi;
|
package/dist/ui.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { Button, Checkbox, ColorField, ColorPicker, ColorPicker as ToolbarColorPicker, Dialog, DialogFooter, FieldGroup, FieldRow, FloatingActionButton, FormField, Grid, GridPicker, Heading, IconButton, Menu, NumberField, Popover, Radio, RadioGroup, Select, SelectField, Separator, SidePanel, SidePanelBody, SidePanelFooter, SidePanelHeader, SplitButton, Stack, StatusText, SurfaceButton, Tabs, Text, TextAreaField, TextField, ToolbarButton, ToggleChip, } from '../index.ts';
|
|
2
2
|
export type { ActionRowProps, ButtonProps, CheckboxProps, ColorFieldProps, ColorPickerKind, ColorPickerProps, DialogFooterProps, DialogProps, FieldGroupProps, FieldRowProps, FloatingActionButtonProps, FormFieldProps, GridOffset, GridPickerProps, GridProps, GridSize, HeadingProps, IconButtonProps, MenuProps, NumberFieldProps, PopoverProps, PopoverTriggerApi, RadioGroupOption, RadioGroupProps, RadioProps, ResponsiveValue, SelectFieldOption, SelectFieldProps, SeparatorProps, SidePanelProps, SidePanelSectionProps, SplitButtonProps, StackProps, StatusTextProps, SurfaceButtonProps, TabsItem, TabsProps, TextAreaFieldProps, TextProps, TextFieldProps, ToolbarButtonProps, ToolbarSelectProps, ToggleChipProps, } from '../index.ts';
|
package/dist/ui.js
CHANGED
|
@@ -1,41 +1,40 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Button as t, Checkbox as i, ColorField as r, ColorPicker as l, Dialog as a, DialogFooter as d, FieldGroup as n, FieldRow as u, FloatingActionButton as F, FormField as c, Grid as S, GridPicker as P, Heading as T, IconButton as p, Menu as B, NumberField as g, Popover as k, Radio as x, RadioGroup as C, Select as b, SelectField as G, Separator as m, SidePanel as s, SidePanelBody as R, SidePanelFooter as f, SidePanelHeader as h, SplitButton as A, Stack as D, StatusText as H, SurfaceButton as v, Tabs as w, Text as y, TextAreaField as I, TextField as M, ToggleChip as N, ToolbarButton as j, ColorPicker as q } from "oasis-editor";
|
|
2
2
|
export {
|
|
3
|
-
t as
|
|
4
|
-
i as
|
|
5
|
-
r as
|
|
6
|
-
l as
|
|
7
|
-
a as
|
|
8
|
-
d as
|
|
9
|
-
n as
|
|
10
|
-
c as FieldGroup,
|
|
3
|
+
t as Button,
|
|
4
|
+
i as Checkbox,
|
|
5
|
+
r as ColorField,
|
|
6
|
+
l as ColorPicker,
|
|
7
|
+
a as Dialog,
|
|
8
|
+
d as DialogFooter,
|
|
9
|
+
n as FieldGroup,
|
|
11
10
|
u as FieldRow,
|
|
12
11
|
F as FloatingActionButton,
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
12
|
+
c as FormField,
|
|
13
|
+
S as Grid,
|
|
14
|
+
P as GridPicker,
|
|
15
|
+
T as Heading,
|
|
16
|
+
p as IconButton,
|
|
17
|
+
B as Menu,
|
|
18
|
+
g as NumberField,
|
|
19
|
+
k as Popover,
|
|
20
|
+
x as Radio,
|
|
21
|
+
C as RadioGroup,
|
|
22
|
+
b as Select,
|
|
23
|
+
G as SelectField,
|
|
25
24
|
m as Separator,
|
|
26
25
|
s as SidePanel,
|
|
27
|
-
|
|
26
|
+
R as SidePanelBody,
|
|
28
27
|
f as SidePanelFooter,
|
|
29
28
|
h as SidePanelHeader,
|
|
30
|
-
|
|
29
|
+
A as SplitButton,
|
|
31
30
|
D as Stack,
|
|
32
31
|
H as StatusText,
|
|
33
32
|
v as SurfaceButton,
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
33
|
+
w as Tabs,
|
|
34
|
+
y as Text,
|
|
35
|
+
I as TextAreaField,
|
|
36
|
+
M as TextField,
|
|
37
|
+
N as ToggleChip,
|
|
38
|
+
j as ToolbarButton,
|
|
39
|
+
q as ToolbarColorPicker
|
|
41
40
|
};
|
package/dist/vue.d.ts
CHANGED
|
@@ -1,6 +1,16 @@
|
|
|
1
1
|
import { VNode, RendererNode, RendererElement, PropType } from 'vue';
|
|
2
2
|
import { OasisEditorAppProps, OasisEditorClient } from '../index.ts';
|
|
3
3
|
|
|
4
|
+
/**
|
|
5
|
+
* Vue 3 component that mounts the Oasis editor. Mount-only — remount to
|
|
6
|
+
* apply a new configuration.
|
|
7
|
+
*
|
|
8
|
+
* @component
|
|
9
|
+
* @param props.config - Editor configuration props.
|
|
10
|
+
* @param props.class - CSS class for the container.
|
|
11
|
+
* @param props.style - CSS style for the container.
|
|
12
|
+
* @param props.onClient - Callback receiving the mounted client.
|
|
13
|
+
*/
|
|
4
14
|
export declare const OasisEditor: import('vue').DefineComponent<import('vue').ExtractPropTypes<{
|
|
5
15
|
config: {
|
|
6
16
|
type: () => OasisEditorAppProps;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "oasis-editor",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.140",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -53,6 +53,7 @@
|
|
|
53
53
|
"prepack": "npm run build:lib",
|
|
54
54
|
"preview": "vite preview",
|
|
55
55
|
"test:perf": "playwright test",
|
|
56
|
+
"test:smoke": "playwright test --config playwright.smoke.config.ts",
|
|
56
57
|
"wasm:build": "wasm-pack build ./rust-core --target web --out-dir ../public/wasm",
|
|
57
58
|
"dev:rust": "npm run wasm:build && vite",
|
|
58
59
|
"build:all": "npm run wasm:build && npm run build",
|