@arbidocs/blocks 0.4.4 → 0.4.6

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 (149) hide show
  1. package/README.md +71 -6
  2. package/dist/agents/index.cjs +163 -162
  3. package/dist/agents/index.js +6 -5
  4. package/dist/artifacts/ArtifactCompareBar.d.ts +33 -0
  5. package/dist/artifacts/ArtifactEditor.d.ts +64 -0
  6. package/dist/artifacts/ArtifactEditorBody.d.ts +34 -0
  7. package/dist/artifacts/ArtifactRedlineView.d.ts +57 -0
  8. package/dist/artifacts/ArtifactToolbar.d.ts +53 -0
  9. package/dist/artifacts/ArtifactVersionBar.d.ts +42 -0
  10. package/dist/{files → artifacts}/RedlineParts.d.ts +4 -0
  11. package/dist/artifacts/editor/ArtifactMarkdownEditor.d.ts +39 -0
  12. package/dist/artifacts/editor/index.cjs +89 -0
  13. package/dist/artifacts/editor/index.cjs.map +1 -0
  14. package/dist/artifacts/editor/index.d.ts +1 -0
  15. package/dist/artifacts/editor/index.js +86 -0
  16. package/dist/artifacts/editor/index.js.map +1 -0
  17. package/dist/artifacts/index.cjs +807 -0
  18. package/dist/artifacts/index.cjs.map +1 -0
  19. package/dist/artifacts/index.d.ts +8 -0
  20. package/dist/artifacts/index.js +787 -0
  21. package/dist/artifacts/index.js.map +1 -0
  22. package/dist/chat/ChatMessageContent.d.ts +16 -0
  23. package/dist/chat/ChatPage.d.ts +11 -8
  24. package/dist/chat/ChatThreads.d.ts +3 -1
  25. package/dist/chat/CitationMark.d.ts +18 -0
  26. package/dist/chat/chat-page-types.d.ts +75 -1
  27. package/dist/chat/index.cjs +125 -116
  28. package/dist/chat/index.d.ts +3 -1
  29. package/dist/chat/index.js +4 -3
  30. package/dist/{chunk-XKKGGUU2.cjs → chunk-23XL6SVZ.cjs} +39 -19
  31. package/dist/chunk-23XL6SVZ.cjs.map +1 -0
  32. package/dist/{chunk-ULWRNGGE.cjs → chunk-2ZTONLT5.cjs} +4 -25
  33. package/dist/chunk-2ZTONLT5.cjs.map +1 -0
  34. package/dist/{chunk-O637DUKS.cjs → chunk-56BUD74K.cjs} +28 -28
  35. package/dist/{chunk-O637DUKS.cjs.map → chunk-56BUD74K.cjs.map} +1 -1
  36. package/dist/{chunk-ATXPAD6S.cjs → chunk-5SLLMK5K.cjs} +420 -114
  37. package/dist/chunk-5SLLMK5K.cjs.map +1 -0
  38. package/dist/{chunk-SS23F63U.cjs → chunk-5ZBP7TCD.cjs} +55 -3
  39. package/dist/chunk-5ZBP7TCD.cjs.map +1 -0
  40. package/dist/{chunk-DGVKBOY5.cjs → chunk-67HGXV4I.cjs} +6 -6
  41. package/dist/{chunk-DGVKBOY5.cjs.map → chunk-67HGXV4I.cjs.map} +1 -1
  42. package/dist/{chunk-RCP6THBS.js → chunk-7OCFHEE6.js} +3 -3
  43. package/dist/{chunk-RCP6THBS.js.map → chunk-7OCFHEE6.js.map} +1 -1
  44. package/dist/{chunk-TX2ZICS7.js → chunk-CPMNAJLF.js} +4 -24
  45. package/dist/chunk-CPMNAJLF.js.map +1 -0
  46. package/dist/{chunk-BBEMPS6C.js → chunk-CVFBSUXL.js} +5 -5
  47. package/dist/{chunk-BBEMPS6C.js.map → chunk-CVFBSUXL.js.map} +1 -1
  48. package/dist/chunk-DCDVWPMB.cjs +29 -0
  49. package/dist/chunk-DCDVWPMB.cjs.map +1 -0
  50. package/dist/{chunk-TI4UTYRL.js → chunk-EY2RJW27.js} +258 -10
  51. package/dist/chunk-EY2RJW27.js.map +1 -0
  52. package/dist/{chunk-7YADKWZT.js → chunk-G2E3O3HI.js} +3 -3
  53. package/dist/{chunk-7YADKWZT.js.map → chunk-G2E3O3HI.js.map} +1 -1
  54. package/dist/{chunk-JPO3F4J7.js → chunk-G2T3KTZ3.js} +418 -114
  55. package/dist/chunk-G2T3KTZ3.js.map +1 -0
  56. package/dist/{chunk-2NNTQLBY.js → chunk-IAKUTBPX.js} +4 -4
  57. package/dist/{chunk-2NNTQLBY.js.map → chunk-IAKUTBPX.js.map} +1 -1
  58. package/dist/{chunk-IZHWP6WQ.cjs → chunk-JG4TFS3Z.cjs} +6 -6
  59. package/dist/{chunk-IZHWP6WQ.cjs.map → chunk-JG4TFS3Z.cjs.map} +1 -1
  60. package/dist/chunk-JLOYWXRB.js +1156 -0
  61. package/dist/chunk-JLOYWXRB.js.map +1 -0
  62. package/dist/{chunk-WJZBJUPX.js → chunk-KXMDOTGW.js} +56 -4
  63. package/dist/chunk-KXMDOTGW.js.map +1 -0
  64. package/dist/{chunk-2VBJ763Y.js → chunk-KZJAG7T3.js} +37 -7
  65. package/dist/chunk-KZJAG7T3.js.map +1 -0
  66. package/dist/{chunk-RIL7G7AS.cjs → chunk-MGUHR3JI.cjs} +4 -4
  67. package/dist/{chunk-RIL7G7AS.cjs.map → chunk-MGUHR3JI.cjs.map} +1 -1
  68. package/dist/{chunk-DN3NFNIA.cjs → chunk-QMDLPO3M.cjs} +266 -10
  69. package/dist/chunk-QMDLPO3M.cjs.map +1 -0
  70. package/dist/chunk-TJMKFY5P.js +27 -0
  71. package/dist/chunk-TJMKFY5P.js.map +1 -0
  72. package/dist/{chunk-B673CCW5.js → chunk-UHVNYKV2.js} +38 -18
  73. package/dist/chunk-UHVNYKV2.js.map +1 -0
  74. package/dist/{chunk-6CHMNKXC.cjs → chunk-UTYQPVIW.cjs} +11 -11
  75. package/dist/chunk-UTYQPVIW.cjs.map +1 -0
  76. package/dist/{chunk-KHX2BX3S.cjs → chunk-VGOFFCMT.cjs} +37 -5
  77. package/dist/chunk-VGOFFCMT.cjs.map +1 -0
  78. package/dist/{chunk-67MKU5U7.js → chunk-YMHGF6R5.js} +8 -8
  79. package/dist/chunk-YMHGF6R5.js.map +1 -0
  80. package/dist/chunk-YVIOCITQ.cjs +1186 -0
  81. package/dist/chunk-YVIOCITQ.cjs.map +1 -0
  82. package/dist/collaboration/index.cjs +38 -37
  83. package/dist/collaboration/index.js +3 -2
  84. package/dist/connect/index.cjs +358 -19
  85. package/dist/connect/index.cjs.map +1 -1
  86. package/dist/connect/index.d.ts +1 -0
  87. package/dist/connect/index.js +341 -9
  88. package/dist/connect/index.js.map +1 -1
  89. package/dist/connection/ConnectedSettings.d.ts +64 -0
  90. package/dist/facts/index.cjs +1 -1
  91. package/dist/facts/index.js +1 -1
  92. package/dist/files/ViewerChrome.d.ts +0 -45
  93. package/dist/files/ViewerParts.d.ts +0 -19
  94. package/dist/files/index.cjs +15 -446
  95. package/dist/files/index.cjs.map +1 -1
  96. package/dist/files/index.d.ts +2 -4
  97. package/dist/files/index.js +9 -428
  98. package/dist/files/index.js.map +1 -1
  99. package/dist/home/index.cjs +1 -1
  100. package/dist/home/index.js +1 -1
  101. package/dist/index.cjs +634 -585
  102. package/dist/index.cjs.map +1 -1
  103. package/dist/index.js +19 -18
  104. package/dist/index.js.map +1 -1
  105. package/dist/lib/bottom-inset.d.ts +16 -0
  106. package/dist/lib/useElementSize.d.ts +13 -0
  107. package/dist/lib/useFillHeight.d.ts +10 -0
  108. package/dist/settings/account-views.d.ts +55 -0
  109. package/dist/settings/index.cjs +178 -1147
  110. package/dist/settings/index.cjs.map +1 -1
  111. package/dist/settings/index.d.ts +1 -0
  112. package/dist/settings/index.js +9 -1072
  113. package/dist/settings/index.js.map +1 -1
  114. package/dist/shell/InstallPrompt.d.ts +28 -0
  115. package/dist/shell/MobileBars.d.ts +1 -1
  116. package/dist/shell/index.cjs +92 -52
  117. package/dist/shell/index.d.ts +4 -0
  118. package/dist/shell/index.js +4 -4
  119. package/dist/shell/install-instructions.d.ts +19 -0
  120. package/dist/shell/types.d.ts +6 -0
  121. package/dist/shell/use-install-prompt.d.ts +49 -0
  122. package/dist/site/index.cjs +67 -67
  123. package/dist/site/index.js +3 -3
  124. package/dist/studio/index.cjs +79 -78
  125. package/dist/studio/index.cjs.map +1 -1
  126. package/dist/studio/index.js +9 -8
  127. package/dist/studio/index.js.map +1 -1
  128. package/dist/theme/ThemeEditor.d.ts +4 -2
  129. package/dist/workspaces/index.cjs +4 -3
  130. package/dist/workspaces/index.cjs.map +1 -1
  131. package/dist/workspaces/index.js +3 -2
  132. package/dist/workspaces/index.js.map +1 -1
  133. package/package.json +30 -5
  134. package/src/blocks.css +30 -0
  135. package/dist/chunk-2VBJ763Y.js.map +0 -1
  136. package/dist/chunk-67MKU5U7.js.map +0 -1
  137. package/dist/chunk-6CHMNKXC.cjs.map +0 -1
  138. package/dist/chunk-ATXPAD6S.cjs.map +0 -1
  139. package/dist/chunk-B673CCW5.js.map +0 -1
  140. package/dist/chunk-DN3NFNIA.cjs.map +0 -1
  141. package/dist/chunk-JPO3F4J7.js.map +0 -1
  142. package/dist/chunk-KHX2BX3S.cjs.map +0 -1
  143. package/dist/chunk-SS23F63U.cjs.map +0 -1
  144. package/dist/chunk-TI4UTYRL.js.map +0 -1
  145. package/dist/chunk-TX2ZICS7.js.map +0 -1
  146. package/dist/chunk-ULWRNGGE.cjs.map +0 -1
  147. package/dist/chunk-WJZBJUPX.js.map +0 -1
  148. package/dist/chunk-XKKGGUU2.cjs.map +0 -1
  149. /package/dist/{files → artifacts}/VersionTimeline.d.ts +0 -0
