oasis-editor 0.0.31 → 0.0.33

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.
@@ -38,6 +38,12 @@ export interface OasisEditorAppDocumentProps {
38
38
  readOnly?: boolean;
39
39
  persistenceEnabled?: boolean;
40
40
  persistence?: DocumentPersistence;
41
+ /**
42
+ * Storage key for the built-in IndexedDB persistence. Two editors on the same
43
+ * page must use distinct keys to avoid overwriting each other's document.
44
+ * Ignored when a custom `persistence` is provided.
45
+ */
46
+ persistenceKey?: string;
41
47
  }
42
48
  export interface OasisEditorAppRuntimeProps {
43
49
  onReady?: (client: OasisEditorClient) => void;
@@ -1,4 +1,5 @@
1
1
  import { EditorState } from '../../core/model.js';
2
+ import { TranslateFn } from '../../i18n/index.js';
2
3
  import { ContextMenuItem } from '../components/ContextMenu/ContextMenu.js';
3
4
  import { EditorLogger } from '../../utils/logger.js';
4
5
 
@@ -10,6 +11,7 @@ interface ContextMenuState {
10
11
  export interface EditorContextMenuClipboardDeps {
11
12
  state: () => EditorState;
12
13
  isReadOnly: () => boolean;
14
+ t: TranslateFn;
13
15
  logger: EditorLogger;
14
16
  setContextMenu: (state: ContextMenuState) => void;
15
17
  clearPreferredColumn: () => void;
@@ -15,6 +15,7 @@ type RuntimeCommandHost = ReturnType<typeof createRuntimeCommandHost>;
15
15
  export interface EditorRuntimeBootstrapContext {
16
16
  essentials: EssentialsPluginDeps;
17
17
  externalPlugins: RuntimePluginsConfig["externalPlugins"];
18
+ t: RuntimePluginsConfig["t"];
18
19
  customizeToolbar: RuntimePluginsConfig["customizeToolbar"];
19
20
  customizeMenubar: RuntimePluginsConfig["customizeMenubar"];
20
21
  initialDocument: RuntimeCommandHostConfig["initialDocument"];
@@ -1,10 +1,12 @@
1
1
  import { OasisPlugin } from '../../core/plugin.js';
2
+ import { TranslateFn } from '../../i18n/index.js';
2
3
  import { MenuRegistry } from '../components/Menubar/menuRegistry.js';
3
4
  import { ToolbarRegistry } from '../components/Toolbar/registry/ToolbarRegistry.js';
4
5
 
5
6
  export interface EditorRuntimePluginsOptions {
6
7
  essentialsPlugin: OasisPlugin;
7
8
  externalPlugins?: OasisPlugin[];
9
+ t: TranslateFn;
8
10
  customizeToolbar?: (registry: ToolbarRegistry) => void;
9
11
  customizeMenubar?: (registry: MenuRegistry) => void;
10
12
  }
@@ -3,6 +3,6 @@ import { MenuRegistry, MenubarHost } from './menuRegistry.js';
3
3
 
4
4
  export interface MenubarProps {
5
5
  host: () => MenubarHost;
6
- registry?: MenuRegistry;
6
+ registry: MenuRegistry;
7
7
  }
8
8
  export declare function Menubar(props: MenubarProps): JSX.Element;
@@ -25,4 +25,3 @@ export declare class MenuRegistry {
25
25
  unregister(id: string): void;
26
26
  getItems(): MenuItem[];
27
27
  }
28
- export declare const defaultMenuRegistry: MenuRegistry;
@@ -1,3 +1,4 @@
1
+ import { TranslateFn } from '../../../../i18n/index.js';
1
2
  import { ToolbarItem } from '../schema/items.js';
2
3
 
3
4
  /**
@@ -6,4 +7,4 @@ import { ToolbarItem } from '../schema/items.js';
6
7
  * public contribution API clients use. Load each item into a registry via
7
8
  * `registry.register` (see Toolbar bootstrap).
8
9
  */
9
- export declare function createDefaultToolbarPreset(): ToolbarItem[];
10
+ export declare function createDefaultToolbarPreset(t: TranslateFn): ToolbarItem[];
@@ -1,4 +1,5 @@
1
1
  import { RibbonRow, RibbonTabId, ToolbarItem } from '../schema/items.js';
2
+ import { TranslateFn } from '../../../../i18n/index.js';
2
3
 
3
4
  export interface RibbonTabDefinition {
4
5
  id: RibbonTabId;
@@ -11,7 +12,7 @@ export interface RibbonGroupModel {
11
12
  rows: Record<RibbonRow, ToolbarItem[]>;
12
13
  order: number;
13
14
  }
14
- export declare const RIBBON_TAB_DEFINITIONS: RibbonTabDefinition[];
15
+ export declare function buildRibbonTabDefinitions(t: TranslateFn): RibbonTabDefinition[];
15
16
  export declare const DEFAULT_RIBBON_TAB: RibbonTabId;
16
17
  export declare const DEFAULT_RIBBON_GROUP = "general";
17
18
  export declare const DEFAULT_RIBBON_ROW: RibbonRow;
@@ -19,5 +20,5 @@ export declare function normalizeRibbonTab(tab: ToolbarItem["tab"]): RibbonTabId
19
20
  export declare function normalizeRibbonGroup(group: ToolbarItem["group"]): string;
20
21
  export declare function normalizeRibbonRow(row: ToolbarItem["row"]): RibbonRow;
21
22
  export declare function isLargeRibbonItem(item: ToolbarItem): boolean;
22
- export declare function ribbonGroupLabel(group: string): string;
23
- export declare function buildRibbonGroups(items: ToolbarItem[], tab: RibbonTabId): RibbonGroupModel[];
23
+ export declare function ribbonGroupLabel(group: string, t: TranslateFn): string;
24
+ export declare function buildRibbonGroups(items: ToolbarItem[], tab: RibbonTabId, t: TranslateFn): RibbonGroupModel[];
@@ -3,11 +3,9 @@ import { CommandBus } from '../../../../core/commands/CommandBus.js';
3
3
  import { CommandRef } from '../../../../core/commands/CommandRef.js';
4
4
  import { TranslationKey } from '../../../../i18n/index.js';
5
5
  import { ColorPalette } from './palette.js';
6
+ import { RibbonTabId, RibbonRow, RibbonSize } from '../../../../core/pluginUiTypes.js';
6
7
 
7
- export declare const RIBBON_TABS: readonly ["file", "home", "insert", "draw", "layout", "references", "collaboration", "protection", "view", "plugins", "ai"];
8
- export type RibbonTabId = (typeof RIBBON_TABS)[number];
9
- export type RibbonRow = 1 | 2;
10
- export type RibbonSize = "normal" | "large";
8
+ export { RIBBON_TABS, type RibbonTabId, type RibbonRow, type RibbonSize, } from '../../../../core/pluginUiTypes.js';
11
9
  /** Reactive snapshot of a command's state, as consumed by toolbar items. */
12
10
  export interface ToolbarCommandState {
13
11
  isEnabled: boolean;
@@ -147,4 +145,3 @@ export interface CustomItem extends ToolbarItemBase {
147
145
  }
148
146
  export type ToolbarItem = ButtonItem | ToggleItem | SplitItem | MenuItem | SelectItem | ColorPickerItem | GridPickerItem | SeparatorItem | GroupItem | CustomItem;
149
147
  export type ToolbarItemType = ToolbarItem["type"];
150
- export {};
@@ -1,3 +1,4 @@
1
+ import { TranslateFn } from '../../../../i18n/index.js';
1
2
  import { CommandBus } from '../../../../core/commands/CommandBus.js';
2
3
  import { ToolbarActionApi, ToolbarCommandState } from '../schema/items.js';
3
4
 
@@ -11,4 +12,4 @@ export interface ToolbarHost {
11
12
  focusEditor(): void;
12
13
  }
13
14
  /** Builds the {@link ToolbarActionApi} from the narrow {@link ToolbarHost}. */
14
- export declare function createToolbarApi(host: () => ToolbarHost): ToolbarActionApi;
15
+ export declare function createToolbarApi(host: () => ToolbarHost, t: TranslateFn): ToolbarActionApi;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "oasis-editor",
3
- "version": "0.0.31",
3
+ "version": "0.0.33",
4
4
  "type": "module",
5
5
  "repository": {
6
6
  "type": "git",
@@ -58,6 +58,7 @@
58
58
  "build:all": "npm run wasm:build && npm run build",
59
59
  "test": "vitest run",
60
60
  "test:word-parity": "vitest run --config vitest.word-parity.config.js",
61
+ "check:imports": "node ./scripts/check-import-graph.mjs",
61
62
  "lint": "eslint src --ext .ts",
62
63
  "format": "prettier --write \"src/**/*.ts\""
63
64
  },
@@ -1,11 +0,0 @@
1
- import { EditorDocument } from '../../core/model.js';
2
-
3
- export declare class PersistenceService {
4
- private db;
5
- private getDB;
6
- saveDocument(doc: EditorDocument): Promise<void>;
7
- loadDocument(): Promise<EditorDocument | null>;
8
- clearDocument(): Promise<void>;
9
- close(): void;
10
- }
11
- export declare const persistenceService: PersistenceService;