@a3s-lab/office 0.2.2 → 0.4.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 (277) hide show
  1. package/COLLABORATION_ROADMAP.md +426 -0
  2. package/README.md +649 -10
  3. package/dist/0~1403.js +1 -1
  4. package/dist/0~2805.js +1279 -0
  5. package/dist/{0~use-office-draft.js → 0~345.js} +30 -1
  6. package/dist/0~3539.js +1 -1
  7. package/dist/0~3557.js +1 -1
  8. package/dist/0~3635.js +1 -1
  9. package/dist/0~4595.js +123 -12
  10. package/dist/0~4980.js +154 -0
  11. package/dist/0~5050.js +124 -113
  12. package/dist/{0~9512.js → 0~6090.js} +540 -3
  13. package/dist/0~7048.js +92 -66
  14. package/dist/0~7614.js +2 -1
  15. package/dist/0~7754.js +5653 -0
  16. package/dist/0~9445.js +1 -1
  17. package/dist/0~document-editor.js +4992 -3323
  18. package/dist/0~markdown-editor.js +250 -44
  19. package/dist/0~pdf-viewer.js +1016 -24
  20. package/dist/0~presentation-editor.js +179 -8
  21. package/dist/0~spreadsheet-editor.js +3371 -578
  22. package/dist/0~work-docx-export.js +6801 -658
  23. package/dist/0~work-docx-import.js +1388 -795
  24. package/dist/0~work-office-diagnostics.js +524 -30
  25. package/dist/0~work-pptx-export.js +2 -1
  26. package/dist/0~work-pptx-import.js +1 -2
  27. package/dist/0~work-presentation-charts.js +1 -1
  28. package/dist/2591.js +197 -0
  29. package/dist/3818.js +1090 -0
  30. package/dist/4104.js +970 -60
  31. package/dist/432.js +171 -14
  32. package/dist/4476.js +2008 -0
  33. package/dist/4560.js +674 -0
  34. package/dist/4650.js +70 -0
  35. package/dist/{1134.js → 5184.js} +183 -1
  36. package/dist/6489.js +18 -18
  37. package/dist/7060.js +132 -0
  38. package/dist/8715.js +2 -136
  39. package/dist/8928.js +16778 -0
  40. package/dist/9787.js +209 -0
  41. package/dist/core.d.ts +29 -9
  42. package/dist/core.js +10 -2
  43. package/dist/index.js +13 -3
  44. package/dist/internal/collaboration/office-collaboration-flat-json.d.ts +13 -0
  45. package/dist/internal/collaboration/office-collaboration-json.d.ts +4 -0
  46. package/dist/internal/collaboration/office-collaboration-presence.d.ts +86 -0
  47. package/dist/internal/collaboration/office-collaboration-transport.d.ts +42 -0
  48. package/dist/internal/collaboration/office-collaboration.d.ts +85 -0
  49. package/dist/internal/collaboration/office-document-collaboration-bibliography.d.ts +7 -0
  50. package/dist/internal/collaboration/office-document-collaboration-claims.d.ts +9 -0
  51. package/dist/internal/collaboration/office-document-collaboration-comments.d.ts +7 -0
  52. package/dist/internal/collaboration/office-document-collaboration-sidecar-utils.d.ts +27 -0
  53. package/dist/internal/collaboration/office-document-collaboration-sidecars.d.ts +16 -0
  54. package/dist/internal/collaboration/office-document-collaboration.d.ts +45 -0
  55. package/dist/internal/collaboration/office-markdown-collaboration.d.ts +31 -0
  56. package/dist/internal/collaboration/office-pdf-collaboration-claims.d.ts +4 -0
  57. package/dist/internal/collaboration/office-pdf-collaboration-conflicts.d.ts +2 -0
  58. package/dist/internal/collaboration/office-pdf-collaboration-model.d.ts +26 -0
  59. package/dist/internal/collaboration/office-pdf-collaboration-records.d.ts +21 -0
  60. package/dist/internal/collaboration/office-pdf-collaboration-types.d.ts +91 -0
  61. package/dist/internal/collaboration/office-pdf-collaboration-validation.d.ts +4 -0
  62. package/dist/internal/collaboration/office-pdf-collaboration.d.ts +35 -0
  63. package/dist/internal/collaboration/office-presentation-collaboration-model.d.ts +25 -0
  64. package/dist/internal/collaboration/office-presentation-collaboration-records.d.ts +22 -0
  65. package/dist/internal/collaboration/office-presentation-collaboration-validation.d.ts +4 -0
  66. package/dist/internal/collaboration/office-presentation-collaboration.d.ts +32 -0
  67. package/dist/internal/collaboration/office-spreadsheet-collaboration-cells.d.ts +13 -0
  68. package/dist/internal/collaboration/office-spreadsheet-collaboration-claims.d.ts +4 -0
  69. package/dist/internal/collaboration/office-spreadsheet-collaboration-conflicts.d.ts +2 -0
  70. package/dist/internal/collaboration/office-spreadsheet-collaboration-flat-json.d.ts +10 -0
  71. package/dist/internal/collaboration/office-spreadsheet-collaboration-model.d.ts +31 -0
  72. package/dist/internal/collaboration/office-spreadsheet-collaboration-records.d.ts +17 -0
  73. package/dist/internal/collaboration/office-spreadsheet-collaboration-validation.d.ts +4 -0
  74. package/dist/internal/collaboration/office-spreadsheet-collaboration.d.ts +32 -0
  75. package/dist/internal/design-system/primitives/navigation/tabs.d.ts +3 -1
  76. package/dist/internal/features/work/components/work-document-page-border.d.ts +6 -0
  77. package/dist/internal/features/work/editors/document-command-catalog.d.ts +536 -0
  78. package/dist/internal/features/work/editors/document-editor-focus.d.ts +1 -1
  79. package/dist/internal/features/work/editors/document-editor-support.d.ts +7 -3
  80. package/dist/internal/features/work/editors/document-editor.d.ts +8 -2
  81. package/dist/internal/features/work/editors/document-external-content.d.ts +14 -0
  82. package/dist/internal/features/work/editors/document-format-clipboard.d.ts +6 -0
  83. package/dist/internal/features/work/editors/document-format-tools.d.ts +4 -0
  84. package/dist/internal/features/work/editors/document-layout-panel.d.ts +4 -1
  85. package/dist/internal/features/work/editors/document-page-chrome-wps-shortcuts.d.ts +2 -0
  86. package/dist/internal/features/work/editors/document-page-layout-ribbon.d.ts +14 -0
  87. package/dist/internal/features/work/editors/document-page-stack.d.ts +10 -1
  88. package/dist/internal/features/work/editors/document-page-thumbnail.d.ts +2 -0
  89. package/dist/internal/features/work/editors/document-pagination-run-coordinator.d.ts +26 -0
  90. package/dist/internal/features/work/editors/document-picture-properties-dialog-model.d.ts +20 -1
  91. package/dist/internal/features/work/editors/document-review-navigation.d.ts +9 -0
  92. package/dist/internal/features/work/editors/document-statistics-dialog.d.ts +7 -0
  93. package/dist/internal/features/work/editors/document-status-bar.d.ts +2 -1
  94. package/dist/internal/features/work/editors/document-table-properties-dialog-model.d.ts +4 -1
  95. package/dist/internal/features/work/editors/document-toolbar.d.ts +19 -42
  96. package/dist/internal/features/work/editors/document-wps-shortcuts.d.ts +12 -0
  97. package/dist/internal/features/work/editors/document-zoom.d.ts +17 -0
  98. package/dist/internal/features/work/editors/markdown-editor-focus.d.ts +1 -1
  99. package/dist/internal/features/work/editors/markdown-editor.d.ts +5 -1
  100. package/dist/internal/features/work/editors/markdown-toolbar.d.ts +2 -1
  101. package/dist/internal/features/work/editors/office-collaboration-participants.d.ts +3 -0
  102. package/dist/internal/features/work/editors/office-collaboration-presence-context.d.ts +17 -0
  103. package/dist/internal/features/work/editors/office-collaboration-presence-ui.d.ts +25 -0
  104. package/dist/internal/features/work/editors/office-editor-focus-handoff.d.ts +27 -0
  105. package/dist/internal/features/work/editors/pdf-annotation-controller.d.ts +5 -0
  106. package/dist/internal/features/work/editors/pdf-collaboration-presence.d.ts +3 -0
  107. package/dist/internal/features/work/editors/pdf-collaboration-projection.d.ts +10 -0
  108. package/dist/internal/features/work/editors/pdf-evidence-contract.d.ts +36 -0
  109. package/dist/internal/features/work/editors/pdf-evidence-overlay.d.ts +37 -0
  110. package/dist/internal/features/work/editors/pdf-toolbar.d.ts +2 -1
  111. package/dist/internal/features/work/editors/pdf-viewer-controller.d.ts +7 -1
  112. package/dist/internal/features/work/editors/pdf-viewer.d.ts +11 -1
  113. package/dist/internal/features/work/editors/presentation-collaboration-presence.d.ts +5 -0
  114. package/dist/internal/features/work/editors/presentation-editor-focus.d.ts +3 -2
  115. package/dist/internal/features/work/editors/presentation-editor-types.d.ts +3 -0
  116. package/dist/internal/features/work/editors/presentation-editor.d.ts +1 -1
  117. package/dist/internal/features/work/editors/spreadsheet-auto-filter.d.ts +9 -0
  118. package/dist/internal/features/work/editors/spreadsheet-cell-clear.d.ts +3 -0
  119. package/dist/internal/features/work/editors/spreadsheet-cell-merge.d.ts +12 -0
  120. package/dist/internal/features/work/editors/spreadsheet-clipboard-shortcuts.d.ts +3 -7
  121. package/dist/internal/features/work/editors/spreadsheet-collaboration-presence.d.ts +9 -0
  122. package/dist/internal/features/work/editors/spreadsheet-command-catalog.d.ts +464 -0
  123. package/dist/internal/features/work/editors/spreadsheet-command-controller.d.ts +45 -9
  124. package/dist/internal/features/work/editors/spreadsheet-context-menu.d.ts +2 -0
  125. package/dist/internal/features/work/editors/spreadsheet-editor-ribbon.d.ts +9 -28
  126. package/dist/internal/features/work/editors/spreadsheet-editor.d.ts +8 -2
  127. package/dist/internal/features/work/editors/spreadsheet-format-painter.d.ts +27 -0
  128. package/dist/internal/features/work/editors/spreadsheet-freeze-panes.d.ts +14 -0
  129. package/dist/internal/features/work/editors/use-document-insert-commands.d.ts +3 -2
  130. package/dist/internal/features/work/editors/use-document-pagination.d.ts +6 -1
  131. package/dist/internal/features/work/editors/use-document-review-conflicts.d.ts +28 -0
  132. package/dist/internal/features/work/editors/use-spreadsheet-auto-filter.d.ts +21 -0
  133. package/dist/internal/features/work/editors/use-spreadsheet-collaboration.d.ts +27 -0
  134. package/dist/internal/features/work/editors/use-spreadsheet-format-painter.d.ts +18 -0
  135. package/dist/internal/features/work/editors/work-office-chrome.d.ts +22 -3
  136. package/dist/internal/features/work/editors/work-office-ribbon-overflow.d.ts +2 -0
  137. package/dist/internal/features/work/work-document-bookmark-references.d.ts +37 -0
  138. package/dist/internal/features/work/work-document-bookmarks.d.ts +29 -0
  139. package/dist/internal/features/work/work-document-caption-nodes.d.ts +4 -1
  140. package/dist/internal/features/work/work-document-comments.d.ts +1 -1
  141. package/dist/internal/features/work/work-document-equations.d.ts +513 -0
  142. package/dist/internal/features/work/work-document-extensions.d.ts +1 -0
  143. package/dist/internal/features/work/work-document-field-identity.d.ts +2 -0
  144. package/dist/internal/features/work/work-document-field-node.d.ts +2 -2
  145. package/dist/internal/features/work/work-document-fields.d.ts +7 -0
  146. package/dist/internal/features/work/work-document-image-identity.d.ts +30 -0
  147. package/dist/internal/features/work/work-document-image-layout.d.ts +46 -1
  148. package/dist/internal/features/work/work-document-image-wrap-contour.d.ts +16 -0
  149. package/dist/internal/features/work/work-document-incremental-layout.d.ts +2 -2
  150. package/dist/internal/features/work/work-document-model-codec.d.ts +4 -1
  151. package/dist/internal/features/work/work-document-note-integrity.d.ts +2 -0
  152. package/dist/internal/features/work/work-document-page-borders.d.ts +25 -0
  153. package/dist/internal/features/work/work-document-page-capture.d.ts +8 -0
  154. package/dist/internal/features/work/work-document-page-frames.d.ts +15 -0
  155. package/dist/internal/features/work/work-document-page-margins.d.ts +56 -0
  156. package/dist/internal/features/work/work-document-page-size.d.ts +47 -0
  157. package/dist/internal/features/work/work-document-pagination-measurement.d.ts +1 -2
  158. package/dist/internal/features/work/work-document-pagination-types.d.ts +7 -2
  159. package/dist/internal/features/work/work-document-pagination.d.ts +2 -2
  160. package/dist/internal/features/work/work-document-paragraph-borders.d.ts +32 -0
  161. package/dist/internal/features/work/work-document-paragraph-identity.d.ts +26 -0
  162. package/dist/internal/features/work/work-document-paragraph-shading.d.ts +18 -0
  163. package/dist/internal/features/work/work-document-review-conflicts.d.ts +35 -0
  164. package/dist/internal/features/work/work-document-section.d.ts +4 -0
  165. package/dist/internal/features/work/work-document-snapshot.d.ts +19 -0
  166. package/dist/internal/features/work/work-document-source.d.ts +23 -0
  167. package/dist/internal/features/work/work-document-table-column-widths.d.ts +7 -0
  168. package/dist/internal/features/work/work-document-table-property-changes.d.ts +3 -0
  169. package/dist/internal/features/work/work-document-table-row-identity.d.ts +15 -0
  170. package/dist/internal/features/work/work-document-table-sizing.d.ts +3 -0
  171. package/dist/internal/features/work/work-document-text-layout.d.ts +3 -1
  172. package/dist/internal/features/work/work-document-word-line-metrics.d.ts +2 -0
  173. package/dist/internal/features/work/work-docx-bookmark-diagnostics.d.ts +3 -0
  174. package/dist/internal/features/work/work-docx-bookmark-import.d.ts +24 -0
  175. package/dist/internal/features/work/work-docx-bookmarks.d.ts +17 -0
  176. package/dist/internal/features/work/work-docx-comment-durable-id-preservation.d.ts +2 -0
  177. package/dist/internal/features/work/work-docx-comment-export.d.ts +3 -0
  178. package/dist/internal/features/work/work-docx-comment-metadata.d.ts +2 -0
  179. package/dist/internal/features/work/work-docx-drawing-extension-preservation.d.ts +4 -0
  180. package/dist/internal/features/work/work-docx-equation-diagnostics.d.ts +3 -0
  181. package/dist/internal/features/work/work-docx-equation-export.d.ts +14 -0
  182. package/dist/internal/features/work/work-docx-equation-import.d.ts +30 -0
  183. package/dist/internal/features/work/work-docx-equation-story.d.ts +9 -0
  184. package/dist/internal/features/work/work-docx-export-formatting.d.ts +3 -1
  185. package/dist/internal/features/work/work-docx-export-image.d.ts +5 -1
  186. package/dist/internal/features/work/work-docx-export.d.ts +1 -1
  187. package/dist/internal/features/work/work-docx-field-instructions.d.ts +8 -0
  188. package/dist/internal/features/work/work-docx-font-table-preservation.d.ts +3 -0
  189. package/dist/internal/features/work/work-docx-ignorable-extension-preservation.d.ts +15 -0
  190. package/dist/internal/features/work/work-docx-image-crop.d.ts +12 -0
  191. package/dist/internal/features/work/work-docx-image-identity.d.ts +17 -0
  192. package/dist/internal/features/work/work-docx-image-layer.d.ts +12 -0
  193. package/dist/internal/features/work/work-docx-image-layout-import.d.ts +14 -2
  194. package/dist/internal/features/work/work-docx-image-wrap.d.ts +15 -0
  195. package/dist/internal/features/work/work-docx-import.d.ts +13 -3
  196. package/dist/internal/features/work/work-docx-list-export.d.ts +18 -0
  197. package/dist/internal/features/work/work-docx-list-import.d.ts +14 -0
  198. package/dist/internal/features/work/work-docx-note-comment-content-control-block-preservation.d.ts +18 -0
  199. package/dist/internal/features/work/work-docx-note-comment-content-control-model.d.ts +47 -0
  200. package/dist/internal/features/work/work-docx-note-comment-content-control-preservation.d.ts +4 -0
  201. package/dist/internal/features/work/work-docx-note-comment-content-control-properties.d.ts +17 -0
  202. package/dist/internal/features/work/work-docx-note-comment-content-control-table-model.d.ts +17 -0
  203. package/dist/internal/features/work/work-docx-note-comment-content-control-xml.d.ts +14 -0
  204. package/dist/internal/features/work/work-docx-note-comment-extension-preservation.d.ts +2 -0
  205. package/dist/internal/features/work/work-docx-note-comment-hyperlink-content.d.ts +40 -0
  206. package/dist/internal/features/work/work-docx-note-comment-hyperlink-preservation.d.ts +5 -0
  207. package/dist/internal/features/work/work-docx-note-comment-hyperlink-relationships.d.ts +35 -0
  208. package/dist/internal/features/work/work-docx-note-comment-identity.d.ts +15 -0
  209. package/dist/internal/features/work/work-docx-note-comment-run-preservation.d.ts +4 -0
  210. package/dist/internal/features/work/work-docx-note-comment-run-properties.d.ts +2 -0
  211. package/dist/internal/features/work/work-docx-note-image-import.d.ts +12 -0
  212. package/dist/internal/features/work/work-docx-note-image-relationships.d.ts +1 -0
  213. package/dist/internal/features/work/work-docx-numbering-extension-preservation.d.ts +6 -0
  214. package/dist/internal/features/work/work-docx-numbering.d.ts +1 -0
  215. package/dist/internal/features/work/work-docx-page-borders-diagnostics.d.ts +3 -0
  216. package/dist/internal/features/work/work-docx-page-borders-import.d.ts +10 -0
  217. package/dist/internal/features/work/work-docx-page-margins-diagnostics.d.ts +3 -0
  218. package/dist/internal/features/work/work-docx-page-margins-import.d.ts +18 -0
  219. package/dist/internal/features/work/work-docx-page-size-diagnostics.d.ts +2 -0
  220. package/dist/internal/features/work/work-docx-page-size-import.d.ts +17 -0
  221. package/dist/internal/features/work/work-docx-paragraph-borders-diagnostics.d.ts +3 -0
  222. package/dist/internal/features/work/work-docx-paragraph-borders-export.d.ts +18 -0
  223. package/dist/internal/features/work/work-docx-paragraph-borders-import.d.ts +24 -0
  224. package/dist/internal/features/work/work-docx-paragraph-default-collapsed.d.ts +19 -0
  225. package/dist/internal/features/work/work-docx-paragraph-extension-preservation.d.ts +2 -0
  226. package/dist/internal/features/work/work-docx-paragraph-identity-import.d.ts +10 -0
  227. package/dist/internal/features/work/work-docx-paragraph-identity.d.ts +18 -0
  228. package/dist/internal/features/work/work-docx-paragraph-pagination-import.d.ts +6 -1
  229. package/dist/internal/features/work/work-docx-paragraph-shading-diagnostics.d.ts +3 -0
  230. package/dist/internal/features/work/work-docx-paragraph-shading-export.d.ts +5 -0
  231. package/dist/internal/features/work/work-docx-paragraph-shading-import.d.ts +18 -0
  232. package/dist/internal/features/work/work-docx-run-formatting-import.d.ts +3 -0
  233. package/dist/internal/features/work/work-docx-settings-preservation.d.ts +10 -0
  234. package/dist/internal/features/work/work-docx-settings-xml.d.ts +16 -0
  235. package/dist/internal/features/work/work-docx-style-extension-preservation.d.ts +2 -0
  236. package/dist/internal/features/work/work-docx-table-cell-export.d.ts +2 -1
  237. package/dist/internal/features/work/work-docx-table-cell-import.d.ts +3 -0
  238. package/dist/internal/features/work/work-docx-table-extension-preservation.d.ts +2 -0
  239. package/dist/internal/features/work/work-docx-table-row-import.d.ts +2 -0
  240. package/dist/internal/features/work/work-docx-table-sizing-import.d.ts +1 -0
  241. package/dist/internal/features/work/work-docx-theme-reference.d.ts +23 -0
  242. package/dist/internal/features/work/work-docx-theme.d.ts +4 -1
  243. package/dist/internal/features/work/work-docx-twips.d.ts +12 -0
  244. package/dist/internal/features/work/work-file-contract.d.ts +1 -0
  245. package/dist/internal/features/work/work-file-io.d.ts +1 -1
  246. package/dist/internal/features/work/work-markdown-extensions.d.ts +4 -1
  247. package/dist/internal/features/work/work-ooxml-package-preservation.d.ts +12 -0
  248. package/dist/internal/features/work/work-ooxml-package-security.d.ts +6 -0
  249. package/dist/internal/features/work/work-ooxml-relationship-preservation.d.ts +10 -0
  250. package/dist/internal/features/work/work-ooxml-xml.d.ts +2 -0
  251. package/dist/internal/features/work/work-pdf-export.d.ts +10 -0
  252. package/dist/internal/features/work/work-repository.d.ts +2 -0
  253. package/dist/internal/features/work/work-types.d.ts +15 -2
  254. package/dist/internal/kernel/office-kernel-client-types.d.ts +1 -0
  255. package/dist/internal/kernel/office-kernel-protocol.d.ts +7 -0
  256. package/dist/internal/kernel/office-kernel-version.d.ts +1 -1
  257. package/dist/office-kernel.wasm +0 -0
  258. package/dist/office-kernel.worker.js +93 -41
  259. package/dist/react.d.ts +18 -12
  260. package/dist/react.js +1 -1
  261. package/dist/styles.css +1367 -16
  262. package/dist/vue.d.ts +48 -5
  263. package/dist/vue.js +42 -3
  264. package/dist/web-component.d.ts +24 -2
  265. package/dist/web-component.js +101 -2
  266. package/docs/latest/en/browser-editor-architecture.md +262 -47
  267. package/package.json +29 -4
  268. package/dist/0~152.js +0 -94
  269. package/dist/0~2582.js +0 -485
  270. package/dist/0~4750.js +0 -939
  271. package/dist/0~5861.js +0 -596
  272. package/dist/0~work-document-extensions.js +0 -3045
  273. package/dist/0~work-document-model-codec.js +0 -42
  274. package/dist/0~work-docx-bibliography.js +0 -347
  275. package/dist/0~work-docx-page-color.js +0 -42
  276. package/dist/2881.js +0 -1455
  277. package/dist/8728.js +0 -723
