@atlaskit/media-file-preview 0.16.4 → 0.16.5

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 CHANGED
@@ -1,5 +1,11 @@
1
1
  # @atlaskit/media-file-preview
2
2
 
3
+ ## 0.16.5
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies
8
+
3
9
  ## 0.16.4
4
10
 
5
11
  ### 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
- if (preview) {
308
- _getPreview.mediaFilePreviewCache.acquire(identifier.id, resizeMode);
309
- return function () {
310
- _getPreview.mediaFilePreviewCache.release(identifier.id, resizeMode);
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
- if (preview) {
283
- mediaFilePreviewCache.acquire(identifier.id, resizeMode);
284
- return () => {
285
- mediaFilePreviewCache.release(identifier.id, resizeMode);
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
- if (preview) {
301
- mediaFilePreviewCache.acquire(identifier.id, resizeMode);
302
- return function () {
303
- mediaFilePreviewCache.release(identifier.id, resizeMode);
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: (() => import("react").ScriptHTMLAttributes<HTMLScriptElement>) | undefined;
42
- copyNodeRef: (instance: HTMLDivElement | HTMLImageElement | null) => void | import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES];
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 { type MediaFilePreviewDimensions } from './types';
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: import("./types").MediaFilePreviewStatus;
32
- error: import("./errors").MediaFilePreviewError | undefined;
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
- 'data-test-file-id': string;
39
- 'data-test-collection': string | undefined;
40
- 'data-test-preview-source': import("./types").MediaFilePreviewSource | undefined;
40
+ "data-test-file-id": string;
41
+ "data-test-collection": string | undefined;
42
+ "data-test-preview-source": MediaFilePreviewSource | undefined;
41
43
  };
42
- getSsrScriptProps: (() => import("react").ScriptHTMLAttributes<HTMLScriptElement>) | undefined;
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: (() => import("react").ScriptHTMLAttributes<HTMLScriptElement>) | undefined;
42
- copyNodeRef: (instance: HTMLDivElement | HTMLImageElement | null) => void | import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES];
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 { type MediaFilePreviewDimensions } from './types';
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: import("./types").MediaFilePreviewStatus;
32
- error: import("./errors").MediaFilePreviewError | undefined;
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
- 'data-test-file-id': string;
39
- 'data-test-collection': string | undefined;
40
- 'data-test-preview-source': import("./types").MediaFilePreviewSource | undefined;
40
+ "data-test-file-id": string;
41
+ "data-test-collection": string | undefined;
42
+ "data-test-preview-source": MediaFilePreviewSource | undefined;
41
43
  };
42
- getSsrScriptProps: (() => import("react").ScriptHTMLAttributes<HTMLScriptElement>) | undefined;
44
+ getSsrScriptProps: (() => ScriptHTMLAttributes<HTMLScriptElement>) | undefined;
43
45
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/media-file-preview",
3
- "version": "0.16.4",
3
+ "version": "0.16.5",
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",
@@ -33,9 +33,9 @@
33
33
  "@atlaskit/media-client": "^36.0.0",
34
34
  "@atlaskit/media-client-react": "^5.0.0",
35
35
  "@atlaskit/media-common": "^13.0.0",
36
- "@atlaskit/media-ui": "^28.7.0",
36
+ "@atlaskit/media-ui": "^29.0.0",
37
37
  "@atlaskit/platform-feature-flags": "^1.1.0",
38
- "@atlaskit/react-ufo": "^5.4.0",
38
+ "@atlaskit/react-ufo": "^5.14.0",
39
39
  "@babel/runtime": "^7.0.0",
40
40
  "lru_map": "^0.4.1"
41
41
  },
@@ -50,7 +50,7 @@
50
50
  "@atlaskit/media-test-data": "^3.2.0",
51
51
  "@atlaskit/section-message": "^8.12.0",
52
52
  "@atlaskit/ssr": "workspace:^",
53
- "@atlassian/a11y-jest-testing": "^0.10.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",