@bendyline/docblocks-react 2.2.1 → 2.3.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,12 +1,13 @@
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
+ import { MediaProvider } from '@bendyline/squisq/schemas';
10
11
  import { ContentContainer } from '@bendyline/squisq/storage';
11
12
  import { VideoExportModalProps } from '@bendyline/squisq-video-react';
12
13
  import { ExportBlobSaver } from './export/index.js';
@@ -15,6 +16,19 @@ import { DocumentSession, DocumentSessionSnapshot } from '@bendyline/docblocks/d
15
16
  import 'react';
16
17
  import '@bendyline/squisq-formats/pptx';
17
18
 
19
+ interface PinnedDocument {
20
+ readonly workspaceId: string;
21
+ readonly workspaceName: string;
22
+ /** Canonical, root-relative workspace path. */
23
+ readonly path: string;
24
+ }
25
+ type PinnedDocumentAvailability = 'unknown' | 'available' | 'missing';
26
+ interface PinnedDocumentListItem extends PinnedDocument {
27
+ readonly availability: PinnedDocumentAvailability;
28
+ }
29
+
30
+ type FileExplorerSortMode = 'name' | 'last-modified';
31
+
18
32
  type FileTreeChange = {
19
33
  type: 'create';
20
34
  path: string;
@@ -37,8 +51,30 @@ interface WorkspaceMoveDestination {
37
51
  interface FileExplorerProps {
38
52
  /** The filesystem to display. */
39
53
  provider: FileSystemProvider | null;
54
+ /** Changes after a non-watch provider has durably updated file metadata. */
55
+ metadataRefreshKey?: string | number | null;
40
56
  /** Active document to select and reveal by expanding all ancestor folders. */
41
57
  activeFilePath?: string | null;
58
+ /** Presentation order for files within each directory. */
59
+ sortMode?: FileExplorerSortMode;
60
+ /** Called when a file ordering toolbar button is selected. */
61
+ onSortModeChange?: (mode: FileExplorerSortMode) => void;
62
+ /** Active workspace identity, used to decorate a selected cross-workspace pin. */
63
+ activeWorkspaceId?: string | null;
64
+ /** Documents pinned across every workspace, shown above the active file tree. */
65
+ pinnedDocuments?: readonly PinnedDocumentListItem[];
66
+ /** Canonical paths pinned inside the active workspace. */
67
+ pinnedPaths?: readonly string[];
68
+ /** Opens a pinned document, switching workspace when necessary. */
69
+ onPinnedDocumentSelect?: (document: PinnedDocumentListItem) => void;
70
+ /** Removes a document from the global pinned list. */
71
+ onPinnedDocumentUnpin?: (document: PinnedDocumentListItem) => void | Promise<void>;
72
+ /** Renames a pinned document without requiring its workspace to be active. */
73
+ onPinnedDocumentRename?: (document: PinnedDocumentListItem) => void | Promise<void>;
74
+ /** Deletes a pinned document without requiring its workspace to be active. */
75
+ onPinnedDocumentDelete?: (document: PinnedDocumentListItem) => void | Promise<void>;
76
+ /** Pins or unpins a file in the active workspace. */
77
+ onTogglePin?: (path: string) => void | Promise<void>;
42
78
  /** Called when any entry is selected (file or directory). */
43
79
  onSelect?: (path: string, kind: 'file' | 'directory') => void;
44
80
  /**
@@ -63,7 +99,7 @@ interface FileExplorerProps {
63
99
  /** Optional className for the root element. */
64
100
  className?: string;
65
101
  }
66
- declare function FileExplorer({ provider, activeFilePath, onSelect, onTreeMutation, onTreeChange, onImportFiles, confirmDelete, moveDestinations, onMoveToWorkspace, className, }: FileExplorerProps): react_jsx_runtime.JSX.Element;
102
+ declare function FileExplorer({ provider, metadataRefreshKey, activeFilePath, sortMode, onSortModeChange, activeWorkspaceId, pinnedDocuments, pinnedPaths, onPinnedDocumentSelect, onPinnedDocumentUnpin, onPinnedDocumentRename, onPinnedDocumentDelete, onTogglePin, onSelect, onTreeMutation, onTreeChange, onImportFiles, confirmDelete, moveDestinations, onMoveToWorkspace, className, }: FileExplorerProps): react_jsx_runtime.JSX.Element;
67
103
 
68
104
  /** Git decoration for a row — precomputed by FileExplorer so this node stays context-free. */
69
105
  interface FileTreeNodeBadge {
@@ -109,6 +145,10 @@ interface FileTreeNodeProps {
109
145
  confirmDelete?: (message: string) => boolean | Promise<boolean>;
110
146
  onDelete: (path: string, kind: 'file' | 'directory') => Promise<void>;
111
147
  onRename: (oldPath: string, newPath: string, kind: 'file' | 'directory') => Promise<void>;
148
+ /** Whether this document is present in the shell's cross-workspace pin list. */
149
+ pinned?: boolean;
150
+ /** Pin or unpin this file. Omitted for directories and standalone trees. */
151
+ onTogglePin?: (path: string) => void | Promise<void>;
112
152
  draggable?: boolean;
113
153
  dragging?: boolean;
114
154
  dropTarget?: boolean;
@@ -117,14 +157,26 @@ interface FileTreeNodeProps {
117
157
  onDragOverEntry?: (event: React.DragEvent, entry: FileSystemEntry) => void;
118
158
  onDropEntry?: (event: React.DragEvent, entry: FileSystemEntry) => void;
119
159
  renderChildren?: (dirPath: string) => React.ReactNode;
160
+ /** Path-scoped directory loading failure, rendered outside the ARIA tree group. */
161
+ childError?: React.ReactNode;
120
162
  }
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;
163
+ 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
164
 
123
165
  /**
124
166
  * useFileTree — hook that reads from a FileSystemProvider,
125
167
  * maintains expanded/collapsed state, and provides CRUD operations.
126
168
  */
127
169
 
170
+ interface FileTreeReadIssue {
171
+ /** Directory whose listing was requested, in canonical workspace-relative form. */
172
+ readonly directoryPath: string;
173
+ /** Exact failing path supplied by the filesystem error. */
174
+ readonly path: string;
175
+ readonly code: FsErrorCode;
176
+ readonly message: string;
177
+ /** Whether another user-initiated attempt can reasonably succeed. */
178
+ readonly retryable: boolean;
179
+ }
128
180
  interface FileTreeState {
129
181
  /** Flat list of entries for the current directory view. */
130
182
  entries: FileSystemEntry[];
@@ -136,8 +188,14 @@ interface FileTreeState {
136
188
  selectedKind: 'file' | 'directory' | null;
137
189
  /** Whether the tree is loading. */
138
190
  loading: boolean;
139
- /** Latest provider/read/watch failure, cleared by a successful refresh. */
191
+ /** Root provider/read/watch failure, retained for backwards compatibility. */
140
192
  error: string | null;
193
+ /** Structured root failure, including its exact filesystem path. */
194
+ rootIssue: FileTreeReadIssue | null;
195
+ /** Failures scoped to expanded child directories. */
196
+ childIssues: ReadonlyMap<string, FileTreeReadIssue>;
197
+ /** Cached listings for expanded child directories. */
198
+ childEntries: ReadonlyMap<string, FileSystemEntry[]>;
141
199
  }
142
200
  interface FileTreeActions {
143
201
  /** Toggle a directory's expanded state. */
@@ -156,8 +214,10 @@ interface FileTreeActions {
156
214
  renameEntry: (oldPath: string, newPath: string, kind?: 'file' | 'directory') => Promise<void>;
157
215
  /** Force refresh the tree. */
158
216
  refresh: () => Promise<void>;
217
+ /** Retry one failed directory without treating it as a workspace-root failure. */
218
+ retryDirectory: (path: string) => Promise<void>;
159
219
  }
160
- declare function useFileTree(provider: FileSystemProvider | null): FileTreeState & FileTreeActions;
220
+ declare function useFileTree(provider: FileSystemProvider | null, metadataRefreshKey?: string | number | null, metadataRefreshPath?: string | null): FileTreeState & FileTreeActions;
161
221
 
162
222
  interface WorkspacePickerProps {
163
223
  /** Currently active workspace id. */
@@ -224,13 +284,15 @@ interface DocBlocksShellProps {
224
284
  updateAvailable?: boolean;
225
285
  /** Activates the waiting update and reloads onto the new version. */
226
286
  onApplyUpdate?: () => void;
287
+ /** Host-supplied content rendered at the right edge of the editor status bar. */
288
+ statusBarSlotRight?: React.ReactNode;
227
289
  /**
228
290
  * True once the app has been fully cached for offline use (browser PWA
229
291
  * hosts). Shown to the user once as a passive notice.
230
292
  */
231
293
  offlineReady?: boolean;
232
294
  }
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;
295
+ 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
296
 
235
297
  /**
236
298
  * Versioning preferences — global default + per-workspace resolution.
@@ -305,6 +367,8 @@ interface ExportToolbarControlsProps {
305
367
  selectedFile: string | null;
306
368
  /** Media container for resolving images during export. */
307
369
  mediaContainer?: ContentContainer | null;
370
+ /** Active document media provider used to preload audio and video export assets. */
371
+ mediaProvider?: MediaProvider | null;
308
372
  /** Override the default browser download behavior for host-provided save flows. */
309
373
  saveBlob?: ExportBlobSaver;
310
374
  /** Optional host adapter for displaying, picking, and saving to a native target path. */
@@ -354,4 +418,4 @@ interface UseDocumentSessionResult {
354
418
  */
355
419
  declare function useDocumentSession(autoSaveDelayMs?: number): UseDocumentSessionResult;
356
420
 
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 };
421
+ export { AccentColor, AppMenu, type AppMenuProps, DocBlocksShell, type DocBlocksShellProps, ExportBlobSaver, type ExportDestinationAdapter, type ExportDestinationTarget, ExportToolbarControls, type ExportToolbarControlsProps, FileExplorer, type FileExplorerProps, type FileExplorerSortMode, type FileTreeActions, type FileTreeChange, type FileTreeMutationHandler, FileTreeNode, type FileTreeNodeProps, type FileTreeReadIssue, type FileTreeState, ThemePreference, type UseDocumentSessionResult, WorkspacePicker, type WorkspacePickerProps, WriteCanvasPreferences, useDocumentSession, useFileTree };