@bendyline/docblocks-react 2.2.0 → 2.2.2

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,11 +1,11 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import { FileSystemProvider, FileSystemEntry } from '@bendyline/docblocks/filesystem';
2
+ import { FileSystemProvider, FileSystemEntry, FsErrorCode } from '@bendyline/docblocks/filesystem';
3
3
  import { WorkspaceDescriptor } from '@bendyline/docblocks/workspace';
4
4
  import { EditorColorScheme } from '@bendyline/squisq-editor-react';
5
5
  import { FfmpegWasmLoadConfig } from '@bendyline/squisq-video';
6
6
  import { PrunePolicy, SaveVersionResult, DocumentVersionManager } from '@bendyline/squisq/versions';
7
7
  import { ThemePreference, AccentColor, WriteCanvasPreferences } from './settings/index.js';
8
- export { AccentColorSettings, AccentColorSettingsProps, SettingsDialog, SettingsDialogProps, ThemeSettings, ThemeSettingsProps, WriteCanvasSettingsControls, WriteCanvasSettingsControlsProps } from './settings/index.js';
8
+ export { AccentColorSettings, AccentColorSettingsProps, DEFAULT_WRITE_CANVAS_FONT_SCHEME, SettingsDialog, SettingsDialogProps, ThemeSettings, ThemeSettingsProps, WRITE_CANVAS_FONT_SCHEMES, WriteCanvasFontScheme, WriteCanvasFontSchemeGroup, WriteCanvasFontSchemeOption, WriteCanvasSettingsControls, WriteCanvasSettingsControlsProps, resolveWriteCanvasFonts } from './settings/index.js';
9
9
  import { SharedDocumentMode } from '@bendyline/docblocks/share';
10
10
  import { ContentContainer } from '@bendyline/squisq/storage';
11
11
  import { VideoExportModalProps } from '@bendyline/squisq-video-react';
@@ -15,6 +15,17 @@ import { DocumentSession, DocumentSessionSnapshot } from '@bendyline/docblocks/d
15
15
  import 'react';
16
16
  import '@bendyline/squisq-formats/pptx';
17
17
 
