@arbidocs/blocks 0.4.20 → 0.4.22

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 (93) hide show
  1. package/dist/agents/definitions/AgentCard.d.ts +4 -1
  2. package/dist/agents/index.cjs +211 -211
  3. package/dist/agents/index.js +5 -5
  4. package/dist/chat/ChatPage.d.ts +1 -1
  5. package/dist/chat/chat-page-types.d.ts +2 -0
  6. package/dist/chat/index.cjs +169 -168
  7. package/dist/chat/index.js +3 -2
  8. package/dist/chunk-5TRALRWN.js +42 -0
  9. package/dist/chunk-5TRALRWN.js.map +1 -0
  10. package/dist/chunk-7UTB4PHM.cjs +300 -0
  11. package/dist/chunk-7UTB4PHM.cjs.map +1 -0
  12. package/dist/chunk-AA3PT6KR.js +286 -0
  13. package/dist/chunk-AA3PT6KR.js.map +1 -0
  14. package/dist/{chunk-QJEJBLHI.js → chunk-CQ6CYPV4.js} +7 -281
  15. package/dist/chunk-CQ6CYPV4.js.map +1 -0
  16. package/dist/chunk-EUOGPUMJ.cjs +59 -0
  17. package/dist/chunk-EUOGPUMJ.cjs.map +1 -0
  18. package/dist/{chunk-PRVKJ5XL.cjs → chunk-J22DXUJY.cjs} +4 -3
  19. package/dist/chunk-J22DXUJY.cjs.map +1 -0
  20. package/dist/{chunk-ZPOLKYR2.cjs → chunk-JCVZKCXC.cjs} +22 -69
  21. package/dist/chunk-JCVZKCXC.cjs.map +1 -0
  22. package/dist/{chunk-557EU3G4.js → chunk-JLOYWXRB.js} +3 -3
  23. package/dist/{chunk-557EU3G4.js.map → chunk-JLOYWXRB.js.map} +1 -1
  24. package/dist/{chunk-UVIOQUJA.js → chunk-JLPYOPCX.js} +4 -3
  25. package/dist/chunk-JLPYOPCX.js.map +1 -0
  26. package/dist/{chunk-4TBZRZFC.js → chunk-MLJDOH3B.js} +23 -6
  27. package/dist/chunk-MLJDOH3B.js.map +1 -0
  28. package/dist/chunk-NNH7N62N.cjs +876 -0
  29. package/dist/chunk-NNH7N62N.cjs.map +1 -0
  30. package/dist/{chunk-7Q6RBXIV.cjs → chunk-OEQXYWUO.cjs} +22 -5
  31. package/dist/chunk-OEQXYWUO.cjs.map +1 -0
  32. package/dist/{chunk-J4AOAFZF.cjs → chunk-TL2DHSC5.cjs} +11 -297
  33. package/dist/chunk-TL2DHSC5.cjs.map +1 -0
  34. package/dist/chunk-UOLMFC5K.js +846 -0
  35. package/dist/chunk-UOLMFC5K.js.map +1 -0
  36. package/dist/{chunk-DCEI37AX.cjs → chunk-YVIOCITQ.cjs} +3 -3
  37. package/dist/{chunk-DCEI37AX.cjs.map → chunk-YVIOCITQ.cjs.map} +1 -1
  38. package/dist/{chunk-S74WZNK7.js → chunk-ZEIOREJY.js} +5 -36
  39. package/dist/chunk-ZEIOREJY.js.map +1 -0
  40. package/dist/connect/docx.cjs +86 -0
  41. package/dist/connect/docx.cjs.map +1 -0
  42. package/dist/connect/docx.d.ts +1 -0
  43. package/dist/connect/docx.js +84 -0
  44. package/dist/connect/docx.js.map +1 -0
  45. package/dist/connect/index.cjs +136 -69
  46. package/dist/connect/index.cjs.map +1 -1
  47. package/dist/connect/index.d.ts +1 -0
  48. package/dist/connect/index.js +91 -25
  49. package/dist/connect/index.js.map +1 -1
  50. package/dist/connection/ConnectedNativeDocxEditor.d.ts +5 -0
  51. package/dist/connection/useConnectedDocxNotifications.d.ts +9 -0
  52. package/dist/docx/DocxMentions.d.ts +17 -0
  53. package/dist/docx/NativeDocxComparison.d.ts +10 -0
  54. package/dist/docx/NativeDocxEditor.d.ts +50 -0
  55. package/dist/docx/export.d.ts +2 -0
  56. package/dist/docx/fonts.d.ts +2 -0
  57. package/dist/docx/index.cjs +116 -0
  58. package/dist/docx/index.cjs.map +1 -0
  59. package/dist/docx/index.d.ts +10 -0
  60. package/dist/docx/index.js +63 -0
  61. package/dist/docx/index.js.map +1 -0
  62. package/dist/docx/mentions.d.ts +8 -0
  63. package/dist/facts/index.cjs +1 -1
  64. package/dist/facts/index.js +1 -1
  65. package/dist/files/index.cjs +5 -5
  66. package/dist/files/index.js +6 -6
  67. package/dist/index.cjs +795 -794
  68. package/dist/index.cjs.map +1 -1
  69. package/dist/index.js +17 -16
  70. package/dist/index.js.map +1 -1
  71. package/dist/settings/index.cjs +41 -41
  72. package/dist/settings/index.js +4 -4
  73. package/dist/shell/index.cjs +9 -9
  74. package/dist/shell/index.js +1 -1
  75. package/dist/site/index.cjs +13 -13
  76. package/dist/site/index.js +1 -1
  77. package/dist/studio/index.cjs +6 -5
  78. package/dist/studio/index.cjs.map +1 -1
  79. package/dist/studio/index.js +4 -3
  80. package/dist/studio/index.js.map +1 -1
  81. package/dist/workspaces/index.cjs +2 -2
  82. package/dist/workspaces/index.js +2 -2
  83. package/package.json +48 -7
  84. package/src/docx/README.md +68 -0
  85. package/src/docx/styles.css +36 -0
  86. package/dist/chunk-4TBZRZFC.js.map +0 -1
  87. package/dist/chunk-7Q6RBXIV.cjs.map +0 -1
  88. package/dist/chunk-J4AOAFZF.cjs.map +0 -1
  89. package/dist/chunk-PRVKJ5XL.cjs.map +0 -1
  90. package/dist/chunk-QJEJBLHI.js.map +0 -1
  91. package/dist/chunk-S74WZNK7.js.map +0 -1
  92. package/dist/chunk-UVIOQUJA.js.map +0 -1
  93. package/dist/chunk-ZPOLKYR2.cjs.map +0 -1
