markloom 0.3.0 → 0.5.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 (52) hide show
  1. package/README.md +29 -16
  2. package/ai.md +160 -0
  3. package/collab.md +68 -0
  4. package/dist/ai/index.cjs +4 -3
  5. package/dist/ai/index.d.cts +4 -2
  6. package/dist/ai/index.d.ts +4 -2
  7. package/dist/ai/index.js +5 -4
  8. package/dist/ai/theme.css +63 -63
  9. package/dist/{chunk-VVFIQLVR.cjs → chunk-4TMHVNL6.cjs} +71 -79
  10. package/dist/chunk-6DCI7AL3.js +208 -0
  11. package/dist/chunk-AC5E42NH.cjs +208 -0
  12. package/dist/chunk-GQ2HHRGI.cjs +16 -0
  13. package/dist/{chunk-GUPMZI6Q.js → chunk-JMOJU5EU.js} +7 -5
  14. package/dist/chunk-JS527FDV.cjs +294 -0
  15. package/dist/chunk-LA5SBCGQ.js +16 -0
  16. package/dist/{chunk-ITVAR2UM.js → chunk-LEYAQNJA.js} +5 -3
  17. package/dist/{chunk-J3QWW6CN.js → chunk-MFYF2A6U.js} +5 -13
  18. package/dist/chunk-RLTHVQNQ.js +294 -0
  19. package/dist/{chunk-7Q6AXLF2.cjs → chunk-SLRD6FMP.cjs} +30 -28
  20. package/dist/{chunk-UCNEQGMY.js → chunk-WUHTCCAE.js} +391 -332
  21. package/dist/{chunk-2X6AF7XH.cjs → chunk-YJAWPRJW.cjs} +722 -663
  22. package/dist/{chunk-HA6XHJUD.cjs → chunk-YXQDCW4Y.cjs} +22 -20
  23. package/dist/client-A0ZQJnyR.d.ts +137 -0
  24. package/dist/client-BNams4wv.d.cts +137 -0
  25. package/dist/collab/index.cjs +19 -0
  26. package/dist/collab/index.d.cts +3 -0
  27. package/dist/collab/index.d.ts +3 -0
  28. package/dist/collab/index.js +19 -0
  29. package/dist/comments-DlExS6f-.d.cts +43 -0
  30. package/dist/comments-PhnR7Gkn.d.ts +43 -0
  31. package/dist/{controller-Dm4uLD3I.d.ts → controller-BkY1VPzc.d.ts} +24 -8
  32. package/dist/{controller-cE9iEYp3.d.cts → controller-CVIZI--A.d.cts} +24 -8
  33. package/dist/index.cjs +21 -243
  34. package/dist/index.d.cts +5 -7
  35. package/dist/index.d.ts +5 -7
  36. package/dist/index.js +22 -244
  37. package/dist/react/index.cjs +12 -9
  38. package/dist/react/index.d.cts +7 -5
  39. package/dist/react/index.d.ts +7 -5
  40. package/dist/react/index.js +12 -9
  41. package/dist/rebase-batch-8rL_aXEE.d.ts +38 -0
  42. package/dist/rebase-batch-bYnBJpRO.d.cts +38 -0
  43. package/dist/step-BrvHIK7O.d.cts +65 -0
  44. package/dist/step-BrvHIK7O.d.ts +65 -0
  45. package/dist/view/index.cjs +11 -8
  46. package/dist/view/index.d.cts +7 -5
  47. package/dist/view/index.d.ts +7 -5
  48. package/dist/view/index.js +9 -6
  49. package/dist/view/theme.css +507 -507
  50. package/package.json +10 -3
  51. package/dist/comments-USjT1wYN.d.cts +0 -105
  52. package/dist/comments-USjT1wYN.d.ts +0 -105
@@ -1,6 +1,8 @@
1
- import { E as ElementNode, S as Step, g as Selection, M as Mark, P as Path, N as Node, H as History, d as CommentThread, C as CommentAuthor } from './comments-USjT1wYN.cjs';
1
+ import { E as ElementNode, S as Step, c as Selection, M as Mark, P as Path, N as Node } from './step-BrvHIK7O.cjs';
2
2
  import * as preact from 'preact';
3
3
  import { ComponentChild } from 'preact';
4
+ import { H as History, c as CommentThread, C as CommentAuthor } from './comments-DlExS6f-.cjs';
5
+ import { d as CollabConfig, c as CollabClient } from './client-BNams4wv.cjs';
4
6
 
