@atlaskit/media-client 26.3.0 → 27.0.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 +1044 -683
- package/dist/cjs/client/file-fetcher/index.js +2 -1
- package/dist/es2019/client/file-fetcher/index.js +2 -1
- package/dist/esm/client/file-fetcher/index.js +2 -1
- package/dist/types/client/file-fetcher/index.d.ts +11 -11
- package/dist/types-ts4.5/client/file-fetcher/index.d.ts +11 -11
- package/example-helpers/styles.ts +73 -74
- package/package.json +11 -4
- package/dist/cjs/test-helpers/MockedMediaApi/MockedMediaApi.js +0 -455
- package/dist/cjs/test-helpers/MockedMediaApi/helpers.js +0 -184
- package/dist/cjs/test-helpers/MockedMediaApi/index.js +0 -55
- package/dist/cjs/test-helpers/_numbers.js +0 -9
- package/dist/cjs/test-helpers/authProvider.js +0 -70
- package/dist/cjs/test-helpers/collectionNames.js +0 -11
- package/dist/cjs/test-helpers/exampleMediaItems.js +0 -274
- package/dist/cjs/test-helpers/fakeMediaClient.js +0 -75
- package/dist/cjs/test-helpers/index.js +0 -422
- package/dist/cjs/test-helpers/mediaClientProvider.js +0 -54
- package/dist/cjs/test-helpers/mediaPickerAuthProvider.js +0 -92
- package/dist/es2019/test-helpers/MockedMediaApi/MockedMediaApi.js +0 -166
- package/dist/es2019/test-helpers/MockedMediaApi/helpers.js +0 -167
- package/dist/es2019/test-helpers/MockedMediaApi/index.js +0 -2
- package/dist/es2019/test-helpers/_numbers.js +0 -3
- package/dist/es2019/test-helpers/authProvider.js +0 -34
- package/dist/es2019/test-helpers/collectionNames.js +0 -5
- package/dist/es2019/test-helpers/exampleMediaItems.js +0 -268
- package/dist/es2019/test-helpers/fakeMediaClient.js +0 -63
- package/dist/es2019/test-helpers/index.js +0 -8
- package/dist/es2019/test-helpers/mediaClientProvider.js +0 -42
- package/dist/es2019/test-helpers/mediaPickerAuthProvider.js +0 -56
- package/dist/esm/test-helpers/MockedMediaApi/MockedMediaApi.js +0 -448
- package/dist/esm/test-helpers/MockedMediaApi/helpers.js +0 -177
- package/dist/esm/test-helpers/MockedMediaApi/index.js +0 -2
- package/dist/esm/test-helpers/_numbers.js +0 -3
- package/dist/esm/test-helpers/authProvider.js +0 -63
- package/dist/esm/test-helpers/collectionNames.js +0 -5
- package/dist/esm/test-helpers/exampleMediaItems.js +0 -268
- package/dist/esm/test-helpers/fakeMediaClient.js +0 -69
- package/dist/esm/test-helpers/index.js +0 -8
- package/dist/esm/test-helpers/mediaClientProvider.js +0 -48
- package/dist/esm/test-helpers/mediaPickerAuthProvider.js +0 -85
- package/dist/types/test-helpers/MockedMediaApi/MockedMediaApi.d.ts +0 -16
- package/dist/types/test-helpers/MockedMediaApi/helpers.d.ts +0 -23
- package/dist/types/test-helpers/MockedMediaApi/index.d.ts +0 -3
- package/dist/types/test-helpers/_numbers.d.ts +0 -1
- package/dist/types/test-helpers/authProvider.d.ts +0 -6
- package/dist/types/test-helpers/collectionNames.d.ts +0 -5
- package/dist/types/test-helpers/exampleMediaItems.d.ts +0 -53
- package/dist/types/test-helpers/fakeMediaClient.d.ts +0 -4
- package/dist/types/test-helpers/index.d.ts +0 -9
- package/dist/types/test-helpers/mediaClientProvider.d.ts +0 -23
- package/dist/types/test-helpers/mediaPickerAuthProvider.d.ts +0 -5
- package/dist/types-ts4.5/test-helpers/MockedMediaApi/MockedMediaApi.d.ts +0 -16
- package/dist/types-ts4.5/test-helpers/MockedMediaApi/helpers.d.ts +0 -23
- package/dist/types-ts4.5/test-helpers/MockedMediaApi/index.d.ts +0 -3
- package/dist/types-ts4.5/test-helpers/_numbers.d.ts +0 -1
- package/dist/types-ts4.5/test-helpers/authProvider.d.ts +0 -6
- package/dist/types-ts4.5/test-helpers/collectionNames.d.ts +0 -5
- package/dist/types-ts4.5/test-helpers/exampleMediaItems.d.ts +0 -53
- package/dist/types-ts4.5/test-helpers/fakeMediaClient.d.ts +0 -4
- package/dist/types-ts4.5/test-helpers/index.d.ts +0 -9
- package/dist/types-ts4.5/test-helpers/mediaClientProvider.d.ts +0 -23
- package/dist/types-ts4.5/test-helpers/mediaPickerAuthProvider.d.ts +0 -5
|
@@ -48,6 +48,7 @@ var _shouldFetchRemoteFileStates = require("../../utils/shouldFetchRemoteFileSta
|
|
|
48
48
|
var _polling = require("../../utils/polling");
|
|
49
49
|
var _detectEmptyFile = require("../../utils/detectEmptyFile");
|
|
50
50
|
var _mediaState = require("@atlaskit/media-state");
|
|
51
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
51
52
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
52
53
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; } // import setimmediate to temporary fix dataloader 2.0.0 bug
|
|
53
54
|
// @see https://github.com/graphql/dataloader/issues/249
|
|
@@ -153,7 +154,7 @@ var FileFetcherImpl = exports.FileFetcherImpl = /*#__PURE__*/function () {
|
|
|
153
154
|
if (content instanceof Blob) {
|
|
154
155
|
size = content.size;
|
|
155
156
|
mimeType = content.type;
|
|
156
|
-
if ((0, _mediaTypeUtils.isMimeTypeSupportedByBrowser)(content.type)) {
|
|
157
|
+
if ((0, _mediaTypeUtils.isMimeTypeSupportedByBrowser)(content.type) || (0, _platformFeatureFlags.getBooleanFF)('platform.media-svg-rendering')) {
|
|
157
158
|
preview = {
|
|
158
159
|
value: content,
|
|
159
160
|
origin: 'local'
|
|
@@ -27,6 +27,7 @@ import { shouldFetchRemoteFileStates } from '../../utils/shouldFetchRemoteFileSt
|
|
|
27
27
|
import { PollingFunction } from '../../utils/polling';
|
|
28
28
|
import { isEmptyFile } from '../../utils/detectEmptyFile';
|
|
29
29
|
import { mediaStore } from '@atlaskit/media-state';
|
|
30
|
+
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
30
31
|
export { isFileFetcherError, FileFetcherError } from './error';
|
|
31
32
|
export class FileFetcherImpl {
|
|
32
33
|
constructor(mediaApi, store = mediaStore) {
|
|
@@ -107,7 +108,7 @@ export class FileFetcherImpl {
|
|
|
107
108
|
if (content instanceof Blob) {
|
|
108
109
|
size = content.size;
|
|
109
110
|
mimeType = content.type;
|
|
110
|
-
if (isMimeTypeSupportedByBrowser(content.type)) {
|
|
111
|
+
if (isMimeTypeSupportedByBrowser(content.type) || getBooleanFF('platform.media-svg-rendering')) {
|
|
111
112
|
preview = {
|
|
112
113
|
value: content,
|
|
113
114
|
origin: 'local'
|
|
@@ -33,6 +33,7 @@ import { shouldFetchRemoteFileStates } from '../../utils/shouldFetchRemoteFileSt
|
|
|
33
33
|
import { PollingFunction } from '../../utils/polling';
|
|
34
34
|
import { isEmptyFile } from '../../utils/detectEmptyFile';
|
|
35
35
|
import { mediaStore } from '@atlaskit/media-state';
|
|
36
|
+
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
36
37
|
export { isFileFetcherError, FileFetcherError } from './error';
|
|
37
38
|
export var FileFetcherImpl = /*#__PURE__*/function () {
|
|
38
39
|
function FileFetcherImpl(mediaApi) {
|
|
@@ -136,7 +137,7 @@ export var FileFetcherImpl = /*#__PURE__*/function () {
|
|
|
136
137
|
if (content instanceof Blob) {
|
|
137
138
|
size = content.size;
|
|
138
139
|
mimeType = content.type;
|
|
139
|
-
if (isMimeTypeSupportedByBrowser(content.type)) {
|
|
140
|
+
if (isMimeTypeSupportedByBrowser(content.type) || getBooleanFF('platform.media-svg-rendering')) {
|
|
140
141
|
preview = {
|
|
141
142
|
value: content,
|
|
142
143
|
origin: 'local'
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import 'setimmediate';
|
|
2
|
-
import { AuthProvider } from '@atlaskit/media-core';
|
|
3
|
-
import { MediaFileArtifacts } from '@atlaskit/media-state';
|
|
4
|
-
import { MediaStore as MediaApi, MediaStoreCopyFileWithTokenParams, TouchedFiles, TouchFileDescriptor } from '../media-store';
|
|
5
|
-
import { GetFileOptions } from '../../models/file-state';
|
|
6
|
-
import { MediaFile } from '../../models/media';
|
|
7
|
-
import { UploadableFile, UploadableFileUpfrontIds } from '../../uploader';
|
|
8
|
-
import { UploadController } from '../../upload-controller';
|
|
9
|
-
import { MediaSubscribable } from '../../utils/mediaSubscribable';
|
|
10
|
-
import { Dimensions } from '../../utils/getDimensionsFromBlob';
|
|
11
|
-
import { MediaTraceContext } from '@atlaskit/media-common';
|
|
12
|
-
import { FilePreview, FileState, MediaStore } from '@atlaskit/media-state';
|
|
2
|
+
import { type AuthProvider } from '@atlaskit/media-core';
|
|
3
|
+
import { type MediaFileArtifacts } from '@atlaskit/media-state';
|
|
4
|
+
import { MediaStore as MediaApi, type MediaStoreCopyFileWithTokenParams, type TouchedFiles, type TouchFileDescriptor } from '../media-store';
|
|
5
|
+
import { type GetFileOptions } from '../../models/file-state';
|
|
6
|
+
import { type MediaFile } from '../../models/media';
|
|
7
|
+
import { type UploadableFile, type UploadableFileUpfrontIds } from '../../uploader';
|
|
8
|
+
import { type UploadController } from '../../upload-controller';
|
|
9
|
+
import { type MediaSubscribable } from '../../utils/mediaSubscribable';
|
|
10
|
+
import { type Dimensions } from '../../utils/getDimensionsFromBlob';
|
|
11
|
+
import { type MediaTraceContext } from '@atlaskit/media-common';
|
|
12
|
+
import { type FilePreview, type FileState, type MediaStore } from '@atlaskit/media-state';
|
|
13
13
|
export type { FileFetcherErrorAttributes, FileFetcherErrorReason, } from './error';
|
|
14
14
|
export { isFileFetcherError, FileFetcherError } from './error';
|
|
15
15
|
export interface CopySourceFile {
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import 'setimmediate';
|
|
2
|
-
import { AuthProvider } from '@atlaskit/media-core';
|
|
3
|
-
import { MediaFileArtifacts } from '@atlaskit/media-state';
|
|
4
|
-
import { MediaStore as MediaApi, MediaStoreCopyFileWithTokenParams, TouchedFiles, TouchFileDescriptor } from '../media-store';
|
|
5
|
-
import { GetFileOptions } from '../../models/file-state';
|
|
6
|
-
import { MediaFile } from '../../models/media';
|
|
7
|
-
import { UploadableFile, UploadableFileUpfrontIds } from '../../uploader';
|
|
8
|
-
import { UploadController } from '../../upload-controller';
|
|
9
|
-
import { MediaSubscribable } from '../../utils/mediaSubscribable';
|
|
10
|
-
import { Dimensions } from '../../utils/getDimensionsFromBlob';
|
|
11
|
-
import { MediaTraceContext } from '@atlaskit/media-common';
|
|
12
|
-
import { FilePreview, FileState, MediaStore } from '@atlaskit/media-state';
|
|
2
|
+
import { type AuthProvider } from '@atlaskit/media-core';
|
|
3
|
+
import { type MediaFileArtifacts } from '@atlaskit/media-state';
|
|
4
|
+
import { MediaStore as MediaApi, type MediaStoreCopyFileWithTokenParams, type TouchedFiles, type TouchFileDescriptor } from '../media-store';
|
|
5
|
+
import { type GetFileOptions } from '../../models/file-state';
|
|
6
|
+
import { type MediaFile } from '../../models/media';
|
|
7
|
+
import { type UploadableFile, type UploadableFileUpfrontIds } from '../../uploader';
|
|
8
|
+
import { type UploadController } from '../../upload-controller';
|
|
9
|
+
import { type MediaSubscribable } from '../../utils/mediaSubscribable';
|
|
10
|
+
import { type Dimensions } from '../../utils/getDimensionsFromBlob';
|
|
11
|
+
import { type MediaTraceContext } from '@atlaskit/media-common';
|
|
12
|
+
import { type FilePreview, type FileState, type MediaStore } from '@atlaskit/media-state';
|
|
13
13
|
export type { FileFetcherErrorAttributes, FileFetcherErrorReason, } from './error';
|
|
14
14
|
export { isFileFetcherError, FileFetcherError } from './error';
|
|
15
15
|
export interface CopySourceFile {
|
|
@@ -2,27 +2,27 @@ import { token } from '@atlaskit/tokens';
|
|
|
2
2
|
import { css } from '@emotion/react';
|
|
3
3
|
import { FileStatus } from '../src';
|
|
4
4
|
|
|
5
|
-
export const wrapperStyles = css
|
|
6
|
-
display: flex
|
|
7
|
-
|
|
5
|
+
export const wrapperStyles = css({
|
|
6
|
+
display: 'flex',
|
|
7
|
+
});
|
|
8
8
|
|
|
9
|
-
export const imagePreviewStyles = css
|
|
10
|
-
width: 300px
|
|
11
|
-
|
|
9
|
+
export const imagePreviewStyles = css({
|
|
10
|
+
width: '300px',
|
|
11
|
+
});
|
|
12
12
|
|
|
13
|
-
export const previewWrapperStyles = css
|
|
14
|
-
flex: 1
|
|
15
|
-
|
|
13
|
+
export const previewWrapperStyles = css({
|
|
14
|
+
flex: 1,
|
|
15
|
+
});
|
|
16
16
|
|
|
17
|
-
export const metadataWrapperStyles = css
|
|
18
|
-
width: 400px
|
|
19
|
-
overflow: scroll
|
|
20
|
-
flex: 1
|
|
21
|
-
|
|
17
|
+
export const metadataWrapperStyles = css({
|
|
18
|
+
width: '400px',
|
|
19
|
+
overflow: 'scroll',
|
|
20
|
+
flex: 1,
|
|
21
|
+
});
|
|
22
22
|
|
|
23
|
-
export const fileInputStyles = css
|
|
24
|
-
color: transparent
|
|
25
|
-
|
|
23
|
+
export const fileInputStyles = css({
|
|
24
|
+
color: 'transparent',
|
|
25
|
+
});
|
|
26
26
|
|
|
27
27
|
export interface FilesWrapperProps {
|
|
28
28
|
status: FileStatus;
|
|
@@ -38,68 +38,67 @@ const statusColorMap: { [key in FileStatus]: string } = {
|
|
|
38
38
|
};
|
|
39
39
|
|
|
40
40
|
// eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage
|
|
41
|
-
export const fileWrapperStyles = (status: FileStatus) =>
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
41
|
+
export const fileWrapperStyles = (status: FileStatus) =>
|
|
42
|
+
css({
|
|
43
|
+
padding: '5px',
|
|
44
|
+
margin: '10px',
|
|
45
|
+
display: 'inline-block',
|
|
46
|
+
width: '315px',
|
|
47
|
+
backgroundColor: statusColorMap[status],
|
|
48
|
+
});
|
|
48
49
|
|
|
49
50
|
// eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage
|
|
50
|
-
export const cardsWrapperStyles = css
|
|
51
|
-
width: 900px
|
|
52
|
-
padding: 10px
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
}
|
|
65
|
-
`;
|
|
51
|
+
export const cardsWrapperStyles = css({
|
|
52
|
+
width: '900px',
|
|
53
|
+
padding: '10px',
|
|
54
|
+
borderRight: `1px solid ${token('color.border', '#ccc')}`,
|
|
55
|
+
h1: {
|
|
56
|
+
textAlign: 'center',
|
|
57
|
+
borderBottom: `1px solid ${token('color.border', '#ccc')}`,
|
|
58
|
+
},
|
|
59
|
+
'> div': {
|
|
60
|
+
width: 'auto',
|
|
61
|
+
display: 'inline-block',
|
|
62
|
+
margin: '10px',
|
|
63
|
+
},
|
|
64
|
+
});
|
|
66
65
|
|
|
67
66
|
// eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage
|
|
68
|
-
export const headerStyles = css
|
|
69
|
-
button {
|
|
70
|
-
margin: 5px
|
|
71
|
-
}
|
|
72
|
-
|
|
67
|
+
export const headerStyles = css({
|
|
68
|
+
button: {
|
|
69
|
+
margin: '5px',
|
|
70
|
+
},
|
|
71
|
+
});
|
|
73
72
|
|
|
74
73
|
// eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage
|
|
75
|
-
export const fileStateWrapperStyles = css
|
|
76
|
-
border: 1px solid ${token('color.border', '#ccc')}
|
|
77
|
-
margin: 10px
|
|
78
|
-
padding: 10px
|
|
79
|
-
width: 500px
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
export const uploadTouchWrapperStyles = css
|
|
83
|
-
height: 100
|
|
84
|
-
width: 100
|
|
85
|
-
display: flex
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
74
|
+
export const fileStateWrapperStyles = css({
|
|
75
|
+
border: `1px solid ${token('color.border', '#ccc')}`,
|
|
76
|
+
margin: '10px',
|
|
77
|
+
padding: '10px',
|
|
78
|
+
width: '500px',
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
export const uploadTouchWrapperStyles = css({
|
|
82
|
+
height: '100%',
|
|
83
|
+
width: '100%',
|
|
84
|
+
display: 'flex',
|
|
85
|
+
flexDirection: 'column',
|
|
86
|
+
flexWrap: 'nowrap',
|
|
87
|
+
alignItems: 'center',
|
|
88
|
+
justifyContent: 'center',
|
|
89
|
+
alignContent: 'center',
|
|
90
|
+
});
|
|
92
91
|
|
|
93
92
|
// eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage
|
|
94
|
-
export const rowStyles = css
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
> * {
|
|
98
|
-
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
export const responseStyles = css
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
93
|
+
export const rowStyles = css({
|
|
94
|
+
flexDirection: 'row',
|
|
95
|
+
justifyContent: 'center',
|
|
96
|
+
'> *': {
|
|
97
|
+
marginRight: '10px',
|
|
98
|
+
},
|
|
99
|
+
});
|
|
100
|
+
|
|
101
|
+
export const responseStyles = css({
|
|
102
|
+
fontFamily: 'monospace',
|
|
103
|
+
whiteSpace: 'pre',
|
|
104
|
+
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/media-client",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "27.0.0",
|
|
4
4
|
"description": "Media API Web Client Library",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -37,7 +37,8 @@
|
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
39
|
"@atlaskit/chunkinator": "^6.0.0",
|
|
40
|
-
"@atlaskit/media-common": "^11.
|
|
40
|
+
"@atlaskit/media-common": "^11.2.0",
|
|
41
|
+
"@atlaskit/platform-feature-flags": "0.2.5",
|
|
41
42
|
"@babel/runtime": "^7.0.0",
|
|
42
43
|
"dataloader": "^2.0.0",
|
|
43
44
|
"deep-equal": "^1.0.1",
|
|
@@ -59,8 +60,9 @@
|
|
|
59
60
|
"@atlaskit/media-core": "^34.2.0",
|
|
60
61
|
"@atlaskit/media-state": "^1.0.0",
|
|
61
62
|
"@atlaskit/ssr": "*",
|
|
62
|
-
"@atlaskit/tokens": "^1.
|
|
63
|
+
"@atlaskit/tokens": "^1.45.0",
|
|
63
64
|
"@atlassian/atlassian-frontend-prettier-config-1.0.1": "npm:@atlassian/atlassian-frontend-prettier-config@1.0.1",
|
|
65
|
+
"@atlassian/feature-flags-test-utils": "0.2.1",
|
|
64
66
|
"@emotion/react": "^11.7.1",
|
|
65
67
|
"@types/deep-equal": "^1.0.1",
|
|
66
68
|
"@types/uuid-validate": "^0.0.2",
|
|
@@ -82,5 +84,10 @@
|
|
|
82
84
|
]
|
|
83
85
|
}
|
|
84
86
|
},
|
|
85
|
-
"prettier": "@atlassian/atlassian-frontend-prettier-config-1.0.1"
|
|
87
|
+
"prettier": "@atlassian/atlassian-frontend-prettier-config-1.0.1",
|
|
88
|
+
"platform-feature-flags": {
|
|
89
|
+
"platform.media-svg-rendering": {
|
|
90
|
+
"type": "boolean"
|
|
91
|
+
}
|
|
92
|
+
}
|
|
86
93
|
}
|