markloom 0.4.0 → 0.5.1

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 (51) hide show
  1. package/README.md +29 -16
  2. package/ai.md +160 -0
  3. package/collab.md +70 -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 +3 -2
  8. package/dist/chunk-4JSJAHTB.js +255 -0
  9. package/dist/{chunk-VVFIQLVR.cjs → chunk-4TMHVNL6.cjs} +71 -79
  10. package/dist/chunk-ALZ3A5CS.cjs +255 -0
  11. package/dist/{chunk-QXJHFQLJ.js → chunk-FCH7LZFI.js} +23 -15
  12. package/dist/chunk-GQ2HHRGI.cjs +16 -0
  13. package/dist/chunk-JS527FDV.cjs +294 -0
  14. package/dist/chunk-LA5SBCGQ.js +16 -0
  15. package/dist/{chunk-ITVAR2UM.js → chunk-LEYAQNJA.js} +5 -3
  16. package/dist/{chunk-J3QWW6CN.js → chunk-MFYF2A6U.js} +5 -13
  17. package/dist/chunk-RLTHVQNQ.js +294 -0
  18. package/dist/{chunk-VSTOMEU2.cjs → chunk-VXM7Q6P5.cjs} +813 -478
  19. package/dist/{chunk-LNSKDJMF.cjs → chunk-YIFOGP2D.cjs} +46 -38
  20. package/dist/{chunk-HA6XHJUD.cjs → chunk-YXQDCW4Y.cjs} +22 -20
  21. package/dist/{chunk-VMUJM52A.js → chunk-ZMTLSFLO.js} +350 -15
  22. package/dist/client-6KiH4kGK.d.ts +144 -0
  23. package/dist/client-ZRZj2nkq.d.cts +144 -0
  24. package/dist/collab/index.cjs +25 -0
  25. package/dist/collab/index.d.cts +11 -0
  26. package/dist/collab/index.d.ts +11 -0
  27. package/dist/collab/index.js +25 -0
  28. package/dist/comments-DlExS6f-.d.cts +43 -0
  29. package/dist/comments-PhnR7Gkn.d.ts +43 -0
  30. package/dist/{controller-B_wG2Wh-.d.ts → controller-BNuuUM3E.d.ts} +26 -2
  31. package/dist/{controller-Cd1Dprrk.d.cts → controller-DQITsFhy.d.cts} +26 -2
  32. package/dist/index.cjs +21 -243
  33. package/dist/index.d.cts +5 -7
  34. package/dist/index.d.ts +5 -7
  35. package/dist/index.js +22 -244
  36. package/dist/react/index.cjs +8 -5
  37. package/dist/react/index.d.cts +4 -2
  38. package/dist/react/index.d.ts +4 -2
  39. package/dist/react/index.js +7 -4
  40. package/dist/rebase-batch-8rL_aXEE.d.ts +38 -0
  41. package/dist/rebase-batch-bYnBJpRO.d.cts +38 -0
  42. package/dist/step-BrvHIK7O.d.cts +65 -0
  43. package/dist/step-BrvHIK7O.d.ts +65 -0
  44. package/dist/view/index.cjs +11 -8
  45. package/dist/view/index.d.cts +5 -3
  46. package/dist/view/index.d.ts +5 -3
  47. package/dist/view/index.js +7 -4
  48. package/dist/view/theme.css +72 -0
  49. package/package.json +10 -3
  50. package/dist/comments-USjT1wYN.d.cts +0 -105
  51. package/dist/comments-USjT1wYN.d.ts +0 -105
@@ -1,9 +1,12 @@
1
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
2
 
3
- var _chunkVSTOMEU2cjs = require('../chunk-VSTOMEU2.cjs');
4
- require('../chunk-HA6XHJUD.cjs');
5
- require('../chunk-LNSKDJMF.cjs');
6
- require('../chunk-VVFIQLVR.cjs');
3
+ var _chunkVXM7Q6P5cjs = require('../chunk-VXM7Q6P5.cjs');
4
+ require('../chunk-YXQDCW4Y.cjs');
5
+ require('../chunk-YIFOGP2D.cjs');
6
+ require('../chunk-4TMHVNL6.cjs');
7
+ require('../chunk-ALZ3A5CS.cjs');
8
+ require('../chunk-JS527FDV.cjs');
9
+ require('../chunk-GQ2HHRGI.cjs');
7
10
 
8
11
  // src/react/index.ts
9
12
  var _react = require('react');
