@kitionstage/sdk 0.0.0-stage → 0.5.2-stage.2

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 (259) hide show
  1. package/README.md +73 -2
  2. package/dist/LICENSE +177 -0
  3. package/dist/THIRD_PARTY_NOTICES +28 -0
  4. package/dist/lib/assets/kitEngine.worker-3iMvwtlI.js +12732 -0
  5. package/dist/lib/assets/loro_wasm_bg-Gulzks_0.wasm +0 -0
  6. package/dist/lib/chunks/batch-BWpAyHvP.js +789 -0
  7. package/dist/lib/chunks/canonical-BIWfVCL-.js +87 -0
  8. package/dist/lib/chunks/envelope-D6MGY-ZN.js +61 -0
  9. package/dist/lib/chunks/replica-D8w3I4sn.js +2472 -0
  10. package/dist/lib/chunks/runtime-BVJHE1Pg.js +997 -0
  11. package/dist/lib/chunks/session-BqXC9a1-.js +281 -0
  12. package/dist/lib/chunks/toolIds-BCeSGHpV.js +821 -0
  13. package/dist/lib/chunks/workspaceTree-Destqupf.js +23 -0
  14. package/dist/lib/convergence/index.js +1035 -0
  15. package/dist/lib/convergence/node.js +8 -0
  16. package/dist/lib/embed-server/callbacks.js +37 -0
  17. package/dist/lib/embed-server/cli.js +19 -0
  18. package/dist/lib/embed-server/index.js +272 -0
  19. package/dist/lib/extensions/index.js +439 -0
  20. package/dist/lib/extensions/panel.html +208 -0
  21. package/dist/lib/extensions/runtime.js +198 -0
  22. package/dist/lib/extensions/sandbox.html +35 -0
  23. package/dist/lib/kdm/index.js +437 -0
  24. package/dist/lib/kit-dev-host/checkUiIds.mjs +44 -0
  25. package/dist/lib/kit-dev-host/index.js +308 -0
  26. package/dist/lib/kit-dev-host/lineRow.mjs +47 -0
  27. package/dist/lib/kit-dev-host/modeSmoke.mjs +178 -0
  28. package/dist/lib/kit-editor/index.js +6481 -0
  29. package/dist/lib/kit-editor/styles.css +807 -0
  30. package/dist/lib/kit-editor/workspaceTree.js +1 -0
  31. package/dist/lib/kit-engine/index.js +7 -0
  32. package/dist/lib/kit-host/index.js +530 -0
  33. package/dist/lib/kit-ui-protocol/index.js +336 -0
  34. package/dist/lib/node-only/embed-server-callbacks.js +2 -0
  35. package/dist/lib/node-only/embed-server.js +2 -0
  36. package/dist/lib/sync/index.js +1008 -0
  37. package/dist/lib/sync/openToken.js +201 -0
  38. package/dist/lib/sync/replicaVersions.js +51 -0
  39. package/dist/standalone/chunks/batch-CAGYk6m4.js +789 -0
  40. package/dist/standalone/chunks/client-B9xkOcvf.js +772 -0
  41. package/dist/standalone/chunks/collab-CTQZ9h7J.js +1022 -0
  42. package/dist/standalone/chunks/comment-Ds9t8xSE.js +94 -0
  43. package/dist/standalone/chunks/comments-uVDS8Wxp.js +41 -0
  44. package/dist/standalone/chunks/document-B5MMuYyN.js +324 -0
  45. package/dist/standalone/chunks/envelope-GX4Cynkx.js +7612 -0
  46. package/dist/standalone/chunks/index-BEgEEnhU.js +287 -0
  47. package/dist/standalone/chunks/index-EEl8hGbP.js +1967 -0
  48. package/dist/standalone/chunks/kits-Cp51mDlw.js +9 -0
  49. package/dist/standalone/chunks/replica-Di2iCPiD.js +3281 -0
  50. package/dist/standalone/chunks/replicaVersions-C3rJxnk9.js +50 -0
  51. package/dist/standalone/chunks/touched-T9jKJjxn.js +78 -0
  52. package/dist/standalone/index.js +12 -0
  53. package/dist/standalone/script/index.js +339 -0
  54. package/dist/standalone/script/kits/board.js +5 -0
  55. package/dist/standalone/script/kits/cad.js +5 -0
  56. package/dist/standalone/script/kits/design.js +5 -0
  57. package/dist/standalone/script/kits/doc.js +5 -0
  58. package/dist/standalone/script/kits/film.js +5 -0
  59. package/dist/standalone/script/kits/html.js +5 -0
  60. package/dist/standalone/script/kits/index.js +38 -0
  61. package/dist/standalone/script/kits/layout.js +5 -0
  62. package/dist/standalone/script/kits/motion.js +5 -0
  63. package/dist/standalone/script/kits/note.js +5 -0
  64. package/dist/standalone/script/kits/pdf.js +5 -0
  65. package/dist/standalone/script/kits/photo.js +5 -0
  66. package/dist/standalone/script/kits/scene.js +5 -0
  67. package/dist/standalone/script/kits/sheet.js +5 -0
  68. package/dist/standalone/script/kits/slide.js +5 -0
  69. package/dist/standalone/script/kits/table.js +5 -0
  70. package/dist/standalone/script/kits/vector.js +5 -0
  71. package/dist/standalone/script/node.js +401 -0
  72. package/dist/standalone/script/proxy.js +254 -0
  73. package/dist/types/convergence/src/adapter.d.ts +131 -0
  74. package/dist/types/convergence/src/engine.d.ts +66 -0
  75. package/dist/types/convergence/src/index.d.ts +21 -0
  76. package/dist/types/convergence/src/net.d.ts +52 -0
  77. package/dist/types/convergence/src/node.d.ts +6 -0
  78. package/dist/types/convergence/src/report.d.ts +56 -0
  79. package/dist/types/convergence/src/rng.d.ts +12 -0
  80. package/dist/types/convergence/src/scenarios.d.ts +15 -0
  81. package/dist/types/convergence/src/state.d.ts +67 -0
  82. package/dist/types/embed/src/agent.d.ts +88 -0
  83. package/dist/types/embed/src/blobs.d.ts +2 -0
  84. package/dist/types/embed/src/collab.d.ts +250 -0
  85. package/dist/types/embed/src/comments.d.ts +30 -0
  86. package/dist/types/embed/src/errors.d.ts +24 -0
  87. package/dist/types/embed/src/handlers.d.ts +92 -0
  88. package/dist/types/embed/src/index.d.ts +20 -0
  89. package/dist/types/embed/src/mount.d.ts +39 -0
  90. package/dist/types/embed/src/replicaStore.d.ts +3 -0
  91. package/dist/types/embed/src/rooms.d.ts +40 -0
  92. package/dist/types/embed/src/schemas.d.ts +7 -0
  93. package/dist/types/embed/src/syncClients.d.ts +28 -0
  94. package/dist/types/embed/src/theme.d.ts +7 -0
  95. package/dist/types/embed/src/types.d.ts +596 -0
  96. package/dist/types/embed/src/ui.d.ts +33 -0
  97. package/dist/types/embed/src/version.d.ts +2 -0
  98. package/dist/types/embed-server/src/callbacks.d.ts +30 -0
  99. package/dist/types/embed-server/src/cli.d.ts +1 -0
  100. package/dist/types/embed-server/src/index.d.ts +19 -0
  101. package/dist/types/embed-server/src/page.d.ts +15 -0
  102. package/dist/types/embed-server/src/server.d.ts +39 -0
  103. package/dist/types/embed-server/src/session.d.ts +22 -0
  104. package/dist/types/extensions/src/gate.d.ts +17 -0
  105. package/dist/types/extensions/src/generated/runtime.d.ts +8 -0
  106. package/dist/types/extensions/src/host.d.ts +135 -0
  107. package/dist/types/extensions/src/index.d.ts +13 -0
  108. package/dist/types/extensions/src/manifest.d.ts +82 -0
  109. package/dist/types/extensions/src/protocol.d.ts +159 -0
  110. package/dist/types/extensions/src/rpc.d.ts +52 -0
  111. package/dist/types/extensions/src/runtime/document.d.ts +40 -0
  112. package/dist/types/extensions/src/runtime/index.d.ts +10 -0
  113. package/dist/types/extensions/src/runtime/panel.d.ts +19 -0
  114. package/dist/types/extensions/src/runtime/runtime.d.ts +54 -0
  115. package/dist/types/extensions/src/runtime/worker.d.ts +1 -0
  116. package/dist/types/extensions/src/sandbox.d.ts +41 -0
  117. package/dist/types/kdm/src/args.d.ts +12 -0
  118. package/dist/types/kdm/src/batch.d.ts +118 -0
  119. package/dist/types/kdm/src/canonical.d.ts +25 -0
  120. package/dist/types/kdm/src/comment.d.ts +114 -0
  121. package/dist/types/kdm/src/diff.d.ts +125 -0
  122. package/dist/types/kdm/src/envelope.d.ts +27 -0
  123. package/dist/types/kdm/src/errors.d.ts +28 -0
  124. package/dist/types/kdm/src/footprint.d.ts +21 -0
  125. package/dist/types/kdm/src/ids.d.ts +57 -0
  126. package/dist/types/kdm/src/index.d.ts +18 -0
  127. package/dist/types/kdm/src/marks.d.ts +32 -0
  128. package/dist/types/kdm/src/op.d.ts +124 -0
  129. package/dist/types/kdm/src/origin.d.ts +41 -0
  130. package/dist/types/kdm/src/overlay.d.ts +92 -0
  131. package/dist/types/kdm/src/projection.d.ts +29 -0
  132. package/dist/types/kdm/src/read.d.ts +90 -0
  133. package/dist/types/kdm/src/replica.d.ts +403 -0
  134. package/dist/types/kdm/src/schema.d.ts +185 -0
  135. package/dist/types/kdm/src/testing.d.ts +28 -0
  136. package/dist/types/kdm/src/toolIds.d.ts +61 -0
  137. package/dist/types/kdm/src/touched.d.ts +24 -0
  138. package/dist/types/kdm/src/tx.d.ts +215 -0
  139. package/dist/types/kdm/src/value.d.ts +23 -0
  140. package/dist/types/kit-dev-host/src/checkNoPaths.d.ts +19 -0
  141. package/dist/types/kit-dev-host/src/checkUiIds.d.mts +2 -0
  142. package/dist/types/kit-dev-host/src/index.d.ts +179 -0
  143. package/dist/types/kit-dev-host/src/lineRow.d.mts +14 -0
  144. package/dist/types/kit-dev-host/src/memoryFiles.d.ts +15 -0
  145. package/dist/types/kit-dev-host/src/modeSmoke.d.mts +8 -0
  146. package/dist/types/kit-editor/src/CommandDialog.d.ts +22 -0
  147. package/dist/types/kit-editor/src/CommentsPanel.d.ts +45 -0
  148. package/dist/types/kit-editor/src/CustomizeDialog.d.ts +32 -0
  149. package/dist/types/kit-editor/src/HostButtons.d.ts +11 -0
  150. package/dist/types/kit-editor/src/RenderFailure.d.ts +7 -0
  151. package/dist/types/kit-editor/src/TextSink.d.ts +6 -0
  152. package/dist/types/kit-editor/src/brand.d.ts +2 -0
  153. package/dist/types/kit-editor/src/catalogMenus.d.ts +27 -0
  154. package/dist/types/kit-editor/src/chart.d.ts +138 -0
  155. package/dist/types/kit-editor/src/conflicts.d.ts +12 -0
  156. package/dist/types/kit-editor/src/drawing.d.ts +83 -0
  157. package/dist/types/kit-editor/src/editor.d.ts +544 -0
  158. package/dist/types/kit-editor/src/engine/KitCanvas.d.ts +70 -0
  159. package/dist/types/kit-editor/src/engine/backdrop.d.ts +32 -0
  160. package/dist/types/kit-editor/src/engine/createKitFile.d.ts +12 -0
  161. package/dist/types/kit-editor/src/engine/decorations.d.ts +14 -0
  162. package/dist/types/kit-editor/src/engine/engineOverlays.d.ts +197 -0
  163. package/dist/types/kit-editor/src/engine/engineTools.d.ts +116 -0
  164. package/dist/types/kit-editor/src/engine/kitDraft.d.ts +70 -0
  165. package/dist/types/kit-editor/src/engine/kitEngine.d.ts +390 -0
  166. package/dist/types/kit-editor/src/engine/kitEngine.worker.d.ts +30 -0
  167. package/dist/types/kit-editor/src/engine/kitHost.d.ts +41 -0
  168. package/dist/types/kit-editor/src/engine/kitModel.d.ts +32 -0
  169. package/dist/types/kit-editor/src/engine/kitModelRunner.d.ts +99 -0
  170. package/dist/types/kit-editor/src/engine/kitModule.d.ts +185 -0
  171. package/dist/types/kit-editor/src/engine/kitShortcuts.d.ts +32 -0
  172. package/dist/types/kit-editor/src/engine/kitTools.d.ts +79 -0
  173. package/dist/types/kit-editor/src/engine/lazyFonts.d.ts +34 -0
  174. package/dist/types/kit-editor/src/engine/lentFiles.d.ts +29 -0
  175. package/dist/types/kit-editor/src/engine/rasterViewport.d.ts +178 -0
  176. package/dist/types/kit-editor/src/engine/readOnly.d.ts +78 -0
  177. package/dist/types/kit-editor/src/engine/refusal.d.ts +39 -0
  178. package/dist/types/kit-editor/src/engine/replica.d.ts +23 -0
  179. package/dist/types/kit-editor/src/engine/useKitDocument.d.ts +154 -0
  180. package/dist/types/kit-editor/src/engine/workerRelay.d.ts +62 -0
  181. package/dist/types/kit-editor/src/files.d.ts +74 -0
  182. package/dist/types/kit-editor/src/frame/EditorFrame.d.ts +74 -0
  183. package/dist/types/kit-editor/src/frame/FocusBar.d.ts +10 -0
  184. package/dist/types/kit-editor/src/frame/MenuNodes.d.ts +20 -0
  185. package/dist/types/kit-editor/src/frame/MenuRibbon.d.ts +8 -0
  186. package/dist/types/kit-editor/src/frame/ModeButton.d.ts +7 -0
  187. package/dist/types/kit-editor/src/frame/menus.d.ts +64 -0
  188. package/dist/types/kit-editor/src/frame/modes.d.ts +51 -0
  189. package/dist/types/kit-editor/src/frame/useFrameLayout.d.ts +34 -0
  190. package/dist/types/kit-editor/src/host.d.ts +127 -0
  191. package/dist/types/kit-editor/src/index.d.ts +85 -0
  192. package/dist/types/kit-editor/src/ink.d.ts +26 -0
  193. package/dist/types/kit-editor/src/lease.d.ts +53 -0
  194. package/dist/types/kit-editor/src/oneInFlight.d.ts +7 -0
  195. package/dist/types/kit-editor/src/phrases.d.ts +25 -0
  196. package/dist/types/kit-editor/src/presence.d.ts +79 -0
  197. package/dist/types/kit-editor/src/strings.d.ts +6 -0
  198. package/dist/types/kit-editor/src/toolIcons.d.ts +32 -0
  199. package/dist/types/kit-editor/src/uiCatalog.d.ts +59 -0
  200. package/dist/types/kit-editor/src/uiConfig.d.ts +53 -0
  201. package/dist/types/kit-editor/src/uiContext.d.ts +65 -0
  202. package/dist/types/kit-editor/src/uiStore.d.ts +20 -0
  203. package/dist/types/kit-editor/src/useCommentAnchors.d.ts +29 -0
  204. package/dist/types/kit-editor/src/useKitSession.d.ts +115 -0
  205. package/dist/types/kit-editor/src/workspaceTree.d.ts +5 -0
  206. package/dist/types/kit-engine/src/contract.d.ts +154 -0
  207. package/dist/types/kit-engine/src/index.d.ts +2 -0
  208. package/dist/types/kit-engine/src/session.d.ts +133 -0
  209. package/dist/types/kit-host/src/files.d.ts +163 -0
  210. package/dist/types/kit-host/src/index.d.ts +315 -0
  211. package/dist/types/kit-ui-protocol/src/index.d.ts +1145 -0
  212. package/dist/types/loro-crdt.d.ts +9 -0
  213. package/dist/types/script/kits/board.d.ts +534 -0
  214. package/dist/types/script/kits/cad.d.ts +2937 -0
  215. package/dist/types/script/kits/design.d.ts +3213 -0
  216. package/dist/types/script/kits/doc.d.ts +2575 -0
  217. package/dist/types/script/kits/film.d.ts +4067 -0
  218. package/dist/types/script/kits/html.d.ts +38 -0
  219. package/dist/types/script/kits/index.d.ts +20 -0
  220. package/dist/types/script/kits/layout.d.ts +3483 -0
  221. package/dist/types/script/kits/motion.d.ts +4826 -0
  222. package/dist/types/script/kits/note.d.ts +631 -0
  223. package/dist/types/script/kits/pdf.d.ts +829 -0
  224. package/dist/types/script/kits/photo.d.ts +7574 -0
  225. package/dist/types/script/kits/scene.d.ts +2962 -0
  226. package/dist/types/script/kits/sheet.d.ts +2419 -0
  227. package/dist/types/script/kits/slide.d.ts +1894 -0
  228. package/dist/types/script/kits/table.d.ts +654 -0
  229. package/dist/types/script/kits/vector.d.ts +5167 -0
  230. package/dist/types/script/src/agentRelay.d.ts +48 -0
  231. package/dist/types/script/src/capabilities.d.ts +21 -0
  232. package/dist/types/script/src/document.d.ts +87 -0
  233. package/dist/types/script/src/drafts.d.ts +141 -0
  234. package/dist/types/script/src/exchange.d.ts +30 -0
  235. package/dist/types/script/src/headless.d.ts +190 -0
  236. package/dist/types/script/src/index.d.ts +15 -0
  237. package/dist/types/script/src/kitModel.d.ts +17 -0
  238. package/dist/types/script/src/kits.d.ts +8 -0
  239. package/dist/types/script/src/node.d.ts +42 -0
  240. package/dist/types/script/src/port.d.ts +89 -0
  241. package/dist/types/script/src/proxy.d.ts +132 -0
  242. package/dist/types/script/src/room.d.ts +162 -0
  243. package/dist/types/script/src/sources.d.ts +73 -0
  244. package/dist/types/sync/src/backoff.d.ts +9 -0
  245. package/dist/types/sync/src/blobSection.d.ts +23 -0
  246. package/dist/types/sync/src/capabilities.d.ts +20 -0
  247. package/dist/types/sync/src/client.d.ts +253 -0
  248. package/dist/types/sync/src/framing.d.ts +35 -0
  249. package/dist/types/sync/src/hash.d.ts +2 -0
  250. package/dist/types/sync/src/index.d.ts +19 -0
  251. package/dist/types/sync/src/leases.d.ts +82 -0
  252. package/dist/types/sync/src/openToken.d.ts +104 -0
  253. package/dist/types/sync/src/protocol.d.ts +484 -0
  254. package/dist/types/sync/src/relay.d.ts +52 -0
  255. package/dist/types/sync/src/replicaVersions.d.ts +17 -0
  256. package/dist/types/sync/src/saveMachine.d.ts +83 -0
  257. package/dist/types/sync/src/saveRun.d.ts +52 -0
  258. package/dist/types/sync/src/transport.d.ts +19 -0
  259. package/package.json +229 -4
