oasis-editor 0.0.33 → 0.0.35

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,154 +1,5 @@
1
1
  import { OasisPlugin } from '../../core/plugin.js';
2
- import { EditorPageMargins } from '../../core/model.js';
3
- import { TextCaseMode } from '../../core/commands/text.js';
4
- import { ToolbarStyleState } from '../../ui/toolbarStyleState.js';
2
+ import { EssentialsPluginDeps } from './essentialsCapabilities.js';
5
3
 
6
- export interface EssentialsFeatureGate {
7
- isCommandEnabled: (commandName: string) => boolean;
8
- }
9
- export interface EssentialsStyleCapability {
10
- state: () => ToolbarStyleState;
11
- }
12
- export interface EssentialsSelectionCapability {
13
- isCollapsed: () => boolean;
14
- }
15
- export interface EssentialsHistoryCapability {
16
- canUndo: () => boolean;
17
- canRedo: () => boolean;
18
- undo: () => boolean;
19
- redo: () => boolean;
20
- }
21
- export interface EssentialsFormattingCapability {
22
- selectAll: () => boolean;
23
- insertFootnote: () => boolean;
24
- pastePlainText: () => boolean;
25
- bold: () => boolean;
26
- italic: () => boolean;
27
- underline: () => boolean;
28
- strike: () => boolean;
29
- superscript: () => boolean;
30
- subscript: () => boolean;
31
- alignLeft: () => boolean;
32
- alignCenter: () => boolean;
33
- alignRight: () => boolean;
34
- alignJustify: () => boolean;
35
- orderedList: () => boolean;
36
- bulletList: () => boolean;
37
- find: () => boolean;
38
- replace: () => boolean;
39
- toggleTrackChanges: () => boolean;
40
- acceptRevisions: () => boolean;
41
- rejectRevisions: () => boolean;
42
- toggleShowMargins: () => boolean;
43
- toggleShowParagraphMarks: () => boolean;
44
- togglePreciseFonts: () => boolean;
45
- pageBreak: () => boolean;
46
- lineBreak: () => boolean;
47
- splitBlock: () => boolean;
48
- setFontFamily: (value: string | null) => boolean;
49
- setFontSize: (value: number | null) => boolean;
50
- increaseFontSize: () => boolean;
51
- decreaseFontSize: () => boolean;
52
- changeTextCase: (mode: TextCaseMode) => boolean;
53
- clearFormatting: () => boolean;
54
- setColor: (value: string | null) => boolean;
55
- setHighlight: (value: string | null) => boolean;
56
- setTextShading: (value: string | null) => boolean;
57
- setStyleId: (value: string) => boolean;
58
- setUnderlineStyle: (value: string | null) => void;
59
- }
60
- export interface EssentialsDocumentStyleDescriptor {
61
- id: string;
62
- name: string;
63
- fontFamily?: string;
64
- fontSize?: number;
65
- }
66
- export interface EssentialsDocumentCapability {
67
- documentStyles: () => EssentialsDocumentStyleDescriptor[];
68
- exportDocx: () => void;
69
- exportPdf: () => void;
70
- importDocument: () => void;
71
- insertImage: () => void;
72
- insertShape: (preset: string) => void;
73
- }
74
- export interface EssentialsLinkCapability {
75
- prompt: () => void;
76
- remove: () => void;
77
- canPrompt: () => boolean;
78
- }
79
- export interface EssentialsImageCapability {
80
- promptAlt: () => void;
81
- promptCaption: () => void;
82
- isSelected: () => boolean;
83
- }
84
- export interface EssentialsBrowserCapability {
85
- print: () => void;
86
- copy: () => void;
87
- }
88
- export interface EssentialsParagraphCapability {
89
- togglePageBreakBefore: () => void;
90
- toggleKeepWithNext: () => void;
91
- setSpacingAfter: (value: number | null) => void;
92
- setSpacingBefore: (value: number | null) => void;
93
- setIndentLeft: (value: number | null) => void;
94
- setIndentRight: (value: number | null) => void;
95
- setIndentFirstLine: (value: number | null) => void;
96
- setIndentHanging: (value: number | null) => void;
97
- setSpecialIndent: (kind: "none" | "firstLine" | "hanging", value?: number | null) => void;
98
- setShading: (value: string | null) => void;
99
- applyBorders: () => void;
100
- setLineHeight: (value: number | null) => void;
101
- setListFormat: (format: string) => void;
102
- setListStartAt: (value: number | null) => void;
103
- outdent: () => void;
104
- indent: () => void;
105
- }
106
- export interface EssentialsSectionCapability {
107
- isLandscape: () => boolean;
108
- toggleOrientation: () => void;
109
- setOrientation: (orientation: "portrait" | "landscape") => void;
110
- breakNextPage: () => void;
111
- breakContinuous: () => void;
112
- getMargins: () => EditorPageMargins | undefined;
113
- setPageMargins: (margins: Partial<EditorPageMargins>) => void;
114
- }
115
- export interface EssentialsTableCapability {
116
- insideTable: () => boolean;
117
- selectionLabel: () => string | null;
118
- canMerge: () => boolean;
119
- canSplit: () => boolean;
120
- canEditColumn: () => boolean;
121
- canEditRow: () => boolean;
122
- merge: () => void;
123
- split: () => void;
124
- insertColumnBefore: () => void;
125
- insertColumnAfter: () => void;
126
- deleteColumn: () => void;
127
- insertRowBefore: () => void;
128
- insertRowAfter: () => void;
129
- deleteRow: () => void;
130
- cellShading: (color: string | null) => void;
131
- cellBorders: () => void;
132
- cellNoBorders: () => void;
133
- width100: () => void;
134
- alignLeft: () => void;
135
- alignCenter: () => void;
136
- alignRight: () => void;
137
- setCellWidth: (width: string) => void;
138
- insert: (rows: number, cols: number) => void;
139
- }
140
- export interface EssentialsPluginDeps {
141
- gate: EssentialsFeatureGate;
142
- style: EssentialsStyleCapability;
143
- selection: EssentialsSelectionCapability;
144
- history: EssentialsHistoryCapability;
145
- formatting: EssentialsFormattingCapability;
146
- document: EssentialsDocumentCapability;
147
- link: EssentialsLinkCapability;
148
- image: EssentialsImageCapability;
149
- browser: EssentialsBrowserCapability;
150
- paragraph: EssentialsParagraphCapability;
151
- section: EssentialsSectionCapability;
152
- table: EssentialsTableCapability;
153
- }
4
+ export type { EssentialsFeatureGate, EssentialsStyleCapability, EssentialsSelectionCapability, EssentialsHistoryCapability, EssentialsFormattingCapability, EssentialsDocumentStyleDescriptor, EssentialsDocumentCapability, EssentialsLinkCapability, EssentialsImageCapability, EssentialsBrowserCapability, EssentialsParagraphCapability, EssentialsSectionCapability, EssentialsTableCapability, EssentialsPluginDeps, } from './essentialsCapabilities.js';
154
5
  export declare function createEssentialsPlugin(deps: EssentialsPluginDeps): OasisPlugin;