18
+ interface PinnedDocument {
19
+ readonly workspaceId: string;
20
+ readonly workspaceName: string;
21
+ /** Canonical, root-relative workspace path. */
22
+ readonly path: string;
23
+ }
24
+ type PinnedDocumentAvailability = 'unknown' | 'available' | 'missing';
25
+ interface PinnedDocumentListItem extends PinnedDocument {
26
+ readonly availability: PinnedDocumentAvailability;
27
+ }
28
+
18
29
  type FileTreeChange = {
19
30
  type: 'create';
20
31
  path: string;
@@ -39,6 +50,22 @@ interface FileExplorerProps {
39
50
  provider: FileSystemProvider | null;
40
51
  /** Active document to select and reveal by expanding all ancestor folders. */
41
52
  activeFilePath?: string | null;
53
+ /** Active workspace identity, used to decorate a selected cross-workspace pin. */
54
+ activeWorkspaceId?: string | null;
55
+ /** Documents pinned across every workspace, shown above the active file tree. */
56
+ pinnedDocuments?: readonly PinnedDocumentListItem[];
57
+ /** Canonical paths pinned inside the active workspace. */
58
+ pinnedPaths?: readonly string[];
59
+ /** Opens a pinned document, switching workspace when necessary. */
60
+ onPinnedDocumentSelect?: (document: PinnedDocumentListItem) => void;
61
+ /** Removes a document from the global pinned list. */
62
+ onPinnedDocumentUnpin?: (document: PinnedDocumentListItem) => void | Promise<void>;
63
+ /** Renames a pinned document without requiring its workspace to be active. */
64
+ onPinnedDocumentRename?: (document: PinnedDocumentListItem) => void | Promise<void>;
65
+ /** Deletes a pinned document without requiring its workspace to be active. */
66
+ onPinnedDocumentDelete?: (document: PinnedDocumentListItem) => void | Promise<void>;
67
+ /** Pins or unpins a file in the active workspace. */
68
+ onTogglePin?: (path: string) => void | Promise<void>;
42
69
  /** Called when any entry is selected (file or directory). */
43
70
  onSelect?: (path: string, kind: 'file' | 'directory') => void;
44
71
  /**
@@ -63,7 +90,7 @@ interface FileExplorerProps {
63
90
  /** Optional className for the root element. */
64
91
  className?: string;
65
92
  }
66
- declare function FileExplorer({ provider, activeFilePath, onSelect, onTreeMutation, onTreeChange, onImportFiles, confirmDelete, moveDestinations, onMoveToWorkspace, className, }: FileExplorerProps): react_jsx_runtime.JSX.Element;
93
+ declare function FileExplorer({ provider, activeFilePath, activeWorkspaceId, pinnedDocuments, pinnedPaths, onPinnedDocumentSelect, onPinnedDocumentUnpin, onPinnedDocumentRename, onPinnedDocumentDelete, onTogglePin, onSelect, onTreeMutation, onTreeChange, onImportFiles, confirmDelete, moveDestinations, onMoveToWorkspace, className, }: FileExplorerProps): react_jsx_runtime.JSX.Element;
67
94
 
68
95
  /** Git decoration for a row — precomputed by FileExplorer so this node stays context-free. */
69
96
  interface FileTreeNodeBadge {
@@ -109,6 +136,10 @@ interface FileTreeNodeProps {
109
136
  confirmDelete?: (message: string) => boolean | Promise<boolean>;
110
137
  onDelete: (path: string, kind: 'file' | 'directory') => Promise<void>;
111
138
  onRename: (oldPath: string, newPath: string, kind: 'file' | 'directory') => Promise<void>;
139
+ /** Whether this document is present in the shell's cross-workspace pin list. */
140
+ pinned?: boolean;
141
+ /** Pin or unpin this file. Omitted for directories and standalone trees. */
142
+ onTogglePin?: (path: string) => void | Promise<void>;
112
143
  draggable?: boolean;
113
144
  dragging?: boolean;
114
145
  dropTarget?: boolean;
@@ -117,14 +148,26 @@ interface FileTreeNodeProps {
117
148
  onDragOverEntry?: (event: React.DragEvent, entry: FileSystemEntry) => void;
118
149
  onDropEntry?: (event: React.DragEvent, entry: FileSystemEntry) => void;
119
150
  renderChildren?: (dirPath: string) => React.ReactNode;
151
+ /** Path-scoped directory loading failure, rendered outside the ARIA tree group. */
152
+ childError?: React.ReactNode;
120
153
  }
121
- declare function FileTreeNode({ entry, depth, expanded, selected, badge, gitActions, focusable, posInSet, setSize, onRowFocus, onToggle, onSelect, confirmDelete, onDelete, onRename, draggable, dragging, dropTarget, onDragStart, onDragEnd, onDragOverEntry, onDropEntry, renderChildren, }: FileTreeNodeProps): react_jsx_runtime.JSX.Element;
154
+ declare function FileTreeNode({ entry, depth, expanded, selected, badge, gitActions, focusable, posInSet, setSize, onRowFocus, onToggle, onSelect, confirmDelete, onDelete, onRename, pinned, onTogglePin, draggable, dragging, dropTarget, onDragStart, onDragEnd, onDragOverEntry, onDropEntry, renderChildren, childError, }: FileTreeNodeProps): react_jsx_runtime.JSX.Element;
122
155
 
123
156
  /**
124
157
  * useFileTree — hook that reads from a FileSystemProvider,
125
158
  * maintains expanded/collapsed state, and provides CRUD operations.
126
159
  */
127
160
 
161
+ interface FileTreeReadIssue {
162
+ /** Directory whose listing was requested, in canonical workspace-relative form. */
163
+ readonly directoryPath: string;
164
+ /** Exact failing path supplied by the filesystem error. */
165
+ readonly path: string;
166
+ readonly code: FsErrorCode;
167
+ readonly message: string;
168
+ /** Whether another user-initiated attempt can reasonably succeed. */
169
+ readonly retryable: boolean;
170
+ }
128
171
  interface FileTreeState {
129
172
  /** Flat list of entries for the current directory view. */
130
173
  entries: FileSystemEntry[];
@@ -136,8 +179,14 @@ interface FileTreeState {
136
179
  selectedKind: 'file' | 'directory' | null;
137
180
  /** Whether the tree is loading. */
138
181
  loading: boolean;
139
- /** Latest provider/read/watch failure, cleared by a successful refresh. */
182
+ /** Root provider/read/watch failure, retained for backwards compatibility. */
140
183
  error: string | null;
184
+ /** Structured root failure, including its exact filesystem path. */
185
+ rootIssue: FileTreeReadIssue | null;
186
+ /** Failures scoped to expanded child directories. */
187
+ childIssues: ReadonlyMap<string, FileTreeReadIssue>;
188
+ /** Cached listings for expanded child directories. */
189
+ childEntries: ReadonlyMap<string, FileSystemEntry[]>;
141
190
  }
142
191
  interface FileTreeActions {
143
192
  /** Toggle a directory's expanded state. */
@@ -156,6 +205,8 @@ interface FileTreeActions {
156
205
  renameEntry: (oldPath: string, newPath: string, kind?: 'file' | 'directory') => Promise<void>;
157
206
  /** Force refresh the tree. */
158
207
  refresh: () => Promise<void>;
208
+ /** Retry one failed directory without treating it as a workspace-root failure. */
209
+ retryDirectory: (path: string) => Promise<void>;
159
210
  }
160
211
  declare function useFileTree(provider: FileSystemProvider | null): FileTreeState & FileTreeActions;
161
212
 
@@ -219,18 +270,20 @@ interface DocBlocksShellProps {
219
270
  /**
220
271
  * True when a new deploy is waiting (browser PWA hosts: a fresh service
221
272
  * worker finished installing). The shell shows an "Update available"
222
- * status-bar notice that opens a Reload/Later prompt.
273
+ * status-bar notice; clicking it opens a nearby Reload/Later prompt.
223
274
  */
224
275
  updateAvailable?: boolean;
225
276
  /** Activates the waiting update and reloads onto the new version. */
226
277
  onApplyUpdate?: () => void;
278
+ /** Host-supplied content rendered at the right edge of the editor status bar. */
279
+ statusBarSlotRight?: React.ReactNode;
227
280
  /**
228
281
  * True once the app has been fully cached for offline use (browser PWA
229
282
  * hosts). Shown to the user once as a passive notice.
230
283
  */
231
284
  offlineReady?: boolean;
232
285
  }
233
- declare function DocBlocksShell({ theme: hostTheme, logoUrl, issueReportVersion, appBuildDate, ffmpegWasm, homeDocumentTitle, homeDocumentPath, allowVersioning, versionBasename, versioningPrunePolicy, versioningAutoSaveIdleMs, onSaveVersion, versioningRef, updateAvailable, onApplyUpdate, offlineReady, }: DocBlocksShellProps): react_jsx_runtime.JSX.Element;
286
+ declare function DocBlocksShell({ theme: hostTheme, logoUrl, issueReportVersion, appBuildDate, ffmpegWasm, homeDocumentTitle, homeDocumentPath, allowVersioning, versionBasename, versioningPrunePolicy, versioningAutoSaveIdleMs, onSaveVersion, versioningRef, updateAvailable, onApplyUpdate, statusBarSlotRight, offlineReady, }: DocBlocksShellProps): react_jsx_runtime.JSX.Element;
234
287
 
235
288
  /**
236
289
  * Versioning preferences — global default + per-workspace resolution.
@@ -354,4 +407,4 @@ interface UseDocumentSessionResult {
354
407
  */
355
408
  declare function useDocumentSession(autoSaveDelayMs?: number): UseDocumentSessionResult;
356
409
 
357
- export { AccentColor, AppMenu, type AppMenuProps, DocBlocksShell, type DocBlocksShellProps, ExportBlobSaver, type ExportDestinationAdapter, type ExportDestinationTarget, ExportToolbarControls, type ExportToolbarControlsProps, FileExplorer, type FileExplorerProps, type FileTreeChange, type FileTreeMutationHandler, FileTreeNode, type FileTreeNodeProps, ThemePreference, type UseDocumentSessionResult, WorkspacePicker, type WorkspacePickerProps, WriteCanvasPreferences, useDocumentSession, useFileTree };
410
+ export { AccentColor, AppMenu, type AppMenuProps, DocBlocksShell, type DocBlocksShellProps, ExportBlobSaver, type ExportDestinationAdapter, type ExportDestinationTarget, ExportToolbarControls, type ExportToolbarControlsProps, FileExplorer, type FileExplorerProps, type FileTreeActions, type FileTreeChange, type FileTreeMutationHandler, FileTreeNode, type FileTreeNodeProps, type FileTreeReadIssue, type FileTreeState, ThemePreference, type UseDocumentSessionResult, WorkspacePicker, type WorkspacePickerProps, WriteCanvasPreferences, useDocumentSession, useFileTree };