@@ -0,0 +1,61 @@
1
+ import type { ObjectId } from './ids.js';
2
+ import type { Replica } from './replica.js';
3
+ import { type Schema } from './schema.js';
4
+ /** Why a target names no single object. */
5
+ export type Unresolved = {
6
+ reason: 'not-found' | 'ambiguous';
7
+ message: string;
8
+ };
9
+ /** The tool ids of one document state. */
10
+ export declare class ToolIds {
11
+ /** Whether the schema declares any tool id; when not, every method answers object ids. */
12
+ private readonly active;
13
+ /** Each object's tool id, when it is its own. */
14
+ private readonly own;
15
+ /** Every rendered tool id to the objects rendering it. */
16
+ private readonly named;
17
+ /** Each object held through an owning field: its holders. */
18
+ private readonly owners;
19
+ private constructor();
20
+ static none(): ToolIds;
21
+ /** The tool ids of a replica's current state. */
22
+ static ofReplica(replica: Replica): ToolIds;
23
+ /** The tool ids of a canonical state (`Replica.stateJson`) read with `schema`. */
24
+ static ofState(schema: Schema, state: unknown): ToolIds;
25
+ private static build;
26
+ /**
27
+ * As the Rust `ToolIds::attributed`: for an object without a tool id of its own, the nearest
28
+ * object holding it that has one and the path from it (`body.paragraphs.0`); `null` for an object
29
+ * with a tool id, without tool ids in the schema, or when an object on the way has no single holder.
30
+ */
31
+ attributed(id: ObjectId): {
32
+ holder: string;
33
+ path: string;
34
+ } | null;
35
+ /**
36
+ * As the Rust `ToolIds::named_path`: `attributed`'s path in the words of the kit's commands, the names
37
+ * of the objects on the way whose type declares a `pathName` joined by `/`, then the path below the
38
+ * last of them; `null` when no object on the way is named so.
39
+ */
40
+ namedPath(id: ObjectId): string | null;
41
+ /** The type of the object a tool id names, when it names one. */
42
+ typeOf(toolId: string): string | null;
43
+ /** Whether the schema declares tool ids. */
44
+ isActive(): boolean;
45
+ /** The object's tool id, when it has one of its own. */
46
+ toolId(id: ObjectId): string | null;
47
+ /** How the object is named at the tool interface: its tool id, else its object id. */
48
+ showJson(value: unknown): unknown;
49
+ show(id: ObjectId): string;
50
+ /** References in marks share the tool id space; inserted characters stay literal. */
51
+ showText(value: unknown): unknown;
52
+ /**
53
+ * The object `text` names: a tool id, else an object id for which `exists` holds; an `Unresolved`
54
+ * when it names none or several. Without declared tool ids, `text` as an object id.
55
+ */
56
+ resolve(text: string, exists: (id: ObjectId) => boolean): ObjectId | Unresolved;
57
+ /** Why `text` names no object, with the ids it may have meant (KHP A44, A48). */
58
+ notFound(text: string): string;
59
+ }
60
+ /** Whether a `resolve` answer is a refusal. */
61
+ export declare const isUnresolved: (answer: ObjectId | Unresolved) => answer is Unresolved;
@@ -0,0 +1,24 @@
1
+ import { Version } from './envelope.js';
2
+ import type { ObjectId } from './ids.js';
3
+ /** What a change touched: each object with its type (as it was before, else after), and whether it changed the document outside its objects. */
4
+ export type Touched = {
5
+ objects: Map<ObjectId, string | null>;
6
+ outside: boolean;
7
+ };
8
+ /** Whether `touched` holds only comment threads and comments: all a commenter may write (rule M23). */
9
+ export declare function touchesOnlyComments(touched: Touched): boolean;
10
+ /**
11
+ * A copy of a document that follows its changes and tells what each one touched. It reads the
12
+ * KDM layout only, so it serves any kit's document; it never writes.
13
+ */
14
+ export declare class ChangeAudit {
15
+ private readonly doc;
16
+ private constructor();
17
+ /** From a snapshot or a full change export of the document. */
18
+ static load(bytes: Uint8Array): ChangeAudit;
19
+ version(): Version;
20
+ /** Takes changes the document already holds without looking at them (another replica's, an undo). */
21
+ follow(changes: Uint8Array): void;
22
+ /** Takes `changes` and answers what they touched. */
23
+ touched(changes: Uint8Array): Touched;
24
+ }
@@ -0,0 +1,215 @@
1
+ /**
2
+ * Transactions. Nothing is written to the engine while a transaction runs: every operation
3
+ * validates against the committed document plus an overlay of the transaction's own earlier
4
+ * operations, and is buffered. `Replica.transact` applies the buffer only if the whole transaction
5
+ * succeeds, because the engine cannot abort (its operations take effect as they are applied).
6
+ */
7
+ import type { LoroDoc } from '../../loro-crdt.js';
8
+ import { type NodeRef, type ObjectId, type TreeEntry } from './ids.js';
9
+ import { type Schema } from './schema.js';
10
+ import type { UndoTouch } from './replica.js';
11
+ type Fields = Record<string, unknown>;
12
+ /** A successful transaction's operations, ready to apply. */
13
+ export interface Staged {
14
+ readonly empty: boolean;
15
+ /** Whether the transaction raises the document's minimum schema version. */
16
+ readonly raisesSchema: boolean;
17
+ /**
18
+ * Applies the operations without committing, calling `touched` with each changed object. On
19
+ * success the transaction's node handles resolve. Throws the engine's refusal as a `KdmError`.
20
+ */
21
+ apply(doc: LoroDoc, schema: Schema, touched: (id: ObjectId) => void): void;
22
+ /**
23
+ * The registers the operations write: the object, the map field (`null` for the object's own
24
+ * register field), the key, and the value (`undefined` for a deleted map key).
25
+ */
26
+ readonly registerWrites: Array<{
27
+ id: ObjectId;
28
+ field: string | null;
29
+ key: string;
30
+ value: unknown;
31
+ }>;
32
+ readonly undoTouches: UndoTouch[];
33
+ }
34
+ /**
35
+ * The operations of one transaction.
36
+ *
37
+ * Nothing is written to the document while the transaction runs. Every operation validates
38
+ * against the committed document plus the transaction's own earlier operations, and is buffered;
39
+ * reads on `Tx` see those pending effects. An operation that throws changes nothing, so a
40
+ * transaction may catch the error and continue. Positions in text are UTF-16 code units
41
+ * (CodeMirror and DOM positions); one that would split a surrogate pair is `out-of-range`.
42
+ */
43
+ export declare class Tx {
44
+ private readonly doc;
45
+ private readonly schema;
46
+ private readonly serial;
47
+ private readonly ops;
48
+ /** Objects this transaction created: their type and the index of their `create` operation. */
49
+ private readonly created;
50
+ private readonly deleted;
51
+ /** Register writes: the index of the latest `set` operation of each field. */
52
+ private readonly registers;
53
+ private readonly texts;
54
+ private readonly lists;
55
+ private readonly trees;
56
+ /** Map writes by field: for each key written, the index of its latest `mapSet` operation, or `null` when the latest write deleted it. */
57
+ private readonly maps;
58
+ /** The ids of `created` by type, in creation order (deleted ones included). */
59
+ private readonly createdByType;
60
+ private readonly nodes;
61
+ /** The largest schema version this transaction raised the document to. */
62
+ private raised;
63
+ private ended;
64
+ private constructor();
65
+ /** @internal Runs `build` on a new transaction; answers its result and its staged operations. */
66
+ static stage<R>(doc: LoroDoc, schema: Schema, build: (tx: Tx) => R): {
67
+ result: R;
68
+ staged: Staged;
69
+ };
70
+ private undoListItem;
71
+ /**
72
+ * Raises the document's minimum schema version to `version` (rule M20): replicas whose schema is
73
+ * older then refuse to load the document or import its changes (`newer-schema`). A migration
74
+ * raises the version in the transaction that rewrites the document into the new form. Answers
75
+ * whether the version rose: raising to a version the document already has, or a lower one,
76
+ * changes nothing. Concurrent raises keep the largest.
77
+ *
78
+ * Only a `system` transaction raises the version, so it is never an undo step (`transact`
79
+ * refuses others as `invalid-value`). `version` is at most the transaction's schema version: a
80
+ * build cannot require a schema it does not read.
81
+ */
82
+ raiseSchemaVersion(version: number): boolean;
83
+ /** The document's minimum schema version (rule M20), including this transaction's raises. */
84
+ minSchemaVersion(): number;
85
+ /**
86
+ * Creates an object of type `ty` with its register fields; container fields start empty. Its id
87
+ * is a new UUID v7, or `options.id`: an id the host chose, matching
88
+ * `[A-Za-z0-9][A-Za-z0-9:_-]{0,127}` and naming no object of the document or of this
89
+ * transaction (one it deleted included); otherwise `invalid-value`. Replicas that create one id
90
+ * concurrently keep one of the objects.
91
+ */
92
+ create(ty: string, fields: Fields, options?: {
93
+ id?: string;
94
+ }): ObjectId;
95
+ /** Sets one register field. Concurrent sets of one field resolve to one winner; sets of different fields both survive. */
96
+ set(id: ObjectId, field: string, value: unknown): void;
97
+ /** Deletes an object. References to it dangle; kits treat that as a validation state. */
98
+ delete(id: ObjectId): void;
99
+ exists(id: ObjectId): boolean;
100
+ /** Whether this transaction already removed the object, including an ownership cascade. */
101
+ wasDeleted(id: ObjectId): boolean;
102
+ /** The type of a live object, including one this transaction created; not-found for an object it deleted. */
103
+ objectType(id: ObjectId): string;
104
+ get(id: ObjectId, field: string): unknown;
105
+ /** Inserts `content` at `index`, counted in UTF-16 code units. */
106
+ textInsert(id: ObjectId, field: string, index: number, content: string): void;
107
+ /** Deletes `count` UTF-16 code units starting at `index`. */
108
+ textDelete(id: ObjectId, field: string, index: number, count: number): void;
109
+ /** The length of a text field in UTF-16 code units, including this transaction's edits. */
110
+ textLength(id: ObjectId, field: string): number;
111
+ /** A text field including this transaction's edits. Reads the whole text. */
112
+ text(id: ObjectId, field: string): string;
113
+ /**
114
+ * Sets mark `key` to `value` over the code units `start..end` of a text field (rule M19). The
115
+ * field declares `key` in its schema `marks`; `value` is plain JSON and not `null` (remove a
116
+ * mark with `textUnmark`). An empty range changes nothing. Concurrent marks of one key over
117
+ * overlapping ranges resolve to one value per character; marks of different keys all apply.
118
+ */
119
+ textMark(id: ObjectId, field: string, start: number, end: number, key: string, value: unknown): void;
120
+ /** Removes mark `key` from the code units `start..end` of a text field. Characters without the mark are left as they are; an empty range changes nothing. */
121
+ textUnmark(id: ObjectId, field: string, start: number, end: number, key: string): void;
122
+ listInsert(id: ObjectId, field: string, index: number, item: ObjectId): void;
123
+ /** Moves the item at `from` so that it ends at index `to`. */
124
+ listMove(id: ObjectId, field: string, from: number, to: number): void;
125
+ listRemove(id: ObjectId, field: string, index: number): void;
126
+ /** The list's items including this transaction's edits. Reads the whole list: call it only when the items themselves are wanted. */
127
+ listItems(id: ObjectId, field: string): ObjectId[];
128
+ /** `listItems` under the name `Replica` uses. */
129
+ list(id: ObjectId, field: string): ObjectId[];
130
+ /** Sets `key` of a map field. Concurrent sets of one key resolve to one winner. */
131
+ mapSet(id: ObjectId, field: string, key: string, value: unknown): void;
132
+ mapDelete(id: ObjectId, field: string, key: string): void;
133
+ /**
134
+ * One key of a map field including this transaction's writes, or `null`, as `Replica.mapGet`
135
+ * reads it. Costs one lookup in the transaction's writes of the field and at most one in the
136
+ * document, however large the transaction.
137
+ */
138
+ mapGet(id: ObjectId, field: string, key: string): unknown;
139
+ /**
140
+ * A map field's keys and values including this transaction's writes, sorted by key (code point
141
+ * order, as in the canonical state), each as `mapGet` reads it. Reads the whole map and sorts
142
+ * the result on every call, O(n log n) in its keys: call it only when every entry is wanted.
143
+ */
144
+ mapEntries(id: ObjectId, field: string): Array<[string, unknown]>;
145
+ /**
146
+ * Ids of the live objects of type `ty`, including those this transaction created and without
147
+ * those it deleted, sorted as `Replica.objectsOfType` sorts them. One pass over every object of
148
+ * the document, O(objects) per call, plus this transaction's creations of `ty`; when it created
149
+ * any, the whole result is sorted again, O(n log n) per call.
150
+ */
151
+ objectsOfType(ty: string): ObjectId[];
152
+ /** Adds a node naming `object` under `parent` (`null`: a root), last among its siblings. The handle resolves when the transaction commits. */
153
+ treeCreate(id: ObjectId, field: string, parent: NodeRef | null, object: ObjectId): NodeRef;
154
+ /**
155
+ * Moves `node` under `parent` (`null`: a root), last among its siblings. A move that would make a
156
+ * node its own ancestor (counting this transaction's earlier moves) is a `cycle` error; concurrent
157
+ * moves that would form a cycle are resolved by the engine.
158
+ */
159
+ treeMove(id: ObjectId, field: string, node: NodeRef, parent: NodeRef | null): void;
160
+ /**
161
+ * Rule M10b: leaves every object of the tree named by one node. For each object that several of
162
+ * the document's nodes name (a redo made a new node for it while another replica's concurrent
163
+ * move kept the old one alive), the node kept is the least by engine id (peer, then counter)
164
+ * among those with no ancestor naming the same object; every other node naming it has its
165
+ * children moved, in order, to the end of the kept node's children, and is then deleted. The
166
+ * choice depends on the state alone, so replicas that repair one state concurrently make the
167
+ * same moves and deletes. Nodes this transaction created are not considered. Answers how many
168
+ * nodes it deleted; 0 writes nothing. Run it in a kit's repair (engine contract E14, a `system`
169
+ * transaction) for every tree field.
170
+ */
171
+ treeDedupe(id: ObjectId, field: string): number;
172
+ /** The first object in pre-order that several of the document's nodes name (M10b): the node to keep and the first other one in pre-order. */
173
+ private treeDuplicate;
174
+ /**
175
+ * The tree's nodes in pre-order as this transaction sees it: the document's nodes plus the nodes
176
+ * it created, each node it created or moved last among its new siblings, as they will be once it
177
+ * applies. A node that names no object is skipped with its subtree, as in `Replica.tree`. Reads
178
+ * the whole tree: O(nodes + this transaction's operations).
179
+ */
180
+ tree(id: ObjectId, field: string): TreeEntry[];
181
+ /** Checks an id the host chose for a new object of type `ty`. */
182
+ private freeId;
183
+ private live;
184
+ /** The type of a live object, declared by the schema. */
185
+ private typeOf;
186
+ /** The object's type and the definition of `field`. */
187
+ private field;
188
+ private containerField;
189
+ /** Refuses a target that exists but is not of the field's `of` type. A missing target is accepted: a dangling reference is a validation state. */
190
+ private checkOf;
191
+ /**
192
+ * The document's container for a field, or `null` when it starts empty: the object was created
193
+ * by this transaction, or (for reads) it predates the field. Writes to a field the stored object
194
+ * lacks are `not-found`.
195
+ */
196
+ private stored;
197
+ /** The pending writes of a map field, made on first use. */
198
+ private mapWrites;
199
+ /** The value of the `mapSet` operation at `index` (`null`: a deletion), as the engine will store it. */
200
+ private pendingMapValue;
201
+ private pendingRegister;
202
+ /** The text's state: this transaction's, or a fresh one over the document's text (not recorded until an edit succeeds). */
203
+ private textState;
204
+ /** Checks that `field` is a text field declaring mark `key`; answers the object's type. */
205
+ private markKey;
206
+ /** Checks a mark's range against the text including this transaction's edits; answers whether it holds any character. */
207
+ private markRange;
208
+ private listState;
209
+ /** Checks a map field for writing; answers the object's type. */
210
+ private writableMap;
211
+ private treeState;
212
+ /** A handle as this transaction sees it. A handle of another transaction that never applied (it failed) names no node. */
213
+ private nodeKey;
214
+ }
215
+ export {};
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Values as the KDM stores them: JSON only, checked and copied when an operation is staged, so a
3
+ * value that is not JSON never reaches the engine and later mutation of the caller's object
4
+ * changes nothing.
5
+ */
6
+ /** A JSON value: what register fields, `json` fields, blobs, and map entries hold. */
7
+ export type JsonValue = null | boolean | number | string | JsonValue[] | {
8
+ [key: string]: JsonValue;
9
+ };
10
+ export declare const isLowSurrogate: (unit: number) => boolean;
11
+ /**
12
+ * The string the engine stores for `text`: a lone surrogate becomes U+FFFD (strings cross into the
13
+ * engine as UTF-8), so pending reads and positions match committed ones.
14
+ */
15
+ export declare function wellFormed(text: string): string;
16
+ /**
17
+ * A checked deep copy of `value` as JSON: `null`, booleans, strings (lone surrogates normalised),
18
+ * finite numbers, arrays, and plain objects (prototype `Object.prototype` or `null`, no `__proto__`
19
+ * key, no symbol keys). Anything else (`undefined` inside a value, bigints, functions, symbols,
20
+ * typed arrays, dates, maps, class instances, `NaN`, infinities, cycles) is refused through `fail`,
21
+ * which answers the error to throw. A top-level `undefined` is `null`.
22
+ */
23
+ export declare function toJson(value: unknown, fail: (reason: string) => Error): JsonValue;
@@ -0,0 +1,19 @@
1
+ /**
2
+ * `checkNoPaths` (KitFiles 1.0 section 13): a kit never sends a path-shaped string in a `files/*`
3
+ * request. It names files by handle and suggests bare names; the host owns every path (FA-P2).
4
+ */
5
+ /** A path-shaped string a kit sent: the request, where in its params, and the string. */
6
+ export type PathLeak = {
7
+ method: string;
8
+ at: string;
9
+ value: string;
10
+ };
11
+ /** Whether `value` is path-shaped: an absolute path anywhere, or (outside free text) any separator. */
12
+ export declare function isPathShaped(value: string, freeText?: boolean): boolean;
13
+ /** Whether `value` is a MIME type rather than a path: `application/pdf` is, `exports/Out.pdf` and `/tmp/x` are not. */
14
+ export declare function isMimeType(value: string): boolean;
15
+ /** The path-shaped strings in the `files/*` requests a kit sent; none when it kept to handles and names. */
16
+ export declare function checkNoPaths(requests: ReadonlyArray<{
17
+ method: string;
18
+ params: unknown;
19
+ }>): PathLeak[];
@@ -0,0 +1,2 @@
1
+ /** Answers the problems found in `frame` (a Playwright Frame of the kit); empty when none. */
2
+ export function checkUiIds(frame: any, elements: any, options?: {}): Promise<any>;
@@ -0,0 +1,179 @@
1
+ /**
2
+ * A development host for an embedded kit UI (a kit's `dev.html`): mounts the editor in an iframe
3
+ * over the Kit UI protocol, with an in-memory workspace, so the kit can be run and tested without
4
+ * Kition. It opens a sample file from the kit's package, or one chosen in the page.
5
+ *
6
+ * The page needs `<iframe id="kit">`, `<span id="status">`, and `<input id="file" type="file">`.
7
+ * Tests drive it through `window.devHost`. `?role=viewer` or `?role=commenter` opens the document
8
+ * read-only as that person would (Kit UI protocol `document.readOnly` and `document.comments`).
9
+ * `?presence=1` (or `presence: true`) serves presence (capability `presence`, protocol section
10
+ * 7e): the host keeps what the kit shares and tests play other people with `setPeers`. Schema
11
+ * reports (`document/schema`, section 7f) are always kept.
12
+ *
13
+ * With `kitFiles` (the kit manifest's `files` lists, K15) it serves KitFiles 1.0 (protocol section
14
+ * 7g) from the same in-memory folder: a scripted picker (`scriptPick`), a printer that records
15
+ * what it printed, the grant log, and every `files/*` request the kit sent, for `checkNoPaths`.
16
+ *
17
+ * With `generate` (or `?generate=1`) it serves host generation (capability `generate`, protocol
18
+ * section 7j): every `host/generate` is kept in `generated` and answered from `scriptGenerate`'s
19
+ * queue (with nothing queued, it is refused as `unavailable`, no model configured). A purpose
20
+ * that is neither defined nor the kit's own is refused as `not-allowed`, as every host does.
21
+ *
22
+ * With `open` (or `?open=1`) it serves opening (capabilities `open-file` and `open-url`, protocol
23
+ * section 7i): every `host/open` and `host/openUrl` is kept in `opens` and answered with
24
+ * `openAnswer`, without leaving the open document. A link resolves against the document's folder
25
+ * (a leading `/` from the workspace root), a bare name to a file of that name; a missing one is
26
+ * refused as `not-found` unless the request asks to create it, which adds an empty file.
27
+ *
28
+ * It always serves picking a file to link (`links/pick`, capability `links-pick`, protocol section
29
+ * 7i, except for `?role=viewer` and `?role=commenter`): the next answer `scriptLinkPick` queued (workspace paths), or else the
30
+ * workspace files `pickable` names that the request accepts (the first, or all with `multiple`),
31
+ * never the open document. Nothing is copied: the kit gets each by its path from the document's
32
+ * folder and reads it with `host/read`. `linkPicks` keeps every request.
33
+ */
34
+ import { type KitConnection, type KitLinkRef, type KitLinksPickParams, type KitOpenParams, type KitGenerateErrorReason, type KitGenerateParams, type KitGenerateResult, type KitFileGrant, type KitFilesManifest, type KitFilesPickParams, type KitPeerPresence, type KitPresence, type KitSchemaReport, type KitUiConfig, type KitView } from '../../kit-host/src/index.js';
35
+ import { type PathLeak } from './checkNoPaths.js';
36
+ import { type MemoryFile } from './memoryFiles.js';
37
+ export { checkNoPaths, isMimeType, isPathShaped, type PathLeak } from './checkNoPaths.js';
38
+ export { memoryFilesStorage, type MemoryFile } from './memoryFiles.js';
39
+ type File = MemoryFile;
40
+ /** What the scripted picker answers next: workspace paths (none: the person cancelled), or a function of the request. */
41
+ export type ScriptedPick = string[] | ((params: KitFilesPickParams) => string[]);
42
+ /** What the link chooser answers next (`links/pick`): workspace paths (none: the person cancelled), or a function of the request. */
43
+ export type ScriptedLinkPick = string[] | ((params: KitLinksPickParams) => string[]);
44
+ /** What a scripted `host/generate` answers: a result, a refusal with its reason, or a function of the request. */
45
+ export type ScriptedGenerate = KitGenerateResult | {
46
+ refuse: KitGenerateErrorReason;
47
+ } | ((params: KitGenerateParams) => KitGenerateResult | {
48
+ refuse: KitGenerateErrorReason;
49
+ } | Promise<KitGenerateResult | {
50
+ refuse: KitGenerateErrorReason;
51
+ }>);
52
+ export type DevHostOptions = {
53
+ /** The sample opened at start, relative to the page (`./sample/Sample.kslide`). */
54
+ sample?: string;
55
+ /** The editor's page, relative to this one. */
56
+ entry?: string;
57
+ /** Workspace files `host/pick` and `links/pick` may answer with. */
58
+ pickable?: RegExp;
59
+ /** Extra files put in the workspace before the sample opens (name → URL). */
60
+ files?: Record<string, string>;
61
+ /**
62
+ * Files the document links (media), lent as the protocol's `document.lend`: a folder of this
63
+ * site that serves ranged reads (Vite's static server does), and the document's folder in it.
64
+ */
65
+ lend?: {
66
+ root: string;
67
+ folder: string;
68
+ };
69
+ /** Serves presence (capability `presence`, protocol section 7e), as `?presence=1` does. */
70
+ presence?: boolean;
71
+ /** The kit manifest's `files` lists (K15): serves KitFiles 1.0 (`files/*`) under them. */
72
+ kitFiles?: KitFilesManifest;
73
+ /** Serves host generation (capability `generate`, protocol section 7j), as `?generate=1` does. */
74
+ generate?: boolean;
75
+ /** Serves opening (capabilities `open-file` and `open-url`, protocol section 7i), as `?open=1` does. */
76
+ open?: boolean;
77
+ };
78
+ /** A `host/open` or `host/openUrl` the editor sent, as `mountKit` checked it. */
79
+ export type DevOpen = {
80
+ method: 'host/open';
81
+ params: KitOpenParams;
82
+ } | {
83
+ method: 'host/openUrl';
84
+ params: {
85
+ url: string;
86
+ };
87
+ };
88
+ export type DevHost = {
89
+ files: Map<string, File>;
90
+ connection: () => KitConnection | null;
91
+ /** Opens a file in the editor; `view` is where in it to show first (`document.view`). */
92
+ open: (path: string, bytes: ArrayBuffer, options?: {
93
+ view?: KitView;
94
+ }) => Promise<void>;
95
+ /** Every `document/changed` the editor sent. */
96
+ changes: unknown[];
97
+ /** Sends a UI configuration (`ui/configure`) and keeps it for the next open. */
98
+ configure: (ui: KitUiConfig) => void;
99
+ /** Every `ui/action` the editor sent. */
100
+ actions: unknown[];
101
+ /** Switches the color scheme (`ui/theme`). */
102
+ setScheme: (scheme: 'light' | 'dark') => void;
103
+ /** Every `presence/set` the editor sent, checked (with presence served). */
104
+ presences: KitPresence[];
105
+ /**
106
+ * Plays the other people in the document: sends them as `presence/peers` (the whole list) and
107
+ * again to each editor opened after (with presence served).
108
+ */
109
+ setPeers: (peers: KitPeerPresence[]) => void;
110
+ /** Every `document/schema` the editor sent: a newer kit edited the document. */
111
+ schemas: KitSchemaReport[];
112
+ /** Empty folders in the workspace (KitFiles), beside the folders the files' paths make. */
113
+ folders: Set<string>;
114
+ /** Queues the picker's next answers (`files/pick`), one per pick; with none queued it cancels. */
115
+ scriptPick: (...answers: ScriptedPick[]) => void;
116
+ /** Every grant (KitFiles section 7's grant log). */
117
+ grants: KitFileGrant[];
118
+ /** Every `files/*` request the editor sent, as it sent it. */
119
+ fileRequests: Array<{
120
+ method: string;
121
+ params: unknown;
122
+ }>;
123
+ /** Every print: its title and the PDF's size. `printAnswer` is what the print dialog answers. */
124
+ prints: Array<{
125
+ title: string;
126
+ size: number;
127
+ }>;
128
+ printAnswer: boolean;
129
+ /** The path-shaped strings in the editor's `files/*` requests (KitFiles section 13); none is a pass. */
130
+ checkNoPaths: () => PathLeak[];
131
+ /** Every `host/generate` the editor sent whose purpose a host accepts (with generation served). */
132
+ generated: KitGenerateParams[];
133
+ /** Queues the next `host/generate` answers, one per request; with none queued it is refused as `unavailable`. */
134
+ scriptGenerate: (...answers: ScriptedGenerate[]) => void;
135
+ /** Every `host/open` and `host/openUrl` the editor sent (with opening served), in order. */
136
+ opens: DevOpen[];
137
+ /** What an open answers (`opened`); `false` plays a person who cancelled. */
138
+ openAnswer: boolean;
139
+ /** Queues the link chooser's next answers (`links/pick`), one per pick; with none queued it answers the `pickable` files. */
140
+ scriptLinkPick: (...answers: ScriptedLinkPick[]) => void;
141
+ /** Every `links/pick` the editor sent, as `mountKit` checked it. */
142
+ linkPicks: KitLinksPickParams[];
143
+ };
144
+ declare global {
145
+ interface Window {
146
+ devHost: DevHost;
147
+ }
148
+ }
149
+ /** Whether `name` has one of the extensions in `accept` (with or without their dot); an empty list accepts any. */
150
+ export declare function accepts(accept: readonly string[] | undefined, name: string): boolean;
151
+ /** The document's `readOnly` and `comments` for a `?role=` of `viewer` or `commenter`; nothing for another. */
152
+ export declare function roleInit(role: string | null): {
153
+ readOnly?: undefined;
154
+ comments?: undefined;
155
+ } | {
156
+ readOnly: boolean;
157
+ comments: {
158
+ me: string;
159
+ name: string;
160
+ canComment: boolean;
161
+ othersReadOnly: boolean;
162
+ };
163
+ };
164
+ /**
165
+ * The workspace path a link names from the document at `from` (KitLinks 1.0 LR4): a path relative
166
+ * to its folder (a leading `/` from the workspace root), or, for a bare name, the file with that
167
+ * name, one of `from`'s extension first. A name with no file answers the path to create, beside
168
+ * the document with its extension. `exists` says whether it is there; `null` is no workspace path.
169
+ */
170
+ export declare function resolveLink(link: KitLinkRef, from: string, files: ReadonlySet<string> | ReadonlyMap<string, unknown>): {
171
+ path: string;
172
+ exists: boolean;
173
+ } | null;
174
+ /**
175
+ * The `ui.modes` for a `?modes=` list (`classic`, `menus,focus`): only those allowed, the first the
176
+ * default; nothing without one. A name that is not a display mode is dropped, with a warning.
177
+ */
178
+ export declare function modesInit(param: string | null): KitUiConfig['modes'];
179
+ export declare function startDevHost(options?: DevHostOptions): void;
@@ -0,0 +1,14 @@
1
+ /** Answers `{ buttons, clipped, fields, found, missing }` for the row in this document: `clipped` names buttons drawn outside the row's box, which `buttons` does not count. */
2
+ export function lineRowReport(primary: any): {
3
+ buttons: number;
4
+ clipped: any[];
5
+ fields: number;
6
+ found: any;
7
+ missing: any;
8
+ };
9
+ /**
10
+ * The kit's controls the Focus bar (kit-editor's EditorFrame in `focus` mode) covers in this
11
+ * document: visible buttons, fields, tabs, and sliders outside the bar whose box meets the bar's,
12
+ * by test id, else name, else tag. Answers `['no Focus bar']` when the bar is missing.
13
+ */
14
+ export function focusBarReport(): string[];
@@ -0,0 +1,15 @@
1
+ /**
2
+ * The development host's in-memory folder as KitFiles storage (`@kition/sdk/host`'s
3
+ * `KitFilesStorage`): workspace-relative paths are its references, folders are the paths' prefixes
4
+ * (and any added empty), and a hidden segment (a leading dot) is never visible to the kit (LR2).
5
+ */
6
+ import { type KitFilesStorage } from '../../kit-host/src/index.js';
7
+ export type MemoryFile = {
8
+ bytes: ArrayBuffer;
9
+ version: number;
10
+ };
11
+ /**
12
+ * Storage over `files` (path → bytes and version). `documentFolder` is where new files go without
13
+ * a folder handle; `folders` are empty folders that exist too.
14
+ */
15
+ export declare function memoryFilesStorage(files: Map<string, MemoryFile>, documentFolder: () => string, folders?: Set<string>): KitFilesStorage;
@@ -0,0 +1,8 @@
1
+ export function runModeSmoke({ kit, config, browser: type, createServer, locale, line }: {
2
+ kit: any;
3
+ config: any;
4
+ browser: any;
5
+ createServer: any;
6
+ locale?: string | undefined;
7
+ line?: null | undefined;
8
+ }): Promise<void>;
@@ -0,0 +1,22 @@
1
+ import type { KitCommand } from './engine/kitModule.js';
2
+ /** Whether running `command` needs values a person has to give (a required parameter). */
3
+ export declare function needsParams(command: KitCommand): boolean;
4
+ /**
5
+ * A command's parameters as a form, from its schema (standard A5): a menu for an enum, a number
6
+ * field, a check box, or a text field (JSON for arrays and objects). Runs it with the values.
7
+ */
8
+ export declare function CommandDialog({ command, onRun, onClose, labels, values: given, title, }: {
9
+ command: KitCommand;
10
+ onRun: (params: Record<string, unknown>) => void;
11
+ onClose: () => void;
12
+ labels: {
13
+ run: string;
14
+ cancel: string;
15
+ required: string;
16
+ more?: string;
17
+ };
18
+ /** Values to start with (the current page), over the schema's defaults. */
19
+ values?: Record<string, unknown>;
20
+ /** The dialog's title, translated (the command's title by default). */
21
+ title?: string;
22
+ }): import("react").JSX.Element;
@@ -0,0 +1,45 @@
1
+ import type { CommentAnchor, CommentThread } from '../../kdm/src/index.js';
2
+ export type CommentsPanelLabels = {
3
+ title: string;
4
+ empty: string;
5
+ newComment: string;
6
+ placeholder: string;
7
+ replyPlaceholder: string;
8
+ comment: string;
9
+ reply: string;
10
+ cancel: string;
11
+ resolve: string;
12
+ reopen: string;
13
+ delete: string;
14
+ resolved: string;
15
+ readOnlyHistory: string;
16
+ you: string;
17
+ };
18
+ export declare const COMMENTS_PANEL_LABELS: CommentsPanelLabels;
19
+ export type CommentsPanelProps = {
20
+ threads: CommentThread[];
21
+ /** This person's principal id (the `author` of what they write); `null` when unknown. */
22
+ me: string | null;
23
+ /** Whether this person may write comments at all. */
24
+ canComment: boolean;
25
+ /** Threads others opened are read-only history (no co-editing session). */
26
+ othersReadOnly?: boolean;
27
+ /** Where a new thread would go; set, the panel shows its composer first. */
28
+ pendingAnchor?: CommentAnchor | null;
29
+ /** The thread the kit highlights (its anchor was clicked); the panel scrolls to it. */
30
+ activeThread?: string | null;
31
+ onActivate?: (thread: string) => void;
32
+ onAdd: (anchor: CommentAnchor, body: string) => void;
33
+ onCancelNew?: () => void;
34
+ onReply: (thread: string, body: string) => void;
35
+ onResolve: (thread: string, resolved: boolean) => void;
36
+ onDelete: (thread: string, comment: string) => void;
37
+ /** What the thread's anchor points at, to show above it ("Slide 2", a quote). */
38
+ anchorLabel?: (anchor: CommentAnchor) => string | null;
39
+ /** When a comment was written, for people; ISO text by default. */
40
+ formatTime?: (created: string) => string;
41
+ labels?: Partial<CommentsPanelLabels>;
42
+ testId?: string;
43
+ };
44
+ /** The comments side panel: the threads, newest activity last, and a composer for new ones. */
45
+ export declare function CommentsPanel(props: CommentsPanelProps): import("react").JSX.Element;