5
7
  interface MentionCandidate {
6
8
  id: string;
@@ -78,7 +80,7 @@ declare function renderHr(spec: ElementNode, key: number | string, ctx: BlockRen
78
80
  declare const defaultBlockRenderers: Record<string, BlockRenderer>;
79
81
  declare function renderDoc(doc: ElementNode, opts?: RenderOpts): preact.VNode<preact.ClassAttributes<HTMLElement> & {
80
82
  class: string;
81
- 'data-loom': boolean;
83
+ 'data-markloom': boolean;
82
84
  }>;
83
85
  declare function renderToHtml(doc: ElementNode, opts?: RenderOpts): string;
84
86
 
@@ -336,6 +338,11 @@ interface EditorOptions {
336
338
  * 应用只配 provider / endpoint。
337
339
  */
338
340
  ai?: boolean | AiConfig;
341
+ /**
342
+ * 实时协作(中心化 OT + WebSocket)。传 { url, room } 即连 Cloudflare worker 房间。
343
+ * 本地 dispatch 自动上行;远端 applyRemote。见 collab.md。
344
+ */
345
+ collab?: CollabConfig;
339
346
  }
340
347
  declare class Editor {
341
348
  root: HTMLElement;
@@ -354,10 +361,15 @@ declare class Editor {
354
361
  private decorations;
355
362
  /** AI 一等公民(opts.ai):斜杠 / 格式栏 / 卡片全内置 */
356
363
  private aiCtl;
364
+ /** 协作会话;applyingRemote 期间本地 steps 不上行 */
365
+ private collabCtl;
366
+ private applyingRemote;
357
367
  constructor(root: HTMLElement, doc: ElementNode, opts?: EditorOptions);
358
368
  destroy(): void;
359
369
  /** AI 控制器(opts.ai 启用时);应用工具栏可 ed.ai?.openAtFocus / stop */
360
- get ai(): LoomAi | null;
370
+ get ai(): MarkloomAi | null;
371
+ /** 协作客户端(opts.collab 启用时) */
372
+ get collab(): CollabClient | null;
361
373
  openAi(mode: 'continue' | 'rewrite'): void;
362
374
  stopAi(): void;
363
375
  get doc(): ElementNode;
@@ -371,6 +383,10 @@ declare class Editor {
371
383
  private syncPlaceholder;
372
384
  dispatch(steps: Step[], selectionAfter?: Selection): void;
373
385
  dispatchStream(steps: Step[], selectionAfter?: Selection): void;
386
+ /** 远端协作 op:写入 model 但不上行 */
387
+ applyRemote(steps: Step[], selectionAfter?: Selection): void;
388
+ /** 权威快照替换(welcome/resync);清空本地 undo 栈 */
389
+ replaceDoc(doc: ElementNode): void;
374
390
  /** 回退一笔 history(AI 事务 discard = undo 整笔) */
375
391
  undo(): boolean;
376
392
  redo(): boolean;
@@ -438,7 +454,7 @@ type AiStreamInput = {
438
454
  signal?: AbortSignal;
439
455
  };
440
456
  type AiStreamFn = (input: AiStreamInput, onToken: (text: string) => void) => Promise<void>;
441
- type LoomAiOpts = {
457
+ type MarkloomAiOpts = {
442
458
  stream: AiStreamFn;
443
459
  onError?: (message: string) => void;
444
460
  onBusy?: (busy: boolean) => void;
@@ -446,7 +462,7 @@ type LoomAiOpts = {
446
462
  type AiPromptMode = 'continue' | 'rewrite';
447
463
 
448
464
  /**
449
- * loom/ai — 一笔完整事务:
465
+ * markloom/ai — 一笔完整事务:
450
466
  *
451
467
  * begin (dispatch) 插入真·顶层段落(aiDraft) + loading
452
468
  * stream (amend) token 追加到真段落,随时可见
@@ -455,7 +471,7 @@ type AiPromptMode = 'continue' | 'rewrite';
455
471
  *
456
472
  * 段落从第一 pen 起就在 doc 里,不是影子预览;淡化只是事务未提交的视觉态。
457
473
  */
458
- declare class LoomAi {
474
+ declare class MarkloomAi {
459
475
  private getEditor;
460
476
  private opts;
461
477
  private abort;
@@ -466,7 +482,7 @@ declare class LoomAi {
466
482
  private raf;
467
483
  /** 流式累积的 Markdown 源(每帧物化成真·富文本块做预览) */
468
484
  private pendingMd;
469
- constructor(getEditor: () => Editor | null, opts: LoomAiOpts);
485
+ constructor(getEditor: () => Editor | null, opts: MarkloomAiOpts);
470
486
  destroy(): void;
471
487
  /**
472
488
  * 停止生成:
@@ -504,4 +520,4 @@ declare class LoomAi {
504
520
  private paintMd;
505
521
  }
506
522
 
507
- export { diffSpan as $, type AiConfig as A, type BlockInputRule as B, CALLOUT_VARIANTS as C, type DecorationFactory as D, type EditorOptions as E, type MentionPopoversHost as F, type MentionProfile as G, type NodeViewCtx as H, type InputResult as I, type Resolved as J, type KeymapCommand as K, LoomAi as L, type MentionCandidate as M, type NodeView as N, atomIsSelected as O, type PasteRule as P, blockTransform as Q, type RenderOpts as R, type SlashCommand as S, type TextStylePatch as T, calloutVariantFromQuery as U, caret as V, chord as W, cycleCalloutVariant as X, defaultBlockRenderers as Y, defaultBlockTag as Z, defaultMarkTag as _, type AiPromptMode as a, indentItem as a0, isAtom as a1, isOpaque as a2, leafText as a3, lineBoundaryBack as a4, lineBoundaryFwd as a5, mapInput as a6, mapPaste as a7, mapPasteBlocks as a8, marksAtCaret as a9, mergeTextStyleAttrs as aa, outdentItem as ab, renderCode as ac, renderDoc as ad, renderEmbed as ae, renderHr as af, renderImage as ag, renderTable as ah, renderToHtml as ai, resolve as aj, safeCssValue as ak, serializeSelection as al, setAlign as am, setCalloutVariant as an, setTextStyle as ao, textStyleCss as ap, toggleMark as aq, toggleMarkList as ar, twitchChannel as as, wordBoundaryBack as at, wordBoundaryFwd as au, wrapList as av, youtubeId as aw, type AiProvider as b, type AiStreamFn as c, type AiStreamInput as d, type AiWriteMode as e, type AiWriteSession as f, type LoomAiOpts as g, blockPlainText as h, createAiStream as i, focusBlockId as j, Editor as k, type Extension as l, type AtomSelectCtx as m, type BlockKind as n, type BlockRenderCtx as o, type BlockRenderer as p, type CalloutVariant as q, type DecorationHost as r, startAiWrite as s, type InputRuleCtx as t, type Intent as u, type KeymapCtx as v, type KeymapResult as w, type MentionHost as x, MentionMenu as y, MentionPopovers as z };
523
+ export { diffSpan as $, type AiConfig as A, type BlockInputRule as B, CALLOUT_VARIANTS as C, type DecorationFactory as D, type EditorOptions as E, MentionPopovers as F, type MentionPopoversHost as G, type MentionProfile as H, type InputResult as I, type NodeViewCtx as J, type KeymapCommand as K, type Resolved as L, MarkloomAi as M, type NodeView as N, atomIsSelected as O, type PasteRule as P, blockTransform as Q, type RenderOpts as R, type SlashCommand as S, type TextStylePatch as T, calloutVariantFromQuery as U, caret as V, chord as W, cycleCalloutVariant as X, defaultBlockRenderers as Y, defaultBlockTag as Z, defaultMarkTag as _, type AiPromptMode as a, indentItem as a0, isAtom as a1, isOpaque as a2, leafText as a3, lineBoundaryBack as a4, lineBoundaryFwd as a5, mapInput as a6, mapPaste as a7, mapPasteBlocks as a8, marksAtCaret as a9, mergeTextStyleAttrs as aa, outdentItem as ab, renderCode as ac, renderDoc as ad, renderEmbed as ae, renderHr as af, renderImage as ag, renderTable as ah, renderToHtml as ai, resolve as aj, safeCssValue as ak, serializeSelection as al, setAlign as am, setCalloutVariant as an, setTextStyle as ao, textStyleCss as ap, toggleMark as aq, toggleMarkList as ar, twitchChannel as as, wordBoundaryBack as at, wordBoundaryFwd as au, wrapList as av, youtubeId as aw, type AiProvider as b, type AiStreamFn as c, type AiStreamInput as d, type AiWriteMode as e, type AiWriteSession as f, type MarkloomAiOpts as g, blockPlainText as h, createAiStream as i, focusBlockId as j, Editor as k, type Extension as l, type AtomSelectCtx as m, type BlockKind as n, type BlockRenderCtx as o, type BlockRenderer as p, type CalloutVariant as q, type DecorationHost as r, startAiWrite as s, type InputRuleCtx as t, type Intent as u, type KeymapCtx as v, type KeymapResult as w, type MentionCandidate as x, type MentionHost as y, MentionMenu as z };
package/dist/index.cjs CHANGED
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } }
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
3
 
4
4
 
@@ -9,7 +9,7 @@
9
9
 
10
10
 
11
11
 
12
- var _chunkHA6XHJUDcjs = require('./chunk-HA6XHJUD.cjs');
12
+ var _chunkYXQDCW4Ycjs = require('./chunk-YXQDCW4Y.cjs');
13
13
 
14
14
 
15
15
 
@@ -69,259 +69,33 @@ var _chunkHA6XHJUDcjs = require('./chunk-HA6XHJUD.cjs');
69
69
 
70
70
 
71
71
 
72
+
73
+ var _chunk4TMHVNL6cjs = require('./chunk-4TMHVNL6.cjs');
72
74
 
73
75
 
74
76
 
75
77
 
76
- var _chunkVVFIQLVRcjs = require('./chunk-VVFIQLVR.cjs');
77
78
 
78
- // src/tree/map.ts
79
- function mapPosition(step, pos) {
80
- const p = pos.path;
81
- switch (step.kind) {
82
- case "insertText":
83
- return mapText(step.path, step.offset, step.text.length, p, pos);
84
- case "deleteText":
85
- return mapText(step.path, step.offset, -step.length, p, pos);
86
- case "spliceChildren":
87
- return mapSplice(step.path, step.at, step.remove, step.insert.length, p, pos);
88
- case "replaceNode":
89
- return underPrefix(step.path, p) ? withPath(step.path.concat(0), pos) : pos;
90
- }
91
- }
92
- function mapSelection(step, sel) {
93
- return { anchor: mapPosition(step, sel.anchor), head: mapPosition(step, sel.head) };
94
- }
95
- function mapText(stepPath, at, delta, p, pos) {
96
- if (p.length !== stepPath.length + 1 || !isPrefix(stepPath, p))
97
- return pos;
98
- const off = p[p.length - 1];
99
- if (off < at)
100
- return pos;
101
- if (off === at) {
102
- if (delta > 0 && (_nullishCoalesce(pos.assoc, () => ( 1))) === 1)
103
- return withLast(p, off + delta, pos);
104
- return pos;
105
- }
106
- if (delta < 0 && off < at - delta)
107
- return withLast(p, at, pos);
108
- return withLast(p, off + delta, pos);
109
- }
110
- function mapSplice(parentPath, at, remove, insertCount, p, pos) {
111
- const d = parentPath.length;
112
- if (!isPrefix(parentPath, p) || p.length <= d)
113
- return pos;
114
- const idx = p[d];
115
- const delta = insertCount - remove;
116
- if (idx < at)
117
- return pos;
118
- if (idx < at + remove)
119
- return withPath(parentPath.concat(at), pos);
120
- if (idx === at) {
121
- if (insertCount > 0 && (_nullishCoalesce(pos.assoc, () => ( 1))) === 1)
122
- return withSeg(p, d, idx + insertCount, pos);
123
- return pos;
124
- }
125
- return withSeg(p, d, idx + delta, pos);
126
- }
127
- function withPath(path, src) {
128
- return src.assoc === void 0 ? { path } : { path, assoc: src.assoc };
129
- }
130
- function withLast(path, last, src) {
131
- return withPath(path.slice(0, -1).concat(last), src);
132
- }
133
- function withSeg(path, d, seg, src) {
134
- const next = path.slice();
135
- next[d] = seg;
136
- return withPath(next, src);
137
- }
138
- function isPrefix(a, b) {
139
- if (a.length > b.length)
140
- return false;
141
- for (let i = 0; i < a.length; i++) {
142
- if (a[i] !== b[i])
143
- return false;
144
- }
145
- return true;
146
- }
147
- function underPrefix(a, b) {
148
- return b.length > a.length && isPrefix(a, b);
149
- }
150
- function normalizePosition(doc, pos) {
151
- let cur = doc;
152
- for (let i = 0; i < pos.path.length - 1; i++) {
153
- if (!_chunkVVFIQLVRcjs.isElement.call(void 0, cur))
154
- break;
155
- const next = cur.children[pos.path[i]];
156
- if (!next)
157
- return pos;
158
- cur = next;
159
- }
160
- if (_chunkVVFIQLVRcjs.isText.call(void 0, cur))
161
- return pos;
162
- const at = _nullishCoalesce(pos.path[pos.path.length - 1], () => ( 0));
163
- const prefix = pos.path.slice(0, -1);
164
- return withPath(descendToText(cur, at, prefix), pos);
165
- }
166
- function descendToText(parent, at, prefix) {
167
- const kids = parent.children;
168
- if (kids.length === 0)
169
- return prefix.concat(0);
170
- const leftIdx = at > 0 ? at - 1 : 0;
171
- const toEnd = at > 0;
172
- let path = prefix.concat(leftIdx);
173
- let node = kids[Math.min(leftIdx, kids.length - 1)];
174
- while (_chunkVVFIQLVRcjs.isElement.call(void 0, node)) {
175
- const cs = node.children;
176
- if (cs.length === 0)
177
- return path.concat(0);
178
- const idx = toEnd ? cs.length - 1 : 0;
179
- path = path.concat(idx);
180
- node = cs[idx];
181
- }
182
- return path.concat(toEnd ? node.text.length : 0);
183
- }
184
79
 
185
- // src/tree/rebase.ts
186
- function makeBias(thisSite, overSite) {
187
- return thisSite > overSite ? 1 : -1;
188
- }
189
- function rebase(over, step, bias) {
190
- switch (step.kind) {
191
- case "insertText":
192
- case "deleteText": {
193
- if ((over.kind === "insertText" || over.kind === "deleteText") && samePath(over.path, step.path))
194
- return textVsText(over, step, bias);
195
- const want = step.path.length + 1;
196
- const mlo = movePoint(over, step.path.concat(step.offset), bias);
197
- if (mlo.length < want)
198
- return null;
199
- if (step.kind === "insertText")
200
- return { ...step, path: mlo.slice(0, -1), offset: mlo[mlo.length - 1] };
201
- const mhi = movePoint(over, step.path.concat(step.offset + step.length), bias);
202
- if (mhi.length < want)
203
- return null;
204
- const a = mlo[mlo.length - 1];
205
- const b = mhi[mhi.length - 1];
206
- return { ...step, path: mlo.slice(0, -1), offset: a, length: Math.max(0, b - a) };
207
- }
208
- case "spliceChildren": {
209
- if (over.kind === "spliceChildren" && samePath(over.path, step.path))
210
- return spliceVsSplice(over, step, bias);
211
- const want = step.path.length + 1;
212
- const moved = movePoint(over, step.path.concat(step.at), bias);
213
- if (moved.length < want)
214
- return null;
215
- return { ...step, path: moved.slice(0, -1), at: moved[moved.length - 1] };
216
- }
217
- case "replaceNode": {
218
- if (removesTarget(over, step.path, bias))
219
- return null;
220
- return { ...step, path: movePoint(over, step.path, 1) };
221
- }
222
- }
223
- }
224
- function removesTarget(over, targetPath, bias) {
225
- if (over.kind === "spliceChildren") {
226
- const d = over.path.length;
227
- if (targetPath.length <= d || !isPrefix2(over.path, targetPath))
228
- return false;
229
- const idx = targetPath[d];
230
- return idx >= over.at && idx < over.at + over.remove;
231
- }
232
- if (over.kind === "replaceNode") {
233
- if (isPrefix2(over.path, targetPath)) {
234
- const sameNode = targetPath.length === over.path.length;
235
- return sameNode ? bias === 1 : true;
236
- }
237
- return false;
238
- }
239
- return false;
240
- }
241
- function textVsText(over, step, bias) {
242
- if (over.kind === "insertText") {
243
- const o = over.offset;
244
- const ins = over.text.length;
245
- if (step.kind === "insertText") {
246
- const x = step.offset;
247
- const off = x < o ? x : x > o ? x + ins : bias === 1 ? x + ins : x;
248
- return { ...step, offset: off };
249
- }
250
- const s2 = step.offset;
251
- const e2 = step.offset + step.length;
252
- if (o <= s2)
253
- return { ...step, offset: s2 + ins, length: step.length };
254
- if (o >= e2)
255
- return { ...step, offset: s2, length: step.length };
256
- return { ...step, offset: s2, length: step.length + ins };
257
- }
258
- const d = over.offset;
259
- const oLen = over.length;
260
- if (step.kind === "insertText") {
261
- const x = step.offset;
262
- if (x > d && x < d + oLen)
263
- return null;
264
- return { ...step, offset: x <= d ? x : x - oLen };
265
- }
266
- const s0 = step.offset;
267
- const e0 = step.offset + step.length;
268
- const s = s0 <= d ? s0 : s0 >= d + oLen ? s0 - oLen : d;
269
- const e = e0 <= d ? e0 : e0 >= d + oLen ? e0 - oLen : d;
270
- const len = Math.max(0, e - s);
271
- if (len === 0)
272
- return null;
273
- return { ...step, offset: s, length: len };
274
- }
275
- function spliceVsSplice(over, step, bias) {
276
- const oa = over.at;
277
- const oe = over.at + over.remove;
278
- const oN = over.insert.length;
279
- const delta = oN - over.remove;
280
- const sa = step.at;
281
- const se = step.at + step.remove;
282
- const out = [];
283
- const leftRem = Math.max(0, Math.min(se, oa) - sa);
284
- const rightRem = Math.max(0, se - Math.max(sa, oe));
285
- if (rightRem > 0)
286
- out.push({ kind: "spliceChildren", path: step.path, at: Math.max(sa, oe) + delta, remove: rightRem, insert: [] });
287
- if (leftRem > 0)
288
- out.push({ kind: "spliceChildren", path: step.path, at: sa, remove: leftRem, insert: [] });
289
- if (step.insert.length > 0) {
290
- const insAt = sa === oa ? bias === 1 ? oa + oN : oa : sa < oa ? sa : sa >= oe ? sa + delta : oa + oN;
291
- out.push({ kind: "spliceChildren", path: step.path, at: insAt, remove: 0, insert: step.insert });
292
- }
293
- if (out.length === 0)
294
- return null;
295
- if (out.length === 1)
296
- return out[0];
297
- out.sort((x, y) => y.at - x.at || x.insert.length - y.insert.length);
298
- return out;
299
- }
300
- function samePath(a, b) {
301
- return a.length === b.length && a.every((x, i) => x === b[i]);
302
- }
303
- function isPrefix2(a, b) {
304
- if (a.length > b.length)
305
- return false;
306
- for (let i = 0; i < a.length; i++) {
307
- if (a[i] !== b[i])
308
- return false;
309
- }
310
- return true;
311
- }
312
- function movePoint(over, path, bias) {
313
- const pos = { path, assoc: bias };
314
- return mapPosition(over, pos).path;
315
- }
80
+
81
+
82
+
83
+
84
+ var _chunkJS527FDVcjs = require('./chunk-JS527FDV.cjs');
85
+
86
+
87
+
88
+
89
+ var _chunkGQ2HHRGIcjs = require('./chunk-GQ2HHRGI.cjs');
316
90
 
317
91
  // src/tree/stats.ts
318
92
  function rawText(node) {
319
- if (_chunkVVFIQLVRcjs.isText.call(void 0, node))
93
+ if (_chunkGQ2HHRGIcjs.isText.call(void 0, node))
320
94
  return node.text;
321
95
  return node.children.map(rawText).join("");
322
96
  }
323
97
  function spacedText(node) {
324
- if (_chunkVVFIQLVRcjs.isText.call(void 0, node))
98
+ if (_chunkGQ2HHRGIcjs.isText.call(void 0, node))
325
99
  return node.text;
326
100
  return node.children.map(spacedText).join("\n");
327
101
  }
@@ -421,4 +195,8 @@ function docStats(doc) {
421
195
 
422
196
 
423
197
 
424
- exports.amend = _chunkHA6XHJUDcjs.amend; exports.appendText = _chunkVVFIQLVRcjs.appendText; exports.apply = _chunkVVFIQLVRcjs.apply; exports.applyAll = _chunkVVFIQLVRcjs.applyAll; exports.arrowCell = _chunkVVFIQLVRcjs.arrowCell; exports.basicSchema = _chunkVVFIQLVRcjs.basicSchema; exports.buildGrid = _chunkVVFIQLVRcjs.buildGrid; exports.buildIdIndex = _chunkVVFIQLVRcjs.buildIdIndex; exports.calloutToHtml = _chunkVVFIQLVRcjs.calloutToHtml; exports.caretCell = _chunkVVFIQLVRcjs.caretCell; exports.cellCaret = _chunkVVFIQLVRcjs.cellCaret; exports.cellText = _chunkVVFIQLVRcjs.cellText; exports.checkSchema = _chunkVVFIQLVRcjs.checkSchema; exports.checkTable = _chunkVVFIQLVRcjs.checkTable; exports.clearCells = _chunkVVFIQLVRcjs.clearCells; exports.colspanOf = _chunkVVFIQLVRcjs.colspanOf; exports.commentIdsInDoc = _chunkHA6XHJUDcjs.commentIdsInDoc; exports.commit = _chunkHA6XHJUDcjs.commit; exports.deleteCol = _chunkVVFIQLVRcjs.deleteCol; exports.deleteRow = _chunkVVFIQLVRcjs.deleteRow; exports.deleteTableBlock = _chunkVVFIQLVRcjs.deleteTableBlock; exports.diffById = _chunkVVFIQLVRcjs.diffById; exports.docStats = docStats; exports.docToMd = _chunkVVFIQLVRcjs.docToMd; exports.embedHtml = _chunkVVFIQLVRcjs.embedHtml; exports.firstLeafPath = _chunkVVFIQLVRcjs.firstLeafPath; exports.firstViolation = _chunkHA6XHJUDcjs.firstViolation; exports.hasSpan = _chunkVVFIQLVRcjs.hasSpan; exports.htmlToBlocks = _chunkVVFIQLVRcjs.htmlToBlocks; exports.init = _chunkHA6XHJUDcjs.init; exports.insertAfter = _chunkVVFIQLVRcjs.insertAfter; exports.insertCol = _chunkVVFIQLVRcjs.insertCol; exports.insertRow = _chunkVVFIQLVRcjs.insertRow; exports.invariants = _chunkHA6XHJUDcjs.invariants; exports.invert = _chunkVVFIQLVRcjs.invert; exports.invertAll = _chunkVVFIQLVRcjs.invertAll; exports.isElement = _chunkVVFIQLVRcjs.isElement; exports.isInlineAtom = _chunkVVFIQLVRcjs.isInlineAtom; exports.isRichHtmlBlocks = _chunkVVFIQLVRcjs.isRichHtmlBlocks; exports.isText = _chunkVVFIQLVRcjs.isText; exports.lastLeafEnd = _chunkVVFIQLVRcjs.lastLeafEnd; exports.makeBias = makeBias; exports.makeTable = _chunkVVFIQLVRcjs.makeTable; exports.mapPosition = mapPosition; exports.mapSelection = mapSelection; exports.mdToDoc = _chunkVVFIQLVRcjs.mdToDoc; exports.mergeCells = _chunkVVFIQLVRcjs.mergeCells; exports.moveBlock = _chunkVVFIQLVRcjs.moveBlock; exports.moveCol = _chunkVVFIQLVRcjs.moveCol; exports.moveRow = _chunkVVFIQLVRcjs.moveRow; exports.nextCell = _chunkVVFIQLVRcjs.nextCell; exports.nodeAt = _chunkVVFIQLVRcjs.nodeAt; exports.normalizePosition = normalizePosition; exports.normalizeToLeaf = _chunkVVFIQLVRcjs.normalizeToLeaf; exports.outline = _chunkHA6XHJUDcjs.outline; exports.pathOfId = _chunkVVFIQLVRcjs.pathOfId; exports.rebase = rebase; exports.redo = _chunkHA6XHJUDcjs.redo; exports.replaceAt = _chunkVVFIQLVRcjs.replaceAt; exports.resolve = _chunkVVFIQLVRcjs.resolve; exports.rewriteNode = _chunkVVFIQLVRcjs.rewriteNode; exports.rowspanOf = _chunkVVFIQLVRcjs.rowspanOf; exports.setAlign = _chunkVVFIQLVRcjs.setAlign; exports.setCellStyle = _chunkVVFIQLVRcjs.setCellStyle; exports.setColWidths = _chunkVVFIQLVRcjs.setColWidths; exports.setFreeze = _chunkVVFIQLVRcjs.setFreeze; exports.spliceAt = _chunkVVFIQLVRcjs.spliceAt; exports.splitCell = _chunkVVFIQLVRcjs.splitCell; exports.stripCommentMarks = _chunkHA6XHJUDcjs.stripCommentMarks; exports.tableAt = _chunkVVFIQLVRcjs.tableAt; exports.tableColWidths = _chunkVVFIQLVRcjs.tableColWidths; exports.tableHasExtras = _chunkVVFIQLVRcjs.tableHasExtras; exports.tableSchema = _chunkVVFIQLVRcjs.tableSchema; exports.tableShape = _chunkVVFIQLVRcjs.tableShape; exports.tableToHtml = _chunkVVFIQLVRcjs.tableToHtml; exports.undo = _chunkHA6XHJUDcjs.undo; exports.validate = _chunkVVFIQLVRcjs.validate; exports.validateAll = _chunkVVFIQLVRcjs.validateAll;
198
+
199
+
200
+
201
+
202
+ exports.amend = _chunkYXQDCW4Ycjs.amend; exports.appendText = _chunk4TMHVNL6cjs.appendText; exports.apply = _chunk4TMHVNL6cjs.apply; exports.applyAll = _chunk4TMHVNL6cjs.applyAll; exports.arrowCell = _chunk4TMHVNL6cjs.arrowCell; exports.basicSchema = _chunk4TMHVNL6cjs.basicSchema; exports.buildGrid = _chunk4TMHVNL6cjs.buildGrid; exports.buildIdIndex = _chunk4TMHVNL6cjs.buildIdIndex; exports.calloutToHtml = _chunk4TMHVNL6cjs.calloutToHtml; exports.caretCell = _chunk4TMHVNL6cjs.caretCell; exports.cellCaret = _chunk4TMHVNL6cjs.cellCaret; exports.cellText = _chunk4TMHVNL6cjs.cellText; exports.checkSchema = _chunk4TMHVNL6cjs.checkSchema; exports.checkTable = _chunk4TMHVNL6cjs.checkTable; exports.clearCells = _chunk4TMHVNL6cjs.clearCells; exports.colspanOf = _chunk4TMHVNL6cjs.colspanOf; exports.commentIdsInDoc = _chunkYXQDCW4Ycjs.commentIdsInDoc; exports.commit = _chunkYXQDCW4Ycjs.commit; exports.deleteCol = _chunk4TMHVNL6cjs.deleteCol; exports.deleteRow = _chunk4TMHVNL6cjs.deleteRow; exports.deleteTableBlock = _chunk4TMHVNL6cjs.deleteTableBlock; exports.diffById = _chunk4TMHVNL6cjs.diffById; exports.docStats = docStats; exports.docToMd = _chunk4TMHVNL6cjs.docToMd; exports.embedHtml = _chunk4TMHVNL6cjs.embedHtml; exports.firstLeafPath = _chunk4TMHVNL6cjs.firstLeafPath; exports.firstViolation = _chunkYXQDCW4Ycjs.firstViolation; exports.hasSpan = _chunk4TMHVNL6cjs.hasSpan; exports.htmlToBlocks = _chunk4TMHVNL6cjs.htmlToBlocks; exports.init = _chunkYXQDCW4Ycjs.init; exports.insertAfter = _chunk4TMHVNL6cjs.insertAfter; exports.insertCol = _chunk4TMHVNL6cjs.insertCol; exports.insertRow = _chunk4TMHVNL6cjs.insertRow; exports.invariants = _chunkYXQDCW4Ycjs.invariants; exports.invert = _chunk4TMHVNL6cjs.invert; exports.invertAll = _chunk4TMHVNL6cjs.invertAll; exports.isElement = _chunkGQ2HHRGIcjs.isElement; exports.isInlineAtom = _chunkGQ2HHRGIcjs.isInlineAtom; exports.isRichHtmlBlocks = _chunk4TMHVNL6cjs.isRichHtmlBlocks; exports.isText = _chunkGQ2HHRGIcjs.isText; exports.lastLeafEnd = _chunk4TMHVNL6cjs.lastLeafEnd; exports.makeBias = _chunkJS527FDVcjs.makeBias; exports.makeTable = _chunk4TMHVNL6cjs.makeTable; exports.mapPosition = _chunkJS527FDVcjs.mapPosition; exports.mapSelection = _chunkJS527FDVcjs.mapSelection; exports.mdToDoc = _chunk4TMHVNL6cjs.mdToDoc; exports.mergeCells = _chunk4TMHVNL6cjs.mergeCells; exports.moveBlock = _chunk4TMHVNL6cjs.moveBlock; exports.moveCol = _chunk4TMHVNL6cjs.moveCol; exports.moveRow = _chunk4TMHVNL6cjs.moveRow; exports.nextCell = _chunk4TMHVNL6cjs.nextCell; exports.nodeAt = _chunk4TMHVNL6cjs.nodeAt; exports.normalizePosition = _chunkJS527FDVcjs.normalizePosition; exports.normalizeToLeaf = _chunk4TMHVNL6cjs.normalizeToLeaf; exports.outline = _chunkYXQDCW4Ycjs.outline; exports.pathOfId = _chunk4TMHVNL6cjs.pathOfId; exports.rebase = _chunkJS527FDVcjs.rebase; exports.rebaseBatchOver = _chunkJS527FDVcjs.rebaseBatchOver; exports.rebaseOne = _chunkJS527FDVcjs.rebaseOne; exports.rebaseStepsThrough = _chunkJS527FDVcjs.rebaseStepsThrough; exports.redo = _chunkYXQDCW4Ycjs.redo; exports.replaceAt = _chunk4TMHVNL6cjs.replaceAt; exports.resolve = _chunk4TMHVNL6cjs.resolve; exports.rewriteNode = _chunk4TMHVNL6cjs.rewriteNode; exports.rowspanOf = _chunk4TMHVNL6cjs.rowspanOf; exports.setAlign = _chunk4TMHVNL6cjs.setAlign; exports.setCellStyle = _chunk4TMHVNL6cjs.setCellStyle; exports.setColWidths = _chunk4TMHVNL6cjs.setColWidths; exports.setFreeze = _chunk4TMHVNL6cjs.setFreeze; exports.spliceAt = _chunk4TMHVNL6cjs.spliceAt; exports.splitCell = _chunk4TMHVNL6cjs.splitCell; exports.stripCommentMarks = _chunkYXQDCW4Ycjs.stripCommentMarks; exports.tableAt = _chunk4TMHVNL6cjs.tableAt; exports.tableColWidths = _chunk4TMHVNL6cjs.tableColWidths; exports.tableHasExtras = _chunk4TMHVNL6cjs.tableHasExtras; exports.tableSchema = _chunk4TMHVNL6cjs.tableSchema; exports.tableShape = _chunk4TMHVNL6cjs.tableShape; exports.tableToHtml = _chunk4TMHVNL6cjs.tableToHtml; exports.transformRemoteAgainstPending = _chunkJS527FDVcjs.transformRemoteAgainstPending; exports.undo = _chunkYXQDCW4Ycjs.undo; exports.validate = _chunk4TMHVNL6cjs.validate; exports.validateAll = _chunk4TMHVNL6cjs.validateAll;
package/dist/index.d.cts CHANGED
@@ -1,5 +1,7 @@
1
- import { E as ElementNode, P as Path, S as Step, N as Node, a as Position } from './comments-USjT1wYN.cjs';
2
- export { C as CommentAuthor, b as CommentMessage, c as CommentRenderState, d as CommentThread, e as Commit, D as DeleteText, f as Doc, H as History, I as InsertText, M as Mark, R as ReplaceNode, g as Selection, h as SpliceChildren, T as TextNode, i as amend, j as apply, k as applyAll, l as commentIdsInDoc, m as commit, n as init, o as invert, p as invertAll, q as isElement, r as isInlineAtom, s as isText, t as moveBlock, u as redo, v as stripCommentMarks, w as undo } from './comments-USjT1wYN.cjs';
1
+ import { E as ElementNode, P as Path, S as Step, N as Node, a as Position } from './step-BrvHIK7O.cjs';
2
+ export { D as DeleteText, b as Doc, I as InsertText, M as Mark, R as ReplaceNode, c as Selection, d as SpliceChildren, T as TextNode, e as apply, f as applyAll, i as invert, g as invertAll, h as isElement, j as isInlineAtom, k as isText, m as moveBlock } from './step-BrvHIK7O.cjs';
3
+ export { C as CommentAuthor, a as CommentMessage, b as CommentRenderState, c as CommentThread, d as Commit, H as History, e as amend, f as commentIdsInDoc, g as commit, i as init, r as redo, s as stripCommentMarks, u as undo } from './comments-DlExS6f-.cjs';
4
+ export { B as Bias, m as makeBias, c as rebase, r as rebaseBatchOver, a as rebaseOne, b as rebaseStepsThrough, t as transformRemoteAgainstPending } from './rebase-batch-bYnBJpRO.cjs';
3
5
 
4
6
  interface TableShape {
5
7
  rows: number;
@@ -162,10 +164,6 @@ declare function mapSelection(step: Step, sel: {
162
164
  };
163
165
  declare function normalizePosition(doc: ElementNode, pos: Position): Position;
164
166
 
165
- type Bias = -1 | 1;
166
- declare function makeBias(thisSite: number, overSite: number): Bias;
167
- declare function rebase(over: Step, step: Step, bias: Bias): Step | Step[] | null;
168
-
169
167
  interface DocStats {
170
168
  chars: number;
171
169
  words: number;
@@ -181,4 +179,4 @@ interface TocEntry {
181
179
  }
182
180
  declare function outline(doc: ElementNode): TocEntry[];
183
181
 
184
- export { type Bias, type DocStats, ElementNode, type Grid, type IdIndex, Node, type NodeChange, type NodeSpec, Path, Position, type Resolved, type Schema, Step, type TableShape, type TocEntry, type Violation, appendText, arrowCell, basicSchema, buildGrid, buildIdIndex, calloutToHtml, caretCell, cellCaret, cellText, checkSchema, checkTable, clearCells, colspanOf, deleteCol, deleteRow, deleteTableBlock, diffById, docStats, docToMd, embedHtml, firstLeafPath, firstViolation, hasSpan, htmlToBlocks, insertAfter, insertCol, insertRow, invariants, isRichHtmlBlocks, lastLeafEnd, makeBias, makeTable, mapPosition, mapSelection, mdToDoc, mergeCells, moveCol, moveRow, nextCell, nodeAt, normalizePosition, normalizeToLeaf, outline, pathOfId, rebase, replaceAt, resolve, rewriteNode, rowspanOf, setAlign, setCellStyle, setColWidths, setFreeze, spliceAt, splitCell, tableAt, tableColWidths, tableHasExtras, tableSchema, tableShape, tableToHtml, validate, validateAll };
182
+ export { type DocStats, ElementNode, type Grid, type IdIndex, Node, type NodeChange, type NodeSpec, Path, Position, type Resolved, type Schema, Step, type TableShape, type TocEntry, type Violation, appendText, arrowCell, basicSchema, buildGrid, buildIdIndex, calloutToHtml, caretCell, cellCaret, cellText, checkSchema, checkTable, clearCells, colspanOf, deleteCol, deleteRow, deleteTableBlock, diffById, docStats, docToMd, embedHtml, firstLeafPath, firstViolation, hasSpan, htmlToBlocks, insertAfter, insertCol, insertRow, invariants, isRichHtmlBlocks, lastLeafEnd, makeTable, mapPosition, mapSelection, mdToDoc, mergeCells, moveCol, moveRow, nextCell, nodeAt, normalizePosition, normalizeToLeaf, outline, pathOfId, replaceAt, resolve, rewriteNode, rowspanOf, setAlign, setCellStyle, setColWidths, setFreeze, spliceAt, splitCell, tableAt, tableColWidths, tableHasExtras, tableSchema, tableShape, tableToHtml, validate, validateAll };
package/dist/index.d.ts CHANGED
@@ -1,5 +1,7 @@
1
- import { E as ElementNode, P as Path, S as Step, N as Node, a as Position } from './comments-USjT1wYN.js';
2
- export { C as CommentAuthor, b as CommentMessage, c as CommentRenderState, d as CommentThread, e as Commit, D as DeleteText, f as Doc, H as History, I as InsertText, M as Mark, R as ReplaceNode, g as Selection, h as SpliceChildren, T as TextNode, i as amend, j as apply, k as applyAll, l as commentIdsInDoc, m as commit, n as init, o as invert, p as invertAll, q as isElement, r as isInlineAtom, s as isText, t as moveBlock, u as redo, v as stripCommentMarks, w as undo } from './comments-USjT1wYN.js';
1
+ import { E as ElementNode, P as Path, S as Step, N as Node, a as Position } from './step-BrvHIK7O.js';
2
+ export { D as DeleteText, b as Doc, I as InsertText, M as Mark, R as ReplaceNode, c as Selection, d as SpliceChildren, T as TextNode, e as apply, f as applyAll, i as invert, g as invertAll, h as isElement, j as isInlineAtom, k as isText, m as moveBlock } from './step-BrvHIK7O.js';
3
+ export { C as CommentAuthor, a as CommentMessage, b as CommentRenderState, c as CommentThread, d as Commit, H as History, e as amend, f as commentIdsInDoc, g as commit, i as init, r as redo, s as stripCommentMarks, u as undo } from './comments-PhnR7Gkn.js';
4
+ export { B as Bias, m as makeBias, c as rebase, r as rebaseBatchOver, a as rebaseOne, b as rebaseStepsThrough, t as transformRemoteAgainstPending } from './rebase-batch-8rL_aXEE.js';
3
5
 
4
6
  interface TableShape {
5
7
  rows: number;
@@ -162,10 +164,6 @@ declare function mapSelection(step: Step, sel: {
162
164
  };
163
165
  declare function normalizePosition(doc: ElementNode, pos: Position): Position;
164
166
 
165
- type Bias = -1 | 1;
166
- declare function makeBias(thisSite: number, overSite: number): Bias;
167
- declare function rebase(over: Step, step: Step, bias: Bias): Step | Step[] | null;
168
-
169
167
  interface DocStats {
170
168
  chars: number;
171
169
  words: number;
@@ -181,4 +179,4 @@ interface TocEntry {
181
179
  }
182
180
  declare function outline(doc: ElementNode): TocEntry[];
183
181
 
184
- export { type Bias, type DocStats, ElementNode, type Grid, type IdIndex, Node, type NodeChange, type NodeSpec, Path, Position, type Resolved, type Schema, Step, type TableShape, type TocEntry, type Violation, appendText, arrowCell, basicSchema, buildGrid, buildIdIndex, calloutToHtml, caretCell, cellCaret, cellText, checkSchema, checkTable, clearCells, colspanOf, deleteCol, deleteRow, deleteTableBlock, diffById, docStats, docToMd, embedHtml, firstLeafPath, firstViolation, hasSpan, htmlToBlocks, insertAfter, insertCol, insertRow, invariants, isRichHtmlBlocks, lastLeafEnd, makeBias, makeTable, mapPosition, mapSelection, mdToDoc, mergeCells, moveCol, moveRow, nextCell, nodeAt, normalizePosition, normalizeToLeaf, outline, pathOfId, rebase, replaceAt, resolve, rewriteNode, rowspanOf, setAlign, setCellStyle, setColWidths, setFreeze, spliceAt, splitCell, tableAt, tableColWidths, tableHasExtras, tableSchema, tableShape, tableToHtml, validate, validateAll };
182
+ export { type DocStats, ElementNode, type Grid, type IdIndex, Node, type NodeChange, type NodeSpec, Path, Position, type Resolved, type Schema, Step, type TableShape, type TocEntry, type Violation, appendText, arrowCell, basicSchema, buildGrid, buildIdIndex, calloutToHtml, caretCell, cellCaret, cellText, checkSchema, checkTable, clearCells, colspanOf, deleteCol, deleteRow, deleteTableBlock, diffById, docStats, docToMd, embedHtml, firstLeafPath, firstViolation, hasSpan, htmlToBlocks, insertAfter, insertCol, insertRow, invariants, isRichHtmlBlocks, lastLeafEnd, makeTable, mapPosition, mapSelection, mdToDoc, mergeCells, moveCol, moveRow, nextCell, nodeAt, normalizePosition, normalizeToLeaf, outline, pathOfId, replaceAt, resolve, rewriteNode, rowspanOf, setAlign, setCellStyle, setColWidths, setFreeze, spliceAt, splitCell, tableAt, tableColWidths, tableHasExtras, tableSchema, tableShape, tableToHtml, validate, validateAll };