@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.
Files changed (63) hide show
  1. package/CHANGELOG.md +1044 -683
  2. package/dist/cjs/client/file-fetcher/index.js +2 -1
  3. package/dist/es2019/client/file-fetcher/index.js +2 -1
  4. package/dist/esm/client/file-fetcher/index.js +2 -1
  5. package/dist/types/client/file-fetcher/index.d.ts +11 -11
  6. package/dist/types-ts4.5/client/file-fetcher/index.d.ts +11 -11
  7. package/example-helpers/styles.ts +73 -74
  8. package/package.json +11 -4
  9. package/dist/cjs/test-helpers/MockedMediaApi/MockedMediaApi.js +0 -455
  10. package/dist/cjs/test-helpers/MockedMediaApi/helpers.js +0 -184
  11. package/dist/cjs/test-helpers/MockedMediaApi/index.js +0 -55
  12. package/dist/cjs/test-helpers/_numbers.js +0 -9
  13. package/dist/cjs/test-helpers/authProvider.js +0 -70
  14. package/dist/cjs/test-helpers/collectionNames.js +0 -11
  15. package/dist/cjs/test-helpers/exampleMediaItems.js +0 -274
  16. package/dist/cjs/test-helpers/fakeMediaClient.js +0 -75
  17. package/dist/cjs/test-helpers/index.js +0 -422
  18. package/dist/cjs/test-helpers/mediaClientProvider.js +0 -54
  19. package/dist/cjs/test-helpers/mediaPickerAuthProvider.js +0 -92
  20. package/dist/es2019/test-helpers/MockedMediaApi/MockedMediaApi.js +0 -166
  21. package/dist/es2019/test-helpers/MockedMediaApi/helpers.js +0 -167
  22. package/dist/es2019/test-helpers/MockedMediaApi/index.js +0 -2
  23. package/dist/es2019/test-helpers/_numbers.js +0 -3
  24. package/dist/es2019/test-helpers/authProvider.js +0 -34
  25. package/dist/es2019/test-helpers/collectionNames.js +0 -5
  26. package/dist/es2019/test-helpers/exampleMediaItems.js +0 -268
  27. package/dist/es2019/test-helpers/fakeMediaClient.js +0 -63
  28. package/dist/es2019/test-helpers/index.js +0 -8
  29. package/dist/es2019/test-helpers/mediaClientProvider.js +0 -42
  30. package/dist/es2019/test-helpers/mediaPickerAuthProvider.js +0 -56
  31. package/dist/esm/test-helpers/MockedMediaApi/MockedMediaApi.js +0 -448
  32. package/dist/esm/test-helpers/MockedMediaApi/helpers.js +0 -177
  33. package/dist/esm/test-helpers/MockedMediaApi/index.js +0 -2
  34. package/dist/esm/test-helpers/_numbers.js +0 -3
  35. package/dist/esm/test-helpers/authProvider.js +0 -63
  36. package/dist/esm/test-helpers/collectionNames.js +0 -5
  37. package/dist/esm/test-helpers/exampleMediaItems.js +0 -268
  38. package/dist/esm/test-helpers/fakeMediaClient.js +0 -69
  39. package/dist/esm/test-helpers/index.js +0 -8
  40. package/dist/esm/test-helpers/mediaClientProvider.js +0 -48
  41. package/dist/esm/test-helpers/mediaPickerAuthProvider.js +0 -85
  42. package/dist/types/test-helpers/MockedMediaApi/MockedMediaApi.d.ts +0 -16
  43. package/dist/types/test-helpers/MockedMediaApi/helpers.d.ts +0 -23
  44. package/dist/types/test-helpers/MockedMediaApi/index.d.ts +0 -3
  45. package/dist/types/test-helpers/_numbers.d.ts +0 -1
  46. package/dist/types/test-helpers/authProvider.d.ts +0 -6
  47. package/dist/types/test-helpers/collectionNames.d.ts +0 -5
  48. package/dist/types/test-helpers/exampleMediaItems.d.ts +0 -53
  49. package/dist/types/test-helpers/fakeMediaClient.d.ts +0 -4
  50. package/dist/types/test-helpers/index.d.ts +0 -9
  51. package/dist/types/test-helpers/mediaClientProvider.d.ts +0 -23
  52. package/dist/types/test-helpers/mediaPickerAuthProvider.d.ts +0 -5
  53. package/dist/types-ts4.5/test-helpers/MockedMediaApi/MockedMediaApi.d.ts +0 -16
  54. package/dist/types-ts4.5/test-helpers/MockedMediaApi/helpers.d.ts +0 -23
  55. package/dist/types-ts4.5/test-helpers/MockedMediaApi/index.d.ts +0 -3
  56. package/dist/types-ts4.5/test-helpers/_numbers.d.ts +0 -1
  57. package/dist/types-ts4.5/test-helpers/authProvider.d.ts +0 -6
  58. package/dist/types-ts4.5/test-helpers/collectionNames.d.ts +0 -5
  59. package/dist/types-ts4.5/test-helpers/exampleMediaItems.d.ts +0 -53
  60. package/dist/types-ts4.5/test-helpers/fakeMediaClient.d.ts +0 -4
  61. package/dist/types-ts4.5/test-helpers/index.d.ts +0 -9
  62. package/dist/types-ts4.5/test-helpers/mediaClientProvider.d.ts +0 -23
  63. 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) => css`
42
- padding: 5px;
43
- margin: 10px;
44
- display: inline-block;
45
- width: 315px;
46
- background-color: ${statusColorMap[status]};
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
- border-right: 1px solid ${token('color.border', '#ccc')};
54
-
55
- h1 {
56
- text-align: center;
57
- border-bottom: 1px solid ${token('color.border', '#ccc')};
58
- }
59
-
60
- > div {
61
- width: auto;
62
- display: inline-block;
63
- margin: 10px;
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
- flex-direction: column;
87
- flex-wrap: nowrap;
88
- align-items: center;
89
- justify-content: center;
90
- align-content: center;
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
- flex-direction: row;
96
- justify-content: center;
97
- > * {
98
- margin-right: 10px;
99
- }
100
- `;
101
-
102
- export const responseStyles = css`
103
- font-family: monospace;
104
- white-space: pre;
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": "26.3.0",
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.1.0",
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.43.0",
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
  }