@sendbird/actionbook-core 0.8.1 → 0.9.3

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.
@@ -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: 'tool' | 'manual' | 'agent_message_template' | 'handoff' | 'time_diff';
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 BlockNode = ParagraphNode | HeadingNode | BulletListNode | OrderedListNode | ListItemNode | BlockquoteNode | HorizontalRuleNode | TableNode | JinjaIfBlockNode;
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 NodePath 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 LintRule as o, type LintContext as p, type LintResult as q, type LlmLintRule as r, type LlmCompletionEndpoint as s, type LintSection as t, type JSONContent as u, JUMP_POINT_ID_PATTERN as v, type LintSeverity as w, RESOURCE_TAG_TYPES as x, fromProseMirrorJSON as y };
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 };
@@ -1,17 +1,16 @@
1
1
  import { Schema, Node } from 'prosemirror-model';
2
- import * as prosemirror_state from 'prosemirror-state';
3
2
  import { Plugin, Command, EditorState, PluginKey } from 'prosemirror-state';
4
3
  import { InputRule } from 'prosemirror-inputrules';
5
- import { EditorView, NodeView, Decoration } from 'prosemirror-view';
6
- import React$1, { ReactElement, RefObject } from 'react';
7
- import { D as DocumentNode, A as AstNode, s as LlmCompletionEndpoint, I as InlineNode, B as BlockNode, u as JSONContent } from '../types-rEXLrfo_.js';
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';
8
7
 
9
8
  /**
10
9
  * ProseMirror Schema for Actionbook documents.
11
10
  */
12
- declare const actionbookSchema: Schema<"doc" | "paragraph" | "heading" | "bulletList" | "orderedList" | "listItem" | "blockquote" | "codeBlock" | "jinjaIfBlock" | "jinjaIfBranch" | "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">;
13
12
 
14
- type NodeViewFactory = (node: Node, view: EditorView, getPos: () => number | undefined) => NodeView;
13
+ type NodeViewFactory = (node: Node, view: EditorView, getPos: () => number | undefined, decorations: readonly Decoration[]) => NodeView;
15
14
  interface ActionbookPlugin {
16
15
  name: string;
17
16
  plugins?: () => Plugin[];
@@ -72,6 +71,13 @@ interface ReactNodeViewOptions {
72
71
  className?: string;
73
72
  /** Whether this is an inline node (default: true) */
74
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
+ }>;
75
81
  }
76
82
  /**
77
83
  * Creates a NodeViewFactory that renders a React component as a PM NodeView.
@@ -102,8 +108,10 @@ interface EditorViewConfig {
102
108
  llmCompletionEndpoint?: LlmCompletionEndpoint;
103
109
  }
104
110
  interface EditorViewHandle {
105
- viewRef: RefObject<HTMLDivElement | null>;
111
+ viewRef: RefCallback<HTMLDivElement>;
106
112
  view: EditorView | null;
113
+ /** Always returns the current EditorView (not a stale snapshot). */
114
+ getView: () => EditorView | null;
107
115
  getAST: () => DocumentNode | null;
108
116
  getMarkdown: () => string;
109
117
  setContent: (doc: DocumentNode) => void;
@@ -112,10 +120,10 @@ interface EditorViewHandle {
112
120
  }
113
121
  declare function useEditorView(config: EditorViewConfig): EditorViewHandle;
114
122
 
115
- declare function createHistoryPlugin(): ActionbookPlugin;
116
-
117
123
  declare function createInputRulesPlugin(): ActionbookPlugin;
118
124
 
125
+ declare function createHistoryPlugin(): ActionbookPlugin;
126
+
119
127
  declare function createKeymapPlugin(): ActionbookPlugin;
120
128
 
121
129
  declare function createMarkdownClipboardPlugin(): ActionbookPlugin;
@@ -144,15 +152,15 @@ declare function createJumpPointAdjacentPlugin(): ActionbookPlugin;
144
152
 
145
153
  declare function createJumpPointNodeViewPlugin(): ActionbookPlugin;
146
154
 
147
- declare function createJumpPointValidationPlugin(): ActionbookPlugin;
148
155
  /**
149
- * Check if doc has duplicate jump point IDs.
156
+ * Check whether the editor state contains duplicate jumpPoint IDs.
150
157
  */
151
- declare function hasDuplicateJumpPoints(state: prosemirror_state.EditorState): boolean;
158
+ declare function hasDuplicateJumpPoints(state: EditorState): boolean;
152
159
  /**
153
- * Check if doc has broken anchor references.
160
+ * Check whether the editor state contains broken anchor references.
154
161
  */
155
- declare function hasBrokenAnchorRefs(state: prosemirror_state.EditorState): boolean;
162
+ declare function hasBrokenAnchorRefs(state: EditorState): boolean;
163
+ declare function createJumpPointValidationPlugin(): ActionbookPlugin;
156
164
 
157
165
  declare function createInlineToolTagNodeViewPlugin(): ActionbookPlugin;
158
166
 
@@ -190,6 +198,8 @@ declare function createDragHandlePlugin(): ActionbookPlugin;
190
198
 
191
199
  declare function createTodoNodeViewPlugin(): ActionbookPlugin;
192
200
 
201
+ declare function createNoteBlockPlugin(): ActionbookPlugin;
202
+
193
203
  /**
194
204
  * Slash-command trigger plugin.
195
205
  *
@@ -270,6 +280,10 @@ interface SlashCommandItem {
270
280
  description?: string;
271
281
  /** Optional icon node rendered to the left of the title. */
272
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;
273
287
  /**
274
288
  * Execute this command.
275
289
  *
@@ -299,6 +313,19 @@ interface JinjaTreeViewProps {
299
313
  }
300
314
  declare function JinjaTreeView({ doc, className }: JinjaTreeViewProps): ReactElement | null;
301
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
+
302
329
  /**
303
330
  * Floating UI for the Actionbook editor.
304
331
  *
@@ -395,4 +422,4 @@ declare function toProseMirrorJSON(doc: DocumentNode): JSONContent;
395
422
  */
396
423
  declare function astNodesToJSONContent(nodes: (InlineNode | BlockNode)[]): JSONContent[];
397
424
 
398
- 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, createHistoryPlugin, createInlineSuggestPlugin, createInlineToolTagNodeViewPlugin, createInputRulesPlugin, createJinjaDecorationPlugin, createJinjaIfBlockPlugin, createJumpPointAdjacentPlugin, createJumpPointNodeViewPlugin, createJumpPointValidationPlugin, createKeymapPlugin, createLinkPlugin, createMarkdownClipboardPlugin, createPluginArray, createReactNodeView, createSlashCommandPlugin, createTodoNodeViewPlugin, hasBrokenAnchorRefs, hasDuplicateJumpPoints, 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 };