@@ -0,0 +1,152 @@
1
+ import { EditorPageMargins } from '../../core/model.js';
2
+ import { TextCaseMode } from '../../core/commands/text.js';
3
+ import { ToolbarStyleState } from '../../ui/toolbarStyleState.js';
4
+
5
+ export interface EssentialsFeatureGate {
6
+ isCommandEnabled: (commandName: string) => boolean;
7
+ }
8
+ export interface EssentialsStyleCapability {
9
+ state: () => ToolbarStyleState;
10
+ }
11
+ export interface EssentialsSelectionCapability {
12
+ isCollapsed: () => boolean;
13
+ }
14
+ export interface EssentialsHistoryCapability {
15
+ canUndo: () => boolean;
16
+ canRedo: () => boolean;
17
+ undo: () => boolean;
18
+ redo: () => boolean;
19
+ }
20
+ export interface EssentialsFormattingCapability {
21
+ selectAll: () => boolean;
22
+ insertFootnote: () => boolean;
23
+ pastePlainText: () => boolean;
24
+ bold: () => boolean;
25
+ italic: () => boolean;
26
+ underline: () => boolean;
27
+ strike: () => boolean;
28
+ superscript: () => boolean;
29
+ subscript: () => boolean;
30
+ alignLeft: () => boolean;
31
+ alignCenter: () => boolean;
32
+ alignRight: () => boolean;
33
+ alignJustify: () => boolean;
34
+ orderedList: () => boolean;
35
+ bulletList: () => boolean;
36
+ find: () => boolean;
37
+ replace: () => boolean;
38
+ toggleTrackChanges: () => boolean;
39
+ acceptRevisions: () => boolean;
40
+ rejectRevisions: () => boolean;
41
+ toggleShowMargins: () => boolean;
42
+ toggleShowParagraphMarks: () => boolean;
43
+ togglePreciseFonts: () => boolean;
44
+ pageBreak: () => boolean;
45
+ lineBreak: () => boolean;
46
+ splitBlock: () => boolean;
47
+ setFontFamily: (value: string | null) => boolean;
48
+ setFontSize: (value: number | null) => boolean;
49
+ increaseFontSize: () => boolean;
50
+ decreaseFontSize: () => boolean;
51
+ changeTextCase: (mode: TextCaseMode) => boolean;
52
+ clearFormatting: () => boolean;
53
+ setColor: (value: string | null) => boolean;
54
+ setHighlight: (value: string | null) => boolean;
55
+ setTextShading: (value: string | null) => boolean;
56
+ setStyleId: (value: string) => boolean;
57
+ setUnderlineStyle: (value: string | null) => void;
58
+ }
59
+ export interface EssentialsDocumentStyleDescriptor {
60
+ id: string;
61
+ name: string;
62
+ fontFamily?: string;
63
+ fontSize?: number;
64
+ }
65
+ export interface EssentialsDocumentCapability {
66
+ documentStyles: () => EssentialsDocumentStyleDescriptor[];
67
+ exportDocx: () => void;
68
+ exportPdf: () => void;
69
+ importDocument: () => void;
70
+ insertImage: () => void;
71
+ insertShape: (preset: string) => void;
72
+ }
73
+ export interface EssentialsLinkCapability {
74
+ prompt: () => void;
75
+ remove: () => void;
76
+ canPrompt: () => boolean;
77
+ }
78
+ export interface EssentialsImageCapability {
79
+ promptAlt: () => void;
80
+ promptCaption: () => void;
81
+ isSelected: () => boolean;
82
+ }
83
+ export interface EssentialsBrowserCapability {
84
+ print: () => void;
85
+ copy: () => void;
86
+ }
87
+ export interface EssentialsParagraphCapability {
88
+ togglePageBreakBefore: () => void;
89
+ toggleKeepWithNext: () => void;
90
+ setSpacingAfter: (value: number | null) => void;
91
+ setSpacingBefore: (value: number | null) => void;
92
+ setIndentLeft: (value: number | null) => void;
93
+ setIndentRight: (value: number | null) => void;
94
+ setIndentFirstLine: (value: number | null) => void;
95
+ setIndentHanging: (value: number | null) => void;
96
+ setSpecialIndent: (kind: "none" | "firstLine" | "hanging", value?: number | null) => void;
97
+ setShading: (value: string | null) => void;
98
+ applyBorders: () => void;
99
+ setLineHeight: (value: number | null) => void;
100
+ setListFormat: (format: string) => void;
101
+ setListStartAt: (value: number | null) => void;
102
+ outdent: () => void;
103
+ indent: () => void;
104
+ }
105
+ export interface EssentialsSectionCapability {
106
+ isLandscape: () => boolean;
107
+ toggleOrientation: () => void;
108
+ setOrientation: (orientation: "portrait" | "landscape") => void;
109
+ breakNextPage: () => void;
110
+ breakContinuous: () => void;
111
+ getMargins: () => EditorPageMargins | undefined;
112
+ setPageMargins: (margins: Partial<EditorPageMargins>) => void;
113
+ }
114
+ export interface EssentialsTableCapability {
115
+ insideTable: () => boolean;
116
+ selectionLabel: () => string | null;
117
+ canMerge: () => boolean;
118
+ canSplit: () => boolean;
119
+ canEditColumn: () => boolean;
120
+ canEditRow: () => boolean;
121
+ merge: () => void;
122
+ split: () => void;
123
+ insertColumnBefore: () => void;
124
+ insertColumnAfter: () => void;
125
+ deleteColumn: () => void;
126
+ insertRowBefore: () => void;
127
+ insertRowAfter: () => void;
128
+ deleteRow: () => void;
129
+ cellShading: (color: string | null) => void;
130
+ cellBorders: () => void;
131
+ cellNoBorders: () => void;
132
+ width100: () => void;
133
+ alignLeft: () => void;
134
+ alignCenter: () => void;
135
+ alignRight: () => void;
136
+ setCellWidth: (width: string) => void;
137
+ insert: (rows: number, cols: number) => void;
138
+ }
139
+ export interface EssentialsPluginDeps {
140
+ gate: EssentialsFeatureGate;
141
+ style: EssentialsStyleCapability;
142
+ selection: EssentialsSelectionCapability;
143
+ history: EssentialsHistoryCapability;
144
+ formatting: EssentialsFormattingCapability;
145
+ document: EssentialsDocumentCapability;
146
+ link: EssentialsLinkCapability;
147
+ image: EssentialsImageCapability;
148
+ browser: EssentialsBrowserCapability;
149
+ paragraph: EssentialsParagraphCapability;
150
+ section: EssentialsSectionCapability;
151
+ table: EssentialsTableCapability;
152
+ }
@@ -1,6 +1,6 @@
1
1
  import { OasisPlugin } from '../../core/plugin.js';
