react-reason-editor 1.0.60 → 1.0.62

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.
@@ -41,11 +41,31 @@ interface ReasonDocsProps {
41
41
  initialDocId?: string | null;
42
42
  /** Called whenever the active document changes, so the host can mirror it (e.g. into a URL param). */
43
43
  onActiveDocumentChange?: (docId: string | null) => void;
44
+ /**
45
+ * Generates short AI tips about the active document's content, given its
46
+ * title and HTML content. Powers the sidebar "ai" panel's "Page tips"
47
+ * section. Omitted when the host app has no tips-generation capability —
48
+ * the section is hidden entirely in that case.
49
+ */
50
+ onGenerateTips?: (title: string, contentHtml: string) => Promise<string[]>;
51
+ /**
52
+ * Generates short suggested search queries ("topics") related to the
53
+ * active document's content, given its title and HTML content. Powers
54
+ * the sidebar "related" panel's "Search topics" section. Omitted when
55
+ * the host app has no topics-generation capability to offer.
56
+ */
57
+ onGenerateTopics?: (title: string, contentHtml: string) => Promise<string[]>;
58
+ /**
59
+ * Runs a search for a generated topic (e.g. opens a new chat seeded with
60
+ * it as the first message). Omitted when the host app has no search
61
+ * capability to offer, hiding the "Search topics" section's click action.
62
+ */
63
+ onSearchTopic?: (topic: string) => void;
44
64
  }
45
65
  /**
46
66
  * Root application component that wires together all major UI regions.
47
67
  * Uses `useReasonDocsState` for shared state and `next-themes` for theme control.
48
68
  * Renders a resizable panel layout on desktop and a stacked layout on mobile.
49
69
  */
50
- declare const Index: ({ mainContent, belowMainContent, openFilesSidebarSignal, extraTabs, activeExtraTabId, onExtraTabSelect, onExtraTabClose, onExtraTabAdd, onFileTabSelect, initialDocId, onActiveDocumentChange, }: ReasonDocsProps) => import("react").JSX.Element;
70
+ declare const Index: ({ mainContent, belowMainContent, openFilesSidebarSignal, extraTabs, activeExtraTabId, onExtraTabSelect, onExtraTabClose, onExtraTabAdd, onFileTabSelect, initialDocId, onActiveDocumentChange, onGenerateTips, onGenerateTopics, onSearchTopic, }: ReasonDocsProps) => import("react").JSX.Element;
51
71
  export default Index;
@@ -1,5 +1,5 @@
1
1
  import { RefObject } from 'react';
2
- import { SidebarPanelType, SidebarAiProps, OpenTabItem } from '../layout/sidebar/types';
2
+ import { SidebarPanelType, SidebarAiProps, SidebarTipsProps, SidebarTopicsProps, OpenTabItem } from '../layout/sidebar/types';
3
3
  import { OutlineViewHandle } from '../search/OutlineView';
4
4
  import { ActiveHeadingEditorHandle } from '../search/useActiveHeading';
5
5
  import { TocEntry } from '../app-types/toc';
