@arbidocs/blocks 0.4.4 → 0.4.5
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.
- package/README.md +25 -0
- package/dist/agents/index.cjs +163 -163
- package/dist/agents/index.js +6 -6
- package/dist/artifacts/ArtifactCompareBar.d.ts +33 -0
- package/dist/artifacts/ArtifactEditor.d.ts +64 -0
- package/dist/artifacts/ArtifactEditorBody.d.ts +34 -0
- package/dist/artifacts/ArtifactRedlineView.d.ts +57 -0
- package/dist/artifacts/ArtifactToolbar.d.ts +53 -0
- package/dist/artifacts/ArtifactVersionBar.d.ts +42 -0
- package/dist/{files → artifacts}/RedlineParts.d.ts +4 -0
- package/dist/artifacts/editor/ArtifactMarkdownEditor.d.ts +39 -0
- package/dist/artifacts/editor/index.cjs +89 -0
- package/dist/artifacts/editor/index.cjs.map +1 -0
- package/dist/artifacts/editor/index.d.ts +1 -0
- package/dist/artifacts/editor/index.js +86 -0
- package/dist/artifacts/editor/index.js.map +1 -0
- package/dist/artifacts/index.cjs +807 -0
- package/dist/artifacts/index.cjs.map +1 -0
- package/dist/artifacts/index.d.ts +8 -0
- package/dist/artifacts/index.js +787 -0
- package/dist/artifacts/index.js.map +1 -0
- package/dist/chat/index.cjs +54 -54
- package/dist/chat/index.js +2 -2
- package/dist/{chunk-XKKGGUU2.cjs → chunk-3MIQASHO.cjs} +4 -4
- package/dist/{chunk-XKKGGUU2.cjs.map → chunk-3MIQASHO.cjs.map} +1 -1
- package/dist/{chunk-B673CCW5.js → chunk-3PJCET7H.js} +3 -3
- package/dist/{chunk-B673CCW5.js.map → chunk-3PJCET7H.js.map} +1 -1
- package/dist/{chunk-DGVKBOY5.cjs → chunk-3PZPRAAR.cjs} +14 -14
- package/dist/{chunk-DGVKBOY5.cjs.map → chunk-3PZPRAAR.cjs.map} +1 -1
- package/dist/{chunk-BBEMPS6C.js → chunk-5XTZFH65.js} +6 -6
- package/dist/{chunk-BBEMPS6C.js.map → chunk-5XTZFH65.js.map} +1 -1
- package/dist/{chunk-JPO3F4J7.js → chunk-6YHWXMPQ.js} +3 -3
- package/dist/{chunk-JPO3F4J7.js.map → chunk-6YHWXMPQ.js.map} +1 -1
- package/dist/{chunk-ZVPTFTGV.cjs → chunk-MVNCQDDE.cjs} +4 -4
- package/dist/{chunk-ZVPTFTGV.cjs.map → chunk-MVNCQDDE.cjs.map} +1 -1
- package/dist/{chunk-NJL4LIXX.js → chunk-NPKGUQU5.js} +4 -4
- package/dist/{chunk-NJL4LIXX.js.map → chunk-NPKGUQU5.js.map} +1 -1
- package/dist/{chunk-ATXPAD6S.cjs → chunk-YLOKCIQJ.cjs} +3 -3
- package/dist/{chunk-ATXPAD6S.cjs.map → chunk-YLOKCIQJ.cjs.map} +1 -1
- package/dist/connect/index.cjs +18 -18
- package/dist/connect/index.js +4 -4
- package/dist/facts/index.cjs +1 -1
- package/dist/facts/index.js +1 -1
- package/dist/files/ViewerChrome.d.ts +0 -45
- package/dist/files/ViewerParts.d.ts +0 -19
- package/dist/files/index.cjs +4 -436
- package/dist/files/index.cjs.map +1 -1
- package/dist/files/index.d.ts +2 -4
- package/dist/files/index.js +8 -428
- package/dist/files/index.js.map +1 -1
- package/dist/home/index.cjs +19 -19
- package/dist/home/index.js +4 -4
- package/dist/index.cjs +415 -415
- package/dist/index.js +14 -14
- package/dist/settings/index.cjs +3 -3
- package/dist/settings/index.js +4 -4
- package/dist/shell/index.cjs +10 -10
- package/dist/shell/index.js +2 -2
- package/dist/site/index.cjs +5 -5
- package/dist/site/index.js +1 -1
- package/dist/studio/index.cjs +8 -8
- package/dist/studio/index.js +6 -6
- package/package.json +25 -4
- /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` |
|
|
@@ -112,6 +114,29 @@ const { isDockAvailable } = useChatSurface()
|
|
|
112
114
|
```
|
|
113
115
|
|
|
114
116
|
Theme the user bubble with `--chat-user-bubble` and `--chat-user-bubble-foreground` (HSL triplets).
|
|
117
|
+
## Edit an artifact, save versions, compare
|
|
118
|
+
|
|
119
|
+
`/artifacts` is the surface for an AI-drafted document the user may edit: a toolbar (Edit, Cancel,
|
|
120
|
+
Compare, Save as a new version), a version bar ("Version 2 of 3", a list, Compare with previous),
|
|
121
|
+
and Word-style track changes between two versions with a per-change undo. It is presentational:
|
|
122
|
+
state comes from `useArtifactSession` in `@arbidocs/react/artifacts`, and the editor and redline are
|
|
123
|
+
slots.
|
|
124
|
+
|
|
125
|
+
```tsx
|
|
126
|
+
import { ArtifactEditor, ArtifactRedlineView } from '@arbidocs/blocks/artifacts'
|
|
127
|
+
import { ArtifactMarkdownEditor } from '@arbidocs/blocks/artifacts/editor'
|
|
128
|
+
import { renderArtifactMarkdown, useArtifactSession } from '@arbidocs/react/artifacts'
|
|
129
|
+
import '@mdxeditor/editor/style.css'
|
|
130
|
+
|
|
131
|
+
const s = useArtifactSession({ workspaceId, docId, onSaved: ({ docId: next }) => next && open(next) })
|
|
132
|
+
<ArtifactEditor {...s.view} onOpenVersion={open} renderMarkdown={renderArtifactMarkdown}
|
|
133
|
+
editor={<ArtifactMarkdownEditor {...s.editorProps} />}
|
|
134
|
+
redline={<ArtifactRedlineView {...s.redlineProps} renderMarkdown={renderArtifactMarkdown} />} />
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
Every part takes `labels` and `testIds`; Mod+S saves while editing; touch targets are 44px. The
|
|
138
|
+
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.
|
|
139
|
+
See `examples/custom-ui/ArtifactPage.tsx` for a custom editing surface on in-memory data.
|
|
115
140
|
|
|
116
141
|
## Editorial site parts
|
|
117
142
|
|