@@ -4,11 +4,11 @@
4
4
  var chunkXZIYRKLW_cjs = require('../chunk-XZIYRKLW.cjs');
5
5
  var chunkXAJIKT6Y_cjs = require('../chunk-XAJIKT6Y.cjs');
6
6
  var chunkOB5F4577_cjs = require('../chunk-OB5F4577.cjs');
7
+ require('../chunk-C54XEN5T.cjs');
8
+ var chunkKDG6FER6_cjs = require('../chunk-KDG6FER6.cjs');
7
9
  var chunk7G2LJMUG_cjs = require('../chunk-7G2LJMUG.cjs');
8
10
  var chunk2ZTONLT5_cjs = require('../chunk-2ZTONLT5.cjs');
9
11
  require('../chunk-DCDVWPMB.cjs');
10
- require('../chunk-C54XEN5T.cjs');
11
- var chunkKDG6FER6_cjs = require('../chunk-KDG6FER6.cjs');
12
12
  var react = require('react');
13
13
  var lucideReact = require('lucide-react');
14
14
  var ui = require('@arbidocs/react/ui');
@@ -2,11 +2,11 @@
2
2
  import { CollapsibleSection, KeyValueRow } from '../chunk-LGBAZD37.js';
3
3
  import { MemberAvatarStack } from '../chunk-XNOASBGW.js';