@@ -17,7 +20,7 @@ function useMarkloom(initialDoc, opts = {}) {
17
20
  const host = ref.current;
18
21
  if (!host)
19
22
  return;
20
- const ed = new (0, _chunkVSTOMEU2cjs.Editor)(host, initialDoc, {
23
+ const ed = new (0, _chunkVXM7Q6P5cjs.Editor)(host, initialDoc, {
21
24
  ...optsRef.current,
22
25
  onChange: (d) => {
23
26
  setDoc(d);
@@ -1,8 +1,10 @@
1
1
  import * as react from 'react';
2
2
  import { MutableRefObject } from 'react';
3
- import { E as ElementNode } from '../comments-USjT1wYN.cjs';
4
- import { E as EditorOptions, k as Editor } from '../controller-Cd1Dprrk.cjs';
3
+ import { E as ElementNode } from '../step-BrvHIK7O.cjs';
4
+ import { E as EditorOptions, k as Editor } from '../controller-DQITsFhy.cjs';
5
5
  import 'preact';
6
+ import '../comments-DlExS6f-.cjs';
7
+ import '../client-ZRZj2nkq.cjs';
6
8
 
7
9
  declare function useMarkloom(initialDoc: ElementNode, opts?: EditorOptions): {
8
10
  ref: react.RefObject<HTMLDivElement | null>;
@@ -1,8 +1,10 @@
1
1
  import * as react from 'react';
2
2
  import { MutableRefObject } from 'react';
3
- import { E as ElementNode } from '../comments-USjT1wYN.js';
4
- import { E as EditorOptions, k as Editor } from '../controller-B_wG2Wh-.js';
3
+ import { E as ElementNode } from '../step-BrvHIK7O.js';
4
+ import { E as EditorOptions, k as Editor } from '../controller-BNuuUM3E.js';
5
5
  import 'preact';
6
+ import '../comments-PhnR7Gkn.js';
7
+ import '../client-6KiH4kGK.js';
6
8
 
7
9
  declare function useMarkloom(initialDoc: ElementNode, opts?: EditorOptions): {
8
10
  ref: react.RefObject<HTMLDivElement | null>;
@@ -1,9 +1,12 @@
1
1
  import {
2
2
  Editor
3
- } from "../chunk-VMUJM52A.js";
4
- import "../chunk-ITVAR2UM.js";
5
- import "../chunk-QXJHFQLJ.js";
6
- import "../chunk-J3QWW6CN.js";
3
+ } from "../chunk-ZMTLSFLO.js";
4
+ import "../chunk-LEYAQNJA.js";
5
+ import "../chunk-FCH7LZFI.js";
6
+ import "../chunk-MFYF2A6U.js";
7
+ import "../chunk-4JSJAHTB.js";
8
+ import "../chunk-RLTHVQNQ.js";
9
+ import "../chunk-LA5SBCGQ.js";
7
10
 
8
11
  // src/react/index.ts
9
12
  import { createElement, useEffect, useRef, useState } from "react";
@@ -0,0 +1,38 @@
1
+ import { S as Step } from './step-BrvHIK7O.js';
2
+
3
+ type Bias = -1 | 1;
4
+ declare function makeBias(thisSite: number, overSite: number): Bias;
5
+ declare function rebase(over: Step, step: Step, bias: Bias): Step | Step[] | null;
6
+
7
+ /** 把单步 step 穿过 over,产出 0..n 步(裂步)或空(作废) */
8
+ declare function rebaseOne(over: Step, step: Step, bias: Bias): Step[];
9
+ /** 一批 steps 依次穿过一条 over(批内顺序保留,裂步就地展开) */
10
+ declare function rebaseBatchOver(over: Step, steps: Step[], bias: Bias): Step[];
11
+ /**
12
+ * 本站 steps 穿过一系列并发 op(每条带 siteId)。
13
+ * 对 concurrent[i] 用 makeBias(thisSite, concurrent[i].siteId)。
14
+ */
15
+ declare function rebaseStepsThrough(steps: Step[], concurrent: {
16
+ siteId: number;
17
+ steps: Step[];
18
+ }[], thisSite: number): Step[];
19
+ /**
20
+ * 远端一批 remote 穿过本地 pending 队列 → remote';
21
+ * pending 同步被 remote 搬坐标 → pending'。
22
+ *
23
+ * 对每个 pending 项 p:
24
+ * remote 穿过 p: bias = makeBias(remoteSite, localSite)
25
+ * p 穿过「进入 p 前」的 remote: bias = makeBias(localSite, remoteSite)
26
+ */
27
+ declare function transformRemoteAgainstPending(remote: Step[], remoteSite: number, pending: {
28
+ siteId: number;
29
+ steps: Step[];
30
+ }[], localSite: number): {
31
+ remote: Step[];
32
+ pending: {
33
+ siteId: number;
34
+ steps: Step[];
35
+ }[];
36
+ };
37
+
38
+ export { type Bias as B, rebaseOne as a, rebaseStepsThrough as b, rebase as c, makeBias as m, rebaseBatchOver as r, transformRemoteAgainstPending as t };
@@ -0,0 +1,38 @@
1
+ import { S as Step } from './step-BrvHIK7O.cjs';
2
+
3
+ type Bias = -1 | 1;
4
+ declare function makeBias(thisSite: number, overSite: number): Bias;
5
+ declare function rebase(over: Step, step: Step, bias: Bias): Step | Step[] | null;
6
+
7
+ /** 把单步 step 穿过 over,产出 0..n 步(裂步)或空(作废) */
8
+ declare function rebaseOne(over: Step, step: Step, bias: Bias): Step[];
9
+ /** 一批 steps 依次穿过一条 over(批内顺序保留,裂步就地展开) */
10
+ declare function rebaseBatchOver(over: Step, steps: Step[], bias: Bias): Step[];
11
+ /**
12
+ * 本站 steps 穿过一系列并发 op(每条带 siteId)。
13
+ * 对 concurrent[i] 用 makeBias(thisSite, concurrent[i].siteId)。
14
+ */
15
+ declare function rebaseStepsThrough(steps: Step[], concurrent: {
16
+ siteId: number;
17
+ steps: Step[];
18
+ }[], thisSite: number): Step[];
19
+ /**
20
+ * 远端一批 remote 穿过本地 pending 队列 → remote';
21
+ * pending 同步被 remote 搬坐标 → pending'。
22
+ *
23
+ * 对每个 pending 项 p:
24
+ * remote 穿过 p: bias = makeBias(remoteSite, localSite)
25
+ * p 穿过「进入 p 前」的 remote: bias = makeBias(localSite, remoteSite)
26
+ */
27
+ declare function transformRemoteAgainstPending(remote: Step[], remoteSite: number, pending: {
28
+ siteId: number;
29
+ steps: Step[];
30
+ }[], localSite: number): {
31
+ remote: Step[];
32
+ pending: {
33
+ siteId: number;
34
+ steps: Step[];
35
+ }[];
36
+ };
37
+
38
+ export { type Bias as B, rebaseOne as a, rebaseStepsThrough as b, rebase as c, makeBias as m, rebaseBatchOver as r, transformRemoteAgainstPending as t };
@@ -0,0 +1,65 @@
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 };
@@ -0,0 +1,65 @@
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 };
@@ -79,8 +79,8 @@
79
79
 
80
80
 
81
81
 
82
- var _chunkVSTOMEU2cjs = require('../chunk-VSTOMEU2.cjs');
83
- require('../chunk-HA6XHJUD.cjs');
82
+ var _chunkVXM7Q6P5cjs = require('../chunk-VXM7Q6P5.cjs');
83
+ require('../chunk-YXQDCW4Y.cjs');
84
84
 
85
85
 
86
86
 
@@ -91,8 +91,11 @@ require('../chunk-HA6XHJUD.cjs');
91
91
 
92
92
 
93
93
 
94
- var _chunkLNSKDJMFcjs = require('../chunk-LNSKDJMF.cjs');
95
- require('../chunk-VVFIQLVR.cjs');
94
+ var _chunkYIFOGP2Dcjs = require('../chunk-YIFOGP2D.cjs');
95
+ require('../chunk-4TMHVNL6.cjs');
96
+ require('../chunk-ALZ3A5CS.cjs');
97
+ require('../chunk-JS527FDV.cjs');
98
+ require('../chunk-GQ2HHRGI.cjs');
96
99
 
97
100
  // src/view/shiki-code-view.ts
98
101
  var _preact = require('preact');
@@ -163,7 +166,7 @@ function subRule() {
163
166
  { kind: "deleteText", path: ctx.leafPath, offset: at, length: eaten },
164
167
  { kind: "insertText", path: ctx.leafPath, offset: at, text: s.to }
165
168
  ];
166
- return { steps, selection: _chunkVSTOMEU2cjs.caret.call(void 0, ctx.leafPath.concat(at + s.to.length)) };
169
+ return { steps, selection: _chunkVXM7Q6P5cjs.caret.call(void 0, ctx.leafPath.concat(at + s.to.length)) };
167
170
  }
168
171
  return null;
169
172
  }
@@ -177,7 +180,7 @@ function quoteRule(quote, open, close) {
177
180
  const prev = ctx.marker.slice(-1);
178
181
  const to = prev === "" || prev === " " || prev === "\n" || prev === " " || prev === "(" || prev === "[" || prev === "{" ? open : close;
179
182
  const steps = [{ kind: "insertText", path: ctx.leafPath, offset: ctx.offset, text: to }];
180
- return { steps, selection: _chunkVSTOMEU2cjs.caret.call(void 0, ctx.leafPath.concat(ctx.offset + to.length)) };
183
+ return { steps, selection: _chunkVXM7Q6P5cjs.caret.call(void 0, ctx.leafPath.concat(ctx.offset + to.length)) };
181
184
  }
182
185
  };
183
186
  }
@@ -253,7 +256,7 @@ function emojiRule() {
253
256
  { kind: "deleteText", path: ctx.leafPath, offset: at, length: eaten },
254
257
  { kind: "insertText", path: ctx.leafPath, offset: at, text: glyph }
255
258
  ];
256
- return { steps, selection: _chunkVSTOMEU2cjs.caret.call(void 0, ctx.leafPath.concat(at + glyph.length)) };
259
+ return { steps, selection: _chunkVXM7Q6P5cjs.caret.call(void 0, ctx.leafPath.concat(at + glyph.length)) };
257
260
  }