package/README.md CHANGED
@@ -65,6 +65,8 @@ Every capability is its own entry, so a bundler only loads what you use:
65
65
  | `@arbidocs/blocks` | Light root: theme, primitives, chat, shell, auth, retrieval, agents, citations, collaboration, site blocks | none (zustand, dompurify) |
66
66
  | `/chat`, `/shell`, `/auth`, `/retrieval`, `/citations`, `/collaboration`, `/agents`, `/timeline`, `/site` | one capability each | none |
67
67
  | `/files`, `/facts` | document grid, facts table | `ag-grid-*` |
68
+ | `/artifacts` | artifact editor, version bar, track changes | none |
69
+ | `/artifacts/editor` | rich-text (markdown) editing surface | `@mdxeditor/editor` (optional peer) |
68
70
  | `/home`, `/workspaces` | dashboard, workspace cards and forms | `@dnd-kit/*` |
69
71
  | `/settings` | settings, billing, modals | `cmdk` |
70
72
  | `/connect` | demo/live connection layer | `@tanstack/react-query` |
@@ -94,24 +96,57 @@ import { PassagePill } from '@arbidocs/blocks/citations'
94
96
 
95
97
  ## Assistant chat page
96
98
 
97
- `ChatPage` (`@arbidocs/blocks/chat`) is a whole assistant chat: conversations with auto-titles, markdown
98
- answers, composer with a document chip and upload, empty, error and retry states, plus `header` and `aside`
99
- (workflow launcher) slots. It sizes to its container, so it holds up beside an open dock. Bind it with the
100
- `@arbidocs/react` hook:
99
+ `ChatPage` (`@arbidocs/blocks/chat`) is a whole assistant chat: the workspace's stored conversations (backend
100
+ titles, history loads on open), markdown answers whose citations are quiet numbered marks with a source popover
101
+ (document, page, passage, an open action through `onOpenCitation`), composer with a document chip, upload and a stop
102
+ button, empty, error and retry states, plus `header` and `aside` (workflow launcher) slots. It lays itself out by
103
+ its own width (`asideBreakpoint`, default 60rem: column above, one floating panel below) and has `fillHeight` /
104
+ `compactHeader` for a chat card under a page header. Bind it with the `@arbidocs/react` hook:
101
105
 
