@atlaskit/media-card 79.16.0 → 79.16.2
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 +17 -0
- package/dist/cjs/card/card.js +1 -1
- package/dist/cjs/card/inlinePlayerWrapper-compiled.compiled.css +2 -0
- package/dist/cjs/card/inlinePlayerWrapper-compiled.js +4 -1
- package/dist/cjs/card/media-card-analytics-error-boundary.js +1 -1
- package/dist/cjs/card/ui/imageRenderer/imageRendererV2.js +8 -1
- package/dist/cjs/inline/loader.js +1 -1
- package/dist/cjs/utils/ufoExperiences.js +1 -1
- package/dist/es2019/card/card.js +1 -1
- package/dist/es2019/card/inlinePlayerWrapper-compiled.compiled.css +2 -0
- package/dist/es2019/card/inlinePlayerWrapper-compiled.js +4 -1
- package/dist/es2019/card/media-card-analytics-error-boundary.js +1 -1
- package/dist/es2019/card/ui/imageRenderer/imageRendererV2.js +8 -1
- package/dist/es2019/inline/loader.js +1 -1
- package/dist/es2019/utils/ufoExperiences.js +1 -1
- package/dist/esm/card/card.js +1 -1
- package/dist/esm/card/inlinePlayerWrapper-compiled.compiled.css +2 -0
- package/dist/esm/card/inlinePlayerWrapper-compiled.js +4 -1
- package/dist/esm/card/media-card-analytics-error-boundary.js +1 -1
- package/dist/esm/card/ui/imageRenderer/imageRendererV2.js +8 -1
- package/dist/esm/inline/loader.js +1 -1
- package/dist/esm/utils/ufoExperiences.js +1 -1
- package/package.json +13 -8
- 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,22 @@
|
|
|
1
1
|
# @atlaskit/media-card
|
|
2
2
|
|
|
3
|
+
## 79.16.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`b512cc17bab98`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/b512cc17bab98) -
|
|
8
|
+
Added change to avoid adding ufo hold if the the cardpreview is not available
|
|
9
|
+
- Updated dependencies
|
|
10
|
+
|
|
11
|
+
## 79.16.1
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- [`ca2338799c141`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/ca2338799c141) -
|
|
16
|
+
[ux] Fix media cards and media singles to use the correct border radius in the editor, renderer
|
|
17
|
+
and inline media player.
|
|
18
|
+
- Updated dependencies
|
|
19
|
+
|
|
3
20
|
## 79.16.0
|
|
4
21
|
|
|
5
22
|
### Minor Changes
|
package/dist/cjs/card/card.js
CHANGED
|
@@ -20,7 +20,7 @@ var _label = _interopRequireDefault(require("@atlaskit/react-ufo/label"));
|
|
|
20
20
|
var _excluded = ["identifier"];
|
|
21
21
|
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); }
|
|
22
22
|
var packageName = "@atlaskit/media-card";
|
|
23
|
-
var packageVersion = "
|
|
23
|
+
var packageVersion = "0.0.0-development";
|
|
24
24
|
var CardBase = exports.CardBase = function CardBase(_ref) {
|
|
25
25
|
var identifier = _ref.identifier,
|
|
26
26
|
otherProps = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
|
@@ -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, {
|
|
@@ -87,7 +87,7 @@ var WrappedMediaCardAnalyticsErrorBoundary = /*#__PURE__*/function (_React$Compo
|
|
|
87
87
|
}(_react.default.Component);
|
|
88
88
|
(0, _defineProperty2.default)(WrappedMediaCardAnalyticsErrorBoundary, "displayName", 'MediaCardAnalyticsErrorBoundary');
|
|
89
89
|
var packageName = "@atlaskit/media-card";
|
|
90
|
-
var packageVersion = "
|
|
90
|
+
var packageVersion = "0.0.0-development";
|
|
91
91
|
|
|
92
92
|
// @ts-ignore: [PIT-1685] Fails in post-office due to backwards incompatibility issue with React 18
|
|
93
93
|
var MediaCardAnalyticsErrorBoundary = (0, _mediaCommon.withMediaAnalyticsContext)({
|
|
@@ -19,6 +19,7 @@ var _mediaClient = require("@atlaskit/media-client");
|
|
|
19
19
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
20
20
|
var _customData = _interopRequireDefault(require("@atlaskit/react-ufo/custom-data"));
|
|
21
21
|
var _interactionContext = require("@atlaskit/react-ufo/interaction-context");
|
|
22
|
+
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
22
23
|
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); }
|
|
23
24
|
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
25
|
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; }
|
|
@@ -58,9 +59,12 @@ var ImageRenderer = exports.ImageRenderer = function ImageRenderer(_ref) {
|
|
|
58
59
|
setResolvedDimensions = _useState4[1];
|
|
59
60
|
(0, _react.useLayoutEffect)(function () {
|
|
60
61
|
if (!didRender && (0, _platformFeatureFlags.fg)('platfrom_close_blindspot_for_img')) {
|
|
62
|
+
if (!cardPreview && (0, _expValEquals.expValEquals)('cc_editor_ttvc_media_hold_fix', 'isEnabled', true)) {
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
61
65
|
return ufoContext === null || ufoContext === void 0 ? void 0 : ufoContext.hold('img-loading');
|
|
62
66
|
}
|
|
63
|
-
}, [didRender, ufoContext]);
|
|
67
|
+
}, [didRender, cardPreview, ufoContext]);
|
|
64
68
|
var imgRef = (0, _react.useRef)(null);
|
|
65
69
|
var onLoad = function onLoad(evt) {
|
|
66
70
|
wrapperRef.current && setResolvedDimensions((0, _helpers.calculateDimensions)(evt.currentTarget, wrapperRef.current, resizeMode));
|
|
@@ -68,6 +72,9 @@ var ImageRenderer = exports.ImageRenderer = function ImageRenderer(_ref) {
|
|
|
68
72
|
cardPreview && (onImageLoad === null || onImageLoad === void 0 ? void 0 : onImageLoad(cardPreview));
|
|
69
73
|
};
|
|
70
74
|
var onError = function onError() {
|
|
75
|
+
if ((0, _expValEquals.expValEquals)('cc_editor_ttvc_media_hold_fix', 'isEnabled', true)) {
|
|
76
|
+
setDidRender(true);
|
|
77
|
+
}
|
|
71
78
|
onImageError && cardPreview && onImageError(cardPreview);
|
|
72
79
|
};
|
|
73
80
|
(0, _react.useEffect)(function () {
|
|
@@ -116,7 +116,7 @@ var MediaInlineCardLoader = exports.default = /*#__PURE__*/function (_React$Pure
|
|
|
116
116
|
ErrorBoundary = _this$state.ErrorBoundary;
|
|
117
117
|
var analyticsContext = {
|
|
118
118
|
packageVersion: "@atlaskit/media-card",
|
|
119
|
-
packageName: "
|
|
119
|
+
packageName: "0.0.0-development",
|
|
120
120
|
componentName: 'mediaInlineCard',
|
|
121
121
|
component: 'mediaInlineCard'
|
|
122
122
|
};
|
|
@@ -19,7 +19,7 @@ var _globalScope = require("./globalScope/globalScope");
|
|
|
19
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; }
|
|
20
20
|
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; }
|
|
21
21
|
var packageName = "@atlaskit/media-card";
|
|
22
|
-
var packageVersion = "
|
|
22
|
+
var packageVersion = "0.0.0-development";
|
|
23
23
|
var SAMPLE_RATE = 0.05;
|
|
24
24
|
|
|
25
25
|
/**
|
package/dist/es2019/card/card.js
CHANGED
|
@@ -9,7 +9,7 @@ import { startResourceObserver, setAnalyticsContext } from '../utils/mediaPerfor
|
|
|
9
9
|
import { useAnalyticsEvents } from '@atlaskit/analytics-next';
|
|
10
10
|
import UFOLabel from '@atlaskit/react-ufo/label';
|
|
11
11
|
const packageName = "@atlaskit/media-card";
|
|
12
|
-
const packageVersion = "
|
|
12
|
+
const packageVersion = "0.0.0-development";
|
|
13
13
|
export const CardBase = ({
|
|
14
14
|
identifier,
|
|
15
15
|
...otherProps
|
|
@@ -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'
|
|
@@ -66,7 +66,7 @@ class WrappedMediaCardAnalyticsErrorBoundary extends React.Component {
|
|
|
66
66
|
}
|
|
67
67
|
_defineProperty(WrappedMediaCardAnalyticsErrorBoundary, "displayName", 'MediaCardAnalyticsErrorBoundary');
|
|
68
68
|
const packageName = "@atlaskit/media-card";
|
|
69
|
-
const packageVersion = "
|
|
69
|
+
const packageVersion = "0.0.0-development";
|
|
70
70
|
|
|
71
71
|
// @ts-ignore: [PIT-1685] Fails in post-office due to backwards incompatibility issue with React 18
|
|
72
72
|
const MediaCardAnalyticsErrorBoundary = withMediaAnalyticsContext({
|
|
@@ -9,6 +9,7 @@ import { isFileIdentifier } from '@atlaskit/media-client';
|
|
|
9
9
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
10
10
|
import UFOCustomData from '@atlaskit/react-ufo/custom-data';
|
|
11
11
|
import { useInteractionContext } from '@atlaskit/react-ufo/interaction-context';
|
|
12
|
+
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
12
13
|
const baseStyles = null;
|
|
13
14
|
const backgroundStyles = null;
|
|
14
15
|
export const ImageRenderer = ({
|
|
@@ -38,9 +39,12 @@ export const ImageRenderer = ({
|
|
|
38
39
|
const [resolvedDimensions, setResolvedDimensions] = useState(calculateInitialDimensions(resizeMode));
|
|
39
40
|
useLayoutEffect(() => {
|
|
40
41
|
if (!didRender && fg('platfrom_close_blindspot_for_img')) {
|
|
42
|
+
if (!cardPreview && expValEquals('cc_editor_ttvc_media_hold_fix', 'isEnabled', true)) {
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
41
45
|
return ufoContext === null || ufoContext === void 0 ? void 0 : ufoContext.hold('img-loading');
|
|
42
46
|
}
|
|
43
|
-
}, [didRender, ufoContext]);
|
|
47
|
+
}, [didRender, cardPreview, ufoContext]);
|
|
44
48
|
const imgRef = useRef(null);
|
|
45
49
|
const onLoad = evt => {
|
|
46
50
|
wrapperRef.current && setResolvedDimensions(calculateDimensions(evt.currentTarget, wrapperRef.current, resizeMode));
|
|
@@ -48,6 +52,9 @@ export const ImageRenderer = ({
|
|
|
48
52
|
cardPreview && (onImageLoad === null || onImageLoad === void 0 ? void 0 : onImageLoad(cardPreview));
|
|
49
53
|
};
|
|
50
54
|
const onError = () => {
|
|
55
|
+
if (expValEquals('cc_editor_ttvc_media_hold_fix', 'isEnabled', true)) {
|
|
56
|
+
setDidRender(true);
|
|
57
|
+
}
|
|
51
58
|
onImageError && cardPreview && onImageError(cardPreview);
|
|
52
59
|
};
|
|
53
60
|
useEffect(() => {
|
|
@@ -37,7 +37,7 @@ export default class MediaInlineCardLoader extends React.PureComponent {
|
|
|
37
37
|
} = this.state;
|
|
38
38
|
const analyticsContext = {
|
|
39
39
|
packageVersion: "@atlaskit/media-card",
|
|
40
|
-
packageName: "
|
|
40
|
+
packageName: "0.0.0-development",
|
|
41
41
|
componentName: 'mediaInlineCard',
|
|
42
42
|
component: 'mediaInlineCard'
|
|
43
43
|
};
|
|
@@ -9,7 +9,7 @@ import { getMediaEnvironment, getMediaRegion } from '@atlaskit/media-client';
|
|
|
9
9
|
import { getActiveInteraction } from '@atlaskit/react-ufo/interaction-metrics';
|
|
10
10
|
import { getMediaGlobalScope } from './globalScope/globalScope';
|
|
11
11
|
const packageName = "@atlaskit/media-card";
|
|
12
|
-
const packageVersion = "
|
|
12
|
+
const packageVersion = "0.0.0-development";
|
|
13
13
|
const SAMPLE_RATE = 0.05;
|
|
14
14
|
|
|
15
15
|
/**
|
package/dist/esm/card/card.js
CHANGED
|
@@ -11,7 +11,7 @@ import { startResourceObserver, setAnalyticsContext } from '../utils/mediaPerfor
|
|
|
11
11
|
import { useAnalyticsEvents } from '@atlaskit/analytics-next';
|
|
12
12
|
import UFOLabel from '@atlaskit/react-ufo/label';
|
|
13
13
|
var packageName = "@atlaskit/media-card";
|
|
14
|
-
var packageVersion = "
|
|
14
|
+
var packageVersion = "0.0.0-development";
|
|
15
15
|
export var CardBase = function CardBase(_ref) {
|
|
16
16
|
var identifier = _ref.identifier,
|
|
17
17
|
otherProps = _objectWithoutProperties(_ref, _excluded);
|
|
@@ -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, {
|
|
@@ -80,7 +80,7 @@ var WrappedMediaCardAnalyticsErrorBoundary = /*#__PURE__*/function (_React$Compo
|
|
|
80
80
|
}(React.Component);
|
|
81
81
|
_defineProperty(WrappedMediaCardAnalyticsErrorBoundary, "displayName", 'MediaCardAnalyticsErrorBoundary');
|
|
82
82
|
var packageName = "@atlaskit/media-card";
|
|
83
|
-
var packageVersion = "
|
|
83
|
+
var packageVersion = "0.0.0-development";
|
|
84
84
|
|
|
85
85
|
// @ts-ignore: [PIT-1685] Fails in post-office due to backwards incompatibility issue with React 18
|
|
86
86
|
var MediaCardAnalyticsErrorBoundary = withMediaAnalyticsContext({
|
|
@@ -13,6 +13,7 @@ import { isFileIdentifier } from '@atlaskit/media-client';
|
|
|
13
13
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
14
14
|
import UFOCustomData from '@atlaskit/react-ufo/custom-data';
|
|
15
15
|
import { useInteractionContext } from '@atlaskit/react-ufo/interaction-context';
|
|
16
|
+
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
16
17
|
var baseStyles = null;
|
|
17
18
|
var backgroundStyles = null;
|
|
18
19
|
export var ImageRenderer = function ImageRenderer(_ref) {
|
|
@@ -49,9 +50,12 @@ export var ImageRenderer = function ImageRenderer(_ref) {
|
|
|
49
50
|
setResolvedDimensions = _useState4[1];
|
|
50
51
|
useLayoutEffect(function () {
|
|
51
52
|
if (!didRender && fg('platfrom_close_blindspot_for_img')) {
|
|
53
|
+
if (!cardPreview && expValEquals('cc_editor_ttvc_media_hold_fix', 'isEnabled', true)) {
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
52
56
|
return ufoContext === null || ufoContext === void 0 ? void 0 : ufoContext.hold('img-loading');
|
|
53
57
|
}
|
|
54
|
-
}, [didRender, ufoContext]);
|
|
58
|
+
}, [didRender, cardPreview, ufoContext]);
|
|
55
59
|
var imgRef = useRef(null);
|
|
56
60
|
var onLoad = function onLoad(evt) {
|
|
57
61
|
wrapperRef.current && setResolvedDimensions(calculateDimensions(evt.currentTarget, wrapperRef.current, resizeMode));
|
|
@@ -59,6 +63,9 @@ export var ImageRenderer = function ImageRenderer(_ref) {
|
|
|
59
63
|
cardPreview && (onImageLoad === null || onImageLoad === void 0 ? void 0 : onImageLoad(cardPreview));
|
|
60
64
|
};
|
|
61
65
|
var onError = function onError() {
|
|
66
|
+
if (expValEquals('cc_editor_ttvc_media_hold_fix', 'isEnabled', true)) {
|
|
67
|
+
setDidRender(true);
|
|
68
|
+
}
|
|
62
69
|
onImageError && cardPreview && onImageError(cardPreview);
|
|
63
70
|
};
|
|
64
71
|
useEffect(function () {
|
|
@@ -101,7 +101,7 @@ var MediaInlineCardLoader = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
101
101
|
ErrorBoundary = _this$state.ErrorBoundary;
|
|
102
102
|
var analyticsContext = {
|
|
103
103
|
packageVersion: "@atlaskit/media-card",
|
|
104
|
-
packageName: "
|
|
104
|
+
packageName: "0.0.0-development",
|
|
105
105
|
componentName: 'mediaInlineCard',
|
|
106
106
|
component: 'mediaInlineCard'
|
|
107
107
|
};
|
|
@@ -13,7 +13,7 @@ import { getMediaEnvironment, getMediaRegion } from '@atlaskit/media-client';
|
|
|
13
13
|
import { getActiveInteraction } from '@atlaskit/react-ufo/interaction-metrics';
|
|
14
14
|
import { getMediaGlobalScope } from './globalScope/globalScope';
|
|
15
15
|
var packageName = "@atlaskit/media-card";
|
|
16
|
-
var packageVersion = "
|
|
16
|
+
var packageVersion = "0.0.0-development";
|
|
17
17
|
var SAMPLE_RATE = 0.05;
|
|
18
18
|
|
|
19
19
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/media-card",
|
|
3
|
-
"version": "79.16.
|
|
3
|
+
"version": "79.16.2",
|
|
4
4
|
"description": "Includes all media card related components, CardView, CardViewSmall, Card...",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -31,10 +31,10 @@
|
|
|
31
31
|
}
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@atlaskit/analytics-next": "^11.
|
|
35
|
-
"@atlaskit/dropdown-menu": "^16.
|
|
34
|
+
"@atlaskit/analytics-next": "^11.2.0",
|
|
35
|
+
"@atlaskit/dropdown-menu": "^16.8.0",
|
|
36
36
|
"@atlaskit/editor-shared-styles": "^3.10.0",
|
|
37
|
-
"@atlaskit/icon": "^33.
|
|
37
|
+
"@atlaskit/icon": "^33.1.0",
|
|
38
38
|
"@atlaskit/link": "^3.3.0",
|
|
39
39
|
"@atlaskit/media-client": "^36.0.0",
|
|
40
40
|
"@atlaskit/media-client-react": "^5.0.0",
|
|
@@ -45,11 +45,12 @@
|
|
|
45
45
|
"@atlaskit/media-ui": "^28.7.0",
|
|
46
46
|
"@atlaskit/media-viewer": "^52.9.0",
|
|
47
47
|
"@atlaskit/platform-feature-flags": "^1.1.0",
|
|
48
|
-
"@atlaskit/primitives": "^18.
|
|
49
|
-
"@atlaskit/react-ufo": "^5.
|
|
48
|
+
"@atlaskit/primitives": "^18.1.0",
|
|
49
|
+
"@atlaskit/react-ufo": "^5.5.0",
|
|
50
50
|
"@atlaskit/spinner": "^19.0.0",
|
|
51
51
|
"@atlaskit/theme": "^22.0.0",
|
|
52
|
-
"@atlaskit/
|
|
52
|
+
"@atlaskit/tmp-editor-statsig": "^46.2.0",
|
|
53
|
+
"@atlaskit/tokens": "^11.3.0",
|
|
53
54
|
"@atlaskit/tooltip": "^21.0.0",
|
|
54
55
|
"@atlaskit/ufo": "^0.4.0",
|
|
55
56
|
"@atlaskit/visually-hidden": "^3.0.0",
|
|
@@ -72,7 +73,7 @@
|
|
|
72
73
|
"@af/integration-testing": "workspace:^",
|
|
73
74
|
"@atlaskit/analytics-listeners": "^10.0.0",
|
|
74
75
|
"@atlaskit/analytics-namespaced-context": "^7.2.0",
|
|
75
|
-
"@atlaskit/form": "^15.
|
|
76
|
+
"@atlaskit/form": "^15.5.0",
|
|
76
77
|
"@atlaskit/inline-message": "^15.6.0",
|
|
77
78
|
"@atlaskit/media-core": "^37.0.0",
|
|
78
79
|
"@atlaskit/media-picker": "^70.1.0",
|
|
@@ -84,6 +85,7 @@
|
|
|
84
85
|
"@atlaskit/toggle": "^15.2.0",
|
|
85
86
|
"@atlassian/a11y-jest-testing": "^0.10.0",
|
|
86
87
|
"@atlassian/feature-flags-test-utils": "^1.0.0",
|
|
88
|
+
"@atlassian/testing-library": "^0.4.0",
|
|
87
89
|
"@atlassian/ufo": "^0.7.0",
|
|
88
90
|
"@testing-library/dom": "^10.1.0",
|
|
89
91
|
"@testing-library/react": "^16.3.0",
|
|
@@ -152,6 +154,9 @@
|
|
|
152
154
|
},
|
|
153
155
|
"platform_media_card_action_button_type_fix": {
|
|
154
156
|
"type": "boolean"
|
|
157
|
+
},
|
|
158
|
+
"platform_editor_media_border_radius_fix": {
|
|
159
|
+
"type": "boolean"
|
|
155
160
|
}
|
|
156
161
|
},
|
|
157
162
|
"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;
|