@a3s-lab/office 0.3.0 → 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 (262) hide show
  1. package/COLLABORATION_ROADMAP.md +426 -0
  2. package/README.md +635 -9
  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 +7 -2
  10. package/dist/0~4980.js +154 -0
  11. package/dist/{0~9512.js → 0~6090.js} +539 -3
  12. package/dist/0~7048.js +92 -66
  13. package/dist/0~7614.js +2 -1
  14. package/dist/0~7754.js +5653 -0
  15. package/dist/0~9445.js +1 -1
  16. package/dist/0~document-editor.js +1815 -1553
  17. package/dist/0~markdown-editor.js +250 -44
  18. package/dist/0~pdf-viewer.js +1016 -24
  19. package/dist/0~presentation-editor.js +179 -8
  20. package/dist/0~spreadsheet-editor.js +3371 -578
  21. package/dist/0~work-docx-export.js +6801 -658
  22. package/dist/0~work-docx-import.js +1388 -795
  23. package/dist/0~work-office-diagnostics.js +524 -30
  24. package/dist/0~work-pptx-export.js +2 -1
  25. package/dist/0~work-pptx-import.js +1 -2
  26. package/dist/0~work-presentation-charts.js +1 -1
  27. package/dist/2591.js +197 -0
  28. package/dist/3818.js +1090 -0
  29. package/dist/4104.js +970 -60
  30. package/dist/432.js +171 -14
  31. package/dist/4476.js +2008 -0
  32. package/dist/4560.js +674 -0
  33. package/dist/4650.js +70 -0
  34. package/dist/{1134.js → 5184.js} +183 -1
  35. package/dist/6489.js +18 -18
  36. package/dist/7060.js +132 -0
  37. package/dist/8715.js +2 -136
  38. package/dist/8928.js +16778 -0
  39. package/dist/9787.js +209 -0
  40. package/dist/core.d.ts +29 -9
  41. package/dist/core.js +10 -2
  42. package/dist/index.js +13 -3
  43. package/dist/internal/collaboration/office-collaboration-flat-json.d.ts +13 -0
  44. package/dist/internal/collaboration/office-collaboration-json.d.ts +4 -0
  45. package/dist/internal/collaboration/office-collaboration-presence.d.ts +86 -0
  46. package/dist/internal/collaboration/office-collaboration-transport.d.ts +42 -0
  47. package/dist/internal/collaboration/office-collaboration.d.ts +85 -0
  48. package/dist/internal/collaboration/office-document-collaboration-bibliography.d.ts +7 -0
  49. package/dist/internal/collaboration/office-document-collaboration-claims.d.ts +9 -0
  50. package/dist/internal/collaboration/office-document-collaboration-comments.d.ts +7 -0
  51. package/dist/internal/collaboration/office-document-collaboration-sidecar-utils.d.ts +27 -0
  52. package/dist/internal/collaboration/office-document-collaboration-sidecars.d.ts +16 -0
  53. package/dist/internal/collaboration/office-document-collaboration.d.ts +45 -0
  54. package/dist/internal/collaboration/office-markdown-collaboration.d.ts +31 -0
  55. package/dist/internal/collaboration/office-pdf-collaboration-claims.d.ts +4 -0
  56. package/dist/internal/collaboration/office-pdf-collaboration-conflicts.d.ts +2 -0
  57. package/dist/internal/collaboration/office-pdf-collaboration-model.d.ts +26 -0
  58. package/dist/internal/collaboration/office-pdf-collaboration-records.d.ts +21 -0
  59. package/dist/internal/collaboration/office-pdf-collaboration-types.d.ts +91 -0
  60. package/dist/internal/collaboration/office-pdf-collaboration-validation.d.ts +4 -0
  61. package/dist/internal/collaboration/office-pdf-collaboration.d.ts +35 -0
  62. package/dist/internal/collaboration/office-presentation-collaboration-model.d.ts +25 -0
  63. package/dist/internal/collaboration/office-presentation-collaboration-records.d.ts +22 -0
  64. package/dist/internal/collaboration/office-presentation-collaboration-validation.d.ts +4 -0
  65. package/dist/internal/collaboration/office-presentation-collaboration.d.ts +32 -0
  66. package/dist/internal/collaboration/office-spreadsheet-collaboration-cells.d.ts +13 -0
  67. package/dist/internal/collaboration/office-spreadsheet-collaboration-claims.d.ts +4 -0
  68. package/dist/internal/collaboration/office-spreadsheet-collaboration-conflicts.d.ts +2 -0
  69. package/dist/internal/collaboration/office-spreadsheet-collaboration-flat-json.d.ts +10 -0
  70. package/dist/internal/collaboration/office-spreadsheet-collaboration-model.d.ts +31 -0
  71. package/dist/internal/collaboration/office-spreadsheet-collaboration-records.d.ts +17 -0
  72. package/dist/internal/collaboration/office-spreadsheet-collaboration-validation.d.ts +4 -0
  73. package/dist/internal/collaboration/office-spreadsheet-collaboration.d.ts +32 -0
  74. package/dist/internal/features/work/components/work-document-page-border.d.ts +6 -0
  75. package/dist/internal/features/work/editors/document-command-catalog.d.ts +9 -0
  76. package/dist/internal/features/work/editors/document-editor-focus.d.ts +1 -1
  77. package/dist/internal/features/work/editors/document-editor.d.ts +7 -1
  78. package/dist/internal/features/work/editors/document-external-content.d.ts +14 -0
  79. package/dist/internal/features/work/editors/document-page-stack.d.ts +10 -1
  80. package/dist/internal/features/work/editors/document-page-thumbnail.d.ts +2 -0
  81. package/dist/internal/features/work/editors/document-pagination-run-coordinator.d.ts +26 -0
  82. package/dist/internal/features/work/editors/document-picture-properties-dialog-model.d.ts +20 -1
  83. package/dist/internal/features/work/editors/document-table-properties-dialog-model.d.ts +4 -1
  84. package/dist/internal/features/work/editors/document-toolbar.d.ts +8 -1
  85. package/dist/internal/features/work/editors/markdown-editor-focus.d.ts +1 -1
  86. package/dist/internal/features/work/editors/markdown-editor.d.ts +5 -1
  87. package/dist/internal/features/work/editors/markdown-toolbar.d.ts +2 -1
  88. package/dist/internal/features/work/editors/office-collaboration-participants.d.ts +3 -0
  89. package/dist/internal/features/work/editors/office-collaboration-presence-context.d.ts +17 -0
  90. package/dist/internal/features/work/editors/office-collaboration-presence-ui.d.ts +25 -0
  91. package/dist/internal/features/work/editors/office-editor-focus-handoff.d.ts +27 -0
  92. package/dist/internal/features/work/editors/pdf-annotation-controller.d.ts +5 -0
  93. package/dist/internal/features/work/editors/pdf-collaboration-presence.d.ts +3 -0
  94. package/dist/internal/features/work/editors/pdf-collaboration-projection.d.ts +10 -0
  95. package/dist/internal/features/work/editors/pdf-evidence-contract.d.ts +36 -0
  96. package/dist/internal/features/work/editors/pdf-evidence-overlay.d.ts +37 -0
  97. package/dist/internal/features/work/editors/pdf-toolbar.d.ts +2 -1
  98. package/dist/internal/features/work/editors/pdf-viewer-controller.d.ts +7 -1
  99. package/dist/internal/features/work/editors/pdf-viewer.d.ts +11 -1
  100. package/dist/internal/features/work/editors/presentation-collaboration-presence.d.ts +5 -0
  101. package/dist/internal/features/work/editors/presentation-editor-focus.d.ts +3 -2
  102. package/dist/internal/features/work/editors/presentation-editor-types.d.ts +3 -0
  103. package/dist/internal/features/work/editors/presentation-editor.d.ts +1 -1
  104. package/dist/internal/features/work/editors/spreadsheet-auto-filter.d.ts +9 -0
  105. package/dist/internal/features/work/editors/spreadsheet-cell-clear.d.ts +3 -0
  106. package/dist/internal/features/work/editors/spreadsheet-cell-merge.d.ts +12 -0
  107. package/dist/internal/features/work/editors/spreadsheet-clipboard-shortcuts.d.ts +3 -7
  108. package/dist/internal/features/work/editors/spreadsheet-collaboration-presence.d.ts +9 -0
  109. package/dist/internal/features/work/editors/spreadsheet-command-catalog.d.ts +464 -0
  110. package/dist/internal/features/work/editors/spreadsheet-command-controller.d.ts +45 -9
  111. package/dist/internal/features/work/editors/spreadsheet-context-menu.d.ts +2 -0
  112. package/dist/internal/features/work/editors/spreadsheet-editor-ribbon.d.ts +9 -28
  113. package/dist/internal/features/work/editors/spreadsheet-editor.d.ts +8 -2
  114. package/dist/internal/features/work/editors/spreadsheet-format-painter.d.ts +27 -0
  115. package/dist/internal/features/work/editors/spreadsheet-freeze-panes.d.ts +14 -0
  116. package/dist/internal/features/work/editors/use-document-insert-commands.d.ts +3 -2
  117. package/dist/internal/features/work/editors/use-document-pagination.d.ts +6 -1
  118. package/dist/internal/features/work/editors/use-document-review-conflicts.d.ts +28 -0
  119. package/dist/internal/features/work/editors/use-spreadsheet-auto-filter.d.ts +21 -0
  120. package/dist/internal/features/work/editors/use-spreadsheet-collaboration.d.ts +27 -0
  121. package/dist/internal/features/work/editors/use-spreadsheet-format-painter.d.ts +18 -0
  122. package/dist/internal/features/work/work-document-bookmark-references.d.ts +37 -0
  123. package/dist/internal/features/work/work-document-bookmarks.d.ts +29 -0
  124. package/dist/internal/features/work/work-document-caption-nodes.d.ts +4 -1
  125. package/dist/internal/features/work/work-document-comments.d.ts +1 -1
  126. package/dist/internal/features/work/work-document-equations.d.ts +513 -0
  127. package/dist/internal/features/work/work-document-extensions.d.ts +1 -0
  128. package/dist/internal/features/work/work-document-field-identity.d.ts +2 -0
  129. package/dist/internal/features/work/work-document-field-node.d.ts +2 -2
  130. package/dist/internal/features/work/work-document-fields.d.ts +7 -0
  131. package/dist/internal/features/work/work-document-image-identity.d.ts +30 -0
  132. package/dist/internal/features/work/work-document-image-layout.d.ts +46 -1
  133. package/dist/internal/features/work/work-document-image-wrap-contour.d.ts +16 -0
  134. package/dist/internal/features/work/work-document-incremental-layout.d.ts +2 -2
  135. package/dist/internal/features/work/work-document-model-codec.d.ts +4 -1
  136. package/dist/internal/features/work/work-document-note-integrity.d.ts +2 -0
  137. package/dist/internal/features/work/work-document-page-borders.d.ts +25 -0
  138. package/dist/internal/features/work/work-document-page-capture.d.ts +8 -0
  139. package/dist/internal/features/work/work-document-page-frames.d.ts +15 -0
  140. package/dist/internal/features/work/work-document-page-margins.d.ts +56 -0
  141. package/dist/internal/features/work/work-document-page-size.d.ts +47 -0
  142. package/dist/internal/features/work/work-document-pagination-measurement.d.ts +1 -2
  143. package/dist/internal/features/work/work-document-pagination-types.d.ts +7 -2
  144. package/dist/internal/features/work/work-document-pagination.d.ts +2 -2
  145. package/dist/internal/features/work/work-document-paragraph-borders.d.ts +32 -0
  146. package/dist/internal/features/work/work-document-paragraph-identity.d.ts +26 -0
  147. package/dist/internal/features/work/work-document-paragraph-shading.d.ts +18 -0
  148. package/dist/internal/features/work/work-document-review-conflicts.d.ts +35 -0
  149. package/dist/internal/features/work/work-document-section.d.ts +4 -0
  150. package/dist/internal/features/work/work-document-snapshot.d.ts +19 -0
  151. package/dist/internal/features/work/work-document-source.d.ts +23 -0
  152. package/dist/internal/features/work/work-document-table-column-widths.d.ts +7 -0
  153. package/dist/internal/features/work/work-document-table-property-changes.d.ts +3 -0
  154. package/dist/internal/features/work/work-document-table-row-identity.d.ts +15 -0
  155. package/dist/internal/features/work/work-document-table-sizing.d.ts +3 -0
  156. package/dist/internal/features/work/work-document-text-layout.d.ts +3 -1
  157. package/dist/internal/features/work/work-document-word-line-metrics.d.ts +2 -0
  158. package/dist/internal/features/work/work-docx-bookmark-diagnostics.d.ts +3 -0
  159. package/dist/internal/features/work/work-docx-bookmark-import.d.ts +24 -0
  160. package/dist/internal/features/work/work-docx-bookmarks.d.ts +17 -0
  161. package/dist/internal/features/work/work-docx-comment-durable-id-preservation.d.ts +2 -0
  162. package/dist/internal/features/work/work-docx-comment-export.d.ts +3 -0
  163. package/dist/internal/features/work/work-docx-comment-metadata.d.ts +2 -0
  164. package/dist/internal/features/work/work-docx-drawing-extension-preservation.d.ts +4 -0
  165. package/dist/internal/features/work/work-docx-equation-diagnostics.d.ts +3 -0
  166. package/dist/internal/features/work/work-docx-equation-export.d.ts +14 -0
  167. package/dist/internal/features/work/work-docx-equation-import.d.ts +30 -0
  168. package/dist/internal/features/work/work-docx-equation-story.d.ts +9 -0
  169. package/dist/internal/features/work/work-docx-export-formatting.d.ts +3 -1
  170. package/dist/internal/features/work/work-docx-export-image.d.ts +5 -1
  171. package/dist/internal/features/work/work-docx-export.d.ts +1 -1
  172. package/dist/internal/features/work/work-docx-field-instructions.d.ts +8 -0
  173. package/dist/internal/features/work/work-docx-font-table-preservation.d.ts +3 -0
  174. package/dist/internal/features/work/work-docx-ignorable-extension-preservation.d.ts +15 -0
  175. package/dist/internal/features/work/work-docx-image-crop.d.ts +12 -0
  176. package/dist/internal/features/work/work-docx-image-identity.d.ts +17 -0
  177. package/dist/internal/features/work/work-docx-image-layer.d.ts +12 -0
  178. package/dist/internal/features/work/work-docx-image-layout-import.d.ts +14 -2
  179. package/dist/internal/features/work/work-docx-image-wrap.d.ts +15 -0
  180. package/dist/internal/features/work/work-docx-import.d.ts +13 -3
  181. package/dist/internal/features/work/work-docx-list-export.d.ts +18 -0
  182. package/dist/internal/features/work/work-docx-list-import.d.ts +14 -0
  183. package/dist/internal/features/work/work-docx-note-comment-content-control-block-preservation.d.ts +18 -0
  184. package/dist/internal/features/work/work-docx-note-comment-content-control-model.d.ts +47 -0
  185. package/dist/internal/features/work/work-docx-note-comment-content-control-preservation.d.ts +4 -0
  186. package/dist/internal/features/work/work-docx-note-comment-content-control-properties.d.ts +17 -0
  187. package/dist/internal/features/work/work-docx-note-comment-content-control-table-model.d.ts +17 -0
  188. package/dist/internal/features/work/work-docx-note-comment-content-control-xml.d.ts +14 -0
  189. package/dist/internal/features/work/work-docx-note-comment-extension-preservation.d.ts +2 -0
  190. package/dist/internal/features/work/work-docx-note-comment-hyperlink-content.d.ts +40 -0
  191. package/dist/internal/features/work/work-docx-note-comment-hyperlink-preservation.d.ts +5 -0
  192. package/dist/internal/features/work/work-docx-note-comment-hyperlink-relationships.d.ts +35 -0
  193. package/dist/internal/features/work/work-docx-note-comment-identity.d.ts +15 -0
  194. package/dist/internal/features/work/work-docx-note-comment-run-preservation.d.ts +4 -0
  195. package/dist/internal/features/work/work-docx-note-comment-run-properties.d.ts +2 -0
  196. package/dist/internal/features/work/work-docx-note-image-import.d.ts +12 -0
  197. package/dist/internal/features/work/work-docx-note-image-relationships.d.ts +1 -0
  198. package/dist/internal/features/work/work-docx-numbering-extension-preservation.d.ts +6 -0
  199. package/dist/internal/features/work/work-docx-numbering.d.ts +1 -0
  200. package/dist/internal/features/work/work-docx-page-borders-diagnostics.d.ts +3 -0
  201. package/dist/internal/features/work/work-docx-page-borders-import.d.ts +10 -0
  202. package/dist/internal/features/work/work-docx-page-margins-diagnostics.d.ts +3 -0
  203. package/dist/internal/features/work/work-docx-page-margins-import.d.ts +18 -0
  204. package/dist/internal/features/work/work-docx-page-size-diagnostics.d.ts +2 -0
  205. package/dist/internal/features/work/work-docx-page-size-import.d.ts +17 -0
  206. package/dist/internal/features/work/work-docx-paragraph-borders-diagnostics.d.ts +3 -0
  207. package/dist/internal/features/work/work-docx-paragraph-borders-export.d.ts +18 -0
  208. package/dist/internal/features/work/work-docx-paragraph-borders-import.d.ts +24 -0
  209. package/dist/internal/features/work/work-docx-paragraph-default-collapsed.d.ts +19 -0
  210. package/dist/internal/features/work/work-docx-paragraph-extension-preservation.d.ts +2 -0
  211. package/dist/internal/features/work/work-docx-paragraph-identity-import.d.ts +10 -0
  212. package/dist/internal/features/work/work-docx-paragraph-identity.d.ts +18 -0
  213. package/dist/internal/features/work/work-docx-paragraph-pagination-import.d.ts +6 -1
  214. package/dist/internal/features/work/work-docx-paragraph-shading-diagnostics.d.ts +3 -0
  215. package/dist/internal/features/work/work-docx-paragraph-shading-export.d.ts +5 -0
  216. package/dist/internal/features/work/work-docx-paragraph-shading-import.d.ts +18 -0
  217. package/dist/internal/features/work/work-docx-run-formatting-import.d.ts +3 -0
  218. package/dist/internal/features/work/work-docx-settings-preservation.d.ts +10 -0
  219. package/dist/internal/features/work/work-docx-settings-xml.d.ts +16 -0
  220. package/dist/internal/features/work/work-docx-style-extension-preservation.d.ts +2 -0
  221. package/dist/internal/features/work/work-docx-table-cell-export.d.ts +2 -1
  222. package/dist/internal/features/work/work-docx-table-cell-import.d.ts +3 -0
  223. package/dist/internal/features/work/work-docx-table-extension-preservation.d.ts +2 -0
  224. package/dist/internal/features/work/work-docx-table-row-import.d.ts +2 -0
  225. package/dist/internal/features/work/work-docx-table-sizing-import.d.ts +1 -0
  226. package/dist/internal/features/work/work-docx-theme-reference.d.ts +23 -0
  227. package/dist/internal/features/work/work-docx-theme.d.ts +4 -1
  228. package/dist/internal/features/work/work-docx-twips.d.ts +12 -0
  229. package/dist/internal/features/work/work-file-contract.d.ts +1 -0
  230. package/dist/internal/features/work/work-file-io.d.ts +1 -1
  231. package/dist/internal/features/work/work-markdown-extensions.d.ts +4 -1
  232. package/dist/internal/features/work/work-ooxml-package-preservation.d.ts +12 -0
  233. package/dist/internal/features/work/work-ooxml-package-security.d.ts +6 -0
  234. package/dist/internal/features/work/work-ooxml-relationship-preservation.d.ts +10 -0
  235. package/dist/internal/features/work/work-ooxml-xml.d.ts +2 -0
  236. package/dist/internal/features/work/work-pdf-export.d.ts +10 -0
  237. package/dist/internal/features/work/work-repository.d.ts +2 -0
  238. package/dist/internal/features/work/work-types.d.ts +15 -2
  239. package/dist/internal/kernel/office-kernel-client-types.d.ts +1 -0
  240. package/dist/internal/kernel/office-kernel-protocol.d.ts +7 -0
  241. package/dist/internal/kernel/office-kernel-version.d.ts +1 -1
  242. package/dist/office-kernel.wasm +0 -0
  243. package/dist/office-kernel.worker.js +93 -41
  244. package/dist/react.d.ts +18 -12
  245. package/dist/react.js +1 -1
  246. package/dist/styles.css +1153 -14
  247. package/dist/vue.d.ts +48 -5
  248. package/dist/vue.js +42 -3
  249. package/dist/web-component.d.ts +24 -2
  250. package/dist/web-component.js +101 -2
  251. package/docs/latest/en/browser-editor-architecture.md +231 -49
  252. package/package.json +19 -4
  253. package/dist/0~152.js +0 -94
  254. package/dist/0~2582.js +0 -485
  255. package/dist/0~4750.js +0 -939
  256. package/dist/0~5861.js +0 -596
  257. package/dist/0~work-document-extensions.js +0 -3045
  258. package/dist/0~work-document-model-codec.js +0 -42
  259. package/dist/0~work-docx-bibliography.js +0 -347
  260. package/dist/0~work-docx-page-color.js +0 -42
  261. package/dist/2881.js +0 -1455
  262. package/dist/8728.js +0 -723
