@arbidocs/blocks 0.4.3 → 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.
Files changed (83) hide show
  1. package/README.md +25 -0
  2. package/dist/agents/definitions/AgentCreator.d.ts +11 -2
  3. package/dist/agents/definitions/index.d.ts +1 -0
  4. package/dist/agents/definitions/persona.d.ts +16 -0
  5. package/dist/agents/index.cjs +202 -150
  6. package/dist/agents/index.js +6 -6
  7. package/dist/agents/tasks/TaskRunsDialog.d.ts +15 -3
  8. package/dist/agents/tasks/index.d.ts +1 -0
  9. package/dist/agents/tasks/taskRequest.d.ts +61 -0
  10. package/dist/artifacts/ArtifactCompareBar.d.ts +33 -0
  11. package/dist/artifacts/ArtifactEditor.d.ts +64 -0
  12. package/dist/artifacts/ArtifactEditorBody.d.ts +34 -0
  13. package/dist/artifacts/ArtifactRedlineView.d.ts +57 -0
  14. package/dist/artifacts/ArtifactToolbar.d.ts +53 -0
  15. package/dist/artifacts/ArtifactVersionBar.d.ts +42 -0
  16. package/dist/{files → artifacts}/RedlineParts.d.ts +4 -0
  17. package/dist/artifacts/editor/ArtifactMarkdownEditor.d.ts +39 -0
  18. package/dist/artifacts/editor/index.cjs +89 -0
  19. package/dist/artifacts/editor/index.cjs.map +1 -0
  20. package/dist/artifacts/editor/index.d.ts +1 -0
  21. package/dist/artifacts/editor/index.js +86 -0
  22. package/dist/artifacts/editor/index.js.map +1 -0
  23. package/dist/artifacts/index.cjs +807 -0
  24. package/dist/artifacts/index.cjs.map +1 -0
  25. package/dist/artifacts/index.d.ts +8 -0
  26. package/dist/artifacts/index.js +787 -0
  27. package/dist/artifacts/index.js.map +1 -0
  28. package/dist/chat/index.cjs +54 -54
  29. package/dist/chat/index.js +2 -2
  30. package/dist/{chunk-XKKGGUU2.cjs → chunk-3MIQASHO.cjs} +4 -4
  31. package/dist/{chunk-XKKGGUU2.cjs.map → chunk-3MIQASHO.cjs.map} +1 -1
  32. package/dist/{chunk-B673CCW5.js → chunk-3PJCET7H.js} +3 -3
  33. package/dist/{chunk-B673CCW5.js.map → chunk-3PJCET7H.js.map} +1 -1
  34. package/dist/{chunk-VXOGANFJ.cjs → chunk-3PZPRAAR.cjs} +189 -34
  35. package/dist/chunk-3PZPRAAR.cjs.map +1 -0
  36. package/dist/{chunk-AAY5ASZD.js → chunk-5XTZFH65.js} +170 -28
  37. package/dist/chunk-5XTZFH65.js.map +1 -0
  38. package/dist/{chunk-JPO3F4J7.js → chunk-6YHWXMPQ.js} +3 -3
  39. package/dist/{chunk-JPO3F4J7.js.map → chunk-6YHWXMPQ.js.map} +1 -1
  40. package/dist/{chunk-TYZUCAT7.js → chunk-7YADKWZT.js} +43 -6
  41. package/dist/chunk-7YADKWZT.js.map +1 -0
  42. package/dist/{chunk-SYDHKKRZ.cjs → chunk-IZHWP6WQ.cjs} +47 -5
  43. package/dist/chunk-IZHWP6WQ.cjs.map +1 -0
  44. package/dist/{chunk-ZVPTFTGV.cjs → chunk-MVNCQDDE.cjs} +4 -4
  45. package/dist/{chunk-ZVPTFTGV.cjs.map → chunk-MVNCQDDE.cjs.map} +1 -1
  46. package/dist/{chunk-NJL4LIXX.js → chunk-NPKGUQU5.js} +4 -4
  47. package/dist/{chunk-NJL4LIXX.js.map → chunk-NPKGUQU5.js.map} +1 -1
  48. package/dist/{chunk-ATXPAD6S.cjs → chunk-YLOKCIQJ.cjs} +3 -3
  49. package/dist/{chunk-ATXPAD6S.cjs.map → chunk-YLOKCIQJ.cjs.map} +1 -1
  50. package/dist/collaboration/contacts/AddContactsParts.d.ts +9 -4
  51. package/dist/collaboration/contacts/index.d.ts +1 -0
  52. package/dist/collaboration/contacts/parseEmails.d.ts +26 -0
  53. package/dist/collaboration/index.cjs +51 -31
  54. package/dist/collaboration/index.js +1 -1
  55. package/dist/connect/index.cjs +18 -18
  56. package/dist/connect/index.js +4 -4
  57. package/dist/facts/index.cjs +1 -1
  58. package/dist/facts/index.js +1 -1
  59. package/dist/files/ViewerChrome.d.ts +0 -45
  60. package/dist/files/ViewerParts.d.ts +0 -19
  61. package/dist/files/index.cjs +4 -436
  62. package/dist/files/index.cjs.map +1 -1
  63. package/dist/files/index.d.ts +2 -4
  64. package/dist/files/index.js +8 -428
  65. package/dist/files/index.js.map +1 -1
  66. package/dist/home/index.cjs +19 -19
  67. package/dist/home/index.js +4 -4
  68. package/dist/index.cjs +411 -339
  69. package/dist/index.js +13 -13
  70. package/dist/settings/index.cjs +3 -3
  71. package/dist/settings/index.js +3 -3
  72. package/dist/shell/index.cjs +10 -10
  73. package/dist/shell/index.js +2 -2
  74. package/dist/site/index.cjs +5 -5
  75. package/dist/site/index.js +1 -1
  76. package/dist/studio/index.cjs +8 -8
  77. package/dist/studio/index.js +6 -6
  78. package/package.json +25 -4
  79. package/dist/chunk-AAY5ASZD.js.map +0 -1
  80. package/dist/chunk-SYDHKKRZ.cjs.map +0 -1
  81. package/dist/chunk-TYZUCAT7.js.map +0 -1
  82. package/dist/chunk-VXOGANFJ.cjs.map +0 -1
  83. /package/dist/{files → artifacts}/VersionTimeline.d.ts +0 -0