package/dist/9787.js ADDED
@@ -0,0 +1,209 @@
1
+ import * as __rspack_external_yjs from "yjs";
2
+ const WORK_OFFICE_COLLABORATION_PROTOCOL = 'a3s.office.collaboration';
3
+ const WORK_OFFICE_COLLABORATION_VERSION = 1;
4
+ const WORK_OFFICE_COLLABORATION_NAMESPACE = 'a3s.office';
5
+ class WorkOfficeCollaborationError extends Error {
6
+ code;
7
+ constructor(code, message){
8
+ super(message);
9
+ this.name = 'WorkOfficeCollaborationError';
10
+ this.code = code;
11
+ }
12
+ }
13
+ class WorkOfficeCollaborationSessionImpl {
14
+ artifactId;
15
+ kind;
16
+ document;
17
+ awareness;
18
+ actor;
19
+ mode;
20
+ namespace;
21
+ ownsDocument;
22
+ localOrigin;
23
+ #destroyed = false;
24
+ constructor(options){
25
+ this.artifactId = normalizedIdentifier(options.artifactId, 'artifact ID');
26
+ this.kind = normalizedArtifactKind(options.kind);
27
+ this.document = options.document ?? new __rspack_external_yjs.Doc();
28
+ this.awareness = options.awareness;
29
+ this.actor = options.actor ? normalizedActor(options.actor) : void 0;
30
+ this.mode = normalizedMode(options.mode ?? 'edit');
31
+ this.namespace = normalizedNamespace(options.namespace ?? WORK_OFFICE_COLLABORATION_NAMESPACE);
32
+ this.ownsDocument = void 0 === options.document;
33
+ this.localOrigin = this.createOrigin(this.actor?.kind === 'agent' ? 'agent' : this.actor?.kind === 'system' ? 'system' : 'editor');
34
+ assertSessionMetadata(this);
35
+ }
36
+ metadata() {
37
+ this.ensureActive();
38
+ return readWorkOfficeCollaborationMetadata(this);
39
+ }
40
+ rootName(suffix) {
41
+ this.ensureActive();
42
+ const normalized = normalizedRootSuffix(suffix);
43
+ return `${this.namespace}.${normalized}`;
44
+ }
45
+ createOrigin(kind, operationId) {
46
+ this.ensureActive();
47
+ const normalizedKind = normalizedOriginKind(kind);
48
+ return Object.freeze({
49
+ protocol: WORK_OFFICE_COLLABORATION_PROTOCOL,
50
+ kind: normalizedKind,
51
+ actorId: this.actor?.id,
52
+ operationId: void 0 === operationId ? void 0 : normalizedIdentifier(operationId, 'operation ID')
53
+ });
54
+ }
55
+ transact(operation, origin = this.localOrigin) {
56
+ this.ensureActive();
57
+ assertWorkOfficeCollaborationEditable(this);
58
+ assertWorkOfficeCollaborationOrigin(origin);
59
+ let result;
60
+ this.document.transact((transaction)=>{
61
+ result = operation(transaction);
62
+ }, origin);
63
+ return result;
64
+ }
65
+ destroy() {
66
+ if (this.#destroyed) return;
67
+ this.#destroyed = true;
68
+ if (this.ownsDocument) this.document.destroy();
69
+ }
70
+ ensureActive() {
71
+ if (!this.#destroyed) return;
72
+ throw new WorkOfficeCollaborationError('office.collaboration.session_destroyed', 'The Office collaboration session has been destroyed.');
73
+ }
74
+ }
75
+ function createWorkOfficeCollaborationSession(options) {
76
+ return new WorkOfficeCollaborationSessionImpl(options);
77
+ }
78
+ function readWorkOfficeCollaborationMetadata(session) {
79
+ const metadata = session.document.getMap(session.rootName('metadata'));
80
+ if (0 === metadata.size) {
81
+ if (collaborationInitializers(session).length > 0) throw new WorkOfficeCollaborationError('office.collaboration.metadata_missing', 'The shared document contains bootstrap state without Office collaboration metadata.');
82
+ return null;
83
+ }
84
+ const protocol = metadata.get('protocol');
85
+ const version = metadata.get('version');
86
+ const artifactId = metadata.get('artifactId');
87
+ const kind = metadata.get('kind');
88
+ const initialized = metadata.get('initialized');
89
+ if (protocol !== WORK_OFFICE_COLLABORATION_PROTOCOL || version !== WORK_OFFICE_COLLABORATION_VERSION || 'string' != typeof artifactId || !isWorkArtifactKind(kind) || 'boolean' != typeof initialized) throw new WorkOfficeCollaborationError('office.collaboration.metadata_invalid', 'The shared document contains invalid or unsupported Office collaboration metadata.');
90
+ const result = {
91
+ protocol,
92
+ version,
93
+ artifactId,
94
+ kind,
95
+ initialized
96
+ };
97
+ assertMetadataMatches(session, result);
98
+ assertBootstrapState(session, result);
99
+ return result;
100
+ }
101
+ function initializeWorkOfficeCollaborationMetadata(session) {
102
+ const existing = readWorkOfficeCollaborationMetadata(session);
103
+ if (existing) {
104
+ assertMetadataMatches(session, existing);
105
+ return existing;
106
+ }
107
+ const metadata = session.document.getMap(session.rootName('metadata'));
108
+ metadata.set('protocol', WORK_OFFICE_COLLABORATION_PROTOCOL);
109
+ metadata.set('version', WORK_OFFICE_COLLABORATION_VERSION);
110
+ metadata.set('artifactId', session.artifactId);
111
+ metadata.set('kind', session.kind);
112
+ metadata.set('initialized', false);
113
+ return {
114
+ protocol: WORK_OFFICE_COLLABORATION_PROTOCOL,
115
+ version: WORK_OFFICE_COLLABORATION_VERSION,
116
+ artifactId: session.artifactId,
117
+ kind: session.kind,
118
+ initialized: false
119
+ };
120
+ }
121
+ function markWorkOfficeCollaborationInitialized(session) {
122
+ const metadata = readWorkOfficeCollaborationMetadata(session);
123
+ if (!metadata) throw new WorkOfficeCollaborationError('office.collaboration.metadata_missing', 'Office collaboration metadata must be initialized before its content.');
124
+ assertMetadataMatches(session, metadata);
125
+ session.document.getMap(session.rootName('metadata')).set('initialized', true);
126
+ }
127
+ function registerWorkOfficeCollaborationInitializer(session) {
128
+ const initializers = collaborationInitializers(session);
129
+ if (initializers.length > 0) throw new WorkOfficeCollaborationError('office.collaboration.bootstrap_ambiguous', 'The shared document already contains an Office collaboration initializer.');
130
+ initializers.push([
131
+ `${session.document.clientID}:${session.actor?.id ?? 'anonymous'}`
132
+ ]);
133
+ }
134
+ function assertWorkOfficeCollaborationEditable(session) {
135
+ if ('edit' === session.mode) return;
136
+ throw new WorkOfficeCollaborationError('office.collaboration.permission_denied', `The '${session.mode}' collaboration mode cannot modify canonical content.`);
137
+ }
138
+ function assertSessionMetadata(session) {
139
+ readWorkOfficeCollaborationMetadata(session);
140
+ }
141
+ function assertBootstrapState(session, metadata) {
142
+ const count = collaborationInitializers(session).length;
143
+ if (count > 1) throw new WorkOfficeCollaborationError('office.collaboration.bootstrap_ambiguous', 'Multiple clients initialized the shared document before synchronization completed.');
144
+ if (metadata.initialized && 1 !== count) throw new WorkOfficeCollaborationError('office.collaboration.bootstrap_invalid', 'Initialized Office collaboration metadata must have exactly one initializer.');
145
+ }
146
+ function collaborationInitializers(session) {
147
+ return session.document.getArray(session.rootName('bootstrap.initializers'));
148
+ }
149
+ function assertMetadataMatches(session, metadata) {
150
+ if (metadata.artifactId !== session.artifactId) throw new WorkOfficeCollaborationError('office.collaboration.artifact_mismatch', `The shared document belongs to artifact '${metadata.artifactId}', not '${session.artifactId}'.`);
151
+ if (metadata.kind !== session.kind) throw new WorkOfficeCollaborationError('office.collaboration.kind_mismatch', `The shared document contains '${metadata.kind}' content, not '${session.kind}'.`);
152
+ }
153
+ function normalizedIdentifier(value, label) {
154
+ if ('string' != typeof value) throw new WorkOfficeCollaborationError('office.collaboration.identifier_invalid', `The ${label} must be a string containing between 1 and 256 characters.`);
155
+ const normalized = value.trim();
156
+ if (!normalized || normalized.length > 256) throw new WorkOfficeCollaborationError('office.collaboration.identifier_invalid', `The ${label} must contain between 1 and 256 characters.`);
157
+ return normalized;
158
+ }
159
+ function assertWorkOfficeCollaborationOrigin(origin) {
160
+ if (!origin || origin.protocol !== WORK_OFFICE_COLLABORATION_PROTOCOL) throw new WorkOfficeCollaborationError('office.collaboration.origin_invalid', 'Office collaboration transactions require a versioned collaboration origin.');
161
+ normalizedOriginKind(origin.kind);
162
+ if (void 0 !== origin.actorId) normalizedIdentifier(origin.actorId, 'origin actor ID');
163
+ if (void 0 !== origin.operationId) normalizedIdentifier(origin.operationId, 'operation ID');
164
+ }
165
+ function normalizedActor(actor) {
166
+ const kind = actor.kind ?? 'human';
167
+ if ('human' !== kind && 'agent' !== kind && 'system' !== kind) throw new WorkOfficeCollaborationError('office.collaboration.actor_invalid', `The collaboration actor kind '${String(kind)}' is invalid.`);
168
+ return Object.freeze({
169
+ id: normalizedIdentifier(actor.id, 'actor ID'),
170
+ name: normalizedIdentifier(actor.name, 'actor name'),
171
+ color: normalizedOptionalActorField(actor.color, 'color', 64),
172
+ avatarUrl: normalizedOptionalActorField(actor.avatarUrl, 'avatar URL', 2048),
173
+ kind
174
+ });
175
+ }
176
+ function normalizedOptionalActorField(value, label, maximumLength) {
177
+ if (void 0 === value) return;
178
+ if ('string' != typeof value) throw new WorkOfficeCollaborationError('office.collaboration.actor_invalid', `The collaboration actor ${label} must be a string when provided.`);
179
+ const normalized = value.trim();
180
+ if (!normalized || normalized.length > maximumLength) throw new WorkOfficeCollaborationError('office.collaboration.actor_invalid', `The collaboration actor ${label} must contain between 1 and ${maximumLength} characters.`);
181
+ return normalized;
182
+ }
183
+ function normalizedArtifactKind(value) {
184
+ if (isWorkArtifactKind(value)) return value;
185
+ throw new WorkOfficeCollaborationError('office.collaboration.kind_invalid', `The collaboration artifact kind '${String(value)}' is invalid.`);
186
+ }
187
+ function normalizedMode(value) {
188
+ if ('view' === value || 'comment' === value || 'suggest' === value || 'edit' === value) return value;
189
+ throw new WorkOfficeCollaborationError('office.collaboration.mode_invalid', `The collaboration mode '${String(value)}' is invalid.`);
190
+ }
191
+ function normalizedOriginKind(value) {
192
+ if ('bootstrap' === value || 'editor' === value || 'agent' === value || 'import' === value || 'system' === value) return value;
193
+ throw new WorkOfficeCollaborationError('office.collaboration.origin_invalid', `The collaboration origin kind '${String(value)}' is invalid.`);
194
+ }
195
+ function normalizedNamespace(value) {
196
+ const normalized = normalizedIdentifier(value, 'namespace');
197
+ if (!/^[a-zA-Z0-9](?:[a-zA-Z0-9._-]*[a-zA-Z0-9])?$/.test(normalized)) throw new WorkOfficeCollaborationError('office.collaboration.namespace_invalid', 'The collaboration namespace may contain only letters, digits, dots, underscores, and hyphens.');
198
+ return normalized;
199
+ }
200
+ function normalizedRootSuffix(value) {
201
+ if ('string' != typeof value) throw new WorkOfficeCollaborationError('office.collaboration.root_invalid', 'The collaboration root suffix must be a string.');
202
+ const normalized = value.trim();
203
+ if (!/^[a-z][a-z0-9.-]*$/.test(normalized)) throw new WorkOfficeCollaborationError('office.collaboration.root_invalid', `The collaboration root suffix '${value}' is invalid.`);
204
+ return normalized;
205
+ }
206
+ function isWorkArtifactKind(value) {
207
+ return 'document' === value || 'markdown' === value || 'spreadsheet' === value || 'presentation' === value || 'pdf' === value;
208
+ }
209
+ export { WORK_OFFICE_COLLABORATION_NAMESPACE as OFFICE_COLLABORATION_NAMESPACE, WORK_OFFICE_COLLABORATION_PROTOCOL as OFFICE_COLLABORATION_PROTOCOL, WorkOfficeCollaborationError as OfficeCollaborationError, assertWorkOfficeCollaborationEditable, assertWorkOfficeCollaborationOrigin, createWorkOfficeCollaborationSession as createOfficeCollaborationSession, initializeWorkOfficeCollaborationMetadata, markWorkOfficeCollaborationInitialized, readWorkOfficeCollaborationMetadata as readOfficeCollaborationMetadata, registerWorkOfficeCollaborationInitializer };
package/dist/core.d.ts CHANGED
@@ -1,15 +1,35 @@
1
- export { createWorkArtifact as createArtifact, createWorkId as createOfficeId, WORK_TEMPLATES as officeTemplates, } from './internal/features/work/work-templates';
2
- export { createWorkArtifactBlob as createArtifactBlob, exportWorkArtifact as downloadArtifact, importWorkFile as importOfficeFile, WORK_IMPORT_ACCEPT as OFFICE_FILE_ACCEPT, workKindForFile as officeKindForFile, } from './internal/features/work/work-file-io';
3
- export type { WorkArtifactExportOptions as ArtifactExportOptions } from './internal/features/work/work-file-io';
4
- export { defaultPptxRuntimeUrl } from './internal/features/work/work-presentation-file-io';
5
- export { forgetWorkSourceBlob as forgetSourceBlob, readWorkSourceBlob as readSourceBlob, rememberWorkSourceBlob as registerSourceBlob, } from './internal/features/work/work-repository';
6
- export { exportWorkArtifactPdf as downloadArtifactPdf, type WorkPdfExportOptions as PdfExportOptions, workPdfPagesForExport as pdfPagesForExport, } from './internal/features/work/work-pdf-export';
7
- export { OFFICE_NOTIFICATION_EVENT, type OfficeNotification, type OfficeNotificationTone, subscribeOfficeNotifications, } from './internal/state/app-state';
8
- export { createWorkAgentProposalRequest as createAgentProposalRequest, WORK_AGENT_PROPOSAL_PROTOCOL as AGENT_PROPOSAL_PROTOCOL, workAgentProposalInstruction as createAgentProposalInstruction, workAgentProposalStatus as getAgentProposalStatus, } from './internal/features/work/work-agent-proposal';
1
+ export type { WorkOfficeCollaborationActor as OfficeCollaborationActor, WorkOfficeCollaborationActorKind as OfficeCollaborationActorKind, WorkOfficeCollaborationAwareness as OfficeCollaborationAwareness, WorkOfficeCollaborationErrorCode as OfficeCollaborationErrorCode, WorkOfficeCollaborationMetadata as OfficeCollaborationMetadata, WorkOfficeCollaborationMode as OfficeCollaborationMode, WorkOfficeCollaborationOrigin as OfficeCollaborationOrigin, WorkOfficeCollaborationOriginKind as OfficeCollaborationOriginKind, WorkOfficeCollaborationSession as OfficeCollaborationSession, WorkOfficeCollaborationSessionOptions as OfficeCollaborationSessionOptions, } from './internal/collaboration/office-collaboration';
2
+ export { createWorkOfficeCollaborationSession as createOfficeCollaborationSession, readWorkOfficeCollaborationMetadata as readOfficeCollaborationMetadata, WORK_OFFICE_COLLABORATION_NAMESPACE as OFFICE_COLLABORATION_NAMESPACE, WORK_OFFICE_COLLABORATION_PROTOCOL as OFFICE_COLLABORATION_PROTOCOL, WORK_OFFICE_COLLABORATION_VERSION as OFFICE_COLLABORATION_VERSION, WorkOfficeCollaborationError as OfficeCollaborationError, } from './internal/collaboration/office-collaboration';
3
+ export type { WorkOfficeCollaborationParticipant as OfficeCollaborationParticipant, WorkOfficeCollaborationPresence as OfficeCollaborationPresence, WorkOfficeCollaborationPresenceActivity as OfficeCollaborationPresenceActivity, WorkOfficeCollaborationPresenceActor as OfficeCollaborationPresenceActor, WorkOfficeCollaborationPresenceLocation as OfficeCollaborationPresenceLocation, WorkOfficeCollaborationPresenceSnapshot as OfficeCollaborationPresenceSnapshot, WorkOfficeCollaborationPresenceState as OfficeCollaborationPresenceState, WorkOfficeCollaborationPresenceUpdate as OfficeCollaborationPresenceUpdate, WorkOfficeDocumentPresenceLocation as OfficeDocumentPresenceLocation, WorkOfficeMarkdownPresenceLocation as OfficeMarkdownPresenceLocation, WorkOfficePdfPresenceLocation as OfficePdfPresenceLocation, WorkOfficePresentationPresenceLocation as OfficePresentationPresenceLocation, WorkOfficeSpreadsheetPresenceCell as OfficeSpreadsheetPresenceCell, WorkOfficeSpreadsheetPresenceLocation as OfficeSpreadsheetPresenceLocation, WorkOfficeSpreadsheetPresenceRange as OfficeSpreadsheetPresenceRange, WorkOfficeTextPresenceLocation as OfficeTextPresenceLocation, } from './internal/collaboration/office-collaboration-presence';
4
+ export { createWorkOfficeCollaborationPresence as createOfficeCollaborationPresence, WORK_OFFICE_COLLABORATION_PRESENCE_FIELD as OFFICE_COLLABORATION_PRESENCE_FIELD, } from './internal/collaboration/office-collaboration-presence';
5
+ export type { WorkOfficeCollaborationTransport as OfficeCollaborationTransport, WorkOfficeCollaborationTransportBinding as OfficeCollaborationTransportBinding, WorkOfficeCollaborationTransportBindingOptions as OfficeCollaborationTransportBindingOptions, WorkOfficeCollaborationTransportMessage as OfficeCollaborationTransportMessage, WorkOfficeCollaborationTransportMessageType as OfficeCollaborationTransportMessageType, } from './internal/collaboration/office-collaboration-transport';
6
+ export { createWorkOfficeCollaborationTransportBinding as createOfficeCollaborationTransportBinding, WORK_OFFICE_COLLABORATION_DEFAULT_MAX_TRANSPORT_PAYLOAD_BYTES as OFFICE_COLLABORATION_DEFAULT_MAX_TRANSPORT_PAYLOAD_BYTES, WORK_OFFICE_COLLABORATION_MAX_TRANSPORT_PAYLOAD_BYTES as OFFICE_COLLABORATION_MAX_TRANSPORT_PAYLOAD_BYTES, } from './internal/collaboration/office-collaboration-transport';
7
+ export type { WorkOfficeDocumentCollaborationBinding as OfficeDocumentCollaborationBinding, WorkOfficeDocumentCollaborationBindingOptions as OfficeDocumentCollaborationBindingOptions, WorkOfficeDocumentCollaborationChange as OfficeDocumentCollaborationChange, } from './internal/collaboration/office-document-collaboration';
8
+ export { createWorkOfficeDocumentCollaborationBinding as createOfficeDocumentCollaborationBinding, initializeWorkOfficeDocumentCollaboration as initializeOfficeDocumentCollaboration, readWorkOfficeDocumentCollaboration as readOfficeDocumentCollaboration, workOfficeDocumentCollaborationFragment as officeDocumentCollaborationFragment, } from './internal/collaboration/office-document-collaboration';
9
+ export type { WorkOfficeMarkdownCollaborationBinding as OfficeMarkdownCollaborationBinding, WorkOfficeMarkdownCollaborationBindingOptions as OfficeMarkdownCollaborationBindingOptions, WorkOfficeMarkdownCollaborationChange as OfficeMarkdownCollaborationChange, } from './internal/collaboration/office-markdown-collaboration';
10
+ export { createWorkOfficeMarkdownCollaborationBinding as createOfficeMarkdownCollaborationBinding, initializeWorkOfficeMarkdownCollaboration as initializeOfficeMarkdownCollaboration, readWorkOfficeMarkdownCollaboration as readOfficeMarkdownCollaboration, replaceWorkOfficeMarkdownCollaboration as replaceOfficeMarkdownCollaboration, } from './internal/collaboration/office-markdown-collaboration';
11
+ export type { WorkOfficePdfCollaborationBinding as OfficePdfCollaborationBinding, WorkOfficePdfCollaborationBindingOptions as OfficePdfCollaborationBindingOptions, WorkOfficePdfCollaborationChange as OfficePdfCollaborationChange, WorkPdfCollaborationAnnotation as PdfCollaborationAnnotation, WorkPdfCollaborationContent as PdfCollaborationContent, WorkPdfCollaborationDeletePagesOperation as PdfCollaborationDeletePagesOperation, WorkPdfCollaborationFormValue as PdfCollaborationFormValue, WorkPdfCollaborationPageOperation as PdfCollaborationPageOperation, WorkPdfCollaborationRect as PdfCollaborationRect, WorkPdfCollaborationRedactionProposal as PdfCollaborationRedactionProposal, WorkPdfCollaborationReorderPagesOperation as PdfCollaborationReorderPagesOperation, WorkPdfCollaborationReviewDecision as PdfCollaborationReviewDecision, WorkPdfCollaborationRotatePagesOperation as PdfCollaborationRotatePagesOperation, WorkPdfCollaborationSignatureAppearance as PdfCollaborationSignatureAppearance, WorkPdfCollaborationSignaturePlacement as PdfCollaborationSignaturePlacement, WorkPdfCollaborationSource as PdfCollaborationSource, } from './internal/collaboration/office-pdf-collaboration';
12
+ export { assertWorkOfficePdfCollaborationSource as assertPdfCollaborationSource, createWorkOfficePdfCollaborationBinding as createOfficePdfCollaborationBinding, initializeWorkOfficePdfCollaboration as initializeOfficePdfCollaboration, readWorkOfficePdfCollaboration as readOfficePdfCollaboration, readWorkOfficePdfCollaborationSource as readOfficePdfCollaborationSource, replaceWorkOfficePdfCollaboration as replaceOfficePdfCollaboration, } from './internal/collaboration/office-pdf-collaboration';
13
+ export { createWorkPdfCollaborationContent as createPdfCollaborationContent } from './internal/collaboration/office-pdf-collaboration-types';
14
+ export type { WorkOfficePresentationCollaborationBinding as OfficePresentationCollaborationBinding, WorkOfficePresentationCollaborationBindingOptions as OfficePresentationCollaborationBindingOptions, WorkOfficePresentationCollaborationChange as OfficePresentationCollaborationChange, } from './internal/collaboration/office-presentation-collaboration';
15
+ export { createWorkOfficePresentationCollaborationBinding as createOfficePresentationCollaborationBinding, initializeWorkOfficePresentationCollaboration as initializeOfficePresentationCollaboration, readWorkOfficePresentationCollaboration as readOfficePresentationCollaboration, replaceWorkOfficePresentationCollaboration as replaceOfficePresentationCollaboration, } from './internal/collaboration/office-presentation-collaboration';
16
+ export type { WorkOfficeSpreadsheetCollaborationBinding as OfficeSpreadsheetCollaborationBinding, WorkOfficeSpreadsheetCollaborationBindingOptions as OfficeSpreadsheetCollaborationBindingOptions, WorkOfficeSpreadsheetCollaborationChange as OfficeSpreadsheetCollaborationChange, } from './internal/collaboration/office-spreadsheet-collaboration';
17
+ export { createWorkOfficeSpreadsheetCollaborationBinding as createOfficeSpreadsheetCollaborationBinding, initializeWorkOfficeSpreadsheetCollaboration as initializeOfficeSpreadsheetCollaboration, readWorkOfficeSpreadsheetCollaboration as readOfficeSpreadsheetCollaboration, replaceWorkOfficeSpreadsheetCollaboration as replaceOfficeSpreadsheetCollaboration, } from './internal/collaboration/office-spreadsheet-collaboration';
9
18
  export type { WorkAgentProposal as AgentProposal, WorkAgentProposalApplyResult as AgentProposalApplyResult, WorkAgentProposalChange as AgentProposalChange, WorkAgentProposalConflict as AgentProposalConflict, WorkAgentProposalMessage as AgentProposalMessage, WorkAgentProposalRequest as AgentProposalRequest, WorkAgentProposalStatus as AgentProposalStatus, WorkAgentProposalTarget as AgentProposalTarget, } from './internal/features/work/work-agent-proposal';
19
+ export { createWorkAgentProposalRequest as createAgentProposalRequest, WORK_AGENT_PROPOSAL_PROTOCOL as AGENT_PROPOSAL_PROTOCOL, workAgentProposalInstruction as createAgentProposalInstruction, workAgentProposalStatus as getAgentProposalStatus, } from './internal/features/work/work-agent-proposal';
10
20
  export type { WorkEditorAgentRequest as EditorAgentRequest } from './internal/features/work/work-agent-request';
21
+ export type { WorkDocumentReviewConflict as DocumentReviewConflict, WorkDocumentReviewConflictEvent as DocumentReviewConflictEvent, WorkDocumentReviewConflictReason as DocumentReviewConflictReason, WorkDocumentReviewKind as DocumentReviewKind, } from './internal/features/work/work-document-review-conflicts';
11
22
  export type { WorkDocumentSelectionCommandFailure as DocumentSelectionCommandFailure, WorkDocumentSelectionCommandResult as DocumentSelectionCommandResult, WorkDocumentSelectionCommands as DocumentSelectionCommands, WorkDocumentSelectionContext as DocumentSelectionContext, WorkDocumentSelectionMenuIcon as DocumentSelectionMenuIcon, WorkDocumentSelectionMenuItem as DocumentSelectionMenuItem, WorkDocumentSelectionSnapshot as DocumentSelectionSnapshot, WorkGetDocumentSelectionMenuItems as GetDocumentSelectionMenuItems, } from './internal/features/work/work-document-selection-menu';
23
+ export type { WorkArtifactExportOptions as ArtifactExportOptions } from './internal/features/work/work-file-io';
24
+ export { createWorkArtifactBlob as createArtifactBlob, exportWorkArtifact as downloadArtifact, importWorkFile as importOfficeFile, WORK_IMPORT_ACCEPT as OFFICE_FILE_ACCEPT, workKindForFile as officeKindForFile, } from './internal/features/work/work-file-io';
25
+ export { decodeWorkDocumentSnapshot as decodeDocumentSnapshot, encodeWorkDocumentSnapshot as encodeDocumentSnapshot, WORK_DOCUMENT_SNAPSHOT_MEDIA_TYPE as DOCUMENT_SNAPSHOT_MEDIA_TYPE, WORK_DOCUMENT_SNAPSHOT_SCHEMA as DOCUMENT_SNAPSHOT_SCHEMA, WORK_DOCUMENT_SNAPSHOT_VERSION as DOCUMENT_SNAPSHOT_VERSION, type WorkDocumentSnapshot as DocumentSnapshot, } from './internal/features/work/work-document-snapshot';
26
+ export { applyWorkDocumentSource as applyDocumentSource, projectWorkDocumentSource as projectDocumentSource, WORK_DOCUMENT_SOURCE_MEDIA_TYPE as DOCUMENT_SOURCE_MEDIA_TYPE, WORK_DOCUMENT_SOURCE_SCHEMA as DOCUMENT_SOURCE_SCHEMA, WORK_DOCUMENT_SOURCE_VERSION as DOCUMENT_SOURCE_VERSION, type WorkDocumentSource as DocumentSource, } from './internal/features/work/work-document-source';
12
27
  export type { WorkGetMarkdownSelectionMenuItems as GetMarkdownSelectionMenuItems, WorkMarkdownSelectionCommandFailure as MarkdownSelectionCommandFailure, WorkMarkdownSelectionCommandResult as MarkdownSelectionCommandResult, WorkMarkdownSelectionCommands as MarkdownSelectionCommands, WorkMarkdownSelectionContext as MarkdownSelectionContext, WorkMarkdownSelectionMenuIcon as MarkdownSelectionMenuIcon, WorkMarkdownSelectionMenuItem as MarkdownSelectionMenuItem, WorkMarkdownSelectionSnapshot as MarkdownSelectionSnapshot, } from './internal/features/work/work-markdown-selection-menu';
13
- export { workArtifactExtension as artifactExtension, workArtifactKindLabel as artifactKindLabel, } from './internal/features/work/work-types';
28
+ export { exportWorkArtifactPdf as downloadArtifactPdf, type WorkPdfExportOptions as PdfExportOptions, workPdfPagesForExport as pdfPagesForExport, } from './internal/features/work/work-pdf-export';
29
+ export { defaultPptxRuntimeUrl } from './internal/features/work/work-presentation-file-io';
30
+ export { forgetWorkSourceBlob as forgetSourceBlob, readWorkSourceBlob as readSourceBlob, rememberWorkSourceBlob as registerSourceBlob, } from './internal/features/work/work-repository';
31
+ export { createWorkArtifact as createArtifact, createWorkId as createOfficeId, WORK_TEMPLATES as officeTemplates, } from './internal/features/work/work-templates';
14
32
  export type { WorkArtifact as OfficeArtifact, WorkArtifactContent as OfficeArtifactContent, WorkArtifactKind as OfficeArtifactKind, WorkCompatibilityIssue as CompatibilityIssue, WorkCompatibilityReport as CompatibilityReport, WorkDocumentContent as DocumentContent, WorkMarkdownContent as MarkdownContent, WorkPdfContent as PdfContent, WorkPresentationContent as PresentationContent, WorkSourceFile as SourceFile, WorkSpreadsheetContent as SpreadsheetContent, WorkTemplate as OfficeTemplate, } from './internal/features/work/work-types';
15
33
  export * from './internal/features/work/work-types';
34
+ export { workArtifactExtension as artifactExtension, workArtifactKindLabel as artifactKindLabel, } from './internal/features/work/work-types';
35
+ export { OFFICE_NOTIFICATION_EVENT, type OfficeNotification, type OfficeNotificationTone, subscribeOfficeNotifications, } from './internal/state/app-state';
package/dist/core.js CHANGED
@@ -1,4 +1,12 @@
1
+ var core_OFFICE_COLLABORATION_VERSION = 1;
1
2
  export { AGENT_PROPOSAL_PROTOCOL, OFFICE_NOTIFICATION_EVENT, createAgentProposalInstruction, createAgentProposalRequest, getAgentProposalStatus, subscribeOfficeNotifications } from "./6489.js";
2
- export { OFFICE_FILE_ACCEPT, artifactExtension, artifactExtension as workArtifactExtension, artifactKindLabel, artifactKindLabel as workArtifactKindLabel, createArtifactBlob, defaultPptxRuntimeUrl, downloadArtifact, downloadArtifactPdf, forgetSourceBlob, importOfficeFile, officeKindForFile, pdfPagesForExport, readSourceBlob, registerSourceBlob } from "./4104.js";
3
- export { createArtifact, createOfficeId, officeTemplates } from "./1134.js";
3
+ export { DOCUMENT_SNAPSHOT_MEDIA_TYPE, DOCUMENT_SNAPSHOT_SCHEMA, DOCUMENT_SNAPSHOT_VERSION, DOCUMENT_SOURCE_MEDIA_TYPE, DOCUMENT_SOURCE_SCHEMA, DOCUMENT_SOURCE_VERSION, OFFICE_COLLABORATION_DEFAULT_MAX_TRANSPORT_PAYLOAD_BYTES, OFFICE_COLLABORATION_MAX_TRANSPORT_PAYLOAD_BYTES, OFFICE_COLLABORATION_PRESENCE_FIELD, OFFICE_FILE_ACCEPT, applyDocumentSource, artifactExtension, artifactExtension as workArtifactExtension, artifactKindLabel, artifactKindLabel as workArtifactKindLabel, createArtifactBlob, createOfficeCollaborationPresence, createOfficeCollaborationTransportBinding, createPdfCollaborationContent, decodeDocumentSnapshot, defaultPptxRuntimeUrl, downloadArtifact, downloadArtifactPdf, encodeDocumentSnapshot, forgetSourceBlob, importOfficeFile, officeKindForFile, pdfPagesForExport, projectDocumentSource, readSourceBlob, registerSourceBlob } from "./4104.js";
4
+ export { OFFICE_COLLABORATION_NAMESPACE, OFFICE_COLLABORATION_PROTOCOL, OfficeCollaborationError, createOfficeCollaborationSession, readOfficeCollaborationMetadata } from "./9787.js";
5
+ export { assertPdfCollaborationSource, createOfficePdfCollaborationBinding, initializeOfficePdfCollaboration, readOfficePdfCollaboration, readOfficePdfCollaborationSource, replaceOfficePdfCollaboration } from "./3818.js";
6
+ export { createArtifact, createOfficeId, officeTemplates } from "./5184.js";
7
+ export { createOfficeDocumentCollaborationBinding, initializeOfficeDocumentCollaboration, officeDocumentCollaborationFragment, readOfficeDocumentCollaboration } from "./8928.js";
8
+ export { createOfficeMarkdownCollaborationBinding, initializeOfficeMarkdownCollaboration, readOfficeMarkdownCollaboration, replaceOfficeMarkdownCollaboration } from "./2591.js";
9
+ export { createOfficePresentationCollaborationBinding, initializeOfficePresentationCollaboration, readOfficePresentationCollaboration, replaceOfficePresentationCollaboration } from "./4560.js";
10
+ export { createOfficeSpreadsheetCollaborationBinding, initializeOfficeSpreadsheetCollaboration, readOfficeSpreadsheetCollaboration, replaceOfficeSpreadsheetCollaboration } from "./4476.js";
4
11
  export { normalizeWorkSpreadsheetBubbleScale, normalizeWorkSpreadsheetBubbleSizeRepresents, normalizeWorkSpreadsheetChartAxisGroup, normalizeWorkSpreadsheetCombinationSeriesType, normalizeWorkSpreadsheetDataLabelPosition, normalizeWorkSpreadsheetDataLabels, normalizeWorkSpreadsheetDoughnutHoleSize, normalizeWorkSpreadsheetErrorBars, normalizeWorkSpreadsheetRadarStyle, normalizeWorkSpreadsheetScatterStyle, normalizeWorkSpreadsheetTrendline, normalizeWorkSpreadsheetTrendlineType, workSpreadsheetChartSupportsAxes, workSpreadsheetChartSupportsErrorBars, workSpreadsheetChartSupportsTrendlines, workSpreadsheetChartTypeLabel, workSpreadsheetChartUsesNumericXAxis, workSpreadsheetCombinationSeriesTypeLabel, workSpreadsheetDataLabelPositionLabel, workSpreadsheetErrorBarTypeLabel, workSpreadsheetErrorBarValueTypeLabel, workSpreadsheetTrendlineTypeLabel } from "./8715.js";
12
+ export { core_OFFICE_COLLABORATION_VERSION as OFFICE_COLLABORATION_VERSION };
package/dist/index.js CHANGED
@@ -1,5 +1,15 @@
1
+ var src_DOCUMENT_SNAPSHOT_VERSION = 1;
2
+ var src_DOCUMENT_SOURCE_VERSION = 1;
3
+ var src_OFFICE_COLLABORATION_VERSION = 1;
1
4
  export { AGENT_PROPOSAL_PROTOCOL, OFFICE_NOTIFICATION_EVENT, createAgentProposalInstruction, createAgentProposalRequest, getAgentProposalStatus, subscribeOfficeNotifications } from "./6489.js";
2
- export { DocumentEditor, MarkdownEditor, PdfViewer, PresentationEditor, SpreadsheetEditor, defaultDocumentArabicLayoutFontUrl, defaultDocumentHebrewLayoutFontUrl, defaultDocumentLatinLayoutFontUrl, defaultDocumentLayoutFontUrl, defaultDocumentLayoutFonts, defaultOfficeKernelWasmUrl, defaultPdfiumWasmUrl, preloadOfficeEditor } from "./432.js";
3
- export { OFFICE_FILE_ACCEPT, artifactExtension, artifactExtension as workArtifactExtension, artifactKindLabel, artifactKindLabel as workArtifactKindLabel, createArtifactBlob, defaultPptxRuntimeUrl, downloadArtifact, downloadArtifactPdf, forgetSourceBlob, importOfficeFile, officeKindForFile, pdfPagesForExport, readSourceBlob, registerSourceBlob } from "./4104.js";
4
- export { createArtifact, createOfficeId, officeTemplates } from "./1134.js";
5
+ export { DOCUMENT_SNAPSHOT_MEDIA_TYPE, DOCUMENT_SNAPSHOT_SCHEMA, DOCUMENT_SOURCE_MEDIA_TYPE, DOCUMENT_SOURCE_SCHEMA, OFFICE_COLLABORATION_DEFAULT_MAX_TRANSPORT_PAYLOAD_BYTES, OFFICE_COLLABORATION_MAX_TRANSPORT_PAYLOAD_BYTES, OFFICE_COLLABORATION_PRESENCE_FIELD, OFFICE_FILE_ACCEPT, applyDocumentSource, artifactExtension, artifactExtension as workArtifactExtension, artifactKindLabel, artifactKindLabel as workArtifactKindLabel, createArtifactBlob, createOfficeCollaborationPresence, createOfficeCollaborationTransportBinding, createPdfCollaborationContent, decodeDocumentSnapshot, defaultPptxRuntimeUrl, downloadArtifact, downloadArtifactPdf, encodeDocumentSnapshot, forgetSourceBlob, importOfficeFile, officeKindForFile, pdfPagesForExport, projectDocumentSource, readSourceBlob, registerSourceBlob } from "./4104.js";
6
+ export { DocumentEditor, MarkdownEditor, PDF_EVIDENCE_COORDINATE_BASIS, PdfViewer, PresentationEditor, SpreadsheetEditor, defaultDocumentArabicLayoutFontUrl, defaultDocumentHebrewLayoutFontUrl, defaultDocumentLatinLayoutFontUrl, defaultDocumentLayoutFontUrl, defaultDocumentLayoutFonts, defaultOfficeKernelWasmUrl, defaultPdfiumWasmUrl, preloadOfficeEditor } from "./432.js";
7
+ export { OFFICE_COLLABORATION_NAMESPACE, OFFICE_COLLABORATION_PROTOCOL, OfficeCollaborationError, createOfficeCollaborationSession, readOfficeCollaborationMetadata } from "./9787.js";
8
+ export { assertPdfCollaborationSource, createOfficePdfCollaborationBinding, initializeOfficePdfCollaboration, readOfficePdfCollaboration, readOfficePdfCollaborationSource, replaceOfficePdfCollaboration } from "./3818.js";
9
+ export { createArtifact, createOfficeId, officeTemplates } from "./5184.js";
10
+ export { createOfficeDocumentCollaborationBinding, initializeOfficeDocumentCollaboration, officeDocumentCollaborationFragment, readOfficeDocumentCollaboration } from "./8928.js";
11
+ export { createOfficeMarkdownCollaborationBinding, initializeOfficeMarkdownCollaboration, readOfficeMarkdownCollaboration, replaceOfficeMarkdownCollaboration } from "./2591.js";
12
+ export { createOfficePresentationCollaborationBinding, initializeOfficePresentationCollaboration, readOfficePresentationCollaboration, replaceOfficePresentationCollaboration } from "./4560.js";
13
+ export { createOfficeSpreadsheetCollaborationBinding, initializeOfficeSpreadsheetCollaboration, readOfficeSpreadsheetCollaboration, replaceOfficeSpreadsheetCollaboration } from "./4476.js";
5
14
  export { normalizeWorkSpreadsheetBubbleScale, normalizeWorkSpreadsheetBubbleSizeRepresents, normalizeWorkSpreadsheetChartAxisGroup, normalizeWorkSpreadsheetCombinationSeriesType, normalizeWorkSpreadsheetDataLabelPosition, normalizeWorkSpreadsheetDataLabels, normalizeWorkSpreadsheetDoughnutHoleSize, normalizeWorkSpreadsheetErrorBars, normalizeWorkSpreadsheetRadarStyle, normalizeWorkSpreadsheetScatterStyle, normalizeWorkSpreadsheetTrendline, normalizeWorkSpreadsheetTrendlineType, workSpreadsheetChartSupportsAxes, workSpreadsheetChartSupportsErrorBars, workSpreadsheetChartSupportsTrendlines, workSpreadsheetChartTypeLabel, workSpreadsheetChartUsesNumericXAxis, workSpreadsheetCombinationSeriesTypeLabel, workSpreadsheetDataLabelPositionLabel, workSpreadsheetErrorBarTypeLabel, workSpreadsheetErrorBarValueTypeLabel, workSpreadsheetTrendlineTypeLabel } from "./8715.js";
15
+ export { src_DOCUMENT_SNAPSHOT_VERSION as DOCUMENT_SNAPSHOT_VERSION, src_DOCUMENT_SOURCE_VERSION as DOCUMENT_SOURCE_VERSION, src_OFFICE_COLLABORATION_VERSION as OFFICE_COLLABORATION_VERSION };
@@ -0,0 +1,13 @@
1
+ export interface WorkOfficeCollaborationFlatJsonMap {
2
+ delete(key: string): unknown;
3
+ entries(): IterableIterator<[string, unknown]>;
4
+ get(key: string): unknown;
5
+ set(key: string, value: unknown): unknown;
6
+ }
7
+ export type InvalidWorkOfficeCollaborationSharedValue = (label: string) => never;
8
+ /**
9
+ * Recursively stores object leaves in a stable Y.Map. Arrays stay atomic
10
+ * because their positional semantics belong to each format-specific model.
11
+ */
12
+ export declare function patchWorkOfficeCollaborationFlatJsonMap(target: WorkOfficeCollaborationFlatJsonMap, previous: Record<string, unknown> | undefined, next: Record<string, unknown> | undefined, label: string): void;
13
+ export declare function readWorkOfficeCollaborationFlatJsonMap(target: WorkOfficeCollaborationFlatJsonMap, label: string, invalidShared: InvalidWorkOfficeCollaborationSharedValue): Record<string, unknown>;
@@ -0,0 +1,4 @@
1
+ export declare function cloneWorkOfficeCollaborationJson(value: unknown, seen?: WeakSet<object>): unknown;
2
+ export declare function workOfficeCollaborationJsonEqual(left: unknown, right: unknown): boolean;
3
+ export declare function canonicalWorkOfficeCollaborationJson(value: unknown): string;
4
+ export declare function isWorkOfficeCollaborationRecord(value: unknown): value is Record<string, unknown>;
@@ -0,0 +1,86 @@
1
+ import { WORK_OFFICE_COLLABORATION_PROTOCOL, WORK_OFFICE_COLLABORATION_VERSION, type WorkOfficeCollaborationActorKind, type WorkOfficeCollaborationMode, type WorkOfficeCollaborationSession } from './office-collaboration';
2
+ export declare const WORK_OFFICE_COLLABORATION_PRESENCE_FIELD: "a3sOffice";
3
+ export type WorkOfficeCollaborationPresenceActivity = 'active' | 'idle' | 'away';
4
+ export interface WorkOfficeDocumentPresenceLocation {
5
+ readonly kind: 'document';
6
+ /** Zero-based ProseMirror model position. */
7
+ readonly anchor: number;
8
+ readonly head: number;
9
+ }
10
+ export interface WorkOfficeMarkdownPresenceLocation {
11
+ readonly kind: 'markdown';
12
+ /** Positions are UTF-16 offsets in source mode and ProseMirror positions in visual mode. */
13
+ readonly anchor: number;
14
+ readonly head: number;
15
+ /** Missing values from older protocol peers are interpreted as `source`. */
16
+ readonly surface?: 'source' | 'visual';
17
+ }
18
+ export type WorkOfficeTextPresenceLocation = WorkOfficeDocumentPresenceLocation | WorkOfficeMarkdownPresenceLocation;
19
+ export interface WorkOfficeSpreadsheetPresenceCell {
20
+ readonly row: number;
21
+ readonly column: number;
22
+ }
23
+ export interface WorkOfficeSpreadsheetPresenceRange {
24
+ readonly startRow: number;
25
+ readonly startColumn: number;
26
+ readonly endRow: number;
27
+ readonly endColumn: number;
28
+ }
29
+ export interface WorkOfficeSpreadsheetPresenceLocation {
30
+ readonly kind: 'spreadsheet';
31
+ readonly sheetId: string;
32
+ readonly ranges: readonly WorkOfficeSpreadsheetPresenceRange[];
33
+ readonly activeCell?: WorkOfficeSpreadsheetPresenceCell;
34
+ }
35
+ export interface WorkOfficePresentationPresenceLocation {
36
+ readonly kind: 'presentation';
37
+ readonly slideId: string;
38
+ readonly elementIds: readonly string[];
39
+ }
40
+ export interface WorkOfficePdfPresenceLocation {
41
+ readonly kind: 'pdf';
42
+ /** Zero-based page index. */
43
+ readonly pageIndex: number;
44
+ readonly annotationId?: string;
45
+ }
46
+ export type WorkOfficeCollaborationPresenceLocation = WorkOfficeTextPresenceLocation | WorkOfficeSpreadsheetPresenceLocation | WorkOfficePresentationPresenceLocation | WorkOfficePdfPresenceLocation;
47
+ export interface WorkOfficeCollaborationPresenceActor {
48
+ readonly id: string;
49
+ readonly name: string;
50
+ readonly color?: string;
51
+ readonly avatarUrl?: string;
52
+ readonly kind: WorkOfficeCollaborationActorKind;
53
+ }
54
+ export interface WorkOfficeCollaborationPresenceState {
55
+ readonly protocol: typeof WORK_OFFICE_COLLABORATION_PROTOCOL;
56
+ readonly version: typeof WORK_OFFICE_COLLABORATION_VERSION;
57
+ readonly artifactId: string;
58
+ readonly artifactKind: WorkOfficeCollaborationSession['kind'];
59
+ readonly namespace: string;
60
+ readonly presenceId: string;
61
+ readonly actor: WorkOfficeCollaborationPresenceActor;
62
+ readonly mode: WorkOfficeCollaborationMode;
63
+ readonly activity: WorkOfficeCollaborationPresenceActivity;
64
+ readonly location?: WorkOfficeCollaborationPresenceLocation;
65
+ }
66
+ export interface WorkOfficeCollaborationParticipant extends WorkOfficeCollaborationPresenceState {
67
+ readonly clientId: number;
68
+ readonly local: boolean;
69
+ }
70
+ export interface WorkOfficeCollaborationPresenceSnapshot {
71
+ readonly localClientId: number;
72
+ readonly participants: readonly WorkOfficeCollaborationParticipant[];
73
+ }
74
+ export interface WorkOfficeCollaborationPresenceUpdate {
75
+ readonly activity?: WorkOfficeCollaborationPresenceActivity;
76
+ /** `null` clears the local location; omission keeps the current location. */
77
+ readonly location?: WorkOfficeCollaborationPresenceLocation | null;
78
+ }
79
+ export interface WorkOfficeCollaborationPresence {
80
+ local(): WorkOfficeCollaborationPresenceState;
81
+ snapshot(): WorkOfficeCollaborationPresenceSnapshot;
82
+ update(update: WorkOfficeCollaborationPresenceUpdate): WorkOfficeCollaborationPresenceState;
83
+ subscribe(listener: (snapshot: WorkOfficeCollaborationPresenceSnapshot) => void): () => void;
84
+ destroy(): void;
85
+ }
86
+ export declare function createWorkOfficeCollaborationPresence(session: WorkOfficeCollaborationSession, initial?: WorkOfficeCollaborationPresenceUpdate): WorkOfficeCollaborationPresence;
@@ -0,0 +1,42 @@
1
+ import { WORK_OFFICE_COLLABORATION_PROTOCOL, WORK_OFFICE_COLLABORATION_VERSION, type WorkOfficeCollaborationOrigin, type WorkOfficeCollaborationSession } from './office-collaboration';
2
+ export declare const WORK_OFFICE_COLLABORATION_DEFAULT_MAX_TRANSPORT_PAYLOAD_BYTES: number;
3
+ export declare const WORK_OFFICE_COLLABORATION_MAX_TRANSPORT_PAYLOAD_BYTES: number;
4
+ export type WorkOfficeCollaborationTransportMessageType = 'sync-step-1' | 'sync-step-2' | 'update';
5
+ /**
6
+ * A structured-clone-safe envelope around standard Yjs v1 state vectors and
7
+ * updates. The host may encode this envelope for its own wire protocol.
8
+ */
9
+ export interface WorkOfficeCollaborationTransportMessage {
10
+ readonly protocol: typeof WORK_OFFICE_COLLABORATION_PROTOCOL;
11
+ readonly version: typeof WORK_OFFICE_COLLABORATION_VERSION;
12
+ readonly artifactId: string;
13
+ readonly artifactKind: WorkOfficeCollaborationSession['kind'];
14
+ readonly namespace: string;
15
+ readonly senderClientId: number;
16
+ readonly type: WorkOfficeCollaborationTransportMessageType;
17
+ readonly payload: Uint8Array;
18
+ /** Present only for incremental updates whose Yjs transaction had a typed origin. */
19
+ readonly origin?: WorkOfficeCollaborationOrigin;
20
+ }
21
+ /**
22
+ * Host-owned room channel. It owns connectivity, buffering, authentication,
23
+ * authorization, persistence, and delivery ordering.
24
+ */
25
+ export interface WorkOfficeCollaborationTransport {
26
+ publish(message: WorkOfficeCollaborationTransportMessage): void;
27
+ subscribe(listener: (message: unknown) => void): () => void;
28
+ }
29
+ export interface WorkOfficeCollaborationTransportBindingOptions {
30
+ /**
31
+ * Sends one SyncStep1 immediately after subscribing. Disable when the host
32
+ * must wait for a room connection, then call `synchronize()` on connect.
33
+ */
34
+ autoSynchronize?: boolean;
35
+ maxPayloadBytes?: number;
36
+ }
37
+ export interface WorkOfficeCollaborationTransportBinding {
38
+ /** Send a fresh state vector. Call this after every transport reconnect. */
39
+ synchronize(): void;
40
+ destroy(): void;
41
+ }
42
+ export declare function createWorkOfficeCollaborationTransportBinding(session: WorkOfficeCollaborationSession, transport: WorkOfficeCollaborationTransport, options?: WorkOfficeCollaborationTransportBindingOptions): WorkOfficeCollaborationTransportBinding;
@@ -0,0 +1,85 @@
1
+ import * as Y from 'yjs';
2
+ import type { WorkArtifactKind } from '../features/work/work-types';
3
+ export declare const WORK_OFFICE_COLLABORATION_PROTOCOL: "a3s.office.collaboration";
4
+ export declare const WORK_OFFICE_COLLABORATION_VERSION: 1;
5
+ export declare const WORK_OFFICE_COLLABORATION_NAMESPACE: "a3s.office";
6
+ export type WorkOfficeCollaborationMode = 'view' | 'comment' | 'suggest' | 'edit';
7
+ export type WorkOfficeCollaborationActorKind = 'human' | 'agent' | 'system';
8
+ export interface WorkOfficeCollaborationActor {
9
+ id: string;
10
+ name: string;
11
+ color?: string;
12
+ avatarUrl?: string;
13
+ kind?: WorkOfficeCollaborationActorKind;
14
+ }
15
+ export type WorkOfficeCollaborationOriginKind = 'bootstrap' | 'editor' | 'agent' | 'import' | 'system';
16
+ export interface WorkOfficeCollaborationOrigin {
17
+ readonly protocol: typeof WORK_OFFICE_COLLABORATION_PROTOCOL;
18
+ readonly kind: WorkOfficeCollaborationOriginKind;
19
+ readonly actorId?: string;
20
+ readonly operationId?: string;
21
+ }
22
+ /**
23
+ * Structural subset of y-protocols Awareness used by Office surfaces.
24
+ * Providers keep ownership of the Awareness instance and its transport.
25
+ */
26
+ export interface WorkOfficeCollaborationAwareness {
27
+ readonly clientID: number;
28
+ getLocalState(): Record<string, unknown> | null;
29
+ getStates(): Map<number, Record<string, unknown>>;
30
+ setLocalStateField(field: string, value: unknown): void;
31
+ on(event: 'change' | 'update', listener: (changes: {
32
+ added: number[];
33
+ updated: number[];
34
+ removed: number[];
35
+ }) => void): void;
36
+ off(event: 'change' | 'update', listener: (changes: {
37
+ added: number[];
38
+ updated: number[];
39
+ removed: number[];
40
+ }) => void): void;
41
+ }
42
+ export interface WorkOfficeCollaborationMetadata {
43
+ protocol: typeof WORK_OFFICE_COLLABORATION_PROTOCOL;
44
+ version: typeof WORK_OFFICE_COLLABORATION_VERSION;
45
+ artifactId: string;
46
+ kind: WorkArtifactKind;
47
+ initialized: boolean;
48
+ }
49
+ export interface WorkOfficeCollaborationSessionOptions {
50
+ artifactId: string;
51
+ kind: WorkArtifactKind;
52
+ document?: Y.Doc;
53
+ awareness?: WorkOfficeCollaborationAwareness;
54
+ actor?: WorkOfficeCollaborationActor;
55
+ mode?: WorkOfficeCollaborationMode;
56
+ namespace?: string;
57
+ }
58
+ export interface WorkOfficeCollaborationSession {
59
+ readonly artifactId: string;
60
+ readonly kind: WorkArtifactKind;
61
+ readonly document: Y.Doc;
62
+ readonly awareness?: WorkOfficeCollaborationAwareness;
63
+ readonly actor?: WorkOfficeCollaborationActor;
64
+ readonly mode: WorkOfficeCollaborationMode;
65
+ readonly namespace: string;
66
+ readonly ownsDocument: boolean;
67
+ readonly localOrigin: WorkOfficeCollaborationOrigin;
68
+ metadata(): WorkOfficeCollaborationMetadata | null;
69
+ rootName(suffix: string): string;
70
+ createOrigin(kind: WorkOfficeCollaborationOriginKind, operationId?: string): WorkOfficeCollaborationOrigin;
71
+ transact<T>(operation: (transaction: Y.Transaction) => T, origin?: WorkOfficeCollaborationOrigin): T;
72
+ destroy(): void;
73
+ }
74
+ export type WorkOfficeCollaborationErrorCode = 'office.collaboration.actor_invalid' | 'office.collaboration.artifact_mismatch' | 'office.collaboration.binding_destroyed' | 'office.collaboration.bootstrap_ambiguous' | 'office.collaboration.bootstrap_invalid' | 'office.collaboration.content_invalid' | 'office.collaboration.identifier_invalid' | 'office.collaboration.kind_invalid' | 'office.collaboration.kind_mismatch' | 'office.collaboration.metadata_invalid' | 'office.collaboration.metadata_missing' | 'office.collaboration.mode_invalid' | 'office.collaboration.namespace_invalid' | 'office.collaboration.not_initialized' | 'office.collaboration.origin_invalid' | 'office.collaboration.permission_denied' | 'office.collaboration.presence_conflict' | 'office.collaboration.presence_invalid' | 'office.collaboration.presence_unavailable' | 'office.collaboration.root_invalid' | 'office.collaboration.session_destroyed' | 'office.collaboration.transport_identity_mismatch' | 'office.collaboration.transport_invalid' | 'office.collaboration.transport_message_invalid' | 'office.collaboration.transport_message_too_large';
75
+ export declare class WorkOfficeCollaborationError extends Error {
76
+ readonly code: WorkOfficeCollaborationErrorCode;
77
+ constructor(code: WorkOfficeCollaborationErrorCode, message: string);
78
+ }
79
+ export declare function createWorkOfficeCollaborationSession(options: WorkOfficeCollaborationSessionOptions): WorkOfficeCollaborationSession;
80
+ export declare function readWorkOfficeCollaborationMetadata(session: WorkOfficeCollaborationSession): WorkOfficeCollaborationMetadata | null;
81
+ export declare function initializeWorkOfficeCollaborationMetadata(session: WorkOfficeCollaborationSession): WorkOfficeCollaborationMetadata;
82
+ export declare function markWorkOfficeCollaborationInitialized(session: WorkOfficeCollaborationSession): void;
83
+ export declare function registerWorkOfficeCollaborationInitializer(session: WorkOfficeCollaborationSession): void;
84
+ export declare function assertWorkOfficeCollaborationEditable(session: WorkOfficeCollaborationSession): void;
85
+ export declare function assertWorkOfficeCollaborationOrigin(origin: WorkOfficeCollaborationOrigin): void;
@@ -0,0 +1,7 @@
1
+ import * as Y from 'yjs';
2
+ import type { WorkDocumentBibliography } from '../features/work/work-types';
3
+ export declare function validatedWorkOfficeDocumentBibliography(value: unknown): WorkDocumentBibliography;
4
+ export declare function initializeWorkOfficeDocumentBibliography(settings: Y.Map<unknown>, records: Y.Map<unknown>, order: Y.Array<string>, bibliography: WorkDocumentBibliography): void;
5
+ export declare function readWorkOfficeDocumentBibliography(settings: Y.Map<unknown>, records: Y.Map<unknown>, order: Y.Array<string>): WorkDocumentBibliography;
6
+ export declare function patchWorkOfficeDocumentBibliography(settings: Y.Map<unknown>, records: Y.Map<unknown>, order: Y.Array<string>, previous: WorkDocumentBibliography | undefined, next: WorkDocumentBibliography | undefined): void;
7
+ export declare function assertWorkOfficeDocumentBibliographyConflicts(previous: WorkDocumentBibliography | undefined, next: WorkDocumentBibliography | undefined, shared: WorkDocumentBibliography | undefined): void;
@@ -0,0 +1,9 @@
1
+ import type * as Y from 'yjs';
2
+ import type { WorkDocumentBibliography, WorkDocumentComment } from '../features/work/work-types';
3
+ interface ClaimableDocumentSidecars {
4
+ comments?: WorkDocumentComment[];
5
+ bibliography?: WorkDocumentBibliography;
6
+ }
7
+ export declare function appendWorkOfficeDocumentRecordClaims(claims: Y.Array<string>, previous: ClaimableDocumentSidecars, next: ClaimableDocumentSidecars): void;
8
+ export declare function assertWorkOfficeDocumentRecordClaims(claims: Y.Array<string>, sidecars: ClaimableDocumentSidecars): void;
9
+ export {};
@@ -0,0 +1,7 @@
1
+ import * as Y from 'yjs';
2
+ import type { WorkDocumentComment } from '../features/work/work-types';
3
+ export declare function validatedWorkOfficeDocumentComments(value: unknown): WorkDocumentComment[];
4
+ export declare function initializeWorkOfficeDocumentComments(records: Y.Map<unknown>, order: Y.Array<string>, comments: WorkDocumentComment[]): void;
5
+ export declare function readWorkOfficeDocumentComments(records: Y.Map<unknown>, order: Y.Array<string>): WorkDocumentComment[];
6
+ export declare function patchWorkOfficeDocumentComments(records: Y.Map<unknown>, order: Y.Array<string>, previous: WorkDocumentComment[], next: WorkDocumentComment[]): void;
7
+ export declare function assertWorkOfficeDocumentCommentConflicts(previous: WorkDocumentComment[], next: WorkDocumentComment[], shared: WorkDocumentComment[]): void;
@@ -0,0 +1,27 @@
1
+ import * as Y from 'yjs';
2
+ export declare function validatedOrder(order: Y.Array<string>, records: Y.Map<unknown>, label: string): string[];
3
+ export declare function requiredSharedMap(parent: Y.Map<unknown>, key: string, label: string): Y.Map<unknown>;
4
+ export declare function requiredNestedMap(parent: Y.Map<unknown>, key: string, label: string): Y.Map<unknown>;
5
+ export declare function requiredNestedArray(parent: Y.Map<unknown>, key: string, label: string): Y.Array<string>;
6
+ export declare function patchRequiredScalar(target: Y.Map<unknown>, key: string, previous: unknown, next: unknown): void;
7
+ export declare function patchOptionalScalar(target: Y.Map<unknown>, key: string, previous: unknown, next: unknown): void;
8
+ export declare function removeFromOrder(order: Y.Array<string>, id: string): void;
9
+ export declare function insertIntoOrder(order: Y.Array<string>, desired: string[], id: string): void;
10
+ export declare function optionalSharedString(value: unknown, label: string): string | undefined;
11
+ export declare function requiredIdentifier(value: unknown, label: string): string;
12
+ export declare function requiredSharedIdentifier(value: unknown, label: string): string;
13
+ export declare function requiredString(value: unknown, label: string): string;
14
+ export declare function requiredSharedString(value: unknown, label: string): string;
15
+ export declare function requiredBoolean(value: unknown, label: string): boolean;
16
+ export declare function requiredSharedBoolean(value: unknown, label: string): boolean;
17
+ export declare function cloneJsonRecord(value: Record<string, unknown>): Record<string, unknown>;
18
+ export declare function cloneJsonValue(value: unknown, seen?: WeakSet<object>): unknown;
19
+ export declare function jsonEqual(left: unknown, right: unknown): boolean;
20
+ export declare function canonicalJson(value: unknown): string;
21
+ export declare function assertNoAddedCollision<T extends {
22
+ id: string;
23
+ }>(previous: T[], next: T[], shared: T[], label: string): void;
24
+ export declare function changedRecordMissing(label: string, id: string): never;
25
+ export declare function invalidInputSidecars(expected: string): never;
26
+ export declare function invalidSharedSidecars(label: string): never;
27
+ export declare function isRecord(value: unknown): value is Record<string, unknown>;