@coorax/core 0.0.0-canary.0 → 0.0.0-canary.2
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/base/classes/component.class.d.ts +23 -0
- package/dist/base/classes/container.class.d.ts +17 -0
- package/dist/base/classes/field.class.d.ts +15 -0
- package/dist/base/classes/tnode.class.d.ts +14 -0
- package/{src/base/index.ts → dist/base/index.d.ts} +0 -4
- package/dist/base/types/components/components.d.ts +13 -0
- package/dist/base/types/container/container.d.ts +27 -0
- package/dist/base/types/container/division.types.d.ts +3 -0
- package/{src/base/types/container/section.types.ts → dist/base/types/container/section.types.d.ts} +2 -2
- package/{src/base/types/container/ul-list.types.ts → dist/base/types/container/ul-list.types.d.ts} +2 -2
- package/dist/base/types/css.types.d.ts +23 -0
- package/dist/base/types/field/divider.types.d.ts +3 -0
- package/dist/base/types/field/field.blockquote.types.d.ts +4 -0
- package/dist/base/types/field/field.d.ts +50 -0
- package/dist/base/types/field/field.image.types.d.ts +3 -0
- package/{src/base/types/field/field.media.types.ts → dist/base/types/field/field.media.types.d.ts} +2 -3
- package/{src/base/types/field/field.text.types.ts → dist/base/types/field/field.text.types.d.ts} +4 -5
- package/dist/base/types/field/field.video.types.d.ts +8 -0
- package/dist/base/types/field/fields.iframe.types.d.ts +7 -0
- package/{src/base/types/field/heading.types.ts → dist/base/types/field/heading.types.d.ts} +2 -2
- package/{src/base/types/field/paragraph.types.ts → dist/base/types/field/paragraph.types.d.ts} +2 -2
- package/dist/base/types/global.types.d.ts +26 -0
- package/{src/base/types/node/span.types.ts → dist/base/types/node/link.types.d.ts} +2 -2
- package/{src/base/types/node/node.ts → dist/base/types/node/node.d.ts} +13 -17
- package/{src/base/types/node/link.types.ts → dist/base/types/node/span.types.d.ts} +2 -2
- package/dist/base/types/tree/tree.d.ts +24 -0
- package/dist/constants/field.constants.d.ts +1 -0
- package/dist/constants/index.d.ts +1 -0
- package/{src/engine/engine.ts → dist/engine/engine.d.ts} +20 -24
- package/dist/engine/engine.test.d.ts +1 -0
- package/{src/index.ts → dist/index.d.ts} +1 -2
- package/dist/index.js +3252 -0
- package/dist/modules/caption/caption.module.d.ts +35 -0
- package/dist/modules/caption/caption.test.d.ts +1 -0
- package/dist/modules/code/code.module.d.ts +37 -0
- package/dist/modules/deletion/deletion.module.d.ts +26 -0
- package/dist/modules/editor/editor.module.d.ts +44 -0
- package/dist/modules/focus/focus.module.d.ts +54 -0
- package/dist/modules/history/history.module.d.ts +41 -0
- package/dist/modules/hover/hover.module.d.ts +53 -0
- package/{src/modules/index.ts → dist/modules/index.d.ts} +3 -1
- package/dist/modules/insertion/insertion.module.d.ts +71 -0
- package/dist/modules/modules-manager.d.ts +43 -0
- package/{src/modules/modules.types.ts → dist/modules/modules.types.d.ts} +25 -30
- package/dist/modules/selection/selection.module.d.ts +60 -0
- package/dist/modules/selection/selection.test.d.ts +1 -0
- package/dist/modules/text-editing/text-editing.constants.d.ts +2 -0
- package/dist/modules/text-editing/text-editing.module.d.ts +82 -0
- package/dist/modules/text-editing/text-editing.utils.d.ts +6 -0
- package/dist/services/commandsbus/commandsbus.d.ts +53 -0
- package/dist/services/commandsbus/commandsbus.test.d.ts +17 -0
- package/dist/services/document/document.d.ts +44 -0
- package/dist/services/eventbus/eventbus.d.ts +86 -0
- package/dist/services/eventbus/eventbus.test.d.ts +8 -0
- package/dist/services/eventbus/subscriber.d.ts +18 -0
- package/dist/services/mutations/mutations.d.ts +43 -0
- package/dist/services/mutations/mutations.errors.d.ts +6 -0
- package/dist/services/mutations/mutations.test.d.ts +1 -0
- package/dist/services/shortcuts/shortcuts.d.ts +4 -0
- package/dist/services/state/state.d.ts +20 -0
- package/dist/services/state/state.errors.d.ts +6 -0
- package/dist/services/tasks/tasks.service.d.ts +106 -0
- package/dist/services/tasks/tasks.service.test.d.ts +7 -0
- package/dist/services/text-marks/index.d.ts +1 -0
- package/{src/services/text-marks/marks.types.ts → dist/services/text-marks/marks.types.d.ts} +20 -23
- package/dist/services/text-marks/text-marks.d.ts +45 -0
- package/dist/services/ui/contributions.types.d.ts +79 -0
- package/dist/services/ui/default-styles.d.ts +3 -0
- package/{src/services/ui/index.ts → dist/services/ui/index.d.ts} +0 -1
- package/dist/services/ui/ui.d.ts +23 -0
- package/dist/services/ui/ui.errors.d.ts +3 -0
- package/dist/services/ui/ui.types.d.ts +25 -0
- package/dist/styles.css +2 -0
- package/dist/utils/components.utils.d.ts +10 -0
- package/dist/utils/container.utils.d.ts +13 -0
- package/dist/utils/fields.utils.d.ts +27 -0
- package/dist/utils/global.utils.d.ts +47 -0
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/modules.utils.d.ts +11 -0
- package/dist/utils/tnode.utils.d.ts +9 -0
- package/dist/utils/tree.utils.d.ts +11 -0
- package/package.json +23 -6
- package/styles.css +4 -4
- package/src/base/classes/component.class.ts +0 -68
- package/src/base/classes/container.class.ts +0 -57
- package/src/base/classes/field.class.ts +0 -42
- package/src/base/classes/tnode.class.ts +0 -38
- package/src/base/types/components/components.ts +0 -21
- package/src/base/types/container/container.ts +0 -37
- package/src/base/types/container/division.types.ts +0 -3
- package/src/base/types/css.types.ts +0 -33
- package/src/base/types/field/divider.types.ts +0 -3
- package/src/base/types/field/field.ts +0 -46
- package/src/base/types/global.types.ts +0 -45
- package/src/base/types/tree/tree.ts +0 -33
- package/src/engine/engine.test.ts +0 -27
- package/src/modules/editor/editor.module.ts +0 -119
- package/src/modules/focus/focus.module.ts +0 -185
- package/src/modules/history/history.module.ts +0 -60
- package/src/modules/hover/hover.module.ts +0 -121
- package/src/modules/insertion/insertion.module.ts +0 -140
- package/src/modules/modules-manager.ts +0 -132
- package/src/modules/selection/selection.module.ts +0 -174
- package/src/modules/selection/selection.test.ts +0 -1
- package/src/modules/text-editing/text-editing.constants.ts +0 -6
- package/src/modules/text-editing/text-editing.module.ts +0 -377
- package/src/modules/text-editing/text-editing.utils.ts +0 -27
- package/src/services/commandsbus/commandsbus.test.ts +0 -312
- package/src/services/commandsbus/commandsbus.ts +0 -360
- package/src/services/document/document.ts +0 -139
- package/src/services/eventbus/eventbus.test.ts +0 -144
- package/src/services/eventbus/eventbus.ts +0 -162
- package/src/services/eventbus/subscriber.ts +0 -46
- package/src/services/mutations/mutations.errors.ts +0 -12
- package/src/services/mutations/mutations.test.ts +0 -177
- package/src/services/mutations/mutations.ts +0 -457
- package/src/services/shortcuts/shortcuts.ts +0 -3
- package/src/services/state/state.errors.ts +0 -12
- package/src/services/state/state.ts +0 -64
- package/src/services/tasks/tasks.service.test.ts +0 -193
- package/src/services/tasks/tasks.service.ts +0 -288
- package/src/services/text-marks/index.ts +0 -2
- package/src/services/text-marks/text-marks.ts +0 -244
- package/src/services/ui/default-styles.ts +0 -93
- package/src/services/ui/ui.errors.ts +0 -6
- package/src/services/ui/ui.ts +0 -148
- package/src/services/ui/ui.types.ts +0 -197
- package/src/utils/components.utils.ts +0 -26
- package/src/utils/container.utils.ts +0 -59
- package/src/utils/fields.utils.ts +0 -118
- package/src/utils/global.utils.ts +0 -128
- package/src/utils/index.ts +0 -7
- package/src/utils/modules.utils.ts +0 -110
- package/src/utils/tnode.utils.ts +0 -48
- package/src/utils/tree.utils.ts +0 -120
- package/tsconfig.json +0 -9
- /package/{src/engine/index.ts → dist/engine/index.d.ts} +0 -0
- /package/{src/services/commandsbus/index.ts → dist/services/commandsbus/index.d.ts} +0 -0
- /package/{src/services/document/index.ts → dist/services/document/index.d.ts} +0 -0
- /package/{src/services/eventbus/index.ts → dist/services/eventbus/index.d.ts} +0 -0
- /package/{src/services/mutations/index.ts → dist/services/mutations/index.d.ts} +0 -0
- /package/{src/services/state/index.ts → dist/services/state/index.d.ts} +0 -0
- /package/{src/services/tasks/index.ts → dist/services/tasks/index.d.ts} +0 -0
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { type FieldId } from "@coorax/schema";
|
|
2
|
+
import type { CommandMap } from "../../services/commandsbus/commandsbus";
|
|
3
|
+
import type { TModule } from "../modules.types";
|
|
4
|
+
declare module "../modules-manager" {
|
|
5
|
+
interface ModuleMap {
|
|
6
|
+
caption: {};
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
declare module "../../services/commandsbus/commandsbus" {
|
|
10
|
+
interface CommandMap {
|
|
11
|
+
"caption.add": {
|
|
12
|
+
payload: {
|
|
13
|
+
mediaId: FieldId;
|
|
14
|
+
};
|
|
15
|
+
result: void;
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
declare module "../../services/eventbus/eventbus" {
|
|
20
|
+
interface TEventMap {
|
|
21
|
+
"caption:add": CommandMap["caption.add"]["payload"];
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
declare module "../../services/ui/ui" {
|
|
25
|
+
interface ButtonContributionIdentityMap {
|
|
26
|
+
"insert-caption": {};
|
|
27
|
+
}
|
|
28
|
+
interface IconMap {
|
|
29
|
+
CaptionsIcon: {};
|
|
30
|
+
}
|
|
31
|
+
interface SlotButtonPropsMap {
|
|
32
|
+
CaptionButton: {};
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
export declare const CaptionModule: TModule;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { type FieldId } from "@coorax/schema";
|
|
2
|
+
import type { CommandMap } from "../../services/commandsbus/commandsbus";
|
|
3
|
+
import type { TModule } from "../modules.types";
|
|
4
|
+
declare module "../modules-manager" {
|
|
5
|
+
interface ModuleMap {
|
|
6
|
+
code: {};
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
declare module "../../services/commandsbus/commandsbus" {
|
|
10
|
+
interface CommandMap {
|
|
11
|
+
"code.toggleTheme": {
|
|
12
|
+
payload: {
|
|
13
|
+
fieldId: FieldId;
|
|
14
|
+
};
|
|
15
|
+
result: void;
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
declare module "../../services/eventbus/eventbus" {
|
|
20
|
+
interface TEventMap {
|
|
21
|
+
"code:toggleTheme": CommandMap["code.toggleTheme"]["payload"];
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
declare module "../../services/ui/ui" {
|
|
25
|
+
interface ButtonContributionIdentityMap {
|
|
26
|
+
"format-code-theme": {};
|
|
27
|
+
}
|
|
28
|
+
interface IconMap {
|
|
29
|
+
PaletteIcon: {};
|
|
30
|
+
}
|
|
31
|
+
interface SlotButtonPropsMap {
|
|
32
|
+
CodeThemeButton: {
|
|
33
|
+
isActive: boolean;
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
export declare const CodeModule: TModule;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { TModule } from "../modules.types";
|
|
2
|
+
declare module "../modules-manager" {
|
|
3
|
+
interface ModuleMap {
|
|
4
|
+
deletion: {};
|
|
5
|
+
}
|
|
6
|
+
}
|
|
7
|
+
declare module "../../services/commandsbus/commandsbus" {
|
|
8
|
+
interface CommandMap {
|
|
9
|
+
"blocks.deleteSelection": {
|
|
10
|
+
payload: void;
|
|
11
|
+
result: void;
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
declare module "../../services/ui/ui" {
|
|
16
|
+
interface ButtonContributionIdentityMap {
|
|
17
|
+
"delete-blocks": {};
|
|
18
|
+
}
|
|
19
|
+
interface IconMap {
|
|
20
|
+
TrashIcon: {};
|
|
21
|
+
}
|
|
22
|
+
interface SlotButtonPropsMap {
|
|
23
|
+
DeleteButton: {};
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
export declare const DeletionModule: TModule;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import type { BlockRect, TModule } from "..";
|
|
2
|
+
import type { CommandMap } from "../../services/commandsbus/commandsbus";
|
|
3
|
+
export type EditorRect = Omit<BlockRect, "parentScrollTop" | "parentScrollLeft"> & {
|
|
4
|
+
clientTop: number;
|
|
5
|
+
clientLeft: number;
|
|
6
|
+
scrollTop: number;
|
|
7
|
+
scrollLeft: number;
|
|
8
|
+
};
|
|
9
|
+
export type OverlayPosition = {
|
|
10
|
+
top: number;
|
|
11
|
+
left: number;
|
|
12
|
+
width: number;
|
|
13
|
+
height: number;
|
|
14
|
+
};
|
|
15
|
+
/** Viewport block rects → `position: absolute` inside the scroll container. */
|
|
16
|
+
export declare function overlayPositionFromBlockRects(rects: readonly BlockRect[], editorRect: EditorRect | null): OverlayPosition | null;
|
|
17
|
+
declare module "../modules-manager" {
|
|
18
|
+
interface ModuleMap {
|
|
19
|
+
editor: {};
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
declare module "../../services/state/state" {
|
|
23
|
+
interface StateMap {
|
|
24
|
+
editor: {
|
|
25
|
+
editorRect: EditorRect | null;
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
declare module "../../services/commandsbus/commandsbus" {
|
|
30
|
+
interface CommandMap {
|
|
31
|
+
"editor.rect": {
|
|
32
|
+
payload: {
|
|
33
|
+
editorRect: EditorRect;
|
|
34
|
+
};
|
|
35
|
+
result: void;
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
declare module "../../services/eventbus/eventbus" {
|
|
40
|
+
interface TEventMap {
|
|
41
|
+
"editor:rect": CommandMap["editor.rect"]["payload"];
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
export declare const EditorModule: TModule;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { type BlockId } from "@coorax/schema";
|
|
2
|
+
import type { CommandMap } from "../../services/commandsbus";
|
|
3
|
+
import type { StateMap } from "../../services/state";
|
|
4
|
+
import type { BlockRect, TModule } from "../modules.types";
|
|
5
|
+
declare module "../modules-manager" {
|
|
6
|
+
interface ModuleMap {
|
|
7
|
+
focus: {};
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
declare module "../../services/state/state" {
|
|
11
|
+
interface StateMap {
|
|
12
|
+
focus: {
|
|
13
|
+
id: BlockId;
|
|
14
|
+
rect: BlockRect;
|
|
15
|
+
} | null;
|
|
16
|
+
focus_memory: {
|
|
17
|
+
blocks: {
|
|
18
|
+
id: BlockId;
|
|
19
|
+
rect: BlockRect;
|
|
20
|
+
}[];
|
|
21
|
+
count: number;
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
declare module "../../services/commandsbus/commandsbus" {
|
|
26
|
+
interface CommandMap {
|
|
27
|
+
"blocks.focus": {
|
|
28
|
+
payload: StateMap["focus"];
|
|
29
|
+
result: void;
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
declare module "../../services/eventbus/eventbus" {
|
|
34
|
+
interface TEventMap {
|
|
35
|
+
"blocks:focus": CommandMap["blocks.focus"]["payload"];
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
declare module "../../services/ui/ui" {
|
|
39
|
+
interface SlotComponentMap {
|
|
40
|
+
FocusOverlay: {
|
|
41
|
+
position: {
|
|
42
|
+
top: number;
|
|
43
|
+
left: number;
|
|
44
|
+
width: number;
|
|
45
|
+
height: number;
|
|
46
|
+
} | null;
|
|
47
|
+
hidden: boolean;
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
interface ComponentContributionIdentityMap {
|
|
51
|
+
"focus-overlay": {};
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
export declare const FocusModule: TModule;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type { TModule } from "../modules.types";
|
|
2
|
+
declare module "../modules-manager" {
|
|
3
|
+
interface ModuleMap {
|
|
4
|
+
history: {};
|
|
5
|
+
}
|
|
6
|
+
}
|
|
7
|
+
declare module "../../services/state/state" {
|
|
8
|
+
interface StateMap {
|
|
9
|
+
history: {
|
|
10
|
+
canUndo: boolean;
|
|
11
|
+
canRedo: boolean;
|
|
12
|
+
};
|
|
13
|
+
"history:stack": {
|
|
14
|
+
size: number;
|
|
15
|
+
cursor: number;
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
declare module "../../services/commandsbus/commandsbus" {
|
|
20
|
+
interface CommandMap {
|
|
21
|
+
"history.undo": {
|
|
22
|
+
payload: {};
|
|
23
|
+
result: void;
|
|
24
|
+
};
|
|
25
|
+
"history.redo": {
|
|
26
|
+
payload: {};
|
|
27
|
+
result: void;
|
|
28
|
+
};
|
|
29
|
+
"history.cleanup": {
|
|
30
|
+
payload: {};
|
|
31
|
+
result: void;
|
|
32
|
+
};
|
|
33
|
+
"history.move": {
|
|
34
|
+
payload: {
|
|
35
|
+
cursor: number;
|
|
36
|
+
};
|
|
37
|
+
result: void;
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
export declare const HistoryModule: TModule;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import type { BlockId } from "@coorax/schema";
|
|
2
|
+
import type { StateMap } from "../../services/state";
|
|
3
|
+
import type { BlockRect, TModule } from "../modules.types";
|
|
4
|
+
declare module "../modules-manager" {
|
|
5
|
+
interface ModuleMap {
|
|
6
|
+
hover: {};
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
declare module "../../services/state/state" {
|
|
10
|
+
interface StateMap {
|
|
11
|
+
hover: {
|
|
12
|
+
id: BlockId;
|
|
13
|
+
rect: BlockRect;
|
|
14
|
+
} | null;
|
|
15
|
+
hover_memory: {
|
|
16
|
+
blocks: {
|
|
17
|
+
id: BlockId;
|
|
18
|
+
rect: BlockRect;
|
|
19
|
+
}[];
|
|
20
|
+
count: number;
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
declare module "../../services/commandsbus/commandsbus" {
|
|
25
|
+
interface CommandMap {
|
|
26
|
+
"blocks.hover": {
|
|
27
|
+
payload: StateMap["hover"];
|
|
28
|
+
result: void;
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
declare module "../../services/eventbus/eventbus" {
|
|
33
|
+
interface TEventMap {
|
|
34
|
+
"blocks:hover": StateMap["hover"];
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
declare module "../../services/ui/ui" {
|
|
38
|
+
interface SlotComponentMap {
|
|
39
|
+
HoverOverlay: {
|
|
40
|
+
position: {
|
|
41
|
+
top: number;
|
|
42
|
+
left: number;
|
|
43
|
+
width: number;
|
|
44
|
+
height: number;
|
|
45
|
+
} | null;
|
|
46
|
+
hidden: boolean;
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
interface ComponentContributionIdentityMap {
|
|
50
|
+
"hover-overlay": {};
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
export declare const HoverModule: TModule;
|
|
@@ -6,5 +6,7 @@ export * from "./modules-manager";
|
|
|
6
6
|
export * from "./hover/hover.module";
|
|
7
7
|
export * from "./history/history.module";
|
|
8
8
|
export * from "./text-editing/text-editing.module";
|
|
9
|
-
export * from "./text-editing/text-editing.utils";
|
|
10
9
|
export * from "./editor/editor.module";
|
|
10
|
+
export * from "./code/code.module";
|
|
11
|
+
export * from "./caption/caption.module";
|
|
12
|
+
export * from "./deletion/deletion.module";
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { type Block, type BlockId, type FieldId, type FieldType } from "@coorax/schema";
|
|
2
|
+
import type { CommandMap } from "../../services/commandsbus/commandsbus";
|
|
3
|
+
import type { TModule } from "../modules.types";
|
|
4
|
+
declare module "../../services/commandsbus/commandsbus" {
|
|
5
|
+
interface CommandMap {
|
|
6
|
+
"blocks.insert": {
|
|
7
|
+
payload: {
|
|
8
|
+
block: Block;
|
|
9
|
+
pos?: number;
|
|
10
|
+
};
|
|
11
|
+
result: void;
|
|
12
|
+
};
|
|
13
|
+
"fields.change": {
|
|
14
|
+
payload: {
|
|
15
|
+
fieldId: FieldId;
|
|
16
|
+
type: FieldType;
|
|
17
|
+
};
|
|
18
|
+
result: void;
|
|
19
|
+
};
|
|
20
|
+
"blocks.delete": {
|
|
21
|
+
payload: {
|
|
22
|
+
blockId: BlockId;
|
|
23
|
+
};
|
|
24
|
+
result: void;
|
|
25
|
+
};
|
|
26
|
+
"actions.toggle": {
|
|
27
|
+
payload: boolean;
|
|
28
|
+
result: void;
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
declare module "../../services/eventbus/eventbus" {
|
|
33
|
+
interface TEventMap {
|
|
34
|
+
"blocks:insert": CommandMap["blocks.insert"]["payload"];
|
|
35
|
+
"fields:change": CommandMap["fields.change"]["payload"];
|
|
36
|
+
"blocks:delete": CommandMap["blocks.delete"]["payload"];
|
|
37
|
+
"actions:toggle": CommandMap["actions.toggle"]["payload"];
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
declare module "../../services/state/state" {
|
|
41
|
+
interface StateMap {
|
|
42
|
+
insertion: boolean;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
declare module "../modules-manager" {
|
|
46
|
+
interface ModuleMap {
|
|
47
|
+
insertion: {};
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
declare module "../../services/ui/ui" {
|
|
51
|
+
interface ButtonContributionIdentityMap {
|
|
52
|
+
"insert-field": {};
|
|
53
|
+
"insert-heading": {};
|
|
54
|
+
"insert-text": {};
|
|
55
|
+
"insert-image": {};
|
|
56
|
+
"insert-video": {};
|
|
57
|
+
"insert-divider": {};
|
|
58
|
+
"insert-iframe": {};
|
|
59
|
+
"insert-doc": {};
|
|
60
|
+
"insert-blockquote": {};
|
|
61
|
+
"insert-code": {};
|
|
62
|
+
}
|
|
63
|
+
interface IconMap {
|
|
64
|
+
DividerIcon: {};
|
|
65
|
+
YoutubeIcon: {};
|
|
66
|
+
FileTextIcon: {};
|
|
67
|
+
QuoteIcon: {};
|
|
68
|
+
CodeIcon: {};
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
export declare const InsertionModule: TModule;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import type { Engine } from "../engine/engine";
|
|
2
|
+
import type { TModule } from "./modules.types";
|
|
3
|
+
export interface ModuleMap {
|
|
4
|
+
}
|
|
5
|
+
export type ModuleName = keyof ModuleMap;
|
|
6
|
+
export interface ModuleManagerInterface {
|
|
7
|
+
register(modules: TModule[]): void;
|
|
8
|
+
isEnabled(name: ModuleName): boolean;
|
|
9
|
+
isRegistered(name: ModuleName): boolean;
|
|
10
|
+
enable(name: ModuleName): void;
|
|
11
|
+
enableAll(): void;
|
|
12
|
+
disable(name: ModuleName, opts?: {
|
|
13
|
+
cascade?: boolean;
|
|
14
|
+
}): void;
|
|
15
|
+
disabledAll(): void;
|
|
16
|
+
unregister(name: ModuleName): void;
|
|
17
|
+
}
|
|
18
|
+
export declare class ModuleManager implements ModuleManagerInterface {
|
|
19
|
+
private registry;
|
|
20
|
+
private active;
|
|
21
|
+
private engine;
|
|
22
|
+
constructor(engine: Engine);
|
|
23
|
+
register(modules: TModule[]): void;
|
|
24
|
+
isEnabled(name: ModuleName): boolean;
|
|
25
|
+
isRegistered(name: ModuleName): boolean;
|
|
26
|
+
enable(name: ModuleName): void;
|
|
27
|
+
enableAll(): void;
|
|
28
|
+
disabledAll(): void;
|
|
29
|
+
disable(name: ModuleName, opts?: {
|
|
30
|
+
cascade?: boolean;
|
|
31
|
+
}): void;
|
|
32
|
+
unregister(name: ModuleName): void;
|
|
33
|
+
/**
|
|
34
|
+
* Enable module recursively
|
|
35
|
+
*
|
|
36
|
+
* @param name string
|
|
37
|
+
* @param stack string[]
|
|
38
|
+
* @returns void
|
|
39
|
+
*/
|
|
40
|
+
private enableRec;
|
|
41
|
+
private activate;
|
|
42
|
+
private activeDependentsOf;
|
|
43
|
+
}
|
|
@@ -8,40 +8,35 @@ import type { TextMarksInterface } from "../services/text-marks/text-marks";
|
|
|
8
8
|
import type { UiInterface } from "../services/ui/ui";
|
|
9
9
|
import type { TasksInterface } from "../services/tasks/tasks.service";
|
|
10
10
|
import type { ModuleName } from "./modules-manager";
|
|
11
|
-
|
|
12
11
|
export type TModuleCtx = {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
12
|
+
readonly events: EventBusInterface;
|
|
13
|
+
readonly commands: CommandsInterface;
|
|
14
|
+
readonly mutations: MutationsInterface;
|
|
15
|
+
readonly shortcuts: ShortcutsInterface;
|
|
16
|
+
readonly state: StateInterface;
|
|
17
|
+
readonly document: DocumentInterface;
|
|
18
|
+
readonly ui: UiInterface;
|
|
19
|
+
readonly text: TextMarksInterface;
|
|
20
|
+
readonly tasks: TasksInterface;
|
|
22
21
|
};
|
|
23
|
-
|
|
24
22
|
export type ModuleDisposer = () => void;
|
|
25
|
-
|
|
26
23
|
export interface TModule {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
install(ctx: TModuleCtx): void | ModuleDisposer;
|
|
24
|
+
readonly name: ModuleName;
|
|
25
|
+
readonly version: string;
|
|
26
|
+
readonly requires: ReadonlyArray<ModuleName>;
|
|
27
|
+
install(ctx: TModuleCtx): void | ModuleDisposer;
|
|
32
28
|
}
|
|
33
|
-
|
|
34
29
|
export type BlockRect = {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
30
|
+
top: number;
|
|
31
|
+
left: number;
|
|
32
|
+
right: number;
|
|
33
|
+
width: number;
|
|
34
|
+
height: number;
|
|
35
|
+
bottom: number;
|
|
36
|
+
offsetTop: number;
|
|
37
|
+
offsetLeft: number;
|
|
38
|
+
offsetWidth: number;
|
|
39
|
+
offsetHeight: number;
|
|
40
|
+
parentScrollTop: number;
|
|
41
|
+
parentScrollLeft: number;
|
|
47
42
|
};
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import type { BlockId } from "@coorax/schema";
|
|
2
|
+
import type { CommandMap } from "../../services/commandsbus/commandsbus";
|
|
3
|
+
import type { StateMap } from "../../services/state";
|
|
4
|
+
import type { BlockRect, TModule } from "../modules.types";
|
|
5
|
+
export type SelectedBlocks = Map<BlockId, BlockRect>;
|
|
6
|
+
type SelectMode = "replace" | "add" | "toggle" | "remove";
|
|
7
|
+
declare module "../../services/commandsbus/commandsbus" {
|
|
8
|
+
interface CommandMap {
|
|
9
|
+
"blocks.select": {
|
|
10
|
+
payload: {
|
|
11
|
+
blocks: StateMap["selection"]["blocks"];
|
|
12
|
+
mode?: SelectMode;
|
|
13
|
+
};
|
|
14
|
+
result: void;
|
|
15
|
+
};
|
|
16
|
+
"blocks.clearSelection": {
|
|
17
|
+
payload: void;
|
|
18
|
+
result: void;
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
declare module "../../services/eventbus/eventbus" {
|
|
23
|
+
interface TEventMap {
|
|
24
|
+
"blocks:select": CommandMap["blocks.select"]["payload"];
|
|
25
|
+
"selection:changed": {
|
|
26
|
+
blocks: StateMap["selection"]["blocks"];
|
|
27
|
+
previous: StateMap["selection"]["blocks"];
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
declare module "../../services/state/state" {
|
|
32
|
+
interface StateMap {
|
|
33
|
+
selection: {
|
|
34
|
+
blocks: SelectedBlocks;
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
declare module "../modules-manager" {
|
|
39
|
+
interface ModuleMap {
|
|
40
|
+
selection: {};
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
declare module "../../services/ui/ui" {
|
|
44
|
+
interface SlotComponentMap {
|
|
45
|
+
SelectionOverlay: {
|
|
46
|
+
position: {
|
|
47
|
+
top: number;
|
|
48
|
+
left: number;
|
|
49
|
+
width: number;
|
|
50
|
+
height: number;
|
|
51
|
+
} | null;
|
|
52
|
+
hidden: boolean;
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
interface ComponentContributionIdentityMap {
|
|
56
|
+
"selection-overlay": {};
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
export declare const SelectionModule: TModule;
|
|
60
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { type FieldId, type FieldTextContentPath, type Mark, type MarkAttrs, type MarkSpec, type MarkType } from "@coorax/schema";
|
|
2
|
+
import type { CommandMap } from "../../services/commandsbus";
|
|
3
|
+
import type { TModule } from "../modules.types";
|
|
4
|
+
export type TextSelection = {
|
|
5
|
+
blockId: FieldId;
|
|
6
|
+
path: FieldTextContentPath;
|
|
7
|
+
start: number;
|
|
8
|
+
end: number;
|
|
9
|
+
/** Marks du prochain caractère tapé (curseur sans sélection). null = comportement automatique. */
|
|
10
|
+
pendingMarks: readonly MarkSpec[] | null;
|
|
11
|
+
};
|
|
12
|
+
declare module "../modules-manager" {
|
|
13
|
+
interface ModuleMap {
|
|
14
|
+
"text-editing": {};
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
declare module "../../services/ui/ui" {
|
|
18
|
+
interface ButtonContributionIdentityMap {
|
|
19
|
+
"format-bold": {};
|
|
20
|
+
"format-italic": {};
|
|
21
|
+
"format-underline": {};
|
|
22
|
+
"format-link": {};
|
|
23
|
+
"format-code": {};
|
|
24
|
+
"format-initial": {};
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
declare module "../../services/state/state" {
|
|
28
|
+
interface StateMap {
|
|
29
|
+
textSelection: TextSelection | null;
|
|
30
|
+
currentMarks: Mark[];
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
declare module "../../services/ui/ui" {
|
|
34
|
+
interface IconMap {
|
|
35
|
+
UnderlineIcon: {};
|
|
36
|
+
ItalicIcon: {};
|
|
37
|
+
LinkIcon: {};
|
|
38
|
+
TextInitial: {};
|
|
39
|
+
}
|
|
40
|
+
interface SlotButtonPropsMap {
|
|
41
|
+
ToolBarButton: {
|
|
42
|
+
isActive: boolean;
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
declare module "../../services/commandsbus/commandsbus" {
|
|
47
|
+
interface CommandMap {
|
|
48
|
+
"text.setSelection": {
|
|
49
|
+
payload: Omit<TextSelection, "pendingMarks"> | null;
|
|
50
|
+
result: void;
|
|
51
|
+
};
|
|
52
|
+
"text.format": {
|
|
53
|
+
payload: {
|
|
54
|
+
format: MarkType;
|
|
55
|
+
attrs?: MarkAttrs;
|
|
56
|
+
};
|
|
57
|
+
result: void;
|
|
58
|
+
};
|
|
59
|
+
"text.insert": {
|
|
60
|
+
payload: {
|
|
61
|
+
text: string;
|
|
62
|
+
};
|
|
63
|
+
result: void;
|
|
64
|
+
};
|
|
65
|
+
"text.delete": {
|
|
66
|
+
payload: {
|
|
67
|
+
direction?: "backward" | "forward";
|
|
68
|
+
type?: "word" | "character";
|
|
69
|
+
};
|
|
70
|
+
result: void;
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
declare module "../../services/eventbus/eventbus" {
|
|
75
|
+
interface TEventMap {
|
|
76
|
+
"text:setSelection": CommandMap["text.setSelection"]["payload"];
|
|
77
|
+
"text:format": CommandMap["text.format"]["payload"];
|
|
78
|
+
"text:insert": CommandMap["text.insert"]["payload"];
|
|
79
|
+
"text:delete": CommandMap["text.delete"]["payload"];
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
export declare const TextEditingModule: TModule;
|