@atlaskit/media-viewer 53.1.1 → 53.2.1

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,28 @@
1
1
  # @atlaskit/media-viewer
2
2
 
3
+ ## 53.2.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [`2fe9a9909d2ac`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/2fe9a9909d2ac) -
8
+ Enrol media packages into the React Compiler with platform gating via
9
+ isReactCompilerActivePlatform
10
+ - Updated dependencies
11
+
12
+ ## 53.2.0
13
+
14
+ ### Minor Changes
15
+
16
+ - [`34c40eb233aa4`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/34c40eb233aa4) -
17
+ isUxChange: true
18
+
19
+ Lazy-append document pages for MS Excel previews behind platform_media_excel_lazy_load gate to fix
20
+ initial-render freeze on very large documents
21
+
22
+ ### Patch Changes
23
+
24
+ - Updated dependencies
25
+
3
26
  ## 53.1.1
4
27
 
5
28
  ### Patch Changes
@@ -17,11 +17,13 @@ var _react = _interopRequireWildcard(require("react"));
17
17
  var _mediaClient = require("@atlaskit/media-client");
18
18
  var _mediaDocumentViewer = require("@atlaskit/media-document-viewer");
19
19
  var _mediaCommon = require("@atlaskit/media-common");
20
+ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
20
21
  var _errors = require("../../errors");
21
22
  var _zoomControls = require("../../zoomControls");
22
23
  var _zoomLevel = require("../../domain/zoomLevel");
23
24
  var _passwordInput = require("./passwordInput");
24
25
  var _spinner = _interopRequireDefault(require("@atlaskit/spinner"));
26
+ var _mediaTypeUtils = require("@atlaskit/media-common/mediaTypeUtils");
25
27
  function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
26
28
  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; }
27
29
  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; }