4
4
  import { ActionLink } from '../chunk-S7PSMMRG.js';
5
+ import '../chunk-76JDDMSP.js';
6
+ import { fromNow, fmtDate } from '../chunk-OXF2IFXG.js';
5
7
  export { RoleBadge, WorkspaceTypeBadgeView } from '../chunk-NBV56SGU.js';
6
8
  import { ModalHeader } from '../chunk-CPMNAJLF.js';
7
9
  import '../chunk-TJMKFY5P.js';
8
- import '../chunk-76JDDMSP.js';
9
- import { fromNow, fmtDate } from '../chunk-OXF2IFXG.js';
10
10
  import { createContext, useContext, useMemo, useState, useCallback, useId } from 'react';
11
11
  import { FileText, MessagesSquare, Users, Check, ChevronRight, UserPlus, LogOut, AlertCircle, Plus, ArrowUpRight, AlignLeft, Globe, CreditCard, Loader2, FolderLock } from 'lucide-react';
12
12
  import { cn, Button, Dialog, DialogContent, DialogTitle, DialogDescription, Select, SelectTrigger, SelectValue, SelectContent, SelectItem, SelectSeparator, Input } from '@arbidocs/react/ui';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arbidocs/blocks",
3
- "version": "0.4.20",
3
+ "version": "0.4.22",
4
4
  "description": "Composable, domain-neutral UI blocks for ARBI apps, organised by capability (retrieval, facts, agents, workspaces, citations, collaboration) plus shell, theme and site primitives, on top of @arbidocs/react.",
5
5
  "type": "module",
6
6
  "main": "dist/index.cjs",
@@ -112,6 +112,17 @@
112
112
  "types": "./dist/artifacts/editor/index.d.ts",
113
113
  "import": "./dist/artifacts/editor/index.js",
114
114
  "require": "./dist/artifacts/editor/index.cjs"
115
+ },
116
+ "./docx": {
117
+ "types": "./dist/docx/index.d.ts",
118
+ "import": "./dist/docx/index.js",
119
+ "require": "./dist/docx/index.cjs"
120
+ },
121
+ "./docx.css": "./src/docx/styles.css",
122
+ "./connect/docx": {
123
+ "types": "./dist/connect/docx.d.ts",
124
+ "import": "./dist/connect/docx.js",
125
+ "require": "./dist/connect/docx.cjs"
115
126
  }
116
127
  },
117
128
  "typesVersions": {
@@ -172,6 +183,12 @@
172
183
  ],
173
184
  "artifacts/editor": [
174
185
  "./dist/artifacts/editor/index.d.ts"
186
+ ],
187
+ "docx": [
188
+ "./dist/docx/index.d.ts"
189
+ ],
190
+ "connect/docx": [
191
+ "./dist/connect/docx.d.ts"
175
192
  ]
176
193
  }
177
194
  },
@@ -181,7 +198,9 @@
181
198
  "src/blocks.css",
182
199
  "src/studio/studio.css",
183
200
  "src/components/grid.css",
184
- "src/source.css"
201
+ "src/source.css",
202
+ "src/docx/styles.css",
203
+ "src/docx/README.md"
185
204
  ],
186
205
  "scripts": {
187
206
  "build": "rm -rf dist && tsup && tsc -p tsconfig.build.json",
@@ -194,7 +213,7 @@
194
213
  "example:test:e2e": "playwright test -c examples/custom-ui/playwright.config.ts"
195
214
  },
