@sendbird/actionbook-core 0.7.3 → 0.9.1
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/LICENSE +13 -0
- package/README.md +2 -2
- package/dist/index.d.ts +37 -3
- package/dist/index.js +484 -33
- package/dist/index.js.map +1 -1
- package/dist/{types-rEXLrfo_.d.ts → types-DK_GhIWZ.d.ts} +17 -5
- package/dist/ui/index.d.ts +50 -8
- package/dist/ui/index.js +2523 -495
- package/dist/ui/index.js.map +1 -1
- package/package.json +5 -5
|
@@ -19,6 +19,8 @@ type LinkMark = {
|
|
|
19
19
|
readonly title?: string;
|
|
20
20
|
};
|
|
21
21
|
type Mark = BoldMark | ItalicMark | UnderlineMark | StrikethroughMark | CodeMark | LinkMark;
|
|
22
|
+
declare const RESOURCE_TAG_TYPES: readonly ["tool", "manual", "agent_message_template", "handoff", "time_diff", "time_difference"];
|
|
23
|
+
type ResourceTagType = (typeof RESOURCE_TAG_TYPES)[number];
|
|
22
24
|
type TextNode = {
|
|
23
25
|
readonly type: 'text';
|
|
24
26
|
readonly text: string;
|
|
@@ -26,7 +28,7 @@ type TextNode = {
|
|
|
26
28
|
};
|
|
27
29
|
type ResourceTagNode = {
|
|
28
30
|
readonly type: 'resourceTag';
|
|
29
|
-
readonly tagType:
|
|
31
|
+
readonly tagType: ResourceTagType;
|
|
30
32
|
readonly resourceId: string;
|
|
31
33
|
readonly text: string;
|
|
32
34
|
};
|
|
@@ -59,15 +61,18 @@ type HeadingNode = {
|
|
|
59
61
|
type ListItemNode = {
|
|
60
62
|
readonly type: 'listItem';
|
|
61
63
|
readonly checked?: boolean | null;
|
|
64
|
+
readonly spread?: boolean;
|
|
62
65
|
readonly content: readonly BlockNode[];
|
|
63
66
|
};
|
|
64
67
|
type BulletListNode = {
|
|
65
68
|
readonly type: 'bulletList';
|
|
69
|
+
readonly spread?: boolean;
|
|
66
70
|
readonly content: readonly ListItemNode[];
|
|
67
71
|
};
|
|
68
72
|
type OrderedListNode = {
|
|
69
73
|
readonly type: 'orderedList';
|
|
70
74
|
readonly start: number;
|
|
75
|
+
readonly spread?: boolean;
|
|
71
76
|
readonly content: readonly ListItemNode[];
|
|
72
77
|
};
|
|
73
78
|
type BlockquoteNode = {
|
|
@@ -77,6 +82,11 @@ type BlockquoteNode = {
|
|
|
77
82
|
type HorizontalRuleNode = {
|
|
78
83
|
readonly type: 'horizontalRule';
|
|
79
84
|
};
|
|
85
|
+
type CodeBlockNode = {
|
|
86
|
+
readonly type: 'codeBlock';
|
|
87
|
+
readonly language?: string;
|
|
88
|
+
readonly content: string;
|
|
89
|
+
};
|
|
80
90
|
type TableCellNode = {
|
|
81
91
|
readonly type: 'tableCell';
|
|
82
92
|
readonly header?: boolean;
|
|
@@ -94,15 +104,17 @@ type JinjaIfBlockNode = {
|
|
|
94
104
|
readonly type: 'jinjaIfBlock';
|
|
95
105
|
readonly branches: readonly JinjaIfBranch<BlockNode>[];
|
|
96
106
|
};
|
|
97
|
-
type
|
|
107
|
+
type NoteBlockNode = {
|
|
108
|
+
readonly type: 'noteBlock';
|
|
109
|
+
readonly content: readonly BlockNode[];
|
|
110
|
+
};
|
|
111
|
+
type BlockNode = ParagraphNode | HeadingNode | BulletListNode | OrderedListNode | ListItemNode | BlockquoteNode | HorizontalRuleNode | CodeBlockNode | TableNode | JinjaIfBlockNode | NoteBlockNode;
|
|
98
112
|
type DocumentNode = {
|
|
99
113
|
readonly type: 'doc';
|
|
100
114
|
readonly content: readonly BlockNode[];
|
|
101
115
|
};
|
|
102
116
|
type AstNode = DocumentNode | BlockNode | InlineNode | TableRowNode | TableCellNode;
|
|
103
117
|
type NodePath = readonly number[];
|
|
104
|
-
declare const RESOURCE_TAG_TYPES: readonly ["tool", "manual", "agent_message_template", "handoff", "time_diff"];
|
|
105
|
-
type ResourceTagType = (typeof RESOURCE_TAG_TYPES)[number];
|
|
106
118
|
declare const JUMP_POINT_ID_PATTERN: RegExp;
|
|
107
119
|
|
|
108
120
|
/**
|
|
@@ -188,4 +200,4 @@ type LlmLintRule = {
|
|
|
188
200
|
readonly parseResponse: (response: string, section: LintSection) => LintResult[];
|
|
189
201
|
};
|
|
190
202
|
|
|
191
|
-
export { type AstNode as A, type BlockNode as B, type CodeMark as C, type DocumentNode as D, type HardBreakNode as H, type InlineNode as I, type JinjaIfBranch as J, type ListItemNode as L, type Mark as M, type
|
|
203
|
+
export { type AstNode as A, type BlockNode as B, type CodeMark as C, type DocumentNode as D, type HardBreakNode as H, type InlineNode as I, type JinjaIfBranch as J, type ListItemNode as L, type Mark as M, type NoteBlockNode as N, type OrderedListNode as O, type ParagraphNode as P, type ResourceTagType as R, type StrikethroughMark as S, type TableRowNode as T, type UnderlineMark as U, type BlockquoteNode as a, type BoldMark as b, type BulletListNode as c, type HeadingNode as d, type HorizontalRuleNode as e, type ItalicMark as f, type JinjaIfBlockNode as g, type JinjaIfInlineNode as h, type JumpPointNode as i, type LinkMark as j, type ResourceTagNode as k, type TableNode as l, type TableCellNode as m, type TextNode as n, type NodePath as o, type LintRule as p, type LintContext as q, type LintResult as r, type LlmLintRule as s, type LlmCompletionEndpoint as t, type LintSection as u, type JSONContent as v, JUMP_POINT_ID_PATTERN as w, type LintSeverity as x, RESOURCE_TAG_TYPES as y, fromProseMirrorJSON as z };
|
package/dist/ui/index.d.ts
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { Schema, Node } from 'prosemirror-model';
|
|
2
2
|
import { Plugin, Command, EditorState, PluginKey } from 'prosemirror-state';
|
|
3
3
|
import { InputRule } from 'prosemirror-inputrules';
|
|
4
|
-
import { EditorView,
|
|
5
|
-
import React$1, { ReactElement,
|
|
6
|
-
import { D as DocumentNode, A as AstNode,
|
|
4
|
+
import { EditorView, Decoration, NodeView } from 'prosemirror-view';
|
|
5
|
+
import React$1, { ReactElement, RefCallback } from 'react';
|
|
6
|
+
import { D as DocumentNode, A as AstNode, t as LlmCompletionEndpoint, I as InlineNode, B as BlockNode, v as JSONContent } from '../types-DK_GhIWZ.js';
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* ProseMirror Schema for Actionbook documents.
|
|
10
10
|
*/
|
|
11
|
-
declare const actionbookSchema: Schema<"doc" | "paragraph" | "heading" | "bulletList" | "orderedList" | "listItem" | "blockquote" | "horizontalRule" | "table" | "tableRow" | "tableCell" | "tableHeader" | "text" | "inlineToolTag" | "jumpPoint" | "hardBreak", "bold" | "italic" | "underline" | "strikethrough" | "code" | "link" | "diffMark">;
|
|
11
|
+
declare const actionbookSchema: Schema<"doc" | "paragraph" | "heading" | "bulletList" | "orderedList" | "listItem" | "blockquote" | "codeBlock" | "horizontalRule" | "jinjaIfBlock" | "jinjaIfBranch" | "noteBlock" | "table" | "tableRow" | "tableCell" | "tableHeader" | "text" | "inlineToolTag" | "jumpPoint" | "hardBreak", "bold" | "italic" | "underline" | "strikethrough" | "code" | "link" | "diffMark">;
|
|
12
12
|
|
|
13
|
-
type NodeViewFactory = (node: Node, view: EditorView, getPos: () => number | undefined) => NodeView;
|
|
13
|
+
type NodeViewFactory = (node: Node, view: EditorView, getPos: () => number | undefined, decorations: readonly Decoration[]) => NodeView;
|
|
14
14
|
interface ActionbookPlugin {
|
|
15
15
|
name: string;
|
|
16
16
|
plugins?: () => Plugin[];
|
|
@@ -71,6 +71,13 @@ interface ReactNodeViewOptions {
|
|
|
71
71
|
className?: string;
|
|
72
72
|
/** Whether this is an inline node (default: true) */
|
|
73
73
|
inline?: boolean;
|
|
74
|
+
/**
|
|
75
|
+
* Optional wrapper component that provides context (Router, QueryClient, etc.)
|
|
76
|
+
* around every NodeView React root. Receives `children` as its only prop.
|
|
77
|
+
*/
|
|
78
|
+
wrapper?: React.ComponentType<{
|
|
79
|
+
children: React.ReactNode;
|
|
80
|
+
}>;
|
|
74
81
|
}
|
|
75
82
|
/**
|
|
76
83
|
* Creates a NodeViewFactory that renders a React component as a PM NodeView.
|
|
@@ -101,8 +108,10 @@ interface EditorViewConfig {
|
|
|
101
108
|
llmCompletionEndpoint?: LlmCompletionEndpoint;
|
|
102
109
|
}
|
|
103
110
|
interface EditorViewHandle {
|
|
104
|
-
viewRef:
|
|
111
|
+
viewRef: RefCallback<HTMLDivElement>;
|
|
105
112
|
view: EditorView | null;
|
|
113
|
+
/** Always returns the current EditorView (not a stale snapshot). */
|
|
114
|
+
getView: () => EditorView | null;
|
|
106
115
|
getAST: () => DocumentNode | null;
|
|
107
116
|
getMarkdown: () => string;
|
|
108
117
|
setContent: (doc: DocumentNode) => void;
|
|
@@ -113,6 +122,8 @@ declare function useEditorView(config: EditorViewConfig): EditorViewHandle;
|
|
|
113
122
|
|
|
114
123
|
declare function createInputRulesPlugin(): ActionbookPlugin;
|
|
115
124
|
|
|
125
|
+
declare function createHistoryPlugin(): ActionbookPlugin;
|
|
126
|
+
|
|
116
127
|
declare function createKeymapPlugin(): ActionbookPlugin;
|
|
117
128
|
|
|
118
129
|
declare function createMarkdownClipboardPlugin(): ActionbookPlugin;
|
|
@@ -141,10 +152,22 @@ declare function createJumpPointAdjacentPlugin(): ActionbookPlugin;
|
|
|
141
152
|
|
|
142
153
|
declare function createJumpPointNodeViewPlugin(): ActionbookPlugin;
|
|
143
154
|
|
|
155
|
+
/**
|
|
156
|
+
* Check whether the editor state contains duplicate jumpPoint IDs.
|
|
157
|
+
*/
|
|
158
|
+
declare function hasDuplicateJumpPoints(state: EditorState): boolean;
|
|
159
|
+
/**
|
|
160
|
+
* Check whether the editor state contains broken anchor references.
|
|
161
|
+
*/
|
|
162
|
+
declare function hasBrokenAnchorRefs(state: EditorState): boolean;
|
|
163
|
+
declare function createJumpPointValidationPlugin(): ActionbookPlugin;
|
|
164
|
+
|
|
144
165
|
declare function createInlineToolTagNodeViewPlugin(): ActionbookPlugin;
|
|
145
166
|
|
|
146
167
|
declare function createJinjaDecorationPlugin(): ActionbookPlugin;
|
|
147
168
|
|
|
169
|
+
declare function createJinjaIfBlockPlugin(): ActionbookPlugin;
|
|
170
|
+
|
|
148
171
|
/**
|
|
149
172
|
* Link editing plugin for the Actionbook editor.
|
|
150
173
|
*
|
|
@@ -175,6 +198,8 @@ declare function createDragHandlePlugin(): ActionbookPlugin;
|
|
|
175
198
|
|
|
176
199
|
declare function createTodoNodeViewPlugin(): ActionbookPlugin;
|
|
177
200
|
|
|
201
|
+
declare function createNoteBlockPlugin(): ActionbookPlugin;
|
|
202
|
+
|
|
178
203
|
/**
|
|
179
204
|
* Slash-command trigger plugin.
|
|
180
205
|
*
|
|
@@ -255,6 +280,10 @@ interface SlashCommandItem {
|
|
|
255
280
|
description?: string;
|
|
256
281
|
/** Optional icon node rendered to the left of the title. */
|
|
257
282
|
icon?: React$1.ReactNode;
|
|
283
|
+
/** Optional group name. When present, items are visually grouped with a header. */
|
|
284
|
+
group?: string;
|
|
285
|
+
/** Optional shortcut symbol displayed on the right side (e.g. "#", "##", "---"). */
|
|
286
|
+
shortcut?: string;
|
|
258
287
|
/**
|
|
259
288
|
* Execute this command.
|
|
260
289
|
*
|
|
@@ -284,6 +313,19 @@ interface JinjaTreeViewProps {
|
|
|
284
313
|
}
|
|
285
314
|
declare function JinjaTreeView({ doc, className }: JinjaTreeViewProps): ReactElement | null;
|
|
286
315
|
|
|
316
|
+
/**
|
|
317
|
+
* DocumentTreeView — lightweight React tree component for document outline.
|
|
318
|
+
* Shows headings, jump points, jinja if blocks, resource tags, end actions, and note blocks.
|
|
319
|
+
* Supports selected item highlight (purple background like Figma).
|
|
320
|
+
*/
|
|
321
|
+
|
|
322
|
+
interface DocumentTreeViewProps {
|
|
323
|
+
doc: DocumentNode;
|
|
324
|
+
className?: string;
|
|
325
|
+
onNavigate?: (blockIndex: number) => void;
|
|
326
|
+
}
|
|
327
|
+
declare function DocumentTreeView({ doc, className, onNavigate }: DocumentTreeViewProps): ReactElement;
|
|
328
|
+
|
|
287
329
|
/**
|
|
288
330
|
* Floating UI for the Actionbook editor.
|
|
289
331
|
*
|
|
@@ -372,7 +414,7 @@ declare function createInlineSuggestPlugin(provider: InlineSuggestProvider, endp
|
|
|
372
414
|
*/
|
|
373
415
|
|
|
374
416
|
declare function convertInline(node: InlineNode): JSONContent;
|
|
375
|
-
declare function convertBlock(node: BlockNode
|
|
417
|
+
declare function convertBlock(node: BlockNode): JSONContent;
|
|
376
418
|
declare function toProseMirrorJSON(doc: DocumentNode): JSONContent;
|
|
377
419
|
/**
|
|
378
420
|
* Convert parseFragment() output (InlineNode[] | BlockNode[]) to PM JSONContent[].
|
|
@@ -380,4 +422,4 @@ declare function toProseMirrorJSON(doc: DocumentNode): JSONContent;
|
|
|
380
422
|
*/
|
|
381
423
|
declare function astNodesToJSONContent(nodes: (InlineNode | BlockNode)[]): JSONContent[];
|
|
382
424
|
|
|
383
|
-
export { type ActionbookPlugin, ActionbookRenderer, type ActionbookRendererProps, EditorShell, type EditorShellProps, type EditorViewConfig, type EditorViewHandle, FloatingMenu, type FloatingMenuProps, type InlineSuggestContext, type InlineSuggestProvider, type InlineSuggestState, JUMP_POINT_ADJACENT_SPEC, JinjaTreeView, type JinjaTreeViewProps, type NodeViewFactory, type ReactNodeViewOptions, type ReactNodeViewProps, type SlashCommandItem, SlashCommandMenu, type SlashCommandMenuProps, type SlashCommandState, actionbookSchema, astNodesToJSONContent, convertBlock, convertInline, createDragHandlePlugin, createInlineSuggestPlugin, createInlineToolTagNodeViewPlugin, createInputRulesPlugin, createJinjaDecorationPlugin, createJumpPointAdjacentPlugin, createJumpPointNodeViewPlugin, createKeymapPlugin, createLinkPlugin, createMarkdownClipboardPlugin, createPluginArray, createReactNodeView, createSlashCommandPlugin, createTodoNodeViewPlugin, inlineSuggestKey, slashCommandKey, toProseMirrorJSON, useEditorView };
|
|
425
|
+
export { type ActionbookPlugin, ActionbookRenderer, type ActionbookRendererProps, DocumentTreeView, type DocumentTreeViewProps, EditorShell, type EditorShellProps, type EditorViewConfig, type EditorViewHandle, FloatingMenu, type FloatingMenuProps, type InlineSuggestContext, type InlineSuggestProvider, type InlineSuggestState, JUMP_POINT_ADJACENT_SPEC, JinjaTreeView, type JinjaTreeViewProps, type NodeViewFactory, type ReactNodeViewOptions, type ReactNodeViewProps, type SlashCommandItem, SlashCommandMenu, type SlashCommandMenuProps, type SlashCommandState, actionbookSchema, astNodesToJSONContent, convertBlock, convertInline, createDragHandlePlugin, createHistoryPlugin, createInlineSuggestPlugin, createInlineToolTagNodeViewPlugin, createInputRulesPlugin, createJinjaDecorationPlugin, createJinjaIfBlockPlugin, createJumpPointAdjacentPlugin, createJumpPointNodeViewPlugin, createJumpPointValidationPlugin, createKeymapPlugin, createLinkPlugin, createMarkdownClipboardPlugin, createNoteBlockPlugin, createPluginArray, createReactNodeView, createSlashCommandPlugin, createTodoNodeViewPlugin, hasBrokenAnchorRefs, hasDuplicateJumpPoints, inlineSuggestKey, slashCommandKey, toProseMirrorJSON, useEditorView };
|