2
2
  import { ActionCommandBuilder, CommandBuilder, ValueCommandBuilder } from './essentialsCommandBuilders.js';
3
- import { EssentialsBrowserCapability, EssentialsDocumentCapability, EssentialsFeatureGate, EssentialsFormattingCapability, EssentialsHistoryCapability, EssentialsImageCapability, EssentialsLinkCapability, EssentialsParagraphCapability, EssentialsSectionCapability, EssentialsSelectionCapability, EssentialsStyleCapability, EssentialsTableCapability } from './createEssentialsPlugin.js';
3
+ import { EssentialsBrowserCapability, EssentialsDocumentCapability, EssentialsFeatureGate, EssentialsFormattingCapability, EssentialsHistoryCapability, EssentialsImageCapability, EssentialsLinkCapability, EssentialsParagraphCapability, EssentialsSectionCapability, EssentialsSelectionCapability, EssentialsStyleCapability, EssentialsTableCapability } from './essentialsCapabilities.js';
4
4
 
5
5
  interface CoreFormattingGroupDeps {
6
6
  gate: EssentialsFeatureGate;
@@ -1,8 +1,6 @@
1
1
  import { EditorLigatures, EditorNumberForm, EditorNumberSpacing } from '../../../core/model.js';
2
- import { FontTabValues, AdvancedTabValues, FontDialogInitialValues, FontDialogApplyValues } from './font-dialog/FontDialogTypes.js';
2
+ import { FontTabValues, AdvancedTabValues, FontDialogInitialValues, FontDialogApplyValues, FontDialogSpacingMode, FontDialogPositionMode } from './font-dialog/FontDialogTypes.js';
3
3
 
4
- export type FontDialogSpacingMode = "normal" | "expanded" | "condensed";
5
- export type FontDialogPositionMode = "normal" | "raised" | "lowered";
6
4
  export type FontFaceStyle = "regular" | "italic" | "bold" | "boldItalic";
7
5
  export declare function parsePositiveNumber(value: string): number | null;
8
6
  export declare function parseNonNegativeNumber(value: string): number | null;
@@ -1,6 +1,7 @@
1
1
  import { EditorLigatures, EditorNumberForm, EditorNumberSpacing, EditorUnderlineStyle } from '../../../../core/model.js';
2
- import { FontDialogSpacingMode, FontDialogPositionMode } from '../FontDialogModel.js';
3
2
 
3
+ export type FontDialogSpacingMode = "normal" | "expanded" | "condensed";
4
+ export type FontDialogPositionMode = "normal" | "raised" | "lowered";
4
5
  export declare const DEFAULT_COLOR = "#111827";
5
6
  export declare const DEFAULT_HIGHLIGHT = "#fef08a";
6
7
  export declare const DEFAULT_SHADING = "#fef3c7";
@@ -1,13 +1 @@
1
- import { JSX } from 'solid-js';
2
- import { ToolbarActionApi, ToolbarItem } from '../schema/items.js';
3
-
4
- /**
5
- * Renders a single toolbar item by dispatching on its `type` to the renderer
6
- * map. Wraps each item so contextual visibility toggles `display` instead of
7
- * unmounting — required by the imperative OverflowManager (DOM moves break if
8
- * the child count changes).
9
- */
10
- export declare function ToolbarItemRenderer(props: {
11
- item: ToolbarItem;
12
- api: ToolbarActionApi;
13
- }): JSX.Element;
1
+ export { ToolbarItemRenderer } from './renderers.js';
@@ -1,4 +1,4 @@
1
- import { Component } from 'solid-js';
1
+ import { Component, JSX } from 'solid-js';
2
2
  import { ToolbarActionApi, ToolbarItem, ToolbarItemType } from '../schema/items.js';
3
3
 
4
4
  export interface RendererProps<I extends ToolbarItem = ToolbarItem> {
@@ -12,3 +12,18 @@ export declare const TOOLBAR_RENDERERS: Record<ToolbarItemType, Component<Render
12
12
  */
13
13
  export declare function registerToolbarRenderer(type: string, component: Component<RendererProps>): void;
14
14
  export declare function resolveRenderer(type: string): Component<RendererProps> | undefined;
15
+ /**
16
+ * Renders a single toolbar item by dispatching on its `type` to the renderer
17
+ * map. Wraps each item so contextual visibility toggles `display` instead of
18
+ * unmounting — required by the imperative OverflowManager (DOM moves break if
19
+ * the child count changes).
20
+ *
21
+ * Defined here (alongside the renderers it dispatches to) because the two are
22
+ * mutually recursive: menu/group renderers render child items through this
23
+ * component, which in turn resolves them back to those renderers. Keeping the
24
+ * recursion intra-module avoids an import cycle.
25
+ */
26
+ export declare function ToolbarItemRenderer(props: {
27
+ item: ToolbarItem;
28
+ api: ToolbarActionApi;
29
+ }): JSX.Element;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "oasis-editor",
3
- "version": "0.0.33",
3
+ "version": "0.0.35",
4
4
  "type": "module",
5
5
  "repository": {
6
6
  "type": "git",