markloom 0.5.1 → 0.7.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.
Files changed (73) hide show
  1. package/PACKAGES.md +26 -0
  2. package/README.md +20 -2
  3. package/collab.md +60 -13
  4. package/dist/ai/index.cjs +5 -4
  5. package/dist/ai/index.d.cts +5 -4
  6. package/dist/ai/index.d.ts +5 -4
  7. package/dist/ai/index.js +4 -3
  8. package/dist/ai/theme.css +66 -102
  9. package/dist/{chunk-ZMTLSFLO.js → chunk-4Q7PAR2T.js} +5746 -1341
  10. package/dist/chunk-75EJ4ARB.cjs +642 -0
  11. package/dist/{chunk-JS527FDV.cjs → chunk-BMPCVT3B.cjs} +47 -39
  12. package/dist/{chunk-RLTHVQNQ.js → chunk-EFYT2223.js} +47 -39
  13. package/dist/chunk-HXABDVLZ.cjs +297 -0
  14. package/dist/{chunk-YIFOGP2D.cjs → chunk-I2LDEVLA.cjs} +499 -102
  15. package/dist/chunk-MQLRZQZL.js +642 -0
  16. package/dist/chunk-OVHASRID.cjs +4279 -0
  17. package/dist/chunk-PCSVBPOR.cjs +40 -0
  18. package/dist/{chunk-FCH7LZFI.js → chunk-PSAXWBNM.js} +450 -53
  19. package/dist/chunk-PZRWTLLB.cjs +858 -0
  20. package/dist/chunk-QO7JEZDB.js +4279 -0
  21. package/dist/chunk-WSJUXPAG.js +40 -0
  22. package/dist/{chunk-VXM7Q6P5.cjs → chunk-Y4IXQFWL.cjs} +6026 -1621
  23. package/dist/chunk-YLVSMDIO.js +858 -0
  24. package/dist/chunk-ZL6WT6OY.js +297 -0
  25. package/dist/client-BvvyHjhh.d.ts +250 -0
  26. package/dist/client-Ciy7Fa_k.d.cts +250 -0
  27. package/dist/collab/index.cjs +17 -4
  28. package/dist/collab/index.d.cts +18 -7
  29. package/dist/collab/index.d.ts +18 -7
  30. package/dist/collab/index.js +19 -6
  31. package/dist/{controller-DQITsFhy.d.cts → controller-CHznEhAR.d.cts} +277 -26
  32. package/dist/{controller-BNuuUM3E.d.ts → controller-DLqI8_jm.d.ts} +277 -26
  33. package/dist/index.cjs +119 -7
  34. package/dist/index.d.cts +138 -6
  35. package/dist/index.d.ts +138 -6
  36. package/dist/index.js +130 -18
  37. package/dist/io/index.cjs +1412 -0
  38. package/dist/io/index.d.cts +33 -0
  39. package/dist/io/index.d.ts +33 -0
  40. package/dist/io/index.js +1412 -0
  41. package/dist/react/index.cjs +9 -8
  42. package/dist/react/index.d.cts +5 -4
  43. package/dist/react/index.d.ts +5 -4
  44. package/dist/react/index.js +8 -7
  45. package/dist/{rebase-batch-8rL_aXEE.d.ts → rebase-batch-CSnv8FKp.d.ts} +11 -9
  46. package/dist/{rebase-batch-bYnBJpRO.d.cts → rebase-batch-DO1ygkx9.d.cts} +11 -9
  47. package/dist/types-BkHlmUFL.d.cts +34 -0
  48. package/dist/types-BkHlmUFL.d.ts +34 -0
  49. package/dist/versions-DNFf8zVz.d.cts +51 -0
  50. package/dist/versions-DOkOyh2J.d.ts +51 -0
  51. package/dist/view/index.cjs +259 -17
  52. package/dist/view/index.d.cts +277 -12
  53. package/dist/view/index.d.ts +277 -12
  54. package/dist/view/index.js +256 -14
  55. package/dist/view/theme.css +2093 -1577
  56. package/dist/word-count-BPw9G2Bg.d.ts +130 -0
  57. package/dist/word-count-DNLn1h_t.d.cts +130 -0
  58. package/io.md +38 -0
  59. package/package.json +25 -4
  60. package/dist/chunk-4JSJAHTB.js +0 -255
  61. package/dist/chunk-4TMHVNL6.cjs +0 -2297
  62. package/dist/chunk-ALZ3A5CS.cjs +0 -255
  63. package/dist/chunk-GQ2HHRGI.cjs +0 -16
  64. package/dist/chunk-LA5SBCGQ.js +0 -16
  65. package/dist/chunk-LEYAQNJA.js +0 -220
  66. package/dist/chunk-MFYF2A6U.js +0 -2297
  67. package/dist/chunk-YXQDCW4Y.cjs +0 -220
  68. package/dist/client-6KiH4kGK.d.ts +0 -144
  69. package/dist/client-ZRZj2nkq.d.cts +0 -144
  70. package/dist/comments-DlExS6f-.d.cts +0 -43
  71. package/dist/comments-PhnR7Gkn.d.ts +0 -43
  72. package/dist/step-BrvHIK7O.d.cts +0 -65
  73. package/dist/step-BrvHIK7O.d.ts +0 -65