@@ -35,6 +35,10 @@ interface RightPanelProps {
35
35
  tabItems?: OpenTabItem[];
36
36
  onNewChat?: () => void;
37
37
  aiProps: SidebarAiProps;
38
+ /** AI-generated page tips state/handlers (used by the "ai" panel). */
39
+ tipsProps?: SidebarTipsProps;
40
+ /** AI-generated search topics state/handlers (used by the "related" panel). */
41
+ topicsProps?: SidebarTopicsProps;
38
42
  /** Closes the panel by clearing the right sidebar's panel list. */
39
43
  onClose: () => void;
40
44
  /** Renders as a slide-in drawer instead of an inset resizable panel. */
@@ -49,5 +53,5 @@ interface RightPanelProps {
49
53
  * by dragging its left edge; its body renders whichever panels are enabled
50
54
  * for the right sidebar.
51
55
  */
52
- export declare function RightPanel({ panels, split, documents, activeId, activeDocument, onSelect, onAdd, onDelete, onDuplicate, onMove, onManageTags, onRename, headings, onNavigate, openTabs, activeTab, onTabChange, onTabClose, onTabRename, onSplitRight, onReopenLastClosed, canReopenLastClosed, outlineRef, editorRef, tabItems, onNewChat, aiProps, onClose, isMobile, isOpen, onOpenChange, }: RightPanelProps): import("react").JSX.Element;
56
+ export declare function RightPanel({ panels, split, documents, activeId, activeDocument, onSelect, onAdd, onDelete, onDuplicate, onMove, onManageTags, onRename, headings, onNavigate, openTabs, activeTab, onTabChange, onTabClose, onTabRename, onSplitRight, onReopenLastClosed, canReopenLastClosed, outlineRef, editorRef, tabItems, onNewChat, aiProps, tipsProps, topicsProps, onClose, isMobile, isOpen, onOpenChange, }: RightPanelProps): import("react").JSX.Element;
53
57
  export {};
package/dist/index.cjs CHANGED
@@ -1 +1 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("./rolldown-runtime-BeavJI0R.cjs");const e=require("./editorConfig-Cx4ilZJV.cjs"),o=require("./ReasonDocs-CIatd_iE.cjs"),r=require("./RichTextProvider-CSKrKcEv.cjs"),t=require("./externalLibsMode-Dm8a-Jd9.cjs");exports.NovelEditor=e.NovelEditor,exports.ReasonDocs=o.Index,exports.RichTextProvider=r.RichTextProvider,exports.externalLibsModeActions=t.externalLibsModeActions,exports.getExternalLibsMode=t.getExternalLibsMode,exports.useExternalLibsMode=t.useExternalLibsMode,exports.useNovelEditor=e.useNovelEditor;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("./rolldown-runtime-BeavJI0R.cjs");const e=require("./editorConfig-Cx4ilZJV.cjs"),o=require("./ReasonDocs-B4rT3-HS.cjs"),r=require("./RichTextProvider-CSKrKcEv.cjs"),t=require("./externalLibsMode-Dm8a-Jd9.cjs");exports.NovelEditor=e.NovelEditor,exports.ReasonDocs=o.Index,exports.RichTextProvider=r.RichTextProvider,exports.externalLibsModeActions=t.externalLibsModeActions,exports.getExternalLibsMode=t.getExternalLibsMode,exports.useExternalLibsMode=t.useExternalLibsMode,exports.useNovelEditor=e.useNovelEditor;
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- import{a as o,i as s}from"./editorConfig-BDVG1hyU.js";import{t as r}from"./ReasonDocs-Bgyy-dnb.js";import{t as a}from"./RichTextProvider-CHcaIPMd.js";import{n as t,r as i,t as e}from"./externalLibsMode-DEDBnK98.js";export{s as NovelEditor,r as ReasonDocs,a as RichTextProvider,e as externalLibsModeActions,t as getExternalLibsMode,i as useExternalLibsMode,o as useNovelEditor};
1
+ import{a as o,i as s}from"./editorConfig-BDVG1hyU.js";import{t as r}from"./ReasonDocs-DkUKYeNa.js";import{t as a}from"./RichTextProvider-CHcaIPMd.js";import{n as t,r as i,t as e}from"./externalLibsMode-DEDBnK98.js";export{s as NovelEditor,r as ReasonDocs,a as RichTextProvider,e as externalLibsModeActions,t as getExternalLibsMode,i as useExternalLibsMode,o as useNovelEditor};
@@ -1,2 +1,2 @@
1
1
  import { SidebarProps } from './types';
2
- export declare const Sidebar: ({ documents, activeId, activeDocument, onSelect, onAdd, onDelete, onDuplicate, onMove, onManageTags, onRename, onSearchFocus, isOpen, onOpenChange, isMobile, leftPanels, onLeftPanelsChange, leftSplit, onLeftSplitChange, rightPanels, onRightPanelsChange, rightSplit, onRightSplitChange, onSettingsClick, onRestore, newDocumentId, showDynamicIsland, onToggleDynamicIsland, activeFileSourceId, onFileSourceChange, headings, onNavigate, editorRef, openTabs, activeTab, onTabChange, onTabClose, onTabRename, onSplitRight, onReopenLastClosed, canReopenLastClosed, aiProps, tabItems, onNewChat, }: SidebarProps) => import("react").JSX.Element;
2
+ export declare const Sidebar: ({ documents, activeId, activeDocument, onSelect, onAdd, onDelete, onDuplicate, onMove, onManageTags, onRename, onSearchFocus, isOpen, onOpenChange, isMobile, leftPanels, onLeftPanelsChange, leftSplit, onLeftSplitChange, rightPanels, onRightPanelsChange, rightSplit, onRightSplitChange, onSettingsClick, onRestore, newDocumentId, showDynamicIsland, onToggleDynamicIsland, activeFileSourceId, onFileSourceChange, headings, onNavigate, editorRef, openTabs, activeTab, onTabChange, onTabClose, onTabRename, onSplitRight, onReopenLastClosed, canReopenLastClosed, aiProps, tipsProps, topicsProps, tabItems, onNewChat, }: SidebarProps) => import("react").JSX.Element;
@@ -2,7 +2,7 @@ import { RefObject } from 'react';
2
2
  import { OutlineViewHandle } from '../../search/OutlineView';
3
3
  import { ActiveHeadingEditorHandle } from '../../search/useActiveHeading';
4
4
  import { Document } from '../../documents/DocumentTree';
5
- import { SidebarPanelType, SidebarAiProps, OpenTabItem } from './types';
5
+ import { SidebarPanelType, SidebarAiProps, SidebarTipsProps, SidebarTopicsProps, OpenTabItem } from './types';
6
6
  import { TocEntry } from '../../app-types/toc';
7
7
  type DocumentTreeHandle = {
8
8
  collapseAll: () => void;
@@ -71,6 +71,10 @@ interface SidebarContentProps {
71
71
  onNavigate?: (key: string) => void;
72
72
  /** AI suggestion state/handlers (used by the "ai" panel). */
73
73
  aiProps?: SidebarAiProps;
74
+ /** AI-generated page tips state/handlers (used by the "ai" panel). */
75
+ tipsProps?: SidebarTipsProps;
76
+ /** AI-generated search topics state/handlers (used by the "related" panel). */
77
+ topicsProps?: SidebarTopicsProps;
74
78
  /** Unified tab list (files + chats). Overrides file-only tab derivation when set. */
75
79
  tabItems?: OpenTabItem[];
76
80
  /** Opens a new chat tab from the "Open Tabs" panel header. */
@@ -80,5 +84,5 @@ interface SidebarContentProps {
80
84
  * Renders the enabled panels for one side of the layout, stacked in a
81
85
  * resizable vertical split when more than one panel is active.
82
86
  */
83
- export declare const SidebarContent: ({ panels, split, persistenceKey, activeDocuments, activeId, activeDocument, headings, isMobile, onSelect, onAdd, onDelete, onDuplicate, onMove, onManageTags, onRename, onOpenChange, treeRef, outlineRef, editorRef, openTabs, activeTab, onTabChange, onTabClose, onTabRename, onSplitRight, onReopenLastClosed, canReopenLastClosed, onNavigate, aiProps, tabItems, onNewChat, }: SidebarContentProps) => import("react").JSX.Element;
87
+ export declare const SidebarContent: ({ panels, split, persistenceKey, activeDocuments, activeId, activeDocument, headings, isMobile, onSelect, onAdd, onDelete, onDuplicate, onMove, onManageTags, onRename, onOpenChange, treeRef, outlineRef, editorRef, openTabs, activeTab, onTabChange, onTabClose, onTabRename, onSplitRight, onReopenLastClosed, canReopenLastClosed, onNavigate, aiProps, tipsProps, topicsProps, tabItems, onNewChat, }: SidebarContentProps) => import("react").JSX.Element;
84
88
  export {};
@@ -32,6 +32,35 @@ export interface SidebarAiProps {
32
32
  onAiReject?: () => void;
33
33
  onAiRegenerate?: (mode: any) => void;
34
34
  }
35
+ /**
36
+ * AI-generated tips about the currently active document, shown as a section
37
+ * of the "ai" panel. Omitted entirely (and the section hidden) when the
38
+ * host app has no tips-generation capability to offer.
39
+ */
40
+ export interface SidebarTipsProps {
41
+ /** Tips generated for the active document by the most recent request. */
42
+ tips?: string[];
43
+ /** Whether a tips-generation request is in flight. */
44
+ isTipsLoading?: boolean;
45
+ /** Requests (re)generation of tips for the active document. */
46
+ onGenerateTips?: () => void;
47
+ }
48
+ /**
49
+ * AI-generated suggested search queries ("topics") related to the currently
50
+ * active document, shown as a section of the "related" panel. Omitted
51
+ * entirely (and the section hidden) when the host app has no
52
+ * topics-generation capability to offer.
53
+ */
54
+ export interface SidebarTopicsProps {
55
+ /** Suggested search queries generated for the active document by the most recent request. */
56
+ topics?: string[];
57
+ /** Whether a topics-generation request is in flight. */
58
+ isTopicsLoading?: boolean;
59
+ /** Requests (re)generation of topics for the active document. */
60
+ onGenerateTopics?: () => void;
61
+ /** Runs a search for the given topic (e.g. opens a new chat seeded with it). */
62
+ onSearchTopic?: (topic: string) => void;
63
+ }
35
64
  export interface SidebarProps {
36
65
  documents: Document[];
37
66
  activeId: string | null;
@@ -82,4 +111,6 @@ export interface SidebarProps {
82
111
  tabItems?: OpenTabItem[];
83
112
  onNewChat?: () => void;
84
113
  aiProps?: SidebarAiProps;
114
+ tipsProps?: SidebarTipsProps;
115
+ topicsProps?: SidebarTopicsProps;
85
116
  }
@@ -1 +1 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("./rolldown-runtime-BeavJI0R.cjs");const e=require("./ReasonDocs-CIatd_iE.cjs");exports.ReasonDocs=e.Index;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("./rolldown-runtime-BeavJI0R.cjs");const e=require("./ReasonDocs-B4rT3-HS.cjs");exports.ReasonDocs=e.Index;
@@ -1 +1 @@
1
- import{t as o}from"./ReasonDocs-Bgyy-dnb.js";export{o as ReasonDocs};
1
+ import{t as o}from"./ReasonDocs-DkUKYeNa.js";export{o as ReasonDocs};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-reason-editor",
3
- "version": "1.0.60",
3
+ "version": "1.0.62",
4
4
  "description": "A modern WYSIWYG rich text editor based on tiptap and shadcn ui for React",
5
5
  "repository": {
6
6
  "type": "git",