@@ -0,0 +1,86 @@
1
+ "use client";
2
+ import { testIdOr } from '../../chunk-7F6CBP3Z.js';
3
+ import { useRef } from 'react';
4
+ import { MDXEditor, headingsPlugin, listsPlugin, quotePlugin, thematicBreakPlugin, linkPlugin, linkDialogPlugin, tablePlugin, markdownShortcutPlugin, toolbarPlugin, UndoRedo, Separator, BoldItalicUnderlineToggles, BlockTypeSelect, ListsToggle, CreateLink, InsertTable, InsertThematicBreak, usePublisher, insertMarkdown$ } from '@mdxeditor/editor';
5
+ import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
6
+
7
+ function DictationSlot({
8
+ render
9
+ }) {
10
+ const insertMarkdown = usePublisher(insertMarkdown$);
11
+ return /* @__PURE__ */ jsx(Fragment, { children: render(insertMarkdown) });
12
+ }
13
+ var DEFAULT_ARTIFACT_MARKDOWN_EDITOR_LABELS = {
14
+ editor: "Document editor",
15
+ placeholder: "Start typing\u2026"
16
+ };
17
+ function ArtifactMarkdownEditor({
18
+ markdown,
19
+ onChange,
20
+ onNormalized,
21
+ dictation,
22
+ labels,
23
+ testId
24
+ }) {
25
+ const l = { ...DEFAULT_ARTIFACT_MARKDOWN_EDITOR_LABELS, ...labels };
26
+ const ref = useRef(null);
27
+ const pendingNormalizationRef = useRef(true);
28
+ return /* @__PURE__ */ jsx(
29
+ "div",
30
+ {
31
+ role: "group",
32
+ "aria-label": l.editor,
33
+ "data-testid": testIdOr(testId, { testId: "artifact-markdown-editor" }),
34
+ className: "h-full pointer-coarse:[&_[role=toolbar]_button]:min-h-11 pointer-coarse:[&_[role=toolbar]_button]:min-w-11",
35
+ children: /* @__PURE__ */ jsx(
36
+ MDXEditor,
37
+ {
38
+ ref,
39
+ markdown,
40
+ onChange: (next) => {
41
+ if (pendingNormalizationRef.current) {
42
+ pendingNormalizationRef.current = false;
43
+ onNormalized?.(next);
44
+ }
45
+ onChange(next);
46
+ },
47
+ contentEditableClassName: "markdown-content max-w-none px-6 py-4 outline-none min-h-full",
48
+ className: "h-full overflow-auto bg-background",
49
+ placeholder: /* @__PURE__ */ jsx("span", { className: "text-muted-foreground", children: l.placeholder }),
50
+ plugins: [
51
+ headingsPlugin(),
52
+ listsPlugin(),
53
+ quotePlugin(),
54
+ thematicBreakPlugin(),
55
+ linkPlugin(),
56
+ linkDialogPlugin(),
57
+ tablePlugin(),
58
+ markdownShortcutPlugin(),
59
+ toolbarPlugin({
60
+ toolbarContents: () => /* @__PURE__ */ jsxs(Fragment, { children: [
61
+ /* @__PURE__ */ jsx(UndoRedo, {}),
62
+ /* @__PURE__ */ jsx(Separator, {}),
63
+ /* @__PURE__ */ jsx(BoldItalicUnderlineToggles, {}),
64
+ /* @__PURE__ */ jsx(Separator, {}),
65
+ /* @__PURE__ */ jsx(BlockTypeSelect, {}),
66
+ /* @__PURE__ */ jsx(ListsToggle, {}),
67
+ /* @__PURE__ */ jsx(Separator, {}),
68
+ /* @__PURE__ */ jsx(CreateLink, {}),
69
+ /* @__PURE__ */ jsx(InsertTable, {}),
70
+ /* @__PURE__ */ jsx(InsertThematicBreak, {}),
71
+ dictation && /* @__PURE__ */ jsxs(Fragment, { children: [
72
+ /* @__PURE__ */ jsx(Separator, {}),
73
+ /* @__PURE__ */ jsx(DictationSlot, { render: dictation })
74
+ ] })
75
+ ] })
76
+ })
77
+ ]
78
+ }
79
+ )
80
+ }
81
+ );
82
+ }
83
+
84
+ export { ArtifactMarkdownEditor, DEFAULT_ARTIFACT_MARKDOWN_EDITOR_LABELS };
85
+ //# sourceMappingURL=index.js.map
86
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/artifacts/editor/ArtifactMarkdownEditor.tsx"],"names":[],"mappings":";;;;;AA2BA,SAAS,aAAA,CAAc;AAAA,EACrB;AACF,CAAA,EAEuB;AACrB,EAAA,MAAM,cAAA,GAAiB,aAAa,eAAe,CAAA;AACnD,EAAA,uBAAO,GAAA,CAAA,QAAA,EAAA,EAAG,QAAA,EAAA,MAAA,CAAO,cAAc,CAAA,EAAE,CAAA;AACnC;AAQO,IAAM,uCAAA,GAAwE;AAAA,EACnF,MAAA,EAAQ,iBAAA;AAAA,EACR,WAAA,EAAa;AACf;AAkCO,SAAS,sBAAA,CAAuB;AAAA,EACrC,QAAA;AAAA,EACA,QAAA;AAAA,EACA,YAAA;AAAA,EACA,SAAA;AAAA,EACA,MAAA;AAAA,EACA;AACF,CAAA,EAAoD;AAClD,EAAA,MAAM,CAAA,GAAI,EAAE,GAAG,uCAAA,EAAyC,GAAG,MAAA,EAAO;AAClE,EAAA,MAAM,GAAA,GAAM,OAAyB,IAAI,CAAA;AAGzC,EAAA,MAAM,uBAAA,GAA0B,OAAO,IAAI,CAAA;AAE3C,EAAA,uBACE,GAAA;AAAA,IAAC,KAAA;AAAA,IAAA;AAAA,MACC,IAAA,EAAK,OAAA;AAAA,MACL,cAAY,CAAA,CAAE,MAA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AA,EAAA,EAAY,CAAA;AAAA,oCACZ,mBAAA,EAAA,EAAoB,CAAA;AAAA,gBACpB,6BACC,IAAA,CAAA,QAAA,EAAA,EACE,QAAA,EAAA;AAAA,kCAAA,GAAA,CAAC,SAAA,EAAA,EAAU,CAAA;AAAA,kCACX,GAAA,CAAC,aAAA,EAAA,EAAc,MAAA,EAAQ,SAAA,EAAW;AAAA,iBAAA,EACpC;AAAA,eAAA,EAEJ;AAAA,aAEH;AAAA;AACH;AAAA;AACF;AAAA,GACF;AAEJ","file":"index.js","sourcesContent":["import { useRef, type ReactNode } from 'react'\nimport {\n MDXEditor,\n type MDXEditorMethods,\n headingsPlugin,\n listsPlugin,\n quotePlugin,\n thematicBreakPlugin,\n linkPlugin,\n linkDialogPlugin,\n tablePlugin,\n markdownShortcutPlugin,\n toolbarPlugin,\n UndoRedo,\n BoldItalicUnderlineToggles,\n BlockTypeSelect,\n ListsToggle,\n CreateLink,\n InsertTable,\n InsertThematicBreak,\n Separator,\n insertMarkdown$,\n usePublisher,\n} from '@mdxeditor/editor'\nimport { testIdOr } from '../../chat/test-id'\n\n/** Renders the host's dictation control; `insert` puts text at the cursor. */\nfunction DictationSlot({\n render,\n}: {\n render: (insert: (markdown: string) => void) => ReactNode\n}): React.ReactElement {\n const insertMarkdown = usePublisher(insertMarkdown$)\n return <>{render(insertMarkdown)}</>\n}\n\nexport interface ArtifactMarkdownEditorLabels {\n /** The accessible name of the editor region. */\n editor: string\n placeholder: string\n}\n\nexport const DEFAULT_ARTIFACT_MARKDOWN_EDITOR_LABELS: ArtifactMarkdownEditorLabels = {\n editor: 'Document editor',\n placeholder: 'Start typing…',\n}\n\nexport interface ArtifactMarkdownEditorProps {\n /** Current markdown (controlled by the parent). */\n markdown: string\n /** Called with the new markdown whenever the document changes. */\n onChange: (markdown: string) => void\n /**\n * Fired exactly once per editor instance, with the markdown the editor produces on mount.\n * MDXEditor canonicalises the source as it parses (table padding, escapes, thematic-break\n * style), so the first `onChange` after mount is the round-tripped form of the input, not a\n * user edit. Use it to adopt the normalised form as the baseline so entering edit mode does\n * not look dirty. Remount via `key` to receive it for the next document.\n */\n onNormalized?: (normalized: string) => void\n /**\n * A dictation control for the toolbar (the host owns recording and transcription, for example\n * `@arbidocs/react`'s `InlineMicButton`). It gets a function that inserts text at the cursor.\n */\n dictation?: (insert: (markdown: string) => void) => ReactNode\n labels?: Partial<ArtifactMarkdownEditorLabels>\n testId?: string\n}\n\n/**\n * WYSIWYG editor for artifact documents: the user edits the rendered document directly and the\n * editor round-trips Markdown, so `onChange` always yields markdown a save can persist unchanged.\n *\n *\n * Heavy (Lexical via MDXEditor): mount it behind a lazy boundary. The host imports\n * `@mdxeditor/editor/style.css` once and, from the module that lazily imports this one, a module\n * that defines the global `Prism` FIRST (assign the prismjs core to `globalThis.Prism`):\n * `@lexical/code` reads it while it evaluates, and a library cannot order that in every bundler.\n */\nexport function ArtifactMarkdownEditor({\n markdown,\n onChange,\n onNormalized,\n dictation,\n labels,\n testId,\n}: ArtifactMarkdownEditorProps): React.ReactElement {\n const l = { ...DEFAULT_ARTIFACT_MARKDOWN_EDITOR_LABELS, ...labels }\n const ref = useRef<MDXEditorMethods>(null)\n // Latched until MDXEditor fires its first onChange after mount: that is the canonicalisation\n // round-trip, not a user edit.\n const pendingNormalizationRef = useRef(true)\n\n return (\n <div\n role=\"group\"\n aria-label={l.editor}\n data-testid={testIdOr(testId, { testId: 'artifact-markdown-editor' })}\n className=\"h-full pointer-coarse:[&_[role=toolbar]_button]:min-h-11 pointer-coarse:[&_[role=toolbar]_button]:min-w-11\"\n >\n <MDXEditor\n ref={ref}\n markdown={markdown}\n onChange={(next) => {\n if (pendingNormalizationRef.current) {\n pendingNormalizationRef.current = false\n onNormalized?.(next)\n }\n onChange(next)\n }}\n contentEditableClassName=\"markdown-content max-w-none px-6 py-4 outline-none min-h-full\"\n className=\"h-full overflow-auto bg-background\"\n placeholder={<span className=\"text-muted-foreground\">{l.placeholder}</span>}\n plugins={[\n headingsPlugin(),\n listsPlugin(),\n quotePlugin(),\n thematicBreakPlugin(),\n linkPlugin(),\n linkDialogPlugin(),\n tablePlugin(),\n markdownShortcutPlugin(),\n toolbarPlugin({\n toolbarContents: () => (\n <>\n <UndoRedo />\n <Separator />\n <BoldItalicUnderlineToggles />\n <Separator />\n <BlockTypeSelect />\n <ListsToggle />\n <Separator />\n <CreateLink />\n <InsertTable />\n <InsertThematicBreak />\n {dictation && (\n <>\n <Separator />\n <DictationSlot render={dictation} />\n </>\n )}\n </>\n ),\n }),\n ]}\n />\n </div>\n )\n}\n"]}