@atlaskit/media-card 79.8.2 → 79.9.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 +23 -0
- package/dist/cjs/card/card.js +1 -1
- package/dist/cjs/card/fileCard.js +2 -1
- package/dist/cjs/card/media-card-analytics-error-boundary.js +1 -1
- package/dist/cjs/card/ui/imageRenderer/helpers.js +1 -1
- package/dist/cjs/inline/loader.js +1 -1
- package/dist/cjs/utils/mediaPerformanceObserver/mediaPerformanceObserver.js +1 -1
- package/dist/cjs/utils/ufoExperiences.js +1 -1
- package/dist/es2019/card/card.js +1 -1
- package/dist/es2019/card/fileCard.js +2 -1
- package/dist/es2019/card/media-card-analytics-error-boundary.js +1 -1
- package/dist/es2019/card/ui/imageRenderer/helpers.js +1 -1
- package/dist/es2019/inline/loader.js +1 -1
- package/dist/es2019/utils/mediaPerformanceObserver/mediaPerformanceObserver.js +1 -1
- package/dist/es2019/utils/ufoExperiences.js +1 -1
- package/dist/esm/card/card.js +1 -1
- package/dist/esm/card/fileCard.js +2 -1
- package/dist/esm/card/media-card-analytics-error-boundary.js +1 -1
- package/dist/esm/card/ui/imageRenderer/helpers.js +1 -1
- package/dist/esm/inline/loader.js +1 -1
- package/dist/esm/utils/mediaPerformanceObserver/mediaPerformanceObserver.js +1 -1
- package/dist/esm/utils/ufoExperiences.js +1 -1
- package/package.json +9 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,28 @@
|
|
|
1
1
|
# @atlaskit/media-card
|
|
2
2
|
|
|
3
|
+
## 79.9.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`2fe94e8511b55`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/2fe94e8511b55) -
|
|
8
|
+
Improved same-aspect-ratio detection in image rendering by using threshold-based comparison
|
|
9
|
+
instead of rounding-based comparison. This fixes edge cases where images with negligible aspect
|
|
10
|
+
ratio differences (1-2 pixels) from their parent container were incorrectly treated as different
|
|
11
|
+
ratios, causing unnecessary style recalculations and sub-optimal rendering strategies.
|
|
12
|
+
|
|
13
|
+
## 79.9.0
|
|
14
|
+
|
|
15
|
+
### Minor Changes
|
|
16
|
+
|
|
17
|
+
- [`2060fe01f7695`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/2060fe01f7695) -
|
|
18
|
+
Optimised lazy loading by integrating the removal of lazy loading during SSR
|
|
19
|
+
|
|
20
|
+
### Patch Changes
|
|
21
|
+
|
|
22
|
+
- [`2060fe01f7695`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/2060fe01f7695) -
|
|
23
|
+
Add media-perf-lazy-loading-optimisation to perfObserver metrics to track impact
|
|
24
|
+
- Updated dependencies
|
|
25
|
+
|
|
3
26
|
## 79.8.2
|
|
4
27
|
|
|
5
28
|
### Patch 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);
|
|
@@ -587,13 +587,14 @@ var FileCard = exports.FileCard = function FileCard(_ref) {
|
|
|
587
587
|
var izLazyOverride = arguments.length > 2 ? arguments[2] : undefined;
|
|
588
588
|
var mediaItemType = identifier.mediaItemType;
|
|
589
589
|
var isLazyWithOverride = izLazyOverride === undefined ? isLazy : izLazyOverride;
|
|
590
|
+
var isLazyPreview = (0, _platformFeatureFlags.fg)('media-perf-lazy-loading-optimisation') ? preview === null || preview === void 0 ? void 0 : preview.lazy : true;
|
|
590
591
|
|
|
591
592
|
// We should natively lazy load an SSR preview when card is not visible,
|
|
592
593
|
// otherwise we'll fire the metadata fetch from outside the viewport
|
|
593
594
|
// Side note: We should not lazy load if the cardPreview is available from local cache,
|
|
594
595
|
// in order to avoid flickers during re-mount of the component
|
|
595
596
|
// CXP-2723 TODO: Create test cases for the above scenarios
|
|
596
|
-
var nativeLazyLoad = isLazyWithOverride && ((0, _platformFeatureFlags.fg)('media-perf-uplift-mutation-fix') || !isCardVisible) && preview && (0, _types.isSSRPreview)(preview);
|
|
597
|
+
var nativeLazyLoad = isLazyWithOverride && ((0, _platformFeatureFlags.fg)('media-perf-uplift-mutation-fix') || !isCardVisible) && preview && (0, _types.isSSRPreview)(preview) && isLazyPreview;
|
|
597
598
|
// Force Media Image to always display img for SSR
|
|
598
599
|
var forceSyncDisplay = !!ssr;
|
|
599
600
|
var card = /*#__PURE__*/_react.default.createElement(_cardView.CardView, {
|
|
@@ -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)({
|
|
@@ -36,7 +36,7 @@ var calculateDimensions = exports.calculateDimensions = function calculateDimens
|
|
|
36
36
|
var imgRatio = imgWidth / imgHeight;
|
|
37
37
|
var cardRatio = parentWidth / parentHeight;
|
|
38
38
|
if ((0, _platformFeatureFlags.fg)('media-perf-uplift-mutation-fix')) {
|
|
39
|
-
var isSameRatio = roundedRatio(imgWidth / parentWidth) === roundedRatio(imgHeight / parentHeight);
|
|
39
|
+
var isSameRatio = (0, _platformFeatureFlags.fg)('media-perf-ratio-calc-fix') ? Math.abs(imgWidth / parentWidth - imgHeight / parentHeight) < 0.1 : roundedRatio(imgWidth / parentWidth) === roundedRatio(imgHeight / parentHeight);
|
|
40
40
|
if (isSameRatio) {
|
|
41
41
|
if (resizeMode === 'stretchy-fit') {
|
|
42
42
|
return DEFAULT_STRETCHY_FIT_DIMENSIONS;
|
|
@@ -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
|
};
|
|
@@ -39,7 +39,7 @@ var createAndGetResourceObserver = function createAndGetResourceObserver() {
|
|
|
39
39
|
fileId: fileId,
|
|
40
40
|
mediaClientId: clientId,
|
|
41
41
|
featureFlags: {
|
|
42
|
-
'media-
|
|
42
|
+
'media-perf-lazy-loading-optimisation': (0, _platformFeatureFlags.fg)('media-perf-lazy-loading-optimisation')
|
|
43
43
|
}
|
|
44
44
|
}, mediaDurationMetrics)
|
|
45
45
|
});
|
|
@@ -15,7 +15,7 @@ var _mediaClient = require("@atlaskit/media-client");
|
|
|
15
15
|
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; }
|
|
16
16
|
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; }
|
|
17
17
|
var packageName = "@atlaskit/media-card";
|
|
18
|
-
var packageVersion = "
|
|
18
|
+
var packageVersion = "0.0.0-development";
|
|
19
19
|
var SAMPLE_RATE = 0.05;
|
|
20
20
|
var concurrentExperience;
|
|
21
21
|
var getExperience = function getExperience(id) {
|
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
|
|
@@ -510,13 +510,14 @@ export const FileCard = ({
|
|
|
510
510
|
mediaItemType
|
|
511
511
|
} = identifier;
|
|
512
512
|
const isLazyWithOverride = izLazyOverride === undefined ? isLazy : izLazyOverride;
|
|
513
|
+
let isLazyPreview = fg('media-perf-lazy-loading-optimisation') ? preview === null || preview === void 0 ? void 0 : preview.lazy : true;
|
|
513
514
|
|
|
514
515
|
// We should natively lazy load an SSR preview when card is not visible,
|
|
515
516
|
// otherwise we'll fire the metadata fetch from outside the viewport
|
|
516
517
|
// Side note: We should not lazy load if the cardPreview is available from local cache,
|
|
517
518
|
// in order to avoid flickers during re-mount of the component
|
|
518
519
|
// CXP-2723 TODO: Create test cases for the above scenarios
|
|
519
|
-
const nativeLazyLoad = isLazyWithOverride && (fg('media-perf-uplift-mutation-fix') || !isCardVisible) && preview && isSSRPreview(preview);
|
|
520
|
+
const nativeLazyLoad = isLazyWithOverride && (fg('media-perf-uplift-mutation-fix') || !isCardVisible) && preview && isSSRPreview(preview) && isLazyPreview;
|
|
520
521
|
// Force Media Image to always display img for SSR
|
|
521
522
|
const forceSyncDisplay = !!ssr;
|
|
522
523
|
const card = /*#__PURE__*/React.createElement(CardView, {
|
|
@@ -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({
|
|
@@ -33,7 +33,7 @@ export const calculateDimensions = (imgElement, parentElement, resizeMode) => {
|
|
|
33
33
|
const imgRatio = imgWidth / imgHeight;
|
|
34
34
|
const cardRatio = parentWidth / parentHeight;
|
|
35
35
|
if (fg('media-perf-uplift-mutation-fix')) {
|
|
36
|
-
const isSameRatio = roundedRatio(imgWidth / parentWidth) === roundedRatio(imgHeight / parentHeight);
|
|
36
|
+
const isSameRatio = fg('media-perf-ratio-calc-fix') ? Math.abs(imgWidth / parentWidth - imgHeight / parentHeight) < 0.1 : roundedRatio(imgWidth / parentWidth) === roundedRatio(imgHeight / parentHeight);
|
|
37
37
|
if (isSameRatio) {
|
|
38
38
|
if (resizeMode === 'stretchy-fit') {
|
|
39
39
|
return DEFAULT_STRETCHY_FIT_DIMENSIONS;
|
|
@@ -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
|
};
|
|
@@ -29,7 +29,7 @@ const createAndGetResourceObserver = () => {
|
|
|
29
29
|
fileId: fileId,
|
|
30
30
|
mediaClientId: clientId,
|
|
31
31
|
featureFlags: {
|
|
32
|
-
'media-
|
|
32
|
+
'media-perf-lazy-loading-optimisation': fg('media-perf-lazy-loading-optimisation')
|
|
33
33
|
},
|
|
34
34
|
...mediaDurationMetrics
|
|
35
35
|
}
|
|
@@ -5,7 +5,7 @@ import { extractErrorInfo, getRenderErrorRequestMetadata } from './analytics';
|
|
|
5
5
|
import { MediaCardError } from '../errors';
|
|
6
6
|
import { getMediaEnvironment, getMediaRegion } from '@atlaskit/media-client';
|
|
7
7
|
const packageName = "@atlaskit/media-card";
|
|
8
|
-
const packageVersion = "
|
|
8
|
+
const packageVersion = "0.0.0-development";
|
|
9
9
|
const SAMPLE_RATE = 0.05;
|
|
10
10
|
let concurrentExperience;
|
|
11
11
|
const getExperience = id => {
|
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);
|
|
@@ -579,13 +579,14 @@ export var FileCard = function FileCard(_ref) {
|
|
|
579
579
|
var izLazyOverride = arguments.length > 2 ? arguments[2] : undefined;
|
|
580
580
|
var mediaItemType = identifier.mediaItemType;
|
|
581
581
|
var isLazyWithOverride = izLazyOverride === undefined ? isLazy : izLazyOverride;
|
|
582
|
+
var isLazyPreview = fg('media-perf-lazy-loading-optimisation') ? preview === null || preview === void 0 ? void 0 : preview.lazy : true;
|
|
582
583
|
|
|
583
584
|
// We should natively lazy load an SSR preview when card is not visible,
|
|
584
585
|
// otherwise we'll fire the metadata fetch from outside the viewport
|
|
585
586
|
// Side note: We should not lazy load if the cardPreview is available from local cache,
|
|
586
587
|
// in order to avoid flickers during re-mount of the component
|
|
587
588
|
// CXP-2723 TODO: Create test cases for the above scenarios
|
|
588
|
-
var nativeLazyLoad = isLazyWithOverride && (fg('media-perf-uplift-mutation-fix') || !isCardVisible) && preview && isSSRPreview(preview);
|
|
589
|
+
var nativeLazyLoad = isLazyWithOverride && (fg('media-perf-uplift-mutation-fix') || !isCardVisible) && preview && isSSRPreview(preview) && isLazyPreview;
|
|
589
590
|
// Force Media Image to always display img for SSR
|
|
590
591
|
var forceSyncDisplay = !!ssr;
|
|
591
592
|
var card = /*#__PURE__*/React.createElement(CardView, {
|
|
@@ -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({
|
|
@@ -30,7 +30,7 @@ export var calculateDimensions = function calculateDimensions(imgElement, parent
|
|
|
30
30
|
var imgRatio = imgWidth / imgHeight;
|
|
31
31
|
var cardRatio = parentWidth / parentHeight;
|
|
32
32
|
if (fg('media-perf-uplift-mutation-fix')) {
|
|
33
|
-
var isSameRatio = roundedRatio(imgWidth / parentWidth) === roundedRatio(imgHeight / parentHeight);
|
|
33
|
+
var isSameRatio = fg('media-perf-ratio-calc-fix') ? Math.abs(imgWidth / parentWidth - imgHeight / parentHeight) < 0.1 : roundedRatio(imgWidth / parentWidth) === roundedRatio(imgHeight / parentHeight);
|
|
34
34
|
if (isSameRatio) {
|
|
35
35
|
if (resizeMode === 'stretchy-fit') {
|
|
36
36
|
return DEFAULT_STRETCHY_FIT_DIMENSIONS;
|
|
@@ -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
|
};
|
|
@@ -32,7 +32,7 @@ var createAndGetResourceObserver = function createAndGetResourceObserver() {
|
|
|
32
32
|
fileId: fileId,
|
|
33
33
|
mediaClientId: clientId,
|
|
34
34
|
featureFlags: {
|
|
35
|
-
'media-
|
|
35
|
+
'media-perf-lazy-loading-optimisation': fg('media-perf-lazy-loading-optimisation')
|
|
36
36
|
}
|
|
37
37
|
}, mediaDurationMetrics)
|
|
38
38
|
});
|
|
@@ -8,7 +8,7 @@ import { extractErrorInfo, getRenderErrorRequestMetadata } from './analytics';
|
|
|
8
8
|
import { MediaCardError } from '../errors';
|
|
9
9
|
import { getMediaEnvironment, getMediaRegion } from '@atlaskit/media-client';
|
|
10
10
|
var packageName = "@atlaskit/media-card";
|
|
11
|
-
var packageVersion = "
|
|
11
|
+
var packageVersion = "0.0.0-development";
|
|
12
12
|
var SAMPLE_RATE = 0.05;
|
|
13
13
|
var concurrentExperience;
|
|
14
14
|
var getExperience = function getExperience(id) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/media-card",
|
|
3
|
-
"version": "79.
|
|
3
|
+
"version": "79.9.1",
|
|
4
4
|
"description": "Includes all media card related components, CardView, CardViewSmall, Card...",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -39,10 +39,10 @@
|
|
|
39
39
|
"@atlaskit/media-client": "^35.6.0",
|
|
40
40
|
"@atlaskit/media-client-react": "^4.1.0",
|
|
41
41
|
"@atlaskit/media-common": "^12.3.0",
|
|
42
|
-
"@atlaskit/media-file-preview": "^0.
|
|
42
|
+
"@atlaskit/media-file-preview": "^0.15.0",
|
|
43
43
|
"@atlaskit/media-svg": "^2.1.0",
|
|
44
44
|
"@atlaskit/media-ui": "^28.7.0",
|
|
45
|
-
"@atlaskit/media-viewer": "^52.
|
|
45
|
+
"@atlaskit/media-viewer": "^52.5.0",
|
|
46
46
|
"@atlaskit/platform-feature-flags": "^1.1.0",
|
|
47
47
|
"@atlaskit/primitives": "^16.4.0",
|
|
48
48
|
"@atlaskit/react-ufo": "^4.15.0",
|
|
@@ -137,6 +137,12 @@
|
|
|
137
137
|
},
|
|
138
138
|
"media-perf-uplift-mutation-fix": {
|
|
139
139
|
"type": "boolean"
|
|
140
|
+
},
|
|
141
|
+
"media-perf-lazy-loading-optimisation": {
|
|
142
|
+
"type": "boolean"
|
|
143
|
+
},
|
|
144
|
+
"media-perf-ratio-calc-fix": {
|
|
145
|
+
"type": "boolean"
|
|
140
146
|
}
|
|
141
147
|
},
|
|
142
148
|
"techstack": {
|