filecove 0.1.0 → 0.2.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/CHANGELOG.md +21 -0
- package/dist/components/buttons/toolbar-actions.d.ts +1 -1
- package/dist/components/buttons/tooltip-icon-button.d.ts +1 -1
- package/dist/components/downloads/download-panel.d.ts +1 -1
- package/dist/components/drag/drag-preview.d.ts +24 -0
- package/dist/components/file-manager/announcer.d.ts +1 -1
- package/dist/components/file-manager/content/file-grid.d.ts +1 -1
- package/dist/components/file-manager/content/file-list.d.ts +1 -1
- package/dist/components/file-manager/content/folder-view.d.ts +1 -1
- package/dist/components/file-manager/content/item-icon.d.ts +1 -1
- package/dist/components/file-manager/content/search-results.d.ts +1 -1
- package/dist/components/file-manager/content/search-tabs.d.ts +1 -1
- package/dist/components/file-manager/content/trash-bar.d.ts +1 -1
- package/dist/components/file-manager/context-menu/context-menu.d.ts +1 -1
- package/dist/components/file-manager/dialogs/conflict-step.d.ts +1 -1
- package/dist/components/file-manager/dialogs/delete-dialog.d.ts +3 -2
- package/dist/components/file-manager/dialogs/image-viewer.d.ts +1 -1
- package/dist/components/file-manager/dialogs/name-dialog.d.ts +1 -1
- package/dist/components/file-manager/dialogs/paste-dialog.d.ts +1 -1
- package/dist/components/file-manager/dialogs/preview-dialog.d.ts +2 -2
- package/dist/components/file-manager/dialogs/restore-dialog.d.ts +1 -1
- package/dist/components/file-manager/dialogs/shortcuts-dialog.d.ts +1 -1
- package/dist/components/file-manager/dialogs/transfer-dialog.d.ts +2 -2
- package/dist/components/file-manager/dialogs/upload-dialog.d.ts +1 -1
- package/dist/components/file-manager/file-manager.d.ts +1 -1
- package/dist/components/file-manager/header-bar/header-bar.d.ts +1 -1
- package/dist/components/file-manager/header-bar/history-menu.d.ts +1 -1
- package/dist/components/file-manager/header-bar/path-bar.d.ts +1 -1
- package/dist/components/file-manager/header-bar/search-field.d.ts +1 -1
- package/dist/components/file-manager/header-bar/search-sections-menu.d.ts +1 -1
- package/dist/components/file-manager/header-bar/view-menu.d.ts +1 -1
- package/dist/components/file-manager/notice-bar.d.ts +1 -1
- package/dist/components/file-manager/properties-pane.d.ts +2 -2
- package/dist/components/file-manager/sidebar/location-item.d.ts +1 -1
- package/dist/components/file-manager/sidebar/main-menu.d.ts +1 -1
- package/dist/components/file-manager/sidebar/sidebar.d.ts +2 -2
- package/dist/components/icons/create-icon.d.ts +1 -1
- package/dist/components/icons/icon-provider.d.ts +1 -1
- package/dist/components/icons/icon-slot.d.ts +1 -1
- package/dist/components/icons/icon.d.ts +1 -1
- package/dist/components/media-manager/asset-delete.d.ts +20 -8
- package/dist/components/media-manager/asset-hold.d.ts +1 -1
- package/dist/components/media-manager/asset-option.d.ts +13 -2
- package/dist/components/media-manager/asset-trail.d.ts +1 -1
- package/dist/components/media-manager/choice-list.d.ts +1 -1
- package/dist/components/media-manager/choices-pane.d.ts +1 -1
- package/dist/components/media-manager/group-create.d.ts +1 -1
- package/dist/components/media-manager/group-path.d.ts +8 -2
- package/dist/components/media-manager/library-list.d.ts +4 -2
- package/dist/components/media-manager/media-asset.d.ts +19 -7
- package/dist/components/media-manager/media-edit-many.d.ts +33 -0
- package/dist/components/media-manager/media-fields.d.ts +1 -1
- package/dist/components/media-manager/media-filter-chips.d.ts +17 -0
- package/dist/components/media-manager/media-filters-dialog.d.ts +39 -0
- package/dist/components/media-manager/media-filters.d.ts +37 -0
- package/dist/components/media-manager/media-form.d.ts +3 -1
- package/dist/components/media-manager/media-frame.d.ts +7 -3
- package/dist/components/media-manager/media-grid.d.ts +34 -5
- package/dist/components/media-manager/media-group.d.ts +1 -1
- package/dist/components/media-manager/media-header.d.ts +20 -3
- package/dist/components/media-manager/media-manager.d.ts +33 -10
- package/dist/components/media-manager/media-move.d.ts +19 -11
- package/dist/components/media-manager/media-picker.d.ts +25 -7
- package/dist/components/media-manager/media-picture.d.ts +1 -1
- package/dist/components/media-manager/media-process.d.ts +1 -1
- package/dist/components/media-manager/media-row.d.ts +1 -1
- package/dist/components/media-manager/media-tile.d.ts +1 -1
- package/dist/components/media-manager/media-upload.d.ts +28 -6
- package/dist/components/media-manager/picker-frame.d.ts +6 -2
- package/dist/components/media-manager/selection-bar.d.ts +25 -0
- package/dist/components/media-manager/upload-tile.d.ts +5 -3
- package/dist/components/properties/properties-panel.d.ts +9 -3
- package/dist/components/properties/property-display.d.ts +1 -1
- package/dist/components/properties/property-editor.d.ts +1 -1
- package/dist/components/properties/property-input.d.ts +1 -1
- package/dist/components/transfers/transfer-panel.d.ts +1 -1
- package/dist/components/ui/dialog.d.ts +1 -1
- package/dist/components/ui/root-providers.d.ts +1 -1
- package/dist/components/uploads/upload-panel.d.ts +8 -2
- package/dist/contexts/cut-context.d.ts +1 -1
- package/dist/contexts/data-context.d.ts +3 -3
- package/dist/contexts/direction-context.d.ts +1 -1
- package/dist/contexts/drag-context.d.ts +1 -1
- package/dist/contexts/icon-context.d.ts +1 -1
- package/dist/contexts/locale-context.d.ts +1 -1
- package/dist/contexts/moving-context.d.ts +1 -1
- package/dist/hooks/use-asset-states.d.ts +1 -1
- package/dist/hooks/use-clipboard-follow.d.ts +2 -2
- package/dist/hooks/use-cut-ids.d.ts +1 -1
- package/dist/hooks/use-dev-checks.d.ts +16 -0
- package/dist/hooks/use-download-queue.d.ts +3 -3
- package/dist/hooks/use-dragged-ids.d.ts +1 -1
- package/dist/hooks/use-drop-target.d.ts +1 -1
- package/dist/hooks/use-entry-drag.d.ts +2 -2
- package/dist/hooks/use-files-drop.d.ts +7 -1
- package/dist/hooks/use-folder.d.ts +3 -3
- package/dist/hooks/use-icon-config.d.ts +1 -1
- package/dist/hooks/use-level-filters.d.ts +112 -0
- package/dist/hooks/use-level-search.d.ts +8 -6
- package/dist/hooks/use-locale.d.ts +3 -3
- package/dist/hooks/use-location-history.d.ts +1 -1
- package/dist/hooks/use-long-press.d.ts +1 -1
- package/dist/hooks/use-marquee.d.ts +1 -1
- package/dist/hooks/use-match-count.d.ts +5 -4
- package/dist/hooks/use-media-search.d.ts +22 -8
- package/dist/hooks/use-moving-ids.d.ts +2 -2
- package/dist/hooks/use-preview-contents.d.ts +1 -1
- package/dist/hooks/use-properties.d.ts +2 -2
- package/dist/hooks/use-scroll-measure.d.ts +1 -1
- package/dist/hooks/use-search.d.ts +6 -5
- package/dist/hooks/use-selection.d.ts +1 -1
- package/dist/hooks/use-text-direction.d.ts +1 -1
- package/dist/hooks/use-thumbnail.d.ts +1 -1
- package/dist/hooks/use-transfer-queue.d.ts +5 -5
- package/dist/hooks/use-tree-rows.d.ts +1 -1
- package/dist/hooks/use-tree-selection.d.ts +1 -1
- package/dist/hooks/use-upload-queue.d.ts +7 -5
- package/dist/hooks/use-virtual-lines.d.ts +1 -1
- package/dist/hooks/use-wheel-zoom.d.ts +1 -1
- package/dist/icon-sets/filled.d.ts +1 -1
- package/dist/icon-sets/outlined.d.ts +1 -1
- package/dist/icon-sets/rounded.d.ts +1 -1
- package/dist/icon-sets/sharp.d.ts +1 -1
- package/dist/icon-sets/two-tone.d.ts +1 -1
- package/dist/index.d.ts +18 -18
- package/dist/index.js +4307 -1129
- package/dist/index.js.map +1 -1
- package/dist/locales/en-us.d.ts +1 -1
- package/dist/store/download-queue.d.ts +1 -1
- package/dist/store/folder-store.d.ts +1 -1
- package/dist/store/properties-cache.d.ts +9 -1
- package/dist/store/thumbnail-cache.d.ts +1 -1
- package/dist/store/transfer-across.d.ts +1 -1
- package/dist/store/transfer-queue.d.ts +2 -2
- package/dist/store/upload-queue.d.ts +28 -8
- package/dist/styles/classes.d.ts +30 -2
- package/dist/styles/layout.d.ts +2 -2
- package/dist/styles/media-layout.d.ts +1 -1
- package/dist/styles.css +1095 -367
- package/dist/styles.layer.css +1095 -367
- package/dist/types/action.d.ts +3 -3
- package/dist/types/adapter.d.ts +164 -11
- package/dist/types/api.d.ts +21 -9
- package/dist/types/clipboard.d.ts +2 -2
- package/dist/types/download.d.ts +1 -1
- package/dist/types/drag.d.ts +4 -4
- package/dist/types/folder.d.ts +1 -1
- package/dist/types/index.d.ts +27 -27
- package/dist/types/locale.d.ts +161 -4
- package/dist/types/main-menu.d.ts +1 -1
- package/dist/types/media.d.ts +127 -11
- package/dist/types/menu.d.ts +4 -4
- package/dist/types/navigation.d.ts +2 -2
- package/dist/types/preview.d.ts +1 -1
- package/dist/types/previewer.d.ts +1 -1
- package/dist/types/properties.d.ts +20 -2
- package/dist/types/property-definition.d.ts +58 -1
- package/dist/types/search.d.ts +2 -2
- package/dist/types/section.d.ts +2 -2
- package/dist/types/selection.d.ts +3 -3
- package/dist/types/slots.d.ts +12 -7
- package/dist/types/transfer.d.ts +2 -2
- package/dist/types/tree.d.ts +2 -2
- package/dist/types/undo.d.ts +3 -3
- package/dist/types/upload.d.ts +79 -3
- package/dist/types/view.d.ts +5 -5
- package/dist/utils/action-groups.d.ts +1 -1
- package/dist/utils/clipboard.d.ts +2 -2
- package/dist/utils/dom.d.ts +13 -0
- package/dist/utils/download.d.ts +1 -1
- package/dist/utils/field-errors.d.ts +1 -1
- package/dist/utils/files.d.ts +9 -5
- package/dist/utils/format.d.ts +1 -1
- package/dist/utils/groups.d.ts +1 -1
- package/dist/utils/hidden.d.ts +1 -1
- package/dist/utils/keyboard.d.ts +1 -1
- package/dist/utils/media.d.ts +82 -5
- package/dist/utils/menu-position.d.ts +1 -1
- package/dist/utils/names.d.ts +1 -1
- package/dist/utils/navigation.d.ts +1 -1
- package/dist/utils/path.d.ts +2 -2
- package/dist/utils/permissions.d.ts +2 -2
- package/dist/utils/preview.d.ts +1 -1
- package/dist/utils/property-value.d.ts +3 -1
- package/dist/utils/search.d.ts +1 -1
- package/dist/utils/sections.d.ts +1 -1
- package/dist/utils/selection.d.ts +1 -1
- package/dist/utils/shortcut.d.ts +1 -1
- package/dist/utils/slots.d.ts +2 -2
- package/dist/utils/sort.d.ts +1 -1
- package/dist/utils/transfer.d.ts +1 -1
- package/dist/utils/trash.d.ts +1 -1
- package/dist/utils/undo.d.ts +1 -1
- package/dist/utils/zoom.d.ts +2 -2
- package/docs/README.md +1 -1
- package/docs/adapter.md +66 -6
- package/docs/customizing.md +31 -2
- package/docs/getting-started.md +3 -1
- package/docs/media-manager.md +194 -7
- package/docs/search.md +2 -0
- package/docs/uploads-and-downloads.md +2 -1
- package/package.json +1 -1
- package/dist/components/file-manager/drag-preview.d.ts +0 -22
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { FieldErrors, FileEntry, PropertyDefinition, PropertyErrorKeyParams } from "../types";
|
|
1
|
+
import type { FieldErrors, FileEntry, PropertyDefinition, PropertyErrorKeyParams } from "../types/index.js";
|
|
2
2
|
/** No errors: what the properties hand their definitions, and a media manager without `errors`. */
|
|
3
3
|
export declare const NO_ERRORS: FieldErrors;
|
|
4
4
|
export declare const NO_MESSAGES: readonly string[];
|
package/dist/utils/files.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { DragEvent } from "react";
|
|
2
|
-
import type { DroppedFiles, FolderSource, Section } from "../types";
|
|
2
|
+
import type { DroppedFiles, FolderSource, Section } from "../types/index.js";
|
|
3
3
|
/**
|
|
4
4
|
* Whether files are dragged in from outside, such as from the desktop. Only that there are some can
|
|
5
5
|
* be told before the drop, not what they are.
|
|
@@ -25,10 +25,14 @@ export declare const pickedFolder: (files: File[]) => FolderSource | undefined;
|
|
|
25
25
|
*/
|
|
26
26
|
export declare const takesUploads: (section: Section) => boolean;
|
|
27
27
|
/**
|
|
28
|
-
* The patterns of
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
|
|
28
|
+
* The patterns of an `accept` string, as a file input reads it: extensions (".pdf"), MIME types
|
|
29
|
+
* ("image/png") and their wildcards ("image/*"), lowercased. Null when it takes any file: not a
|
|
30
|
+
* string, or a string with no pattern, or with the one for every type.
|
|
31
|
+
*/
|
|
32
|
+
export declare const acceptPatterns: (rule: unknown) => string[] | null;
|
|
33
|
+
/**
|
|
34
|
+
* The patterns of the section's `acceptUploads` string (see `acceptPatterns`); null when it takes
|
|
35
|
+
* any file, `true` or left out included.
|
|
32
36
|
*/
|
|
33
37
|
export declare const uploadPatterns: (section: Section) => string[] | null;
|
|
34
38
|
/**
|
package/dist/utils/format.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Locale, LocaleText } from "../types";
|
|
1
|
+
import type { Locale, LocaleText } from "../types/index.js";
|
|
2
2
|
/**
|
|
3
3
|
* The text and formats for a `FileManager` or a `MediaManager`: `localeText` over the English
|
|
4
4
|
* defaults, with keys given as undefined kept in English, and numbers, sizes, dates and the order
|
package/dist/utils/groups.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { EntryGroup, FileAdapter, FileEntry, FolderRef, MenuRequest, Section } from "../types";
|
|
1
|
+
import type { EntryGroup, FileAdapter, FileEntry, FolderRef, MenuRequest, Section } from "../types/index.js";
|
|
2
2
|
/** An entry of a section, with where it is and the adapter serving it. */
|
|
3
3
|
interface PlacedEntry {
|
|
4
4
|
section: Section;
|
package/dist/utils/hidden.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import type { FileEntry } from "../types";
|
|
1
|
+
import type { FileEntry } from "../types/index.js";
|
|
2
2
|
/** Whether the entry is hidden: as the adapter says with `hidden`, or else when its name starts with a dot. */
|
|
3
3
|
export declare const isHidden: (entry: FileEntry) => boolean;
|
package/dist/utils/keyboard.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { KeyboardEvent } from "react";
|
|
2
|
-
import type { EntryLayout } from "../types";
|
|
2
|
+
import type { EntryLayout } from "../types/index.js";
|
|
3
3
|
/** The keys that open a context menu: the Menu key, or Shift+F10. */
|
|
4
4
|
export declare const isMenuKey: (event: KeyboardEvent) => boolean;
|
|
5
5
|
/** A key that types a character, which type-ahead finds an entry by. Shift is allowed, for capitals. */
|
package/dist/utils/media.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AssetHold, AssetState, DroppedFiles, FileAdapter, FileEntry, FolderRef, GroupPicks, IconName, Locale, MediaActionContext, MediaActionGroup, MediaKind, MediaLayout, MediaPickForm, MediaSection, MediaUploadCheck, ToolbarGroup } from "../types";
|
|
1
|
+
import type { AssetHold, AssetState, DroppedFiles, FileAdapter, FileEntry, FileUploadItem, FolderMaker, FolderRef, GroupPicks, IconName, Locale, MediaActionContext, MediaActionGroup, MediaGroupForm, MediaKind, MediaLayout, MediaPickForm, MediaSection, MediaUploadCheck, PropertyDefinition, PropertyDefinitionGroup, ToolbarGroup, UploadItem, UploadPlace } from "../types/index.js";
|
|
2
2
|
/**
|
|
3
3
|
* The app's actions that apply as the media manager's header shows them, still grouped, with groups
|
|
4
4
|
* left empty dropped, each bound to what it's told.
|
|
@@ -19,24 +19,101 @@ export declare const layoutsOf: (section: MediaSection) => readonly MediaLayout[
|
|
|
19
19
|
export declare const pickFormOf: (asset: FileEntry, section: MediaSection, pickForm: ((asset: FileEntry, section: MediaSection) => MediaPickForm | null) | undefined) => MediaPickForm | null | undefined;
|
|
20
20
|
/** What a library says of groups going into a level, the group open or `null` at its root; nothing unsaid. */
|
|
21
21
|
export declare const groupRule: (section: MediaSection, parent: FileEntry | null) => boolean | undefined;
|
|
22
|
+
/**
|
|
23
|
+
* The form a group made at a level of a library is asked by: the library's own, where its adapter takes
|
|
24
|
+
* what it holds (`createGroup`), or else none, a name alone going to `createFolder`.
|
|
25
|
+
*/
|
|
26
|
+
export declare const newGroupFormOf: (section: MediaSection, adapter: FileAdapter, parent: FileEntry | null) => MediaGroupForm<Record<string, unknown>> | null;
|
|
27
|
+
/**
|
|
28
|
+
* How folders uploaded into a level of a library make its groups, by the rules New group goes by: where
|
|
29
|
+
* the library says a group can be (`createGroups`), by its group form's `fromFolder` through the
|
|
30
|
+
* adapter's `createGroup` where a form makes them, or else named as the folder through `createFolder`.
|
|
31
|
+
* A folder where neither can fails, with what's in it, saying no group can be made in the group it goes
|
|
32
|
+
* in (`refused`, handed its name, or the library's label at its root, isolated). The folder uploaded
|
|
33
|
+
* goes in the level open, which the queue gives as `parent`, as it does the group just made of the
|
|
34
|
+
* folder around each one inside it.
|
|
35
|
+
*/
|
|
36
|
+
export declare const groupMaker: (section: MediaSection, adapter: FileAdapter, refused: (place: string) => string) => FolderMaker;
|
|
37
|
+
/**
|
|
38
|
+
* How folders given to a level of a library go, where they can be made its groups: what the level lists
|
|
39
|
+
* there (`listed`, its whole listing), the form a group made there is asked by, and how a folder kept
|
|
40
|
+
* beside an asset of its name is named.
|
|
41
|
+
*/
|
|
42
|
+
export interface FolderGroups {
|
|
43
|
+
listed: readonly FileEntry[];
|
|
44
|
+
form: MediaGroupForm | null;
|
|
45
|
+
keptBothName: (name: string, number: number) => string;
|
|
46
|
+
}
|
|
22
47
|
/**
|
|
23
48
|
* Sorts what was picked, dropped or pasted into a level of a library before anything is sent: files of
|
|
24
|
-
* types it doesn't take (`acceptUploads`),
|
|
25
|
-
*
|
|
26
|
-
*
|
|
49
|
+
* types it doesn't take (`acceptUploads`), and names its backend's own rules refuse (`checkName`, asked
|
|
50
|
+
* with that level as the folder) are left out. Folders are made groups where `groups` says they can be,
|
|
51
|
+
* merged into a group of their name there that can be written to, else made under that name, or a free
|
|
52
|
+
* one beside anything else of it (`freeName`), a library holding no two of a name it can tell apart;
|
|
53
|
+
* those the level's group form won't make (`fromFolder` answering `null`, or missing) are left out, as
|
|
54
|
+
* all are without `groups`, what a group is, and so what one given would make, being the library's.
|
|
55
|
+
*/
|
|
56
|
+
export declare const checkMediaUpload: (section: MediaSection, adapter: FileAdapter, { files, folders }: DroppedFiles, parentId: string, groups?: FolderGroups) => MediaUploadCheck;
|
|
57
|
+
/**
|
|
58
|
+
* Sorts a file picked to take an asset's place before it's sent, as an upload's are: one of a type its
|
|
59
|
+
* library doesn't take (`acceptUploads`) is left out. Its name isn't checked, as the asset keeps its
|
|
60
|
+
* own, or takes the new file's, as its backend decides.
|
|
61
|
+
*/
|
|
62
|
+
export declare const checkReplacement: (section: MediaSection, file: File) => MediaUploadCheck;
|
|
63
|
+
/**
|
|
64
|
+
* Sorts files picked to go into a part of an asset (`PropertyUpload`), as an upload's are: those of a
|
|
65
|
+
* type the part doesn't take (`accept`) are left out. Their names aren't checked, as a part isn't
|
|
66
|
+
* listed in a level, and what it's called there is its backend's.
|
|
27
67
|
*/
|
|
28
|
-
export declare const
|
|
68
|
+
export declare const checkPartUpload: (accept: string | undefined, files: readonly File[]) => MediaUploadCheck;
|
|
69
|
+
/**
|
|
70
|
+
* What uploads are doing to what an adapter's libraries list, by id, with the line and the bar their
|
|
71
|
+
* tiles and views show, as the backend's work on an asset usable meanwhile shows: the assets whose files
|
|
72
|
+
* are being put in place of (`FileAdapter.replace`), which stay as they were until the new file is in,
|
|
73
|
+
* and those files are being uploaded into a part of (`FileAdapter.uploadPart`), waiting or being sent,
|
|
74
|
+
* with how far along once the adapter says; and the groups folders uploaded made or went into, being
|
|
75
|
+
* filled, with how many of their files are in. A file put in an asset's place wins over its parts, as
|
|
76
|
+
* the asset changes most by it.
|
|
77
|
+
*/
|
|
78
|
+
export declare const uploadWorksOf: (items: readonly UploadItem[], adapter: FileAdapter, { text, formatPercent }: Pick<Locale, "text" | "formatPercent">) => ReadonlyMap<string, AssetHold>;
|
|
29
79
|
/**
|
|
30
80
|
* What fields in an upload form are handed as their entry, which a definition's functions take, as
|
|
31
81
|
* nothing is uploaded yet: the first file's name and type, the files' size together, and no id.
|
|
32
82
|
*/
|
|
33
83
|
export declare const uploadStandIn: (files: readonly File[]) => FileEntry;
|
|
84
|
+
/**
|
|
85
|
+
* An entry standing in for several being changed together, in Edit fields…, for the definitions'
|
|
86
|
+
* functions, which take one: the first one's name and kind, their type when they share one, and no id,
|
|
87
|
+
* as `uploadStandIn` has for files, so nothing takes it for one of them.
|
|
88
|
+
*/
|
|
89
|
+
export declare const manyStandIn: (entries: readonly FileEntry[]) => FileEntry;
|
|
90
|
+
/**
|
|
91
|
+
* Whether Edit fields… offers a property for several at once: one that can be changed, with an editor
|
|
92
|
+
* unless it says otherwise (`editMany`), or drawn by `render` alone where it says so.
|
|
93
|
+
*/
|
|
94
|
+
export declare const editsMany: (definition: PropertyDefinition) => boolean;
|
|
95
|
+
/**
|
|
96
|
+
* The fields Edit fields… offers for several entries, each with definitions of its own, as an album's
|
|
97
|
+
* differ from a track's: those of the first one's that it offers and every other one's offer too, by
|
|
98
|
+
* `field`, in the first one's groups and order, groups left with none dropped. None where any has no
|
|
99
|
+
* definitions.
|
|
100
|
+
*/
|
|
101
|
+
export declare const fieldsForMany: (entries: readonly FileEntry[], definitionsOf: (entry: FileEntry) => readonly PropertyDefinitionGroup[] | undefined) => PropertyDefinitionGroup[];
|
|
34
102
|
/**
|
|
35
103
|
* The groups of a search's trail as entries, for the ways through a library, which walked ones are.
|
|
36
104
|
* All that's known of them is what the adapter's trail gave, so one giving whole entries is drawn as
|
|
37
105
|
* one walked to is, by `groupHeader` for one.
|
|
38
106
|
*/
|
|
39
107
|
export declare const groupsOfTrail: (refs: readonly FolderRef[]) => FileEntry[];
|
|
108
|
+
/**
|
|
109
|
+
* Where a file uploaded into a library's level is, when its adapter said more than its entry: the
|
|
110
|
+
* groups holding it, read from below the library's root wherever that is in the trail it gave, or the
|
|
111
|
+
* level's own (`levelTrail`) when it gave none. Nothing when it said no more, or only that the file
|
|
112
|
+
* is where it went, as the level's listing will have it.
|
|
113
|
+
*/
|
|
114
|
+
export declare const uploadPlaceOf: ({ entry, existing, trail }: FileUploadItem, rootId: string, folderId: string, levelTrail: readonly FileEntry[]) => UploadPlace | undefined;
|
|
115
|
+
/** Where an upload is, written out: the groups holding it, or the library's label at its root. */
|
|
116
|
+
export declare const uploadPlaceName: (among: readonly FileEntry[], library: MediaSection) => string;
|
|
40
117
|
/**
|
|
41
118
|
* An asset as the backend's latest word on its processing has it, where its listing said it was
|
|
42
119
|
* being processed: with how it stands now, or once it's done, as the backend handed it over, or
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { MouseEvent } from "react";
|
|
2
|
-
import type { HeldPress, MenuPosition } from "../types";
|
|
2
|
+
import type { HeldPress, MenuPosition } from "../types/index.js";
|
|
3
3
|
/** At the pointer, for right-clicks. */
|
|
4
4
|
export declare const pointerPosition: (event: MouseEvent) => MenuPosition;
|
|
5
5
|
/** Where a touch press was held, for the menu a long-press opens. */
|
package/dist/utils/names.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { FileEntry, FileManagerLocaleText, UploadLocaleText } from "../types";
|
|
1
|
+
import type { FileEntry, FileManagerLocaleText, UploadLocaleText } from "../types/index.js";
|
|
2
2
|
type EntryKind = FileEntry["kind"];
|
|
3
3
|
/**
|
|
4
4
|
* Why a name can't be given to an entry, or undefined when it can. `name` is expected trimmed.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { FileEntry, FileManagerLocation, FolderRef, PlaceName, Section } from "../types";
|
|
1
|
+
import type { FileEntry, FileManagerLocation, FolderRef, PlaceName, Section } from "../types/index.js";
|
|
2
2
|
/** The folder a place points at: the end of its trail, or the section root. */
|
|
3
3
|
export declare const folderOf: (section: Section, trail: FolderRef[]) => FolderRef;
|
|
4
4
|
/** Whether two places are the same folder of the same section, by id. */
|
package/dist/utils/path.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { FolderStore } from "../store/folder-store";
|
|
2
|
-
import type { FileAdapter, FileManagerLocaleText, FileManagerLocation, FolderRef, PathProblem, PathResult, Section } from "../types";
|
|
1
|
+
import type { FolderStore } from "../store/folder-store.js";
|
|
2
|
+
import type { FileAdapter, FileManagerLocaleText, FileManagerLocation, FolderRef, PathProblem, PathResult, Section } from "../types/index.js";
|
|
3
3
|
/** What `resolvePath` reads from the file manager. */
|
|
4
4
|
export interface PathContext {
|
|
5
5
|
/** Where a path not starting with "/" begins: the open place, in `section`. */
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { FolderStore } from "../store/folder-store";
|
|
2
|
-
import type { EntryPermissions, FileEntry, FileManagerLocaleText, FolderRef, MovingKind, MovingKinds, Section } from "../types";
|
|
1
|
+
import type { FolderStore } from "../store/folder-store.js";
|
|
2
|
+
import type { EntryPermissions, FileEntry, FileManagerLocaleText, FolderRef, MovingKind, MovingKinds, Section } from "../types/index.js";
|
|
3
3
|
/** Whether every one of the permissions given allows `what`; each allows what it doesn't set to false. */
|
|
4
4
|
export declare const allows: (what: keyof EntryPermissions, ...permissions: (EntryPermissions | undefined)[]) => boolean;
|
|
5
5
|
/** Whether an entry is a folder whose own permissions say nothing can be put in it, which shows a lock. */
|
package/dist/utils/preview.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { FileAdapter, FileContent, FileEntry, FilePreviewer, PreviewPlan, TextExcerpt } from "../types";
|
|
1
|
+
import type { FileAdapter, FileContent, FileEntry, FilePreviewer, PreviewPlan, TextExcerpt } from "../types/index.js";
|
|
2
2
|
/** How much of a text file the preview reads and shows at first, and reads more by each time, in bytes. */
|
|
3
3
|
export declare const TEXT_LIMIT = 256000;
|
|
4
4
|
/**
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { FileEntry, Locale, PropertyDefinition, PropertyOption } from "../types";
|
|
1
|
+
import type { FileEntry, Locale, PropertyDefinition, PropertyOption } from "../types/index.js";
|
|
2
2
|
/** Whether a property has nothing to show: nothing, an empty text, or an empty list. */
|
|
3
3
|
export declare const isEmptyValue: (value: unknown) => boolean;
|
|
4
4
|
/**
|
|
@@ -31,6 +31,8 @@ export declare const formatValue: (definition: PropertyDefinition, value: unknow
|
|
|
31
31
|
* kind it only writes out (size, duration) with nothing to choose from, and no type at all.
|
|
32
32
|
*/
|
|
33
33
|
export declare const hasBuiltInEditor: (definition: PropertyDefinition) => boolean;
|
|
34
|
+
/** The name of the part a property's files are uploaded into (`PropertyUpload.part`), or its `field`. */
|
|
35
|
+
export declare const partNameOf: (definition: PropertyDefinition) => string;
|
|
34
36
|
/** Whether a property can be edited at all: by its own editor, or by the built-in one. */
|
|
35
37
|
export declare const hasEditor: (definition: PropertyDefinition) => boolean;
|
|
36
38
|
/** Whether two values are the same, lists item by item, an empty text the same as none. */
|
package/dist/utils/search.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { FileManagerSearch } from "../types";
|
|
1
|
+
import type { FileManagerSearch } from "../types/index.js";
|
|
2
2
|
/**
|
|
3
3
|
* What's typed in a search, as the words a name has to hold, each folded by `fold` (case and
|
|
4
4
|
* accents left out, `Locale.foldLetters`). None when nothing but spaces is typed.
|
package/dist/utils/sections.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Section } from "../types";
|
|
1
|
+
import type { Section } from "../types/index.js";
|
|
2
2
|
/**
|
|
3
3
|
* Whether entries listed in `source` may be moved or copied into `target`, by `target`'s
|
|
4
4
|
* `importFrom`. Within a section they always may. The adapters aren't compared here.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { MouseEvent } from "react";
|
|
2
|
-
import type { EntrySelection, SelectModifiers, TreeSelection, TreeTarget } from "../types";
|
|
2
|
+
import type { EntrySelection, SelectModifiers, TreeSelection, TreeTarget } from "../types/index.js";
|
|
3
3
|
export declare const EMPTY_SELECTION: EntrySelection;
|
|
4
4
|
export declare const NO_MODIFIERS: SelectModifiers;
|
|
5
5
|
/** What a click's modifier keys ask for. ⌘ stands in for Ctrl on macOS, where Ctrl-click opens the context menu. */
|
package/dist/utils/shortcut.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { KeyboardEvent } from "react";
|
|
2
|
-
import type { FileManagerLocaleText, UndoDirection, ZoomStep } from "../types";
|
|
2
|
+
import type { FileManagerLocaleText, UndoDirection, ZoomStep } from "../types/index.js";
|
|
3
3
|
/**
|
|
4
4
|
* The keys a press stands for in a shortcut, lowercased as menus name them ("h", "1", "+",
|
|
5
5
|
* "delete", "space"), the likeliest first.
|
package/dist/utils/slots.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { SlotAttributesOf } from "../types";
|
|
1
|
+
import type { SlotAttributesOf } from "../types/index.js";
|
|
2
2
|
/**
|
|
3
3
|
* A part's handler with the app's from `slotProps` before it (see `SlotAttributes`): the app's runs
|
|
4
4
|
* first, and the part's only when the app's didn't call `preventDefault`, as the root's handlers go.
|
|
@@ -12,4 +12,4 @@ export declare const chain: <E extends {
|
|
|
12
12
|
* The attributes of one of a part there are many of, from `slotProps`: the same for each, or what
|
|
13
13
|
* the app's function gives this one, its params made only when there's a function to hand them to.
|
|
14
14
|
*/
|
|
15
|
-
export declare const slotAttributesFor: <P>(slot: SlotAttributesOf<P> | undefined, params: () => P) => import("
|
|
15
|
+
export declare const slotAttributesFor: <P>(slot: SlotAttributesOf<P> | undefined, params: () => P) => import("../index.js").SlotAttributes | undefined;
|
package/dist/utils/sort.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { FileEntry, FileManagerLocaleText, Locale, SortKey, SortOrder } from "../types";
|
|
1
|
+
import type { FileEntry, FileManagerLocaleText, Locale, SortKey, SortOrder } from "../types/index.js";
|
|
2
2
|
type Comparator = (a: FileEntry, b: FileEntry) => number;
|
|
3
3
|
interface SortKeyLabels {
|
|
4
4
|
/** The list column's label, which the view menu uses too. */
|
package/dist/utils/transfer.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Clash, EntryClash, FileAdapter, FileEntry, MovingIds, MovingKind, MovingKinds, TransferItem, TransferKind } from "../types";
|
|
1
|
+
import type { Clash, EntryClash, FileAdapter, FileEntry, MovingIds, MovingKind, MovingKinds, TransferItem, TransferKind } from "../types/index.js";
|
|
2
2
|
/**
|
|
3
3
|
* The names of `entries`, or of files and folders being uploaded, that a folder's listing already
|
|
4
4
|
* has, which a transfer or upload into it would clash with, with what has each there, and whether
|
package/dist/utils/trash.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { FileAdapter, FileEntry, FolderRef, Section, TrashInfo, TrashResult, UndoFolder } from "../types";
|
|
1
|
+
import type { FileAdapter, FileEntry, FolderRef, Section, TrashInfo, TrashResult, UndoFolder } from "../types/index.js";
|
|
2
2
|
/** Whether the folder at `trail` is the root of a trash (`Section.trash`), where entries are restored from. */
|
|
3
3
|
export declare const inTrashRoot: (section: Section, trail: readonly FolderRef[]) => boolean;
|
|
4
4
|
/** The trash sections `served` serves, in the sidebar's order. */
|
package/dist/utils/undo.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ConflictPolicy, EntryGroup, FileAdapter, FileEntry, MadePair, Section, UndoAction, UndoDirection, UndoFolders, UndoHistory, UndoStep, WentEntry } from "../types";
|
|
1
|
+
import type { ConflictPolicy, EntryGroup, FileAdapter, FileEntry, MadePair, Section, UndoAction, UndoDirection, UndoFolders, UndoHistory, UndoStep, WentEntry } from "../types/index.js";
|
|
2
2
|
/** How many changes are kept to undo, unless `FileManagerLimits.undoSteps` says otherwise. */
|
|
3
3
|
export declare const UNDO_STEPS = 20;
|
|
4
4
|
export declare const NO_HISTORY: UndoHistory;
|
package/dist/utils/zoom.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import type { ViewMode, ViewZoom, ZoomStep } from "../types";
|
|
1
|
+
import type { ViewMode, ViewZoom, ZoomStep } from "../types/index.js";
|
|
2
2
|
export declare const DEFAULT_ZOOM: ViewZoom;
|
|
3
3
|
/** The side of a list entry's icon or thumbnail at a zoom, in rem. */
|
|
4
4
|
export declare const listIconSize: (zoom: number) => number;
|
|
5
5
|
/** The grid's icon and column sizes at a zoom, in rem. */
|
|
6
|
-
export declare const gridSize: (zoom: number) => import("../types").GridSize;
|
|
6
|
+
export declare const gridSize: (zoom: number) => import("../types/index.js").GridSize;
|
|
7
7
|
/** Whether two zooms are the same, view by view. */
|
|
8
8
|
export declare const sameZoom: (a: ViewZoom, b: ViewZoom) => boolean;
|
|
9
9
|
/** Whether a view can zoom a step in or out, or back to its start, from where it shows. */
|
package/docs/README.md
CHANGED
|
@@ -30,7 +30,7 @@ It needs React 19, and has no styling runtime: one stylesheet you import, themed
|
|
|
30
30
|
| [State and the API](state-and-api.md) | controlled props, keeping the location in the URL, `apiRef` |
|
|
31
31
|
| [Customizing](customizing.md) | theming, the two stylesheets, stable class names, slots, `slotProps`, icons |
|
|
32
32
|
| [Text, languages and right to left](locale-and-rtl.md) | `localeText`, `locale`, `dir="rtl"` |
|
|
33
|
-
| [Media manager](media-manager.md) | libraries, groups, picking, forms, processing, `MediaPicker` |
|
|
33
|
+
| [Media manager](media-manager.md) | libraries, groups, picking, moving and deleting several, dragging, forms, processing, `MediaPicker` |
|
|
34
34
|
|
|
35
35
|
## Recipes
|
|
36
36
|
|
package/docs/adapter.md
CHANGED
|
@@ -74,19 +74,22 @@ Every call takes a `signal`. Calls that change the backend (`rename`, `copy`, `d
|
|
|
74
74
|
| `rename(entry, name, { signal })` | Rename |
|
|
75
75
|
| `checkName(name, { kind, parentId, entry })` | your backend's naming rules, checked as the user types |
|
|
76
76
|
| `copy(entries, targetId, options)` | Copy to…, copy and paste, dragging with Ctrl, within this adapter |
|
|
77
|
-
| `move(entries, targetId, options)` | Move to…, cut and paste, dragging, within this adapter |
|
|
78
|
-
| `delete(entries, { signal })` | Delete, emptying the trash, moving entries out to another adapter |
|
|
77
|
+
| `move(entries, targetId, options)` | Move to…, cut and paste, dragging, within this adapter; the media manager's Move and dragging onto a group |
|
|
78
|
+
| `delete(entries, { signal, onEntryDone })` | Delete, emptying the trash, moving entries out to another adapter; the media manager's Delete, of one or several |
|
|
79
79
|
| `trash(entries, { signal })` | Move to trash, undoable |
|
|
80
80
|
| `restore(entries, { signal, conflict })` | Restore from the trash |
|
|
81
|
-
| `upload(file, folderId, options)` | uploading files and folders; taking entries in from another adapter |
|
|
81
|
+
| `upload(file, folderId, options)` | uploading files and folders; taking entries in from another adapter; resolving with an `UploadResult` says a file was already there, or went into another folder |
|
|
82
82
|
| `content(entry, { signal, purpose, onProgress })` | the preview; downloading single files; copying files out to another adapter |
|
|
83
83
|
| `download(entries, options)` | downloading folders and several entries as one file (a zip) |
|
|
84
84
|
| `downloadAcross(groups, options)` | downloading a search's results from several folders as one file |
|
|
85
85
|
| `thumbnail(entry, { signal, view, size })` | thumbnails in the list, the grid, the properties and the preview |
|
|
86
|
-
| `search(rootId, query, options)` | search everywhere (the open folder's own search needs nothing) |
|
|
86
|
+
| `search(rootId, query, options)` | search everywhere (the open folder's own search needs nothing), and a media library's search and filters |
|
|
87
87
|
| `properties(entry, { signal })` | the backend's own fields in the properties panel |
|
|
88
|
-
| `updateProperties(entry, values, { signal })` | editing those fields |
|
|
88
|
+
| `updateProperties(entry, values, { signal })` | editing those fields; without the next, the media manager's Edit fields… for several, one at a time |
|
|
89
|
+
| `updateManyProperties(entries, changes, options)` | media manager: Edit fields…, the same changes to several at once |
|
|
89
90
|
| `measure(folders, options)` | folder totals (files, folders, size, counted all the way down) |
|
|
91
|
+
| `replace(entry, file, options)` | media manager: Replace file in the asset view, a new file in an asset's place |
|
|
92
|
+
| `uploadPart(entry, part, file, options)` | media manager: uploading into an asset's parts (a subtitle, an audio track, a poster) from a property in its view |
|
|
90
93
|
| `processing`, `watchProcessing`, `process` | media manager: following and asking for processing |
|
|
91
94
|
| `createGroup`, `updateGroup` | media manager: groups made and edited from a form |
|
|
92
95
|
|
|
@@ -116,11 +119,68 @@ It runs on every keystroke, so it must be synchronous and quick. Return the mess
|
|
|
116
119
|
### `delete`
|
|
117
120
|
|
|
118
121
|
```ts
|
|
119
|
-
delete?(entries: FileEntry[], options: { signal: AbortSignal }): Promise<void>;
|
|
122
|
+
delete?(entries: FileEntry[], options: { signal: AbortSignal; onEntryDone: (entry: FileEntry) => void }): Promise<void>;
|
|
120
123
|
```
|
|
121
124
|
|
|
122
125
|
Deletes for good, folders with everything in them. The entries always share a parent, and the user has already confirmed. For a trash the user can restore from, see [Copy, move, trash and undo](copy-move-trash-undo.md#the-trash).
|
|
123
126
|
|
|
127
|
+
**Report each entry as it's deleted** with `onEntryDone(entry)`, when your backend can refuse some and delete the rest, such as an asset still in use. Then reject with an `Error` saying what was refused and why: what went is gone from the view at once, the media manager names what's left, and Delete tries only that again. Without it, a delete that failed is tried again for every entry.
|
|
128
|
+
|
|
129
|
+
```ts
|
|
130
|
+
async delete(entries, { signal, onEntryDone }) {
|
|
131
|
+
const response = await fetch("/api/files/delete", {
|
|
132
|
+
method: "POST",
|
|
133
|
+
body: JSON.stringify({ ids: entries.map((entry) => entry.id) }),
|
|
134
|
+
signal,
|
|
135
|
+
});
|
|
136
|
+
const { deleted, refused } = await response.json(); // ids deleted, and { id, reason } refused
|
|
137
|
+
|
|
138
|
+
entries.filter((entry) => deleted.includes(entry.id)).forEach(onEntryDone);
|
|
139
|
+
|
|
140
|
+
if (refused.length > 0) {
|
|
141
|
+
throw new Error(refused.map((each: { reason: string }) => each.reason).join(" "));
|
|
142
|
+
}
|
|
143
|
+
},
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
### `updateManyProperties`
|
|
147
|
+
|
|
148
|
+
```ts
|
|
149
|
+
updateManyProperties?(entries: FileEntry[], changes: PropertyChanges, options: {
|
|
150
|
+
signal: AbortSignal;
|
|
151
|
+
onEntryDone: (entry: FileEntry) => void;
|
|
152
|
+
}): Promise<void>;
|
|
153
|
+
|
|
154
|
+
interface PropertyChanges {
|
|
155
|
+
values: Record<string, unknown>; // put in place of each one's, by field; null clears
|
|
156
|
+
added: Record<string, readonly unknown[]>; // items added to each one's list
|
|
157
|
+
removed: Record<string, readonly unknown[]>; // items taken out of each one's list
|
|
158
|
+
}
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
The media manager's Edit fields… saves the same changes to several assets or groups at once through it: values put in place, and items added to and taken out of lists (`multiple` properties, such as tags), each one keeping what it holds of the rest. The entries may be in several groups, as a search's results are. A backend that saves them in one query does it here, as Laravel's `attach` and `detach` do for tags kept as a relation:
|
|
162
|
+
|
|
163
|
+
```ts
|
|
164
|
+
async updateManyProperties(entries, { values, added, removed }, { signal, onEntryDone }) {
|
|
165
|
+
const response = await fetch("/api/media/bulk", {
|
|
166
|
+
method: "PATCH",
|
|
167
|
+
body: JSON.stringify({ ids: entries.map((entry) => entry.id), values, added, removed }),
|
|
168
|
+
signal,
|
|
169
|
+
});
|
|
170
|
+
const { saved, refused } = await response.json(); // ids saved, and { id, reason } refused
|
|
171
|
+
|
|
172
|
+
entries.filter((entry) => saved.includes(entry.id)).forEach(onEntryDone);
|
|
173
|
+
|
|
174
|
+
if (refused.length > 0) {
|
|
175
|
+
throw new Error(refused.map((each: { reason: string }) => each.reason).join(" "));
|
|
176
|
+
}
|
|
177
|
+
},
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
**Report each entry as it's saved** with `onEntryDone(entry)`, and reject with an `Error` saying why for those refused: the media manager names the rest under your message, and Save tries only them again.
|
|
181
|
+
|
|
182
|
+
Without it, each entry goes through `updateProperties`, four at a time, with `values` as they are, and each list it changes as that entry's is now, read from `properties` first, with the items added and taken out. Fine for a few dozen; for hundreds, or a list kept as a relation, `updateManyProperties` saves the backend that many requests.
|
|
183
|
+
|
|
124
184
|
## Permissions
|
|
125
185
|
|
|
126
186
|
A backend says what it refuses, so the file manager doesn't offer what would only fail:
|
package/docs/customizing.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
filecove brings its own look, scoped to its roots and what they open (menus, dialogs, tooltips), and asks for no theme provider or global reset. There are five ways to change it, from lightest to heaviest:
|
|
4
4
|
|
|
5
|
-
1. **Custom properties** (`--fm-*`): colours, the corner radius, the font, the layers. Covers most needs.
|
|
5
|
+
1. **Custom properties** (`--fm-*`): colours, the corner radius, the panels' gap, the font, the layers. Covers most needs.
|
|
6
6
|
2. **Stable class names** (`fm-…`, `fmClasses`): aim CSS at a part.
|
|
7
7
|
3. **`slotProps`**: put your own attributes, such as utility classes or test ids, on a part.
|
|
8
8
|
4. **`slots`**: draw a part yourself, such as the empty folder state.
|
|
@@ -40,6 +40,8 @@ Set any `--fm-*` property on the component or anything above it, `:root` include
|
|
|
40
40
|
| `--fm-tooltip`, `--fm-tooltip-text` | tooltips |
|
|
41
41
|
| `--fm-notice`, `--fm-notice-text` | the notice over the content ("Renamed … · Undo") |
|
|
42
42
|
| `--fm-radius` | the corner radius, one step that parts take a few of |
|
|
43
|
+
| `--fm-panel-gap` | the space between the window's panels and around them (6px): the content, the docked properties, the upload, download and transfer panels, a media library and its selected column; a length with its unit, `0px` for none |
|
|
44
|
+
| `--fm-panel-radius` | those panels' corners; three steps of `--fm-radius` when left out |
|
|
43
45
|
| `--fm-font-family` | the font; the page's own when left out |
|
|
44
46
|
| `--fm-shadow-1`, `-2`, `-3`, `-6`, `-8`, `-24` | shadows, by elevation |
|
|
45
47
|
| `--fm-z-popup`, `--fm-z-tooltip` | the z-index of menus and dialogs (1300) and tooltips (1500), to fit your own layers |
|
|
@@ -64,9 +66,36 @@ Without a `color-scheme`, it's light. Your own values can use `light-dark()` too
|
|
|
64
66
|
}
|
|
65
67
|
```
|
|
66
68
|
|
|
69
|
+
### Lines instead of tone
|
|
70
|
+
|
|
71
|
+
By default the panels are inset cards on the window's background, told apart by the two tones of `--fm-background` and `--fm-surface`. For a flat look, with lines between the parts, put the panels edge to edge and square, give both tones one value, and draw the lines on the parts' stable class names:
|
|
72
|
+
|
|
73
|
+
```css
|
|
74
|
+
.admin {
|
|
75
|
+
--fm-panel-gap: 0px;
|
|
76
|
+
--fm-panel-radius: 0;
|
|
77
|
+
--fm-background: #fff;
|
|
78
|
+
--fm-surface: #fff;
|
|
79
|
+
--fm-divider: #e5e7eb;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
/* MediaManager and MediaPicker */
|
|
83
|
+
.admin .fm-media-libraries { border-inline-end: 1px solid var(--fm-divider); }
|
|
84
|
+
.admin .fm-media-header { border-bottom: 1px solid var(--fm-divider); }
|
|
85
|
+
.admin .fm-media-chosen { border-inline-start: 1px solid var(--fm-divider); }
|
|
86
|
+
.admin .fm-task-panel { border-top: 1px solid var(--fm-divider); }
|
|
87
|
+
|
|
88
|
+
/* FileManager; its properties only, as the media manager's asset view holds a properties panel too */
|
|
89
|
+
.admin .fm-sidebar { border-inline-end: 1px solid var(--fm-divider); }
|
|
90
|
+
.admin .fm-header { border-bottom: 1px solid var(--fm-divider); }
|
|
91
|
+
.admin .fm-file-manager .fm-properties { border-inline-start: 1px solid var(--fm-divider); }
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
The upload panel then runs across the bottom as a strip. Aim at the parts, not at the boxes around them, which have no stable names and may change.
|
|
95
|
+
|
|
67
96
|
### Sizing the root
|
|
68
97
|
|
|
69
|
-
The root fills its container, 100% wide and high. Give the container a height. Its layout follows its own width, not the viewport's (container queries): the sidebar docks from 900px wide, the properties panel from 1100px.
|
|
98
|
+
The root fills its container, 100% wide and high. Give the container a height. Its layout follows its own width, not the viewport's (container queries): the sidebar docks from 900px wide, the properties panel from 1100px. Those widths leave the content room for the default gap; a much larger `--fm-panel-gap` narrows the panels docked beside it sooner.
|
|
70
99
|
|
|
71
100
|
## The two stylesheets
|
|
72
101
|
|
package/docs/getting-started.md
CHANGED
|
@@ -9,7 +9,7 @@ npm install filecove
|
|
|
9
9
|
|
|
10
10
|
filecove needs **React 19** and React DOM 19, as peer dependencies. It brings `@base-ui/react` and `@react-symbols/icons` with it.
|
|
11
11
|
|
|
12
|
-
It's published as ES modules only. Its type declarations resolve with TypeScript's `moduleResolution` set to `"bundler"`, which Vite and Next.js use
|
|
12
|
+
It's published as ES modules only. Its type declarations resolve with TypeScript's `moduleResolution` set to `"bundler"`, which Vite and Next.js use, `"node16"` or `"nodenext"`.
|
|
13
13
|
|
|
14
14
|
## Import the stylesheet
|
|
15
15
|
|
|
@@ -137,6 +137,8 @@ A complete adapter over a REST API is in [recipes/rest-adapter.md](recipes/rest-
|
|
|
137
137
|
|
|
138
138
|
## Things that cost the most time
|
|
139
139
|
|
|
140
|
+
In development, the console warns about the first and last of these, and about a missing stylesheet or a root with no height. Your production build carries none of those checks.
|
|
141
|
+
|
|
140
142
|
- **Keep `adapter` stable.** Define it at module scope, or in `useMemo`. When the `adapter` prop changes to another object, every section it serves goes back to its root and its saved listings are dropped, as another adapter's ids may mean something else. A new adapter each render resets the file manager on every render.
|
|
141
143
|
- **Dates are `Date` objects.** `modifiedAt`, `createdAt` and `trashedAt` are `Date`s, not strings. Convert what your API sends.
|
|
142
144
|
- **Ids are opaque and unique within an adapter.** The file manager never parses an id, joins paths or builds one; it only hands back ids it was given. Paths work as ids, and so do database ids.
|