@strapi/upload 5.56.0 → 5.58.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/admin/hooks/useTracking.js +2 -8
- package/dist/admin/hooks/useTracking.js.map +1 -1
- package/dist/admin/hooks/useTracking.mjs +3 -8
- package/dist/admin/hooks/useTracking.mjs.map +1 -1
- package/dist/admin/legacy/components/AssetCard/UploadingAssetCard.js +9 -1
- package/dist/admin/legacy/components/AssetCard/UploadingAssetCard.js.map +1 -1
- package/dist/admin/legacy/components/AssetCard/UploadingAssetCard.mjs +9 -1
- package/dist/admin/legacy/components/AssetCard/UploadingAssetCard.mjs.map +1 -1
- package/dist/admin/legacy/components/EditAssetDialog/PreviewBox/PreviewBox.js +20 -6
- package/dist/admin/legacy/components/EditAssetDialog/PreviewBox/PreviewBox.js.map +1 -1
- package/dist/admin/legacy/components/EditAssetDialog/PreviewBox/PreviewBox.mjs +20 -6
- package/dist/admin/legacy/components/EditAssetDialog/PreviewBox/PreviewBox.mjs.map +1 -1
- package/dist/admin/legacy/hooks/useEditAsset.js +11 -6
- package/dist/admin/legacy/hooks/useEditAsset.js.map +1 -1
- package/dist/admin/legacy/hooks/useEditAsset.mjs +12 -7
- package/dist/admin/legacy/hooks/useEditAsset.mjs.map +1 -1
- package/dist/admin/legacy/hooks/useTracking.js +3 -1
- package/dist/admin/legacy/hooks/useTracking.js.map +1 -1
- package/dist/admin/legacy/hooks/useTracking.mjs +3 -1
- package/dist/admin/legacy/hooks/useTracking.mjs.map +1 -1
- package/dist/admin/legacy/hooks/useUpload.js +6 -4
- package/dist/admin/legacy/hooks/useUpload.js.map +1 -1
- package/dist/admin/legacy/hooks/useUpload.mjs +6 -4
- package/dist/admin/legacy/hooks/useUpload.mjs.map +1 -1
- package/dist/admin/legacy/pages/App/ConfigureTheView/ConfigureTheView.js +2 -1
- package/dist/admin/legacy/pages/App/ConfigureTheView/ConfigureTheView.js.map +1 -1
- package/dist/admin/legacy/pages/App/ConfigureTheView/ConfigureTheView.mjs +2 -1
- package/dist/admin/legacy/pages/App/ConfigureTheView/ConfigureTheView.mjs.map +1 -1
- package/dist/admin/legacy/pages/App/MediaLibrary.js +2 -1
- package/dist/admin/legacy/pages/App/MediaLibrary.js.map +1 -1
- package/dist/admin/legacy/pages/App/MediaLibrary.mjs +2 -1
- package/dist/admin/legacy/pages/App/MediaLibrary.mjs.map +1 -1
- package/dist/admin/pages/Assets/AssetsPage.js +24 -12
- package/dist/admin/pages/Assets/AssetsPage.js.map +1 -1
- package/dist/admin/pages/Assets/AssetsPage.mjs +25 -13
- package/dist/admin/pages/Assets/AssetsPage.mjs.map +1 -1
- package/dist/admin/pages/Assets/components/AssetActions.js +326 -0
- package/dist/admin/pages/Assets/components/AssetActions.js.map +1 -0
- package/dist/admin/pages/Assets/components/AssetActions.mjs +324 -0
- package/dist/admin/pages/Assets/components/AssetActions.mjs.map +1 -0
- package/dist/admin/pages/Assets/components/AssetActionsMenu.js +28 -309
- package/dist/admin/pages/Assets/components/AssetActionsMenu.js.map +1 -1
- package/dist/admin/pages/Assets/components/AssetActionsMenu.mjs +31 -312
- package/dist/admin/pages/Assets/components/AssetActionsMenu.mjs.map +1 -1
- package/dist/admin/pages/Assets/components/AssetContextMenu.js +79 -0
- package/dist/admin/pages/Assets/components/AssetContextMenu.js.map +1 -0
- package/dist/admin/pages/Assets/components/AssetContextMenu.mjs +77 -0
- package/dist/admin/pages/Assets/components/AssetContextMenu.mjs.map +1 -0
- package/dist/admin/pages/Assets/components/AssetDetails/AssetCropEditor.js +87 -5
- package/dist/admin/pages/Assets/components/AssetDetails/AssetCropEditor.js.map +1 -1
- package/dist/admin/pages/Assets/components/AssetDetails/AssetCropEditor.mjs +89 -7
- package/dist/admin/pages/Assets/components/AssetDetails/AssetCropEditor.mjs.map +1 -1
- package/dist/admin/pages/Assets/components/AssetDetails/AssetDetailsDrawer.js +3 -3
- package/dist/admin/pages/Assets/components/AssetDetails/AssetDetailsDrawer.js.map +1 -1
- package/dist/admin/pages/Assets/components/AssetDetails/AssetDetailsDrawer.mjs +3 -3
- package/dist/admin/pages/Assets/components/AssetDetails/AssetDetailsDrawer.mjs.map +1 -1
- package/dist/admin/pages/Assets/components/AssetDetails/useCropImg.js +62 -5
- package/dist/admin/pages/Assets/components/AssetDetails/useCropImg.js.map +1 -1
- package/dist/admin/pages/Assets/components/AssetDetails/useCropImg.mjs +60 -6
- package/dist/admin/pages/Assets/components/AssetDetails/useCropImg.mjs.map +1 -1
- package/dist/admin/pages/Assets/components/AssetsGrid.js +27 -4
- package/dist/admin/pages/Assets/components/AssetsGrid.js.map +1 -1
- package/dist/admin/pages/Assets/components/AssetsGrid.mjs +27 -4
- package/dist/admin/pages/Assets/components/AssetsGrid.mjs.map +1 -1
- package/dist/admin/pages/Assets/components/AssetsTable.js +27 -4
- package/dist/admin/pages/Assets/components/AssetsTable.js.map +1 -1
- package/dist/admin/pages/Assets/components/AssetsTable.mjs +27 -4
- package/dist/admin/pages/Assets/components/AssetsTable.mjs.map +1 -1
- package/dist/admin/pages/Assets/components/CursorAnchoredMenu.js +77 -0
- package/dist/admin/pages/Assets/components/CursorAnchoredMenu.js.map +1 -0
- package/dist/admin/pages/Assets/components/CursorAnchoredMenu.mjs +75 -0
- package/dist/admin/pages/Assets/components/CursorAnchoredMenu.mjs.map +1 -0
- package/dist/admin/pages/Assets/components/FolderActions.js +139 -0
- package/dist/admin/pages/Assets/components/FolderActions.js.map +1 -0
- package/dist/admin/pages/Assets/components/FolderActions.mjs +137 -0
- package/dist/admin/pages/Assets/components/FolderActions.mjs.map +1 -0
- package/dist/admin/pages/Assets/components/FolderActionsMenu.js +25 -119
- package/dist/admin/pages/Assets/components/FolderActionsMenu.js.map +1 -1
- package/dist/admin/pages/Assets/components/FolderActionsMenu.mjs +27 -121
- package/dist/admin/pages/Assets/components/FolderActionsMenu.mjs.map +1 -1
- package/dist/admin/pages/Assets/components/FolderContextMenu.js +67 -0
- package/dist/admin/pages/Assets/components/FolderContextMenu.js.map +1 -0
- package/dist/admin/pages/Assets/components/FolderContextMenu.mjs +65 -0
- package/dist/admin/pages/Assets/components/FolderContextMenu.mjs.map +1 -0
- package/dist/admin/pages/Assets/components/FolderTree/FolderTree.js +139 -45
- package/dist/admin/pages/Assets/components/FolderTree/FolderTree.js.map +1 -1
- package/dist/admin/pages/Assets/components/FolderTree/FolderTree.mjs +140 -47
- package/dist/admin/pages/Assets/components/FolderTree/FolderTree.mjs.map +1 -1
- package/dist/admin/pages/Assets/components/FolderTree/FolderTreeRowMenu.js +115 -0
- package/dist/admin/pages/Assets/components/FolderTree/FolderTreeRowMenu.js.map +1 -0
- package/dist/admin/pages/Assets/components/FolderTree/FolderTreeRowMenu.mjs +113 -0
- package/dist/admin/pages/Assets/components/FolderTree/FolderTreeRowMenu.mjs.map +1 -0
- package/dist/admin/pages/Assets/components/ItemContextMenu.js +125 -0
- package/dist/admin/pages/Assets/components/ItemContextMenu.js.map +1 -0
- package/dist/admin/pages/Assets/components/ItemContextMenu.mjs +122 -0
- package/dist/admin/pages/Assets/components/ItemContextMenu.mjs.map +1 -0
- package/dist/admin/pages/Assets/components/MainAreaContextMenu.js +88 -63
- package/dist/admin/pages/Assets/components/MainAreaContextMenu.js.map +1 -1
- package/dist/admin/pages/Assets/components/MainAreaContextMenu.mjs +88 -63
- package/dist/admin/pages/Assets/components/MainAreaContextMenu.mjs.map +1 -1
- package/dist/admin/pages/Assets/components/SelectionActions.js +111 -0
- package/dist/admin/pages/Assets/components/SelectionActions.js.map +1 -0
- package/dist/admin/pages/Assets/components/SelectionActions.mjs +109 -0
- package/dist/admin/pages/Assets/components/SelectionActions.mjs.map +1 -0
- package/dist/admin/pages/Assets/components/SelectionContextMenu.js +82 -0
- package/dist/admin/pages/Assets/components/SelectionContextMenu.js.map +1 -0
- package/dist/admin/pages/Assets/components/SelectionContextMenu.mjs +80 -0
- package/dist/admin/pages/Assets/components/SelectionContextMenu.mjs.map +1 -0
- package/dist/admin/pages/Assets/hooks/useAssetSelection.js +10 -0
- package/dist/admin/pages/Assets/hooks/useAssetSelection.js.map +1 -1
- package/dist/admin/pages/Assets/hooks/useAssetSelection.mjs +10 -0
- package/dist/admin/pages/Assets/hooks/useAssetSelection.mjs.map +1 -1
- package/dist/admin/pages/SettingsPage/SettingsPage.js +8 -1
- package/dist/admin/pages/SettingsPage/SettingsPage.js.map +1 -1
- package/dist/admin/pages/SettingsPage/SettingsPage.mjs +8 -1
- package/dist/admin/pages/SettingsPage/SettingsPage.mjs.map +1 -1
- package/dist/admin/src/hooks/useTracking.d.ts +0 -7
- package/dist/admin/src/legacy/hooks/useEditAsset.d.ts +13 -22
- package/dist/admin/src/legacy/hooks/useUpload.d.ts +1 -1
- package/dist/admin/src/pages/Assets/components/AssetActions.d.ts +70 -0
- package/dist/admin/src/pages/Assets/components/AssetActionsMenu.d.ts +5 -14
- package/dist/admin/src/pages/Assets/components/AssetContextMenu.d.ts +27 -0
- package/dist/admin/src/pages/Assets/components/AssetDetails/useCropImg.d.ts +16 -0
- package/dist/admin/src/pages/Assets/components/CursorAnchoredMenu.d.ts +32 -0
- package/dist/admin/src/pages/Assets/components/FolderActions.d.ts +48 -0
- package/dist/admin/src/pages/Assets/components/FolderActionsMenu.d.ts +4 -8
- package/dist/admin/src/pages/Assets/components/FolderContextMenu.d.ts +21 -0
- package/dist/admin/src/pages/Assets/components/FolderTree/FolderTree.d.ts +5 -1
- package/dist/admin/src/pages/Assets/components/FolderTree/FolderTreeRowMenu.d.ts +25 -0
- package/dist/admin/src/pages/Assets/components/ItemContextMenu.d.ts +53 -0
- package/dist/admin/src/pages/Assets/components/MainAreaContextMenu.d.ts +15 -1
- package/dist/admin/src/pages/Assets/components/SelectionActions.d.ts +40 -0
- package/dist/admin/src/pages/Assets/components/SelectionContextMenu.d.ts +25 -0
- package/dist/admin/src/pages/Assets/hooks/useAssetSelection.d.ts +5 -0
- package/dist/admin/src/utils/mediaLibraryVersion.d.ts +18 -0
- package/dist/admin/translations/en.json.js +8 -3
- package/dist/admin/translations/en.json.js.map +1 -1
- package/dist/admin/translations/en.json.mjs +8 -3
- package/dist/admin/translations/en.json.mjs.map +1 -1
- package/dist/admin/utils/mediaLibraryVersion.js +24 -0
- package/dist/admin/utils/mediaLibraryVersion.js.map +1 -0
- package/dist/admin/utils/mediaLibraryVersion.mjs +20 -0
- package/dist/admin/utils/mediaLibraryVersion.mjs.map +1 -0
- package/dist/server/controllers/admin-file.js +2 -2
- package/dist/server/controllers/admin-file.js.map +1 -1
- package/dist/server/controllers/admin-file.mjs +2 -2
- package/dist/server/controllers/admin-file.mjs.map +1 -1
- package/dist/server/controllers/admin-folder.js +5 -5
- package/dist/server/controllers/admin-folder.js.map +1 -1
- package/dist/server/controllers/admin-folder.mjs +5 -5
- package/dist/server/controllers/admin-folder.mjs.map +1 -1
- package/dist/server/controllers/content-api.js +30 -7
- package/dist/server/controllers/content-api.js.map +1 -1
- package/dist/server/controllers/content-api.mjs +30 -7
- package/dist/server/controllers/content-api.mjs.map +1 -1
- package/dist/server/controllers/validation/admin/folder-file.js +4 -4
- package/dist/server/controllers/validation/admin/folder-file.js.map +1 -1
- package/dist/server/controllers/validation/admin/folder-file.mjs +2 -2
- package/dist/server/controllers/validation/admin/folder-file.mjs.map +1 -1
- package/dist/server/controllers/validation/admin/folder.js +3 -4
- package/dist/server/controllers/validation/admin/folder.js.map +1 -1
- package/dist/server/controllers/validation/admin/folder.mjs +3 -4
- package/dist/server/controllers/validation/admin/folder.mjs.map +1 -1
- package/dist/server/controllers/validation/admin/upload.js +1 -2
- package/dist/server/controllers/validation/admin/upload.js.map +1 -1
- package/dist/server/controllers/validation/admin/upload.mjs +1 -2
- package/dist/server/controllers/validation/admin/upload.mjs.map +1 -1
- package/dist/server/controllers/validation/admin/utils.js +1 -2
- package/dist/server/controllers/validation/admin/utils.js.map +1 -1
- package/dist/server/controllers/validation/admin/utils.mjs +1 -2
- package/dist/server/controllers/validation/admin/utils.mjs.map +1 -1
- package/dist/server/migrations/unsign-richtext-and-blocks-urls.js +2 -2
- package/dist/server/migrations/unsign-richtext-and-blocks-urls.js.map +1 -1
- package/dist/server/migrations/unsign-richtext-and-blocks-urls.mjs +1 -1
- package/dist/server/migrations/unsign-richtext-and-blocks-urls.mjs.map +1 -1
- package/dist/server/routes/content-api.js +3 -3
- package/dist/server/routes/content-api.js.map +1 -1
- package/dist/server/routes/content-api.mjs +3 -3
- package/dist/server/routes/content-api.mjs.map +1 -1
- package/dist/server/routes/validation/upload.js +8 -0
- package/dist/server/routes/validation/upload.js.map +1 -1
- package/dist/server/routes/validation/upload.mjs +8 -0
- package/dist/server/routes/validation/upload.mjs.map +1 -1
- package/dist/server/services/api-upload-folder.js +3 -3
- package/dist/server/services/api-upload-folder.js.map +1 -1
- package/dist/server/services/api-upload-folder.mjs +3 -3
- package/dist/server/services/api-upload-folder.mjs.map +1 -1
- package/dist/server/services/extensions/utils.js +20 -16
- package/dist/server/services/extensions/utils.js.map +1 -1
- package/dist/server/services/extensions/utils.mjs +20 -16
- package/dist/server/services/extensions/utils.mjs.map +1 -1
- package/dist/server/services/file.js +2 -2
- package/dist/server/services/file.js.map +1 -1
- package/dist/server/services/file.mjs +1 -1
- package/dist/server/services/file.mjs.map +1 -1
- package/dist/server/services/folder.js +5 -5
- package/dist/server/services/folder.js.map +1 -1
- package/dist/server/services/folder.mjs +5 -5
- package/dist/server/services/folder.mjs.map +1 -1
- package/dist/server/services/provider.js +3 -4
- package/dist/server/services/provider.js.map +1 -1
- package/dist/server/services/provider.mjs +3 -4
- package/dist/server/services/provider.mjs.map +1 -1
- package/dist/server/services/upload.js +5 -6
- package/dist/server/services/upload.js.map +1 -1
- package/dist/server/services/upload.mjs +4 -5
- package/dist/server/services/upload.mjs.map +1 -1
- package/dist/server/services/weekly-metrics.js +2 -2
- package/dist/server/services/weekly-metrics.js.map +1 -1
- package/dist/server/services/weekly-metrics.mjs +2 -2
- package/dist/server/services/weekly-metrics.mjs.map +1 -1
- package/dist/server/src/controllers/admin-folder.d.ts.map +1 -1
- package/dist/server/src/controllers/content-api.d.ts.map +1 -1
- package/dist/server/src/controllers/validation/admin/folder.d.ts.map +1 -1
- package/dist/server/src/controllers/validation/admin/upload.d.ts.map +1 -1
- package/dist/server/src/controllers/validation/admin/utils.d.ts.map +1 -1
- package/dist/server/src/index.d.ts.map +1 -1
- package/dist/server/src/mcp/ambient-instance.d.ts.map +1 -1
- package/dist/server/src/routes/validation/upload.d.ts +4 -0
- package/dist/server/src/routes/validation/upload.d.ts.map +1 -1
- package/dist/server/src/services/extensions/utils.d.ts +34 -2
- package/dist/server/src/services/extensions/utils.d.ts.map +1 -1
- package/dist/server/src/services/index.d.ts.map +1 -1
- package/dist/server/src/services/provider.d.ts.map +1 -1
- package/dist/server/src/services/upload.d.ts.map +1 -1
- package/dist/server/utils/mime-validation.js +1 -1
- package/dist/server/utils/mime-validation.js.map +1 -1
- package/dist/server/utils/mime-validation.mjs +1 -1
- package/dist/server/utils/mime-validation.mjs.map +1 -1
- package/package.json +7 -7
|
@@ -1,15 +1,6 @@
|
|
|
1
1
|
import { File as FileAsset } from '../../../../shared/contracts/files';
|
|
2
|
-
export type ErrorMutation = {
|
|
3
|
-
message: string;
|
|
4
|
-
response: {
|
|
5
|
-
status: number;
|
|
6
|
-
data: {
|
|
7
|
-
error: Error;
|
|
8
|
-
};
|
|
9
|
-
};
|
|
10
|
-
} | null;
|
|
11
2
|
export declare const useEditAsset: () => {
|
|
12
|
-
cancel: () => void;
|
|
3
|
+
cancel: () => void | undefined;
|
|
13
4
|
editAsset: (asset: FileAsset, file: File) => Promise<FileAsset>;
|
|
14
5
|
progress: number;
|
|
15
6
|
status: "success" | "error" | "loading" | "idle";
|
|
@@ -19,7 +10,7 @@ export declare const useEditAsset: () => {
|
|
|
19
10
|
isIdle: true;
|
|
20
11
|
isLoading: false;
|
|
21
12
|
isSuccess: false;
|
|
22
|
-
mutate: import("react-query").UseMutateFunction<FileAsset,
|
|
13
|
+
mutate: import("react-query").UseMutateFunction<FileAsset, Error, {
|
|
23
14
|
asset: FileAsset;
|
|
24
15
|
file: File;
|
|
25
16
|
}, unknown>;
|
|
@@ -31,12 +22,12 @@ export declare const useEditAsset: () => {
|
|
|
31
22
|
asset: FileAsset;
|
|
32
23
|
file: File;
|
|
33
24
|
} | undefined;
|
|
34
|
-
mutateAsync: import("react-query").UseMutateAsyncFunction<FileAsset,
|
|
25
|
+
mutateAsync: import("react-query").UseMutateAsyncFunction<FileAsset, Error, {
|
|
35
26
|
asset: FileAsset;
|
|
36
27
|
file: File;
|
|
37
28
|
}, unknown>;
|
|
38
29
|
} | {
|
|
39
|
-
cancel: () => void;
|
|
30
|
+
cancel: () => void | undefined;
|
|
40
31
|
editAsset: (asset: FileAsset, file: File) => Promise<FileAsset>;
|
|
41
32
|
progress: number;
|
|
42
33
|
status: "success" | "error" | "loading" | "idle";
|
|
@@ -46,7 +37,7 @@ export declare const useEditAsset: () => {
|
|
|
46
37
|
isIdle: false;
|
|
47
38
|
isLoading: true;
|
|
48
39
|
isSuccess: false;
|
|
49
|
-
mutate: import("react-query").UseMutateFunction<FileAsset,
|
|
40
|
+
mutate: import("react-query").UseMutateFunction<FileAsset, Error, {
|
|
50
41
|
asset: FileAsset;
|
|
51
42
|
file: File;
|
|
52
43
|
}, unknown>;
|
|
@@ -58,22 +49,22 @@ export declare const useEditAsset: () => {
|
|
|
58
49
|
asset: FileAsset;
|
|
59
50
|
file: File;
|
|
60
51
|
} | undefined;
|
|
61
|
-
mutateAsync: import("react-query").UseMutateAsyncFunction<FileAsset,
|
|
52
|
+
mutateAsync: import("react-query").UseMutateAsyncFunction<FileAsset, Error, {
|
|
62
53
|
asset: FileAsset;
|
|
63
54
|
file: File;
|
|
64
55
|
}, unknown>;
|
|
65
56
|
} | {
|
|
66
|
-
cancel: () => void;
|
|
57
|
+
cancel: () => void | undefined;
|
|
67
58
|
editAsset: (asset: FileAsset, file: File) => Promise<FileAsset>;
|
|
68
59
|
progress: number;
|
|
69
60
|
status: "success" | "error" | "loading" | "idle";
|
|
70
61
|
data: undefined;
|
|
71
|
-
error:
|
|
62
|
+
error: Error;
|
|
72
63
|
isError: true;
|
|
73
64
|
isIdle: false;
|
|
74
65
|
isLoading: false;
|
|
75
66
|
isSuccess: false;
|
|
76
|
-
mutate: import("react-query").UseMutateFunction<FileAsset,
|
|
67
|
+
mutate: import("react-query").UseMutateFunction<FileAsset, Error, {
|
|
77
68
|
asset: FileAsset;
|
|
78
69
|
file: File;
|
|
79
70
|
}, unknown>;
|
|
@@ -85,12 +76,12 @@ export declare const useEditAsset: () => {
|
|
|
85
76
|
asset: FileAsset;
|
|
86
77
|
file: File;
|
|
87
78
|
} | undefined;
|
|
88
|
-
mutateAsync: import("react-query").UseMutateAsyncFunction<FileAsset,
|
|
79
|
+
mutateAsync: import("react-query").UseMutateAsyncFunction<FileAsset, Error, {
|
|
89
80
|
asset: FileAsset;
|
|
90
81
|
file: File;
|
|
91
82
|
}, unknown>;
|
|
92
83
|
} | {
|
|
93
|
-
cancel: () => void;
|
|
84
|
+
cancel: () => void | undefined;
|
|
94
85
|
editAsset: (asset: FileAsset, file: File) => Promise<FileAsset>;
|
|
95
86
|
progress: number;
|
|
96
87
|
status: "success" | "error" | "loading" | "idle";
|
|
@@ -100,7 +91,7 @@ export declare const useEditAsset: () => {
|
|
|
100
91
|
isIdle: false;
|
|
101
92
|
isLoading: false;
|
|
102
93
|
isSuccess: true;
|
|
103
|
-
mutate: import("react-query").UseMutateFunction<FileAsset,
|
|
94
|
+
mutate: import("react-query").UseMutateFunction<FileAsset, Error, {
|
|
104
95
|
asset: FileAsset;
|
|
105
96
|
file: File;
|
|
106
97
|
}, unknown>;
|
|
@@ -112,7 +103,7 @@ export declare const useEditAsset: () => {
|
|
|
112
103
|
asset: FileAsset;
|
|
113
104
|
file: File;
|
|
114
105
|
} | undefined;
|
|
115
|
-
mutateAsync: import("react-query").UseMutateAsyncFunction<FileAsset,
|
|
106
|
+
mutateAsync: import("react-query").UseMutateAsyncFunction<FileAsset, Error, {
|
|
116
107
|
asset: FileAsset;
|
|
117
108
|
file: File;
|
|
118
109
|
}, unknown>;
|
|
@@ -7,7 +7,7 @@ interface Asset extends Omit<File, 'id' | 'hash'> {
|
|
|
7
7
|
export declare const useUpload: () => {
|
|
8
8
|
upload: (assets: Asset | Asset[], folderId: number | null) => Promise<File[]>;
|
|
9
9
|
isLoading: boolean;
|
|
10
|
-
cancel: () => void;
|
|
10
|
+
cancel: () => void | undefined;
|
|
11
11
|
error: import("@strapi/utils/dist/errors").ApplicationError<"ApplicationError", string, unknown> | import("@strapi/utils/dist/errors").ValidationError<string, unknown> | null | undefined;
|
|
12
12
|
progress: number;
|
|
13
13
|
status: "success" | "error" | "loading" | "idle";
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import type { File } from '../../../../../shared/contracts/files';
|
|
3
|
+
import type { DragFileData } from '../../../types/dnd';
|
|
4
|
+
interface AssetActionsRender {
|
|
5
|
+
/** The `Menu.Item`s, for whichever trigger is rendering them. */
|
|
6
|
+
items: ReactNode;
|
|
7
|
+
/**
|
|
8
|
+
* The replace file input and the three dialogs. Rendered outside `Menu.Root`
|
|
9
|
+
* by every caller: Radix unmounts menu content on close, and a dialog opened
|
|
10
|
+
* from a menu item has to outlive the menu that opened it.
|
|
11
|
+
*/
|
|
12
|
+
dialogs: ReactNode;
|
|
13
|
+
/**
|
|
14
|
+
* False once RBAC has settled and every action is gated away. Callers render
|
|
15
|
+
* no trigger at all in that case — an empty popup is worse than none.
|
|
16
|
+
*/
|
|
17
|
+
hasActions: boolean;
|
|
18
|
+
/**
|
|
19
|
+
* True while anything the actions own is still in play — a dialog, or the
|
|
20
|
+
* native file picker. A cursor-anchored caller is mounted only as long as it
|
|
21
|
+
* has something on screen, so it needs this to know it must stay around
|
|
22
|
+
* after the menu closes.
|
|
23
|
+
*/
|
|
24
|
+
isBusy: boolean;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* The asset actions themselves — items, dialogs and handlers — with no opinion
|
|
28
|
+
* about how the menu is opened. A render-prop rather than a hook because it
|
|
29
|
+
* produces JSX, and the repo reserves `use*.tsx` for tests.
|
|
30
|
+
*
|
|
31
|
+
* Both entry points (the row's `•••` trigger and the right-click menu anchored
|
|
32
|
+
* at the cursor) render what this returns, so neither can drift from the other:
|
|
33
|
+
* adding an action or changing a permission gate happens here, once.
|
|
34
|
+
*
|
|
35
|
+
* Replace / copy link / download duplicate what the details drawer offers as
|
|
36
|
+
* icon buttons, so the same action is one click away without opening the asset
|
|
37
|
+
* first. They are re-implemented rather than lifted out of the drawer: the
|
|
38
|
+
* drawer versions render as `IconButton`s and report through its in-drawer toast
|
|
39
|
+
* slot, neither of which fits a menu item on a row.
|
|
40
|
+
*
|
|
41
|
+
* A successful move or delete deselects this one asset and leaves the rest of
|
|
42
|
+
* the selection intact: the mutations only invalidate RTK tags, so without it an
|
|
43
|
+
* `asset:<id>` key for a file that has been deleted — or has moved out of this
|
|
44
|
+
* list — would linger.
|
|
45
|
+
*/
|
|
46
|
+
/** The subset of the RBAC answer these actions are gated on. */
|
|
47
|
+
export interface AssetActionPermissions {
|
|
48
|
+
isLoading: boolean;
|
|
49
|
+
canUpdate: boolean;
|
|
50
|
+
canDownload: boolean;
|
|
51
|
+
canCopyLink: boolean;
|
|
52
|
+
}
|
|
53
|
+
interface AssetActionsProps {
|
|
54
|
+
asset: File;
|
|
55
|
+
dragData: DragFileData;
|
|
56
|
+
/**
|
|
57
|
+
* Already-resolved permissions, for a caller that mounts on demand.
|
|
58
|
+
*
|
|
59
|
+
* `useRBAC` starts every instance at `isLoading: true` with each flag false,
|
|
60
|
+
* so a menu mounted by a right-click would render empty for a tick — an open
|
|
61
|
+
* popup with nothing in it. A caller that has been mounted all along (the
|
|
62
|
+
* context menu provider) has the answer already and passes it here. Omitted
|
|
63
|
+
* by the `•••` trigger, which is mounted with its row and has no such gap.
|
|
64
|
+
*/
|
|
65
|
+
permissions?: AssetActionPermissions;
|
|
66
|
+
/** Receives the items and dialogs to place around whichever trigger it owns. */
|
|
67
|
+
children: (actions: AssetActionsRender) => ReactNode;
|
|
68
|
+
}
|
|
69
|
+
export declare const AssetActions: ({ asset, dragData, permissions, children }: AssetActionsProps) => import("react/jsx-runtime").JSX.Element;
|
|
70
|
+
export {};
|
|
@@ -7,20 +7,11 @@ interface AssetActionsMenuProps {
|
|
|
7
7
|
}
|
|
8
8
|
/**
|
|
9
9
|
* The "..." menu on an asset row/card. Always acts on that one asset, whatever
|
|
10
|
-
* the current multi-selection is (the bulk actions bar
|
|
11
|
-
*
|
|
10
|
+
* the current multi-selection is (the bulk actions bar and the right-click menu
|
|
11
|
+
* are the selection-scoped affordances) — the file mirror of `FolderActionsMenu`.
|
|
12
12
|
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
* first. They are re-implemented rather than lifted out of the drawer: the
|
|
16
|
-
* drawer versions render as `IconButton`s and report through its in-drawer toast
|
|
17
|
-
* slot, neither of which fits a menu item on a row.
|
|
18
|
-
*
|
|
19
|
-
* A successful move or delete deselects this one asset and leaves the rest of
|
|
20
|
-
* the selection intact: the mutations only invalidate RTK tags, so without it an
|
|
21
|
-
* `asset:<id>` key for a file that has been deleted — or has moved out of this
|
|
22
|
-
* list — would linger. The other selected rows are untouched, which is the whole
|
|
23
|
-
* point of the menu being a single-item affordance.
|
|
13
|
+
* The actions themselves live in `AssetActions`, shared with
|
|
14
|
+
* `AssetContextMenu`. This component is only the trigger.
|
|
24
15
|
*/
|
|
25
|
-
export declare const AssetActionsMenu: ({ asset, dragData }: AssetActionsMenuProps) => import("react/jsx-runtime").JSX.Element
|
|
16
|
+
export declare const AssetActionsMenu: ({ asset, dragData }: AssetActionsMenuProps) => import("react/jsx-runtime").JSX.Element;
|
|
26
17
|
export {};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { type AssetActionPermissions } from './AssetActions';
|
|
2
|
+
import { type CursorPosition } from './CursorAnchoredMenu';
|
|
3
|
+
import type { File } from '../../../../../shared/contracts/files';
|
|
4
|
+
import type { DragFileData } from '../../../types/dnd';
|
|
5
|
+
interface AssetContextMenuProps {
|
|
6
|
+
asset: File;
|
|
7
|
+
dragData: DragFileData;
|
|
8
|
+
/** Resolved by the provider, so this menu never renders while RBAC loads. */
|
|
9
|
+
permissions: AssetActionPermissions;
|
|
10
|
+
position: CursorPosition;
|
|
11
|
+
returnFocusTo: HTMLElement | null;
|
|
12
|
+
/** Mounted only while it has something on screen, so the parent drops it on this. */
|
|
13
|
+
onClose: () => void;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* The right-click twin of `AssetActionsMenu`: same actions, opened at the
|
|
17
|
+
* cursor instead of from the row's `•••`. Both render what `AssetActions`
|
|
18
|
+
* gives them, so the two can't offer different things.
|
|
19
|
+
*
|
|
20
|
+
* Picking "Replace", "Move" or "Delete" closes the menu and opens a dialog in
|
|
21
|
+
* the same tick, and that dialog is rendered here — so the menu being shut and
|
|
22
|
+
* this being unmounted are two different things, tracked apart. Unmounting
|
|
23
|
+
* early would take the dialog with it, and for "Replace" the hidden file input
|
|
24
|
+
* too, which is why `isBusy` also covers the native picker.
|
|
25
|
+
*/
|
|
26
|
+
export declare const AssetContextMenu: ({ asset, dragData, permissions, position, returnFocusTo, onClose, }: AssetContextMenuProps) => import("react/jsx-runtime").JSX.Element;
|
|
27
|
+
export {};
|
|
@@ -26,6 +26,20 @@ export declare const resolveCornerResize: ({ anchorX, anchorY, point, aspectRati
|
|
|
26
26
|
};
|
|
27
27
|
aspectRatio: number | null;
|
|
28
28
|
}) => CropRect;
|
|
29
|
+
export type Rotation = 0 | 90 | 180 | 270;
|
|
30
|
+
/**
|
|
31
|
+
* Remap a crop rect through a quarter-turn. `size` is the image size *before* the
|
|
32
|
+
* turn, so the returned rect is expressed against the swapped size for 90/270.
|
|
33
|
+
* Pure: the caller swaps `naturalSize` to match.
|
|
34
|
+
*/
|
|
35
|
+
export declare const rotateCropRect: (crop: CropRect, direction: "left" | "right", size: NaturalSize) => CropRect;
|
|
36
|
+
/**
|
|
37
|
+
* The crop rect expressed against the *unrotated* source, by undoing each quarter-turn
|
|
38
|
+
* already applied. `produceFile` needs it to know which source pixels to sample.
|
|
39
|
+
*/
|
|
40
|
+
export declare const sourceCropRect: (crop: CropRect, rotation: Rotation, rotatedSize: NaturalSize) => CropRect;
|
|
41
|
+
/** Advance a rotation by one quarter-turn, wrapping at 360. */
|
|
42
|
+
export declare const nextRotation: (current: Rotation, direction: "left" | "right") => Rotation;
|
|
29
43
|
/**
|
|
30
44
|
* Custom crop state + file producer. Replaces a cropperjs-based version: the
|
|
31
45
|
* crop rectangle is stored in natural-image pixels (so it stays locked across
|
|
@@ -37,6 +51,8 @@ export declare const useCropImg: () => {
|
|
|
37
51
|
init: (image: HTMLImageElement) => void;
|
|
38
52
|
crop: CropRect;
|
|
39
53
|
naturalSize: NaturalSize;
|
|
54
|
+
rotation: Rotation;
|
|
55
|
+
rotate: (direction: "left" | "right") => void;
|
|
40
56
|
aspectRatio: number | null;
|
|
41
57
|
setCropSize: (next: Partial<Pick<CropRect, "width" | "height">>) => void;
|
|
42
58
|
setCropPosition: (next: Partial<Pick<CropRect, "x" | "y">>) => void;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
export interface CursorPosition {
|
|
3
|
+
x: number;
|
|
4
|
+
y: number;
|
|
5
|
+
}
|
|
6
|
+
interface CursorAnchoredMenuProps {
|
|
7
|
+
position: CursorPosition;
|
|
8
|
+
/**
|
|
9
|
+
* Controlled, because a caller may need the menu shut while staying mounted —
|
|
10
|
+
* picking an item that opens a dialog is exactly that case.
|
|
11
|
+
*/
|
|
12
|
+
open: boolean;
|
|
13
|
+
/** Names the menu for assistive tech — Radix points `aria-labelledby` at the anchor. */
|
|
14
|
+
label: string;
|
|
15
|
+
/** Where focus goes back on close — the element that was right-clicked. */
|
|
16
|
+
returnFocusTo?: HTMLElement | null;
|
|
17
|
+
/**
|
|
18
|
+
* Asked to close. Callers that opened a dialog from an item must defer
|
|
19
|
+
* unmounting until the dialog is done, or the dialog goes with them.
|
|
20
|
+
*/
|
|
21
|
+
onClose: () => void;
|
|
22
|
+
children: ReactNode;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* A menu opened at the cursor by a right-click, rather than from a trigger the
|
|
26
|
+
* user can see.
|
|
27
|
+
*
|
|
28
|
+
* Extracted from `MainAreaContextMenu`, which opened the background create menu
|
|
29
|
+
* this way first; the item menus reuse it so the anchoring trick exists once.
|
|
30
|
+
*/
|
|
31
|
+
export declare const CursorAnchoredMenu: ({ position, open, label, returnFocusTo, onClose, children, }: CursorAnchoredMenuProps) => import("react/jsx-runtime").JSX.Element;
|
|
32
|
+
export {};
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
import type { Folder } from '../../../../../shared/contracts/folders';
|
|
3
|
+
import type { DragFolderData } from '../../../types/dnd';
|
|
4
|
+
interface FolderActionsRender {
|
|
5
|
+
/** The `Menu.Item`s, for whichever trigger is rendering them. */
|
|
6
|
+
items: ReactNode;
|
|
7
|
+
/**
|
|
8
|
+
* The three dialogs. Rendered outside `Menu.Root` by every caller: Radix
|
|
9
|
+
* unmounts menu content on close, and a dialog opened from a menu item has to
|
|
10
|
+
* outlive the menu that opened it.
|
|
11
|
+
*/
|
|
12
|
+
dialogs: ReactNode;
|
|
13
|
+
/**
|
|
14
|
+
* True while a dialog is open. A cursor-anchored caller is mounted only as
|
|
15
|
+
* long as it has something on screen, so it needs this to know it must stay
|
|
16
|
+
* around after the menu closes.
|
|
17
|
+
*/
|
|
18
|
+
isBusy: boolean;
|
|
19
|
+
}
|
|
20
|
+
interface FolderActionsProps {
|
|
21
|
+
/** Only the id and name are read, so a tree node satisfies this too. */
|
|
22
|
+
folder: Pick<Folder, 'id' | 'name'>;
|
|
23
|
+
/** Drag data for this folder, so the move dialog validates against its real parent. */
|
|
24
|
+
dragData: DragFolderData;
|
|
25
|
+
/**
|
|
26
|
+
* Renaming is a list affordance. The folder tree offers the same menu without
|
|
27
|
+
* it, so the two entry points there stay identical to each other.
|
|
28
|
+
*/
|
|
29
|
+
showRename?: boolean;
|
|
30
|
+
/** Receives the items and dialogs to place around whichever trigger it owns. */
|
|
31
|
+
children: (actions: FolderActionsRender) => ReactNode;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* The folder actions themselves — items, dialogs and handlers — with no opinion
|
|
35
|
+
* about how the menu is opened, mirroring `AssetActions`.
|
|
36
|
+
*
|
|
37
|
+
* Both entry points (the row's `•••` trigger and the right-click menu anchored
|
|
38
|
+
* at the cursor) render what this gives them, so neither can drift from the
|
|
39
|
+
* other.
|
|
40
|
+
*
|
|
41
|
+
* A successful move or delete deselects this one folder and leaves the rest of
|
|
42
|
+
* the selection intact: they only invalidate RTK tags, so without it a
|
|
43
|
+
* `folder:<id>` key for a folder that no longer lives where the selection thinks
|
|
44
|
+
* it does would linger. A rename leaves the id valid and the folder in place, so
|
|
45
|
+
* it touches the selection not at all.
|
|
46
|
+
*/
|
|
47
|
+
export declare const FolderActions: ({ folder, dragData, showRename, children, }: FolderActionsProps) => import("react/jsx-runtime").JSX.Element;
|
|
48
|
+
export {};
|
|
@@ -7,15 +7,11 @@ interface FolderActionsMenuProps {
|
|
|
7
7
|
}
|
|
8
8
|
/**
|
|
9
9
|
* The "..." menu on a folder row/card. Always acts on that one folder, whatever
|
|
10
|
-
* the current multi-selection is (the bulk actions bar
|
|
11
|
-
*
|
|
12
|
-
* while open.
|
|
10
|
+
* the current multi-selection is (the bulk actions bar and the right-click menu
|
|
11
|
+
* are the selection-scoped affordances).
|
|
13
12
|
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
* `folder:<id>` key for a folder that no longer lives where the selection thinks
|
|
17
|
-
* it does would linger. A rename leaves the id valid and the folder in place, so
|
|
18
|
-
* it touches the selection not at all.
|
|
13
|
+
* The actions themselves live in `FolderActions`, shared with
|
|
14
|
+
* `FolderContextMenu`. This component is only the trigger.
|
|
19
15
|
*/
|
|
20
16
|
export declare const FolderActionsMenu: ({ folder, dragData }: FolderActionsMenuProps) => import("react/jsx-runtime").JSX.Element;
|
|
21
17
|
export {};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { type CursorPosition } from './CursorAnchoredMenu';
|
|
2
|
+
import type { Folder } from '../../../../../shared/contracts/folders';
|
|
3
|
+
import type { DragFolderData } from '../../../types/dnd';
|
|
4
|
+
interface FolderContextMenuProps {
|
|
5
|
+
folder: Pick<Folder, 'id' | 'name'>;
|
|
6
|
+
dragData: DragFolderData;
|
|
7
|
+
/** Passed through — the folder tree offers the menu without Rename. */
|
|
8
|
+
showRename?: boolean;
|
|
9
|
+
position: CursorPosition;
|
|
10
|
+
returnFocusTo: HTMLElement | null;
|
|
11
|
+
/** Mounted only while it has something on screen, so the parent drops it on this. */
|
|
12
|
+
onClose: () => void;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* The right-click twin of `FolderActionsMenu`: same actions, opened at the
|
|
16
|
+
* cursor. Mirrors `AssetContextMenu`, including keeping "the menu is shut" and
|
|
17
|
+
* "this is unmounted" as separate things — a dialog opened from an item is
|
|
18
|
+
* rendered here and would go with an early unmount.
|
|
19
|
+
*/
|
|
20
|
+
export declare const FolderContextMenu: ({ folder, dragData, showRename, position, returnFocusTo, onClose, }: FolderContextMenuProps) => import("react/jsx-runtime").JSX.Element;
|
|
21
|
+
export {};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
1
2
|
interface FolderTreeProps {
|
|
2
3
|
currentFolderId: number | null;
|
|
3
4
|
/**
|
|
@@ -6,7 +7,10 @@ interface FolderTreeProps {
|
|
|
6
7
|
* */
|
|
7
8
|
showActiveFolder?: boolean;
|
|
8
9
|
onSelectFolder: (folderId: number | null) => void;
|
|
10
|
+
/** Rendered inside the sidebar, which it can listen on through `FOLDER_TREE_ROOT_SELECTOR`. */
|
|
11
|
+
backgroundContextMenu?: ReactNode;
|
|
9
12
|
}
|
|
13
|
+
export declare const FOLDER_TREE_ROOT_SELECTOR = "[data-folder-tree-root]";
|
|
10
14
|
/**
|
|
11
15
|
* Left-rail navigation for the Media Library. Fetches folder structure internally
|
|
12
16
|
* and renders:
|
|
@@ -24,5 +28,5 @@ interface FolderTreeProps {
|
|
|
24
28
|
* via `onSelectFolder` so the URL stays the single source of truth (see
|
|
25
29
|
* `useFolderNavigation`).
|
|
26
30
|
*/
|
|
27
|
-
export declare const FolderTree: ({ currentFolderId, showActiveFolder, onSelectFolder, }: FolderTreeProps) => import("react/jsx-runtime").JSX.Element;
|
|
31
|
+
export declare const FolderTree: ({ currentFolderId, showActiveFolder, onSelectFolder, backgroundContextMenu, }: FolderTreeProps) => import("react/jsx-runtime").JSX.Element;
|
|
28
32
|
export {};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { CursorPosition } from '../CursorAnchoredMenu';
|
|
2
|
+
interface FolderTreeRowMenuProps {
|
|
3
|
+
folder: {
|
|
4
|
+
id: number;
|
|
5
|
+
name: string;
|
|
6
|
+
};
|
|
7
|
+
/** Its parent's id, so a move validates against where it actually lives. */
|
|
8
|
+
parentId: number | null;
|
|
9
|
+
/** Set by the row's right-click; null when the menu is closed. */
|
|
10
|
+
menuPosition: CursorPosition | null;
|
|
11
|
+
returnFocusTo: HTMLElement | null;
|
|
12
|
+
onCloseMenu: () => void;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Folder actions on a tree row, from either the `•••` or a right-click.
|
|
16
|
+
*
|
|
17
|
+
* Both render the same `FolderActions`, minus Rename — renaming is a list
|
|
18
|
+
* affordance and the tree does not offer it. Unlike the list, a tree row has no
|
|
19
|
+
* selection, so a right-click always means the row it landed on.
|
|
20
|
+
*
|
|
21
|
+
* One `FolderActions` serves both triggers here rather than two instances, so
|
|
22
|
+
* the dialogs it owns are not duplicated per row.
|
|
23
|
+
*/
|
|
24
|
+
export declare const FolderTreeRowMenu: ({ folder, parentId, menuPosition, returnFocusTo, onCloseMenu, }: FolderTreeRowMenuProps) => import("react/jsx-runtime").JSX.Element;
|
|
25
|
+
export {};
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
import type { File } from '../../../../../shared/contracts/files';
|
|
3
|
+
import type { Folder } from '../../../../../shared/contracts/folders';
|
|
4
|
+
import type { DragFileData, DragFolderData } from '../../../types/dnd';
|
|
5
|
+
import type { ItemLocations } from '../../../utils/itemLocations';
|
|
6
|
+
import type { ItemKey } from '../utils/selection';
|
|
7
|
+
/**
|
|
8
|
+
* What a card or row hands over when it is right-clicked. It passes its own
|
|
9
|
+
* asset rather than a key alone, so nothing here has to resolve keys back to
|
|
10
|
+
* items — the item is already in scope where the gesture happens.
|
|
11
|
+
*/
|
|
12
|
+
export type ContextMenuPayload = {
|
|
13
|
+
kind: 'asset';
|
|
14
|
+
asset: File;
|
|
15
|
+
dragData: DragFileData;
|
|
16
|
+
} | {
|
|
17
|
+
kind: 'folder';
|
|
18
|
+
folder: Folder;
|
|
19
|
+
dragData: DragFolderData;
|
|
20
|
+
};
|
|
21
|
+
type OpenForItem = (event: React.MouseEvent, key: ItemKey, payload: ContextMenuPayload) => void;
|
|
22
|
+
/**
|
|
23
|
+
* Called by the list items. Returns `null` outside the provider — the asset
|
|
24
|
+
* picker renders the same cards without a context menu, and a missing provider
|
|
25
|
+
* there should be a no-op rather than a crash.
|
|
26
|
+
*/
|
|
27
|
+
export declare const useItemContextMenuTrigger: () => OpenForItem | null;
|
|
28
|
+
interface ItemContextMenuProviderProps {
|
|
29
|
+
/**
|
|
30
|
+
* Real location of every loaded row, so a selection move validates each item
|
|
31
|
+
* against its own parent — same input the bulk bar takes.
|
|
32
|
+
*/
|
|
33
|
+
locations: ItemLocations;
|
|
34
|
+
children: ReactNode;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Owns the right-click menu for the list, above both the grid and the table so
|
|
38
|
+
* one instance serves either view and the selection case has the `locations` it
|
|
39
|
+
* needs.
|
|
40
|
+
*
|
|
41
|
+
* The rule, in one place:
|
|
42
|
+
*
|
|
43
|
+
* - right-clicking an item **inside a multi-selection** opens the selection
|
|
44
|
+
* menu, acting on all of it — the file-manager behaviour, and the menu leads
|
|
45
|
+
* with the count so what it acts on is stated before the actions are
|
|
46
|
+
* - **anything else** replaces the selection with the clicked item and opens
|
|
47
|
+
* that item's own menu. That includes right-clicking an unselected item while
|
|
48
|
+
* others are selected: every file manager drops the old selection there, and
|
|
49
|
+
* the visible deselection is what stops the menu looking like it applies to
|
|
50
|
+
* items it doesn't
|
|
51
|
+
*/
|
|
52
|
+
export declare const ItemContextMenuProvider: ({ locations, children }: ItemContextMenuProviderProps) => import("react/jsx-runtime").JSX.Element;
|
|
53
|
+
export {};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { ItemLocations } from '../../../utils/itemLocations';
|
|
1
2
|
interface MainAreaContextMenuProps {
|
|
2
3
|
/** Opens the "new folder" dialog in the folder currently on screen. */
|
|
3
4
|
onCreateFolder: () => void;
|
|
@@ -11,6 +12,19 @@ interface MainAreaContextMenuProps {
|
|
|
11
12
|
* permission gate can't silently regress to permissive.
|
|
12
13
|
*/
|
|
13
14
|
disabled: boolean;
|
|
15
|
+
/**
|
|
16
|
+
* The element to listen on, found from where this renders. Defaults to the
|
|
17
|
+
* scrolling main column.
|
|
18
|
+
*/
|
|
19
|
+
containerSelector?: string;
|
|
20
|
+
/**
|
|
21
|
+
* Real location of every loaded row. Supplying it turns on the selection
|
|
22
|
+
* section: with items selected, their bulk actions lead the menu, above the
|
|
23
|
+
* creation ones. Omitted, the menu offers creation only — which is what the
|
|
24
|
+
* folder tree wants, where the asset selection is not what you are pointing
|
|
25
|
+
* at.
|
|
26
|
+
*/
|
|
27
|
+
locations?: ItemLocations;
|
|
14
28
|
}
|
|
15
29
|
/**
|
|
16
30
|
* Drive/Dropbox-style right-click on the empty parts of the assets area: the
|
|
@@ -24,5 +38,5 @@ interface MainAreaContextMenuProps {
|
|
|
24
38
|
* row is left alone — those carry `data-native-context-menu` and keep the
|
|
25
39
|
* browser's menu (which is what you want over a thumbnail or a filename).
|
|
26
40
|
*/
|
|
27
|
-
export declare const MainAreaContextMenu: ({ onCreateFolder, onImportFiles, onImportFromUrl, disabled, }: MainAreaContextMenuProps) => import("react/jsx-runtime").JSX.Element;
|
|
41
|
+
export declare const MainAreaContextMenu: ({ onCreateFolder, onImportFiles, onImportFromUrl, disabled, containerSelector, locations, }: MainAreaContextMenuProps) => import("react/jsx-runtime").JSX.Element;
|
|
28
42
|
export {};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
import type { ItemLocations } from '../../../utils/itemLocations';
|
|
3
|
+
interface SelectionActionsRender {
|
|
4
|
+
/** How many items the actions would act on. Zero means nothing is selected. */
|
|
5
|
+
count: number;
|
|
6
|
+
/**
|
|
7
|
+
* Whether there is anything to offer. False for a role that can read but not
|
|
8
|
+
* update; true while the RBAC check is still settling, so a menu built on it
|
|
9
|
+
* does not flash empty.
|
|
10
|
+
*/
|
|
11
|
+
hasActions: boolean;
|
|
12
|
+
/** The count label, a separator, then Move and Delete. */
|
|
13
|
+
items: ReactNode;
|
|
14
|
+
/** Rendered outside `Menu.Root` — a dialog has to outlive the menu that opened it. */
|
|
15
|
+
dialogs: ReactNode;
|
|
16
|
+
/** True while a dialog is open, for callers that unmount once nothing is on screen. */
|
|
17
|
+
isBusy: boolean;
|
|
18
|
+
}
|
|
19
|
+
interface SelectionActionsProps {
|
|
20
|
+
/**
|
|
21
|
+
* Real location of every loaded row, so the move dialog validates each
|
|
22
|
+
* selected item against its own parent — same input the bulk bar takes.
|
|
23
|
+
*/
|
|
24
|
+
locations: ItemLocations;
|
|
25
|
+
children: (actions: SelectionActionsRender) => ReactNode;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* The actions that apply to the current selection — move and delete — with no
|
|
29
|
+
* opinion about which menu shows them.
|
|
30
|
+
*
|
|
31
|
+
* Two menus offer them: the one a right-click on a selected item opens, and the
|
|
32
|
+
* background menu, which prepends them to its own creation actions whenever
|
|
33
|
+
* something is selected. Sharing the items keeps the two from drifting, and
|
|
34
|
+
* keeps one copy of the dialogs they open.
|
|
35
|
+
*
|
|
36
|
+
* Only move and delete: the rest of an item's menu has no meaning for a set —
|
|
37
|
+
* there is no one link to copy and no one file to replace.
|
|
38
|
+
*/
|
|
39
|
+
export declare const SelectionActions: ({ locations, children }: SelectionActionsProps) => import("react/jsx-runtime").JSX.Element;
|
|
40
|
+
export {};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { type CursorPosition } from './CursorAnchoredMenu';
|
|
2
|
+
import type { ItemLocations } from '../../../utils/itemLocations';
|
|
3
|
+
interface SelectionContextMenuProps {
|
|
4
|
+
position: CursorPosition;
|
|
5
|
+
returnFocusTo: HTMLElement | null;
|
|
6
|
+
/**
|
|
7
|
+
* Real location of every loaded row, so the move dialog validates each
|
|
8
|
+
* selected item against its own parent — same input the bulk bar takes.
|
|
9
|
+
*/
|
|
10
|
+
locations: ItemLocations;
|
|
11
|
+
onClose: () => void;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Right-clicking one of several selected items acts on the selection, the way a
|
|
15
|
+
* file manager does.
|
|
16
|
+
*
|
|
17
|
+
* The count leads, so what the menu is about to act on is stated before the
|
|
18
|
+
* actions are. Right-clicking an item that is *not* in the selection replaces
|
|
19
|
+
* the selection with it first, and `AssetContextMenu` handles it instead.
|
|
20
|
+
*
|
|
21
|
+
* Right-clicking the background with a selection live is a different menu:
|
|
22
|
+
* `MainAreaContextMenu` shows these same actions above its creation ones.
|
|
23
|
+
*/
|
|
24
|
+
export declare const SelectionContextMenu: ({ position, returnFocusTo, locations, onClose, }: SelectionContextMenuProps) => import("react/jsx-runtime").JSX.Element;
|
|
25
|
+
export {};
|
|
@@ -27,6 +27,11 @@ export interface AssetSelection {
|
|
|
27
27
|
selectRange: (orderedKeys: ItemKey[], targetKey: ItemKey) => void;
|
|
28
28
|
/** Header checkbox — selects every rendered item (folders and assets). */
|
|
29
29
|
selectAll: (orderedKeys: ItemKey[]) => void;
|
|
30
|
+
/**
|
|
31
|
+
* Replaces the selection with this one key, as a right-click on an unselected
|
|
32
|
+
* item does: what the menu then acts on is what the user can see is selected.
|
|
33
|
+
*/
|
|
34
|
+
selectOnly: (key: ItemKey) => void;
|
|
30
35
|
/** Row-level "..." menu — drops one key when its item leaves the list (move, delete). */
|
|
31
36
|
deselect: (key: ItemKey) => void;
|
|
32
37
|
/** Close button / folder navigation / list-identity changes. */
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Which Media Library a project is configured to use, stamped on every event
|
|
3
|
+
* both trees fire. They emit the SAME event names, so without this there is no
|
|
4
|
+
* way to tell a project that kept the legacy library from one that did not.
|
|
5
|
+
*
|
|
6
|
+
* Read from the feature flag rather than from whichever tree fired the event,
|
|
7
|
+
* because the two do not line up. Several surfaces are registered outside the
|
|
8
|
+
* flag's branch in `index.ts` and so run under both settings — the Content
|
|
9
|
+
* Manager media field and picker are legacy code for everyone, and the Media
|
|
10
|
+
* Library settings page is current code for everyone. Tagging by tree would
|
|
11
|
+
* report a project running the current library as legacy the moment an editor
|
|
12
|
+
* attached an image to an entry, and vice versa.
|
|
13
|
+
*
|
|
14
|
+
* Bump these if a future revamp ever needs its own bucket.
|
|
15
|
+
*/
|
|
16
|
+
export declare const MEDIA_LIBRARY_VERSION_CURRENT = "v2";
|
|
17
|
+
export declare const MEDIA_LIBRARY_VERSION_LEGACY = "v1";
|
|
18
|
+
export declare const getMediaLibraryVersion: () => "v2" | "v1";
|