markloom 0.3.0
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/README.md +125 -0
- package/dist/ai/index.cjs +19 -0
- package/dist/ai/index.d.cts +10 -0
- package/dist/ai/index.d.ts +10 -0
- package/dist/ai/index.js +19 -0
- package/dist/ai/theme.css +304 -0
- package/dist/chunk-2X6AF7XH.cjs +9030 -0
- package/dist/chunk-7Q6AXLF2.cjs +1076 -0
- package/dist/chunk-GUPMZI6Q.js +1076 -0
- package/dist/chunk-HA6XHJUD.cjs +218 -0
- package/dist/chunk-ITVAR2UM.js +218 -0
- package/dist/chunk-J3QWW6CN.js +2305 -0
- package/dist/chunk-UCNEQGMY.js +9030 -0
- package/dist/chunk-VVFIQLVR.cjs +2305 -0
- package/dist/comments-USjT1wYN.d.cts +105 -0
- package/dist/comments-USjT1wYN.d.ts +105 -0
- package/dist/controller-Dm4uLD3I.d.ts +507 -0
- package/dist/controller-cE9iEYp3.d.cts +507 -0
- package/dist/index.cjs +424 -0
- package/dist/index.d.cts +184 -0
- package/dist/index.d.ts +184 -0
- package/dist/index.js +424 -0
- package/dist/react/index.cjs +45 -0
- package/dist/react/index.d.cts +22 -0
- package/dist/react/index.d.ts +22 -0
- package/dist/react/index.js +45 -0
- package/dist/view/index.cjs +368 -0
- package/dist/view/index.d.cts +155 -0
- package/dist/view/index.d.ts +155 -0
- package/dist/view/index.js +368 -0
- package/dist/view/theme.css +2627 -0
- package/package.json +89 -0
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
interface TextNode {
|
|
2
|
+
text: string;
|
|
3
|
+
marks?: Mark[];
|
|
4
|
+
}
|
|
5
|
+
interface ElementNode {
|
|
6
|
+
type: string;
|
|
7
|
+
attrs?: Record<string, unknown>;
|
|
8
|
+
children: Node[];
|
|
9
|
+
id?: string;
|
|
10
|
+
}
|
|
11
|
+
type Node = TextNode | ElementNode;
|
|
12
|
+
interface Mark {
|
|
13
|
+
name: string;
|
|
14
|
+
attrs?: Record<string, unknown>;
|
|
15
|
+
}
|
|
16
|
+
declare function isText(n: Node): n is TextNode;
|
|
17
|
+
declare function isElement(n: Node): n is ElementNode;
|
|
18
|
+
declare function isInlineAtom(n: Node): boolean;
|
|
19
|
+
type Path = number[];
|
|
20
|
+
interface Position {
|
|
21
|
+
path: Path;
|
|
22
|
+
assoc?: -1 | 1;
|
|
23
|
+
}
|
|
24
|
+
interface Selection {
|
|
25
|
+
anchor: Position;
|
|
26
|
+
head: Position;
|
|
27
|
+
}
|
|
28
|
+
type Doc = ElementNode;
|
|
29
|
+
|
|
30
|
+
interface InsertText {
|
|
31
|
+
kind: 'insertText';
|
|
32
|
+
path: Path;
|
|
33
|
+
offset: number;
|
|
34
|
+
text: string;
|
|
35
|
+
marks?: {
|
|
36
|
+
name: string;
|
|
37
|
+
attrs?: Record<string, unknown>;
|
|
38
|
+
}[];
|
|
39
|
+
}
|
|
40
|
+
interface DeleteText {
|
|
41
|
+
kind: 'deleteText';
|
|
42
|
+
path: Path;
|
|
43
|
+
offset: number;
|
|
44
|
+
length: number;
|
|
45
|
+
}
|
|
46
|
+
interface ReplaceNode {
|
|
47
|
+
kind: 'replaceNode';
|
|
48
|
+
path: Path;
|
|
49
|
+
node: Node;
|
|
50
|
+
}
|
|
51
|
+
interface SpliceChildren {
|
|
52
|
+
kind: 'spliceChildren';
|
|
53
|
+
path: Path;
|
|
54
|
+
at: number;
|
|
55
|
+
remove: number;
|
|
56
|
+
insert: Node[];
|
|
57
|
+
}
|
|
58
|
+
type Step = InsertText | DeleteText | ReplaceNode | SpliceChildren;
|
|
59
|
+
declare function apply(doc: ElementNode, step: Step): ElementNode;
|
|
60
|
+
declare function invert(doc: ElementNode, step: Step): Step;
|
|
61
|
+
declare function applyAll(doc: ElementNode, steps: Step[]): ElementNode;
|
|
62
|
+
declare function moveBlock(doc: ElementNode, fromIdx: number, toGap: number): Step[];
|
|
63
|
+
declare function invertAll(doc: ElementNode, steps: Step[]): Step[];
|
|
64
|
+
|
|
65
|
+
interface Commit {
|
|
66
|
+
steps: Step[];
|
|
67
|
+
inverse: Step[];
|
|
68
|
+
}
|
|
69
|
+
interface History {
|
|
70
|
+
doc: ElementNode;
|
|
71
|
+
past: Commit[];
|
|
72
|
+
future: Commit[];
|
|
73
|
+
validate?: (doc: ElementNode) => string | null;
|
|
74
|
+
}
|
|
75
|
+
declare function init(doc: ElementNode, validate?: (doc: ElementNode) => string | null): History;
|
|
76
|
+
declare function commit(h: History, steps: Step[]): History;
|
|
77
|
+
declare function amend(h: History, more: Step[]): History;
|
|
78
|
+
declare function undo(h: History): History;
|
|
79
|
+
declare function redo(h: History): History;
|
|
80
|
+
|
|
81
|
+
interface CommentAuthor {
|
|
82
|
+
id: string;
|
|
83
|
+
name: string;
|
|
84
|
+
avatar?: string;
|
|
85
|
+
}
|
|
86
|
+
interface CommentMessage {
|
|
87
|
+
id: string;
|
|
88
|
+
author: CommentAuthor;
|
|
89
|
+
body: string;
|
|
90
|
+
createdAt: number;
|
|
91
|
+
}
|
|
92
|
+
interface CommentThread {
|
|
93
|
+
id: string;
|
|
94
|
+
resolved: boolean;
|
|
95
|
+
quote?: string;
|
|
96
|
+
messages: CommentMessage[];
|
|
97
|
+
}
|
|
98
|
+
interface CommentRenderState {
|
|
99
|
+
resolved: Set<string>;
|
|
100
|
+
activeId: string | null;
|
|
101
|
+
}
|
|
102
|
+
declare function commentIdsInDoc(doc: ElementNode): Set<string>;
|
|
103
|
+
declare function stripCommentMarks(doc: ElementNode, id: string): Step[];
|
|
104
|
+
|
|
105
|
+
export { type CommentAuthor as C, type DeleteText as D, type ElementNode as E, type History as H, type InsertText as I, type Mark as M, type Node as N, type Path as P, type ReplaceNode as R, type Step as S, type TextNode as T, type Position as a, type CommentMessage as b, type CommentRenderState as c, type CommentThread as d, type Commit as e, type Doc as f, type Selection as g, type SpliceChildren as h, amend as i, apply as j, applyAll as k, commentIdsInDoc as l, commit as m, init as n, invert as o, invertAll as p, isElement as q, isInlineAtom as r, isText as s, moveBlock as t, redo as u, stripCommentMarks as v, undo as w };
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
interface TextNode {
|
|
2
|
+
text: string;
|
|
3
|
+
marks?: Mark[];
|
|
4
|
+
}
|
|
5
|
+
interface ElementNode {
|
|
6
|
+
type: string;
|
|
7
|
+
attrs?: Record<string, unknown>;
|
|
8
|
+
children: Node[];
|
|
9
|
+
id?: string;
|
|
10
|
+
}
|
|
11
|
+
type Node = TextNode | ElementNode;
|
|
12
|
+
interface Mark {
|
|
13
|
+
name: string;
|
|
14
|
+
attrs?: Record<string, unknown>;
|
|
15
|
+
}
|
|
16
|
+
declare function isText(n: Node): n is TextNode;
|
|
17
|
+
declare function isElement(n: Node): n is ElementNode;
|
|
18
|
+
declare function isInlineAtom(n: Node): boolean;
|
|
19
|
+
type Path = number[];
|
|
20
|
+
interface Position {
|
|
21
|
+
path: Path;
|
|
22
|
+
assoc?: -1 | 1;
|
|
23
|
+
}
|
|
24
|
+
interface Selection {
|
|
25
|
+
anchor: Position;
|
|
26
|
+
head: Position;
|
|
27
|
+
}
|
|
28
|
+
type Doc = ElementNode;
|
|
29
|
+
|
|
30
|
+
interface InsertText {
|
|
31
|
+
kind: 'insertText';
|
|
32
|
+
path: Path;
|
|
33
|
+
offset: number;
|
|
34
|
+
text: string;
|
|
35
|
+
marks?: {
|
|
36
|
+
name: string;
|
|
37
|
+
attrs?: Record<string, unknown>;
|
|
38
|
+
}[];
|
|
39
|
+
}
|
|
40
|
+
interface DeleteText {
|
|
41
|
+
kind: 'deleteText';
|
|
42
|
+
path: Path;
|
|
43
|
+
offset: number;
|
|
44
|
+
length: number;
|
|
45
|
+
}
|
|
46
|
+
interface ReplaceNode {
|
|
47
|
+
kind: 'replaceNode';
|
|
48
|
+
path: Path;
|
|
49
|
+
node: Node;
|
|
50
|
+
}
|
|
51
|
+
interface SpliceChildren {
|
|
52
|
+
kind: 'spliceChildren';
|
|
53
|
+
path: Path;
|
|
54
|
+
at: number;
|
|
55
|
+
remove: number;
|
|
56
|
+
insert: Node[];
|
|
57
|
+
}
|
|
58
|
+
type Step = InsertText | DeleteText | ReplaceNode | SpliceChildren;
|
|
59
|
+
declare function apply(doc: ElementNode, step: Step): ElementNode;
|
|
60
|
+
declare function invert(doc: ElementNode, step: Step): Step;
|
|
61
|
+
declare function applyAll(doc: ElementNode, steps: Step[]): ElementNode;
|
|
62
|
+
declare function moveBlock(doc: ElementNode, fromIdx: number, toGap: number): Step[];
|
|
63
|
+
declare function invertAll(doc: ElementNode, steps: Step[]): Step[];
|
|
64
|
+
|
|
65
|
+
interface Commit {
|
|
66
|
+
steps: Step[];
|
|
67
|
+
inverse: Step[];
|
|
68
|
+
}
|
|
69
|
+
interface History {
|
|
70
|
+
doc: ElementNode;
|
|
71
|
+
past: Commit[];
|
|
72
|
+
future: Commit[];
|
|
73
|
+
validate?: (doc: ElementNode) => string | null;
|
|
74
|
+
}
|
|
75
|
+
declare function init(doc: ElementNode, validate?: (doc: ElementNode) => string | null): History;
|
|
76
|
+
declare function commit(h: History, steps: Step[]): History;
|
|
77
|
+
declare function amend(h: History, more: Step[]): History;
|
|
78
|
+
declare function undo(h: History): History;
|
|
79
|
+
declare function redo(h: History): History;
|
|
80
|
+
|
|
81
|
+
interface CommentAuthor {
|
|
82
|
+
id: string;
|
|
83
|
+
name: string;
|
|
84
|
+
avatar?: string;
|
|
85
|
+
}
|
|
86
|
+
interface CommentMessage {
|
|
87
|
+
id: string;
|
|
88
|
+
author: CommentAuthor;
|
|
89
|
+
body: string;
|
|
90
|
+
createdAt: number;
|
|
91
|
+
}
|
|
92
|
+
interface CommentThread {
|
|
93
|
+
id: string;
|
|
94
|
+
resolved: boolean;
|
|
95
|
+
quote?: string;
|
|
96
|
+
messages: CommentMessage[];
|
|
97
|
+
}
|
|
98
|
+
interface CommentRenderState {
|
|
99
|
+
resolved: Set<string>;
|
|
100
|
+
activeId: string | null;
|
|
101
|
+
}
|
|
102
|
+
declare function commentIdsInDoc(doc: ElementNode): Set<string>;
|
|
103
|
+
declare function stripCommentMarks(doc: ElementNode, id: string): Step[];
|
|
104
|
+
|
|
105
|
+
export { type CommentAuthor as C, type DeleteText as D, type ElementNode as E, type History as H, type InsertText as I, type Mark as M, type Node as N, type Path as P, type ReplaceNode as R, type Step as S, type TextNode as T, type Position as a, type CommentMessage as b, type CommentRenderState as c, type CommentThread as d, type Commit as e, type Doc as f, type Selection as g, type SpliceChildren as h, amend as i, apply as j, applyAll as k, commentIdsInDoc as l, commit as m, init as n, invert as o, invertAll as p, isElement as q, isInlineAtom as r, isText as s, moveBlock as t, redo as u, stripCommentMarks as v, undo as w };
|