@seedprotocol/react 0.6.10 → 0.7.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/OPFSFilesManager/DeleteDialog.d.ts +17 -0
- package/dist/OPFSFilesManager/DeleteDialog.d.ts.map +1 -0
- package/dist/OPFSFilesManager/FileGrid.d.ts +14 -0
- package/dist/OPFSFilesManager/FileGrid.d.ts.map +1 -0
- package/dist/OPFSFilesManager/FileList.d.ts +15 -0
- package/dist/OPFSFilesManager/FileList.d.ts.map +1 -0
- package/dist/OPFSFilesManager/FileThumbnail.d.ts +16 -0
- package/dist/OPFSFilesManager/FileThumbnail.d.ts.map +1 -0
- package/dist/OPFSFilesManager/OPFSFilesManager.d.ts +26 -0
- package/dist/OPFSFilesManager/OPFSFilesManager.d.ts.map +1 -0
- package/dist/OPFSFilesManager/PreviewPanel.d.ts +16 -0
- package/dist/OPFSFilesManager/PreviewPanel.d.ts.map +1 -0
- package/dist/OPFSFilesManager/fileModel.d.ts +55 -0
- package/dist/OPFSFilesManager/fileModel.d.ts.map +1 -0
- package/dist/OPFSFilesManager/format.d.ts +8 -0
- package/dist/OPFSFilesManager/format.d.ts.map +1 -0
- package/dist/OPFSFilesManager/icons.d.ts +34 -0
- package/dist/OPFSFilesManager/icons.d.ts.map +1 -0
- package/dist/OPFSFilesManager/index.d.ts +4 -0
- package/dist/OPFSFilesManager/index.d.ts.map +1 -0
- package/dist/OPFSFilesManager/styles.d.ts +12 -0
- package/dist/OPFSFilesManager/styles.d.ts.map +1 -0
- package/dist/OPFSFilesManager/types.d.ts +110 -0
- package/dist/OPFSFilesManager/types.d.ts.map +1 -0
- package/dist/OPFSFilesManager/useStorageEstimate.d.ts +12 -0
- package/dist/OPFSFilesManager/useStorageEstimate.d.ts.map +1 -0
- package/dist/OPFSFilesManager/useThumbnail.d.ts +13 -0
- package/dist/OPFSFilesManager/useThumbnail.d.ts.map +1 -0
- package/dist/OPFSFilesManager/zip.d.ts +15 -0
- package/dist/OPFSFilesManager/zip.d.ts.map +1 -0
- package/dist/OPFSImage.d.ts.map +1 -1
- package/dist/SeedClientGate.d.ts +8 -2
- package/dist/SeedClientGate.d.ts.map +1 -1
- package/dist/SeedImage.d.ts +7 -3
- package/dist/SeedImage.d.ts.map +1 -1
- package/dist/SeedMediaAudio.d.ts +19 -0
- package/dist/SeedMediaAudio.d.ts.map +1 -0
- package/dist/SeedMediaVideo.d.ts +19 -0
- package/dist/SeedMediaVideo.d.ts.map +1 -0
- package/dist/SeedProvider.d.ts +1 -1
- package/dist/SeedProvider.d.ts.map +1 -1
- package/dist/SeedSessionContext.d.ts +2 -2
- package/dist/SeedSessionContext.d.ts.map +1 -1
- package/dist/index.d.ts +10 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2783 -1170
- package/dist/index.js.map +1 -1
- package/dist/item.d.ts +4 -0
- package/dist/item.d.ts.map +1 -1
- package/dist/itemProperty.d.ts.map +1 -1
- package/dist/localCopiesRemovedEventName.d.ts +5 -0
- package/dist/localCopiesRemovedEventName.d.ts.map +1 -0
- package/dist/model.d.ts.map +1 -1
- package/dist/modelProperty.d.ts.map +1 -1
- package/dist/opfsPaths.d.ts +20 -0
- package/dist/opfsPaths.d.ts.map +1 -0
- package/dist/schema.d.ts.map +1 -1
- package/dist/trash.d.ts.map +1 -1
- package/dist/useEnsureLocalImage.d.ts +19 -0
- package/dist/useEnsureLocalImage.d.ts.map +1 -0
- package/dist/useFiles.d.ts.map +1 -1
- package/dist/useImageFiles.d.ts.map +1 -1
- package/dist/useOPFSFiles.d.ts +13 -0
- package/dist/useOPFSFiles.d.ts.map +1 -1
- package/package.json +3 -3
- package/dist/OPFSFilesManager.d.ts +0 -45
- package/dist/OPFSFilesManager.d.ts.map +0 -1
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { FileEntry } from './fileModel';
|
|
3
|
+
import { ResolvedDeleteAction } from './types';
|
|
4
|
+
export interface DeleteDialogProps {
|
|
5
|
+
entries: FileEntry[];
|
|
6
|
+
/** Folder that listed paths are shown relative to. */
|
|
7
|
+
rootPath: string;
|
|
8
|
+
warning: string | null;
|
|
9
|
+
/** Resolves the label and tone for the files the confirm button would remove. */
|
|
10
|
+
deleteActionFor: (includeVariants: boolean) => ResolvedDeleteAction;
|
|
11
|
+
onCancel: () => void;
|
|
12
|
+
onConfirm: (includeVariants: boolean) => void;
|
|
13
|
+
className?: string;
|
|
14
|
+
}
|
|
15
|
+
/** Delete confirmation, rendered as a native modal <dialog> (focus trap, Esc, top layer). */
|
|
16
|
+
export declare function DeleteDialog({ entries, rootPath, warning, deleteActionFor, onCancel, onConfirm, className, }: DeleteDialogProps): React.JSX.Element;
|
|
17
|
+
//# sourceMappingURL=DeleteDialog.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DeleteDialog.d.ts","sourceRoot":"","sources":["../../src/OPFSFilesManager/DeleteDialog.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAsC,MAAM,OAAO,CAAA;AAC1D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAG5C,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAA;AAInD,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE,SAAS,EAAE,CAAA;IACpB,sDAAsD;IACtD,QAAQ,EAAE,MAAM,CAAA;IAChB,OAAO,EAAE,MAAM,GAAG,IAAI,CAAA;IACtB,iFAAiF;IACjF,eAAe,EAAE,CAAC,eAAe,EAAE,OAAO,KAAK,oBAAoB,CAAA;IACnE,QAAQ,EAAE,MAAM,IAAI,CAAA;IACpB,SAAS,EAAE,CAAC,eAAe,EAAE,OAAO,KAAK,IAAI,CAAA;IAC7C,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AAED,6FAA6F;AAC7F,wBAAgB,YAAY,CAAC,EAC3B,OAAO,EACP,QAAQ,EACR,OAAO,EACP,eAAe,EACf,QAAQ,EACR,SAAS,EACT,SAAS,GACV,EAAE,iBAAiB,qBA6FnB"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { FileEntry } from './fileModel';
|
|
3
|
+
export interface FileViewProps {
|
|
4
|
+
entries: FileEntry[];
|
|
5
|
+
selected: ReadonlySet<string>;
|
|
6
|
+
/** Click or Enter on an item. */
|
|
7
|
+
onActivate: (entry: FileEntry, index: number, event: React.MouseEvent | React.KeyboardEvent) => void;
|
|
8
|
+
/** Checkbox, Space, or Shift-click. `range` extends from the last toggled item. */
|
|
9
|
+
onToggle: (entry: FileEntry, index: number, range: boolean) => void;
|
|
10
|
+
tileClassName?: string;
|
|
11
|
+
className?: string;
|
|
12
|
+
}
|
|
13
|
+
export declare function FileGrid({ entries, selected, onActivate, onToggle, className, tileClassName }: FileViewProps): React.JSX.Element;
|
|
14
|
+
//# sourceMappingURL=FileGrid.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FileGrid.d.ts","sourceRoot":"","sources":["../../src/OPFSFilesManager/FileGrid.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAK5C,MAAM,WAAW,aAAa;IAC5B,OAAO,EAAE,SAAS,EAAE,CAAA;IACpB,QAAQ,EAAE,WAAW,CAAC,MAAM,CAAC,CAAA;IAC7B,iCAAiC;IACjC,UAAU,EAAE,CAAC,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,CAAC,UAAU,GAAG,KAAK,CAAC,aAAa,KAAK,IAAI,CAAA;IACpG,mFAAmF;IACnF,QAAQ,EAAE,CAAC,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,KAAK,IAAI,CAAA;IACnE,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AAED,wBAAgB,QAAQ,CAAC,EAAE,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,QAAQ,EAAE,SAAS,EAAE,aAAa,EAAE,EAAE,aAAa,qBAmE5G"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { FileEntry } from './fileModel';
|
|
3
|
+
import { FileViewProps } from './FileGrid';
|
|
4
|
+
import { ResolvedDeleteAction } from './types';
|
|
5
|
+
export interface FileListProps extends Omit<FileViewProps, 'tileClassName'> {
|
|
6
|
+
/** Paths are shown relative to this folder. */
|
|
7
|
+
cwd: string;
|
|
8
|
+
onToggleAll: () => void;
|
|
9
|
+
onDownload: (entry: FileEntry) => void;
|
|
10
|
+
onDelete: (entry: FileEntry) => void;
|
|
11
|
+
deleteActionFor: (entry: FileEntry) => ResolvedDeleteAction;
|
|
12
|
+
rowClassName?: string;
|
|
13
|
+
}
|
|
14
|
+
export declare function FileList({ entries, selected, cwd, onActivate, onToggle, onToggleAll, onDownload, onDelete, deleteActionFor, className, rowClassName, }: FileListProps): React.JSX.Element;
|
|
15
|
+
//# sourceMappingURL=FileList.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FileList.d.ts","sourceRoot":"","sources":["../../src/OPFSFilesManager/FileList.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA4B,MAAM,OAAO,CAAA;AAChD,OAAO,EAA2B,KAAK,SAAS,EAAE,MAAM,aAAa,CAAA;AACrE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAA;AAI/C,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAA;AAEnD,MAAM,WAAW,aAAc,SAAQ,IAAI,CAAC,aAAa,EAAE,eAAe,CAAC;IACzE,+CAA+C;IAC/C,GAAG,EAAE,MAAM,CAAA;IACX,WAAW,EAAE,MAAM,IAAI,CAAA;IACvB,UAAU,EAAE,CAAC,KAAK,EAAE,SAAS,KAAK,IAAI,CAAA;IACtC,QAAQ,EAAE,CAAC,KAAK,EAAE,SAAS,KAAK,IAAI,CAAA;IACpC,eAAe,EAAE,CAAC,KAAK,EAAE,SAAS,KAAK,oBAAoB,CAAA;IAC3D,YAAY,CAAC,EAAE,MAAM,CAAA;CACtB;AAED,wBAAgB,QAAQ,CAAC,EACvB,OAAO,EACP,QAAQ,EACR,GAAG,EACH,UAAU,EACV,QAAQ,EACR,WAAW,EACX,UAAU,EACV,QAAQ,EACR,eAAe,EACf,SAAS,EACT,YAAY,GACb,EAAE,aAAa,qBAsHf"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { FileEntry, FileKind } from './fileModel';
|
|
3
|
+
import { IconName } from './icons';
|
|
4
|
+
export declare const KIND_META: Record<FileKind, {
|
|
5
|
+
icon: IconName;
|
|
6
|
+
label: string;
|
|
7
|
+
color: string;
|
|
8
|
+
}>;
|
|
9
|
+
export declare const kindStyle: (kind: FileKind) => React.CSSProperties;
|
|
10
|
+
export declare function FileThumbnail({ entry, size, children, }: {
|
|
11
|
+
entry: FileEntry;
|
|
12
|
+
size: 'tile' | 'mini';
|
|
13
|
+
/** Overlays (checkbox, badges) rendered inside the frame. */
|
|
14
|
+
children?: React.ReactNode;
|
|
15
|
+
}): React.JSX.Element;
|
|
16
|
+
//# sourceMappingURL=FileThumbnail.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FileThumbnail.d.ts","sourceRoot":"","sources":["../../src/OPFSFilesManager/FileThumbnail.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAwC,KAAK,SAAS,EAAE,KAAK,QAAQ,EAAE,MAAM,aAAa,CAAA;AACjG,OAAO,EAAQ,KAAK,QAAQ,EAAE,MAAM,SAAS,CAAA;AAG7C,eAAO,MAAM,SAAS,EAAE,MAAM,CAAC,QAAQ,EAAE;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAOxF,CAAA;AAED,eAAO,MAAM,SAAS,GAAI,MAAM,QAAQ,KACQ,KAAK,CAAC,aAAa,CAAA;AAQnE,wBAAgB,aAAa,CAAC,EAC5B,KAAK,EACL,IAAI,EACJ,QAAQ,GACT,EAAE;IACD,KAAK,EAAE,SAAS,CAAA;IAChB,IAAI,EAAE,MAAM,GAAG,MAAM,CAAA;IACrB,6DAA6D;IAC7D,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;CAC3B,qBAwCA"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { OPFSFilesManagerProps } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* Browse, preview, download, and delete files stored in OPFS (the Origin Private File
|
|
5
|
+
* System). Useful for debugging and for letting people manage what an app stores locally.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```tsx
|
|
9
|
+
* <OPFSFilesManager
|
|
10
|
+
* rootPath="app-files"
|
|
11
|
+
* onAfterDelete={(paths) => {
|
|
12
|
+
* if (paths.some(isSeedDbPath)) {
|
|
13
|
+
* clearSeedDependentData()
|
|
14
|
+
* window.location.reload()
|
|
15
|
+
* }
|
|
16
|
+
* }}
|
|
17
|
+
* onDownload={async (file, blob) => {
|
|
18
|
+
* if (window.electron?.downloadFile) {
|
|
19
|
+
* await window.electron.downloadFile({ data: await blob.arrayBuffer(), filename: file.name })
|
|
20
|
+
* }
|
|
21
|
+
* }}
|
|
22
|
+
* />
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
25
|
+
export declare function OPFSFilesManager({ rootPath, filter, onBeforeDelete, onAfterDelete, onDownload, title, description, headingLevel, theme, className, classNames, defaultView, groupImageVariants, deleteWarning, confirmDelete, deleteAction, onNotify, }: OPFSFilesManagerProps): React.JSX.Element;
|
|
26
|
+
//# sourceMappingURL=OPFSFilesManager.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"OPFSFilesManager.d.ts","sourceRoot":"","sources":["../../src/OPFSFilesManager/OPFSFilesManager.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAgF,MAAM,OAAO,CAAA;AAsBpG,OAAO,KAAK,EAGV,qBAAqB,EAItB,MAAM,SAAS,CAAA;AAwHhB;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,gBAAgB,CAAC,EAC/B,QAAQ,EACR,MAAM,EACN,cAAc,EACd,aAAa,EACb,UAAU,EACV,KAAe,EACf,WAAiC,EACjC,YAAgB,EAChB,KAAgB,EAChB,SAAS,EACT,UAAe,EACf,WAAW,EACX,kBAAyB,EACzB,aAAoC,EACpC,aAAa,EACb,YAAY,EACZ,QAAQ,GACT,EAAE,qBAAqB,qBAkiBvB"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { FileEntry } from './fileModel';
|
|
3
|
+
import { ResolvedDeleteAction } from './types';
|
|
4
|
+
export interface PreviewPanelProps {
|
|
5
|
+
entry: FileEntry;
|
|
6
|
+
onClose: () => void;
|
|
7
|
+
onPrevious: (() => void) | null;
|
|
8
|
+
onNext: (() => void) | null;
|
|
9
|
+
onDownload: () => void;
|
|
10
|
+
onDelete: () => void;
|
|
11
|
+
deleteAction: ResolvedDeleteAction;
|
|
12
|
+
onCopyPath: () => void;
|
|
13
|
+
className?: string;
|
|
14
|
+
}
|
|
15
|
+
export declare function PreviewPanel({ entry, onClose, onPrevious, onNext, onDownload, onDelete, deleteAction, onCopyPath, className, }: PreviewPanelProps): React.JSX.Element;
|
|
16
|
+
//# sourceMappingURL=PreviewPanel.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PreviewPanel.d.ts","sourceRoot":"","sources":["../../src/OPFSFilesManager/PreviewPanel.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAsC,MAAM,OAAO,CAAA;AAE1D,OAAO,EAA2B,KAAK,SAAS,EAAE,MAAM,aAAa,CAAA;AAIrE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAA;AAkEnD,MAAM,WAAW,iBAAiB;IAChC,KAAK,EAAE,SAAS,CAAA;IAChB,OAAO,EAAE,MAAM,IAAI,CAAA;IACnB,UAAU,EAAE,CAAC,MAAM,IAAI,CAAC,GAAG,IAAI,CAAA;IAC/B,MAAM,EAAE,CAAC,MAAM,IAAI,CAAC,GAAG,IAAI,CAAA;IAC3B,UAAU,EAAE,MAAM,IAAI,CAAA;IACtB,QAAQ,EAAE,MAAM,IAAI,CAAA;IACpB,YAAY,EAAE,oBAAoB,CAAA;IAClC,UAAU,EAAE,MAAM,IAAI,CAAA;IACtB,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AAED,wBAAgB,YAAY,CAAC,EAC3B,KAAK,EACL,OAAO,EACP,UAAU,EACV,MAAM,EACN,UAAU,EACV,QAAQ,EACR,YAAY,EACZ,UAAU,EACV,SAAS,GACV,EAAE,iBAAiB,qBA4KnB"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { OPFSFile } from '../useOPFSFiles';
|
|
2
|
+
export type FileKind = 'image' | 'database' | 'json' | 'html' | 'text' | 'other';
|
|
3
|
+
export type SortKey = 'name' | 'modified' | 'size';
|
|
4
|
+
/** Detected type when available, otherwise File.type. */
|
|
5
|
+
export declare function effectiveType(file: OPFSFile): string;
|
|
6
|
+
export declare function fileKind(file: OPFSFile): FileKind;
|
|
7
|
+
/** Short label for a file's format: its extension, or the detected subtype when there is none. */
|
|
8
|
+
export declare function formatLabel(file: OPFSFile): string;
|
|
9
|
+
/** A resized copy the SDK writes to `…/images/<width>/<base>.webp`. */
|
|
10
|
+
export interface ImageVariant {
|
|
11
|
+
file: OPFSFile;
|
|
12
|
+
width: number;
|
|
13
|
+
}
|
|
14
|
+
/** A row in the manager: a file plus, for originals, its resized copies. */
|
|
15
|
+
export interface FileEntry {
|
|
16
|
+
file: OPFSFile;
|
|
17
|
+
/** Resized copies, narrowest first. Empty unless variants are grouped. */
|
|
18
|
+
variants: ImageVariant[];
|
|
19
|
+
/** Size of the file plus its variants. */
|
|
20
|
+
totalSize: number;
|
|
21
|
+
}
|
|
22
|
+
export declare function parseImageVariant(path: string): {
|
|
23
|
+
key: string;
|
|
24
|
+
width: number;
|
|
25
|
+
} | null;
|
|
26
|
+
/**
|
|
27
|
+
* Turn the flat file list into entries. With `groupVariants`, resized copies are
|
|
28
|
+
* attached to their original image and removed from the list. Copies whose original
|
|
29
|
+
* is missing stay in the list on their own.
|
|
30
|
+
*/
|
|
31
|
+
export declare function buildEntries(files: OPFSFile[], groupVariants: boolean): FileEntry[];
|
|
32
|
+
export interface FolderSummary {
|
|
33
|
+
name: string;
|
|
34
|
+
path: string;
|
|
35
|
+
fileCount: number;
|
|
36
|
+
size: number;
|
|
37
|
+
}
|
|
38
|
+
export interface DirectoryListing {
|
|
39
|
+
folders: FolderSummary[];
|
|
40
|
+
entries: FileEntry[];
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* List the folders and files directly inside `cwd`. With a search query, returns
|
|
44
|
+
* every matching file at any depth below `cwd` and no folders.
|
|
45
|
+
*/
|
|
46
|
+
export declare function listDirectory(all: FileEntry[], cwd: string, options?: {
|
|
47
|
+
query?: string;
|
|
48
|
+
sort?: SortKey;
|
|
49
|
+
}): DirectoryListing;
|
|
50
|
+
export declare function sortEntries(entries: FileEntry[], sort?: SortKey): FileEntry[];
|
|
51
|
+
/** Bytes per kind across all files, for the storage meter. */
|
|
52
|
+
export declare function sizeByKind(files: OPFSFile[]): Record<FileKind, number>;
|
|
53
|
+
/** Default deleteWarning: flags the Seed client's SQLite database. */
|
|
54
|
+
export declare function defaultDeleteWarning(files: OPFSFile[]): string | null;
|
|
55
|
+
//# sourceMappingURL=fileModel.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fileModel.d.ts","sourceRoot":"","sources":["../../src/OPFSFilesManager/fileModel.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAA;AAE/C,MAAM,MAAM,QAAQ,GAAG,OAAO,GAAG,UAAU,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,CAAA;AAEhF,MAAM,MAAM,OAAO,GAAG,MAAM,GAAG,UAAU,GAAG,MAAM,CAAA;AAElD,yDAAyD;AACzD,wBAAgB,aAAa,CAAC,IAAI,EAAE,QAAQ,GAAG,MAAM,CAEpD;AAID,wBAAgB,QAAQ,CAAC,IAAI,EAAE,QAAQ,GAAG,QAAQ,CAQjD;AAED,kGAAkG;AAClG,wBAAgB,WAAW,CAAC,IAAI,EAAE,QAAQ,GAAG,MAAM,CAMlD;AAED,uEAAuE;AACvE,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,QAAQ,CAAA;IACd,KAAK,EAAE,MAAM,CAAA;CACd;AAED,4EAA4E;AAC5E,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,QAAQ,CAAA;IACd,0EAA0E;IAC1E,QAAQ,EAAE,YAAY,EAAE,CAAA;IACxB,0CAA0C;IAC1C,SAAS,EAAE,MAAM,CAAA;CAClB;AAOD,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CAIrF;AASD;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,QAAQ,EAAE,EAAE,aAAa,EAAE,OAAO,GAAG,SAAS,EAAE,CA8BnF;AAED,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,MAAM,CAAA;IACZ,SAAS,EAAE,MAAM,CAAA;IACjB,IAAI,EAAE,MAAM,CAAA;CACb;AAED,MAAM,WAAW,gBAAgB;IAC/B,OAAO,EAAE,aAAa,EAAE,CAAA;IACxB,OAAO,EAAE,SAAS,EAAE,CAAA;CACrB;AAID;;;GAGG;AACH,wBAAgB,aAAa,CAC3B,GAAG,EAAE,SAAS,EAAE,EAChB,GAAG,EAAE,MAAM,EACX,OAAO,GAAE;IAAE,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,OAAO,CAAA;CAAO,GAC/C,gBAAgB,CA8BlB;AAED,wBAAgB,WAAW,CAAC,OAAO,EAAE,SAAS,EAAE,EAAE,IAAI,GAAE,OAAgB,GAAG,SAAS,EAAE,CAOrF;AAED,8DAA8D;AAC9D,wBAAgB,UAAU,CAAC,KAAK,EAAE,QAAQ,EAAE,GAAG,MAAM,CAAC,QAAQ,EAAE,MAAM,CAAC,CAItE;AAED,sEAAsE;AACtE,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,QAAQ,EAAE,GAAG,MAAM,GAAG,IAAI,CAIrE"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/** 1024-based size: '0 B', '812 B', '4.2 KB', '38 MB'. One decimal below 10. */
|
|
2
|
+
export declare function formatFileSize(bytes: number): string;
|
|
3
|
+
/** Short relative time: 'just now', '5 min ago', '3 h ago', 'yesterday', '12 days ago', or a date. */
|
|
4
|
+
export declare function formatRelativeTime(timestamp: number, now?: number): string;
|
|
5
|
+
export declare function formatDateTime(timestamp: number): string;
|
|
6
|
+
/** Shorten long names (e.g. 43-char Arweave transaction IDs) from the middle, keeping the extension visible. */
|
|
7
|
+
export declare function truncateMiddle(value: string, max: number): string;
|
|
8
|
+
//# sourceMappingURL=format.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"format.d.ts","sourceRoot":"","sources":["../../src/OPFSFilesManager/format.ts"],"names":[],"mappings":"AAEA,gFAAgF;AAChF,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAMpD;AAMD,sGAAsG;AACtG,wBAAgB,kBAAkB,CAAC,SAAS,EAAE,MAAM,EAAE,GAAG,GAAE,MAAmB,GAAG,MAAM,CAStF;AAED,wBAAgB,cAAc,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAExD;AAED,gHAAgH;AAChH,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,CAKjE"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
declare const ICONS: {
|
|
3
|
+
check: React.JSX.Element;
|
|
4
|
+
chevronLeft: React.JSX.Element;
|
|
5
|
+
chevronRight: React.JSX.Element;
|
|
6
|
+
copy: React.JSX.Element;
|
|
7
|
+
database: React.JSX.Element;
|
|
8
|
+
download: React.JSX.Element;
|
|
9
|
+
file: React.JSX.Element;
|
|
10
|
+
fileCode: React.JSX.Element;
|
|
11
|
+
fileJson: React.JSX.Element;
|
|
12
|
+
fileText: React.JSX.Element;
|
|
13
|
+
folder: React.JSX.Element;
|
|
14
|
+
folderOpen: React.JSX.Element;
|
|
15
|
+
image: React.JSX.Element;
|
|
16
|
+
imageOff: React.JSX.Element;
|
|
17
|
+
layers: React.JSX.Element;
|
|
18
|
+
layoutGrid: React.JSX.Element;
|
|
19
|
+
list: React.JSX.Element;
|
|
20
|
+
refresh: React.JSX.Element;
|
|
21
|
+
search: React.JSX.Element;
|
|
22
|
+
trash: React.JSX.Element;
|
|
23
|
+
triangleAlert: React.JSX.Element;
|
|
24
|
+
x: React.JSX.Element;
|
|
25
|
+
};
|
|
26
|
+
export type IconName = keyof typeof ICONS;
|
|
27
|
+
export declare function Icon({ name, size, strokeWidth, className, }: {
|
|
28
|
+
name: IconName;
|
|
29
|
+
size?: number;
|
|
30
|
+
strokeWidth?: number;
|
|
31
|
+
className?: string;
|
|
32
|
+
}): React.JSX.Element;
|
|
33
|
+
export {};
|
|
34
|
+
//# sourceMappingURL=icons.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"icons.d.ts","sourceRoot":"","sources":["../../src/OPFSFilesManager/icons.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,QAAA,MAAM,KAAK;;;;;;;;;;;;;;;;;;;;;;;CA2IgC,CAAA;AAE3C,MAAM,MAAM,QAAQ,GAAG,MAAM,OAAO,KAAK,CAAA;AAEzC,wBAAgB,IAAI,CAAC,EACnB,IAAI,EACJ,IAAS,EACT,WAAe,EACf,SAAS,GACV,EAAE;IACD,IAAI,EAAE,QAAQ,CAAA;IACd,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB,qBAmBA"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { OPFSFilesManager } from './OPFSFilesManager';
|
|
2
|
+
export type { OPFSFilesManagerProps, OPFSFilesManagerTheme, OPFSFilesManagerView, OPFSFilesManagerSlot, OPFSFilesManagerClassNames, OPFSFilesManagerDeleteAction, OPFSFilesManagerNotice, OPFSFilesManagerNotifyTone, } from './types';
|
|
3
|
+
export { OPFS_FILES_MANAGER_CSS } from './styles';
|
|
4
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/OPFSFilesManager/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AACrD,YAAY,EACV,qBAAqB,EACrB,qBAAqB,EACrB,oBAAoB,EACpB,oBAAoB,EACpB,0BAA0B,EAC1B,4BAA4B,EAC5B,sBAAsB,EACtB,0BAA0B,GAC3B,MAAM,SAAS,CAAA;AAChB,OAAO,EAAE,sBAAsB,EAAE,MAAM,UAAU,CAAA"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Scoped stylesheet for OPFSFilesManager. Injected once into document.head (see
|
|
3
|
+
* docs/adr/0002-component-styling-tokens-and-injected-css.md). Every color comes from a
|
|
4
|
+
* `--seed-*` custom property, so hosts restyle by overriding variables on `.seed-fm`
|
|
5
|
+
* or an ancestor.
|
|
6
|
+
*/
|
|
7
|
+
export declare const STYLE_ELEMENT_ID = "seed-opfs-files-manager-styles";
|
|
8
|
+
export declare const STYLE_LAYER = "seed-opfs-files-manager";
|
|
9
|
+
export declare const OPFS_FILES_MANAGER_CSS = "@layer seed-opfs-files-manager {\n\n.seed-fm {\n \n --seed-bg: #fbfcfb;\n --seed-surface: #ffffff;\n --seed-sunken: #f0f3f1;\n --seed-hover: #e9eeeb;\n --seed-fg: #18211d;\n --seed-fg-muted: #5a6861;\n --seed-fg-faint: #8a978f;\n --seed-border: #dfe5e1;\n --seed-border-strong: #c5cfc9;\n --seed-accent: #2c6b59;\n --seed-accent-fg: #ffffff;\n --seed-accent-soft: #e0eee8;\n --seed-danger: #b4332a;\n --seed-danger-fg: #ffffff;\n --seed-danger-soft: #fbe7e4;\n --seed-danger-inverse: #ff9a8f;\n --seed-warn: #8a5208;\n --seed-warn-soft: #fdf1dc;\n --seed-kind-image: #2f7d68;\n --seed-kind-database: #6a4fb3;\n --seed-kind-json: #a2620e;\n --seed-kind-html: #b0413a;\n --seed-kind-text: #3f6f9a;\n --seed-kind-other: #66736c;\n --seed-checker-a: #eef1ef;\n --seed-checker-b: #ffffff;\n --seed-shadow: 0 10px 30px rgb(16 24 20 / 0.14), 0 2px 6px rgb(16 24 20 / 0.08);\n --seed-backdrop: rgb(8 12 10 / 0.42);\n\n --seed-radius-sm: 6px;\n --seed-radius-md: 8px;\n --seed-radius-lg: 12px;\n --seed-font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;\n color-scheme: light;\n}\n.seed-fm[data-seed-theme=\"dark\"] { \n --seed-bg: #111816;\n --seed-surface: #171f1c;\n --seed-sunken: #1d2723;\n --seed-hover: #24302b;\n --seed-fg: #e4ebe7;\n --seed-fg-muted: #9daba3;\n --seed-fg-faint: #6f7d76;\n --seed-border: #29342f;\n --seed-border-strong: #3a4842;\n --seed-accent: #6cc0a3;\n --seed-accent-fg: #0c1a15;\n --seed-accent-soft: #1c3a30;\n --seed-danger: #f08277;\n --seed-danger-fg: #2a0d0a;\n --seed-danger-soft: #3b1c19;\n --seed-danger-inverse: #b4332a;\n --seed-warn: #e9b062;\n --seed-warn-soft: #382a14;\n --seed-kind-image: #6cc0a3;\n --seed-kind-database: #b29cf0;\n --seed-kind-json: #e3ad5c;\n --seed-kind-html: #ef8a80;\n --seed-kind-text: #8fb8de;\n --seed-kind-other: #9aa8a0;\n --seed-checker-a: #1d2723;\n --seed-checker-b: #24302b;\n --seed-shadow: 0 12px 34px rgb(0 0 0 / 0.5), 0 2px 6px rgb(0 0 0 / 0.4);\n --seed-backdrop: rgb(0 0 0 / 0.55);\n color-scheme: dark;\n }\n@media (prefers-color-scheme: dark) {\n .seed-fm[data-seed-theme=\"system\"] { \n --seed-bg: #111816;\n --seed-surface: #171f1c;\n --seed-sunken: #1d2723;\n --seed-hover: #24302b;\n --seed-fg: #e4ebe7;\n --seed-fg-muted: #9daba3;\n --seed-fg-faint: #6f7d76;\n --seed-border: #29342f;\n --seed-border-strong: #3a4842;\n --seed-accent: #6cc0a3;\n --seed-accent-fg: #0c1a15;\n --seed-accent-soft: #1c3a30;\n --seed-danger: #f08277;\n --seed-danger-fg: #2a0d0a;\n --seed-danger-soft: #3b1c19;\n --seed-danger-inverse: #b4332a;\n --seed-warn: #e9b062;\n --seed-warn-soft: #382a14;\n --seed-kind-image: #6cc0a3;\n --seed-kind-database: #b29cf0;\n --seed-kind-json: #e3ad5c;\n --seed-kind-html: #ef8a80;\n --seed-kind-text: #8fb8de;\n --seed-kind-other: #9aa8a0;\n --seed-checker-a: #1d2723;\n --seed-checker-b: #24302b;\n --seed-shadow: 0 12px 34px rgb(0 0 0 / 0.5), 0 2px 6px rgb(0 0 0 / 0.4);\n --seed-backdrop: rgb(0 0 0 / 0.55);\n color-scheme: dark;\n }\n}\n\n.seed-fm { position: relative; color: var(--seed-fg); background: var(--seed-bg); font-family: inherit; font-size: 14px; line-height: 1.45; }\n.seed-fm *, .seed-fm *::before, .seed-fm *::after { box-sizing: border-box; }\n/* Element defaults use :where() so they have zero specificity and any component class beats them. */\n:where(.seed-fm) :where(button, input, select) { font: inherit; color: inherit; }\n.seed-fm :focus-visible { outline: 2px solid var(--seed-accent); outline-offset: 2px; }\n:where(.seed-fm) :where(svg) { flex: none; display: inline-block; vertical-align: middle; }\n.seed-fm-frame { container: seed-fm / inline-size; }\n\n.seed-fm-header { display: flex; flex-wrap: wrap; gap: 12px 20px; align-items: flex-start; padding: 18px 20px 14px; }\n.seed-fm-titles { flex: 1 1 240px; min-width: 0; }\n.seed-fm-title { font-size: 20px; line-height: 1.25; font-weight: 600; margin: 0; letter-spacing: -0.01em; }\n.seed-fm-description { margin: 2px 0 0; color: var(--seed-fg-muted); font-size: 13px; }\n.seed-fm-usage { flex: 0 1 280px; min-width: 200px; font-size: 12px; color: var(--seed-fg-muted); }\n.seed-fm-usage-row { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 5px; font-variant-numeric: tabular-nums; }\n.seed-fm-usage-row strong { color: var(--seed-fg); font-weight: 600; }\n.seed-fm-meter { height: 6px; border-radius: 99px; background: var(--seed-sunken); overflow: hidden; display: flex; }\n.seed-fm-meter > span { display: block; height: 100%; }\n.seed-fm-legend { display: flex; flex-wrap: wrap; gap: 4px 10px; margin: 6px 0 0; padding: 0; list-style: none; }\n.seed-fm-legend li { display: inline-flex; align-items: center; gap: 5px; font-variant-numeric: tabular-nums; }\n.seed-fm-legend li::before { content: \"\"; width: 7px; height: 7px; border-radius: 2px; background: var(--seed-swatch); }\n\n.seed-fm-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 32px; padding: 0 12px; margin: 0; border-radius: var(--seed-radius-md); border: 1px solid var(--seed-border); background: var(--seed-surface); color: var(--seed-fg); cursor: pointer; font-size: 13px; font-weight: 500; white-space: nowrap; text-decoration: none; }\n.seed-fm-btn:hover:not(:disabled) { background: var(--seed-hover); }\n.seed-fm-btn:disabled { opacity: 0.45; cursor: default; }\n.seed-fm-btn--icon { width: 32px; padding: 0; }\n.seed-fm-btn--primary { background: var(--seed-accent); border-color: var(--seed-accent); color: var(--seed-accent-fg); }\n.seed-fm-btn--primary:hover:not(:disabled) { background: var(--seed-accent); filter: brightness(1.08); }\n.seed-fm-btn--danger { background: var(--seed-danger); border-color: var(--seed-danger); color: var(--seed-danger-fg); }\n.seed-fm-btn--danger:hover:not(:disabled) { background: var(--seed-danger); filter: brightness(1.08); }\n.seed-fm-btn--ghost { border-color: transparent; background: transparent; }\n.seed-fm-btn--danger-text { color: var(--seed-danger); }\n.seed-fm-btn[data-busy=\"true\"] svg { animation: seed-fm-spin 0.8s linear infinite; }\n@keyframes seed-fm-spin { to { transform: rotate(360deg); } }\n\n.seed-fm-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; padding: 0 20px 12px; border-bottom: 1px solid var(--seed-border); }\n.seed-fm-crumbs { display: flex; align-items: center; gap: 2px; min-width: 0; flex: 1 1 auto; font-size: 13px; overflow: hidden; margin: 0; padding: 0; list-style: none; }\n.seed-fm-crumbs li { display: inline-flex; align-items: center; min-width: 0; }\n.seed-fm-crumbs button { border: 0; background: none; padding: 4px 6px; border-radius: var(--seed-radius-sm); cursor: pointer; color: var(--seed-fg-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 24ch; }\n.seed-fm-crumbs button:hover { background: var(--seed-hover); color: var(--seed-fg); }\n.seed-fm-crumbs button[aria-current=\"page\"] { color: var(--seed-fg); font-weight: 600; }\n.seed-fm-crumbs svg { color: var(--seed-fg-faint); }\n.seed-fm-search { position: relative; flex: 0 1 220px; min-width: 140px; display: block; }\n.seed-fm-search svg { position: absolute; left: 9px; top: 50%; transform: translateY(-50%); color: var(--seed-fg-faint); pointer-events: none; }\n.seed-fm-search input { width: 100%; height: 32px; margin: 0; padding: 0 10px 0 30px; border-radius: var(--seed-radius-md); border: 1px solid var(--seed-border); background: var(--seed-surface); color: var(--seed-fg); font-size: 13px; }\n.seed-fm-search input::placeholder { color: var(--seed-fg-faint); }\n.seed-fm-select { height: 32px; margin: 0; border-radius: var(--seed-radius-md); border: 1px solid var(--seed-border); background: var(--seed-surface); color: var(--seed-fg); font-size: 13px; padding: 0 8px; }\n.seed-fm-viewtoggle { display: inline-flex; border: 1px solid var(--seed-border); border-radius: var(--seed-radius-md); overflow: hidden; }\n.seed-fm-viewtoggle button { width: 32px; height: 30px; margin: 0; border: 0; background: var(--seed-surface); cursor: pointer; color: var(--seed-fg-muted); display: inline-flex; align-items: center; justify-content: center; }\n.seed-fm-viewtoggle button[aria-pressed=\"true\"] { background: var(--seed-sunken); color: var(--seed-fg); }\n.seed-fm-hint { width: 100%; font-size: 12px; color: var(--seed-fg-faint); margin: 0; }\n.seed-fm-hint svg { margin-right: 6px; vertical-align: -2px; }\n.seed-fm-hint .seed-fm-linkbtn { margin-left: 6px; }\n.seed-fm-linkbtn { border: 0; background: none; color: var(--seed-accent); cursor: pointer; padding: 0; font-size: inherit; text-decoration: underline; text-underline-offset: 2px; }\n\n.seed-fm-body { padding: 16px 20px 24px; }\n.seed-fm-section-label { font-size: 11.5px; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase; color: var(--seed-fg-faint); margin: 4px 0 8px; }\n.seed-fm-folders { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 8px; margin: 0 0 20px; padding: 0; list-style: none; }\n.seed-fm-folder { width: 100%; display: flex; align-items: center; gap: 10px; padding: 10px 12px; margin: 0; border: 1px solid var(--seed-border); border-radius: var(--seed-radius-md); background: var(--seed-surface); cursor: pointer; text-align: left; min-width: 0; }\n.seed-fm-folder:hover { background: var(--seed-hover); }\n.seed-fm-folder > svg { color: var(--seed-fg-muted); }\n.seed-fm-folder > span { min-width: 0; display: flex; flex-direction: column; }\n.seed-fm-folder-name { font-weight: 600; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }\n.seed-fm-folder-meta { font-size: 11.5px; color: var(--seed-fg-muted); font-variant-numeric: tabular-nums; }\n\n.seed-fm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(156px, 1fr)); gap: 14px; margin: 0; padding: 0; list-style: none; }\n.seed-fm-tile { position: relative; border-radius: var(--seed-radius-lg); cursor: pointer; min-width: 0; outline: none; }\n.seed-fm-thumb { position: relative; aspect-ratio: 4 / 3; border-radius: var(--seed-radius-lg); overflow: hidden; background: var(--seed-sunken); border: 1px solid var(--seed-border); display: flex; align-items: center; justify-content: center; color: var(--seed-kind); }\n.seed-fm-thumb--checker { background-color: var(--seed-checker-b);\n background-image: conic-gradient(var(--seed-checker-a) 25%, transparent 0 50%, var(--seed-checker-a) 0 75%, transparent 0); background-size: 14px 14px; }\n.seed-fm-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform 0.12s ease; }\n.seed-fm-thumb--checker img { object-fit: contain; }\n.seed-fm-tile:hover .seed-fm-thumb { border-color: var(--seed-border-strong); }\n.seed-fm-tile:focus-visible .seed-fm-thumb { outline: 2px solid var(--seed-accent); outline-offset: 2px; }\n.seed-fm-tile[aria-selected=\"true\"] .seed-fm-thumb { border-color: var(--seed-accent); box-shadow: 0 0 0 2px var(--seed-accent); }\n.seed-fm-tile[aria-selected=\"true\"] .seed-fm-thumb img { transform: scale(0.94); border-radius: 6px; }\n.seed-fm-kind { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 8px; text-align: center; }\n.seed-fm-ext { font-family: var(--seed-font-mono); font-size: 10.5px; font-weight: 500; letter-spacing: 0.04em; text-transform: uppercase; padding: 1px 6px; border-radius: 4px; background: color-mix(in srgb, var(--seed-kind) 14%, transparent); }\n.seed-fm-kind-error { font-size: 11px; color: var(--seed-fg-faint); }\n.seed-fm-skeleton { background: linear-gradient(90deg, var(--seed-sunken), var(--seed-hover), var(--seed-sunken)); background-size: 200% 100%; animation: seed-fm-shimmer 1.3s ease-in-out infinite; border-color: transparent; }\n@keyframes seed-fm-shimmer { from { background-position: 100% 0; } to { background-position: -100% 0; } }\n.seed-fm-check { position: absolute; top: 8px; left: 8px; width: 22px; height: 22px; margin: 0; border-radius: 6px; border: 1.5px solid rgb(255 255 255 / 0.9); background: rgb(0 0 0 / 0.28); color: #fff; display: flex; align-items: center; justify-content: center; opacity: 0; cursor: pointer; padding: 0; transition: opacity 0.1s; z-index: 1; }\n.seed-fm-tile:hover .seed-fm-check, .seed-fm-tile:focus-visible .seed-fm-check, .seed-fm-check:focus-visible, .seed-fm[data-selecting=\"true\"] .seed-fm-check, .seed-fm-tile[aria-selected=\"true\"] .seed-fm-check { opacity: 1; }\n.seed-fm-tile[aria-selected=\"true\"] .seed-fm-check { background: var(--seed-accent); border-color: var(--seed-accent); color: var(--seed-accent-fg); }\n.seed-fm-badge { position: absolute; bottom: 7px; right: 7px; font-size: 10.5px; font-weight: 600; padding: 2px 6px 2px 5px; border-radius: 5px; background: rgb(10 16 13 / 0.66); color: #fff; display: inline-flex; gap: 4px; align-items: center; }\n.seed-fm-tile-meta { display: block; padding: 7px 2px 0; min-width: 0; }\n.seed-fm-tile-name { display: block; font-size: 13px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }\n.seed-fm-tile-sub { display: block; font-size: 11.5px; color: var(--seed-fg-muted); font-variant-numeric: tabular-nums; }\n\n.seed-fm-list-wrap { overflow-x: auto; }\n.seed-fm-list { width: 100%; border-collapse: collapse; font-size: 13px; }\n.seed-fm-list th { text-align: left; font-size: 11.5px; font-weight: 600; color: var(--seed-fg-muted); padding: 6px 10px; border-bottom: 1px solid var(--seed-border); white-space: nowrap; background: none; }\n.seed-fm-list td { padding: 7px 10px; border-bottom: 1px solid var(--seed-border); vertical-align: middle; }\n.seed-fm-row { cursor: pointer; }\n.seed-fm-row:hover td { background: var(--seed-hover); }\n.seed-fm-row[aria-selected=\"true\"] td { background: var(--seed-accent-soft); }\n.seed-fm-num { text-align: right !important; font-variant-numeric: tabular-nums; white-space: nowrap; color: var(--seed-fg-muted); }\n.seed-fm-when { white-space: nowrap; color: var(--seed-fg-muted); }\n.seed-fm-namecell { display: flex; align-items: center; gap: 10px; min-width: 0; }\n.seed-fm-namecell > span { min-width: 0; display: flex; flex-direction: column; }\n.seed-fm-mini { width: 36px; height: 28px; border-radius: 5px; overflow: hidden; flex: none; border: 1px solid var(--seed-border); background: var(--seed-sunken); display: flex; align-items: center; justify-content: center; color: var(--seed-kind); }\n.seed-fm-mini img { width: 100%; height: 100%; object-fit: cover; display: block; }\n.seed-fm-mini.seed-fm-thumb--checker { background-size: 8px 8px; }\n.seed-fm-mini.seed-fm-thumb--checker img { object-fit: contain; }\n.seed-fm-row-name { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 40ch; }\n.seed-fm-row-open { display: block; border: 0; padding: 0; margin: 0; background: none; color: inherit; cursor: pointer; text-align: left; }\n.seed-fm-visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }\n.seed-fm-row-path { display: block; font-family: var(--seed-font-mono); font-size: 11px; color: var(--seed-fg-faint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 52ch; }\n.seed-fm-actions { white-space: nowrap; text-align: right; }\n.seed-fm-actions .seed-fm-btn { opacity: 0; height: 28px; width: 28px; }\n.seed-fm-row:hover .seed-fm-actions .seed-fm-btn, .seed-fm-actions .seed-fm-btn:focus-visible { opacity: 1; }\n.seed-fm-checkbox { width: 16px; height: 16px; margin: 0; accent-color: var(--seed-accent); cursor: pointer; vertical-align: middle; }\n.seed-fm-type { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; color: var(--seed-fg-muted); white-space: nowrap; }\n.seed-fm-type::before { content: \"\"; width: 7px; height: 7px; border-radius: 2px; background: var(--seed-kind); }\n.seed-fm-type small { color: var(--seed-fg-faint); font-size: inherit; }\n@container seed-fm (max-width: 720px) {\n .seed-fm-col-type, .seed-fm-col-modified { display: none; }\n .seed-fm-row-path { max-width: 28ch; }\n}\n@container seed-fm (max-width: 520px) {\n .seed-fm-col-size { display: none; }\n .seed-fm-header { padding: 14px 14px 10px; }\n .seed-fm-toolbar { padding: 0 14px 10px; }\n .seed-fm-body { padding: 12px 14px 20px; }\n .seed-fm-grid { grid-template-columns: repeat(auto-fill, minmax(128px, 1fr)); gap: 10px; }\n .seed-fm-usage { flex-basis: 100%; order: 3; }\n .seed-fm-search { flex: 1 1 100%; }\n}\n\n.seed-fm-state { max-width: 400px; margin: 40px auto; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 8px; }\n.seed-fm-state-icon { width: 48px; height: 48px; border-radius: 12px; background: var(--seed-sunken); display: flex; align-items: center; justify-content: center; color: var(--seed-fg-muted); margin-bottom: 4px; }\n.seed-fm-state--error .seed-fm-state-icon { background: var(--seed-danger-soft); color: var(--seed-danger); }\n.seed-fm-state h3, .seed-fm-state p { margin: 0; }\n.seed-fm-state h3 { font-size: 15px; font-weight: 600; }\n.seed-fm-state p { color: var(--seed-fg-muted); font-size: 13px; }\n.seed-fm-state .seed-fm-btn { margin-top: 8px; }\n:where(.seed-fm) :where(code) { font-family: var(--seed-font-mono); font-size: 0.92em; }\n.seed-fm-state code { background: var(--seed-sunken); padding: 1px 5px; border-radius: 4px; }\n\n.seed-fm-batch { position: sticky; bottom: 16px; z-index: 5; width: fit-content; max-width: calc(100% - 24px); margin: 0 auto 16px; display: flex; align-items: center; flex-wrap: wrap; justify-content: center; gap: 6px; padding: 6px 6px 6px 14px; background: var(--seed-fg); color: var(--seed-bg); border-radius: 12px; box-shadow: var(--seed-shadow); }\n.seed-fm-batch-count { font-size: 13px; font-weight: 600; margin-right: 6px; font-variant-numeric: tabular-nums; white-space: nowrap; }\n.seed-fm-batch-count span { font-weight: 400; opacity: 0.7; }\n.seed-fm-batch .seed-fm-btn { background: transparent; border-color: transparent; color: var(--seed-bg); height: 30px; }\n.seed-fm-batch .seed-fm-btn:hover:not(:disabled) { background: color-mix(in srgb, var(--seed-bg) 14%, transparent); }\n.seed-fm-batch .seed-fm-btn--danger-text { color: var(--seed-danger-inverse); }\n\n.seed-fm-panel { position: fixed; top: 0; right: 0; bottom: 0; z-index: 1000; width: min(420px, 100vw); background: var(--seed-surface); color: var(--seed-fg); border-left: 1px solid var(--seed-border); box-shadow: var(--seed-shadow); display: flex; flex-direction: column; }\n.seed-fm-panel-head { display: flex; align-items: center; gap: 4px; padding: 10px 10px 10px 16px; border-bottom: 1px solid var(--seed-border); }\n.seed-fm-panel-head h3 { flex: 1; min-width: 0; margin: 0; font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }\n.seed-fm-panel-body { flex: 1; overflow: auto; padding: 16px; display: flex; flex-direction: column; gap: 16px; }\n.seed-fm-preview { border-radius: var(--seed-radius-md); overflow: hidden; border: 1px solid var(--seed-border); background: var(--seed-sunken); display: flex; align-items: center; justify-content: center; min-height: 180px; color: var(--seed-kind); }\n.seed-fm-preview.seed-fm-thumb--checker { background-size: 16px 16px; }\n.seed-fm-preview img { max-width: 100%; max-height: 320px; display: block; }\n.seed-fm-preview pre { margin: 0; padding: 12px 14px; align-self: stretch; width: 100%; font-family: var(--seed-font-mono); font-size: 11.5px; line-height: 1.55; color: var(--seed-fg); overflow: auto; max-height: 320px; white-space: pre; }\n.seed-fm-preview-note { padding: 28px; text-align: center; color: var(--seed-fg-muted); font-size: 12.5px; display: flex; flex-direction: column; align-items: center; gap: 8px; }\n.seed-fm-preview-note svg { color: var(--seed-kind); }\n.seed-fm-details { display: grid; grid-template-columns: 92px minmax(0, 1fr); gap: 8px 12px; margin: 0; font-size: 13px; }\n.seed-fm-details dt { color: var(--seed-fg-muted); }\n.seed-fm-details dd { margin: 0; min-width: 0; font-variant-numeric: tabular-nums; }\n.seed-fm-details small { color: var(--seed-fg-faint); font-size: 12px; }\n.seed-fm-path { display: flex; gap: 4px; align-items: flex-start; }\n.seed-fm-path code { font-size: 11.5px; word-break: break-all; flex: 1; padding-top: 4px; }\n.seed-fm-path .seed-fm-btn { width: 26px; height: 26px; }\n.seed-fm-variants { display: flex; flex-direction: column; margin: 0; padding: 0; list-style: none; border: 1px solid var(--seed-border); border-radius: var(--seed-radius-md); overflow: hidden; }\n.seed-fm-variants li { display: flex; justify-content: space-between; padding: 6px 10px; font-size: 12.5px; border-bottom: 1px solid var(--seed-border); font-variant-numeric: tabular-nums; }\n.seed-fm-variants li:last-child { border-bottom: 0; }\n.seed-fm-variants li span:last-child { color: var(--seed-fg-muted); }\n.seed-fm-panel-foot { display: flex; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--seed-border); }\n.seed-fm-panel-foot .seed-fm-btn--primary { flex: 1; }\n\n/* margin: auto restates the UA default that centres a modal; Tailwind's preflight resets it to 0. */\n.seed-fm-dialog { margin: auto; border: 1px solid var(--seed-border); border-radius: var(--seed-radius-lg); background: var(--seed-surface); color: var(--seed-fg); box-shadow: var(--seed-shadow); width: min(460px, calc(100vw - 32px)); max-height: calc(100vh - 32px); padding: 0; }\n.seed-fm-dialog::backdrop { background: var(--seed-backdrop); }\n.seed-fm-dialog form { display: flex; flex-direction: column; gap: 12px; margin: 0; padding: 20px; }\n.seed-fm-dialog h3 { margin: 0; font-size: 16px; font-weight: 600; overflow-wrap: anywhere; }\n.seed-fm-dialog p { margin: 0; font-size: 13px; color: var(--seed-fg-muted); }\n.seed-fm-dialog ul { margin: 0; padding: 0; list-style: none; border: 1px solid var(--seed-border); border-radius: var(--seed-radius-md); max-height: 160px; overflow: auto; }\n.seed-fm-dialog li { display: flex; justify-content: space-between; gap: 12px; padding: 6px 10px; font-size: 12.5px; border-bottom: 1px solid var(--seed-border); }\n.seed-fm-dialog li:last-child { border-bottom: 0; }\n.seed-fm-dialog li code { font-size: 11.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }\n.seed-fm-dialog li span { color: var(--seed-fg-muted); font-variant-numeric: tabular-nums; white-space: nowrap; }\n.seed-fm-dialog label { display: flex; gap: 8px; align-items: center; font-size: 13px; cursor: pointer; }\n.seed-fm-dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }\n.seed-fm-warning { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: var(--seed-radius-md); background: var(--seed-warn-soft); color: var(--seed-warn); font-size: 12.5px; }\n.seed-fm-warning svg { margin-top: 1px; }\n\n.seed-fm-toasts { position: fixed; left: 16px; bottom: 16px; z-index: 1001; display: flex; flex-direction: column; gap: 8px; pointer-events: none; margin: 0; padding: 0; list-style: none; }\n.seed-fm-toast { display: flex; align-items: center; gap: 8px; max-width: min(420px, calc(100vw - 32px)); padding: 9px 12px; background: var(--seed-surface); color: var(--seed-fg); border: 1px solid var(--seed-border); border-radius: var(--seed-radius-md); box-shadow: var(--seed-shadow); font-size: 13px; animation: seed-fm-toast-in 0.18s ease-out; }\n.seed-fm-toast svg { color: var(--seed-accent); }\n.seed-fm-toast--error svg { color: var(--seed-danger); }\n@keyframes seed-fm-toast-in { from { transform: translateY(6px); opacity: 0.4; } }\n\n@media (prefers-reduced-motion: reduce) {\n .seed-fm-skeleton, .seed-fm-btn[data-busy=\"true\"] svg, .seed-fm-toast { animation: none; }\n .seed-fm-thumb img { transition: none; }\n}\n\n}";
|
|
10
|
+
/** Inject the stylesheet once. No-op during SSR. */
|
|
11
|
+
export declare function ensureStylesInjected(): void;
|
|
12
|
+
//# sourceMappingURL=styles.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../src/OPFSFilesManager/styles.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,eAAO,MAAM,gBAAgB,mCAAmC,CAAA;AAChE,eAAO,MAAM,WAAW,4BAA4B,CAAA;AAsRpD,eAAO,MAAM,sBAAsB,+4uBAAuC,CAAA;AAE1E,oDAAoD;AACpD,wBAAgB,oBAAoB,IAAI,IAAI,CAO3C"}
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import { OPFSFile } from '../useOPFSFiles';
|
|
2
|
+
/**
|
|
3
|
+
* 'system' follows prefers-color-scheme. 'none' skips the built-in stylesheet and
|
|
4
|
+
* renders unstyled markup with stable `seed-fm-*` class names.
|
|
5
|
+
*/
|
|
6
|
+
export type OPFSFilesManagerTheme = 'system' | 'light' | 'dark' | 'none';
|
|
7
|
+
export type OPFSFilesManagerView = 'grid' | 'list';
|
|
8
|
+
/** Elements that accept extra classes through the `classNames` prop. */
|
|
9
|
+
export type OPFSFilesManagerSlot = 'root' | 'header' | 'toolbar' | 'body' | 'folder' | 'grid' | 'tile' | 'list' | 'row' | 'batchBar' | 'panel' | 'dialog' | 'toast';
|
|
10
|
+
export type OPFSFilesManagerClassNames = Partial<Record<OPFSFilesManagerSlot, string>>;
|
|
11
|
+
export type OPFSFilesManagerNotifyTone = 'success' | 'error';
|
|
12
|
+
/** What a notification is about, so hosts can write their own wording. */
|
|
13
|
+
export type OPFSFilesManagerNotice = {
|
|
14
|
+
kind: 'delete';
|
|
15
|
+
deleted: string[];
|
|
16
|
+
/** Paths that onBeforeDelete kept. */
|
|
17
|
+
skipped: string[];
|
|
18
|
+
failed: {
|
|
19
|
+
path: string;
|
|
20
|
+
error: string;
|
|
21
|
+
}[];
|
|
22
|
+
} | {
|
|
23
|
+
kind: 'download';
|
|
24
|
+
paths: string[];
|
|
25
|
+
/** Name of the saved .zip. Set when several files were saved. */
|
|
26
|
+
fileName?: string;
|
|
27
|
+
error?: string;
|
|
28
|
+
} | {
|
|
29
|
+
kind: 'copy-path';
|
|
30
|
+
path: string;
|
|
31
|
+
error?: string;
|
|
32
|
+
};
|
|
33
|
+
export interface OPFSFilesManagerDeleteAction {
|
|
34
|
+
/**
|
|
35
|
+
* Replaces "Delete" on the batch bar, panel footer, row action and the confirm dialog's
|
|
36
|
+
* heading and button. Used as-is, so it can include a count ("Remove 3 files from this device").
|
|
37
|
+
*/
|
|
38
|
+
label?: string;
|
|
39
|
+
/** false drops the danger colour and uses the primary confirm button. Default: true */
|
|
40
|
+
destructive?: boolean;
|
|
41
|
+
}
|
|
42
|
+
/** A delete action with defaults applied. Internal. */
|
|
43
|
+
export interface ResolvedDeleteAction {
|
|
44
|
+
label?: string;
|
|
45
|
+
destructive: boolean;
|
|
46
|
+
}
|
|
47
|
+
export interface OPFSFilesManagerProps {
|
|
48
|
+
/** Optional subdirectory to scan (e.g. 'app-files'). Default: root. */
|
|
49
|
+
rootPath?: string;
|
|
50
|
+
/** Filter which files to include. */
|
|
51
|
+
filter?: (file: OPFSFile) => boolean;
|
|
52
|
+
/**
|
|
53
|
+
* Called for each file after the user confirms a delete, just before it's removed.
|
|
54
|
+
* Return false to keep that file.
|
|
55
|
+
*/
|
|
56
|
+
onBeforeDelete?: (file: OPFSFile) => boolean | Promise<boolean>;
|
|
57
|
+
/** Called after a file or files are deleted. Use for clearing app state (e.g. Seed DB). */
|
|
58
|
+
onAfterDelete?: (paths: string[]) => void | Promise<void>;
|
|
59
|
+
/**
|
|
60
|
+
* Custom download handler (e.g. Electron). If not provided, uses a browser blob download.
|
|
61
|
+
* When several files are downloaded at once, this is called once with a `.zip` blob and a
|
|
62
|
+
* synthetic file whose `type` is 'application/zip'.
|
|
63
|
+
*/
|
|
64
|
+
onDownload?: (file: OPFSFile, blob: Blob) => void | Promise<void>;
|
|
65
|
+
/** Title for the page. Default: "Files" */
|
|
66
|
+
title?: string;
|
|
67
|
+
/** Description text. */
|
|
68
|
+
description?: string;
|
|
69
|
+
/** Heading level for the title. Default: 2 */
|
|
70
|
+
headingLevel?: 1 | 2 | 3 | 4 | 5 | 6;
|
|
71
|
+
/** Visual theme. Default: "system" */
|
|
72
|
+
theme?: OPFSFilesManagerTheme;
|
|
73
|
+
/** Class for the container. */
|
|
74
|
+
className?: string;
|
|
75
|
+
/** Extra classes for individual elements. */
|
|
76
|
+
classNames?: OPFSFilesManagerClassNames;
|
|
77
|
+
/**
|
|
78
|
+
* Starting view. By default, folders that are mostly images open as a grid and
|
|
79
|
+
* everything else as a list, until the user picks a view.
|
|
80
|
+
*/
|
|
81
|
+
defaultView?: OPFSFilesManagerView;
|
|
82
|
+
/**
|
|
83
|
+
* Show the resized copies the SDK writes to `images/<width>/` with their original
|
|
84
|
+
* image instead of as separate files. Default: true
|
|
85
|
+
*/
|
|
86
|
+
groupImageVariants?: boolean;
|
|
87
|
+
/**
|
|
88
|
+
* Extra warning for the delete confirmation, or null for none. The default flags
|
|
89
|
+
* the Seed client's database (`db/seed.db`).
|
|
90
|
+
*/
|
|
91
|
+
deleteWarning?: (files: OPFSFile[]) => string | null;
|
|
92
|
+
/**
|
|
93
|
+
* Replace the built-in delete confirmation. Receives every file that will be removed,
|
|
94
|
+
* including resized copies. Resolve true to delete.
|
|
95
|
+
*/
|
|
96
|
+
confirmDelete?: (files: OPFSFile[]) => Promise<boolean>;
|
|
97
|
+
/**
|
|
98
|
+
* Show results and errors in the host's own toaster. When set, the built-in toasts
|
|
99
|
+
* aren't rendered.
|
|
100
|
+
*/
|
|
101
|
+
/**
|
|
102
|
+
* Relabel the delete action, or make it non-destructive, for the files it would remove
|
|
103
|
+
* (including resized copies). Use it when the host knows those files have a copy
|
|
104
|
+
* elsewhere, such as on Arweave. Runs on every render, once per list row, so keep it
|
|
105
|
+
* cheap and synchronous.
|
|
106
|
+
*/
|
|
107
|
+
deleteAction?: (files: OPFSFile[]) => OPFSFilesManagerDeleteAction;
|
|
108
|
+
onNotify?: (message: string, tone: OPFSFilesManagerNotifyTone, notice: OPFSFilesManagerNotice) => void;
|
|
109
|
+
}
|
|
110
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/OPFSFilesManager/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAA;AAE/C;;;GAGG;AACH,MAAM,MAAM,qBAAqB,GAAG,QAAQ,GAAG,OAAO,GAAG,MAAM,GAAG,MAAM,CAAA;AAExE,MAAM,MAAM,oBAAoB,GAAG,MAAM,GAAG,MAAM,CAAA;AAElD,wEAAwE;AACxE,MAAM,MAAM,oBAAoB,GAC5B,MAAM,GACN,QAAQ,GACR,SAAS,GACT,MAAM,GACN,QAAQ,GACR,MAAM,GACN,MAAM,GACN,MAAM,GACN,KAAK,GACL,UAAU,GACV,OAAO,GACP,QAAQ,GACR,OAAO,CAAA;AAEX,MAAM,MAAM,0BAA0B,GAAG,OAAO,CAAC,MAAM,CAAC,oBAAoB,EAAE,MAAM,CAAC,CAAC,CAAA;AAEtF,MAAM,MAAM,0BAA0B,GAAG,SAAS,GAAG,OAAO,CAAA;AAE5D,0EAA0E;AAC1E,MAAM,MAAM,sBAAsB,GAC9B;IACE,IAAI,EAAE,QAAQ,CAAA;IACd,OAAO,EAAE,MAAM,EAAE,CAAA;IACjB,sCAAsC;IACtC,OAAO,EAAE,MAAM,EAAE,CAAA;IACjB,MAAM,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,EAAE,CAAA;CAC1C,GACD;IACE,IAAI,EAAE,UAAU,CAAA;IAChB,KAAK,EAAE,MAAM,EAAE,CAAA;IACf,iEAAiE;IACjE,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,KAAK,CAAC,EAAE,MAAM,CAAA;CACf,GACD;IAAE,IAAI,EAAE,WAAW,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,CAAA;AAEvD,MAAM,WAAW,4BAA4B;IAC3C;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,uFAAuF;IACvF,WAAW,CAAC,EAAE,OAAO,CAAA;CACtB;AAED,uDAAuD;AACvD,MAAM,WAAW,oBAAoB;IACnC,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,WAAW,EAAE,OAAO,CAAA;CACrB;AAED,MAAM,WAAW,qBAAqB;IACpC,uEAAuE;IACvE,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,qCAAqC;IACrC,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE,QAAQ,KAAK,OAAO,CAAA;IACpC;;;OAGG;IACH,cAAc,CAAC,EAAE,CAAC,IAAI,EAAE,QAAQ,KAAK,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAAA;IAC/D,2FAA2F;IAC3F,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IACzD;;;;OAIG;IACH,UAAU,CAAC,EAAE,CAAC,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IACjE,2CAA2C;IAC3C,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,wBAAwB;IACxB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,8CAA8C;IAC9C,YAAY,CAAC,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAA;IACpC,sCAAsC;IACtC,KAAK,CAAC,EAAE,qBAAqB,CAAA;IAC7B,+BAA+B;IAC/B,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,6CAA6C;IAC7C,UAAU,CAAC,EAAE,0BAA0B,CAAA;IACvC;;;OAGG;IACH,WAAW,CAAC,EAAE,oBAAoB,CAAA;IAClC;;;OAGG;IACH,kBAAkB,CAAC,EAAE,OAAO,CAAA;IAC5B;;;OAGG;IACH,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,QAAQ,EAAE,KAAK,MAAM,GAAG,IAAI,CAAA;IACpD;;;OAGG;IACH,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,QAAQ,EAAE,KAAK,OAAO,CAAC,OAAO,CAAC,CAAA;IACvD;;;OAGG;IACH;;;;;OAKG;IACH,YAAY,CAAC,EAAE,CAAC,KAAK,EAAE,QAAQ,EAAE,KAAK,4BAA4B,CAAA;IAClE,QAAQ,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,0BAA0B,EAAE,MAAM,EAAE,sBAAsB,KAAK,IAAI,CAAA;CACvG"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export interface StorageEstimate {
|
|
2
|
+
/** Bytes this origin uses across OPFS, IndexedDB, Cache Storage, etc. */
|
|
3
|
+
usage: number;
|
|
4
|
+
/** Bytes this origin may use. */
|
|
5
|
+
quota: number;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Read `navigator.storage.estimate()`, re-reading whenever `revision` changes.
|
|
9
|
+
* Returns null where the API is unavailable. Browsers round and pad these numbers.
|
|
10
|
+
*/
|
|
11
|
+
export declare function useStorageEstimate(revision: unknown): StorageEstimate | null;
|
|
12
|
+
//# sourceMappingURL=useStorageEstimate.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useStorageEstimate.d.ts","sourceRoot":"","sources":["../../src/OPFSFilesManager/useStorageEstimate.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,eAAe;IAC9B,yEAAyE;IACzE,KAAK,EAAE,MAAM,CAAA;IACb,iCAAiC;IACjC,KAAK,EAAE,MAAM,CAAA;CACd;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,OAAO,GAAG,eAAe,GAAG,IAAI,CAkB5E"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { FileEntry } from './fileModel';
|
|
2
|
+
export type ThumbnailStatus = 'idle' | 'loading' | 'ready' | 'error';
|
|
3
|
+
/**
|
|
4
|
+
* Lazily load a thumbnail object URL for an image entry once its element scrolls near
|
|
5
|
+
* the viewport. Returns `status: 'idle'` for non-images.
|
|
6
|
+
*/
|
|
7
|
+
export declare function useThumbnail(entry: FileEntry): {
|
|
8
|
+
ref: (el: Element | null) => void;
|
|
9
|
+
url: string | null;
|
|
10
|
+
status: ThumbnailStatus;
|
|
11
|
+
markError: () => void;
|
|
12
|
+
};
|
|
13
|
+
//# sourceMappingURL=useThumbnail.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useThumbnail.d.ts","sourceRoot":"","sources":["../../src/OPFSFilesManager/useThumbnail.ts"],"names":[],"mappings":"AAEA,OAAO,EAAY,KAAK,SAAS,EAAE,MAAM,aAAa,CAAA;AAmItD,MAAM,MAAM,eAAe,GAAG,MAAM,GAAG,SAAS,GAAG,OAAO,GAAG,OAAO,CAAA;AAEpE;;;GAGG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,SAAS;cAOd,OAAO,GAAG,IAAI;;;;EAsC5C"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Minimal store-only (uncompressed) ZIP writer. Used so "download selected" produces one
|
|
3
|
+
* file instead of N downloads, which browsers block after the first. Most OPFS content
|
|
4
|
+
* (JPEG, WebP, SQLite pages) doesn't compress well, so skipping deflate costs little.
|
|
5
|
+
* No ZIP64: the archive must stay under 4 GB and 65,535 entries.
|
|
6
|
+
*/
|
|
7
|
+
export declare function crc32(data: Uint8Array): number;
|
|
8
|
+
export interface ZipInput {
|
|
9
|
+
/** Path inside the archive, '/'-separated. */
|
|
10
|
+
name: string;
|
|
11
|
+
data: Blob;
|
|
12
|
+
lastModified?: number;
|
|
13
|
+
}
|
|
14
|
+
export declare function createZip(inputs: ZipInput[]): Promise<Blob>;
|
|
15
|
+
//# sourceMappingURL=zip.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"zip.d.ts","sourceRoot":"","sources":["../../src/OPFSFilesManager/zip.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAeH,wBAAgB,KAAK,CAAC,IAAI,EAAE,UAAU,GAAG,MAAM,CAK9C;AAWD,MAAM,WAAW,QAAQ;IACvB,8CAA8C;IAC9C,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,IAAI,CAAA;IACV,YAAY,CAAC,EAAE,MAAM,CAAA;CACtB;AAKD,wBAAsB,SAAS,CAAC,MAAM,EAAE,QAAQ,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CA4DjE"}
|
package/dist/OPFSImage.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OPFSImage.d.ts","sourceRoot":"","sources":["../src/OPFSImage.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,EAAuB,cAAc,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"OPFSImage.d.ts","sourceRoot":"","sources":["../src/OPFSImage.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,EAAuB,cAAc,EAAE,MAAM,OAAO,CAAC;AAMnE,KAAK,cAAc,GAAG,cAAc,CAAC,gBAAgB,CAAC,GAAG;IACrD,QAAQ,EAAE,MAAM,CAAC;CACpB,CAAC;AAGF,QAAA,MAAM,SAAS,EAAE,KAAK,CAAC,EAAE,CAAC,cAAc,CA8DvC,CAAC;AAEF,eAAe,SAAS,CAAC"}
|
package/dist/SeedClientGate.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ReactNode } from 'react';
|
|
1
|
+
import { default as React, ReactNode } from 'react';
|
|
2
2
|
import { SeedConstructorOptions, SchemaFileFormat } from '@seedprotocol/sdk';
|
|
3
3
|
/** Schema input: path string or SchemaFileFormat object. Merged into config.schema at init. */
|
|
4
4
|
type SchemaInput = string | SchemaFileFormat;
|
|
@@ -11,6 +11,12 @@ export type SeedClientGateProps = {
|
|
|
11
11
|
loadingComponent?: ReactNode;
|
|
12
12
|
/** @deprecated Schema is now loaded at init via config.schema; no separate import. Kept for backward compatibility. */
|
|
13
13
|
onSchemaImportError?: (err: unknown) => void;
|
|
14
|
+
/**
|
|
15
|
+
* Called when client init fails; children stay hidden behind the loading UI. A
|
|
16
|
+
* `FileSystemLockedError` (`code === 'OPFS_LOCKED'`) means another tab is using the app's
|
|
17
|
+
* storage: offer "close other tabs / retry", where retry calls `client.init` again.
|
|
18
|
+
*/
|
|
19
|
+
onInitError?: (err: unknown) => void;
|
|
14
20
|
/** Class for the root wrapper. e.g. "relative flex h-screen w-screen" */
|
|
15
21
|
wrapperClassName?: string;
|
|
16
22
|
/** Class for the loading overlay. e.g. "absolute inset-0 z-50 flex items-center justify-center bg-zinc-950" */
|
|
@@ -23,6 +29,6 @@ export type SeedClientGateProps = {
|
|
|
23
29
|
* This avoids removeChild DOM errors and ensures QueryClientProvider stays stable.
|
|
24
30
|
* Both overlay and content stay in DOM; we only toggle visibility via classes.
|
|
25
31
|
*/
|
|
26
|
-
export declare function SeedClientGate({ initConfig, schema, loadingComponent, wrapperClassName, loadingClassName, children, }: SeedClientGateProps):
|
|
32
|
+
export declare function SeedClientGate({ initConfig, schema, loadingComponent, wrapperClassName, loadingClassName, onInitError, children, }: SeedClientGateProps): React.JSX.Element;
|
|
27
33
|
export {};
|
|
28
34
|
//# sourceMappingURL=SeedClientGate.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SeedClientGate.d.ts","sourceRoot":"","sources":["../src/SeedClientGate.tsx"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"SeedClientGate.d.ts","sourceRoot":"","sources":["../src/SeedClientGate.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAqB,KAAK,SAAS,EAAE,MAAM,OAAO,CAAA;AAEhE,OAAO,KAAK,EAAE,sBAAsB,EAAc,gBAAgB,EAAE,MAAM,mBAAmB,CAAA;AAG7F,+FAA+F;AAC/F,KAAK,WAAW,GAAG,MAAM,GAAG,gBAAgB,CAAA;AAkB5C,MAAM,MAAM,mBAAmB,GAAG;IAChC,+DAA+D;IAC/D,UAAU,EAAE,sBAAsB,CAAA;IAClC,mHAAmH;IACnH,MAAM,CAAC,EAAE,WAAW,CAAA;IACpB,qEAAqE;IACrE,gBAAgB,CAAC,EAAE,SAAS,CAAA;IAC5B,uHAAuH;IACvH,mBAAmB,CAAC,EAAE,CAAC,GAAG,EAAE,OAAO,KAAK,IAAI,CAAA;IAC5C;;;;OAIG;IACH,WAAW,CAAC,EAAE,CAAC,GAAG,EAAE,OAAO,KAAK,IAAI,CAAA;IACpC,yEAAyE;IACzE,gBAAgB,CAAC,EAAE,MAAM,CAAA;IACzB,+GAA+G;IAC/G,gBAAgB,CAAC,EAAE,MAAM,CAAA;IACzB,QAAQ,EAAE,SAAS,CAAA;CACpB,CAAA;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,EAC7B,UAAU,EACV,MAAM,EACN,gBAAgB,EAChB,gBAAgB,EAChB,gBAAgB,EAChB,WAAW,EACX,QAAQ,GACT,EAAE,mBAAmB,qBA8DrB"}
|
package/dist/SeedImage.d.ts
CHANGED
|
@@ -1,13 +1,17 @@
|
|
|
1
1
|
import { default as React, DetailedHTMLProps, ImgHTMLAttributes } from 'react';
|
|
2
2
|
import { ItemProperty } from '@seedprotocol/sdk';
|
|
3
|
-
type SeedImageProps = DetailedHTMLProps<ImgHTMLAttributes<HTMLImageElement>, HTMLImageElement> & {
|
|
3
|
+
export type SeedImageProps = DetailedHTMLProps<ImgHTMLAttributes<HTMLImageElement>, HTMLImageElement> & {
|
|
4
4
|
imageProperty: ItemProperty<any>;
|
|
5
5
|
alt?: string;
|
|
6
6
|
width?: number;
|
|
7
7
|
height?: number;
|
|
8
8
|
/** Optional filename override when property hasn't resolved yet (e.g. in tests) */
|
|
9
9
|
filename?: string;
|
|
10
|
+
/**
|
|
11
|
+
* When true (default), ensure the image exists locally (download from Arweave +
|
|
12
|
+
* create needed size variants) before / while rendering.
|
|
13
|
+
*/
|
|
14
|
+
ensure?: boolean;
|
|
10
15
|
};
|
|
11
|
-
export declare const SeedImage: React.MemoExoticComponent<({ imageProperty, width, filename: filenameOverride, ...props }: SeedImageProps) => React.ReactNode>;
|
|
12
|
-
export {};
|
|
16
|
+
export declare const SeedImage: React.MemoExoticComponent<({ imageProperty, width, filename: filenameOverride, ensure, ...props }: SeedImageProps) => React.ReactNode>;
|
|
13
17
|
//# sourceMappingURL=SeedImage.d.ts.map
|
package/dist/SeedImage.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SeedImage.d.ts","sourceRoot":"","sources":["../src/SeedImage.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAuB,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAA;AAIxF,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;
|
|
1
|
+
{"version":3,"file":"SeedImage.d.ts","sourceRoot":"","sources":["../src/SeedImage.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAuB,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAA;AAIxF,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AA2ChD,MAAM,MAAM,cAAc,GAAG,iBAAiB,CAAC,iBAAiB,CAAC,gBAAgB,CAAC,EAAE,gBAAgB,CAAC,GAAG;IACtG,aAAa,EAAE,YAAY,CAAC,GAAG,CAAC,CAAA;IAChC,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,mFAAmF;IACnF,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB;;;OAGG;IACH,MAAM,CAAC,EAAE,OAAO,CAAA;CACjB,CAAA;AA4KD,eAAO,MAAM,SAAS,qGApKnB,cAAc,KAAG,KAAK,CAAC,SAAS,CA0KlC,CAAA"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { UseResolvedMediaRefParams } from './useResolvedMediaRef';
|
|
3
|
+
type AudioProps = React.DetailedHTMLProps<React.AudioHTMLAttributes<HTMLAudioElement>, HTMLAudioElement>;
|
|
4
|
+
export type SeedMediaAudioProps = Omit<AudioProps, 'src'> & {
|
|
5
|
+
value: string | undefined | null;
|
|
6
|
+
enabled?: boolean;
|
|
7
|
+
treatAs?: UseResolvedMediaRefParams['treatAs'];
|
|
8
|
+
/** Custom render; defaults to `<audio controls />`. */
|
|
9
|
+
render?: (props: AudioProps & {
|
|
10
|
+
src: string;
|
|
11
|
+
}) => React.ReactNode;
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* Audio from a raw feed/XML media string. Storage remains File/Image schema types;
|
|
15
|
+
* this helper only picks the browser element.
|
|
16
|
+
*/
|
|
17
|
+
export declare function SeedMediaAudio({ value, enabled, treatAs, render, controls, ...audioProps }: SeedMediaAudioProps): React.ReactNode;
|
|
18
|
+
export {};
|
|
19
|
+
//# sourceMappingURL=SeedMediaAudio.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SeedMediaAudio.d.ts","sourceRoot":"","sources":["../src/SeedMediaAudio.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAuB,KAAK,yBAAyB,EAAE,MAAM,uBAAuB,CAAA;AAE3F,KAAK,UAAU,GAAG,KAAK,CAAC,iBAAiB,CACvC,KAAK,CAAC,mBAAmB,CAAC,gBAAgB,CAAC,EAC3C,gBAAgB,CACjB,CAAA;AAED,MAAM,MAAM,mBAAmB,GAAG,IAAI,CAAC,UAAU,EAAE,KAAK,CAAC,GAAG;IAC1D,KAAK,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,CAAA;IAChC,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,OAAO,CAAC,EAAE,yBAAyB,CAAC,SAAS,CAAC,CAAA;IAC9C,uDAAuD;IACvD,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE,UAAU,GAAG;QAAE,GAAG,EAAE,MAAM,CAAA;KAAE,KAAK,KAAK,CAAC,SAAS,CAAA;CAClE,CAAA;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAAC,EAC7B,KAAK,EACL,OAAO,EACP,OAAO,EACP,MAAM,EACN,QAAe,EACf,GAAG,UAAU,EACd,EAAE,mBAAmB,GAAG,KAAK,CAAC,SAAS,CAYvC"}
|