@wordpress/media-utils 5.40.2-next.v.202602271551.0 → 5.40.2
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/build-style/style-rtl.css +0 -13
- package/build-style/style.css +0 -13
- package/build-types/components/media-upload-modal/upload-status-popover.d.ts +15 -0
- package/build-types/components/media-upload-modal/upload-status-popover.d.ts.map +1 -0
- package/build-types/components/media-upload-modal/use-invalidate-attachment-resolutions.d.ts +22 -0
- package/build-types/components/media-upload-modal/use-invalidate-attachment-resolutions.d.ts.map +1 -0
- package/build-types/components/media-upload-modal/use-upload-status.d.ts +41 -0
- package/build-types/components/media-upload-modal/use-upload-status.d.ts.map +1 -0
- package/package.json +15 -15
|
@@ -142,19 +142,6 @@
|
|
|
142
142
|
height: 100%;
|
|
143
143
|
}
|
|
144
144
|
|
|
145
|
-
@media not (prefers-reduced-motion) {
|
|
146
|
-
.dataviews-media-field__media-thumbnail.is-loading img, .dataviews-media-field__media-thumbnail.is-loaded img {
|
|
147
|
-
transition: opacity 0.1s linear;
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
.dataviews-media-field__media-thumbnail.is-loading img {
|
|
151
|
-
opacity: 0;
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
.dataviews-media-field__media-thumbnail.is-loaded img {
|
|
155
|
-
opacity: 1;
|
|
156
|
-
}
|
|
157
|
-
|
|
158
145
|
.dataviews-media-field__media-thumbnail--image {
|
|
159
146
|
display: block;
|
|
160
147
|
width: 100%;
|
package/build-style/style.css
CHANGED
|
@@ -142,19 +142,6 @@
|
|
|
142
142
|
height: 100%;
|
|
143
143
|
}
|
|
144
144
|
|
|
145
|
-
@media not (prefers-reduced-motion) {
|
|
146
|
-
.dataviews-media-field__media-thumbnail.is-loading img, .dataviews-media-field__media-thumbnail.is-loaded img {
|
|
147
|
-
transition: opacity 0.1s linear;
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
.dataviews-media-field__media-thumbnail.is-loading img {
|
|
151
|
-
opacity: 0;
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
.dataviews-media-field__media-thumbnail.is-loaded img {
|
|
155
|
-
opacity: 1;
|
|
156
|
-
}
|
|
157
|
-
|
|
158
145
|
.dataviews-media-field__media-thumbnail--image {
|
|
159
146
|
display: block;
|
|
160
147
|
width: 100%;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export interface UploadingFile {
|
|
2
|
+
id: string;
|
|
3
|
+
batchId: string;
|
|
4
|
+
name: string;
|
|
5
|
+
status: 'uploading' | 'uploaded' | 'error';
|
|
6
|
+
error?: string;
|
|
7
|
+
}
|
|
8
|
+
interface UploadStatusPopoverProps {
|
|
9
|
+
uploadingFiles: UploadingFile[];
|
|
10
|
+
onDismissError?: (fileId: string) => void;
|
|
11
|
+
onOpenChange?: (open: boolean) => void;
|
|
12
|
+
}
|
|
13
|
+
export declare function UploadStatusPopover({ uploadingFiles, onDismissError, onOpenChange }: UploadStatusPopoverProps): import("react").JSX.Element | null;
|
|
14
|
+
export {};
|
|
15
|
+
//# sourceMappingURL=upload-status-popover.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"upload-status-popover.d.ts","sourceRoot":"","sources":["../../../src/components/media-upload-modal/upload-status-popover.tsx"],"names":[],"mappings":"AAcA,MAAM,WAAW,aAAa;IAC7B,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,WAAW,GAAG,UAAU,GAAG,OAAO,CAAC;IAC3C,KAAK,CAAC,EAAE,MAAM,CAAC;CACf;AAED,UAAU,wBAAwB;IACjC,cAAc,EAAE,aAAa,EAAE,CAAC;IAChC,cAAc,CAAC,EAAE,CAAE,MAAM,EAAE,MAAM,KAAM,IAAI,CAAC;IAC5C,YAAY,CAAC,EAAE,CAAE,IAAI,EAAE,OAAO,KAAM,IAAI,CAAC;CACzC;AAED,wBAAgB,mBAAmB,CAAE,EACpC,cAAc,EACd,cAAc,EACd,YAAY,EACZ,EAAE,wBAAwB,sCAgI1B"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Hook for invalidating all cached `getEntityRecords` resolutions for the
|
|
3
|
+
* attachment post type.
|
|
4
|
+
*
|
|
5
|
+
* After a file upload completes the media grid needs to refresh, but
|
|
6
|
+
* `invalidateResolution` only clears the exact query that is passed to it.
|
|
7
|
+
* If the user is on page 2, page 1 (where the new upload would appear) stays
|
|
8
|
+
* stale. Using `invalidateResolutionForStoreSelector` would work but is too
|
|
9
|
+
* broad — it clears every `getEntityRecords` resolution, potentially
|
|
10
|
+
* triggering unnecessary refetches for unrelated entity types.
|
|
11
|
+
*
|
|
12
|
+
* This hook provides a middle ground: it iterates over every cached
|
|
13
|
+
* resolution for `getEntityRecords` and invalidates only the entries where
|
|
14
|
+
* the first two arguments match `['postType', 'attachment']`.
|
|
15
|
+
*/
|
|
16
|
+
/**
|
|
17
|
+
* Returns a stable callback that invalidates all cached `getEntityRecords`
|
|
18
|
+
* resolutions for `postType / attachment`, leaving every other entity type
|
|
19
|
+
* untouched.
|
|
20
|
+
*/
|
|
21
|
+
export declare function useInvalidateAttachmentResolutions(): () => void;
|
|
22
|
+
//# sourceMappingURL=use-invalidate-attachment-resolutions.d.ts.map
|
package/build-types/components/media-upload-modal/use-invalidate-attachment-resolutions.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-invalidate-attachment-resolutions.d.ts","sourceRoot":"","sources":["../../../src/components/media-upload-modal/use-invalidate-attachment-resolutions.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AASH;;;;GAIG;AACH,wBAAgB,kCAAkC,eAqBjD"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Hook for tracking media upload status with batch-scoped callbacks.
|
|
3
|
+
*
|
|
4
|
+
* This is a transitional layer that manually tracks upload progress using
|
|
5
|
+
* local state. The @wordpress/upload-media package provides a Redux-based
|
|
6
|
+
* store with richer capabilities (per-file progress, pause/resume, retry,
|
|
7
|
+
* concurrency control, client-side processing). When the media upload modal
|
|
8
|
+
* adopts @wordpress/upload-media, this hook can be replaced by selectors
|
|
9
|
+
* from that store (getItems, isBatchUploaded, getItemProgress, etc.) while
|
|
10
|
+
* keeping the same return interface.
|
|
11
|
+
*/
|
|
12
|
+
/**
|
|
13
|
+
* Internal dependencies
|
|
14
|
+
*/
|
|
15
|
+
import type { Attachment } from '../../utils/types';
|
|
16
|
+
import type { UploadingFile } from './upload-status-popover';
|
|
17
|
+
interface UseUploadStatusOptions {
|
|
18
|
+
onBatchComplete?: (attachments: Partial<Attachment>[]) => void;
|
|
19
|
+
}
|
|
20
|
+
interface RegisterBatchResult {
|
|
21
|
+
onFileChange: (attachments: Partial<Attachment>[]) => void;
|
|
22
|
+
onError: (error: Error) => void;
|
|
23
|
+
}
|
|
24
|
+
interface UseUploadStatusReturn {
|
|
25
|
+
/** Current list of all tracked files. */
|
|
26
|
+
uploadingFiles: UploadingFile[];
|
|
27
|
+
/**
|
|
28
|
+
* Register a new batch of files for tracking.
|
|
29
|
+
* Returns batch-scoped onFileChange and onError callbacks.
|
|
30
|
+
*/
|
|
31
|
+
registerBatch: (files: File[]) => RegisterBatchResult;
|
|
32
|
+
/** Remove a single error entry by file id. */
|
|
33
|
+
dismissError: (fileId: string) => void;
|
|
34
|
+
/** Remove all uploaded (completed) entries from the list. */
|
|
35
|
+
clearCompleted: () => void;
|
|
36
|
+
/** True when tracked entries exist but none are still uploading. */
|
|
37
|
+
allComplete: boolean;
|
|
38
|
+
}
|
|
39
|
+
export declare function useUploadStatus({ onBatchComplete }?: UseUploadStatusOptions): UseUploadStatusReturn;
|
|
40
|
+
export {};
|
|
41
|
+
//# sourceMappingURL=use-upload-status.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-upload-status.d.ts","sourceRoot":"","sources":["../../../src/components/media-upload-modal/use-upload-status.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAQH;;GAEG;AACH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAEpD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAK7D,UAAU,sBAAsB;IAC/B,eAAe,CAAC,EAAE,CAAE,WAAW,EAAE,OAAO,CAAE,UAAU,CAAE,EAAE,KAAM,IAAI,CAAC;CACnE;AAED,UAAU,mBAAmB;IAC5B,YAAY,EAAE,CAAE,WAAW,EAAE,OAAO,CAAE,UAAU,CAAE,EAAE,KAAM,IAAI,CAAC;IAC/D,OAAO,EAAE,CAAE,KAAK,EAAE,KAAK,KAAM,IAAI,CAAC;CAClC;AAED,UAAU,qBAAqB;IAC9B,yCAAyC;IACzC,cAAc,EAAE,aAAa,EAAE,CAAC;IAChC;;;OAGG;IACH,aAAa,EAAE,CAAE,KAAK,EAAE,IAAI,EAAE,KAAM,mBAAmB,CAAC;IACxD,8CAA8C;IAC9C,YAAY,EAAE,CAAE,MAAM,EAAE,MAAM,KAAM,IAAI,CAAC;IACzC,6DAA6D;IAC7D,cAAc,EAAE,MAAM,IAAI,CAAC;IAC3B,oEAAoE;IACpE,WAAW,EAAE,OAAO,CAAC;CACrB;AAED,wBAAgB,eAAe,CAAE,EAChC,eAAe,EACf,GAAE,sBAA2B,GAAI,qBAAqB,CAmJtD"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wordpress/media-utils",
|
|
3
|
-
"version": "5.40.2
|
|
3
|
+
"version": "5.40.2",
|
|
4
4
|
"description": "WordPress Media Upload Utils.",
|
|
5
5
|
"author": "The WordPress Contributors",
|
|
6
6
|
"license": "GPL-2.0-or-later",
|
|
@@ -47,19 +47,19 @@
|
|
|
47
47
|
"build-style/**"
|
|
48
48
|
],
|
|
49
49
|
"dependencies": {
|
|
50
|
-
"@wordpress/api-fetch": "^7.40.1
|
|
51
|
-
"@wordpress/base-styles": "^6.16.1
|
|
52
|
-
"@wordpress/blob": "^4.40.1
|
|
53
|
-
"@wordpress/components": "^32.
|
|
54
|
-
"@wordpress/core-data": "^7.40.2
|
|
55
|
-
"@wordpress/data": "^10.40.1
|
|
56
|
-
"@wordpress/dataviews": "^12.
|
|
57
|
-
"@wordpress/element": "^6.40.1
|
|
58
|
-
"@wordpress/i18n": "^6.13.1
|
|
59
|
-
"@wordpress/icons": "^11.7.1
|
|
60
|
-
"@wordpress/media-fields": "^0.5.2
|
|
61
|
-
"@wordpress/notices": "^5.40.1
|
|
62
|
-
"@wordpress/private-apis": "^1.40.1
|
|
50
|
+
"@wordpress/api-fetch": "^7.40.1",
|
|
51
|
+
"@wordpress/base-styles": "^6.16.1",
|
|
52
|
+
"@wordpress/blob": "^4.40.1",
|
|
53
|
+
"@wordpress/components": "^32.2.1",
|
|
54
|
+
"@wordpress/core-data": "^7.40.2",
|
|
55
|
+
"@wordpress/data": "^10.40.1",
|
|
56
|
+
"@wordpress/dataviews": "^12.0.1",
|
|
57
|
+
"@wordpress/element": "^6.40.1",
|
|
58
|
+
"@wordpress/i18n": "^6.13.1",
|
|
59
|
+
"@wordpress/icons": "^11.7.1",
|
|
60
|
+
"@wordpress/media-fields": "^0.5.2",
|
|
61
|
+
"@wordpress/notices": "^5.40.1",
|
|
62
|
+
"@wordpress/private-apis": "^1.40.1"
|
|
63
63
|
},
|
|
64
64
|
"peerDependencies": {
|
|
65
65
|
"react": "^18.0.0"
|
|
@@ -67,5 +67,5 @@
|
|
|
67
67
|
"publishConfig": {
|
|
68
68
|
"access": "public"
|
|
69
69
|
},
|
|
70
|
-
"gitHead": "
|
|
70
|
+
"gitHead": "adb6623c9f32490cfc73c7ac7f122578c1f10c65"
|
|
71
71
|
}
|