102
106
  ```tsx
103
107
  import { ChatPage, useChatSurface } from '@arbidocs/blocks/chat'
104
108
  import { useConnectedChat } from '@arbidocs/blocks/connect' // or useArbiChat({ workspaceId }) from @arbidocs/react
105
109
 
106
110
  const chat = useConnectedChat()
107
- <ChatPage chat={chat} header={<h2>Assistant</h2>} aside={<WorkflowLauncher … />} />
111
+ <ChatPage
112
+ chat={chat}
113
+ fillHeight compactHeader
114
+ onOpenCitation={(t) => openDocument(t.documentId, t.page)}
115
+ aside={<WorkflowLauncher … />}
116
+ />
108
117
 
109
118
  // The dock yields to a mounted page chat:
110
119
  const { isDockAvailable } = useChatSurface()
111
120
  {isDockAvailable && <MyDock />}
112
121
  ```
113
122
 
114
- Theme the user bubble with `--chat-user-bubble` and `--chat-user-bubble-foreground` (HSL triplets).
123
+ Theme the user bubble with `--chat-user-bubble` and `--chat-user-bubble-foreground` (HSL triplets). The
124
+ live example (`examples/react-chat`, sign in, pick a workspace, chat) and the mock-data
125
+ `packages/arbi-blocks/examples/custom-ui` (`npm run example:dev`) both mount it.
126
+
127
+ ## Edit an artifact, save versions, compare
128
+
129
+ `/artifacts` is the surface for an AI-drafted document the user may edit: a toolbar (Edit, Cancel,
130
+ Compare, Save as a new version), a version bar ("Version 2 of 3", a list, Compare with previous),
131
+ and Word-style track changes between two versions with a per-change undo. It is presentational:
132
+ state comes from `useArtifactSession` in `@arbidocs/react/artifacts`, and the editor and redline are
133
+ slots.
134
+
135
+ ```tsx
136
+ import { ArtifactEditor, ArtifactRedlineView } from '@arbidocs/blocks/artifacts'
137
+ import { ArtifactMarkdownEditor } from '@arbidocs/blocks/artifacts/editor'
138
+ import { renderArtifactMarkdown, useArtifactSession } from '@arbidocs/react/artifacts'
139
+ import '@mdxeditor/editor/style.css'
140
+
141
+ const s = useArtifactSession({ workspaceId, docId, onSaved: ({ docId: next }) => next && open(next) })
142
+ <ArtifactEditor {...s.view} onOpenVersion={open} renderMarkdown={renderArtifactMarkdown}
143
+ editor={<ArtifactMarkdownEditor {...s.editorProps} />}
144
+ redline={<ArtifactRedlineView {...s.redlineProps} renderMarkdown={renderArtifactMarkdown} />} />
145
+ ```
146
+
147
+ Every part takes `labels` and `testIds`; Mod+S saves while editing; touch targets are 44px. The
148
+ editor needs `@mdxeditor/editor` (optional peer) and is heavy (mount it behind `lazy`) and needs the global `Prism` defined before it loads (`@lexical/code` reads it while it evaluates): in the module that lazily imports the editor, import first a side-effect module with `import Prism from 'prismjs'; globalThis.Prism = Prism`. A library cannot order that reliably across bundlers.
149
+ See `examples/custom-ui/ArtifactPage.tsx` for a custom editing surface on in-memory data.
115
150
 
