oasis-editor 0.0.342 → 0.0.344

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,4 +1,5 @@
1
1
  import { EditorDocument, EditorPosition, EditorState, EditorTextStyle } from '../../core/model.js';
2
+ import { TableTabTarget } from './tableOpsSelectionNavigation.js';
2
3
  import { BooleanStyleKey } from '../../ui/toolbarStyleState.js';
3
4
  import { EditorTransactionPort, FocusInputPort, SelectedImageQueryPort } from './controllerPorts.js';
4
5
  /**
@@ -14,6 +15,7 @@ export interface EditorKeyboardDeps extends EditorTransactionPort, FocusInputPor
14
15
  state: () => EditorState;
15
16
  isReadOnly: () => boolean;
16
17
  pendingCaretTextStyle?: () => EditorTextStyle | undefined;
18
+ autoTabIndentEnabled?: () => boolean;
17
19
  commandsController: {
18
20
  promptForImageAlt: () => void;
19
21
  promptForLink: () => void;
@@ -36,6 +38,8 @@ export interface EditorKeyboardDeps extends EditorTransactionPort, FocusInputPor
36
38
  moveVerticalSelection: (direction: -1 | 1, extend: boolean) => boolean;
37
39
  moveVerticalByBlock: (direction: -1 | 1) => boolean;
38
40
  resolveAdjacentTableCellPosition: (document: EditorDocument, paragraphId: string, delta: -1 | 1) => EditorPosition | null;
41
+ resolveTableTabTarget?: (document: EditorDocument, paragraphId: string, delta: -1 | 1) => TableTabTarget;
42
+ appendTableRowForTab?: (current: EditorState) => EditorState;
39
43
  applySelectionPreservingStructure: (selection: EditorState["selection"]) => void;
40
44
  toggleFindReplace: (open?: boolean) => void;
41
45
  toggleReplace: (open?: boolean) => void;
@@ -1,6 +1,6 @@
1
1
  import { EditorState } from '../../core/model.js';
2
2
  import { EditorKeyboardDeps } from './EditorKeyboardDeps.js';
3
- export type TabAction = "passThrough" | "insertLiteralTab" | "navigateCell" | "changeParagraphIndent";
3
+ export type TabAction = "passThrough" | "insertLiteralTab" | "navigateCell" | "changeParagraphIndent" | "changeFirstLineIndent";
4
4
  export interface TabContext {
5
5
  inTable: boolean;
6
6
  shift: boolean;
@@ -9,6 +9,8 @@ export interface TabContext {
9
9
  alt: boolean;
10
10
  wholeParagraphs: boolean;
11
11
  atListStart: boolean;
12
+ autoIndentAtStart?: boolean;
13
+ reverseFirstLineIndent?: boolean;
12
14
  }
13
15
  /** Pure routing policy: table context and host modifiers take precedence. */
14
16
  export declare function resolveTabAction(context: TabContext): TabAction;
