oasis-editor 0.0.75 → 0.0.77

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.
@@ -1,24 +1,15 @@
1
1
  import { EditorParagraphListStyle, EditorParagraphStyle, EditorSection, EditorState, EditorTextStyle } from '../../core/model.js';
2
2
  import { TextCaseMode } from '../../core/commands/text.js';
3
- import { EditorTransactionOptions } from '../../ui/editorHistory.js';
4
3
  import { BooleanStyleKey, ParagraphStyleKey, ToolbarStyleState } from '../../ui/toolbarStyleState.js';
5
4
  import { EditorLogger } from '../../utils/logger.js';
6
- import { SelectedImageRun } from '../../core/commands/image.js';
5
+ import { EditorTransactionPort, FocusInputPort, SelectedImageQueryPort } from './controllerPorts.js';
7
6
 
8
- export interface EditorCommandsControllerDeps {
7
+ export interface EditorCommandsControllerDeps extends EditorTransactionPort, FocusInputPort, SelectedImageQueryPort {
9
8
  state: EditorState;
10
9
  logger: EditorLogger;
11
- applyState: (next: EditorState) => void;
12
- applyTransactionalState: (producer: (current: EditorState) => EditorState, options?: EditorTransactionOptions) => void;
13
10
  applySelectionAwareTextCommand: (command: (current: EditorState) => EditorState) => void;
14
- applySelectionAwareParagraphCommand: (command: (current: EditorState) => EditorState) => void;
15
- applyTableAwareParagraphEdit: (current: EditorState, edit: (tempState: EditorState) => EditorState) => EditorState;
16
- focusInput: () => void;
17
- clearPreferredColumn: () => void;
18
- resetTransactionGrouping: () => void;
19
11
  toolbarStyleState: () => ToolbarStyleState;
20
12
  selectionCollapsed: () => boolean;
21
- selectedImageRun: () => SelectedImageRun | null;
22
13
  openLinkDialog: (initialHref: string) => void;
23
14
  openImageAltDialog: (initialAlt: string) => void;
24
15
  openImageCaptionDialog: (initialCaption: string) => void;
@@ -1,23 +1,19 @@
1
1
  import { EditorDocument, EditorPosition, EditorState } from '../../core/model.js';
2
2
  import { BooleanStyleKey } from '../../ui/toolbarStyleState.js';
3
- import { SelectedImageRun } from '../../core/commands/image.js';
3
+ import { EditorTransactionPort, FocusInputPort, SelectedImageQueryPort } from './controllerPorts.js';
4
4
 
5
5
  /**
6
6
  * The capability surface the keyboard controller and key bindings operate on.
7
7
  * Extracted to its own leaf module so `EditorCommandRegistry` (which references
8
8
  * it from key-binding signatures) and `useEditorKeyboard` (which implements the
9
9
  * controller) can both depend on it without forming an import cycle.
10
+ *
11
+ * Shared transaction/focus/image-selection members come from the capability
12
+ * ports in `controllerPorts.ts`; only keyboard-specific members live here (I1).
10
13
  */
11
- export interface EditorKeyboardDeps {
14
+ export interface EditorKeyboardDeps extends EditorTransactionPort, FocusInputPort, SelectedImageQueryPort {
12
15
  state: () => EditorState;
13
16
  isReadOnly: () => boolean;
14
- clearPreferredColumn: () => void;
15
- resetTransactionGrouping: () => void;
16
- applyState: (state: EditorState) => void;
17
- applyTransactionalState: (transform: (state: EditorState) => EditorState) => void;
18
- applyTableAwareParagraphEdit: (state: EditorState, edit: (state: EditorState) => EditorState) => EditorState;
19
- applySelectionAwareParagraphCommand: (command: (state: EditorState) => EditorState) => void;
20
- focusInput: () => void;
21
17
  commandsController: {
22
18
  promptForImageAlt: () => void;
23
19
  promptForLink: () => void;
@@ -30,7 +26,6 @@ export interface EditorKeyboardDeps {
30
26
  }) => boolean;
31
27
  handleListTab: (direction: "indent" | "outdent") => boolean;
32
28
  };
33
- selectedImageRun: () => SelectedImageRun | null;
34
29
  setForcePlainTextPaste: (value: boolean) => void;
35
30
  moveSelectionByWord: (direction: "left" | "right", extend: boolean) => boolean;
36
31
  moveSelectionToDocumentBoundary: (boundary: "start" | "end", extend: boolean) => boolean;
@@ -0,0 +1,33 @@
1
+ import { EditorState } from '../../core/model.js';
2
+ import { EditorTransactionOptions } from '../../ui/editorHistory.js';
3
+ import { SelectedImageRun } from '../../core/commands/image.js';
4
+
5
+ /**
6
+ * Capability ports shared by the editor controllers (I1). The controller
7
+ * dependency bags used to redeclare these same members independently; grouping
8
+ * them into small, named ports removes that duplication and lets a controller
9
+ * (or a test fabricating deps) depend on just the capabilities it actually
10
+ * uses, rather than a 20+-member catch-all interface.
11
+ */
12
+ /**
13
+ * Applies document changes through the editor's transaction/history machinery.
14
+ * Covers the plain apply, the transactional producer (optionally grouped), the
15
+ * table-aware paragraph edit, the selection-aware paragraph command, and the
16
+ * transaction-grouping bookkeeping.
17
+ */
18
+ export interface EditorTransactionPort {
19
+ applyState: (next: EditorState) => void;
20
+ applyTransactionalState: (producer: (current: EditorState) => EditorState, options?: EditorTransactionOptions) => void;
21
+ applyTableAwareParagraphEdit: (current: EditorState, edit: (tempState: EditorState) => EditorState) => EditorState;
22
+ applySelectionAwareParagraphCommand: (command: (current: EditorState) => EditorState) => void;
23
+ clearPreferredColumn: () => void;
24
+ resetTransactionGrouping: () => void;
25
+ }
26
+ /** Returns keyboard focus to the hidden editing input. */
27
+ export interface FocusInputPort {
28
+ focusInput: () => void;
29
+ }
30
+ /** Reads the currently selected inline image run, when one is selected. */
31
+ export interface SelectedImageQueryPort {
32
+ selectedImageRun: () => SelectedImageRun | null;
33
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "oasis-editor",
3
- "version": "0.0.75",
3
+ "version": "0.0.77",
4
4
  "type": "module",
5
5
  "repository": {
6
6
  "type": "git",