@tabula-md/tabula 0.2.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 (122) hide show
  1. package/README.md +106 -0
  2. package/dist/activeDocumentRuntime.d.ts +50 -0
  3. package/dist/activeDocumentRuntime.d.ts.map +1 -0
  4. package/dist/collabCollaborators.d.ts +16 -0
  5. package/dist/collabCollaborators.d.ts.map +1 -0
  6. package/dist/collabConnectionModel.d.ts +11 -0
  7. package/dist/collabConnectionModel.d.ts.map +1 -0
  8. package/dist/collabSessionState.d.ts +24 -0
  9. package/dist/collabSessionState.d.ts.map +1 -0
  10. package/dist/collaboration.d.ts +8 -0
  11. package/dist/collaboration.d.ts.map +1 -0
  12. package/dist/collaboration.js +78 -0
  13. package/dist/collaboration.js.map +1 -0
  14. package/dist/collaborationPresence.d.ts +7 -0
  15. package/dist/collaborationPresence.d.ts.map +1 -0
  16. package/dist/collaborationTypes.d.ts +27 -0
  17. package/dist/collaborationTypes.d.ts.map +1 -0
  18. package/dist/commentRuntimeModel.d.ts +53 -0
  19. package/dist/commentRuntimeModel.d.ts.map +1 -0
  20. package/dist/data/base64Url.d.ts +3 -0
  21. package/dist/data/base64Url.d.ts.map +1 -0
  22. package/dist/data/encode.d.ts +20 -0
  23. package/dist/data/encode.d.ts.map +1 -0
  24. package/dist/data/encode.js +61 -0
  25. package/dist/data/encode.js.map +1 -0
  26. package/dist/data/encryption.d.ts +20 -0
  27. package/dist/data/encryption.d.ts.map +1 -0
  28. package/dist/data/encryption.js +13 -0
  29. package/dist/data/encryption.js.map +1 -0
  30. package/dist/data/json.d.ts +18 -0
  31. package/dist/data/json.d.ts.map +1 -0
  32. package/dist/data/json.js +18 -0
  33. package/dist/data/json.js.map +1 -0
  34. package/dist/data/restore.d.ts +3 -0
  35. package/dist/data/restore.d.ts.map +1 -0
  36. package/dist/data/restore.js +6 -0
  37. package/dist/data/restore.js.map +1 -0
  38. package/dist/documentBuffer.d.ts +68 -0
  39. package/dist/documentBuffer.d.ts.map +1 -0
  40. package/dist/documentControlsModel.d.ts +58 -0
  41. package/dist/documentControlsModel.d.ts.map +1 -0
  42. package/dist/documentMetrics.d.ts +2 -0
  43. package/dist/documentMetrics.d.ts.map +1 -0
  44. package/dist/documentPrimitives.d.ts +9 -0
  45. package/dist/documentPrimitives.d.ts.map +1 -0
  46. package/dist/documentSurfaceModel.d.ts +44 -0
  47. package/dist/documentSurfaceModel.d.ts.map +1 -0
  48. package/dist/encryption-B0xRVvlF.js +82 -0
  49. package/dist/encryption-B0xRVvlF.js.map +1 -0
  50. package/dist/index.d.ts +85 -0
  51. package/dist/index.d.ts.map +1 -0
  52. package/dist/index.js +2474 -0
  53. package/dist/index.js.map +1 -0
  54. package/dist/jsonShareLinkModel.d.ts +36 -0
  55. package/dist/jsonShareLinkModel.d.ts.map +1 -0
  56. package/dist/lineSurfaceModel.d.ts +73 -0
  57. package/dist/lineSurfaceModel.d.ts.map +1 -0
  58. package/dist/markdown/editing.d.ts +12 -0
  59. package/dist/markdown/editing.d.ts.map +1 -0
  60. package/dist/markdown/links.d.ts +23 -0
  61. package/dist/markdown/links.d.ts.map +1 -0
  62. package/dist/markdown/tasks.d.ts +22 -0
  63. package/dist/markdown/tasks.d.ts.map +1 -0
  64. package/dist/markdown.d.ts +25 -0
  65. package/dist/markdown.d.ts.map +1 -0
  66. package/dist/markdownEditing.d.ts +2 -0
  67. package/dist/markdownEditing.d.ts.map +1 -0
  68. package/dist/markdownFormatting.d.ts +11 -0
  69. package/dist/markdownFormatting.d.ts.map +1 -0
  70. package/dist/previewBlockModel.d.ts +66 -0
  71. package/dist/previewBlockModel.d.ts.map +1 -0
  72. package/dist/productPerformancePolicy.d.ts +14 -0
  73. package/dist/productPerformancePolicy.d.ts.map +1 -0
  74. package/dist/rightPanelCommentViewModel.d.ts +39 -0
  75. package/dist/rightPanelCommentViewModel.d.ts.map +1 -0
  76. package/dist/room/envelope.d.ts +27 -0
  77. package/dist/room/envelope.d.ts.map +1 -0
  78. package/dist/room/envelope.js +38 -0
  79. package/dist/room/envelope.js.map +1 -0
  80. package/dist/roomBinaryProtocol.d.ts +43 -0
  81. package/dist/roomBinaryProtocol.d.ts.map +1 -0
  82. package/dist/roomCollaboration.d.ts +39 -0
  83. package/dist/roomCollaboration.d.ts.map +1 -0
  84. package/dist/roomProtocol.d.ts +11 -0
  85. package/dist/roomProtocol.d.ts.map +1 -0
  86. package/dist/roomShareLinkModel.d.ts +20 -0
  87. package/dist/roomShareLinkModel.d.ts.map +1 -0
  88. package/dist/shareLinkViewModel.d.ts +8 -0
  89. package/dist/shareLinkViewModel.d.ts.map +1 -0
  90. package/dist/shareSnapshotPayload-CsTw9sRq.js +209 -0
  91. package/dist/shareSnapshotPayload-CsTw9sRq.js.map +1 -0
  92. package/dist/shareSnapshotPayload.d.ts +75 -0
  93. package/dist/shareSnapshotPayload.d.ts.map +1 -0
  94. package/dist/shareViewModel.d.ts +33 -0
  95. package/dist/shareViewModel.d.ts.map +1 -0
  96. package/dist/sourceScrollTransfer.d.ts +54 -0
  97. package/dist/sourceScrollTransfer.d.ts.map +1 -0
  98. package/dist/statusBarViewModel.d.ts +13 -0
  99. package/dist/statusBarViewModel.d.ts.map +1 -0
  100. package/dist/textPatches.d.ts +16 -0
  101. package/dist/textPatches.d.ts.map +1 -0
  102. package/dist/workspaceFileRuntimeModel.d.ts +11 -0
  103. package/dist/workspaceFileRuntimeModel.d.ts.map +1 -0
  104. package/dist/workspaceIoModel.d.ts +37 -0
  105. package/dist/workspaceIoModel.d.ts.map +1 -0
  106. package/dist/workspaceModel.d.ts +112 -0
  107. package/dist/workspaceModel.d.ts.map +1 -0
  108. package/dist/workspaceRoomCheckpoint.d.ts +46 -0
  109. package/dist/workspaceRoomCheckpoint.d.ts.map +1 -0
  110. package/dist/workspaceRoomCrdt.d.ts +55 -0
  111. package/dist/workspaceRoomCrdt.d.ts.map +1 -0
  112. package/dist/workspaceRoomModel-CO-5ZOpS.js +78 -0
  113. package/dist/workspaceRoomModel-CO-5ZOpS.js.map +1 -0
  114. package/dist/workspaceRoomModel.d.ts +69 -0
  115. package/dist/workspaceRoomModel.d.ts.map +1 -0
  116. package/dist/workspaceRoomSync-B3niC7cn.js +758 -0
  117. package/dist/workspaceRoomSync-B3niC7cn.js.map +1 -0
  118. package/dist/workspaceRoomSync.d.ts +98 -0
  119. package/dist/workspaceRoomSync.d.ts.map +1 -0
  120. package/dist/workspaceViewModel.d.ts +13 -0
  121. package/dist/workspaceViewModel.d.ts.map +1 -0
  122. package/package.json +82 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shareLinkViewModel.d.ts","sourceRoot":"","sources":["../src/shareLinkViewModel.ts"],"names":[],"mappings":"AAMA,MAAM,MAAM,iBAAiB,GAAG;IAC9B,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,CAAC,EAAE,MAAM,CAAC;CACd,CAAC;AAEF,eAAO,MAAM,oBAAoB,GAAI,WAAW,MAAM,EAAE,iBAAiB,MAAM,KAAG,iBAmBjF,CAAC"}