116
151
  ## Editorial site parts
117
152
 
@@ -135,6 +170,36 @@ import { EditorialHero, EditorialSection, PanelGrid, CtaBand } from '@arbidocs/b
135
170
  See `examples/custom-ui/MarketingPage.tsx` for a full page and `docs/design/blocks-package.md` for
136
171
  the part table.
137
172
 
173
+ ## Phone shell: tab bar, install prompt, bottom inset
174
+
175
+ ```tsx
176
+ import { InstallPrompt, MobileTabBar, Shell } from '@arbidocs/blocks/shell'
177
+
178
+ const items: NavItem[] = [
179
+ { id: 'chat', label: 'AI Assistant', shortLabel: 'Assistant', icon: <Chat />, onSelect },
180
+ // ...
181
+ ]
182
+ <Shell.Root tabBar={<MobileTabBar items={items} />} overlays={<InstallPrompt appName="Clarum" />}>
183
+ ```
184
+
185
+ - `MobileTabBar` labels wrap at word boundaries and are never ellipsised. Give an item a `shortLabel`
186
+ and a tab narrower than 5.5rem shows it (the full label stays the accessible name).
187
+ - `InstallPrompt` is a floating "Install app" pill: shown only when the browser fired
188
+ `beforeinstallprompt` (or on iOS, where it expands the Add to Home Screen steps), not when already
189
+ installed, dismissible with the dismissal remembered (`dismissDays`, default 30). Both targets are
190
+ 44px on a phone. `useInstallPrompt()` / `initInstallPrompt()` / `getInstallInstructions()` are the
191
+ headless parts (call `initInstallPrompt()` at app start so the one-shot event is not missed).
192
+ `autoPromptParam="install"` makes `/?install=true` open the native dialog.
193
+ - `--shell-bottom-inset` (on `<html>`) is how far the bottom bars reach up from the screen edge:
194
+ `MobileTabBar` and `Composer.Root` publish it (`useShellBottomInset(ref)` for your own bar). The
195
+ install prompt, and anything else floating at the bottom, positions itself with
196
+ `calc(var(--shell-bottom-inset, 0px) + 0.75rem)` so it never covers a tab label or the composer.
197
+ - Scroll containers use the `scrollbar-themed` utility class from `blocks.css` (thin, token-coloured;
198
+ override with `--scrollbar-thumb` / `--scrollbar-track`). Sidebar, dialogs and the chat list have it.
199
+ - Browser check: `npm run example:dev` (add `-- --port 5331`), or `npm run example:build` then
200
+ `npm run example:preview`; `npm run example:test:e2e` measures the example at 360 and 390px
201
+ against the production build.
202
+
138
203
  ## Workspaces: gallery and switcher in a few lines
139
204
 
140
205
  ```tsx