196
215
  "dependencies": {
197
- "@arbidocs/client": "0.4.20",
216
+ "@arbidocs/client": "0.4.22",
198
217
  "@dnd-kit/core": "^6.3.1",
199
218
  "@dnd-kit/sortable": "^10.0.0",
200
219
  "@dnd-kit/utilities": "^3.2.2",
@@ -206,17 +225,23 @@
206
225
  "cmdk": "^1.1.1",
207
226
  "dompurify": "^3.4.7",
208
227
  "lucide-react": "^1.22.0",
209
- "zustand": "^5.0.14"
228
+ "zustand": "^5.0.14",
229
+ "fflate": "^0.8.2",
230
+ "@hocuspocus/provider": "4.6.0"
210
231
  },
211
232
  "peerDependencies": {
212
- "@arbidocs/react": "0.4.20",
233
+ "@arbidocs/react": "0.4.22",
213
234
  "@mdxeditor/editor": "^4.0.4",
214
235
  "@measured/puck": ">=0.20",
215
236
  "@playwright/test": ">=1.40",
216
237
  "@tanstack/react-query": ">=5",
217
238
  "react": ">=18",
218
239
  "react-dom": ">=18",
219
- "react-router-dom": ">=6"
240
+ "react-router-dom": ">=6",
241
+ "@docx-editor.dev/core": "2.27.0",
242
+ "@docx-editor.dev/react": "2.27.0",
243
+ "@docx-editor.dev/pro": "2.27.0",
244
+ "yjs": "^13.6.32"
220
245
  },
221
246
  "peerDependenciesMeta": {
222
247
  "@mdxeditor/editor": {
@@ -233,6 +258,18 @@
233
258
  },
234
259
  "react-router-dom": {
235
260
  "optional": true
261
+ },
262
+ "@docx-editor.dev/core": {
263
+ "optional": true
264
+ },
265
+ "@docx-editor.dev/react": {
266
+ "optional": true
267
+ },
268
+ "@docx-editor.dev/pro": {
269
+ "optional": true
270
+ },
271
+ "yjs": {
272
+ "optional": true
236
273
  }
237
274
  },
238
275
  "devDependencies": {
@@ -248,7 +285,11 @@
248
285
  "react": "^19.2.7",
249
286
  "react-dom": "^19.2.7",
250
287
  "react-router-dom": "^6.30.1",
251
- "vitest": "^4.0.18"
288
+ "vitest": "^4.0.18",
289
+ "@docx-editor.dev/core": "2.27.0",
290
+ "@docx-editor.dev/react": "2.27.0",
291
+ "@docx-editor.dev/pro": "2.27.0",
292
+ "yjs": "^13.6.32"
252
293
  },
253
294
  "license": "MIT",