258
261
  };
259
262
  }
@@ -365,4 +368,4 @@ var comments = {
365
368
 
366
369
 
367
370
 
368
- exports.CALLOUT_VARIANTS = _chunkVSTOMEU2cjs.CALLOUT_VARIANTS; exports.CommentPanel = _chunkVSTOMEU2cjs.CommentPanel; exports.Editor = _chunkVSTOMEU2cjs.Editor; exports.MentionMenu = _chunkVSTOMEU2cjs.MentionMenu; exports.MentionPopovers = _chunkVSTOMEU2cjs.MentionPopovers; exports.TocPanel = _chunkVSTOMEU2cjs.TocPanel; exports.askInput = _chunkVSTOMEU2cjs.askInput; exports.askLinkPopover = _chunkVSTOMEU2cjs.askLinkPopover; exports.atomIsSelected = _chunkVSTOMEU2cjs.atomIsSelected; exports.blockExtensions = _chunkVSTOMEU2cjs.blockExtensions; exports.blockPlainText = _chunkLNSKDJMFcjs.blockPlainText; exports.blockTransform = _chunkVSTOMEU2cjs.blockTransform; exports.boldMark = _chunkVSTOMEU2cjs.boldMark; exports.bubbleMenu = _chunkVSTOMEU2cjs.bubbleMenu; exports.calloutVariantFromQuery = _chunkVSTOMEU2cjs.calloutVariantFromQuery; exports.caret = _chunkVSTOMEU2cjs.caret; exports.chord = _chunkVSTOMEU2cjs.chord; exports.closeAskInput = _chunkVSTOMEU2cjs.closeAskInput; exports.codeBlock = _chunkVSTOMEU2cjs.codeBlock; exports.codeControls = _chunkVSTOMEU2cjs.codeControls; exports.codeMark = _chunkVSTOMEU2cjs.codeMark; exports.comments = comments; exports.cycleCalloutVariant = _chunkVSTOMEU2cjs.cycleCalloutVariant; exports.decorationExtensions = _chunkVSTOMEU2cjs.decorationExtensions; exports.defaultBlockRenderers = _chunkVSTOMEU2cjs.defaultBlockRenderers; exports.defaultBlockTag = _chunkVSTOMEU2cjs.defaultBlockTag; exports.defaultMarkTag = _chunkVSTOMEU2cjs.defaultMarkTag; exports.diffSpan = _chunkVSTOMEU2cjs.diffSpan; exports.domToPoint = _chunkLNSKDJMFcjs.domToPoint; exports.dragHandle = _chunkVSTOMEU2cjs.dragHandle; exports.elementChildren = _chunkLNSKDJMFcjs.elementChildren; exports.embedBlock = _chunkVSTOMEU2cjs.embedBlock; exports.emoji = emoji; exports.focusBlockId = _chunkLNSKDJMFcjs.focusBlockId; exports.highlightMark = _chunkVSTOMEU2cjs.highlightMark; exports.history = _chunkVSTOMEU2cjs.history; exports.hrBlock = _chunkVSTOMEU2cjs.hrBlock; exports.imageBlock = _chunkVSTOMEU2cjs.imageBlock; exports.indentItem = _chunkVSTOMEU2cjs.indentItem; exports.inputRules = _chunkVSTOMEU2cjs.inputRules; exports.invisibleCharacters = invisibleCharacters; exports.isAtom = _chunkVSTOMEU2cjs.isAtom; exports.isOpaque = _chunkVSTOMEU2cjs.isOpaque; exports.italicMark = _chunkVSTOMEU2cjs.italicMark; exports.leafText = _chunkVSTOMEU2cjs.leafText; exports.lineBoundaryBack = _chunkVSTOMEU2cjs.lineBoundaryBack; exports.lineBoundaryFwd = _chunkVSTOMEU2cjs.lineBoundaryFwd; exports.linkMark = _chunkVSTOMEU2cjs.linkMark; exports.mapInput = _chunkVSTOMEU2cjs.mapInput; exports.mapPaste = _chunkVSTOMEU2cjs.mapPaste; exports.mapPasteBlocks = _chunkVSTOMEU2cjs.mapPasteBlocks; exports.markExtensions = _chunkVSTOMEU2cjs.markExtensions; exports.markloomKit = _chunkVSTOMEU2cjs.markloomKit; exports.marksAtCaret = _chunkVSTOMEU2cjs.marksAtCaret; exports.mentionMenu = _chunkVSTOMEU2cjs.mentionMenu; exports.mergeTextStyleAttrs = _chunkVSTOMEU2cjs.mergeTextStyleAttrs; exports.normalizeLinkUrl = _chunkVSTOMEU2cjs.normalizeLinkUrl; exports.outdentItem = _chunkVSTOMEU2cjs.outdentItem; exports.pointToDom = _chunkLNSKDJMFcjs.pointToDom; exports.readSelection = _chunkLNSKDJMFcjs.readSelection; exports.renderCode = _chunkVSTOMEU2cjs.renderCode; exports.renderDoc = _chunkVSTOMEU2cjs.renderDoc; exports.renderEmbed = _chunkVSTOMEU2cjs.renderEmbed; exports.renderHr = _chunkVSTOMEU2cjs.renderHr; exports.renderImage = _chunkVSTOMEU2cjs.renderImage; exports.renderTable = _chunkVSTOMEU2cjs.renderTable; exports.renderToHtml = _chunkVSTOMEU2cjs.renderToHtml; exports.resolve = _chunkVSTOMEU2cjs.resolve; exports.rootEl = _chunkLNSKDJMFcjs.rootEl; exports.safeCssValue = _chunkVSTOMEU2cjs.safeCssValue; exports.serializeSelection = _chunkVSTOMEU2cjs.serializeSelection; exports.setAlign = _chunkVSTOMEU2cjs.setAlign; exports.setCalloutVariant = _chunkVSTOMEU2cjs.setCalloutVariant; exports.setTextStyle = _chunkVSTOMEU2cjs.setTextStyle; exports.shikiCodeView = shikiCodeView; exports.slashMenu = _chunkVSTOMEU2cjs.slashMenu; exports.startAiWrite = _chunkLNSKDJMFcjs.startAiWrite; exports.strikeMark = _chunkVSTOMEU2cjs.strikeMark; exports.subscriptMark = _chunkVSTOMEU2cjs.subscriptMark; exports.superscriptMark = _chunkVSTOMEU2cjs.superscriptMark; exports.tableBlock = _chunkVSTOMEU2cjs.tableBlock; exports.textAlign = _chunkVSTOMEU2cjs.textAlign; exports.textStyleCss = _chunkVSTOMEU2cjs.textStyleCss; exports.textStyleMark = _chunkVSTOMEU2cjs.textStyleMark; exports.toggleMark = _chunkVSTOMEU2cjs.toggleMark; exports.toggleMarkList = _chunkVSTOMEU2cjs.toggleMarkList; exports.twitchChannel = _chunkVSTOMEU2cjs.twitchChannel; exports.typography = typography; exports.underlineMark = _chunkVSTOMEU2cjs.underlineMark; exports.wordBoundaryBack = _chunkVSTOMEU2cjs.wordBoundaryBack; exports.wordBoundaryFwd = _chunkVSTOMEU2cjs.wordBoundaryFwd; exports.wrapList = _chunkVSTOMEU2cjs.wrapList; exports.writeSelection = _chunkLNSKDJMFcjs.writeSelection; exports.youtubeId = _chunkVSTOMEU2cjs.youtubeId;
371
+ exports.CALLOUT_VARIANTS = _chunkVXM7Q6P5cjs.CALLOUT_VARIANTS; exports.CommentPanel = _chunkVXM7Q6P5cjs.CommentPanel; exports.Editor = _chunkVXM7Q6P5cjs.Editor; exports.MentionMenu = _chunkVXM7Q6P5cjs.MentionMenu; exports.MentionPopovers = _chunkVXM7Q6P5cjs.MentionPopovers; exports.TocPanel = _chunkVXM7Q6P5cjs.TocPanel; exports.askInput = _chunkVXM7Q6P5cjs.askInput; exports.askLinkPopover = _chunkVXM7Q6P5cjs.askLinkPopover; exports.atomIsSelected = _chunkVXM7Q6P5cjs.atomIsSelected; exports.blockExtensions = _chunkVXM7Q6P5cjs.blockExtensions; exports.blockPlainText = _chunkYIFOGP2Dcjs.blockPlainText; exports.blockTransform = _chunkVXM7Q6P5cjs.blockTransform; exports.boldMark = _chunkVXM7Q6P5cjs.boldMark; exports.bubbleMenu = _chunkVXM7Q6P5cjs.bubbleMenu; exports.calloutVariantFromQuery = _chunkVXM7Q6P5cjs.calloutVariantFromQuery; exports.caret = _chunkVXM7Q6P5cjs.caret; exports.chord = _chunkVXM7Q6P5cjs.chord; exports.closeAskInput = _chunkVXM7Q6P5cjs.closeAskInput; exports.codeBlock = _chunkVXM7Q6P5cjs.codeBlock; exports.codeControls = _chunkVXM7Q6P5cjs.codeControls; exports.codeMark = _chunkVXM7Q6P5cjs.codeMark; exports.comments = comments; exports.cycleCalloutVariant = _chunkVXM7Q6P5cjs.cycleCalloutVariant; exports.decorationExtensions = _chunkVXM7Q6P5cjs.decorationExtensions; exports.defaultBlockRenderers = _chunkVXM7Q6P5cjs.defaultBlockRenderers; exports.defaultBlockTag = _chunkVXM7Q6P5cjs.defaultBlockTag; exports.defaultMarkTag = _chunkVXM7Q6P5cjs.defaultMarkTag; exports.diffSpan = _chunkVXM7Q6P5cjs.diffSpan; exports.domToPoint = _chunkYIFOGP2Dcjs.domToPoint; exports.dragHandle = _chunkVXM7Q6P5cjs.dragHandle; exports.elementChildren = _chunkYIFOGP2Dcjs.elementChildren; exports.embedBlock = _chunkVXM7Q6P5cjs.embedBlock; exports.emoji = emoji; exports.focusBlockId = _chunkYIFOGP2Dcjs.focusBlockId; exports.highlightMark = _chunkVXM7Q6P5cjs.highlightMark; exports.history = _chunkVXM7Q6P5cjs.history; exports.hrBlock = _chunkVXM7Q6P5cjs.hrBlock; exports.imageBlock = _chunkVXM7Q6P5cjs.imageBlock; exports.indentItem = _chunkVXM7Q6P5cjs.indentItem; exports.inputRules = _chunkVXM7Q6P5cjs.inputRules; exports.invisibleCharacters = invisibleCharacters; exports.isAtom = _chunkVXM7Q6P5cjs.isAtom; exports.isOpaque = _chunkVXM7Q6P5cjs.isOpaque; exports.italicMark = _chunkVXM7Q6P5cjs.italicMark; exports.leafText = _chunkVXM7Q6P5cjs.leafText; exports.lineBoundaryBack = _chunkVXM7Q6P5cjs.lineBoundaryBack; exports.lineBoundaryFwd = _chunkVXM7Q6P5cjs.lineBoundaryFwd; exports.linkMark = _chunkVXM7Q6P5cjs.linkMark; exports.mapInput = _chunkVXM7Q6P5cjs.mapInput; exports.mapPaste = _chunkVXM7Q6P5cjs.mapPaste; exports.mapPasteBlocks = _chunkVXM7Q6P5cjs.mapPasteBlocks; exports.markExtensions = _chunkVXM7Q6P5cjs.markExtensions; exports.markloomKit = _chunkVXM7Q6P5cjs.markloomKit; exports.marksAtCaret = _chunkVXM7Q6P5cjs.marksAtCaret; exports.mentionMenu = _chunkVXM7Q6P5cjs.mentionMenu; exports.mergeTextStyleAttrs = _chunkVXM7Q6P5cjs.mergeTextStyleAttrs; exports.normalizeLinkUrl = _chunkVXM7Q6P5cjs.normalizeLinkUrl; exports.outdentItem = _chunkVXM7Q6P5cjs.outdentItem; exports.pointToDom = _chunkYIFOGP2Dcjs.pointToDom; exports.readSelection = _chunkYIFOGP2Dcjs.readSelection; exports.renderCode = _chunkVXM7Q6P5cjs.renderCode; exports.renderDoc = _chunkVXM7Q6P5cjs.renderDoc; exports.renderEmbed = _chunkVXM7Q6P5cjs.renderEmbed; exports.renderHr = _chunkVXM7Q6P5cjs.renderHr; exports.renderImage = _chunkVXM7Q6P5cjs.renderImage; exports.renderTable = _chunkVXM7Q6P5cjs.renderTable; exports.renderToHtml = _chunkVXM7Q6P5cjs.renderToHtml; exports.resolve = _chunkVXM7Q6P5cjs.resolve; exports.rootEl = _chunkYIFOGP2Dcjs.rootEl; exports.safeCssValue = _chunkVXM7Q6P5cjs.safeCssValue; exports.serializeSelection = _chunkVXM7Q6P5cjs.serializeSelection; exports.setAlign = _chunkVXM7Q6P5cjs.setAlign; exports.setCalloutVariant = _chunkVXM7Q6P5cjs.setCalloutVariant; exports.setTextStyle = _chunkVXM7Q6P5cjs.setTextStyle; exports.shikiCodeView = shikiCodeView; exports.slashMenu = _chunkVXM7Q6P5cjs.slashMenu; exports.startAiWrite = _chunkYIFOGP2Dcjs.startAiWrite; exports.strikeMark = _chunkVXM7Q6P5cjs.strikeMark; exports.subscriptMark = _chunkVXM7Q6P5cjs.subscriptMark; exports.superscriptMark = _chunkVXM7Q6P5cjs.superscriptMark; exports.tableBlock = _chunkVXM7Q6P5cjs.tableBlock; exports.textAlign = _chunkVXM7Q6P5cjs.textAlign; exports.textStyleCss = _chunkVXM7Q6P5cjs.textStyleCss; exports.textStyleMark = _chunkVXM7Q6P5cjs.textStyleMark; exports.toggleMark = _chunkVXM7Q6P5cjs.toggleMark; exports.toggleMarkList = _chunkVXM7Q6P5cjs.toggleMarkList; exports.twitchChannel = _chunkVXM7Q6P5cjs.twitchChannel; exports.typography = typography; exports.underlineMark = _chunkVXM7Q6P5cjs.underlineMark; exports.wordBoundaryBack = _chunkVXM7Q6P5cjs.wordBoundaryBack; exports.wordBoundaryFwd = _chunkVXM7Q6P5cjs.wordBoundaryFwd; exports.wrapList = _chunkVXM7Q6P5cjs.wrapList; exports.writeSelection = _chunkYIFOGP2Dcjs.writeSelection; exports.youtubeId = _chunkVXM7Q6P5cjs.youtubeId;
@@ -1,7 +1,9 @@
1
- import { N as NodeView, l as Extension } from '../controller-Cd1Dprrk.cjs';
2
- export { e as AiWriteMode, f as AiWriteSession, m as AtomSelectCtx, B as BlockInputRule, n as BlockKind, o as BlockRenderCtx, p as BlockRenderer, C as CALLOUT_VARIANTS, q as CalloutVariant, D as DecorationFactory, r as DecorationHost, k as Editor, E as EditorOptions, I as InputResult, t as InputRuleCtx, u as Intent, K as KeymapCommand, v as KeymapCtx, w as KeymapResult, x as MentionCandidate, y as MentionHost, z as MentionMenu, F as MentionPopovers, G as MentionPopoversHost, H as MentionProfile, J as NodeViewCtx, P as PasteRule, R as RenderOpts, L as Resolved, S as SlashCommand, T as TextStylePatch, O as atomIsSelected, h as blockPlainText, Q as blockTransform, U as calloutVariantFromQuery, V as caret, W as chord, X as cycleCalloutVariant, Y as defaultBlockRenderers, Z as defaultBlockTag, _ as defaultMarkTag, $ as diffSpan, j as focusBlockId, a0 as indentItem, a1 as isAtom, a2 as isOpaque, a3 as leafText, a4 as lineBoundaryBack, a5 as lineBoundaryFwd, a6 as mapInput, a7 as mapPaste, a8 as mapPasteBlocks, a9 as marksAtCaret, aa as mergeTextStyleAttrs, ab as outdentItem, ac as renderCode, ad as renderDoc, ae as renderEmbed, af as renderHr, ag as renderImage, ah as renderTable, ai as renderToHtml, aj as resolve, ak as safeCssValue, al as serializeSelection, am as setAlign, an as setCalloutVariant, ao as setTextStyle, s as startAiWrite, ap as textStyleCss, aq as toggleMark, ar as toggleMarkList, as as twitchChannel, at as wordBoundaryBack, au as wordBoundaryFwd, av as wrapList, aw as youtubeId } from '../controller-Cd1Dprrk.cjs';
3
- import { E as ElementNode, a as Position, N as Node, g as Selection, S as Step, C as CommentAuthor, d as CommentThread, c as CommentRenderState } from '../comments-USjT1wYN.cjs';
1
+ import { N as NodeView, l as Extension } from '../controller-DQITsFhy.cjs';
2
+ export { e as AiWriteMode, f as AiWriteSession, m as AtomSelectCtx, B as BlockInputRule, n as BlockKind, o as BlockRenderCtx, p as BlockRenderer, C as CALLOUT_VARIANTS, q as CalloutVariant, D as DecorationFactory, r as DecorationHost, k as Editor, E as EditorOptions, I as InputResult, t as InputRuleCtx, u as Intent, K as KeymapCommand, v as KeymapCtx, w as KeymapResult, x as MentionCandidate, y as MentionHost, z as MentionMenu, F as MentionPopovers, G as MentionPopoversHost, H as MentionProfile, J as NodeViewCtx, P as PasteRule, R as RenderOpts, L as Resolved, S as SlashCommand, T as TextStylePatch, O as atomIsSelected, h as blockPlainText, Q as blockTransform, U as calloutVariantFromQuery, V as caret, W as chord, X as cycleCalloutVariant, Y as defaultBlockRenderers, Z as defaultBlockTag, _ as defaultMarkTag, $ as diffSpan, j as focusBlockId, a0 as indentItem, a1 as isAtom, a2 as isOpaque, a3 as leafText, a4 as lineBoundaryBack, a5 as lineBoundaryFwd, a6 as mapInput, a7 as mapPaste, a8 as mapPasteBlocks, a9 as marksAtCaret, aa as mergeTextStyleAttrs, ab as outdentItem, ac as renderCode, ad as renderDoc, ae as renderEmbed, af as renderHr, ag as renderImage, ah as renderTable, ai as renderToHtml, aj as resolve, ak as safeCssValue, al as serializeSelection, am as setAlign, an as setCalloutVariant, ao as setTextStyle, s as startAiWrite, ap as textStyleCss, aq as toggleMark, ar as toggleMarkList, as as twitchChannel, at as wordBoundaryBack, au as wordBoundaryFwd, av as wrapList, aw as youtubeId } from '../controller-DQITsFhy.cjs';
3
+ import { E as ElementNode, a as Position, N as Node, c as Selection, S as Step } from '../step-BrvHIK7O.cjs';
4
+ import { C as CommentAuthor, c as CommentThread, b as CommentRenderState } from '../comments-DlExS6f-.cjs';
4
5
  import 'preact';
6
+ import '../client-ZRZj2nkq.cjs';
5
7
 
6
8
  declare function shikiCodeView(highlight: (code: string, lang?: string) => string, langs?: () => string[]): NodeView;
7
9
 
@@ -1,7 +1,9 @@
1
- import { N as NodeView, l as Extension } from '../controller-B_wG2Wh-.js';
2
- export { e as AiWriteMode, f as AiWriteSession, m as AtomSelectCtx, B as BlockInputRule, n as BlockKind, o as BlockRenderCtx, p as BlockRenderer, C as CALLOUT_VARIANTS, q as CalloutVariant, D as DecorationFactory, r as DecorationHost, k as Editor, E as EditorOptions, I as InputResult, t as InputRuleCtx, u as Intent, K as KeymapCommand, v as KeymapCtx, w as KeymapResult, x as MentionCandidate, y as MentionHost, z as MentionMenu, F as MentionPopovers, G as MentionPopoversHost, H as MentionProfile, J as NodeViewCtx, P as PasteRule, R as RenderOpts, L as Resolved, S as SlashCommand, T as TextStylePatch, O as atomIsSelected, h as blockPlainText, Q as blockTransform, U as calloutVariantFromQuery, V as caret, W as chord, X as cycleCalloutVariant, Y as defaultBlockRenderers, Z as defaultBlockTag, _ as defaultMarkTag, $ as diffSpan, j as focusBlockId, a0 as indentItem, a1 as isAtom, a2 as isOpaque, a3 as leafText, a4 as lineBoundaryBack, a5 as lineBoundaryFwd, a6 as mapInput, a7 as mapPaste, a8 as mapPasteBlocks, a9 as marksAtCaret, aa as mergeTextStyleAttrs, ab as outdentItem, ac as renderCode, ad as renderDoc, ae as renderEmbed, af as renderHr, ag as renderImage, ah as renderTable, ai as renderToHtml, aj as resolve, ak as safeCssValue, al as serializeSelection, am as setAlign, an as setCalloutVariant, ao as setTextStyle, s as startAiWrite, ap as textStyleCss, aq as toggleMark, ar as toggleMarkList, as as twitchChannel, at as wordBoundaryBack, au as wordBoundaryFwd, av as wrapList, aw as youtubeId } from '../controller-B_wG2Wh-.js';
3
- import { E as ElementNode, a as Position, N as Node, g as Selection, S as Step, C as CommentAuthor, d as CommentThread, c as CommentRenderState } from '../comments-USjT1wYN.js';
1
+ import { N as NodeView, l as Extension } from '../controller-BNuuUM3E.js';
2
+ export { e as AiWriteMode, f as AiWriteSession, m as AtomSelectCtx, B as BlockInputRule, n as BlockKind, o as BlockRenderCtx, p as BlockRenderer, C as CALLOUT_VARIANTS, q as CalloutVariant, D as DecorationFactory, r as DecorationHost, k as Editor, E as EditorOptions, I as InputResult, t as InputRuleCtx, u as Intent, K as KeymapCommand, v as KeymapCtx, w as KeymapResult, x as MentionCandidate, y as MentionHost, z as MentionMenu, F as MentionPopovers, G as MentionPopoversHost, H as MentionProfile, J as NodeViewCtx, P as PasteRule, R as RenderOpts, L as Resolved, S as SlashCommand, T as TextStylePatch, O as atomIsSelected, h as blockPlainText, Q as blockTransform, U as calloutVariantFromQuery, V as caret, W as chord, X as cycleCalloutVariant, Y as defaultBlockRenderers, Z as defaultBlockTag, _ as defaultMarkTag, $ as diffSpan, j as focusBlockId, a0 as indentItem, a1 as isAtom, a2 as isOpaque, a3 as leafText, a4 as lineBoundaryBack, a5 as lineBoundaryFwd, a6 as mapInput, a7 as mapPaste, a8 as mapPasteBlocks, a9 as marksAtCaret, aa as mergeTextStyleAttrs, ab as outdentItem, ac as renderCode, ad as renderDoc, ae as renderEmbed, af as renderHr, ag as renderImage, ah as renderTable, ai as renderToHtml, aj as resolve, ak as safeCssValue, al as serializeSelection, am as setAlign, an as setCalloutVariant, ao as setTextStyle, s as startAiWrite, ap as textStyleCss, aq as toggleMark, ar as toggleMarkList, as as twitchChannel, at as wordBoundaryBack, au as wordBoundaryFwd, av as wrapList, aw as youtubeId } from '../controller-BNuuUM3E.js';
3
+ import { E as ElementNode, a as Position, N as Node, c as Selection, S as Step } from '../step-BrvHIK7O.js';
4
+ import { C as CommentAuthor, c as CommentThread, b as CommentRenderState } from '../comments-PhnR7Gkn.js';
4
5
  import 'preact';
6
+ import '../client-6KiH4kGK.js';
5
7
 
6
8
  declare function shikiCodeView(highlight: (code: string, lang?: string) => string, langs?: () => string[]): NodeView;
7
9
 
@@ -79,8 +79,8 @@ import {
79
79
  wordBoundaryFwd,
80
80
  wrapList,
81
81
  youtubeId
82
- } from "../chunk-VMUJM52A.js";
83
- import "../chunk-ITVAR2UM.js";
82
+ } from "../chunk-ZMTLSFLO.js";
83
+ import "../chunk-LEYAQNJA.js";
84
84
  import {
85
85
  blockPlainText,
86
86
  domToPoint,
@@ -91,8 +91,11 @@ import {
91
91
  rootEl,
92
92
  startAiWrite,
93
93
  writeSelection
94
- } from "../chunk-QXJHFQLJ.js";
95
- import "../chunk-J3QWW6CN.js";
94
+ } from "../chunk-FCH7LZFI.js";
95
+ import "../chunk-MFYF2A6U.js";
96
+ import "../chunk-4JSJAHTB.js";
97
+ import "../chunk-RLTHVQNQ.js";
98
+ import "../chunk-LA5SBCGQ.js";
96
99
 