@@ -1,4 +1,5 @@
1
1
  import { useCallback, useRef, useState } from "react";
2
+ import { jsx, jsxs } from "react/jsx-runtime";
2
3
  function useOfficeDraft(createInitial) {
3
4
  const [initial] = useState(createInitial);
4
5
  const [draft, setDraftState] = useState(initial);
@@ -43,4 +44,32 @@ function useOfficeDraft(createInitial) {
43
44
  syncDraft
44
45
  };
45
46
  }
46
- export { useOfficeDraft };
47
+ function InlineNotice({ title, children, icon, actions, tone = 'info', role, className = '' }) {
48
+ return /*#__PURE__*/ jsxs("div", {
49
+ className: `ds-inline-notice ${tone}${className ? ` ${className}` : ''}`,
50
+ role: role,
51
+ children: [
52
+ icon && /*#__PURE__*/ jsx("span", {
53
+ className: "ds-inline-notice-icon",
54
+ "aria-hidden": "true",
55
+ children: icon
56
+ }),
57
+ /*#__PURE__*/ jsxs("div", {
58
+ className: "ds-inline-notice-copy",
59
+ children: [
60
+ title && /*#__PURE__*/ jsx("strong", {
61
+ children: title
62
+ }),
63
+ /*#__PURE__*/ jsx("div", {
64
+ children: children
65
+ })
66
+ ]
67
+ }),
68
+ actions && /*#__PURE__*/ jsx("div", {
69
+ className: "ds-inline-notice-actions",
70
+ children: actions
71
+ })
72
+ ]
73
+ });
74
+ }
75
+ export { InlineNotice, useOfficeDraft };
package/dist/0~3539.js CHANGED
@@ -7,7 +7,7 @@ import { presentationChartLegendPositionLabel, presentationChartShowsLegend, nor
7
7
  import { OfficeCheckbox, CommittedOfficeNumberField, CollectionState } from "./0~7048.js";
8
8
  import { OfficeColorPicker } from "./0~3635.js";
9
9
  import { OfficeSelect } from "./0~4595.js";
10
- import { office_text_field_OfficeTextField, CommittedOfficeTextField } from "./0~9512.js";
10
+ import { office_text_field_OfficeTextField, CommittedOfficeTextField } from "./0~6090.js";
11
11
  function spreadsheetAgentMenuItems(selection, onAgentRequest, applyProposal) {
12
12
  return [
13
13
  {
package/dist/0~3557.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { useEffect, useLayoutEffect, useMemo, useRef } from "react";
2
- import { matchesOfficeEditorKeyboardShortcut } from "./0~9512.js";
2
+ import { matchesOfficeEditorKeyboardShortcut } from "./0~6090.js";
3
3
  const DEFAULT_EXTENSION_PRIORITY = 100;
4
4
  function createOfficeEditorExtension(config) {
5
5
  const name = config.name.trim();
package/dist/0~3635.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
2
2
  import { Check, ChevronDown } from "lucide-react";
3
3
  import { useEffect, useRef, useState } from "react";
4
- import { button_Button, Popover } from "./0~9512.js";
4
+ import { button_Button, Popover } from "./0~6090.js";
5
5
  const THEME_COLORS = [
6
6
  '#111827',
7
7
  '#1f2937',
package/dist/0~4595.js CHANGED
@@ -2,7 +2,7 @@ import { Fragment as jsx_runtime_Fragment, jsx, jsxs } from "react/jsx-runtime";
2
2
  import { Fragment, useCallback, useEffect, useId, useLayoutEffect, useMemo, useRef, useState } from "react";
3
3
  import { createPortal } from "react-dom";
4
4
  import { Check, ChevronDown, ChevronLeft, ChevronRight, ChevronUp, Eye, Minus, Plus, X } from "lucide-react";
5
- import { moveOfficeMenuFocus, useDialogFocusScope, icon_button_IconButton, Popover, matchesAriaKeyShortcuts, officeOverlayPortalRoot } from "./0~9512.js";
5
+ import { WorkOfficeCollaborationParticipants, moveOfficeMenuFocus, useDialogFocusScope, icon_button_IconButton, Popover, matchesAriaKeyShortcuts, officeOverlayPortalRoot } from "./0~6090.js";
6
6
  const CONTEXT_MENU_MARGIN = 8;
7
7
  const CONTEXT_MENU_TAB_STOP_SELECTOR = 'a[href]:not([tabindex="-1"]), button:not(:disabled):not([tabindex="-1"]), input:not(:disabled):not([type="hidden"]):not([tabindex="-1"]), select:not(:disabled):not([tabindex="-1"]), textarea:not(:disabled):not([tabindex="-1"]), [contenteditable="true"]:not([tabindex="-1"]), [tabindex]:not([tabindex="-1"])';
8
8
  function isWorkspaceContextMenuKeyboardEvent({ key, shiftKey }) {
@@ -724,7 +724,8 @@ function WorkOfficeRibbon({ ariaLabel, tabs, defaultTab, activeTab, onTabChange,
724
724
  const updateRibbonOverflow = useCallback(()=>{
725
725
  const toolbar = toolbarRef.current;
726
726
  if (!toolbar) return;
727
- const nextDensity = adaptive ? calculateRibbonDensity(toolbar.clientWidth) : 'comfortable';
727
+ const ribbonWidth = ribbonRef.current?.clientWidth || toolbar.clientWidth;
728
+ const nextDensity = adaptive ? calculateRibbonDensity(ribbonWidth) : 'comfortable';
728
729
  setRibbonDensity((current)=>current === nextDensity ? current : nextDensity);
729
730
  const { backward, forward } = calculateRibbonOverflow({
730
731
  clientWidth: toolbar.clientWidth,
@@ -1075,6 +1076,9 @@ function WorkOfficePreviewBar({ ariaLabel, label, detail, fileActions, className
1075
1076
  children: detail
1076
1077
  })
1077
1078
  ]
1079
+ }),
1080
+ /*#__PURE__*/ jsx(WorkOfficeCollaborationParticipants, {
1081
+ variant: "toolbar"
1078
1082
  })
1079
1083
  ]
1080
1084
  });
@@ -1203,6 +1207,7 @@ function WorkOfficeStatusBar({ ariaLabel = '编辑器状态栏', children, contr
1203
1207
  className: "work-office-status-info",
1204
1208
  children: children
1205
1209
  }),
1210
+ /*#__PURE__*/ jsx(WorkOfficeCollaborationParticipants, {}),
1206
1211
  controls && /*#__PURE__*/ jsx("div", {
1207
1212
  className: "work-office-status-view",
1208
1213
  role: "toolbar",
package/dist/0~4980.js ADDED
@@ -0,0 +1,154 @@
1
+ import jszip from "jszip";
2
+ import { documentNoteKey } from "./8928.js";
3
+ import { directChild, xmlNamespacePrefix, attribute, parseXml } from "./5184.js";
4
+ import { DEFAULT_DOCUMENT_PAGE_COLOR, normalizeDocumentPageColor } from "./0~work-document-page-color.js";
5
+ const MAX_NATIVE_ID = 2147483647;
6
+ const MIN_NATIVE_COMMENT_ID = -2147483648;
7
+ function importedDocumentNoteId(kind, target) {
8
+ const match = new RegExp(`^${kind}-([1-9][0-9]{0,9})$`).exec(target);
9
+ const nativeId = match ? decimalId(match[1], false) : null;
10
+ return null === nativeId ? null : `docx-${kind}-${nativeId}`;
11
+ }
12
+ function assignDocxNoteIds(notes) {
13
+ const candidates = notes.map((note)=>({
14
+ key: documentNoteKey(note.kind, note.id),
15
+ kind: note.kind,
16
+ nativeId: documentNoteNativeId(note.kind, note.id)
17
+ }));
18
+ const counts = occurrenceCounts(candidates.flatMap(({ kind, nativeId })=>null === nativeId ? [] : [
19
+ `${kind}:${nativeId}`
20
+ ]));
21
+ const used = {
22
+ footnote: new Set(),
23
+ endnote: new Set()
24
+ };
25
+ for (const candidate of candidates)if (null !== candidate.nativeId && 1 === counts.get(`${candidate.kind}:${candidate.nativeId}`)) used[candidate.kind].add(candidate.nativeId);
26
+ const next = {
27
+ footnote: 1,
28
+ endnote: 1
29
+ };
30
+ return new Map(candidates.map((candidate)=>{
31
+ const stable = null !== candidate.nativeId && 1 === counts.get(`${candidate.kind}:${candidate.nativeId}`) ? candidate.nativeId : null;
32
+ const id = stable ?? nextAvailableId(used[candidate.kind], next, candidate.kind);
33
+ used[candidate.kind].add(id);
34
+ return [
35
+ candidate.key,
36
+ id
37
+ ];
38
+ }));
39
+ }
40
+ function assignDocxCommentThreads(comments) {
41
+ const candidates = [];
42
+ for (const comment of comments){
43
+ candidates.push({
44
+ nativeId: documentCommentNativeId(comment.id, false)
45
+ });
46
+ for (const reply of comment.replies ?? [])candidates.push({
47
+ nativeId: documentCommentNativeId(reply.id, true)
48
+ });
49
+ }
50
+ const counts = occurrenceCounts(candidates.flatMap(({ nativeId })=>null === nativeId ? [] : [
51
+ String(nativeId)
52
+ ]));
53
+ const used = new Set();
54
+ for (const candidate of candidates)if (null !== candidate.nativeId && 1 === counts.get(String(candidate.nativeId))) used.add(candidate.nativeId);
55
+ let nextId = 0;
56
+ const assigned = new Map();
57
+ for (const candidate of candidates){
58
+ const stable = null !== candidate.nativeId && 1 === counts.get(String(candidate.nativeId)) ? candidate.nativeId : null;
59
+ if (null !== stable) {
60
+ assigned.set(candidate, stable);
61
+ continue;
62
+ }
63
+ while(used.has(nextId))nextId += 1;
64
+ assigned.set(candidate, nextId);
65
+ used.add(nextId);
66
+ nextId += 1;
67
+ }
68
+ let index = 0;
69
+ return comments.map((comment)=>{
70
+ const root = candidates[index];
71
+ index += 1;
72
+ const replies = (comment.replies ?? []).map((reply)=>{
73
+ const candidate = candidates[index];
74
+ index += 1;
75
+ return {
76
+ id: assigned.get(candidate),
77
+ reply
78
+ };
79
+ });
80
+ return {
81
+ comment,
82
+ id: assigned.get(root),
83
+ replies
84
+ };
85
+ });
86
+ }
87
+ function documentNoteNativeId(kind, id) {
88
+ const match = /^docx-(footnote|endnote)-([1-9][0-9]{0,9})$/.exec(id);
89
+ return match?.[1] === kind ? decimalId(match[2], false) : null;
90
+ }
91
+ function documentCommentNativeId(id, reply) {
92
+ const pattern = reply ? /^docx-comment-reply-(0|-?[1-9][0-9]{0,9})$/ : /^docx-comment-(0|-?[1-9][0-9]{0,9})$/;
93
+ return normalizeDocxCommentId(pattern.exec(id)?.[1]);
94
+ }
95
+ function normalizeDocxCommentId(value) {
96
+ if (!value || !/^(?:0|-?[1-9][0-9]{0,9})$/.test(value)) return null;
97
+ const number = Number(value);
98
+ return Number.isSafeInteger(number) && number >= MIN_NATIVE_COMMENT_ID && number <= MAX_NATIVE_ID ? number : null;
99
+ }
100
+ function decimalId(value, allowZero) {
101
+ if (!value) return null;
102
+ const number = Number(value);
103
+ return Number.isSafeInteger(number) && number <= MAX_NATIVE_ID && (allowZero ? number >= 0 : number > 0) ? number : null;
104
+ }
105
+ function occurrenceCounts(values) {
106
+ const counts = new Map();
107
+ for (const value of values)counts.set(value, (counts.get(value) ?? 0) + 1);
108
+ return counts;
109
+ }
110
+ function nextAvailableId(used, next, kind) {
111
+ while(used.has(next[kind]))next[kind] += 1;
112
+ const id = next[kind];
113
+ next[kind] += 1;
114
+ return id;
115
+ }
116
+ const WORD_NAMESPACE = 'http://schemas.openxmlformats.org/wordprocessingml/2006/main';
117
+ function importDocxPageColor(document) {
118
+ const background = directChild(document.documentElement, 'background');
119
+ const color = attribute(background ?? document.documentElement, 'color');
120
+ if (!background || !color || 'auto' === color.toLowerCase()) return;
121
+ return normalizeDocumentPageColor(`#${color}`);
122
+ }
123
+ async function patchDocxPageColor(buffer, value) {
124
+ const pageColor = normalizeDocumentPageColor(value);
125
+ if (!pageColor || pageColor === DEFAULT_DOCUMENT_PAGE_COLOR) return buffer;
126
+ const archive = await jszip.loadAsync(buffer);
127
+ const documentEntry = archive.file('word/document.xml');
128
+ if (!documentEntry) return buffer;
129
+ const document = parseXml(await documentEntry.async('text'), 'word/document.xml');
130
+ upsertDocumentBackground(document, pageColor.slice(1).toUpperCase());
131
+ archive.file('word/document.xml', new XMLSerializer().serializeToString(document));
132
+ const settingsEntry = archive.file('word/settings.xml');
133
+ if (settingsEntry) {
134
+ const settings = parseXml(await settingsEntry.async('text'), 'word/settings.xml');
135
+ if (!directChild(settings.documentElement, 'displayBackgroundShape')) settings.documentElement.append(settings.createElementNS(WORD_NAMESPACE, wordQualifiedName(settings.documentElement, 'displayBackgroundShape')));
136
+ archive.file('word/settings.xml', new XMLSerializer().serializeToString(settings));
137
+ }
138
+ return archive.generateAsync({
139
+ type: 'arraybuffer'
140
+ });
141
+ }
142
+ function upsertDocumentBackground(document, color) {
143
+ const root = document.documentElement;
144
+ let background = directChild(root, 'background');
145
+ if (!background) {
146
+ background = document.createElementNS(WORD_NAMESPACE, wordQualifiedName(root, 'background'));
147
+ root.insertBefore(background, directChild(root, 'body') ?? root.firstChild);
148
+ }
149
+ background.setAttributeNS(WORD_NAMESPACE, wordQualifiedName(root, 'color'), color);
150
+ }
151
+ function wordQualifiedName(root, localName) {
152
+ return `${xmlNamespacePrefix(root, WORD_NAMESPACE) ?? root.prefix ?? 'w'}:${localName}`;
153
+ }
154
+ export { assignDocxCommentThreads, assignDocxNoteIds, importDocxPageColor, importedDocumentNoteId, normalizeDocxCommentId, patchDocxPageColor };