@atlaskit/media-file-preview 0.16.4 → 0.17.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 +17 -0
- package/dist/cjs/useFilePreview.js +5 -7
- package/dist/es2019/useFilePreview.js +5 -7
- package/dist/esm/useFilePreview.js +5 -7
- package/dist/types/useFilePreview.d.ts +3 -2
- package/dist/types/useMediaImage.d.ts +9 -7
- package/dist/types-ts4.5/useFilePreview.d.ts +3 -2
- package/dist/types-ts4.5/useMediaImage.d.ts +9 -7
- package/errors/package.json +15 -0
- package/package.json +8 -8
- package/types/package.json +15 -0
- package/use-file-preview/package.json +15 -0
- package/use-media-image/package.json +15 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
# @atlaskit/media-file-preview
|
|
2
2
|
|
|
3
|
+
## 0.17.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`818d7e656a226`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/818d7e656a226) -
|
|
8
|
+
Autofix: add explicit package exports (barrel removal)
|
|
9
|
+
|
|
10
|
+
### Patch Changes
|
|
11
|
+
|
|
12
|
+
- Updated dependencies
|
|
13
|
+
|
|
14
|
+
## 0.16.5
|
|
15
|
+
|
|
16
|
+
### Patch Changes
|
|
17
|
+
|
|
18
|
+
- Updated dependencies
|
|
19
|
+
|
|
3
20
|
## 0.16.4
|
|
4
21
|
|
|
5
22
|
### Patch Changes
|
|
@@ -304,13 +304,11 @@ var useFilePreview = exports.useFilePreview = function useFilePreview(_ref) {
|
|
|
304
304
|
// Cache ref tracking — prevent blob URL eviction while mounted
|
|
305
305
|
//----------------------------------------------------------------
|
|
306
306
|
(0, _react.useEffect)(function () {
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
}
|
|
313
|
-
}, [preview, identifier.id, resizeMode]);
|
|
307
|
+
_getPreview.mediaFilePreviewCache.acquire(identifier.id, resizeMode);
|
|
308
|
+
return function () {
|
|
309
|
+
_getPreview.mediaFilePreviewCache.release(identifier.id, resizeMode);
|
|
310
|
+
};
|
|
311
|
+
}, [identifier.id, resizeMode]);
|
|
314
312
|
|
|
315
313
|
//----------------------------------------------------------------
|
|
316
314
|
// RETURN
|
|
@@ -279,13 +279,11 @@ export const useFilePreview = ({
|
|
|
279
279
|
// Cache ref tracking — prevent blob URL eviction while mounted
|
|
280
280
|
//----------------------------------------------------------------
|
|
281
281
|
useEffect(() => {
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
}
|
|
288
|
-
}, [preview, identifier.id, resizeMode]);
|
|
282
|
+
mediaFilePreviewCache.acquire(identifier.id, resizeMode);
|
|
283
|
+
return () => {
|
|
284
|
+
mediaFilePreviewCache.release(identifier.id, resizeMode);
|
|
285
|
+
};
|
|
286
|
+
}, [identifier.id, resizeMode]);
|
|
289
287
|
|
|
290
288
|
//----------------------------------------------------------------
|
|
291
289
|
// RETURN
|
|
@@ -297,13 +297,11 @@ export var useFilePreview = function useFilePreview(_ref) {
|
|
|
297
297
|
// Cache ref tracking — prevent blob URL eviction while mounted
|
|
298
298
|
//----------------------------------------------------------------
|
|
299
299
|
useEffect(function () {
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
}
|
|
306
|
-
}, [preview, identifier.id, resizeMode]);
|
|
300
|
+
mediaFilePreviewCache.acquire(identifier.id, resizeMode);
|
|
301
|
+
return function () {
|
|
302
|
+
mediaFilePreviewCache.release(identifier.id, resizeMode);
|
|
303
|
+
};
|
|
304
|
+
}, [identifier.id, resizeMode]);
|
|
307
305
|
|
|
308
306
|
//----------------------------------------------------------------
|
|
309
307
|
// RETURN
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES, type ScriptHTMLAttributes } from 'react';
|
|
1
2
|
import { type FileIdentifier, type MediaBlobUrlAttrs, type MediaStoreGetFileImageParams } from '@atlaskit/media-client';
|
|
2
3
|
import { type MediaTraceContext, type SSR } from '@atlaskit/media-common';
|
|
3
4
|
import { type SSRStatus } from './analytics';
|
|
@@ -38,6 +39,6 @@ export declare const useFilePreview: ({ resizeMode, identifier, ssr, dimensions,
|
|
|
38
39
|
ssrReliability: SSRStatus;
|
|
39
40
|
onImageError: (failedPreview?: MediaFilePreview) => void;
|
|
40
41
|
onImageLoad: (newPreview?: MediaFilePreview) => void;
|
|
41
|
-
getSsrScriptProps: (() =>
|
|
42
|
-
copyNodeRef: (instance: HTMLDivElement | HTMLImageElement | null) => void |
|
|
42
|
+
getSsrScriptProps: (() => ScriptHTMLAttributes<HTMLScriptElement>) | undefined;
|
|
43
|
+
copyNodeRef: (instance: HTMLDivElement | HTMLImageElement | null) => void | DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES];
|
|
43
44
|
};
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
import { type ScriptHTMLAttributes } from 'react';
|
|
1
2
|
import { type FileIdentifier, type MediaBlobUrlAttrs, type MediaStoreGetFileImageParams } from '@atlaskit/media-client';
|
|
2
3
|
import { type MediaTraceContext, type SSR } from '@atlaskit/media-common';
|
|
3
|
-
import {
|
|
4
|
+
import type { MediaFilePreviewError } from './errors';
|
|
5
|
+
import { type MediaFilePreviewDimensions, type MediaFilePreviewSource, type MediaFilePreviewStatus } from './types';
|
|
4
6
|
export interface UseMediaImageParams {
|
|
5
7
|
/** Instance of file identifier. */
|
|
6
8
|
readonly identifier: FileIdentifier;
|
|
@@ -28,16 +30,16 @@ export interface UseMediaImageParams {
|
|
|
28
30
|
readonly onError?: () => void;
|
|
29
31
|
}
|
|
30
32
|
export declare const useMediaImage: ({ identifier, resizeMode, dimensions, ssr, mediaBlobUrlAttrs, traceContext, skipRemote, allowAnimated, upscale, maxAge, onLoad: onLoadCallback, onError: onErrorCallback, }: UseMediaImageParams) => {
|
|
31
|
-
status:
|
|
32
|
-
error:
|
|
33
|
+
status: MediaFilePreviewStatus;
|
|
34
|
+
error: MediaFilePreviewError | undefined;
|
|
33
35
|
getImgProps: () => {
|
|
34
36
|
src: string | undefined;
|
|
35
37
|
onLoad: () => void;
|
|
36
38
|
onError: () => void;
|
|
37
39
|
alt: string;
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
40
|
+
"data-test-file-id": string;
|
|
41
|
+
"data-test-collection": string | undefined;
|
|
42
|
+
"data-test-preview-source": MediaFilePreviewSource | undefined;
|
|
41
43
|
};
|
|
42
|
-
getSsrScriptProps: (() =>
|
|
44
|
+
getSsrScriptProps: (() => ScriptHTMLAttributes<HTMLScriptElement>) | undefined;
|
|
43
45
|
};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES, type ScriptHTMLAttributes } from 'react';
|
|
1
2
|
import { type FileIdentifier, type MediaBlobUrlAttrs, type MediaStoreGetFileImageParams } from '@atlaskit/media-client';
|
|
2
3
|
import { type MediaTraceContext, type SSR } from '@atlaskit/media-common';
|
|
3
4
|
import { type SSRStatus } from './analytics';
|
|
@@ -38,6 +39,6 @@ export declare const useFilePreview: ({ resizeMode, identifier, ssr, dimensions,
|
|
|
38
39
|
ssrReliability: SSRStatus;
|
|
39
40
|
onImageError: (failedPreview?: MediaFilePreview) => void;
|
|
40
41
|
onImageLoad: (newPreview?: MediaFilePreview) => void;
|
|
41
|
-
getSsrScriptProps: (() =>
|
|
42
|
-
copyNodeRef: (instance: HTMLDivElement | HTMLImageElement | null) => void |
|
|
42
|
+
getSsrScriptProps: (() => ScriptHTMLAttributes<HTMLScriptElement>) | undefined;
|
|
43
|
+
copyNodeRef: (instance: HTMLDivElement | HTMLImageElement | null) => void | DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES];
|
|
43
44
|
};
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
import { type ScriptHTMLAttributes } from 'react';
|
|
1
2
|
import { type FileIdentifier, type MediaBlobUrlAttrs, type MediaStoreGetFileImageParams } from '@atlaskit/media-client';
|
|
2
3
|
import { type MediaTraceContext, type SSR } from '@atlaskit/media-common';
|
|
3
|
-
import {
|
|
4
|
+
import type { MediaFilePreviewError } from './errors';
|
|
5
|
+
import { type MediaFilePreviewDimensions, type MediaFilePreviewSource, type MediaFilePreviewStatus } from './types';
|
|
4
6
|
export interface UseMediaImageParams {
|
|
5
7
|
/** Instance of file identifier. */
|
|
6
8
|
readonly identifier: FileIdentifier;
|
|
@@ -28,16 +30,16 @@ export interface UseMediaImageParams {
|
|
|
28
30
|
readonly onError?: () => void;
|
|
29
31
|
}
|
|
30
32
|
export declare const useMediaImage: ({ identifier, resizeMode, dimensions, ssr, mediaBlobUrlAttrs, traceContext, skipRemote, allowAnimated, upscale, maxAge, onLoad: onLoadCallback, onError: onErrorCallback, }: UseMediaImageParams) => {
|
|
31
|
-
status:
|
|
32
|
-
error:
|
|
33
|
+
status: MediaFilePreviewStatus;
|
|
34
|
+
error: MediaFilePreviewError | undefined;
|
|
33
35
|
getImgProps: () => {
|
|
34
36
|
src: string | undefined;
|
|
35
37
|
onLoad: () => void;
|
|
36
38
|
onError: () => void;
|
|
37
39
|
alt: string;
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
40
|
+
"data-test-file-id": string;
|
|
41
|
+
"data-test-collection": string | undefined;
|
|
42
|
+
"data-test-preview-source": MediaFilePreviewSource | undefined;
|
|
41
43
|
};
|
|
42
|
-
getSsrScriptProps: (() =>
|
|
44
|
+
getSsrScriptProps: (() => ScriptHTMLAttributes<HTMLScriptElement>) | undefined;
|
|
43
45
|
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@atlaskit/media-file-preview/errors",
|
|
3
|
+
"main": "../dist/cjs/errors.js",
|
|
4
|
+
"module": "../dist/esm/errors.js",
|
|
5
|
+
"module:es2019": "../dist/es2019/errors.js",
|
|
6
|
+
"sideEffects": false,
|
|
7
|
+
"types": "../dist/types/errors.d.ts",
|
|
8
|
+
"typesVersions": {
|
|
9
|
+
">=4.5 <5.9": {
|
|
10
|
+
"*": [
|
|
11
|
+
"../dist/types-ts4.5/errors.d.ts"
|
|
12
|
+
]
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/media-file-preview",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.17.0",
|
|
4
4
|
"description": "A React Hook to fetch and render file previews. It's overloaded with fancy features like SSR, lazy loading, memory cache and local preview.",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -31,11 +31,11 @@
|
|
|
31
31
|
"atlaskit:src": "src/index.ts",
|
|
32
32
|
"dependencies": {
|
|
33
33
|
"@atlaskit/media-client": "^36.0.0",
|
|
34
|
-
"@atlaskit/media-client-react": "^5.
|
|
35
|
-
"@atlaskit/media-common": "^13.
|
|
36
|
-
"@atlaskit/media-ui": "^
|
|
34
|
+
"@atlaskit/media-client-react": "^5.1.0",
|
|
35
|
+
"@atlaskit/media-common": "^13.1.0",
|
|
36
|
+
"@atlaskit/media-ui": "^29.1.0",
|
|
37
37
|
"@atlaskit/platform-feature-flags": "^1.1.0",
|
|
38
|
-
"@atlaskit/react-ufo": "^5.
|
|
38
|
+
"@atlaskit/react-ufo": "^5.16.0",
|
|
39
39
|
"@babel/runtime": "^7.0.0",
|
|
40
40
|
"lru_map": "^0.4.1"
|
|
41
41
|
},
|
|
@@ -46,11 +46,11 @@
|
|
|
46
46
|
"devDependencies": {
|
|
47
47
|
"@af/integration-testing": "workspace:^",
|
|
48
48
|
"@af/visual-regression": "workspace:^",
|
|
49
|
-
"@atlaskit/media-state": "^2.
|
|
50
|
-
"@atlaskit/media-test-data": "^3.
|
|
49
|
+
"@atlaskit/media-state": "^2.1.0",
|
|
50
|
+
"@atlaskit/media-test-data": "^3.3.0",
|
|
51
51
|
"@atlaskit/section-message": "^8.12.0",
|
|
52
52
|
"@atlaskit/ssr": "workspace:^",
|
|
53
|
-
"@atlassian/a11y-jest-testing": "^0.
|
|
53
|
+
"@atlassian/a11y-jest-testing": "^0.11.0",
|
|
54
54
|
"@atlassian/feature-flags-test-utils": "^1.0.0",
|
|
55
55
|
"@testing-library/react": "^16.3.0",
|
|
56
56
|
"react-dom": "^18.2.0",
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@atlaskit/media-file-preview/types",
|
|
3
|
+
"main": "../dist/cjs/types.js",
|
|
4
|
+
"module": "../dist/esm/types.js",
|
|
5
|
+
"module:es2019": "../dist/es2019/types.js",
|
|
6
|
+
"sideEffects": false,
|
|
7
|
+
"types": "../dist/types/types.d.ts",
|
|
8
|
+
"typesVersions": {
|
|
9
|
+
">=4.5 <5.9": {
|
|
10
|
+
"*": [
|
|
11
|
+
"../dist/types-ts4.5/types.d.ts"
|
|
12
|
+
]
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@atlaskit/media-file-preview/use-file-preview",
|
|
3
|
+
"main": "../dist/cjs/useFilePreview.js",
|
|
4
|
+
"module": "../dist/esm/useFilePreview.js",
|
|
5
|
+
"module:es2019": "../dist/es2019/useFilePreview.js",
|
|
6
|
+
"sideEffects": false,
|
|
7
|
+
"types": "../dist/types/useFilePreview.d.ts",
|
|
8
|
+
"typesVersions": {
|
|
9
|
+
">=4.5 <5.9": {
|
|
10
|
+
"*": [
|
|
11
|
+
"../dist/types-ts4.5/useFilePreview.d.ts"
|
|
12
|
+
]
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@atlaskit/media-file-preview/use-media-image",
|
|
3
|
+
"main": "../dist/cjs/useMediaImage.js",
|
|
4
|
+
"module": "../dist/esm/useMediaImage.js",
|
|
5
|
+
"module:es2019": "../dist/es2019/useMediaImage.js",
|
|
6
|
+
"sideEffects": false,
|
|
7
|
+
"types": "../dist/types/useMediaImage.d.ts",
|
|
8
|
+
"typesVersions": {
|
|
9
|
+
">=4.5 <5.9": {
|
|
10
|
+
"*": [
|
|
11
|
+
"../dist/types-ts4.5/useMediaImage.d.ts"
|
|
12
|
+
]
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
}
|