254
295
  "publishConfig": {
@@ -0,0 +1,68 @@
1
+ # Native DOCX building blocks
2
+
3
+ Import from `@arbidocs/blocks/docx`. This optional entry is separate from the root
4
+ package so apps that do not edit Word files do not load the DOCX engine.
5
+ Install the three `@docx-editor.dev` peer packages at 2.27.0 and `yjs`. The blocks package supplies the Hocuspocus provider.
6
+ The Pro package requires an appropriate production licence.
7
+
8
+ ```tsx
9
+ import {
10
+ NativeDocxEditor, loadDocxFonts, type NativeDocxAdapter,
11
+ } from '@arbidocs/blocks/docx'
12
+ import '@docx-editor.dev/react/styles.css'
13
+ import '@arbidocs/blocks/docx.css'
14
+
15
+ // Keep this adapter stable for the mounted document. Supply your authenticated
16
+ // fetch implementation; `request` paths are relative to ARBI's /v1/editor.
17
+ const adapter: NativeDocxAdapter = {
18
+ request: authenticatedEditorRequest,
19
+ open: id => authenticatedEditorRequest(`/${id}/session`, {
20
+ method: 'POST',
21
+ }).then(r => r.json()),
22
+ save: (id, state) => authenticatedEditorRequest(`/${id}/save`, {
23
+ method: 'POST', headers: { 'Content-Type': 'application/json' },
24
+ body: JSON.stringify({ state }),
25
+ }).then(r => r.json()),
26
+ loadFonts: () => loadDocxFonts('/native-docx/fonts'),
27
+ baseUrl: apiOrigin,
28
+ author: currentUserName,
29
+ onDirtyChange: setNavigationGuard,
30
+ onVersionSaved: refreshDocumentCache,
31
+ subscribeTokenChanges: subscribeToSessionRenewal,
32
+ }
33
+
34
+ <NativeDocxEditor documentId={documentId} title="Contract.docx"
35
+ adapter={adapter} onSaved={openSavedVersion} />
36
+ ```
37
+
38
+ The complete widget handles Yjs/Hocuspocus collaboration, encrypted server
39
+ recovery acknowledgements, reconnects, tracked changes, comments, review actions,
40
+ immutable Save version, DOCX download, read-only snapshots, and new Word notes.
41
+ Use `snapshot` for immutable history/compare documents. Supply `draftContent`
42
+ for a new note; `/prepare` converts its initial content and `/notes` saves DOCX.
43
+
44
+ Fonts are supplied by the host: either provide your own `FontConfiguration`, or
45
+ serve the twelve Liberation TTF files used by `loadDocxFonts`. The ARBI app serves
46
+ these at `/native-docx/fonts`; this library does not assume a consumer's asset
47
+ server or copy assets automatically.
48
+
49
+ For custom layouts, the same entry exports `DocxRibbon`, `DocxParticipants`,
50
+ `DocxEditor` compound primitives, `DocxEditorReview`, editor/review hooks and
51
+ `createHocuspocusCollaboration`. Mount the ribbon within `DocxEditor.Root` and the
52
+ review UI inside `DocxEditor.Viewport`. There are no imports from the ARBI app,
53
+ Zustand stores, app routing, notification singletons, or app query keys.
54
+
55
+ Backend services are still required: ARBI native editor endpoints, one
56
+ Hocuspocus room owner and object storage; LibreOffice provides document compare.
57
+ Workspace people and agents are available through the adapter's `mentions` and
58
+ `requestAgent` callbacks. `@ARBI` wakes the managed assistant; replies remain in
59
+ the originating comment thread. `ConnectedNativeDocxEditor` from `@arbidocs/blocks/connect/docx` supplies these
60
+ callbacks using the blocks connection and authenticated SDK, including normal
61
+ session recovery. Import the same two stylesheets and serve the document fonts.
62
+ For a prompt panel, pass `activeArtifactExtId: documentId` to
63
+ `useConnectedAiTask().run(prompt, [], options)`; the backend edits the live DOCX
64
+ with tracked operations and refuses stale targets.
65
+
66
+ `NativeDocxComparison` uses the same adapter and native editor for the LibreOffice
67
+ Word redline. Pass `baseId`, `revisedId`, `title` and optionally `onCompared` to
68
+ refresh only the generated document in your host cache. Source files stay intact.
@@ -0,0 +1,36 @@
1
+ .native-docx-viewer{position:relative;height:100%;min-height:0;display:flex;flex-direction:column;background:var(--background);color:var(--foreground);font:inherit}
2
+ .native-docx-body{display:flex;flex:1;flex-direction:column;min-height:0;overflow:hidden}
3
+ .native-docx-body .docx-toolbar{flex:none;width:100%;margin:0;border-radius:0;border-width:0 0 1px;padding:4px 8px;background:var(--background);box-shadow:none}
4
+ .native-docx-stage{position:relative;flex:1;min-height:0;overflow:hidden}
5
+ .native-docx-viewport{height:100%;padding-top:8px;padding-bottom:64px;background:var(--muted)}
6
+ .native-docx-body .docx-paginated-surface{margin-top:0;margin-bottom:0}
7
+ .native-docx-actions{position:absolute;z-index:30;right:12px;bottom:12px;left:12px;display:flex;align-items:center;gap:8px;pointer-events:none;font-size:11px}
8
+ .native-docx-actions>*{pointer-events:auto;flex-shrink:0}
9
+ .native-docx-actions .native-docx-status{margin-right:auto;display:flex;align-items:center;gap:5px;max-width:45%;padding:6px 8px;border:1px solid var(--border);border-radius:8px;background:var(--background);color:var(--muted-foreground);box-shadow:0 2px 8px #0000000a}
10
+ .native-docx-actions button{display:inline-flex;align-items:center;gap:5px;padding:6px 8px;border:1px solid var(--border);border-radius:8px;background:var(--background);cursor:pointer;font:inherit;box-shadow:0 2px 8px #0000000a}
11
+ .native-docx-actions button:hover{background:var(--muted)}.native-docx-actions button:disabled{opacity:.5;cursor:default}.native-docx-actions button:focus-visible{outline:2px solid var(--ring);outline-offset:2px}
12
+ .native-docx-actions .native-docx-save{background:#285c4b;color:white;border-color:#285c4b}
13
+ .native-docx-presence{display:flex;gap:4px}.native-docx-avatar{display:grid;place-items:center;width:24px;height:24px;border-radius:50%;background:#d7e9e0;color:#285c4b;font-size:10px}
14
+ .native-docx-error{padding:24px;display:grid;gap:12px;color:var(--foreground)}
15
+ .native-docx-notice{position:absolute;z-index:40;top:48px;left:12px;right:12px;padding:8px 12px;font-size:11px;border-radius:8px;background:#fff6e5;color:#76572f;box-shadow:0 2px 10px #00000014}.native-docx-notice[data-error=true]{background:#fff0ef;color:#a23832}
16
+ .native-docx-body .docx-review__card{font-family:inherit}
17
+ @media(max-width:600px){.native-docx-actions{right:8px;left:8px;gap:5px}.native-docx-actions .native-docx-status{font-size:10px;padding:5px;max-width:40%}.native-docx-actions button{padding:6px}.native-docx-presence{display:none}}
18
+
19
+ /* Review controls overlay the page, matching the other ARBI viewers. */
20
+ .native-docx-body .native-docx-viewport[data-review-pane]{padding-inline:8px;scrollbar-gutter:stable;transition:none}
21
+ .native-docx-viewport .docx-review{left:auto!important;right:8px!important}
22
+ .native-docx-stage .docx-editor__page-number{top:auto;bottom:56px;right:12px;transform:none}
23
+
24
+ .native-docx-ribbon{display:flex;align-items:center;flex:none;min-width:0;border-bottom:1px solid var(--border);background:var(--background)}
25
+ .native-docx-ribbon>select{flex:none;width:76px;margin:4px;padding:6px 4px;border:0;border-radius:4px;background:var(--muted);color:var(--foreground);font:inherit;font-size:12px;cursor:pointer}
26
+ .native-docx-body .native-docx-ribbon .docx-toolbar{min-width:0;flex:1;width:auto;border:0;overflow:visible;flex-wrap:nowrap}
27
+ .native-docx-ribbon .docx-toolbar>*{flex-shrink:0}
28
+
29
+ .native-docx-ribbon{position:relative;z-index:35}
30
+ .native-docx-ribbon>select{width:64px;margin-inline:2px}
31
+ .native-docx-ribbon .docx-toolbar{gap:2px}
32
+ .native-docx-ribbon-menu{position:static;display:flex;align-items:center}
33
+ .native-docx-ribbon-trigger{display:grid;place-items:center;width:28px;height:28px;border:0;border-radius:4px;background:transparent;color:inherit;cursor:pointer}
34
+ .native-docx-ribbon-trigger:hover,.native-docx-ribbon-trigger[aria-expanded=true]{background:var(--muted)}
35
+ .native-docx-ribbon-popover{position:absolute;top:100%;right:8px;display:flex;align-items:center;flex-wrap:wrap;gap:8px;width:270px;max-width:calc(100% - 16px);padding:12px;border:1px solid var(--border);border-radius:8px;background:var(--background);box-shadow:0 4px 16px #0002}
36
+ .native-docx-ribbon .docx-toolbar__button{width:28px;min-width:28px;padding-inline:4px}