@@ -0,0 +1,209 @@
1
+ import { c as M, d as R, W as F, b as N, f as x, e as B, a as g } from "./workspaceRoomModel-CO-5ZOpS.js";
2
+ const A = 2, I = new TextEncoder(), V = ({
3
+ files: e,
4
+ folders: r,
5
+ rootFolderId: t,
6
+ activeFileId: n,
7
+ commentsByFileId: a,
8
+ now: h = () => /* @__PURE__ */ new Date()
9
+ }) => {
10
+ var f;
11
+ const l = new Map(r.map((i) => [i.id, i])), c = l.get(t);
12
+ if (!c || c.parentId !== null)
13
+ throw new Error("Share link failed: invalid workspace root");
14
+ const s = e.map((i, d) => ({
15
+ id: i.id,
16
+ title: i.title,
17
+ text: i.text,
18
+ parentId: l.has(i.parentId ?? "") ? i.parentId : t,
19
+ order: Number.isFinite(i.order) ? i.order : d
20
+ }));
21
+ if (s.length === 0)
22
+ throw new Error("Share link failed: no documents selected");
23
+ const E = /* @__PURE__ */ new Set([t]);
24
+ for (const i of s) {
25
+ let d = i.parentId;
26
+ const b = /* @__PURE__ */ new Set();
27
+ for (; d && !b.has(d); )
28
+ b.add(d), E.add(d), d = ((f = l.get(d)) == null ? void 0 : f.parentId) ?? null;
29
+ }
30
+ const O = r.filter((i) => E.has(i.id)).map((i, d) => ({
31
+ id: i.id,
32
+ title: i.title,
33
+ parentId: i.id === t ? null : i.parentId,
34
+ order: Number.isFinite(i.order) ? i.order : d
35
+ })), o = s.find((i) => i.id === n) ?? s[0];
36
+ return P({
37
+ schemaVersion: A,
38
+ createdAt: h().toISOString(),
39
+ rootFolderId: t,
40
+ activeFileId: o.id,
41
+ folders: O,
42
+ files: s,
43
+ commentsByFileId: q(s, a)
44
+ });
45
+ }, G = ({
46
+ id: e,
47
+ url: r,
48
+ payload: t
49
+ }) => ({ ...t, id: e, url: r }), P = (e) => {
50
+ if (!w(e) || e.schemaVersion !== A)
51
+ throw new Error("Share link failed: unsupported snapshot payload");
52
+ if (!Array.isArray(e.files) || !Array.isArray(e.folders) || !w(e.commentsByFileId))
53
+ throw new Error("Share link failed: invalid snapshot payload");
54
+ const r = p(e.rootFolderId, "rootFolderId"), t = e.folders.map(K), n = e.files.map(X);
55
+ if (n.length > M || t.length - 1 > R)
56
+ throw new Error("Share link failed: workspace is too large");
57
+ const a = /* @__PURE__ */ new Set();
58
+ for (const o of t) {
59
+ if (a.has(o.id)) throw new Error("Share link failed: duplicate folder id");
60
+ a.add(o.id);
61
+ }
62
+ const h = t.find((o) => o.id === r);
63
+ if (!h || h.parentId !== null) throw new Error("Share link failed: invalid workspace root");
64
+ const l = new Map(t.map((o) => [o.id, o]));
65
+ for (const o of t) {
66
+ if (o.id !== r && (!o.parentId || !a.has(o.parentId)))
67
+ throw new Error("Share link failed: invalid folder parent");
68
+ T(o.id, r, l);
69
+ }
70
+ const c = /* @__PURE__ */ new Set();
71
+ for (const o of n) {
72
+ if (c.has(o.id) || a.has(o.id)) throw new Error("Share link failed: duplicate file id");
73
+ if (!a.has(o.parentId)) throw new Error("Share link failed: invalid file parent");
74
+ c.add(o.id);
75
+ }
76
+ if (n.length === 0 || !c.has(p(e.activeFileId, "activeFileId")))
77
+ throw new Error("Share link failed: invalid active file");
78
+ for (const o of Object.keys(e.commentsByFileId))
79
+ if (!c.has(o)) throw new Error("Share link failed: comments reference an unknown file");
80
+ const s = $(e.commentsByFileId), E = Object.values(s).flat();
81
+ if (E.length > F)
82
+ throw new Error("Share link failed: too many comments");
83
+ if (n.reduce((o, f) => o + I.encode(f.text).byteLength, 0) + E.reduce((o, f) => o + I.encode(f.body).byteLength + (f.replies ?? []).reduce((i, d) => i + I.encode(d.body).byteLength, 0), 0) > N)
84
+ throw new Error("Share link failed: workspace content exceeds 10 MiB");
85
+ return {
86
+ schemaVersion: A,
87
+ createdAt: p(e.createdAt, "createdAt"),
88
+ rootFolderId: r,
89
+ activeFileId: e.activeFileId,
90
+ folders: t,
91
+ files: n,
92
+ commentsByFileId: s
93
+ };
94
+ }, T = (e, r, t) => {
95
+ var l;
96
+ const n = /* @__PURE__ */ new Set();
97
+ let a = e, h = 0;
98
+ for (; a && a !== r; ) {
99
+ if (n.has(a)) throw new Error("Share link failed: cyclic folder tree");
100
+ if (n.add(a), a = ((l = t.get(a)) == null ? void 0 : l.parentId) ?? null, h += 1, h > x) throw new Error("Share link failed: folder tree is too deep");
101
+ }
102
+ if (a !== r) throw new Error("Share link failed: detached folder tree");
103
+ }, q = (e, r) => {
104
+ const t = new Set(e.map((n) => n.id));
105
+ return Object.fromEntries(
106
+ Object.entries(r).filter(([n, a]) => t.has(n) && a.length > 0).map(([n, a]) => [n, a.map(W)])
107
+ );
108
+ }, W = (e) => ({
109
+ id: e.id,
110
+ body: e.body,
111
+ ...e.authorName ? { authorName: e.authorName } : {},
112
+ ...e.authorColor ? { authorColor: e.authorColor } : {},
113
+ ...e.quote ? { quote: e.quote } : {},
114
+ ...e.sourceQuote ? { sourceQuote: e.sourceQuote } : {},
115
+ ...typeof e.selectionStart == "number" ? { selectionStart: e.selectionStart } : {},
116
+ ...typeof e.selectionEnd == "number" ? { selectionEnd: e.selectionEnd } : {},
117
+ ...typeof e.resolved == "boolean" ? { resolved: e.resolved } : {},
118
+ ...e.replies ? { replies: e.replies.map(j) } : {},
119
+ createdAt: e.createdAt
120
+ }), j = (e) => ({
121
+ id: e.id,
122
+ body: e.body,
123
+ ...e.authorName ? { authorName: e.authorName } : {},
124
+ ...e.authorColor ? { authorColor: e.authorColor } : {},
125
+ createdAt: e.createdAt
126
+ }), K = (e) => {
127
+ if (!w(e)) throw new Error("Share link failed: invalid snapshot folder");
128
+ return {
129
+ id: y(e.id, "folder.id"),
130
+ title: _(e.title, "folder.title"),
131
+ parentId: e.parentId === null ? null : y(e.parentId, "folder.parentId"),
132
+ order: k(e.order, "folder.order")
133
+ };
134
+ }, X = (e) => {
135
+ if (!w(e)) throw new Error("Share link failed: invalid snapshot file");
136
+ return {
137
+ id: y(e.id, "file.id"),
138
+ title: _(e.title, "file.title"),
139
+ text: u(e.text, "file.text"),
140
+ parentId: p(e.parentId, "file.parentId"),
141
+ order: k(e.order, "file.order")
142
+ };
143
+ }, $ = (e) => Object.fromEntries(Object.entries(e).map(([r, t]) => {
144
+ if (!Array.isArray(t)) throw new Error("Share link failed: invalid snapshot comments");
145
+ return [r, t.map(H)];
146
+ })), H = (e) => {
147
+ if (!w(e)) throw new Error("Share link failed: invalid snapshot comment");
148
+ return {
149
+ id: y(e.id, "comment.id"),
150
+ body: m(e.body, "comment.body", g),
151
+ ...S(e.authorName, "authorName"),
152
+ ...S(e.authorColor, "authorColor"),
153
+ ...S(e.quote, "quote"),
154
+ ...S(e.sourceQuote, "sourceQuote"),
155
+ ...C(e.selectionStart, "selectionStart"),
156
+ ...C(e.selectionEnd, "selectionEnd"),
157
+ ...Q(e.resolved, "resolved"),
158
+ ...e.replies === void 0 ? {} : { replies: L(e.replies) },
159
+ createdAt: p(e.createdAt, "comment.createdAt")
160
+ };
161
+ }, L = (e) => {
162
+ if (!Array.isArray(e)) throw new Error("Share link failed: invalid snapshot replies");
163
+ if (e.length > B) throw new Error("Share link failed: too many comment replies");
164
+ return e.map((r) => {
165
+ if (!w(r)) throw new Error("Share link failed: invalid snapshot reply");
166
+ return {
167
+ id: y(r.id, "reply.id"),
168
+ body: m(r.body, "reply.body", g),
169
+ ...S(r.authorName, "authorName"),
170
+ ...S(r.authorColor, "authorColor"),
171
+ createdAt: p(r.createdAt, "reply.createdAt")
172
+ };
173
+ });
174
+ }, S = (e, r) => e === void 0 ? {} : { [r]: u(e, r) }, C = (e, r) => e === void 0 ? {} : { [r]: k(e, r) }, Q = (e, r) => {
175
+ if (e === void 0) return {};
176
+ if (typeof e != "boolean") throw new Error(`Share link failed: missing ${r}`);
177
+ return { [r]: e };
178
+ }, k = (e, r) => {
179
+ if (typeof e != "number" || !Number.isFinite(e))
180
+ throw new Error(`Share link failed: missing ${r}`);
181
+ return e;
182
+ }, u = (e, r) => {
183
+ if (typeof e != "string") throw new Error(`Share link failed: missing ${r}`);
184
+ return e;
185
+ }, p = (e, r) => {
186
+ const t = u(e, r);
187
+ if (!t) throw new Error(`Share link failed: missing ${r}`);
188
+ return t;
189
+ }, m = (e, r, t) => {
190
+ const n = u(e, r);
191
+ if (n.length > t) throw new Error(`Share link failed: ${r} is too long`);
192
+ return n;
193
+ }, y = (e, r) => {
194
+ const t = p(e, r);
195
+ if (t.length > 200 || t.includes("\0")) throw new Error(`Share link failed: invalid ${r}`);
196
+ return t;
197
+ }, _ = (e, r) => {
198
+ const t = m(e, r, 120).trim();
199
+ if (!t || t === "." || t === ".." || t.includes("\0") || /[/\\]/.test(t))
200
+ throw new Error(`Share link failed: invalid ${r}`);
201
+ return t;
202
+ }, w = (e) => typeof e == "object" && e !== null && !Array.isArray(e);
203
+ export {
204
+ A as S,
205
+ V as a,
206
+ G as c,
207
+ P as v
208
+ };
209
+ //# sourceMappingURL=shareSnapshotPayload-CsTw9sRq.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shareSnapshotPayload-CsTw9sRq.js","sources":["../src/shareSnapshotPayload.ts"],"sourcesContent":["import {\n WORKSPACE_ROOM_MAX_COMMENTS,\n WORKSPACE_ROOM_MAX_COMMENT_LENGTH,\n WORKSPACE_ROOM_MAX_CONTENT_BYTES,\n WORKSPACE_ROOM_MAX_DOCUMENTS,\n WORKSPACE_ROOM_MAX_FOLDERS,\n WORKSPACE_ROOM_MAX_REPLIES,\n WORKSPACE_ROOM_MAX_TREE_DEPTH,\n} from \"./workspaceRoomModel\";\n\nexport const SHARE_SNAPSHOT_SCHEMA_VERSION = 2;\nconst textEncoder = new TextEncoder();\n\nexport type ShareSnapshotSourceFile = {\n id: string;\n title: string;\n text: string;\n parentId?: string | null;\n order?: number;\n};\n\nexport type ShareSnapshotSourceFolder = {\n id: string;\n title: string;\n parentId: string | null;\n order?: number;\n};\n\nexport type ShareSnapshotFile = {\n id: string;\n title: string;\n text: string;\n parentId: string;\n order: number;\n};\n\nexport type ShareSnapshotFolder = {\n id: string;\n title: string;\n parentId: string | null;\n order: number;\n};\n\nexport type ShareSnapshotCommentReply = {\n id: string;\n body: string;\n authorName?: string;\n authorColor?: string;\n createdAt: string;\n};\n\nexport type ShareSnapshotComment = {\n id: string;\n body: string;\n authorName?: string;\n authorColor?: string;\n quote?: string;\n sourceQuote?: string;\n selectionStart?: number;\n selectionEnd?: number;\n resolved?: boolean;\n replies?: ShareSnapshotCommentReply[];\n createdAt: string;\n};\n\nexport type ShareSnapshotPayload = {\n schemaVersion: typeof SHARE_SNAPSHOT_SCHEMA_VERSION;\n createdAt: string;\n rootFolderId: string;\n activeFileId: string;\n folders: ShareSnapshotFolder[];\n files: ShareSnapshotFile[];\n commentsByFileId: Record<string, ShareSnapshotComment[]>;\n};\n\nexport type ShareSnapshot = ShareSnapshotPayload & {\n id: string;\n url: string;\n};\n\nexport const createShareSnapshotPayload = ({\n files,\n folders,\n rootFolderId,\n activeFileId,\n commentsByFileId,\n now = () => new Date(),\n}: {\n files: ShareSnapshotSourceFile[];\n folders: ShareSnapshotSourceFolder[];\n rootFolderId: string;\n activeFileId: string;\n commentsByFileId: Record<string, ShareSnapshotComment[]>;\n now?: () => Date;\n}): ShareSnapshotPayload => {\n const foldersById = new Map(folders.map((folder) => [folder.id, folder]));\n const root = foldersById.get(rootFolderId);\n if (!root || root.parentId !== null) {\n throw new Error(\"Share link failed: invalid workspace root\");\n }\n\n const snapshotFiles = files.map((file, index): ShareSnapshotFile => ({\n id: file.id,\n title: file.title,\n text: file.text,\n parentId: foldersById.has(file.parentId ?? \"\") ? file.parentId! : rootFolderId,\n order: Number.isFinite(file.order) ? file.order! : index,\n }));\n if (snapshotFiles.length === 0) {\n throw new Error(\"Share link failed: no documents selected\");\n }\n\n const includedFolderIds = new Set([rootFolderId]);\n for (const file of snapshotFiles) {\n let parentId: string | null = file.parentId;\n const visited = new Set<string>();\n while (parentId && !visited.has(parentId)) {\n visited.add(parentId);\n includedFolderIds.add(parentId);\n parentId = foldersById.get(parentId)?.parentId ?? null;\n }\n }\n const snapshotFolders = folders\n .filter((folder) => includedFolderIds.has(folder.id))\n .map((folder, index): ShareSnapshotFolder => ({\n id: folder.id,\n title: folder.title,\n parentId: folder.id === rootFolderId ? null : folder.parentId,\n order: Number.isFinite(folder.order) ? folder.order! : index,\n }));\n const activeFile = snapshotFiles.find((file) => file.id === activeFileId) ?? snapshotFiles[0]!;\n\n return validateShareSnapshotPayload({\n schemaVersion: SHARE_SNAPSHOT_SCHEMA_VERSION,\n createdAt: now().toISOString(),\n rootFolderId,\n activeFileId: activeFile.id,\n folders: snapshotFolders,\n files: snapshotFiles,\n commentsByFileId: toShareSnapshotComments(snapshotFiles, commentsByFileId),\n });\n};\n\nexport const createShareSnapshot = ({\n id,\n url,\n payload,\n}: {\n id: string;\n url: string;\n payload: ShareSnapshotPayload;\n}): ShareSnapshot => ({ ...payload, id, url });\n\nexport const validateShareSnapshotPayload = (value: unknown): ShareSnapshotPayload => {\n if (!isRecord(value) || value.schemaVersion !== SHARE_SNAPSHOT_SCHEMA_VERSION) {\n throw new Error(\"Share link failed: unsupported snapshot payload\");\n }\n if (!Array.isArray(value.files) || !Array.isArray(value.folders) || !isRecord(value.commentsByFileId)) {\n throw new Error(\"Share link failed: invalid snapshot payload\");\n }\n\n const rootFolderId = requireNonEmptyString(value.rootFolderId, \"rootFolderId\");\n const folders = value.folders.map(validateShareSnapshotFolder);\n const files = value.files.map(validateShareSnapshotFile);\n if (files.length > WORKSPACE_ROOM_MAX_DOCUMENTS || folders.length - 1 > WORKSPACE_ROOM_MAX_FOLDERS) {\n throw new Error(\"Share link failed: workspace is too large\");\n }\n const folderIds = new Set<string>();\n for (const folder of folders) {\n if (folderIds.has(folder.id)) throw new Error(\"Share link failed: duplicate folder id\");\n folderIds.add(folder.id);\n }\n const root = folders.find((folder) => folder.id === rootFolderId);\n if (!root || root.parentId !== null) throw new Error(\"Share link failed: invalid workspace root\");\n const foldersById = new Map(folders.map((item) => [item.id, item]));\n for (const folder of folders) {\n if (folder.id !== rootFolderId && (!folder.parentId || !folderIds.has(folder.parentId))) {\n throw new Error(\"Share link failed: invalid folder parent\");\n }\n assertFolderHasNoCycle(folder.id, rootFolderId, foldersById);\n }\n\n const fileIds = new Set<string>();\n for (const file of files) {\n if (fileIds.has(file.id) || folderIds.has(file.id)) throw new Error(\"Share link failed: duplicate file id\");\n if (!folderIds.has(file.parentId)) throw new Error(\"Share link failed: invalid file parent\");\n fileIds.add(file.id);\n }\n if (files.length === 0 || !fileIds.has(requireNonEmptyString(value.activeFileId, \"activeFileId\"))) {\n throw new Error(\"Share link failed: invalid active file\");\n }\n for (const fileId of Object.keys(value.commentsByFileId)) {\n if (!fileIds.has(fileId)) throw new Error(\"Share link failed: comments reference an unknown file\");\n }\n const commentsByFileId = validateCommentsByFileId(value.commentsByFileId);\n const comments = Object.values(commentsByFileId).flat();\n if (comments.length > WORKSPACE_ROOM_MAX_COMMENTS) {\n throw new Error(\"Share link failed: too many comments\");\n }\n const contentBytes = files.reduce((total, file) => total + textEncoder.encode(file.text).byteLength, 0) +\n comments.reduce((total, comment) => total + textEncoder.encode(comment.body).byteLength +\n (comment.replies ?? []).reduce((replyTotal, reply) => replyTotal + textEncoder.encode(reply.body).byteLength, 0), 0);\n if (contentBytes > WORKSPACE_ROOM_MAX_CONTENT_BYTES) {\n throw new Error(\"Share link failed: workspace content exceeds 10 MiB\");\n }\n\n return {\n schemaVersion: SHARE_SNAPSHOT_SCHEMA_VERSION,\n createdAt: requireNonEmptyString(value.createdAt, \"createdAt\"),\n rootFolderId,\n activeFileId: value.activeFileId as string,\n folders,\n files,\n commentsByFileId,\n };\n};\n\nconst assertFolderHasNoCycle = (\n folderId: string,\n rootFolderId: string,\n foldersById: Map<string, ShareSnapshotFolder>,\n) => {\n const visited = new Set<string>();\n let currentId: string | null = folderId;\n let depth = 0;\n while (currentId && currentId !== rootFolderId) {\n if (visited.has(currentId)) throw new Error(\"Share link failed: cyclic folder tree\");\n visited.add(currentId);\n currentId = foldersById.get(currentId)?.parentId ?? null;\n depth += 1;\n if (depth > WORKSPACE_ROOM_MAX_TREE_DEPTH) throw new Error(\"Share link failed: folder tree is too deep\");\n }\n if (currentId !== rootFolderId) throw new Error(\"Share link failed: detached folder tree\");\n};\n\nconst toShareSnapshotComments = (\n files: ShareSnapshotFile[],\n commentsByFileId: Record<string, ShareSnapshotComment[]>,\n): Record<string, ShareSnapshotComment[]> => {\n const fileIds = new Set(files.map((file) => file.id));\n return Object.fromEntries(\n Object.entries(commentsByFileId)\n .filter(([fileId, comments]) => fileIds.has(fileId) && comments.length > 0)\n .map(([fileId, comments]) => [fileId, comments.map(toShareSnapshotComment)]),\n );\n};\n\nconst toShareSnapshotComment = (comment: ShareSnapshotComment): ShareSnapshotComment => ({\n id: comment.id,\n body: comment.body,\n ...(comment.authorName ? { authorName: comment.authorName } : {}),\n ...(comment.authorColor ? { authorColor: comment.authorColor } : {}),\n ...(comment.quote ? { quote: comment.quote } : {}),\n ...(comment.sourceQuote ? { sourceQuote: comment.sourceQuote } : {}),\n ...(typeof comment.selectionStart === \"number\" ? { selectionStart: comment.selectionStart } : {}),\n ...(typeof comment.selectionEnd === \"number\" ? { selectionEnd: comment.selectionEnd } : {}),\n ...(typeof comment.resolved === \"boolean\" ? { resolved: comment.resolved } : {}),\n ...(comment.replies ? { replies: comment.replies.map(toShareSnapshotCommentReply) } : {}),\n createdAt: comment.createdAt,\n});\n\nconst toShareSnapshotCommentReply = (reply: ShareSnapshotCommentReply): ShareSnapshotCommentReply => ({\n id: reply.id,\n body: reply.body,\n ...(reply.authorName ? { authorName: reply.authorName } : {}),\n ...(reply.authorColor ? { authorColor: reply.authorColor } : {}),\n createdAt: reply.createdAt,\n});\n\nconst validateShareSnapshotFolder = (value: unknown): ShareSnapshotFolder => {\n if (!isRecord(value)) throw new Error(\"Share link failed: invalid snapshot folder\");\n return {\n id: requireIdentifier(value.id, \"folder.id\"),\n title: requireTitle(value.title, \"folder.title\"),\n parentId: value.parentId === null ? null : requireIdentifier(value.parentId, \"folder.parentId\"),\n order: requireFiniteNumber(value.order, \"folder.order\"),\n };\n};\n\nconst validateShareSnapshotFile = (value: unknown): ShareSnapshotFile => {\n if (!isRecord(value)) throw new Error(\"Share link failed: invalid snapshot file\");\n return {\n id: requireIdentifier(value.id, \"file.id\"),\n title: requireTitle(value.title, \"file.title\"),\n text: requireString(value.text, \"file.text\"),\n parentId: requireNonEmptyString(value.parentId, \"file.parentId\"),\n order: requireFiniteNumber(value.order, \"file.order\"),\n };\n};\n\nconst validateCommentsByFileId = (value: Record<string, unknown>): Record<string, ShareSnapshotComment[]> =>\n Object.fromEntries(Object.entries(value).map(([fileId, comments]) => {\n if (!Array.isArray(comments)) throw new Error(\"Share link failed: invalid snapshot comments\");\n return [fileId, comments.map(validateComment)] as const;\n }));\n\nconst validateComment = (value: unknown): ShareSnapshotComment => {\n if (!isRecord(value)) throw new Error(\"Share link failed: invalid snapshot comment\");\n return {\n id: requireIdentifier(value.id, \"comment.id\"),\n body: requireBoundedString(value.body, \"comment.body\", WORKSPACE_ROOM_MAX_COMMENT_LENGTH),\n ...optionalString(value.authorName, \"authorName\"),\n ...optionalString(value.authorColor, \"authorColor\"),\n ...optionalString(value.quote, \"quote\"),\n ...optionalString(value.sourceQuote, \"sourceQuote\"),\n ...optionalNumber(value.selectionStart, \"selectionStart\"),\n ...optionalNumber(value.selectionEnd, \"selectionEnd\"),\n ...optionalBoolean(value.resolved, \"resolved\"),\n ...(value.replies === undefined ? {} : { replies: validateReplies(value.replies) }),\n createdAt: requireNonEmptyString(value.createdAt, \"comment.createdAt\"),\n };\n};\n\nconst validateReplies = (value: unknown): ShareSnapshotCommentReply[] => {\n if (!Array.isArray(value)) throw new Error(\"Share link failed: invalid snapshot replies\");\n if (value.length > WORKSPACE_ROOM_MAX_REPLIES) throw new Error(\"Share link failed: too many comment replies\");\n return value.map((reply) => {\n if (!isRecord(reply)) throw new Error(\"Share link failed: invalid snapshot reply\");\n return {\n id: requireIdentifier(reply.id, \"reply.id\"),\n body: requireBoundedString(reply.body, \"reply.body\", WORKSPACE_ROOM_MAX_COMMENT_LENGTH),\n ...optionalString(reply.authorName, \"authorName\"),\n ...optionalString(reply.authorColor, \"authorColor\"),\n createdAt: requireNonEmptyString(reply.createdAt, \"reply.createdAt\"),\n };\n });\n};\n\nconst optionalString = (value: unknown, fieldName: string) =>\n value === undefined ? {} : { [fieldName]: requireString(value, fieldName) };\n\nconst optionalNumber = (value: unknown, fieldName: string) =>\n value === undefined ? {} : { [fieldName]: requireFiniteNumber(value, fieldName) };\n\nconst optionalBoolean = (value: unknown, fieldName: string) => {\n if (value === undefined) return {};\n if (typeof value !== \"boolean\") throw new Error(`Share link failed: missing ${fieldName}`);\n return { [fieldName]: value };\n};\n\nconst requireFiniteNumber = (value: unknown, fieldName: string) => {\n if (typeof value !== \"number\" || !Number.isFinite(value)) {\n throw new Error(`Share link failed: missing ${fieldName}`);\n }\n return value;\n};\n\nconst requireString = (value: unknown, fieldName: string) => {\n if (typeof value !== \"string\") throw new Error(`Share link failed: missing ${fieldName}`);\n return value;\n};\n\nconst requireNonEmptyString = (value: unknown, fieldName: string) => {\n const text = requireString(value, fieldName);\n if (!text) throw new Error(`Share link failed: missing ${fieldName}`);\n return text;\n};\n\nconst requireBoundedString = (value: unknown, fieldName: string, maxLength: number) => {\n const text = requireString(value, fieldName);\n if (text.length > maxLength) throw new Error(`Share link failed: ${fieldName} is too long`);\n return text;\n};\n\nconst requireIdentifier = (value: unknown, fieldName: string) => {\n const text = requireNonEmptyString(value, fieldName);\n if (text.length > 200 || text.includes(\"\\0\")) throw new Error(`Share link failed: invalid ${fieldName}`);\n return text;\n};\n\nconst requireTitle = (value: unknown, fieldName: string) => {\n const text = requireBoundedString(value, fieldName, 120).trim();\n if (!text || text === \".\" || text === \"..\" || text.includes(\"\\0\") || /[/\\\\]/.test(text)) {\n throw new Error(`Share link failed: invalid ${fieldName}`);\n }\n return text;\n};\n\nconst isRecord = (value: unknown): value is Record<string, unknown> =>\n typeof value === \"object\" && value !== null && !Array.isArray(value);\n"],"names":["SHARE_SNAPSHOT_SCHEMA_VERSION","textEncoder","createShareSnapshotPayload","files","folders","rootFolderId","activeFileId","commentsByFileId","now","foldersById","folder","root","snapshotFiles","file","index","includedFolderIds","parentId","visited","_a","snapshotFolders","activeFile","validateShareSnapshotPayload","toShareSnapshotComments","createShareSnapshot","id","url","payload","value","isRecord","requireNonEmptyString","validateShareSnapshotFolder","validateShareSnapshotFile","WORKSPACE_ROOM_MAX_DOCUMENTS","WORKSPACE_ROOM_MAX_FOLDERS","folderIds","item","assertFolderHasNoCycle","fileIds","fileId","validateCommentsByFileId","comments","WORKSPACE_ROOM_MAX_COMMENTS","total","comment","replyTotal","reply","WORKSPACE_ROOM_MAX_CONTENT_BYTES","folderId","currentId","depth","WORKSPACE_ROOM_MAX_TREE_DEPTH","toShareSnapshotComment","toShareSnapshotCommentReply","requireIdentifier","requireTitle","requireFiniteNumber","requireString","validateComment","requireBoundedString","WORKSPACE_ROOM_MAX_COMMENT_LENGTH","optionalString","optionalNumber","optionalBoolean","validateReplies","WORKSPACE_ROOM_MAX_REPLIES","fieldName","text","maxLength"],"mappings":";AAUO,MAAMA,IAAgC,GACvCC,IAAc,IAAI,YAAA,GAqEXC,IAA6B,CAAC;AAAA,EACzC,OAAAC;AAAA,EACA,SAAAC;AAAA,EACA,cAAAC;AAAA,EACA,cAAAC;AAAA,EACA,kBAAAC;AAAA,EACA,KAAAC,IAAM,MAAM,oBAAI,KAAA;AAClB,MAO4B;;AAC1B,QAAMC,IAAc,IAAI,IAAIL,EAAQ,IAAI,CAACM,MAAW,CAACA,EAAO,IAAIA,CAAM,CAAC,CAAC,GAClEC,IAAOF,EAAY,IAAIJ,CAAY;AACzC,MAAI,CAACM,KAAQA,EAAK,aAAa;AAC7B,UAAM,IAAI,MAAM,2CAA2C;AAG7D,QAAMC,IAAgBT,EAAM,IAAI,CAACU,GAAMC,OAA8B;AAAA,IACnE,IAAID,EAAK;AAAA,IACT,OAAOA,EAAK;AAAA,IACZ,MAAMA,EAAK;AAAA,IACX,UAAUJ,EAAY,IAAII,EAAK,YAAY,EAAE,IAAIA,EAAK,WAAYR;AAAA,IAClE,OAAO,OAAO,SAASQ,EAAK,KAAK,IAAIA,EAAK,QAASC;AAAA,EAAA,EACnD;AACF,MAAIF,EAAc,WAAW;AAC3B,UAAM,IAAI,MAAM,0CAA0C;AAG5D,QAAMG,IAAoB,oBAAI,IAAI,CAACV,CAAY,CAAC;AAChD,aAAWQ,KAAQD,GAAe;AAChC,QAAII,IAA0BH,EAAK;AACnC,UAAMI,wBAAc,IAAA;AACpB,WAAOD,KAAY,CAACC,EAAQ,IAAID,CAAQ;AACtC,MAAAC,EAAQ,IAAID,CAAQ,GACpBD,EAAkB,IAAIC,CAAQ,GAC9BA,MAAWE,IAAAT,EAAY,IAAIO,CAAQ,MAAxB,gBAAAE,EAA2B,aAAY;AAAA,EAE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AM,8BAA8BD,CAAS,EAAE;AAE3D,SAAOC;AACT,GAEMtC,IAAW,CAACD,MAChB,OAAOA,KAAU,YAAYA,MAAU,QAAQ,CAAC,MAAM,QAAQA,CAAK;"}
@@ -0,0 +1,75 @@
1
+ export declare const SHARE_SNAPSHOT_SCHEMA_VERSION = 2;
2
+ export type ShareSnapshotSourceFile = {
3
+ id: string;
4
+ title: string;
5
+ text: string;
6
+ parentId?: string | null;
7
+ order?: number;
8
+ };
9
+ export type ShareSnapshotSourceFolder = {
10
+ id: string;
11
+ title: string;
12
+ parentId: string | null;
13
+ order?: number;
14
+ };
15
+ export type ShareSnapshotFile = {
16
+ id: string;
17
+ title: string;
18
+ text: string;
19
+ parentId: string;
20
+ order: number;
21
+ };
22
+ export type ShareSnapshotFolder = {
23
+ id: string;
24
+ title: string;
25
+ parentId: string | null;
26
+ order: number;
27
+ };
28
+ export type ShareSnapshotCommentReply = {
29
+ id: string;
30
+ body: string;
31
+ authorName?: string;
32
+ authorColor?: string;
33
+ createdAt: string;
34
+ };
35
+ export type ShareSnapshotComment = {
36
+ id: string;
37
+ body: string;
38
+ authorName?: string;
39
+ authorColor?: string;
40
+ quote?: string;
41
+ sourceQuote?: string;
42
+ selectionStart?: number;
43
+ selectionEnd?: number;
44
+ resolved?: boolean;
45
+ replies?: ShareSnapshotCommentReply[];
46
+ createdAt: string;
47
+ };
48
+ export type ShareSnapshotPayload = {
49
+ schemaVersion: typeof SHARE_SNAPSHOT_SCHEMA_VERSION;
50
+ createdAt: string;
51
+ rootFolderId: string;
52
+ activeFileId: string;
53
+ folders: ShareSnapshotFolder[];
54
+ files: ShareSnapshotFile[];
55
+ commentsByFileId: Record<string, ShareSnapshotComment[]>;
56
+ };
57
+ export type ShareSnapshot = ShareSnapshotPayload & {
58
+ id: string;
59
+ url: string;
60
+ };
61
+ export declare const createShareSnapshotPayload: ({ files, folders, rootFolderId, activeFileId, commentsByFileId, now, }: {
62
+ files: ShareSnapshotSourceFile[];
63
+ folders: ShareSnapshotSourceFolder[];
64
+ rootFolderId: string;
65
+ activeFileId: string;
66
+ commentsByFileId: Record<string, ShareSnapshotComment[]>;
67
+ now?: () => Date;
68
+ }) => ShareSnapshotPayload;
69
+ export declare const createShareSnapshot: ({ id, url, payload, }: {
70
+ id: string;
71
+ url: string;
72
+ payload: ShareSnapshotPayload;
73
+ }) => ShareSnapshot;
74
+ export declare const validateShareSnapshotPayload: (value: unknown) => ShareSnapshotPayload;
75
+ //# sourceMappingURL=shareSnapshotPayload.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shareSnapshotPayload.d.ts","sourceRoot":"","sources":["../src/shareSnapshotPayload.ts"],"names":[],"mappings":"AAUA,eAAO,MAAM,6BAA6B,IAAI,CAAC;AAG/C,MAAM,MAAM,uBAAuB,GAAG;IACpC,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,MAAM,MAAM,yBAAyB,GAAG;IACtC,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG;IAC9B,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG;IAChC,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;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EAAE,MAAM,CAAC;IACrB,gBAAgB,EAAE,MAAM,CAAC,MAAM,EAAE,oBAAoB,EAAE,CAAC,CAAC;IACzD,GAAG,CAAC,EAAE,MAAM,IAAI,CAAC;CAClB,KAAG,oBA+CH,CAAC;AAEF,eAAO,MAAM,mBAAmB,GAAI,uBAIjC;IACD,EAAE,EAAE,MAAM,CAAC;IACX,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,EAAE,oBAAoB,CAAC;CAC/B,KAAG,aAA0C,CAAC;AAE/C,eAAO,MAAM,4BAA4B,GAAI,OAAO,OAAO,KAAG,oBA8D7D,CAAC"}
@@ -0,0 +1,33 @@
1
+ import { type RoomShareLinkView } from "./shareLinkViewModel";
2
+ export type ShareViewLabels = {
3
+ exportToLink: string;
4
+ exporting: string;
5
+ };
6
+ export type ShareViewModel = {
7
+ live: {
8
+ status: "active" | "blocked" | "ready";
9
+ canStart: boolean;
10
+ disabledReason: string;
11
+ link: RoomShareLinkView;
12
+ };
13
+ shareable: {
14
+ status: "blocked" | "exported" | "exporting" | "ready";
15
+ canExport: boolean;
16
+ disabledReason: string;
17
+ hasLink: boolean;
18
+ primaryLabel: string;
19
+ };
20
+ };
21
+ export declare const buildShareViewModel: ({ canStartSession, isLive, labels, jsonShareCanExport, jsonShareDisabledReason, jsonShareExporting, jsonShareUrl, roomId, shareUrl, startSessionUnavailableReason, }: {
22
+ canStartSession: boolean;
23
+ isLive: boolean;
24
+ labels: ShareViewLabels;
25
+ jsonShareCanExport: boolean;
26
+ jsonShareDisabledReason: string;
27
+ jsonShareExporting: boolean;
28
+ jsonShareUrl?: string;
29
+ roomId?: string;
30
+ shareUrl?: string;
31
+ startSessionUnavailableReason: string;
32
+ }) => ShareViewModel;
33
+ //# sourceMappingURL=shareViewModel.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shareViewModel.d.ts","sourceRoot":"","sources":["../src/shareViewModel.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,iBAAiB,EACvB,MAAM,sBAAsB,CAAC;AAE9B,MAAM,MAAM,eAAe,GAAG;IAC5B,YAAY,EAAE,MAAM,CAAC;IACrB,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG;IAC3B,IAAI,EAAE;QACJ,MAAM,EAAE,QAAQ,GAAG,SAAS,GAAG,OAAO,CAAC;QACvC,QAAQ,EAAE,OAAO,CAAC;QAClB,cAAc,EAAE,MAAM,CAAC;QACvB,IAAI,EAAE,iBAAiB,CAAC;KACzB,CAAC;IACF,SAAS,EAAE;QACT,MAAM,EAAE,SAAS,GAAG,UAAU,GAAG,WAAW,GAAG,OAAO,CAAC;QACvD,SAAS,EAAE,OAAO,CAAC;QACnB,cAAc,EAAE,MAAM,CAAC;QACvB,OAAO,EAAE,OAAO,CAAC;QACjB,YAAY,EAAE,MAAM,CAAC;KACtB,CAAC;CACH,CAAC;AAEF,eAAO,MAAM,mBAAmB,GAAI,sKAWjC;IACD,eAAe,EAAE,OAAO,CAAC;IACzB,MAAM,EAAE,OAAO,CAAC;IAChB,MAAM,EAAE,eAAe,CAAC;IACxB,kBAAkB,EAAE,OAAO,CAAC;IAC5B,uBAAuB,EAAE,MAAM,CAAC;IAChC,kBAAkB,EAAE,OAAO,CAAC;IAC5B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,6BAA6B,EAAE,MAAM,CAAC;CACvC,KAAG,cA2BH,CAAC"}
@@ -0,0 +1,54 @@
1
+ import { type PreviewBlockIndex, type PreviewBlockKind, type PreviewBlockMeasurements } from "./previewBlockModel";
2
+ export type EditorScrollPosition = {
3
+ atDocumentEnd: boolean;
4
+ lineNumber: number;
5
+ lineOffsetRatio: number;
6
+ };
7
+ export type PreviewScrollTarget = {
8
+ clamped: boolean;
9
+ scrollTop: number;
10
+ sourceLineNumber: number;
11
+ sourceProgress: number;
12
+ };
13
+ export type SourceScrollSegmentKind = PreviewBlockKind | "document-end" | "frontmatter";
14
+ export type SourceScrollSegment = {
15
+ blockId?: string;
16
+ id: string;
17
+ kind: SourceScrollSegmentKind;
18
+ measured: boolean;
19
+ previewHeight: number;
20
+ previewTop: number;
21
+ renderable: boolean;
22
+ sourceEndLine: number;
23
+ sourceStartLine: number;
24
+ };
25
+ export type SourceScrollMap = {
26
+ lineCount: number;
27
+ segments: SourceScrollSegment[];
28
+ totalPreviewHeight: number;
29
+ };
30
+ export type SourceScrollPosition = {
31
+ atDocumentEnd: boolean;
32
+ lineNumber: number;
33
+ lineOffsetRatio: number;
34
+ segmentId: string | null;
35
+ segmentProgress: number;
36
+ sourceProgress: number;
37
+ };
38
+ export type BuildSourceScrollSegmentsMetadata = {
39
+ frontmatterEstimatedHeight?: number;
40
+ frontmatterLineCount?: number;
41
+ frontmatterMeasuredHeight?: number;
42
+ sourceLineCount?: number;
43
+ sourceLineOffset?: number;
44
+ };
45
+ export type SourceScrollTransferViewport = {
46
+ edgePadding?: number;
47
+ viewportHeight: number;
48
+ };
49
+ export declare const buildSourceScrollSegments: (markdown: string, previewBlockIndex: PreviewBlockIndex, metadata?: BuildSourceScrollSegmentsMetadata) => SourceScrollMap;
50
+ export declare const resolveSourcePosition: (editorPosition: EditorScrollPosition, sourceScrollMap: SourceScrollMap) => SourceScrollPosition;
51
+ export declare const getPreviewScrollTopForSourcePosition: (sourceScrollMap: SourceScrollMap, sourcePosition: SourceScrollPosition, viewport: SourceScrollTransferViewport) => PreviewScrollTarget;
52
+ export declare const getPreviewScrollTargetForEditorPosition: (markdown: string, previewBlockIndex: PreviewBlockIndex, editorPosition: EditorScrollPosition, viewport: SourceScrollTransferViewport, metadata?: BuildSourceScrollSegmentsMetadata) => PreviewScrollTarget;
53
+ export declare const applyPreviewSegmentMeasurements: (sourceScrollMap: SourceScrollMap, measurements: PreviewBlockMeasurements) => SourceScrollMap;
54
+ //# sourceMappingURL=sourceScrollTransfer.d.ts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AAE,MAAM,CAAC;IACxB,cAAc,EAAE,MAAM,CAAC;CACxB,CAAC;AAEF,MAAM,MAAM,iCAAiC,GAAG;IAC9C,0BAA0B,CAAC,EAAE,MAAM,CAAC;IACpC,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,yBAAyB,CAAC,EAAE,MAAM,CAAC;IACnC,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B,CAAC;AAEF,MAAM,MAAM,4BAA4B,GAAG;IACzC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,cAAc,EAAE,MAAM,CAAC;CACxB,CAAC;AA2GF,eAAO,MAAM,yBAAyB,GACpC,UAAU,MAAM,EAChB,mBAAmB,iBAAiB,EACpC,WAAU,iCAAsC,KAC/C,eAmEF,CAAC;AAEF,eAAO,MAAM,qBAAqB,GAChC,gBAAgB,oBAAoB,EACpC,iBAAiB,eAAe,KAC/B,oBAsBF,CAAC;AAEF,eAAO,MAAM,oCAAoC,GAC/C,iBAAiB,eAAe,EAChC,gBAAgB,oBAAoB,EACpC,UAAU,4BAA4B,KACrC,mBA8BF,CAAC;AAEF,eAAO,MAAM,uCAAuC,GAClD,UAAU,MAAM,EAChB,mBAAmB,iBAAiB,EACpC,gBAAgB,oBAAoB,EACpC,UAAU,4BAA4B,EACtC,WAAU,iCAAsC,wBAKjD,CAAC;AAEF,eAAO,MAAM,+BAA+B,GAC1C,iBAAiB,eAAe,EAChC,cAAc,wBAAwB,KACrC,eAsBF,CAAC"}
@@ -0,0 +1,13 @@
1
+ export type StatusBarSaveState = {
2
+ label: string;
3
+ tone: "saved" | "attention";
4
+ visible: boolean;
5
+ };
6
+ export declare const getStatusBarSaveState: ({ isLive, roomAttentionLabels, roomOfflineLabel, savedLocallyLabel, statusLabel, }: {
7
+ isLive: boolean;
8
+ roomAttentionLabels?: readonly string[];
9
+ roomOfflineLabel?: string;
10
+ savedLocallyLabel?: string;
11
+ statusLabel: string;
12
+ }) => StatusBarSaveState;
13
+ //# sourceMappingURL=statusBarViewModel.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"statusBarViewModel.d.ts","sourceRoot":"","sources":["../src/statusBarViewModel.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,kBAAkB,GAAG;IAC/B,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,OAAO,GAAG,WAAW,CAAC;IAC5B,OAAO,EAAE,OAAO,CAAC;CAClB,CAAC;AAEF,eAAO,MAAM,qBAAqB,GAAI,oFAYnC;IACD,MAAM,EAAE,OAAO,CAAC;IAChB,mBAAmB,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACxC,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,WAAW,EAAE,MAAM,CAAC;CACrB,KAAG,kBAcH,CAAC"}
@@ -0,0 +1,16 @@
1
+ export type TextPatch = {
2
+ from: number;
3
+ to: number;
4
+ insert: string;
5
+ };
6
+ export type TextChange = {
7
+ docLength?: number;
8
+ lineCount?: number;
9
+ patches: TextPatch[];
10
+ };
11
+ export declare const diffTextPatch: (oldText: string, nextText: string) => TextPatch;
12
+ export declare const normalizeTextPatches: (patches: readonly TextPatch[]) => TextPatch[];
13
+ export declare const areTextPatchesApplicable: (text: string, patches: readonly TextPatch[]) => boolean;
14
+ export declare const applyTextPatches: (text: string, patches: readonly TextPatch[]) => string | null;
15
+ export declare const getTextPatchesForChange: (oldText: string, nextText: string, preferredPatches?: readonly TextPatch[]) => TextPatch[];
16
+ //# sourceMappingURL=textPatches.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"textPatches.d.ts","sourceRoot":"","sources":["../src/textPatches.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,SAAS,GAAG;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,MAAM,MAAM,UAAU,GAAG;IACvB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,SAAS,EAAE,CAAC;CACtB,CAAC;AAQF,eAAO,MAAM,aAAa,GAAI,SAAS,MAAM,EAAE,UAAU,MAAM,KAAG,SA0BjE,CAAC;AAEF,eAAO,MAAM,oBAAoB,GAAI,SAAS,SAAS,SAAS,EAAE,gBACtB,CAAC;AAE7C,eAAO,MAAM,wBAAwB,GAAI,MAAM,MAAM,EAAE,SAAS,SAAS,SAAS,EAAE,YAmBnF,CAAC;AAEF,eAAO,MAAM,gBAAgB,GAAI,MAAM,MAAM,EAAE,SAAS,SAAS,SAAS,EAAE,kBAY3E,CAAC;AAEF,eAAO,MAAM,uBAAuB,GAClC,SAAS,MAAM,EACf,UAAU,MAAM,EAChB,mBAAmB,SAAS,SAAS,EAAE,gBAWxC,CAAC"}
@@ -0,0 +1,11 @@
1
+ export type WorkspaceFileTitleLike = {
2
+ title: string;
3
+ };
4
+ export type WorkspaceFileIdentity = {
5
+ id: string;
6
+ };
7
+ export declare function removeRecordKey<TValue>(record: Record<string, TValue>, key: string): Record<string, TValue>;
8
+ export declare function restoreFileToList<TFile extends WorkspaceFileIdentity>(files: TFile[], restoredFile: TFile, restoredIndex: number): TFile[];
9
+ export declare function restoreOpenFileId(openFileIds: string[], restoredFileId: string, previousOpenFileIds: string[]): string[];
10
+ export declare const normalizeWorkspaceFileTitleForLookup: (file: WorkspaceFileTitleLike) => string;
11
+ //# sourceMappingURL=workspaceFileRuntimeModel.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"workspaceFileRuntimeModel.d.ts","sourceRoot":"","sources":["../src/workspaceFileRuntimeModel.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,sBAAsB,GAAG;IACnC,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,MAAM,MAAM,qBAAqB,GAAG;IAClC,EAAE,EAAE,MAAM,CAAC;CACZ,CAAC;AAEF,wBAAgB,eAAe,CAAC,MAAM,EACpC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAC9B,GAAG,EAAE,MAAM,0BAQZ;AAED,wBAAgB,iBAAiB,CAAC,KAAK,SAAS,qBAAqB,EACnE,KAAK,EAAE,KAAK,EAAE,EACd,YAAY,EAAE,KAAK,EACnB,aAAa,EAAE,MAAM,WAStB;AAED,wBAAgB,iBAAiB,CAC/B,WAAW,EAAE,MAAM,EAAE,EACrB,cAAc,EAAE,MAAM,EACtB,mBAAmB,EAAE,MAAM,EAAE,YAiB9B;AAED,eAAO,MAAM,oCAAoC,GAC/C,MAAM,sBAAsB,WAC2B,CAAC"}
@@ -0,0 +1,37 @@
1
+ import { type FileViewMode, type ReadingWidth } from "./documentPrimitives";
2
+ export type WorkspaceFilePreferenceDefaults<TViewMode extends string = FileViewMode, TReadingWidth extends string = ReadingWidth> = {
3
+ newFileViewMode: TViewMode;
4
+ readingWidth: TReadingWidth;
5
+ lineWrapping: boolean;
6
+ lineNumbers: boolean;
7
+ };
8
+ export type WorkspaceIoPreferenceOverrides<TViewMode extends string = FileViewMode, TReadingWidth extends string = ReadingWidth> = {
9
+ viewMode: TViewMode;
10
+ readingWidth: TReadingWidth;
11
+ lineWrapping: boolean;
12
+ lineNumbers: boolean;
13
+ };
14
+ export type TextFileDownloadDraft = {
15
+ fileName: string;
16
+ content: string;
17
+ type: string;
18
+ };
19
+ export type WorkspaceIoFile = {
20
+ title: string;
21
+ text: string;
22
+ };
23
+ export type WorkspaceImportFileDescriptor = {
24
+ name: string;
25
+ type: string;
26
+ };
27
+ export type ImportedWorkspaceFileDraft<TViewMode extends string = FileViewMode, TReadingWidth extends string = ReadingWidth> = {
28
+ title: string;
29
+ text: string;
30
+ viewMode: TViewMode;
31
+ overrides: WorkspaceIoPreferenceOverrides<TViewMode, TReadingWidth>;
32
+ };
33
+ export declare function getNewFilePreferenceOverrides<TViewMode extends string, TReadingWidth extends string>(preferences: WorkspaceFilePreferenceDefaults<TViewMode, TReadingWidth>): WorkspaceIoPreferenceOverrides<TViewMode, TReadingWidth>;
34
+ export declare const isSupportedImportFileDescriptor: (file: WorkspaceImportFileDescriptor) => boolean;
35
+ export declare const createCurrentFileDownloadDraft: (file: WorkspaceIoFile) => TextFileDownloadDraft;
36
+ export declare const createImportedWorkspaceFileDraft: <TViewMode extends string, TReadingWidth extends string>(fileName: string, text: string, preferences: WorkspaceFilePreferenceDefaults<TViewMode, TReadingWidth>) => ImportedWorkspaceFileDraft<TViewMode, TReadingWidth>;
37
+ //# sourceMappingURL=workspaceIoModel.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"workspaceIoModel.d.ts","sourceRoot":"","sources":["../src/workspaceIoModel.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,YAAY,EAAE,KAAK,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAG5E,MAAM,MAAM,+BAA+B,CACzC,SAAS,SAAS,MAAM,GAAG,YAAY,EACvC,aAAa,SAAS,MAAM,GAAG,YAAY,IACzC;IACF,eAAe,EAAE,SAAS,CAAC;IAC3B,YAAY,EAAE,aAAa,CAAC;IAC5B,YAAY,EAAE,OAAO,CAAC;IACtB,WAAW,EAAE,OAAO,CAAC;CACtB,CAAC;AAEF,MAAM,MAAM,8BAA8B,CACxC,SAAS,SAAS,MAAM,GAAG,YAAY,EACvC,aAAa,SAAS,MAAM,GAAG,YAAY,IACzC;IACF,QAAQ,EAAE,SAAS,CAAC;IACpB,YAAY,EAAE,aAAa,CAAC;IAC5B,YAAY,EAAE,OAAO,CAAC;IACtB,WAAW,EAAE,OAAO,CAAC;CACtB,CAAC;AAEF,MAAM,MAAM,qBAAqB,GAAG;IAClC,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG;IAC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