@atlaskit/media-card 79.15.9 → 79.16.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 +21 -0
- package/dist/cjs/card/fileCard.js +4 -2
- package/dist/cjs/card/inlinePlayerWrapper-compiled.compiled.css +2 -0
- package/dist/cjs/card/inlinePlayerWrapper-compiled.js +4 -1
- package/dist/cjs/card/ui/actionsBar/cardActions/cardActionButton-compiled.js +4 -1
- package/dist/es2019/card/fileCard.js +4 -2
- package/dist/es2019/card/inlinePlayerWrapper-compiled.compiled.css +2 -0
- package/dist/es2019/card/inlinePlayerWrapper-compiled.js +4 -1
- package/dist/es2019/card/ui/actionsBar/cardActions/cardActionButton-compiled.js +4 -1
- package/dist/esm/card/fileCard.js +4 -2
- package/dist/esm/card/inlinePlayerWrapper-compiled.compiled.css +2 -0
- package/dist/esm/card/inlinePlayerWrapper-compiled.js +4 -1
- package/dist/esm/card/ui/actionsBar/cardActions/cardActionButton-compiled.js +4 -1
- package/dist/types/card/fileCard.d.ts +4 -2
- package/dist/types/types.d.ts +3 -1
- package/dist/types-ts4.5/card/fileCard.d.ts +4 -2
- package/dist/types-ts4.5/types.d.ts +3 -1
- package/example-helpers/svg-helpers/uploader.ts +6 -4
- package/package.json +11 -5
- package/dist/cjs/utils/objectURLCache.js +0 -83
- package/dist/es2019/utils/objectURLCache.js +0 -44
- package/dist/esm/utils/objectURLCache.js +0 -76
- package/dist/types/utils/objectURLCache.d.ts +0 -12
- package/dist/types-ts4.5/utils/objectURLCache.d.ts +0 -12
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,26 @@
|
|
|
1
1
|
# @atlaskit/media-card
|
|
2
2
|
|
|
3
|
+
## 79.16.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`ca2338799c141`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/ca2338799c141) -
|
|
8
|
+
[ux] Fix media cards and media singles to use the correct border radius in the editor, renderer
|
|
9
|
+
and inline media player.
|
|
10
|
+
- Updated dependencies
|
|
11
|
+
|
|
12
|
+
## 79.16.0
|
|
13
|
+
|
|
14
|
+
### Minor Changes
|
|
15
|
+
|
|
16
|
+
- [`6e25e8bbb01c3`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/6e25e8bbb01c3) -
|
|
17
|
+
[ux] Adds mediaViewerExtensions prop to media-viewer/src/header and threads it through parents.
|
|
18
|
+
Allows callers to pass in additional buttons to the image / video preview'
|
|
19
|
+
|
|
20
|
+
### Patch Changes
|
|
21
|
+
|
|
22
|
+
- Updated dependencies
|
|
23
|
+
|
|
3
24
|
## 79.15.9
|
|
4
25
|
|
|
5
26
|
### Patch Changes
|
|
@@ -93,7 +93,8 @@ var FileCard = exports.FileCard = function FileCard(_ref) {
|
|
|
93
93
|
viewerOptions = _ref.viewerOptions,
|
|
94
94
|
includeHashForDuplicateFiles = _ref.includeHashForDuplicateFiles,
|
|
95
95
|
ssrItemDetails = _ref.ssrItemDetails,
|
|
96
|
-
onError = _ref.onError
|
|
96
|
+
onError = _ref.onError,
|
|
97
|
+
mediaViewerExtensions = _ref.mediaViewerExtensions;
|
|
97
98
|
var _useIntl = (0, _reactIntlNext.useIntl)(),
|
|
98
99
|
formatMessage = _useIntl.formatMessage;
|
|
99
100
|
var _useState = (0, _react.useState)(false),
|
|
@@ -786,6 +787,7 @@ var FileCard = exports.FileCard = function FileCard(_ref) {
|
|
|
786
787
|
},
|
|
787
788
|
contextId: contextId,
|
|
788
789
|
featureFlags: featureFlags,
|
|
789
|
-
viewerOptions: viewerOptions
|
|
790
|
+
viewerOptions: viewerOptions,
|
|
791
|
+
extensions: mediaViewerExtensions
|
|
790
792
|
}) : null, getSsrScriptProps && /*#__PURE__*/_react.default.createElement("script", getSsrScriptProps()));
|
|
791
793
|
};
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
|
|
2
|
+
._14mj1kw7:after{border-radius:inherit}
|
|
2
3
|
._14mjfajl:after{border-radius:var(--ds-radius-small,3px)}
|
|
4
|
+
._2rko1mok{border-radius:var(--ds-radius-large,8px)}
|
|
3
5
|
._2rkofajl{border-radius:var(--ds-radius-small,3px)}
|
|
4
6
|
._eq43fyzg:after{border:var(--ds-border-width,1px) solid var(--ds-border-selected,#1868db)}._11fnglyw:after{pointer-events:none}
|
|
5
7
|
._14r11j28::-moz-selection{background-color:transparent}
|
|
@@ -15,6 +15,7 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/de
|
|
|
15
15
|
var _getDimensionsWithDefault = require("../utils/lightCards/getDimensionsWithDefault");
|
|
16
16
|
var _vcMedia = require("@atlaskit/react-ufo/vc-media");
|
|
17
17
|
var _customData = _interopRequireDefault(require("@atlaskit/react-ufo/custom-data"));
|
|
18
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
18
19
|
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); }
|
|
19
20
|
var hideNativeBrowserTextSelectionStyles = null;
|
|
20
21
|
var selectedBorderStyle = null;
|
|
@@ -24,10 +25,12 @@ var selectedBorderStyle = null;
|
|
|
24
25
|
* shrinking the image OR growing the card size
|
|
25
26
|
*/
|
|
26
27
|
var borderStyle = null;
|
|
28
|
+
var updatedBorderStyle = null;
|
|
27
29
|
var inlinePlayerClassName = exports.inlinePlayerClassName = 'media-card-inline-player';
|
|
28
30
|
var LOCAL_WIDTH_VARIABLE = exports.LOCAL_WIDTH_VARIABLE = '--media-inline-player-wrapper-width';
|
|
29
31
|
var LOCAL_HEIGHT_VARIABLE = exports.LOCAL_HEIGHT_VARIABLE = '--media-inline-player-wrapper-height';
|
|
30
32
|
var inlinePlayerWrapperStyles = null;
|
|
33
|
+
var updatedInlinePlayerWrapperStyles = null;
|
|
31
34
|
|
|
32
35
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
33
36
|
|
|
@@ -42,7 +45,7 @@ var InlinePlayerWrapper = exports.InlinePlayerWrapper = function InlinePlayerWra
|
|
|
42
45
|
"data-testid": testId
|
|
43
46
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
44
47
|
,
|
|
45
|
-
className: (0, _runtime.ax)(["_1reo15vq _18m915vq _2rkofajl _kqswh2mm _p12f1osq _c71l1osq _1bsb1ez3 _4t3i1amq _1y2k1osq _z18o1osq", selected && "_1p1y1j28 _1rk81j28 _14r11j28 _1np21j28", "_14mjfajl _aetrb3bt _z0ai1osq _1qdg1osq _18postnw _15l2idpf _631ousvi _11fnglyw", selected && "_eq43fyzg", inlinePlayerClassName]),
|
|
48
|
+
className: (0, _runtime.ax)([(0, _platformFeatureFlags.fg)('platform_editor_media_border_radius_fix') ? "_1reo15vq _18m915vq _2rko1mok _kqswh2mm _p12f1osq _c71l1osq _1bsb1ez3 _4t3i1amq _1y2k1osq _z18o1osq" : "_1reo15vq _18m915vq _2rkofajl _kqswh2mm _p12f1osq _c71l1osq _1bsb1ez3 _4t3i1amq _1y2k1osq _z18o1osq", selected && "_1p1y1j28 _1rk81j28 _14r11j28 _1np21j28", (0, _platformFeatureFlags.fg)('platform_editor_media_border_radius_fix') ? "_14mj1kw7 _aetrb3bt _z0ai1osq _1qdg1osq _18postnw _15l2idpf _631ousvi _11fnglyw" : "_14mjfajl _aetrb3bt _z0ai1osq _1qdg1osq _18postnw _15l2idpf _631ousvi _11fnglyw", selected && "_eq43fyzg", inlinePlayerClassName]),
|
|
46
49
|
onClick: onClick,
|
|
47
50
|
ref: innerRef
|
|
48
51
|
}, _vcMedia.VcMediaWrapperProps, {
|
|
@@ -13,6 +13,7 @@ var React = _react;
|
|
|
13
13
|
var _runtime = require("@compiled/react/runtime");
|
|
14
14
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
15
15
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
16
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
16
17
|
var _colors = require("@atlaskit/theme/colors");
|
|
17
18
|
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); }
|
|
18
19
|
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; }
|
|
@@ -24,7 +25,9 @@ var variantStyleMap = {
|
|
|
24
25
|
var cardActionButtonStyles = null;
|
|
25
26
|
var CardActionButton = exports.CardActionButton = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
26
27
|
var _props$variant;
|
|
27
|
-
return /*#__PURE__*/React.createElement("button", (0, _extends2.default)({}, props, {
|
|
28
|
+
return /*#__PURE__*/React.createElement("button", (0, _extends2.default)({}, props, (0, _platformFeatureFlags.fg)('platform_media_card_action_button_type_fix') ? {
|
|
29
|
+
type: 'button'
|
|
30
|
+
} : {}, {
|
|
28
31
|
id: "cardActionButton",
|
|
29
32
|
"data-testid": "media-card-primary-action",
|
|
30
33
|
"aria-label": props.label,
|
|
@@ -74,7 +74,8 @@ export const FileCard = ({
|
|
|
74
74
|
viewerOptions,
|
|
75
75
|
includeHashForDuplicateFiles,
|
|
76
76
|
ssrItemDetails,
|
|
77
|
-
onError
|
|
77
|
+
onError,
|
|
78
|
+
mediaViewerExtensions
|
|
78
79
|
}) => {
|
|
79
80
|
const {
|
|
80
81
|
formatMessage
|
|
@@ -704,6 +705,7 @@ export const FileCard = ({
|
|
|
704
705
|
},
|
|
705
706
|
contextId: contextId,
|
|
706
707
|
featureFlags: featureFlags,
|
|
707
|
-
viewerOptions: viewerOptions
|
|
708
|
+
viewerOptions: viewerOptions,
|
|
709
|
+
extensions: mediaViewerExtensions
|
|
708
710
|
}) : null, getSsrScriptProps && /*#__PURE__*/React.createElement("script", getSsrScriptProps()));
|
|
709
711
|
};
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
|
|
2
|
+
._14mj1kw7:after{border-radius:inherit}
|
|
2
3
|
._14mjfajl:after{border-radius:var(--ds-radius-small,3px)}
|
|
4
|
+
._2rko1mok{border-radius:var(--ds-radius-large,8px)}
|
|
3
5
|
._2rkofajl{border-radius:var(--ds-radius-small,3px)}
|
|
4
6
|
._eq43fyzg:after{border:var(--ds-border-width,1px) solid var(--ds-border-selected,#1868db)}._11fnglyw:after{pointer-events:none}
|
|
5
7
|
._14r11j28::-moz-selection{background-color:transparent}
|
|
@@ -6,6 +6,7 @@ import { ax, ix } from "@compiled/react/runtime";
|
|
|
6
6
|
import { getDimensionsWithDefault } from '../utils/lightCards/getDimensionsWithDefault';
|
|
7
7
|
import { VcMediaWrapperProps } from '@atlaskit/react-ufo/vc-media';
|
|
8
8
|
import UFOCustomData from '@atlaskit/react-ufo/custom-data';
|
|
9
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
9
10
|
const hideNativeBrowserTextSelectionStyles = null;
|
|
10
11
|
const selectedBorderStyle = null;
|
|
11
12
|
|
|
@@ -14,10 +15,12 @@ const selectedBorderStyle = null;
|
|
|
14
15
|
* shrinking the image OR growing the card size
|
|
15
16
|
*/
|
|
16
17
|
const borderStyle = null;
|
|
18
|
+
const updatedBorderStyle = null;
|
|
17
19
|
export const inlinePlayerClassName = 'media-card-inline-player';
|
|
18
20
|
export const LOCAL_WIDTH_VARIABLE = '--media-inline-player-wrapper-width';
|
|
19
21
|
export const LOCAL_HEIGHT_VARIABLE = '--media-inline-player-wrapper-height';
|
|
20
22
|
const inlinePlayerWrapperStyles = null;
|
|
23
|
+
const updatedInlinePlayerWrapperStyles = null;
|
|
21
24
|
|
|
22
25
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
23
26
|
|
|
@@ -34,7 +37,7 @@ export const InlinePlayerWrapper = props => {
|
|
|
34
37
|
"data-testid": testId
|
|
35
38
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
36
39
|
,
|
|
37
|
-
className: ax(["_1reo15vq _18m915vq _2rkofajl _kqswh2mm _p12f1osq _c71l1osq _1bsbbj0z _4t3io1dg _1y2k1osq _z18o1osq", selected && "_1p1y1j28 _1rk81j28 _14r11j28 _1np21j28", "_14mjfajl _aetrb3bt _z0ai1osq _1qdg1osq _18postnw _15l2idpf _631ousvi _11fnglyw", selected && "_eq43fyzg", inlinePlayerClassName]),
|
|
40
|
+
className: ax([fg('platform_editor_media_border_radius_fix') ? "_1reo15vq _18m915vq _2rko1mok _kqswh2mm _p12f1osq _c71l1osq _1bsbbj0z _4t3io1dg _1y2k1osq _z18o1osq" : "_1reo15vq _18m915vq _2rkofajl _kqswh2mm _p12f1osq _c71l1osq _1bsbbj0z _4t3io1dg _1y2k1osq _z18o1osq", selected && "_1p1y1j28 _1rk81j28 _14r11j28 _1np21j28", fg('platform_editor_media_border_radius_fix') ? "_14mj1kw7 _aetrb3bt _z0ai1osq _1qdg1osq _18postnw _15l2idpf _631ousvi _11fnglyw" : "_14mjfajl _aetrb3bt _z0ai1osq _1qdg1osq _18postnw _15l2idpf _631ousvi _11fnglyw", selected && "_eq43fyzg", inlinePlayerClassName]),
|
|
38
41
|
style: {
|
|
39
42
|
[LOCAL_WIDTH_VARIABLE]: getDimensionsWithDefault(dimensions).width || '100%',
|
|
40
43
|
[LOCAL_HEIGHT_VARIABLE]: getDimensionsWithDefault(dimensions).height || 'auto'
|
|
@@ -6,6 +6,7 @@ import { ax, ix } from "@compiled/react/runtime";
|
|
|
6
6
|
import { forwardRef } from 'react';
|
|
7
7
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
8
8
|
|
|
9
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
9
10
|
import { N500 } from '@atlaskit/theme/colors';
|
|
10
11
|
const variantStyleMap = {
|
|
11
12
|
filled: "_bfhk1pja _irr3tl7t",
|
|
@@ -14,7 +15,9 @@ const variantStyleMap = {
|
|
|
14
15
|
const cardActionButtonStyles = null;
|
|
15
16
|
export const CardActionButton = /*#__PURE__*/forwardRef((props, ref) => {
|
|
16
17
|
var _props$variant;
|
|
17
|
-
return /*#__PURE__*/React.createElement("button", _extends({}, props, {
|
|
18
|
+
return /*#__PURE__*/React.createElement("button", _extends({}, props, fg('platform_media_card_action_button_type_fix') ? {
|
|
19
|
+
type: 'button'
|
|
20
|
+
} : {}, {
|
|
18
21
|
id: "cardActionButton",
|
|
19
22
|
"data-testid": "media-card-primary-action",
|
|
20
23
|
"aria-label": props.label,
|
|
@@ -85,7 +85,8 @@ export var FileCard = function FileCard(_ref) {
|
|
|
85
85
|
viewerOptions = _ref.viewerOptions,
|
|
86
86
|
includeHashForDuplicateFiles = _ref.includeHashForDuplicateFiles,
|
|
87
87
|
ssrItemDetails = _ref.ssrItemDetails,
|
|
88
|
-
onError = _ref.onError
|
|
88
|
+
onError = _ref.onError,
|
|
89
|
+
mediaViewerExtensions = _ref.mediaViewerExtensions;
|
|
89
90
|
var _useIntl = useIntl(),
|
|
90
91
|
formatMessage = _useIntl.formatMessage;
|
|
91
92
|
var _useState = useState(false),
|
|
@@ -778,6 +779,7 @@ export var FileCard = function FileCard(_ref) {
|
|
|
778
779
|
},
|
|
779
780
|
contextId: contextId,
|
|
780
781
|
featureFlags: featureFlags,
|
|
781
|
-
viewerOptions: viewerOptions
|
|
782
|
+
viewerOptions: viewerOptions,
|
|
783
|
+
extensions: mediaViewerExtensions
|
|
782
784
|
}) : null, getSsrScriptProps && /*#__PURE__*/React.createElement("script", getSsrScriptProps()));
|
|
783
785
|
};
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
|
|
2
|
+
._14mj1kw7:after{border-radius:inherit}
|
|
2
3
|
._14mjfajl:after{border-radius:var(--ds-radius-small,3px)}
|
|
4
|
+
._2rko1mok{border-radius:var(--ds-radius-large,8px)}
|
|
3
5
|
._2rkofajl{border-radius:var(--ds-radius-small,3px)}
|
|
4
6
|
._eq43fyzg:after{border:var(--ds-border-width,1px) solid var(--ds-border-selected,#1868db)}._11fnglyw:after{pointer-events:none}
|
|
5
7
|
._14r11j28::-moz-selection{background-color:transparent}
|
|
@@ -7,6 +7,7 @@ import { ax, ix } from "@compiled/react/runtime";
|
|
|
7
7
|
import { getDimensionsWithDefault } from '../utils/lightCards/getDimensionsWithDefault';
|
|
8
8
|
import { VcMediaWrapperProps } from '@atlaskit/react-ufo/vc-media';
|
|
9
9
|
import UFOCustomData from '@atlaskit/react-ufo/custom-data';
|
|
10
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
10
11
|
var hideNativeBrowserTextSelectionStyles = null;
|
|
11
12
|
var selectedBorderStyle = null;
|
|
12
13
|
|
|
@@ -15,10 +16,12 @@ var selectedBorderStyle = null;
|
|
|
15
16
|
* shrinking the image OR growing the card size
|
|
16
17
|
*/
|
|
17
18
|
var borderStyle = null;
|
|
19
|
+
var updatedBorderStyle = null;
|
|
18
20
|
export var inlinePlayerClassName = 'media-card-inline-player';
|
|
19
21
|
export var LOCAL_WIDTH_VARIABLE = '--media-inline-player-wrapper-width';
|
|
20
22
|
export var LOCAL_HEIGHT_VARIABLE = '--media-inline-player-wrapper-height';
|
|
21
23
|
var inlinePlayerWrapperStyles = null;
|
|
24
|
+
var updatedInlinePlayerWrapperStyles = null;
|
|
22
25
|
|
|
23
26
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
24
27
|
|
|
@@ -33,7 +36,7 @@ export var InlinePlayerWrapper = function InlinePlayerWrapper(props) {
|
|
|
33
36
|
"data-testid": testId
|
|
34
37
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
35
38
|
,
|
|
36
|
-
className: ax(["_1reo15vq _18m915vq _2rkofajl _kqswh2mm _p12f1osq _c71l1osq _1bsb1ez3 _4t3i1amq _1y2k1osq _z18o1osq", selected && "_1p1y1j28 _1rk81j28 _14r11j28 _1np21j28", "_14mjfajl _aetrb3bt _z0ai1osq _1qdg1osq _18postnw _15l2idpf _631ousvi _11fnglyw", selected && "_eq43fyzg", inlinePlayerClassName]),
|
|
39
|
+
className: ax([fg('platform_editor_media_border_radius_fix') ? "_1reo15vq _18m915vq _2rko1mok _kqswh2mm _p12f1osq _c71l1osq _1bsb1ez3 _4t3i1amq _1y2k1osq _z18o1osq" : "_1reo15vq _18m915vq _2rkofajl _kqswh2mm _p12f1osq _c71l1osq _1bsb1ez3 _4t3i1amq _1y2k1osq _z18o1osq", selected && "_1p1y1j28 _1rk81j28 _14r11j28 _1np21j28", fg('platform_editor_media_border_radius_fix') ? "_14mj1kw7 _aetrb3bt _z0ai1osq _1qdg1osq _18postnw _15l2idpf _631ousvi _11fnglyw" : "_14mjfajl _aetrb3bt _z0ai1osq _1qdg1osq _18postnw _15l2idpf _631ousvi _11fnglyw", selected && "_eq43fyzg", inlinePlayerClassName]),
|
|
37
40
|
onClick: onClick,
|
|
38
41
|
ref: innerRef
|
|
39
42
|
}, VcMediaWrapperProps, {
|
|
@@ -9,6 +9,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
9
9
|
import { forwardRef } from 'react';
|
|
10
10
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
11
11
|
|
|
12
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
12
13
|
import { N500 } from '@atlaskit/theme/colors';
|
|
13
14
|
var variantStyleMap = {
|
|
14
15
|
filled: "_bfhk1pja _irr3tl7t",
|
|
@@ -17,7 +18,9 @@ var variantStyleMap = {
|
|
|
17
18
|
var cardActionButtonStyles = null;
|
|
18
19
|
export var CardActionButton = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
19
20
|
var _props$variant;
|
|
20
|
-
return /*#__PURE__*/React.createElement("button", _extends({}, props, {
|
|
21
|
+
return /*#__PURE__*/React.createElement("button", _extends({}, props, fg('platform_media_card_action_button_type_fix') ? {
|
|
22
|
+
type: 'button'
|
|
23
|
+
} : {}, {
|
|
21
24
|
id: "cardActionButton",
|
|
22
25
|
"data-testid": "media-card-primary-action",
|
|
23
26
|
"aria-label": props.label,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type FileIdentifier, type Identifier, type ImageResizeMode } from '@atlaskit/media-client';
|
|
2
2
|
import { type MediaFeatureFlags, type NumericalCardDimensions, type SSR } from '@atlaskit/media-common';
|
|
3
|
-
import { type ViewerOptionsProps } from '@atlaskit/media-viewer';
|
|
3
|
+
import { type ViewerOptionsProps, type MediaViewerExtensions } from '@atlaskit/media-viewer';
|
|
4
4
|
import React from 'react';
|
|
5
5
|
import { type MediaCardErrorPrimaryReason } from '../errors';
|
|
6
6
|
import { type CardAppearance, type CardDimensions, type CardEventProps, type TitleBoxIcon } from '../types';
|
|
@@ -59,5 +59,7 @@ export interface FileCardProps extends CardEventProps {
|
|
|
59
59
|
readonly ssrItemDetails?: SsrItemDetails;
|
|
60
60
|
/** General Error handling include status errors and display errors*/
|
|
61
61
|
readonly onError?: (reason: MediaFilePreviewErrorPrimaryReason | MediaCardErrorPrimaryReason) => void;
|
|
62
|
+
/** Extensions for the media viewer (e.g. comment button in header). */
|
|
63
|
+
readonly mediaViewerExtensions?: MediaViewerExtensions;
|
|
62
64
|
}
|
|
63
|
-
export declare const FileCard: ({ appearance, resizeMode, isLazy, disableOverlay, featureFlags, identifier, ssr, dimensions, originalDimensions, contextId, alt, actions, shouldEnableDownloadButton, useInlinePlayer, shouldOpenMediaViewer, onFullscreenChange, selectable, selected, testId, titleBoxBgColor, titleBoxIcon, shouldHideTooltip, mediaViewerItems, onClick, onMouseEnter, videoControlsWrapperRef, viewerOptions, includeHashForDuplicateFiles, ssrItemDetails, onError, }: FileCardProps) => React.JSX.Element;
|
|
65
|
+
export declare const FileCard: ({ appearance, resizeMode, isLazy, disableOverlay, featureFlags, identifier, ssr, dimensions, originalDimensions, contextId, alt, actions, shouldEnableDownloadButton, useInlinePlayer, shouldOpenMediaViewer, onFullscreenChange, selectable, selected, testId, titleBoxBgColor, titleBoxIcon, shouldHideTooltip, mediaViewerItems, onClick, onMouseEnter, videoControlsWrapperRef, viewerOptions, includeHashForDuplicateFiles, ssrItemDetails, onError, mediaViewerExtensions, }: FileCardProps) => React.JSX.Element;
|
package/dist/types/types.d.ts
CHANGED
|
@@ -8,7 +8,7 @@ import { type UIAnalyticsEvent } from '@atlaskit/analytics-next';
|
|
|
8
8
|
import { type MediaFeatureFlags, type NumericalCardDimensions, type SSR } from '@atlaskit/media-common';
|
|
9
9
|
import { type CardAction } from './card/actions';
|
|
10
10
|
import { type MediaCardError, type MediaCardErrorPrimaryReason } from './errors';
|
|
11
|
-
import { type ViewerOptionsProps } from '@atlaskit/media-viewer';
|
|
11
|
+
import { type ViewerOptionsProps, type MediaViewerExtensions } from '@atlaskit/media-viewer';
|
|
12
12
|
import type { MediaFilePreviewErrorPrimaryReason } from '@atlaskit/media-file-preview';
|
|
13
13
|
export type CardStatus = 'uploading' | 'loading' | 'processing' | 'loading-preview' | 'complete' | 'error' | 'failed-processing';
|
|
14
14
|
export type FilePreviewStatus = {
|
|
@@ -111,6 +111,8 @@ export interface CardProps extends SharedCardProps, CardEventProps {
|
|
|
111
111
|
readonly mediaSettings?: MediaSettings;
|
|
112
112
|
/** General Error handling include status errors and display errors*/
|
|
113
113
|
readonly onError?: (reason: MediaFilePreviewErrorPrimaryReason | MediaCardErrorPrimaryReason) => void;
|
|
114
|
+
/** Extensions for the media viewer (e.g. comment button in header). */
|
|
115
|
+
readonly mediaViewerExtensions?: MediaViewerExtensions;
|
|
114
116
|
}
|
|
115
117
|
export interface CardState {
|
|
116
118
|
status: CardStatus;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type FileIdentifier, type Identifier, type ImageResizeMode } from '@atlaskit/media-client';
|
|
2
2
|
import { type MediaFeatureFlags, type NumericalCardDimensions, type SSR } from '@atlaskit/media-common';
|
|
3
|
-
import { type ViewerOptionsProps } from '@atlaskit/media-viewer';
|
|
3
|
+
import { type ViewerOptionsProps, type MediaViewerExtensions } from '@atlaskit/media-viewer';
|
|
4
4
|
import React from 'react';
|
|
5
5
|
import { type MediaCardErrorPrimaryReason } from '../errors';
|
|
6
6
|
import { type CardAppearance, type CardDimensions, type CardEventProps, type TitleBoxIcon } from '../types';
|
|
@@ -59,5 +59,7 @@ export interface FileCardProps extends CardEventProps {
|
|
|
59
59
|
readonly ssrItemDetails?: SsrItemDetails;
|
|
60
60
|
/** General Error handling include status errors and display errors*/
|
|
61
61
|
readonly onError?: (reason: MediaFilePreviewErrorPrimaryReason | MediaCardErrorPrimaryReason) => void;
|
|
62
|
+
/** Extensions for the media viewer (e.g. comment button in header). */
|
|
63
|
+
readonly mediaViewerExtensions?: MediaViewerExtensions;
|
|
62
64
|
}
|
|
63
|
-
export declare const FileCard: ({ appearance, resizeMode, isLazy, disableOverlay, featureFlags, identifier, ssr, dimensions, originalDimensions, contextId, alt, actions, shouldEnableDownloadButton, useInlinePlayer, shouldOpenMediaViewer, onFullscreenChange, selectable, selected, testId, titleBoxBgColor, titleBoxIcon, shouldHideTooltip, mediaViewerItems, onClick, onMouseEnter, videoControlsWrapperRef, viewerOptions, includeHashForDuplicateFiles, ssrItemDetails, onError, }: FileCardProps) => React.JSX.Element;
|
|
65
|
+
export declare const FileCard: ({ appearance, resizeMode, isLazy, disableOverlay, featureFlags, identifier, ssr, dimensions, originalDimensions, contextId, alt, actions, shouldEnableDownloadButton, useInlinePlayer, shouldOpenMediaViewer, onFullscreenChange, selectable, selected, testId, titleBoxBgColor, titleBoxIcon, shouldHideTooltip, mediaViewerItems, onClick, onMouseEnter, videoControlsWrapperRef, viewerOptions, includeHashForDuplicateFiles, ssrItemDetails, onError, mediaViewerExtensions, }: FileCardProps) => React.JSX.Element;
|
|
@@ -8,7 +8,7 @@ import { type UIAnalyticsEvent } from '@atlaskit/analytics-next';
|
|
|
8
8
|
import { type MediaFeatureFlags, type NumericalCardDimensions, type SSR } from '@atlaskit/media-common';
|
|
9
9
|
import { type CardAction } from './card/actions';
|
|
10
10
|
import { type MediaCardError, type MediaCardErrorPrimaryReason } from './errors';
|
|
11
|
-
import { type ViewerOptionsProps } from '@atlaskit/media-viewer';
|
|
11
|
+
import { type ViewerOptionsProps, type MediaViewerExtensions } from '@atlaskit/media-viewer';
|
|
12
12
|
import type { MediaFilePreviewErrorPrimaryReason } from '@atlaskit/media-file-preview';
|
|
13
13
|
export type CardStatus = 'uploading' | 'loading' | 'processing' | 'loading-preview' | 'complete' | 'error' | 'failed-processing';
|
|
14
14
|
export type FilePreviewStatus = {
|
|
@@ -111,6 +111,8 @@ export interface CardProps extends SharedCardProps, CardEventProps {
|
|
|
111
111
|
readonly mediaSettings?: MediaSettings;
|
|
112
112
|
/** General Error handling include status errors and display errors*/
|
|
113
113
|
readonly onError?: (reason: MediaFilePreviewErrorPrimaryReason | MediaCardErrorPrimaryReason) => void;
|
|
114
|
+
/** Extensions for the media viewer (e.g. comment button in header). */
|
|
115
|
+
readonly mediaViewerExtensions?: MediaViewerExtensions;
|
|
114
116
|
}
|
|
115
117
|
export interface CardState {
|
|
116
118
|
status: CardStatus;
|
|
@@ -3,10 +3,12 @@ import { type SyntheticEvent, useState } from 'react';
|
|
|
3
3
|
import { type FileIdentifier } from '@atlaskit/media-client';
|
|
4
4
|
import { useMediaClient } from '@atlaskit/media-client-react';
|
|
5
5
|
|
|
6
|
-
export const useSvgUploader = (
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
6
|
+
export const useSvgUploader = (
|
|
7
|
+
collectionName?: string,
|
|
8
|
+
): {
|
|
9
|
+
status: string;
|
|
10
|
+
identifier: FileIdentifier | undefined;
|
|
11
|
+
uploadFn: (event: SyntheticEvent<HTMLInputElement>) => Promise<void>;
|
|
10
12
|
} => {
|
|
11
13
|
const mediaClient = useMediaClient();
|
|
12
14
|
const [identifier, setIdentifier] = useState<FileIdentifier>();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/media-card",
|
|
3
|
-
"version": "79.
|
|
3
|
+
"version": "79.16.1",
|
|
4
4
|
"description": "Includes all media card related components, CardView, CardViewSmall, Card...",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -40,15 +40,16 @@
|
|
|
40
40
|
"@atlaskit/media-client-react": "^5.0.0",
|
|
41
41
|
"@atlaskit/media-common": "^13.0.0",
|
|
42
42
|
"@atlaskit/media-file-preview": "^0.16.0",
|
|
43
|
+
"@atlaskit/media-state": "^2.0.0",
|
|
43
44
|
"@atlaskit/media-svg": "^2.2.0",
|
|
44
45
|
"@atlaskit/media-ui": "^28.7.0",
|
|
45
|
-
"@atlaskit/media-viewer": "^52.
|
|
46
|
+
"@atlaskit/media-viewer": "^52.9.0",
|
|
46
47
|
"@atlaskit/platform-feature-flags": "^1.1.0",
|
|
47
48
|
"@atlaskit/primitives": "^18.0.0",
|
|
48
|
-
"@atlaskit/react-ufo": "^5.
|
|
49
|
+
"@atlaskit/react-ufo": "^5.5.0",
|
|
49
50
|
"@atlaskit/spinner": "^19.0.0",
|
|
50
51
|
"@atlaskit/theme": "^22.0.0",
|
|
51
|
-
"@atlaskit/tokens": "^11.
|
|
52
|
+
"@atlaskit/tokens": "^11.2.0",
|
|
52
53
|
"@atlaskit/tooltip": "^21.0.0",
|
|
53
54
|
"@atlaskit/ufo": "^0.4.0",
|
|
54
55
|
"@atlaskit/visually-hidden": "^3.0.0",
|
|
@@ -75,7 +76,6 @@
|
|
|
75
76
|
"@atlaskit/inline-message": "^15.6.0",
|
|
76
77
|
"@atlaskit/media-core": "^37.0.0",
|
|
77
78
|
"@atlaskit/media-picker": "^70.1.0",
|
|
78
|
-
"@atlaskit/media-state": "^2.0.0",
|
|
79
79
|
"@atlaskit/media-test-data": "^3.2.0",
|
|
80
80
|
"@atlaskit/media-test-helpers": "^40.0.0",
|
|
81
81
|
"@atlaskit/radio": "^8.4.0",
|
|
@@ -149,6 +149,12 @@
|
|
|
149
149
|
},
|
|
150
150
|
"dfo_attachments_late_render_fix": {
|
|
151
151
|
"type": "boolean"
|
|
152
|
+
},
|
|
153
|
+
"platform_media_card_action_button_type_fix": {
|
|
154
|
+
"type": "boolean"
|
|
155
|
+
},
|
|
156
|
+
"platform_editor_media_border_radius_fix": {
|
|
157
|
+
"type": "boolean"
|
|
152
158
|
}
|
|
153
159
|
},
|
|
154
160
|
"techstack": {
|
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.createObjectURLCache = exports.PREVIEW_CACHE_LRU_SIZE = exports.ObjectURLCache = void 0;
|
|
8
|
-
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
9
|
-
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
10
|
-
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
11
|
-
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
12
|
-
var _get2 = _interopRequireDefault(require("@babel/runtime/helpers/get"));
|
|
13
|
-
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
14
|
-
var _lru_map = require("lru_map");
|
|
15
|
-
var _eventemitter = require("eventemitter2");
|
|
16
|
-
function _callSuper(t, o, e) { return o = (0, _getPrototypeOf2.default)(o), (0, _possibleConstructorReturn2.default)(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], (0, _getPrototypeOf2.default)(t).constructor) : o.apply(t, e)); }
|
|
17
|
-
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
18
|
-
function _superPropGet(t, o, e, r) { var p = (0, _get2.default)((0, _getPrototypeOf2.default)(1 & r ? t.prototype : t), o, e); return 2 & r && "function" == typeof p ? function (t) { return p.apply(e, t); } : p; }
|
|
19
|
-
var PREVIEW_CACHE_LRU_SIZE = exports.PREVIEW_CACHE_LRU_SIZE = 50;
|
|
20
|
-
var ExtendedLRUCache = /*#__PURE__*/function (_LRUMap) {
|
|
21
|
-
function ExtendedLRUCache(limit) {
|
|
22
|
-
var _this;
|
|
23
|
-
(0, _classCallCheck2.default)(this, ExtendedLRUCache);
|
|
24
|
-
_this = _callSuper(this, ExtendedLRUCache, [limit]);
|
|
25
|
-
_this.eventEmitter = new _eventemitter.EventEmitter2();
|
|
26
|
-
return _this;
|
|
27
|
-
}
|
|
28
|
-
(0, _inherits2.default)(ExtendedLRUCache, _LRUMap);
|
|
29
|
-
return (0, _createClass2.default)(ExtendedLRUCache, [{
|
|
30
|
-
key: "shift",
|
|
31
|
-
value: function shift() {
|
|
32
|
-
var entry = _superPropGet(ExtendedLRUCache, "shift", this, 3)([]);
|
|
33
|
-
this.eventEmitter.emit('shift', entry);
|
|
34
|
-
return entry;
|
|
35
|
-
}
|
|
36
|
-
}, {
|
|
37
|
-
key: "on",
|
|
38
|
-
value: function on(event, callback) {
|
|
39
|
-
this.eventEmitter.on(event, callback);
|
|
40
|
-
}
|
|
41
|
-
}]);
|
|
42
|
-
}(_lru_map.LRUMap);
|
|
43
|
-
var ObjectURLCache = exports.ObjectURLCache = /*#__PURE__*/function () {
|
|
44
|
-
function ObjectURLCache(size) {
|
|
45
|
-
(0, _classCallCheck2.default)(this, ObjectURLCache);
|
|
46
|
-
this.cache = new ExtendedLRUCache(size);
|
|
47
|
-
this.cache.on('shift', function (entry) {
|
|
48
|
-
if (entry && entry[1].dataURI) {
|
|
49
|
-
URL.revokeObjectURL(entry[1].dataURI);
|
|
50
|
-
}
|
|
51
|
-
});
|
|
52
|
-
}
|
|
53
|
-
return (0, _createClass2.default)(ObjectURLCache, [{
|
|
54
|
-
key: "has",
|
|
55
|
-
value: function has(key) {
|
|
56
|
-
return !!this.cache.find(key);
|
|
57
|
-
}
|
|
58
|
-
}, {
|
|
59
|
-
key: "get",
|
|
60
|
-
value: function get(key) {
|
|
61
|
-
return this.cache.get(key);
|
|
62
|
-
}
|
|
63
|
-
}, {
|
|
64
|
-
key: "set",
|
|
65
|
-
value: function set(key, value) {
|
|
66
|
-
this.cache.set(key, value);
|
|
67
|
-
}
|
|
68
|
-
}, {
|
|
69
|
-
key: "remove",
|
|
70
|
-
value: function remove(key) {
|
|
71
|
-
var removed = this.cache.delete(key);
|
|
72
|
-
removed && URL.revokeObjectURL(removed.dataURI);
|
|
73
|
-
}
|
|
74
|
-
}, {
|
|
75
|
-
key: "clear",
|
|
76
|
-
value: function clear() {
|
|
77
|
-
this.cache.clear();
|
|
78
|
-
}
|
|
79
|
-
}]);
|
|
80
|
-
}();
|
|
81
|
-
var createObjectURLCache = exports.createObjectURLCache = function createObjectURLCache() {
|
|
82
|
-
return new ObjectURLCache(PREVIEW_CACHE_LRU_SIZE);
|
|
83
|
-
};
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import { LRUMap } from 'lru_map';
|
|
2
|
-
import { EventEmitter2 } from 'eventemitter2';
|
|
3
|
-
export const PREVIEW_CACHE_LRU_SIZE = 50;
|
|
4
|
-
class ExtendedLRUCache extends LRUMap {
|
|
5
|
-
constructor(limit) {
|
|
6
|
-
super(limit);
|
|
7
|
-
this.eventEmitter = new EventEmitter2();
|
|
8
|
-
}
|
|
9
|
-
shift() {
|
|
10
|
-
const entry = super.shift();
|
|
11
|
-
this.eventEmitter.emit('shift', entry);
|
|
12
|
-
return entry;
|
|
13
|
-
}
|
|
14
|
-
on(event, callback) {
|
|
15
|
-
this.eventEmitter.on(event, callback);
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
export class ObjectURLCache {
|
|
19
|
-
constructor(size) {
|
|
20
|
-
this.cache = new ExtendedLRUCache(size);
|
|
21
|
-
this.cache.on('shift', entry => {
|
|
22
|
-
if (entry && entry[1].dataURI) {
|
|
23
|
-
URL.revokeObjectURL(entry[1].dataURI);
|
|
24
|
-
}
|
|
25
|
-
});
|
|
26
|
-
}
|
|
27
|
-
has(key) {
|
|
28
|
-
return !!this.cache.find(key);
|
|
29
|
-
}
|
|
30
|
-
get(key) {
|
|
31
|
-
return this.cache.get(key);
|
|
32
|
-
}
|
|
33
|
-
set(key, value) {
|
|
34
|
-
this.cache.set(key, value);
|
|
35
|
-
}
|
|
36
|
-
remove(key) {
|
|
37
|
-
const removed = this.cache.delete(key);
|
|
38
|
-
removed && URL.revokeObjectURL(removed.dataURI);
|
|
39
|
-
}
|
|
40
|
-
clear() {
|
|
41
|
-
this.cache.clear();
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
export const createObjectURLCache = () => new ObjectURLCache(PREVIEW_CACHE_LRU_SIZE);
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
2
|
-
import _createClass from "@babel/runtime/helpers/createClass";
|
|
3
|
-
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
|
|
4
|
-
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
5
|
-
import _get from "@babel/runtime/helpers/get";
|
|
6
|
-
import _inherits from "@babel/runtime/helpers/inherits";
|
|
7
|
-
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
8
|
-
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
9
|
-
function _superPropGet(t, o, e, r) { var p = _get(_getPrototypeOf(1 & r ? t.prototype : t), o, e); return 2 & r && "function" == typeof p ? function (t) { return p.apply(e, t); } : p; }
|
|
10
|
-
import { LRUMap } from 'lru_map';
|
|
11
|
-
import { EventEmitter2 } from 'eventemitter2';
|
|
12
|
-
export var PREVIEW_CACHE_LRU_SIZE = 50;
|
|
13
|
-
var ExtendedLRUCache = /*#__PURE__*/function (_LRUMap) {
|
|
14
|
-
function ExtendedLRUCache(limit) {
|
|
15
|
-
var _this;
|
|
16
|
-
_classCallCheck(this, ExtendedLRUCache);
|
|
17
|
-
_this = _callSuper(this, ExtendedLRUCache, [limit]);
|
|
18
|
-
_this.eventEmitter = new EventEmitter2();
|
|
19
|
-
return _this;
|
|
20
|
-
}
|
|
21
|
-
_inherits(ExtendedLRUCache, _LRUMap);
|
|
22
|
-
return _createClass(ExtendedLRUCache, [{
|
|
23
|
-
key: "shift",
|
|
24
|
-
value: function shift() {
|
|
25
|
-
var entry = _superPropGet(ExtendedLRUCache, "shift", this, 3)([]);
|
|
26
|
-
this.eventEmitter.emit('shift', entry);
|
|
27
|
-
return entry;
|
|
28
|
-
}
|
|
29
|
-
}, {
|
|
30
|
-
key: "on",
|
|
31
|
-
value: function on(event, callback) {
|
|
32
|
-
this.eventEmitter.on(event, callback);
|
|
33
|
-
}
|
|
34
|
-
}]);
|
|
35
|
-
}(LRUMap);
|
|
36
|
-
export var ObjectURLCache = /*#__PURE__*/function () {
|
|
37
|
-
function ObjectURLCache(size) {
|
|
38
|
-
_classCallCheck(this, ObjectURLCache);
|
|
39
|
-
this.cache = new ExtendedLRUCache(size);
|
|
40
|
-
this.cache.on('shift', function (entry) {
|
|
41
|
-
if (entry && entry[1].dataURI) {
|
|
42
|
-
URL.revokeObjectURL(entry[1].dataURI);
|
|
43
|
-
}
|
|
44
|
-
});
|
|
45
|
-
}
|
|
46
|
-
return _createClass(ObjectURLCache, [{
|
|
47
|
-
key: "has",
|
|
48
|
-
value: function has(key) {
|
|
49
|
-
return !!this.cache.find(key);
|
|
50
|
-
}
|
|
51
|
-
}, {
|
|
52
|
-
key: "get",
|
|
53
|
-
value: function get(key) {
|
|
54
|
-
return this.cache.get(key);
|
|
55
|
-
}
|
|
56
|
-
}, {
|
|
57
|
-
key: "set",
|
|
58
|
-
value: function set(key, value) {
|
|
59
|
-
this.cache.set(key, value);
|
|
60
|
-
}
|
|
61
|
-
}, {
|
|
62
|
-
key: "remove",
|
|
63
|
-
value: function remove(key) {
|
|
64
|
-
var removed = this.cache.delete(key);
|
|
65
|
-
removed && URL.revokeObjectURL(removed.dataURI);
|
|
66
|
-
}
|
|
67
|
-
}, {
|
|
68
|
-
key: "clear",
|
|
69
|
-
value: function clear() {
|
|
70
|
-
this.cache.clear();
|
|
71
|
-
}
|
|
72
|
-
}]);
|
|
73
|
-
}();
|
|
74
|
-
export var createObjectURLCache = function createObjectURLCache() {
|
|
75
|
-
return new ObjectURLCache(PREVIEW_CACHE_LRU_SIZE);
|
|
76
|
-
};
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { type CardPreview } from '../types';
|
|
2
|
-
export declare const PREVIEW_CACHE_LRU_SIZE = 50;
|
|
3
|
-
export declare class ObjectURLCache {
|
|
4
|
-
private readonly cache;
|
|
5
|
-
constructor(size: number);
|
|
6
|
-
has(key: string): boolean;
|
|
7
|
-
get(key: string): CardPreview | undefined;
|
|
8
|
-
set(key: string, value: CardPreview): void;
|
|
9
|
-
remove(key: string): void;
|
|
10
|
-
clear(): void;
|
|
11
|
-
}
|
|
12
|
-
export declare const createObjectURLCache: () => ObjectURLCache;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { type CardPreview } from '../types';
|
|
2
|
-
export declare const PREVIEW_CACHE_LRU_SIZE = 50;
|
|
3
|
-
export declare class ObjectURLCache {
|
|
4
|
-
private readonly cache;
|
|
5
|
-
constructor(size: number);
|
|
6
|
-
has(key: string): boolean;
|
|
7
|
-
get(key: string): CardPreview | undefined;
|
|
8
|
-
set(key: string, value: CardPreview): void;
|
|
9
|
-
remove(key: string): void;
|
|
10
|
-
clear(): void;
|
|
11
|
-
}
|
|
12
|
-
export declare const createObjectURLCache: () => ObjectURLCache;
|