@@ -5,6 +5,7 @@ interface TableRowColumnOperationsDeps {
5
5
  export declare function createTableRowColumnOperations(deps: TableRowColumnOperationsDeps): ReturnType<typeof createTableRowColumnOperationsImpl>;
6
6
  declare function createTableRowColumnOperationsImpl(deps: TableRowColumnOperationsDeps): {
7
7
  insertSelectedTableRow: (current: EditorState, direction: -1 | 1) => EditorState;
8
+ appendTableRowForTab: (current: EditorState) => EditorState;
8
9
  deleteSelectedTableRow: (current: EditorState) => EditorState;
9
10
  insertSelectedTableColumn: (current: EditorState, direction: -1 | 1) => EditorState;
10
11
  deleteSelectedTableColumn: (current: EditorState) => EditorState;
@@ -1,6 +1,14 @@
1
- import { EditorDocument, EditorPosition, EditorParagraphNode, EditorTableCellNode, EditorTableNode, EditorTableRowNode } from '../../core/model.js';
1
+ import { EditorSelection, EditorDocument, EditorPosition, EditorParagraphNode, EditorTableCellNode, EditorTableNode, EditorTableRowNode } from '../../core/model.js';
2
2
  export declare const getRowVisualWidth: (row: EditorTableRowNode) => number;
3
3
  export declare const getTableVisualWidth: (table: EditorTableNode) => number;
4
4
  export declare const findCellAtVisualColumn: (row: EditorTableRowNode, visualColumn: number) => EditorTableCellNode | null;
5
5
  export declare const findFirstNavigableParagraphInTable: (table: EditorTableNode) => EditorParagraphNode | null;
6
+ export type TableTabTarget = {
7
+ kind: "outside" | "blocked" | "beforeFirst" | "afterLast";
8
+ } | {
9
+ kind: "adjacent";
10
+ selection: EditorSelection;
11
+ };
12
+ export declare const resolveTableTabTarget: (document: EditorDocument, paragraphId: string, delta: -1 | 1) => TableTabTarget;
13
+ /** Position-only projection retained for callers that do not select cell text. */
6
14
  export declare const resolveAdjacentTableCellPosition: (document: EditorDocument, paragraphId: string, delta: -1 | 1) => EditorPosition | null;
@@ -29,6 +29,7 @@ declare function createEditorTableOperationsImpl(deps: EditorTableOperationsDeps
29
29
  splitSelectedTableCell: (current: EditorState) => EditorState;
30
30
  splitSelectedTable: (current: EditorState) => EditorState;
31
31
  insertSelectedTableRow: (current: EditorState, direction: -1 | 1) => EditorState;
32
+ appendTableRowForTab: (current: EditorState) => EditorState;
32
33
  deleteSelectedTableRow: (current: EditorState) => EditorState;
33
34
  insertSelectedTableColumn: (current: EditorState, direction: -1 | 1) => EditorState;
34
35
  deleteSelectedTableColumn: (current: EditorState) => EditorState;
@@ -38,6 +39,7 @@ declare function createEditorTableOperationsImpl(deps: EditorTableOperationsDeps
38
39
  findFirstNavigableParagraphInTable: (table: import('../../core/model.js').EditorTableNode) => import('../../core/model.js').EditorParagraphNode | null;
39
40
  updateBlocksInCurrentSection: (current: EditorState, blocks: import('../../core/model.js').EditorBlockNode[], zone?: import('../../core/model.js').EditorEditingZone) => EditorState;
40
41
  resolveAdjacentTableCellPosition: (document: import('../../core/model.js').EditorDocument, paragraphId: string, delta: -1 | 1) => import('../../core/model.js').EditorPosition | null;
42
+ resolveTableTabTarget: (document: import('../../core/model.js').EditorDocument, paragraphId: string, delta: -1 | 1) => import('./tableOpsSelectionNavigation.js').TableTabTarget;
41
43
  applyTableAwareParagraphEdit: (current: EditorState, edit: (tempState: EditorState) => EditorState) => EditorState;
42
44
  withExpandedTableCellSelection: (current: EditorState) => EditorState;
43
45
  applySelectionAwareTextCommand: (command: (current: EditorState) => EditorState) => void;
@@ -6,3 +6,6 @@ export declare function setWelcomeSeen(): void;
6
6
  export declare function getPreciseFontPreference(): boolean;
7
7
  /** @param on - Whether precise font rendering should be enabled. */
8
8
  export declare function setPreciseFontPreference(on: boolean): void;
9
+ /** Word-style first-line indentation is enabled by default, independently of the document. */
10
+ export declare function getAutoTabIndentPreference(): boolean;
11
+ export declare function setAutoTabIndentPreference(enabled: boolean): void;
@@ -1,5 +1,6 @@
1
1
  import { EditorState } from '../model.js';
2
2
  export declare const DEFAULT_TAB_INTERVAL_PT = 36;
3
+ export declare function tabIntervalPx(state: EditorState): number;
3
4
  /**
4
5
  * Relative keyboard indentation for a whole/selected paragraph or list item.
5
6
  * Paragraph indents are CSS px; document tab interval is pt. Each paragraph
@@ -7,3 +8,5 @@ export declare const DEFAULT_TAB_INTERVAL_PT = 36;
7
8
  * Automatic first-line indentation is a separate policy.
8
9
  */
9
10
  export declare function stepTabParagraphIndent(state: EditorState, direction: -1 | 1): EditorState;
11
+ /** AutoFormat at a nonempty paragraph's first line, or its inverse. */
12
+ export declare function stepFirstLineIndent(state: EditorState, direction: -1 | 1): EditorState;
@@ -21,7 +21,7 @@ export type { EditorReviewActivity, EditorReviewActivityKind, } from './types/do
21
21
  export type { EditorOpcPartKind, EditorOpcPartEncoding, EditorOpcRelationship, EditorOpcContentTypes, EditorOpcPart, EditorDocxDiagnostic, EditorDocxSourcePackage, } from './types/docxSourcePackage.js';
22
22
  export type { EditorPageMargins, EditorPageSettings, EditorColumnsSettings, EditorSection, EditorSectionBreakType, EditorSectionPropertiesSnapshot, EditorPageNumbering, EditorSectionVerticalAlign, EditorFontInfo, EditorFootnoteSettings, EditorFootnotes, EditorEndnoteSettings, EditorEndnotes, EditorDocumentDesign, EditorThemeData, EditorWatermark, EditorPageBorder, EditorDocument, } from './types/document.js';
23
23
  export type { EditorPosition, EditorSelection, EditorEditingZone, } from './types/selection.js';
24
- export type { EditorCaretSlot, EditorLayoutFragmentChar, EditorLayoutFragment, EditorLayoutLine, EditorLayoutParagraph, EditorLayoutBlock, TableCellBlockPosition, EditorLayoutPage, EditorLayoutDocument, } from './types/layout.js';
24
+ export type { EditorCaretSlot, EditorLayoutFragmentChar, EditorLayoutFragment, EditorLayoutLine, EditorResolvedTab, EditorLayoutParagraph, EditorLayoutBlock, TableCellBlockPosition, EditorLayoutPage, EditorLayoutDocument, } from './types/layout.js';
25
25
  export type { EditorState, ReviewDisplayMode } from './editorState.js';
26
26
  export { EDITOR_ASSET_REF_PREFIX } from './types/primitives.js';
27
27
  export { DEFAULT_TEXT_STYLE, DEFAULT_PARAGRAPH_STYLE, EFFECTIVE_TEXT_STYLE_DEFAULTS, EFFECTIVE_PARAGRAPH_STYLE_DEFAULTS, } from './styleDefaults.js';
@@ -1,7 +1,7 @@
1
1
  import { EditorBlockNode, EditorTextBoxData } from './nodes.js';
2
2
  import { EditorMathExpression } from './math.js';
3
3
  import { EditorPageSettings } from './document.js';
4
- import { EditorRevision, EditorImageRunData } from './primitives.js';
4
+ import { EditorRevision, EditorImageRunData, EditorTabStop } from './primitives.js';
5
5
  import { EditorTextStyle } from './styles.js';
6
6
  export interface EditorCaretSlot {
7
7
  paragraphId: string;
@@ -28,6 +28,12 @@ export interface EditorLayoutFragment {
28
28
  revision?: EditorRevision;
29
29
  chars: EditorLayoutFragmentChar[];
30
30
  }
31
+ /** Resolved tab identity; the associated caret slots define final paint bounds. */
32
+ export interface EditorResolvedTab {
33
+ stopPositionPx: number;
34
+ type: Exclude<EditorTabStop["type"], "bar" | "clear">;
35
+ leader?: Exclude<NonNullable<EditorTabStop["leader"]>, "none">;
36
+ }
31
37
  export interface EditorLayoutLine {
32
38
  paragraphId: string;
33
39
  index: number;
@@ -38,6 +44,10 @@ export interface EditorLayoutLine {
38
44
  slots: EditorCaretSlot[];
39
45
  fragments: EditorLayoutFragment[];
40
46
  availableWidth?: number;
47
+ /** Resolved tabs keyed by document paragraph offset, not shifted screen x. */
48
+ resolvedTabs?: Record<number, EditorResolvedTab>;
49
+ /** Column-relative x positions of independent vertical bar decorations. */
50
+ barTabPositionsPx?: number[];
41
51
  /**
42
52
  * Set when the line ends mid-word due to automatic hyphenation. Renderers draw
43
53
  * a trailing hyphen glyph after the last fragment; it is not part of the text