@@ -66,6 +68,7 @@ var reducer = function reducer(state, action) {
66
68
  var documentViewerStyles = null;
67
69
  var spinnerStyles = null;
68
70
  var DocViewer = exports.DocViewer = function DocViewer(_ref) {
71
+ var _fileState$mimeType;
69
72
  var mediaClient = _ref.mediaClient,
70
73
  fileState = _ref.fileState,
71
74
  collectionName = _ref.collectionName,
@@ -76,6 +79,11 @@ var DocViewer = exports.DocViewer = function DocViewer(_ref) {
76
79
  _useReducer2 = (0, _slicedToArray2.default)(_useReducer, 2),
77
80
  state = _useReducer2[0],
78
81
  dispatch = _useReducer2[1];
82
+
83
+ // Compute enableLazyPageRendering based on Excel file detection and feature gate
84
+ // Excel files are found to have 60K pages, because excel can have thousand of empty rows, JST-1296681
85
+ var isExcel = fileState.status !== 'error' && (0, _mediaTypeUtils.isExcelFile)((_fileState$mimeType = fileState.mimeType) !== null && _fileState$mimeType !== void 0 ? _fileState$mimeType : '');
86
+ var enableLazyPageRendering = isExcel && (0, _platformFeatureFlags.fg)('platform_media_excel_lazy_load');
79
87
  var getContent = (0, _mediaCommon.useStaticCallback)( /*#__PURE__*/function () {
80
88
  var _ref2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(pageStart, pageEnd) {
81
89
  return _regenerator.default.wrap(function _callee$(_context) {
@@ -214,7 +222,8 @@ var DocViewer = exports.DocViewer = function DocViewer(_ref) {
214
222
  getContent: getContent,
215
223
  getPageImageUrl: getPageImageUrl,
216
224
  zoom: state.zoomLevel.value,
217
- onSuccess: onSuccessHandler
225
+ onSuccess: onSuccessHandler,
226
+ enableLazyPageRendering: enableLazyPageRendering
218
227
  }), /*#__PURE__*/_react.default.createElement(_zoomControls.ZoomControls, {
219
228
  onChange: onZoomChange,
220
229
  zoomLevel: state.zoomLevel
@@ -5,11 +5,13 @@ import React, { useReducer } from 'react';
5
5
  import { isCommonMediaClientError } from '@atlaskit/media-client';
6
6
  import { DOCUMENT_SCROLL_ROOT_ID, DocumentViewer } from '@atlaskit/media-document-viewer';
7
7
  import { useStaticCallback } from '@atlaskit/media-common';
8
+ import { fg } from '@atlaskit/platform-feature-flags';
8
9
  import { MediaViewerError } from '../../errors';
9
10
  import { ZoomControls } from '../../zoomControls';
10
11
  import { ZoomLevel } from '../../domain/zoomLevel';
11
12
  import { PasswordInput } from './passwordInput';
12
13
  import Spinner from '@atlaskit/spinner';
14
+ import { isExcelFile } from '@atlaskit/media-common/mediaTypeUtils';
13
15
  const initialState = {
14
16
  isMissingPassword: false,
15
17
  hasPasswordError: false,
@@ -64,7 +66,13 @@ export const DocViewer = ({
64
66
  onSuccess,
65
67
  traceContext
66
68
  }) => {
69
+ var _fileState$mimeType;
67
70
  const [state, dispatch] = useReducer(reducer, initialState);
71
+
72
+ // Compute enableLazyPageRendering based on Excel file detection and feature gate
73
+ // Excel files are found to have 60K pages, because excel can have thousand of empty rows, JST-1296681
74
+ const isExcel = fileState.status !== 'error' && isExcelFile((_fileState$mimeType = fileState.mimeType) !== null && _fileState$mimeType !== void 0 ? _fileState$mimeType : '');
75
+ const enableLazyPageRendering = isExcel && fg('platform_media_excel_lazy_load');
68
76
  const getContent = useStaticCallback(async (pageStart, pageEnd) => {
69
77
  try {
70
78
  return await mediaClient.mediaStore.getDocumentContent(fileState.id, {
@@ -152,7 +160,8 @@ export const DocViewer = ({
152
160
  getContent: getContent,
153
161
  getPageImageUrl: getPageImageUrl,
154
162
  zoom: state.zoomLevel.value,
155
- onSuccess: onSuccessHandler
163
+ onSuccess: onSuccessHandler,
164
+ enableLazyPageRendering: enableLazyPageRendering
156
165
  }), /*#__PURE__*/React.createElement(ZoomControls, {
157
166
  onChange: onZoomChange,
158
167
  zoomLevel: state.zoomLevel
@@ -11,11 +11,13 @@ import React, { useReducer } from 'react';
11
11
  import { isCommonMediaClientError } from '@atlaskit/media-client';
12
12
  import { DOCUMENT_SCROLL_ROOT_ID, DocumentViewer } from '@atlaskit/media-document-viewer';
13
13
  import { useStaticCallback } from '@atlaskit/media-common';
14
+ import { fg } from '@atlaskit/platform-feature-flags';
14
15
  import { MediaViewerError } from '../../errors';
15
16
  import { ZoomControls } from '../../zoomControls';
16
17
  import { ZoomLevel } from '../../domain/zoomLevel';
17
18
  import { PasswordInput } from './passwordInput';
18
19
  import Spinner from '@atlaskit/spinner';
20
+ import { isExcelFile } from '@atlaskit/media-common/mediaTypeUtils';
19
21
  var initialState = {
20
22
  isMissingPassword: false,
21
23
  hasPasswordError: false,
@@ -57,6 +59,7 @@ var reducer = function reducer(state, action) {
57
59
  var documentViewerStyles = null;
58
60
  var spinnerStyles = null;
59
61
  export var DocViewer = function DocViewer(_ref) {
62
+ var _fileState$mimeType;
60
63
  var mediaClient = _ref.mediaClient,
61
64
  fileState = _ref.fileState,
62
65
  collectionName = _ref.collectionName,
@@ -67,6 +70,11 @@ export var DocViewer = function DocViewer(_ref) {
67
70
  _useReducer2 = _slicedToArray(_useReducer, 2),
68
71
  state = _useReducer2[0],
69
72
  dispatch = _useReducer2[1];
73
+
74
+ // Compute enableLazyPageRendering based on Excel file detection and feature gate
75
+ // Excel files are found to have 60K pages, because excel can have thousand of empty rows, JST-1296681
76
+ var isExcel = fileState.status !== 'error' && isExcelFile((_fileState$mimeType = fileState.mimeType) !== null && _fileState$mimeType !== void 0 ? _fileState$mimeType : '');
77
+ var enableLazyPageRendering = isExcel && fg('platform_media_excel_lazy_load');
70
78
  var getContent = useStaticCallback( /*#__PURE__*/function () {
71
79
  var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(pageStart, pageEnd) {
72
80
  return _regeneratorRuntime.wrap(function _callee$(_context) {
@@ -205,7 +213,8 @@ export var DocViewer = function DocViewer(_ref) {
205
213
  getContent: getContent,
206
214
  getPageImageUrl: getPageImageUrl,
207
215
  zoom: state.zoomLevel.value,
208
- onSuccess: onSuccessHandler
216
+ onSuccess: onSuccessHandler,
217
+ enableLazyPageRendering: enableLazyPageRendering
209
218
  }), /*#__PURE__*/React.createElement(ZoomControls, {
210
219
  onChange: onZoomChange,
211
220
  zoomLevel: state.zoomLevel
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/media-viewer",
3
- "version": "53.1.1",
3
+ "version": "53.2.1",
4
4
  "description": "MediaViewer is Atlassian's powerful solution for viewing files on the web. It's both powerful and extendable yet easy-to-integrate",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -25,6 +25,13 @@
25
25
  ],
26
26
  "atlaskit:src": "src/index.ts",
27
27
  "atlassian": {
28
+ "react-compiler": {
29
+ "enabled": true,
30
+ "gating": {
31
+ "source": "@atlassian/react-compiler-gating",
32
+ "importSpecifierName": "isReactCompilerActivePlatform"
33
+ }
34
+ },
28
35
  "team": "Media Exif",
29
36
  "website": {
30
37
  "name": "Media Viewer"
@@ -37,15 +44,15 @@
37
44
  "@atlaskit/css": "^0.19.0",
38
45
  "@atlaskit/form": "^15.5.0",
39
46
  "@atlaskit/heading": "^5.4.0",
40
- "@atlaskit/icon": "^34.3.0",
47
+ "@atlaskit/icon": "^34.5.0",
41
48
  "@atlaskit/icon-file-type": "^7.0.0",
42
- "@atlaskit/icon-lab": "^6.6.0",
43
- "@atlaskit/media-client": "^36.1.0",
49
+ "@atlaskit/icon-lab": "^6.8.0",
50
+ "@atlaskit/media-client": "^36.2.0",
44
51
  "@atlaskit/media-client-react": "^5.1.0",
45
- "@atlaskit/media-common": "^13.2.0",
46
- "@atlaskit/media-document-viewer": "^0.6.0",
52
+ "@atlaskit/media-common": "^13.3.0",
53
+ "@atlaskit/media-document-viewer": "^0.7.0",
47
54
  "@atlaskit/media-svg": "^2.3.0",
48
- "@atlaskit/media-ui": "^29.1.0",
55
+ "@atlaskit/media-ui": "^29.2.0",
49
56
  "@atlaskit/platform-feature-flags": "^1.1.0",
50
57
  "@atlaskit/portal": "^5.5.0",
51
58
  "@atlaskit/primitives": "^19.0.0",
@@ -54,7 +61,7 @@
54
61
  "@atlaskit/textfield": "^8.3.0",
55
62
  "@atlaskit/theme": "^23.2.0",
56
63
  "@atlaskit/tokens": "^13.0.0",
57
- "@atlaskit/tooltip": "^22.0.0",
64
+ "@atlaskit/tooltip": "^22.1.0",
58
65
  "@atlaskit/ufo": "^0.4.0",
59
66
  "@babel/runtime": "^7.0.0",
60
67
  "@codemirror/language": "6.10.8",
@@ -92,7 +99,8 @@
92
99
  "@atlaskit/ssr": "workspace:^",
93
100
  "@atlaskit/toggle": "^15.6.0",
94
101
  "@atlassian/a11y-jest-testing": "^0.11.0",
95
- "@atlassian/feature-flags-test-utils": "^1.0.0",
102
+ "@atlassian/feature-flags-test-utils": "^1.1.0",
103
+ "@atlassian/react-compiler-gating": "workspace:^",
96
104
  "@atlassian/ufo": "^0.7.0",
97
105
  "@testing-library/dom": "^10.1.0",
98
106
  "@testing-library/react": "^16.3.0",
@@ -136,6 +144,9 @@
136
144
  },
137
145
  "platform_media_a11y_suppression_fixes": {
138
146
  "type": "boolean"
147
+ },
148
+ "platform_media_excel_lazy_load": {
149
+ "type": "boolean"
139
150
  }
140
151
  },
141
152
  "techstack": {