@parallelworks/ui 0.2.0 → 0.3.1
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/README.md +5 -0
- package/dist/chunks/CodePreviewEditor-CSPRILMp.js +61 -0
- package/dist/chunks/Indicator-hBSIxOPK.js +39 -0
- package/dist/chunks/Markdown-C5Re2ezs.js +101 -0
- package/dist/chunks/{Indicator-fF8AVbjQ.js → Modal-sOUEwebV.js} +1 -38
- package/dist/chunks/{Monaco-CP_cL9gp.js → Monaco-CC4ak1JG.js} +3 -31
- package/dist/chunks/Provider-DvVvScTQ.js +391 -0
- package/dist/chunks/StatusBadge-DXp4zkSd.js +46 -0
- package/dist/chunks/{Table-DWuRINhu.js → SwitchToggle-2uRw8ZeJ.js} +2 -132
- package/dist/chunks/Table-C5z6qWjM.js +91 -0
- package/dist/chunks/editor-D55tumuZ.js +372 -0
- package/dist/chunks/list-7PyDF1tz.js +465 -0
- package/dist/components/Provider.d.ts +293 -0
- package/dist/editor/index.d.ts +1 -0
- package/dist/editor/index.js +2 -219
- package/dist/editor/useCssIsDark.d.ts +6 -0
- package/dist/file-explorer/FileExplorer.d.ts +23 -0
- package/dist/file-explorer/FileExplorerContext.d.ts +17 -0
- package/dist/file-explorer/FilePreview/CodePreviewEditor.d.ts +6 -0
- package/dist/file-explorer/FilePreview/Inline.d.ts +13 -0
- package/dist/file-explorer/FilePreview/StreamedBadge.d.ts +1 -0
- package/dist/file-explorer/FilePreview/Viewer.d.ts +15 -0
- package/dist/file-explorer/FilePreview/index.d.ts +15 -0
- package/dist/file-explorer/FilePreview/parse.d.ts +24 -0
- package/dist/file-explorer/FilePreview/previewCache.d.ts +26 -0
- package/dist/file-explorer/FilePreview/previewType.d.ts +21 -0
- package/dist/file-explorer/FilePreview/readCappedBytes.d.ts +37 -0
- package/dist/file-explorer/FilePreview/useObjectBlobUrl.d.ts +16 -0
- package/dist/file-explorer/FilePreview/useObjectText.d.ts +23 -0
- package/dist/file-explorer/FilePreview/usePresignedUrl.d.ts +12 -0
- package/dist/file-explorer/FileRow.d.ts +35 -0
- package/dist/file-explorer/FileRowsWindow.d.ts +43 -0
- package/dist/file-explorer/FileTable.d.ts +26 -0
- package/dist/file-explorer/FileTableHeaders.d.ts +13 -0
- package/dist/file-explorer/LoadMoreRow.d.ts +15 -0
- package/dist/file-explorer/TreeView.d.ts +28 -0
- package/dist/file-explorer/helpers.d.ts +47 -0
- package/dist/file-explorer/index.d.ts +10 -0
- package/dist/file-explorer/index.js +5646 -0
- package/dist/file-explorer/lib/batch.d.ts +3 -0
- package/dist/file-explorer/lib/errors.d.ts +3 -0
- package/dist/file-explorer/lib/fileExplorer.d.ts +32 -0
- package/dist/file-explorer/lib/paging.d.ts +93 -0
- package/dist/file-explorer/lib/types.d.ts +92 -0
- package/dist/file-explorer/lib/utils.d.ts +37 -0
- package/dist/file-explorer/toasts.d.ts +9 -0
- package/dist/file-explorer/treeRows.d.ts +35 -0
- package/dist/file-explorer/useNearEnd.d.ts +7 -0
- package/dist/form/index.js +4 -2
- package/dist/index.d.ts +1 -1
- package/dist/index.js +9 -101
- package/dist/list/ListTable.d.ts +63 -0
- package/dist/list/RowContextMenu.d.ts +113 -0
- package/dist/list/index.d.ts +2 -0
- package/dist/list/index.js +2 -0
- package/dist/logviewer/index.js +1 -1
- package/dist/styles/theme.css +30 -0
- package/dist/styles.css +1 -1
- package/dist/workflow/index.js +3 -2
- package/package.json +20 -3
- package/dist/chunks/Provider-C2VtPnh5.js +0 -151
- package/dist/chunks/workers-Cjfjb8E7.js +0 -119
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/** Parse CSV/TSV, honoring quoted fields (embedded delimiter/newline/escaped quote);
|
|
2
|
+
* `maxRows` stops early so a big file isn't walked in full for a preview. */
|
|
3
|
+
export declare function parseDelimited(text: string, delimiter: string, maxRows?: number): string[][];
|
|
4
|
+
export interface NotebookOutput {
|
|
5
|
+
output_type: string;
|
|
6
|
+
text?: string | string[];
|
|
7
|
+
data?: Record<string, unknown>;
|
|
8
|
+
ename?: string;
|
|
9
|
+
evalue?: string;
|
|
10
|
+
traceback?: string[];
|
|
11
|
+
}
|
|
12
|
+
export interface NotebookCell {
|
|
13
|
+
cell_type: string;
|
|
14
|
+
source: string | string[];
|
|
15
|
+
outputs?: NotebookOutput[];
|
|
16
|
+
execution_count?: number | null;
|
|
17
|
+
}
|
|
18
|
+
export interface ParsedNotebook {
|
|
19
|
+
cells: NotebookCell[];
|
|
20
|
+
}
|
|
21
|
+
export declare function parseNotebook(text: string): ParsedNotebook | null;
|
|
22
|
+
/** nbformat `source`/`text` is a string or an array of lines; normalize to one string. */
|
|
23
|
+
export declare function joinSource(source: unknown): string;
|
|
24
|
+
export declare function stripAnsi(text: string): string;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
type UrlResult = [string | null, Error | null];
|
|
2
|
+
interface UrlRecord {
|
|
3
|
+
promise: Promise<UrlResult>;
|
|
4
|
+
value?: UrlResult;
|
|
5
|
+
}
|
|
6
|
+
interface ContentRecord<T> {
|
|
7
|
+
promise: Promise<T>;
|
|
8
|
+
value?: T;
|
|
9
|
+
controller: AbortController;
|
|
10
|
+
dispose?: ((value: T) => void) | undefined;
|
|
11
|
+
}
|
|
12
|
+
/** Request a presigned URL for `path` once and remember the result; a failed or
|
|
13
|
+
* empty result is not cached so a later mount retries. */
|
|
14
|
+
export declare function loadPreviewUrl(path: string, loader: () => Promise<UrlResult>): UrlRecord;
|
|
15
|
+
/** Fetch the object for `path` once and remember it; `dispose` frees the value
|
|
16
|
+
* (e.g. revokes a blob URL) when the entry is evicted. A rejected fetch is not
|
|
17
|
+
* cached so a later mount retries. */
|
|
18
|
+
export declare function loadPreviewContent<T>(path: string, loader: (signal: AbortSignal) => Promise<T>, dispose?: (value: T) => void): ContentRecord<T>;
|
|
19
|
+
/** Fetch a preview object over its signed URL; a 401/403 means the URL is stale
|
|
20
|
+
* or unauthorized, so drop it from the cache and let the next mount fetch a fresh
|
|
21
|
+
* one instead of replaying the dead one. */
|
|
22
|
+
export declare function fetchPreviewObject(path: string, url: string, signal: AbortSignal, headers?: HeadersInit): Promise<Response>;
|
|
23
|
+
export declare function peekPreviewUrl(path: string): UrlResult | undefined;
|
|
24
|
+
export declare function peekPreviewContent<T>(path: string): T | undefined;
|
|
25
|
+
export declare function clearPreviewCache(): void;
|
|
26
|
+
export {};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { getFileExtension } from '../lib/utils.js';
|
|
2
|
+
import type { TreeNode } from '../lib/types.js';
|
|
3
|
+
export { getFileExtension };
|
|
4
|
+
export type PreviewKind = 'image' | 'video' | 'audio' | 'pdf' | 'code' | 'csv' | 'notebook' | 'archive' | 'unsupported';
|
|
5
|
+
/** Short-lived so the link doesn't linger; an hour covers a viewing session. */
|
|
6
|
+
export declare const PREVIEW_URL_EXPIRES_IN: number;
|
|
7
|
+
/** Cap text pulled into the tab; media streams through native elements uncapped. */
|
|
8
|
+
export declare const CODE_PREVIEW_MAX_BYTES: number;
|
|
9
|
+
export declare const TABULAR_PREVIEW_MAX_BYTES: number;
|
|
10
|
+
export declare const CSV_PREVIEW_MAX_ROWS = 500;
|
|
11
|
+
/** A line cap bounds what a text preview holds and renders; the byte cap above cuts
|
|
12
|
+
* short whatever the line cap hasn't, and refuses outright only content with no line
|
|
13
|
+
* break to cut on. Well under Monaco's 20MB and 300K-line thresholds, past which it
|
|
14
|
+
* stops tokenizing and highlighting dies. */
|
|
15
|
+
export declare const CODE_PREVIEW_MAX_LINES = 5000;
|
|
16
|
+
/** Fetched into a blob URL to render inline regardless of served content type; falls back to download above this. */
|
|
17
|
+
export declare const PDF_PREVIEW_MAX_BYTES: number;
|
|
18
|
+
export declare function getMonacoLanguage(node: TreeNode): string;
|
|
19
|
+
/** Content type wins when present; extension is the fallback. */
|
|
20
|
+
export declare function getPreviewKind(node: TreeNode): PreviewKind;
|
|
21
|
+
export declare function canPreview(node: TreeNode): boolean;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/** Read a Response body but stop once it passes `maxBytes` (returning `tooLarge`), so an object whose listed size is missing or under-reported can't be pulled fully into the tab. */
|
|
2
|
+
export declare function readCappedBytes(response: Response, maxBytes: number): Promise<{
|
|
3
|
+
bytes: Uint8Array<ArrayBuffer>;
|
|
4
|
+
tooLarge: boolean;
|
|
5
|
+
}>;
|
|
6
|
+
/** Lines a preview will render; a trailing newline doesn't open another line. */
|
|
7
|
+
export declare function countLines(text: string): number;
|
|
8
|
+
interface CappedText {
|
|
9
|
+
text: string;
|
|
10
|
+
tooLarge: boolean;
|
|
11
|
+
truncated: boolean;
|
|
12
|
+
}
|
|
13
|
+
/** Read a Response as text capped at `maxBytes`; when `maxLines` is given, cancel the stream
|
|
14
|
+
* once that many `\n` arrive. Cutting on `\n` keeps the returned prefix on a clean UTF-8 boundary. */
|
|
15
|
+
export declare function readCappedText(response: Response, maxBytes: number, maxLines?: number): Promise<CappedText>;
|
|
16
|
+
/** Keep the last `maxLines` lines, ignoring a single trailing newline so a file
|
|
17
|
+
* ending in one doesn't spend a line on the empty remainder. */
|
|
18
|
+
export declare function lastLines(text: string, maxLines: number): {
|
|
19
|
+
text: string;
|
|
20
|
+
truncated: boolean;
|
|
21
|
+
};
|
|
22
|
+
/** Range header for reading the last `maxBytes` of an object. A closed range is a
|
|
23
|
+
* CORS-safelisted header value, so it travels without a preflight that a bucket's
|
|
24
|
+
* CORS rules may not answer; the suffix form is not safelisted, and is only reached
|
|
25
|
+
* for workspace files, which are same-origin and list no size. Closing the range at
|
|
26
|
+
* the listed size also bounds the window: left open, an object that grew since the
|
|
27
|
+
* listing would serve more than `maxBytes` and the read would refuse it. */
|
|
28
|
+
export declare function tailRangeFor(knownSize: number | undefined, maxBytes: number): string | null;
|
|
29
|
+
/** What a ranged response actually delivered: whether its first line arrives cut in
|
|
30
|
+
* half, or `null` when the body can't be the object's end at all. */
|
|
31
|
+
export declare function tailWindow(response: Response, maxBytes: number): {
|
|
32
|
+
startsMidObject: boolean;
|
|
33
|
+
} | null;
|
|
34
|
+
/** Read a range covering the end of an object as text. `startsMidObject` says the
|
|
35
|
+
* range began at an arbitrary byte, so the first line arrives cut in half. */
|
|
36
|
+
export declare function readTailText(response: Response, maxBytes: number, maxLines: number | undefined, startsMidObject: boolean): Promise<CappedText>;
|
|
37
|
+
export {};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
interface ObjectBlobState {
|
|
2
|
+
blobUrl: string | null;
|
|
3
|
+
loading: boolean;
|
|
4
|
+
error: string | null;
|
|
5
|
+
tooLarge: boolean;
|
|
6
|
+
corsError: boolean;
|
|
7
|
+
}
|
|
8
|
+
/** Fetch an object into a blob URL with a forced MIME type so e.g. PDFs render inline even when served as octet-stream; cached per `cacheKey` so repeated mounts share one download and one blob URL, revoked when the cache drops it. */
|
|
9
|
+
export declare function useObjectBlobUrl(url: string | null, { enabled, maxBytes, knownSize, mimeType, cacheKey, }: {
|
|
10
|
+
enabled: boolean;
|
|
11
|
+
maxBytes: number;
|
|
12
|
+
knownSize?: number | undefined;
|
|
13
|
+
mimeType: string;
|
|
14
|
+
cacheKey: string;
|
|
15
|
+
}): ObjectBlobState;
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
interface TextResult {
|
|
2
|
+
text: string | null;
|
|
3
|
+
tooLarge: boolean;
|
|
4
|
+
truncated: boolean;
|
|
5
|
+
}
|
|
6
|
+
interface ObjectTextState extends TextResult {
|
|
7
|
+
loading: boolean;
|
|
8
|
+
error: string | null;
|
|
9
|
+
corsError: boolean;
|
|
10
|
+
}
|
|
11
|
+
/** Fetch a text object from a presigned URL, cached per `cacheKey` so repeated mounts
|
|
12
|
+
* download it once. `maxLines` stops the read early and `maxBytes` cuts short what it
|
|
13
|
+
* hasn't. `tail` reads the end of the object instead of the start, and caches
|
|
14
|
+
* separately because the same object yields different text. */
|
|
15
|
+
export declare function useObjectText(url: string | null, { enabled, maxBytes, maxLines, knownSize, cacheKey, tail, }: {
|
|
16
|
+
enabled: boolean;
|
|
17
|
+
maxBytes: number;
|
|
18
|
+
maxLines?: number | undefined;
|
|
19
|
+
knownSize?: number | undefined;
|
|
20
|
+
cacheKey: string;
|
|
21
|
+
tail?: boolean | undefined;
|
|
22
|
+
}): ObjectTextState;
|
|
23
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { TreeNode } from '../lib/types.js';
|
|
2
|
+
interface PresignedUrlState {
|
|
3
|
+
url: string | null;
|
|
4
|
+
loading: boolean;
|
|
5
|
+
error: string | null;
|
|
6
|
+
}
|
|
7
|
+
/** Fetch a presigned URL per file, cached so repeated mounts share one request; callbacks come from refs so the effect keys only on file identity. */
|
|
8
|
+
export declare function usePresignedUrl(node: TreeNode | null, getPresignedUrl: (node: TreeNode) => Promise<[string | null, Error | null]>, { enabled, linkErrorMessage }: {
|
|
9
|
+
enabled: boolean;
|
|
10
|
+
linkErrorMessage: string;
|
|
11
|
+
}): PresignedUrlState;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { type OpenMenu, type RowMenuItem } from '../list/index.js';
|
|
2
|
+
import type { ReactNode } from 'react';
|
|
3
|
+
import type { TreeNode } from './lib/types.js';
|
|
4
|
+
export declare const ROW_HEIGHT_SHORT = 45;
|
|
5
|
+
export declare const ROW_HEIGHT_TALL = 52.25;
|
|
6
|
+
export declare function isTwoLineRow(node: TreeNode): boolean;
|
|
7
|
+
/** Pure function of the node, so the virtualizer sizes rows without measuring. */
|
|
8
|
+
export declare function fileRowHeight(node: TreeNode): number;
|
|
9
|
+
interface FileRowProps {
|
|
10
|
+
node: TreeNode;
|
|
11
|
+
icon: ReactNode;
|
|
12
|
+
/** Target for the table's aria-activedescendant. */
|
|
13
|
+
rowId: string;
|
|
14
|
+
/** True position in the folder, which a windowed table cannot convey from DOM order. */
|
|
15
|
+
rowIndex: number;
|
|
16
|
+
/** The keyboard cursor row. Focus stays on the container, so nothing else marks it. */
|
|
17
|
+
active: boolean;
|
|
18
|
+
checked: boolean;
|
|
19
|
+
canPreview: boolean;
|
|
20
|
+
getItems: () => RowMenuItem[];
|
|
21
|
+
openMenu: OpenMenu;
|
|
22
|
+
onOpen: (node: TreeNode) => void;
|
|
23
|
+
onToggleCheck: (node: TreeNode, checked: boolean) => void;
|
|
24
|
+
onPreview: (node: TreeNode) => void;
|
|
25
|
+
}
|
|
26
|
+
export declare function UserRow({ node, icon, storageCount, getItems, openMenu, onOpen, }: {
|
|
27
|
+
node: TreeNode;
|
|
28
|
+
icon: ReactNode;
|
|
29
|
+
storageCount: number;
|
|
30
|
+
getItems: () => RowMenuItem[];
|
|
31
|
+
openMenu: OpenMenu;
|
|
32
|
+
onOpen: (node: TreeNode) => void;
|
|
33
|
+
}): import("react").JSX.Element;
|
|
34
|
+
export declare function FileRow({ node, icon, rowId, rowIndex, active, checked, canPreview, getItems, openMenu, onOpen, onToggleCheck, onPreview, }: FileRowProps): import("react").JSX.Element;
|
|
35
|
+
export {};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import type { OpenMenu, RowMenuItem } from '../list/index.js';
|
|
2
|
+
import type { TreeNode } from './lib/types.js';
|
|
3
|
+
interface Span {
|
|
4
|
+
start: number;
|
|
5
|
+
end: number;
|
|
6
|
+
}
|
|
7
|
+
/** `start`/`end` include scrollMargin but getTotalSize() does not, so the margin
|
|
8
|
+
* has to come back out of both. */
|
|
9
|
+
export declare function spacerHeights(items: readonly Span[], totalSize: number, scrollMargin: number): {
|
|
10
|
+
top: number;
|
|
11
|
+
bottom: number;
|
|
12
|
+
};
|
|
13
|
+
interface VirtualRow {
|
|
14
|
+
index: number;
|
|
15
|
+
start: number;
|
|
16
|
+
size: number;
|
|
17
|
+
}
|
|
18
|
+
interface FileRowsWindowProps {
|
|
19
|
+
items: readonly VirtualRow[];
|
|
20
|
+
padTop: number;
|
|
21
|
+
padBottom: number;
|
|
22
|
+
nodes: TreeNode[];
|
|
23
|
+
checkedItems: Set<string>;
|
|
24
|
+
/** Keyboard cursor owned by FileTable; -1 when there is none. */
|
|
25
|
+
activeIndex: number;
|
|
26
|
+
rowIdPrefix: string;
|
|
27
|
+
scrollEl: HTMLElement | null;
|
|
28
|
+
loadMore?: {
|
|
29
|
+
loading: boolean;
|
|
30
|
+
error: string | undefined;
|
|
31
|
+
auto: boolean;
|
|
32
|
+
onLoadMore: () => void;
|
|
33
|
+
} | undefined;
|
|
34
|
+
getItems: (node: TreeNode) => RowMenuItem[];
|
|
35
|
+
openMenu: OpenMenu;
|
|
36
|
+
onOpen: (node: TreeNode) => void;
|
|
37
|
+
onToggleCheck: (node: TreeNode, checked: boolean) => void;
|
|
38
|
+
onPreview: (node: TreeNode) => void;
|
|
39
|
+
}
|
|
40
|
+
/** Must stay a single child of `<Table>`: Table re-keys children by traversal
|
|
41
|
+
* index, so a count that varied with scroll position would remount every row. */
|
|
42
|
+
export declare function FileRowsWindow({ items, padTop, padBottom, nodes, checkedItems, activeIndex, rowIdPrefix, scrollEl, loadMore, getItems, openMenu, onOpen, onToggleCheck, onPreview, }: FileRowsWindowProps): import("react").JSX.Element;
|
|
43
|
+
export {};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { type OpenMenu, type RowMenuItem } from '../list/index.js';
|
|
2
|
+
import type { TreeNode } from './lib/types.js';
|
|
3
|
+
interface FileTableProps {
|
|
4
|
+
nodes: TreeNode[];
|
|
5
|
+
checkedItems: Set<string>;
|
|
6
|
+
allSelected: boolean;
|
|
7
|
+
someSelected: boolean;
|
|
8
|
+
onSelectAll: () => void;
|
|
9
|
+
getItems: (node: TreeNode) => RowMenuItem[];
|
|
10
|
+
openMenu: OpenMenu;
|
|
11
|
+
onOpen: (node: TreeNode) => void;
|
|
12
|
+
onToggleCheck: (node: TreeNode, checked: boolean) => void;
|
|
13
|
+
onPreview: (node: TreeNode) => void;
|
|
14
|
+
/** Set when the folder has pages left to fetch. */
|
|
15
|
+
loadMore?: {
|
|
16
|
+
loading: boolean;
|
|
17
|
+
error: string | undefined;
|
|
18
|
+
auto: boolean;
|
|
19
|
+
onLoadMore: () => void;
|
|
20
|
+
} | undefined;
|
|
21
|
+
}
|
|
22
|
+
/** The file table. Give it a `key` of the folder path: a folder change must reset
|
|
23
|
+
* the cursor, the scroll offset and the virtualizer's measurements, and a remount
|
|
24
|
+
* does all three without a synchronising effect. */
|
|
25
|
+
export declare function FileTable({ nodes, checkedItems, allSelected, someSelected, onSelectAll, getItems, openMenu, onOpen, onToggleCheck, onPreview, loadMore, }: FileTableProps): import("react").JSX.Element;
|
|
26
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
interface FileTableHeadersProps {
|
|
2
|
+
allSelected: boolean;
|
|
3
|
+
someSelected: boolean;
|
|
4
|
+
/** Takes no event: the box is indeterminate-but-unchecked while pages remain. */
|
|
5
|
+
onSelectAll: () => void;
|
|
6
|
+
}
|
|
7
|
+
/** Carries `isTableHeader` so `Table` hoists these into `<thead>`; a bare fragment
|
|
8
|
+
* would land in `<tbody>`, since Children.toArray only flattens arrays. */
|
|
9
|
+
export declare function FileTableHeaders({ allSelected, someSelected, onSelectAll, }: FileTableHeadersProps): import("react").JSX.Element;
|
|
10
|
+
export declare namespace FileTableHeaders {
|
|
11
|
+
var isTableHeader: boolean;
|
|
12
|
+
}
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/** The virtualizer sizes this row from the constant, never by measuring it. */
|
|
2
|
+
export declare const LOAD_MORE_ROW_HEIGHT = 45;
|
|
3
|
+
interface LoadMoreRowProps {
|
|
4
|
+
rowId: string;
|
|
5
|
+
rowIndex: number;
|
|
6
|
+
loading: boolean;
|
|
7
|
+
error: string | undefined;
|
|
8
|
+
/** False past the auto-load cap, where the user asks for each page. */
|
|
9
|
+
auto: boolean;
|
|
10
|
+
/** The table's scroll container, so proximity is not measured against the page. */
|
|
11
|
+
root: HTMLElement | null;
|
|
12
|
+
onLoadMore: () => void;
|
|
13
|
+
}
|
|
14
|
+
export declare function LoadMoreRow({ rowId, rowIndex, loading, error, auto, root, onLoadMore, }: LoadMoreRowProps): import("react").JSX.Element;
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { TreeNode } from './lib/types.js';
|
|
2
|
+
/** Row pitch, with `space-y-0.5` folded in: absolutely positioned rows cannot use
|
|
3
|
+
* sibling margins. useTreePitchAudit warns if this drifts from the DOM. */
|
|
4
|
+
export declare const TREE_ROW_HEIGHT = 30;
|
|
5
|
+
export declare const TREE_SKELETON_HEIGHT = 64;
|
|
6
|
+
interface TreeViewProps {
|
|
7
|
+
rootNodes: TreeNode[];
|
|
8
|
+
parentToChildrenMap: Record<string, TreeNode[]>;
|
|
9
|
+
expandedPaths: ReadonlySet<string>;
|
|
10
|
+
selectedPath: string;
|
|
11
|
+
loadingPaths: ReadonlySet<string>;
|
|
12
|
+
onToggleExpand: (path: string) => void;
|
|
13
|
+
onSelect: (path: string, node: TreeNode) => void;
|
|
14
|
+
onDropToFolder: (folderPath: string, files: FileList | DataTransferItemList) => void;
|
|
15
|
+
onContextMenu: (e: React.MouseEvent, node: TreeNode) => void;
|
|
16
|
+
onPreviewFile: (node: TreeNode) => void;
|
|
17
|
+
/** Directories with pages left to fetch, and how to fetch them. */
|
|
18
|
+
paging?: {
|
|
19
|
+
incompletePaths: ReadonlySet<string>;
|
|
20
|
+
isLoading: (path: string) => boolean;
|
|
21
|
+
hasFailed: (path: string) => boolean;
|
|
22
|
+
onLoadMore: (node: TreeNode) => void;
|
|
23
|
+
} | undefined;
|
|
24
|
+
}
|
|
25
|
+
/** The sidebar tree, flattened and windowed. The flat array is the single source
|
|
26
|
+
* of truth for rendering, arrow keys and ARIA. */
|
|
27
|
+
export declare function TreeView({ rootNodes, parentToChildrenMap, expandedPaths, selectedPath, loadingPaths, onToggleExpand, onSelect, onDropToFolder, onContextMenu, onPreviewFile, paging, }: TreeViewProps): import("react").JSX.Element;
|
|
28
|
+
export {};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import type { TreeNode, TStorage, UploadNode } from './lib/types.js';
|
|
2
|
+
import { type JSX } from 'react';
|
|
3
|
+
declare const SIDEBAR_WIDTH_STORAGE_KEY = "fileExplorerSidebarWidth";
|
|
4
|
+
declare const SIDEBAR_WIDTH_DEFAULT = 300;
|
|
5
|
+
type StorageIconUrlResolver = (args: {
|
|
6
|
+
type: string;
|
|
7
|
+
}) => string | undefined;
|
|
8
|
+
declare function getNodeIcon(node: TreeNode, storageIconUrl?: StorageIconUrlResolver, storageIconAlt?: string): JSX.Element | null;
|
|
9
|
+
declare function renderUploadNodes(uploadNodes: UploadNode[]): JSX.Element[];
|
|
10
|
+
declare function NoFileSelectedPreview(): JSX.Element;
|
|
11
|
+
/** Shown instead of a skeleton that has nothing left to wait for. */
|
|
12
|
+
declare function NotFoundPreview({ path, onRetry, }: {
|
|
13
|
+
path: string;
|
|
14
|
+
onRetry: () => void;
|
|
15
|
+
}): JSX.Element;
|
|
16
|
+
export type CorsAwareRefresh = (opts?: {
|
|
17
|
+
silent?: boolean;
|
|
18
|
+
}) => Promise<{
|
|
19
|
+
corsError: boolean;
|
|
20
|
+
} | void>;
|
|
21
|
+
declare function CorsIssuePreview({ selectedStorage, onRefresh, }: {
|
|
22
|
+
selectedStorage: TStorage | null;
|
|
23
|
+
onRefresh?: CorsAwareRefresh;
|
|
24
|
+
}): JSX.Element;
|
|
25
|
+
declare function NoDataAvailablePreview({ selectedStorage, error, onRefresh, connectionIssueMessage, className, canWrite, }: {
|
|
26
|
+
selectedStorage: TStorage | null;
|
|
27
|
+
error?: Error | null;
|
|
28
|
+
onRefresh?: CorsAwareRefresh;
|
|
29
|
+
connectionIssueMessage?: string | null;
|
|
30
|
+
className?: string;
|
|
31
|
+
canWrite?: boolean;
|
|
32
|
+
}): JSX.Element;
|
|
33
|
+
declare function SkeletonPreview({ variant, }?: {
|
|
34
|
+
variant?: 'classic' | 'modern';
|
|
35
|
+
}): JSX.Element;
|
|
36
|
+
interface IDragDropZoneProps {
|
|
37
|
+
onDropFiles?: ((files: FileList | DataTransferItemList) => void) | undefined;
|
|
38
|
+
children: React.ReactNode;
|
|
39
|
+
className?: string;
|
|
40
|
+
}
|
|
41
|
+
declare function DragDropZone({ onDropFiles, children, className, }: IDragDropZoneProps): JSX.Element;
|
|
42
|
+
interface IShareFileButtonProps {
|
|
43
|
+
node: TreeNode;
|
|
44
|
+
onShare: (node: TreeNode) => Promise<void>;
|
|
45
|
+
}
|
|
46
|
+
declare function ShareFileButton({ node, onShare }: IShareFileButtonProps): JSX.Element;
|
|
47
|
+
export { CorsIssuePreview, DragDropZone, getNodeIcon, NoFileSelectedPreview, NoDataAvailablePreview, NotFoundPreview, renderUploadNodes, ShareFileButton, SIDEBAR_WIDTH_DEFAULT, SIDEBAR_WIDTH_STORAGE_KEY, SkeletonPreview, };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export { default as FileExplorer } from './FileExplorer.js';
|
|
2
|
+
export { FileExplorerProvider, useFileExplorer, } from './FileExplorerContext.js';
|
|
3
|
+
export { NoDataAvailablePreview, SkeletonPreview } from './helpers.js';
|
|
4
|
+
export type { FileExplorerDeleteFilesResult, FileExplorerGetFileResult, IFileExplorerClient, IFileExplorerProvider, } from './lib/fileExplorer.js';
|
|
5
|
+
export type { TListPageRequest } from './lib/paging.js';
|
|
6
|
+
export { LIST_PAGE_SIZE } from './lib/paging.js';
|
|
7
|
+
export type { TreeNode, TStorage, TStorageObject } from './lib/types.js';
|
|
8
|
+
export { CorsError } from './lib/errors.js';
|
|
9
|
+
export { chunk, mapWithConcurrency, paginate } from './lib/batch.js';
|
|
10
|
+
export { collectObjectKeysToDelete, getObjectKeyFromNode, isClientValid, removeLeadingAndTrailingSlashes, } from './lib/utils.js';
|