@tessera-editor/react 0.1.0 → 0.2.0

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/dist/index.d.ts CHANGED
@@ -1,9 +1,12 @@
1
1
  import * as react from 'react';
2
+ import { ReactNode } from 'react';
2
3
  import { Editor } from '@tiptap/react';
4
+ export { Editor } from '@tiptap/react';
3
5
  import * as _tiptap_core from '@tiptap/core';
4
6
  import { Content } from '@tiptap/core';
7
+ export { Content, JSONContent } from '@tiptap/core';
5
8
  import * as _tessera_editor_core from '@tessera-editor/core';
6
- import { TesseraLocale, UploadService, StorageService, CommentStore, IdentityService, SlashMenuItem, TesseraTranslator } from '@tessera-editor/core';
9
+ import { TesseraLocale, TesseraMessageOverrides, UploadService, CommentStore, IdentityService, TesseraTranslator, SlashMenuItem } from '@tessera-editor/core';
7
10
  import { AIRuntime, SuggestionSession, AiController } from '@tessera-editor/ai';
8
11
  import { SuggestionProps, SuggestionKeyDownProps } from '@tiptap/suggestion';
9
12
  import * as _tiptap_extension_table from '@tiptap/extension-table';
@@ -12,24 +15,40 @@ interface TesseraProps {
12
15
  /** Initial document (JSON / HTML / markdown string). Host owns persistence. */
13
16
  content?: Content;
14
17
  locale?: TesseraLocale;
18
+ /** Empty-paragraph placeholder text (default: the i18n `placeholderEmpty` string). */
19
+ placeholder?: string;
20
+ /** Per-key overrides of the built-in UI dictionary (slash items, tooltips…). */
21
+ messages?: TesseraMessageOverrides;
22
+ /** Render the editor read-only (default: editable). */
23
+ editable?: boolean;
24
+ /**
25
+ * Host block policy: top-level block types to exclude entirely (see
26
+ * `TesseraPresetOptions.excludeBlocks`). Read once at editor creation.
27
+ */
28
+ excludeBlocks?: string[];
15
29
  /** Injected image upload capability (ADR-0001 family). */
16
30
  upload?: UploadService;
17
- /** v1.1: version-history snapshot storage. */
18
- storage?: StorageService;
19
31
  /** v1.1: inline comment persistence. */
20
32
  comments?: CommentStore;
21
33
  /** v1.1: current user (comment authorship). */
22
34
  identity?: IdentityService;
23
35
  /** Injected model runtime; presence enables all AI surfaces. */
24
36
  ai?: AIRuntime;
25
- /** v1.1: idle window for history auto-capture (playground uses short ones) */
26
- historyIdleMs?: number;
27
37
  /** v1.1: document column max-width in px (Slite-style centered column). */
28
38
  docWidth?: number;
39
+ /**
40
+ * Host buttons appended to the selection toolbar (e.g. custom AI actions).
41
+ * A render function receives the live editor + translator, so a host button
42
+ * like 「让 AI 改写此段」 can read the current selection on click.
43
+ */
44
+ extraSelectionItems?: ReactNode | ((ctx: {
45
+ editor: Editor;
46
+ t: TesseraTranslator;
47
+ }) => ReactNode);
29
48
  onUpdate?: (editor: Editor) => void;
30
49
  onCreate?: (editor: Editor) => void;
31
50
  }
32
- declare function Tessera({ content, locale, upload, storage, comments, identity, ai: runtime, historyIdleMs, docWidth, onUpdate, onCreate, }: TesseraProps): react.JSX.Element | null;
51
+ declare function Tessera({ content, locale, placeholder, messages, editable, excludeBlocks, upload, comments, identity, ai: runtime, docWidth, extraSelectionItems, onUpdate, onCreate, }: TesseraProps): react.JSX.Element | null;
33
52
 
34
53
  declare function EmptyLineToolbar(): react.ReactPortal | null;
35
54
 
@@ -65,12 +84,6 @@ declare function SuggestionBar({ session, onClear, }: {
65
84
  onClear: () => void;
66
85
  }): react.JSX.Element | null;
67
86
 
68
- /**
69
- * Version history panel (v1.1): snapshots from the injected StorageService,
70
- * block+word level diff against the current doc, one-click restore.
71
- */
72
- declare function HistoryPanel(): react.JSX.Element | null;
73
-
74
87
  declare function CommentPanel(): react.JSX.Element | null;
75
88
  /** Selection-toolbar composer popover: quote + comment → thread + mark. */
76
89
  declare function CommentComposer({ onClose }: {
@@ -93,8 +106,17 @@ interface TesseraContextValue {
93
106
  locale: TesseraLocale;
94
107
  t: TesseraTranslator;
95
108
  ai: AiController | null;
109
+ /**
110
+ * Host buttons appended to the selection toolbar (e.g. custom AI actions).
111
+ * A render function receives the live editor + translator, so a host button
112
+ * like 「让 AI 改写此段」 can read the current selection on click.
113
+ */
114
+ extraSelectionItems?: ReactNode | ((ctx: {
115
+ editor: Editor;
116
+ t: TesseraTranslator;
117
+ }) => ReactNode);
96
118
  }
97
119
  declare const TesseraContext: react.Context<TesseraContextValue | null>;
98
120
  declare function useTesseraContext(): TesseraContextValue;
99
121
 
100
- export { AiTableCellViewExtension, AiTableHeaderViewExtension, AskPanel, BlockContextMenuUI, CommentComposer, CommentPanel, EmbedBlockView, EmptyLineToolbar, FindReplacePanel, HistoryPanel, ImageBlockView, SelectionToolbar, SlashMenuView, SuggestionBar, Tessera, TesseraContext, type TesseraContextValue, type TesseraProps, TocBlockView, createSlashRenderer, useTesseraContext };
122
+ export { AiTableCellViewExtension, AiTableHeaderViewExtension, AskPanel, BlockContextMenuUI, CommentComposer, CommentPanel, EmbedBlockView, EmptyLineToolbar, FindReplacePanel, ImageBlockView, SelectionToolbar, SlashMenuView, SuggestionBar, Tessera, TesseraContext, type TesseraContextValue, type TesseraProps, TocBlockView, createSlashRenderer, useTesseraContext };