@@ -1,220 +0,0 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
2
-
3
-
4
-
5
-
6
- var _chunk4TMHVNL6cjs = require('./chunk-4TMHVNL6.cjs');
7
-
8
-
9
-
10
-
11
- var _chunkGQ2HHRGIcjs = require('./chunk-GQ2HHRGI.cjs');
12
-
13
- // src/tree/history.ts
14
- function init(doc, validate) {
15
- return { doc, past: [], future: [], validate };
16
- }
17
- function gate(h, next) {
18
- const v = _optionalChain([h, 'access', _ => _.validate, 'optionalCall', _2 => _2(next)]);
19
- if (v)
20
- throw new Error(`[invariant] \u63D0\u4EA4\u4EA7\u751F\u975E\u6CD5 doc: ${v}`);
21
- }
22
- function commit(h, steps) {
23
- const inverse = _chunk4TMHVNL6cjs.invertAll.call(void 0, h.doc, steps);
24
- const next = _chunk4TMHVNL6cjs.applyAll.call(void 0, h.doc, steps);
25
- gate(h, next);
26
- return { ...h, doc: next, past: h.past.concat({ steps, inverse }), future: [] };
27
- }
28
- function amend(h, more) {
29
- if (more.length === 0)
30
- return h;
31
- if (h.past.length === 0)
32
- return commit(h, more);
33
- const last = h.past[h.past.length - 1];
34
- const before = _chunk4TMHVNL6cjs.applyAll.call(void 0, h.doc, last.inverse);
35
- const steps = last.steps.concat(more);
36
- const inverse = _chunk4TMHVNL6cjs.invertAll.call(void 0, before, steps);
37
- const next = _chunk4TMHVNL6cjs.applyAll.call(void 0, before, steps);
38
- gate(h, next);
39
- return {
40
- ...h,
41
- doc: next,
42
- past: h.past.slice(0, -1).concat({ steps, inverse }),
43
- future: []
44
- };
45
- }
46
- function undo(h) {
47
- const last = h.past[h.past.length - 1];
48
- if (!last)
49
- return h;
50
- const next = _chunk4TMHVNL6cjs.applyAll.call(void 0, h.doc, last.inverse);
51
- gate(h, next);
52
- return { ...h, doc: next, past: h.past.slice(0, -1), future: [last, ...h.future] };
53
- }
54
- function redo(h) {
55
- const next = h.future[0];
56
- if (!next)
57
- return h;
58
- const doc = _chunk4TMHVNL6cjs.applyAll.call(void 0, h.doc, next.steps);
59
- gate(h, doc);
60
- return { ...h, doc, past: h.past.concat(next), future: h.future.slice(1) };
61
- }
62
-
63
- // src/tree/invariants.ts
64
- function invariants(schema, doc) {
65
- const out = [];
66
- out.push(..._chunk4TMHVNL6cjs.validateAll.call(void 0, schema, doc));
67
- const ids = /* @__PURE__ */ new Map();
68
- walk(doc, [], schema, out, ids);
69
- return out;
70
- }
71
- function walk(node, path, schema, out, ids) {
72
- if (_chunkGQ2HHRGIcjs.isText.call(void 0, node)) {
73
- return;
74
- }
75
- if (node.id !== void 0) {
76
- ids.set(node.id, (_nullishCoalesce(ids.get(node.id), () => ( 0))) + 1);
77
- if (ids.get(node.id) === 2) {
78
- out.push({ path, reason: `\u91CD\u590D id "${node.id}"` });
79
- }
80
- }
81
- const spec = schema.nodes[node.type];
82
- if (_optionalChain([spec, 'optionalAccess', _3 => _3.atom])) {
83
- if (node.type === "image") {
84
- if (!_optionalChain([node, 'access', _4 => _4.attrs, 'optionalAccess', _5 => _5.url]))
85
- out.push({ path, reason: `[image] \u7F3A url` });
86
- return;
87
- }
88
- if (node.type === "mention") {
89
- if (!_optionalChain([node, 'access', _6 => _6.attrs, 'optionalAccess', _7 => _7.id]))
90
- out.push({ path, reason: `[mention] \u7F3A id` });
91
- return;
92
- }
93
- if (node.type === "math") {
94
- if (typeof _optionalChain([node, 'access', _8 => _8.attrs, 'optionalAccess', _9 => _9.latex]) !== "string")
95
- out.push({ path, reason: `[math] \u7F3A latex` });
96
- return;
97
- }
98
- if (node.type === "embed") {
99
- if (!_optionalChain([node, 'access', _10 => _10.attrs, 'optionalAccess', _11 => _11.kind]))
100
- out.push({ path, reason: `[embed] \u7F3A kind` });
101
- if (!_optionalChain([node, 'access', _12 => _12.attrs, 'optionalAccess', _13 => _13.src]))
102
- out.push({ path, reason: `[embed] \u7F3A src` });
103
- return;
104
- }
105
- for (const reason of _chunk4TMHVNL6cjs.checkTable.call(void 0, node)) {
106
- out.push({ path, reason: `[table] ${reason}` });
107
- }
108
- return;
109
- }
110
- if (_optionalChain([spec, 'optionalAccess', _14 => _14.marks])) {
111
- for (let i = 0; i < node.children.length; i++) {
112
- const child = node.children[i];
113
- if (_chunkGQ2HHRGIcjs.isText.call(void 0, child) && child.marks) {
114
- for (const m of child.marks) {
115
- if (!spec.marks.includes(m.name)) {
116
- out.push({ path: path.concat(i), reason: `${node.type} \u4E0D\u5141\u8BB8 mark "${m.name}"` });
117
- }
118
- }
119
- }
120
- }
121
- }
122
- for (let i = 0; i < node.children.length; i++) {
123
- walk(node.children[i], path.concat(i), schema, out, ids);
124
- }
125
- }
126
- function firstViolation(vs) {
127
- if (vs.length === 0) {
128
- return null;
129
- }
130
- const v = vs[0];
131
- return `${v.path.join(",")}: ${v.reason}`;
132
- }
133
-
134
- // src/tree/toc.ts
135
- function headingText(node) {
136
- let out = "";
137
- for (const c of node.children) {
138
- if (_chunkGQ2HHRGIcjs.isText.call(void 0, c))
139
- out += c.text;
140
- }
141
- return out;
142
- }
143
- function outline(doc) {
144
- const out = [];
145
- const walk2 = (node, path) => {
146
- if (_chunkGQ2HHRGIcjs.isText.call(void 0, node))
147
- return;
148
- if (node.type === "heading") {
149
- const level = Math.min(Math.max(Number(_nullishCoalesce(_optionalChain([node, 'access', _15 => _15.attrs, 'optionalAccess', _16 => _16.depth]), () => ( 1))), 1), 6);
150
- out.push({ level, text: headingText(node), path, id: node.id });
151
- return;
152
- }
153
- for (let i = 0; i < node.children.length; i++)
154
- walk2(node.children[i], path.concat(i));
155
- };
156
- walk2(doc, []);
157
- return out;
158
- }
159
-
160
- // src/tree/comments.ts
161
- function commentIdsInDoc(doc) {
162
- const ids = /* @__PURE__ */ new Set();
163
- const walk2 = (n) => {
164
- if (_chunkGQ2HHRGIcjs.isText.call(void 0, n)) {
165
- for (const m of _nullishCoalesce(n.marks, () => ( []))) {
166
- if (m.name === "comment" && _optionalChain([m, 'access', _17 => _17.attrs, 'optionalAccess', _18 => _18.id]) != null)
167
- ids.add(String(m.attrs.id));
168
- }
169
- return;
170
- }
171
- if (_chunkGQ2HHRGIcjs.isElement.call(void 0, n))
172
- for (const c of n.children)
173
- walk2(c);
174
- };
175
- walk2(doc);
176
- return ids;
177
- }
178
- function stripLeaf(leaf, id) {
179
- const rest = (_nullishCoalesce(leaf.marks, () => ( []))).filter((m) => !(m.name === "comment" && String(_optionalChain([m, 'access', _19 => _19.attrs, 'optionalAccess', _20 => _20.id])) === id));
180
- return rest.length ? { ...leaf, marks: rest } : { text: leaf.text };
181
- }
182
- function stripCommentMarks(doc, id) {
183
- const steps = [];
184
- const walk2 = (node, path) => {
185
- if (node.children.every((c) => _chunkGQ2HHRGIcjs.isText.call(void 0, c) || _chunkGQ2HHRGIcjs.isInlineAtom.call(void 0, c))) {
186
- let changed = false;
187
- const children = node.children.map((c) => {
188
- if (!_chunkGQ2HHRGIcjs.isText.call(void 0, c) || !_optionalChain([c, 'access', _21 => _21.marks, 'optionalAccess', _22 => _22.some, 'call', _23 => _23((m) => m.name === "comment" && String(_optionalChain([m, 'access', _24 => _24.attrs, 'optionalAccess', _25 => _25.id])) === id)]))
189
- return c;
190
- changed = true;
191
- return stripLeaf(c, id);
192
- });
193
- if (changed)
194
- steps.push({ kind: "replaceNode", path, node: { ...node, children } });
195
- return;
196
- }
197
- node.children.forEach((c, i) => {
198
- if (_chunkGQ2HHRGIcjs.isElement.call(void 0, c))
199
- walk2(c, path.concat(i));
200
- });
201
- };
202
- doc.children.forEach((c, i) => {
203
- if (_chunkGQ2HHRGIcjs.isElement.call(void 0, c))
204
- walk2(c, [i]);
205
- });
206
- return steps;
207
- }
208
-
209
-
210
-
211
-
212
-
213
-
214
-
215
-
216
-
217
-
218
-
219
-
220
- exports.init = init; exports.commit = commit; exports.amend = amend; exports.undo = undo; exports.redo = redo; exports.invariants = invariants; exports.firstViolation = firstViolation; exports.outline = outline; exports.commentIdsInDoc = commentIdsInDoc; exports.stripCommentMarks = stripCommentMarks;
@@ -1,144 +0,0 @@
1
- import { P as Path, E as ElementNode, S as Step } from './step-BrvHIK7O.js';
2
-
3
- /** 光标/选区在协议里的轻量形态(path + offset,无 assoc) */
4
- type WireSel = {
5
- anchor: {
6
- path: Path;
7
- offset: number;
8
- };
9
- head: {
10
- path: Path;
11
- offset: number;
12
- };
13
- };
14
- type PeerInfo = {
15
- siteId: number;
16
- name?: string;
17
- color?: string;
18
- sel?: WireSel | null;
19
- };
20
- type ClientJoin = {
21
- type: 'join';
22
- room: string;
23
- name?: string;
24
- color?: string;
25
- /** 空房时用客户端 doc 初始化 */
26
- seed?: ElementNode;
27
- };
28
- type ClientOp = {
29
- type: 'op';
30
- baseVersion: number;
31
- clientSeq: number;
32
- steps: Step[];
33
- };
34
- type ClientPresence = {
35
- type: 'presence';
36
- name?: string;
37
- color?: string;
38
- sel?: WireSel | null;
39
- };
40
- type ClientPing = {
41
- type: 'ping';
42
- };
43
- type ClientMsg = ClientJoin | ClientOp | ClientPresence | ClientPing;
44
- type ServerWelcome = {
45
- type: 'welcome';
46
- siteId: number;
47
- version: number;
48
- doc: ElementNode;
49
- peers: PeerInfo[];
50
- };
51
- type ServerOp = {
52
- type: 'op';
53
- version: number;
54
- siteId: number;
55
- clientSeq?: number;
56
- steps: Step[];
57
- };
58
- type ServerPresence = {
59
- type: 'presence';
60
- siteId: number;
61
- name?: string;
62
- color?: string;
63
- sel?: WireSel | null;
64
- };
65
- type ServerPeerJoin = {
66
- type: 'peer-join';
67
- siteId: number;
68
- name?: string;
69
- color?: string;
70
- };
71
- type ServerPeerLeave = {
72
- type: 'peer-leave';
73
- siteId: number;
74
- };
75
- type ServerResync = {
76
- type: 'resync';
77
- version: number;
78
- doc: ElementNode;
79
- };
80
- type ServerError = {
81
- type: 'error';
82
- message: string;
83
- };
84
- type ServerPong = {
85
- type: 'pong';
86
- };
87
- type ServerMsg = ServerWelcome | ServerOp | ServerPresence | ServerPeerJoin | ServerPeerLeave | ServerResync | ServerError | ServerPong;
88
-
89
- type CollabConfig = {
90
- /** ws(s)://host 或 http(s)://host(自动改 scheme) */
91
- url: string;
92
- room: string;
93
- name?: string;
94
- color?: string;
95
- /** 空房初始化文档;默认由 Editor 传入当前 doc */
96
- seed?: ElementNode;
97
- };
98
- type CollabHandlers = {
99
- /** 权威快照(welcome / resync) */
100
- onDoc: (doc: ElementNode, version: number) => void;
101
- /** 已变换的远端 steps,应 applyRemote */
102
- onRemote: (steps: Step[]) => void;
103
- /** 进房成功(分配 siteId,可画本人头像) */
104
- onWelcome?: (info: {
105
- siteId: number;
106
- version: number;
107
- name?: string;
108
- color?: string;
109
- }) => void;
110
- onPeers?: (peers: PeerInfo[]) => void;
111
- onStatus?: (s: 'connecting' | 'open' | 'closed') => void;
112
- onError?: (message: string) => void;
113
- };
114
- /**
115
- * 协作会话:WS + pending OT。
116
- * Editor 调 push(localSteps);远端经 onRemote / onDoc。
117
- */
118
- declare class CollabClient {
119
- private cfg;
120
- private handlers;
121
- private ws;
122
- private closed;
123
- private retry;
124
- private reconnectTimer;
125
- siteId: number;
126
- version: number;
127
- private clientSeq;
128
- private pending;
129
- private peers;
130
- private joined;
131
- constructor(cfg: CollabConfig, handlers: CollabHandlers);
132
- get peersList(): PeerInfo[];
133
- private connect;
134
- private scheduleReconnect;
135
- private send;
136
- private onServer;
137
- /** 本地已 apply 的 steps 推上服务器 */
138
- push(steps: Step[]): void;
139
- presence(sel: WireSel | null): void;
140
- close(): void;
141
- }
142
- declare function connectCollab(cfg: CollabConfig, handlers: CollabHandlers): CollabClient;
143
-
144
- export { type ClientJoin as C, type PeerInfo as P, type ServerMsg as S, type WireSel as W, type ClientMsg as a, type ClientOp as b, CollabClient as c, type CollabConfig as d, type CollabHandlers as e, type ServerOp as f, type ServerWelcome as g, connectCollab as h };
@@ -1,144 +0,0 @@
1
- import { P as Path, E as ElementNode, S as Step } from './step-BrvHIK7O.cjs';
2
-
3
- /** 光标/选区在协议里的轻量形态(path + offset,无 assoc) */
4
- type WireSel = {
5
- anchor: {
6
- path: Path;
7
- offset: number;
8
- };
9
- head: {
10
- path: Path;
11
- offset: number;
12
- };
13
- };
14
- type PeerInfo = {
15
- siteId: number;
16
- name?: string;
17
- color?: string;
18
- sel?: WireSel | null;
19
- };
20
- type ClientJoin = {
21
- type: 'join';
22
- room: string;
23
- name?: string;
24
- color?: string;
25
- /** 空房时用客户端 doc 初始化 */
26
- seed?: ElementNode;
27
- };
28
- type ClientOp = {
29
- type: 'op';
30
- baseVersion: number;
31
- clientSeq: number;
32
- steps: Step[];
33
- };
34
- type ClientPresence = {
35
- type: 'presence';
36
- name?: string;
37
- color?: string;
38
- sel?: WireSel | null;
39
- };
40
- type ClientPing = {
41
- type: 'ping';
42
- };
43
- type ClientMsg = ClientJoin | ClientOp | ClientPresence | ClientPing;
44
- type ServerWelcome = {
45
- type: 'welcome';
46
- siteId: number;
47
- version: number;
48
- doc: ElementNode;
49
- peers: PeerInfo[];
50
- };
51
- type ServerOp = {
52
- type: 'op';
53
- version: number;
54
- siteId: number;
55
- clientSeq?: number;
56
- steps: Step[];
57
- };
58
- type ServerPresence = {
59
- type: 'presence';
60
- siteId: number;
61
- name?: string;
62
- color?: string;
63
- sel?: WireSel | null;
64
- };
65
- type ServerPeerJoin = {
66
- type: 'peer-join';
67
- siteId: number;
68
- name?: string;
69
- color?: string;
70
- };
71
- type ServerPeerLeave = {
72
- type: 'peer-leave';
73
- siteId: number;
74
- };
75
- type ServerResync = {
76
- type: 'resync';
77
- version: number;
78
- doc: ElementNode;
79
- };
80
- type ServerError = {
81
- type: 'error';
82
- message: string;
83
- };
84
- type ServerPong = {
85
- type: 'pong';
86
- };
87
- type ServerMsg = ServerWelcome | ServerOp | ServerPresence | ServerPeerJoin | ServerPeerLeave | ServerResync | ServerError | ServerPong;
88
-
89
- type CollabConfig = {
90
- /** ws(s)://host 或 http(s)://host(自动改 scheme) */
91
- url: string;
92
- room: string;
93
- name?: string;
94
- color?: string;
95
- /** 空房初始化文档;默认由 Editor 传入当前 doc */
96
- seed?: ElementNode;
97
- };
98
- type CollabHandlers = {
99
- /** 权威快照(welcome / resync) */
100
- onDoc: (doc: ElementNode, version: number) => void;
101
- /** 已变换的远端 steps,应 applyRemote */
102
- onRemote: (steps: Step[]) => void;
103
- /** 进房成功(分配 siteId,可画本人头像) */
104
- onWelcome?: (info: {
105
- siteId: number;
106
- version: number;
107
- name?: string;
108
- color?: string;
109
- }) => void;
110
- onPeers?: (peers: PeerInfo[]) => void;
111
- onStatus?: (s: 'connecting' | 'open' | 'closed') => void;
112
- onError?: (message: string) => void;
113
- };
114
- /**
115
- * 协作会话:WS + pending OT。
116
- * Editor 调 push(localSteps);远端经 onRemote / onDoc。
117
- */
118
- declare class CollabClient {
119
- private cfg;
120
- private handlers;
121
- private ws;
122
- private closed;
123
- private retry;
124
- private reconnectTimer;
125
- siteId: number;
126
- version: number;
127
- private clientSeq;
128
- private pending;
129
- private peers;
130
- private joined;
131
- constructor(cfg: CollabConfig, handlers: CollabHandlers);
132
- get peersList(): PeerInfo[];
133
- private connect;
134
- private scheduleReconnect;
135
- private send;
136
- private onServer;
137
- /** 本地已 apply 的 steps 推上服务器 */
138
- push(steps: Step[]): void;
139
- presence(sel: WireSel | null): void;
140
- close(): void;
141
- }
142
- declare function connectCollab(cfg: CollabConfig, handlers: CollabHandlers): CollabClient;
143
-
144
- export { type ClientJoin as C, type PeerInfo as P, type ServerMsg as S, type WireSel as W, type ClientMsg as a, type ClientOp as b, CollabClient as c, type CollabConfig as d, type CollabHandlers as e, type ServerOp as f, type ServerWelcome as g, connectCollab as h };
@@ -1,43 +0,0 @@
1
- import { E as ElementNode, S as Step } from './step-BrvHIK7O.cjs';
2
-
3
- interface Commit {
4
- steps: Step[];
5
- inverse: Step[];
6
- }
7
- interface History {
8
- doc: ElementNode;
9
- past: Commit[];
10
- future: Commit[];
11
- validate?: (doc: ElementNode) => string | null;
12
- }
13
- declare function init(doc: ElementNode, validate?: (doc: ElementNode) => string | null): History;
14
- declare function commit(h: History, steps: Step[]): History;
15
- declare function amend(h: History, more: Step[]): History;
16
- declare function undo(h: History): History;
17
- declare function redo(h: History): History;
18
-
19
- interface CommentAuthor {
20
- id: string;
21
- name: string;
22
- avatar?: string;
23
- }
24
- interface CommentMessage {
25
- id: string;
26
- author: CommentAuthor;
27
- body: string;
28
- createdAt: number;
29
- }
30
- interface CommentThread {
31
- id: string;
32
- resolved: boolean;
33
- quote?: string;
34
- messages: CommentMessage[];
35
- }
36
- interface CommentRenderState {
37
- resolved: Set<string>;
38
- activeId: string | null;
39
- }
40
- declare function commentIdsInDoc(doc: ElementNode): Set<string>;
41
- declare function stripCommentMarks(doc: ElementNode, id: string): Step[];
42
-
43
- export { type CommentAuthor as C, type History as H, type CommentMessage as a, type CommentRenderState as b, type CommentThread as c, type Commit as d, amend as e, commentIdsInDoc as f, commit as g, init as i, redo as r, stripCommentMarks as s, undo as u };
@@ -1,43 +0,0 @@
1
- import { E as ElementNode, S as Step } from './step-BrvHIK7O.js';
2
-
3
- interface Commit {
4
- steps: Step[];
5
- inverse: Step[];
6
- }
7
- interface History {
8
- doc: ElementNode;
9
- past: Commit[];
10
- future: Commit[];
11
- validate?: (doc: ElementNode) => string | null;
12
- }
13
- declare function init(doc: ElementNode, validate?: (doc: ElementNode) => string | null): History;
14
- declare function commit(h: History, steps: Step[]): History;
15
- declare function amend(h: History, more: Step[]): History;
16
- declare function undo(h: History): History;
17
- declare function redo(h: History): History;
18
-
19
- interface CommentAuthor {
20
- id: string;
21
- name: string;
22
- avatar?: string;
23
- }
24
- interface CommentMessage {
25
- id: string;
26
- author: CommentAuthor;
27
- body: string;
28
- createdAt: number;
29
- }
30
- interface CommentThread {
31
- id: string;
32
- resolved: boolean;
33
- quote?: string;
34
- messages: CommentMessage[];
35
- }
36
- interface CommentRenderState {
37
- resolved: Set<string>;
38
- activeId: string | null;
39
- }
40
- declare function commentIdsInDoc(doc: ElementNode): Set<string>;
41
- declare function stripCommentMarks(doc: ElementNode, id: string): Step[];
42
-
43
- export { type CommentAuthor as C, type History as H, type CommentMessage as a, type CommentRenderState as b, type CommentThread as c, type Commit as d, amend as e, commentIdsInDoc as f, commit as g, init as i, redo as r, stripCommentMarks as s, undo as u };
@@ -1,65 +0,0 @@
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
- export { type DeleteText as D, type ElementNode as E, 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 Doc as b, type Selection as c, type SpliceChildren as d, apply as e, applyAll as f, invertAll as g, isElement as h, invert as i, isInlineAtom as j, isText as k, moveBlock as m };