97
100
  // src/view/shiki-code-view.ts
98
101
  import { h } from "preact";
@@ -2625,3 +2625,75 @@ html.markloom-toc-open,
2625
2625
  text-decoration-color: rgba(255, 255, 255, 0.28);
2626
2626
  }
2627
2627
  }
2628
+
2629
+ /* ── 协作在场(飞书式头像条 + 远端彩光标) ── */
2630
+ .markloom-collab-rail {
2631
+ position: sticky;
2632
+ top: 0;
2633
+ z-index: 40;
2634
+ display: flex;
2635
+ justify-content: flex-end;
2636
+ pointer-events: none;
2637
+ padding: 8px 12px 0;
2638
+ margin: 0 0 4px;
2639
+ }
2640
+ .markloom-collab-avatars {
2641
+ display: flex;
2642
+ flex-direction: row;
2643
+ align-items: center;
2644
+ pointer-events: auto;
2645
+ }
2646
+ .markloom-collab-avatar {
2647
+ width: 28px;
2648
+ height: 28px;
2649
+ border-radius: 50%;
2650
+ background: var(--collab-c, #3370ff);
2651
+ color: #fff;
2652
+ font-size: 12px;
2653
+ font-weight: 600;
2654
+ line-height: 28px;
2655
+ text-align: center;
2656
+ border: 2px solid var(--bg-page, #fff);
2657
+ box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12);
2658
+ margin-left: -8px;
2659
+ cursor: default;
2660
+ user-select: none;
2661
+ }
2662
+ .markloom-collab-avatar:first-child {
2663
+ margin-left: 0;
2664
+ }
2665
+ .markloom-collab-avatar.is-self {
2666
+ box-shadow: 0 0 0 2px var(--collab-c, #3370ff), 0 1px 2px rgba(0, 0, 0, 0.12);
2667
+ }
2668
+ .markloom-collab-carets {
2669
+ position: absolute;
2670
+ inset: 0;
2671
+ pointer-events: none;
2672
+ z-index: 35;
2673
+ overflow: visible;
2674
+ }
2675
+ .markloom-collab-caret {
2676
+ position: absolute;
2677
+ width: 2px;
2678
+ background: var(--collab-c, #3370ff);
2679
+ border-radius: 1px;
2680
+ transform: translateX(-1px);
2681
+ pointer-events: none;
2682
+ }
2683
+ .markloom-collab-caret-lab {
2684
+ position: absolute;
2685
+ left: 0;
2686
+ top: -18px;
2687
+ max-width: 120px;
2688
+ overflow: hidden;
2689
+ text-overflow: ellipsis;
2690
+ white-space: nowrap;
2691
+ padding: 1px 6px;
2692
+ border-radius: 3px 3px 3px 0;
2693
+ background: var(--collab-c, #3370ff);
2694
+ color: #fff;
2695
+ font-size: 11px;
2696
+ font-weight: 500;
2697
+ line-height: 16px;
2698
+ pointer-events: none;
2699
+ }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "markloom",
3
- "version": "0.4.0",
4
- "description": "The loom for Markdown — rich text with MD isomorphism, reversible Steps, controlled editor, optional AI write transactions",
3
+ "version": "0.5.1",
4
+ "description": "The loom for Markdown — rich text with MD isomorphism, reversible Steps, controlled editor, optional AI write + realtime collab",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",
7
7
  "module": "./dist/index.js",
@@ -27,6 +27,11 @@
27
27
  "import": "./dist/ai/index.js",
28
28
  "require": "./dist/ai/index.cjs"
29
29
  },
30
+ "./collab": {
31
+ "types": "./dist/collab/index.d.ts",
32
+ "import": "./dist/collab/index.js",
33
+ "require": "./dist/collab/index.cjs"
34
+ },
30
35
  "./view/theme.css": "./dist/view/theme.css",
31
36
  "./ai/theme.css": "./dist/ai/theme.css"
32
37
  },
@@ -35,7 +40,9 @@
35
40
  },
36
41
  "files": [
37
42
  "dist",
38
- "README.md"
43
+ "README.md",
44
+ "ai.md",
45
+ "collab.md"
39
46
  ],
40
47
  "scripts": {
41
48
  "typecheck": "tsc --noEmit",
@@ -1,105 +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
- 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 };