@atlaskit/react-ufo 2.2.3 → 2.3.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 +16 -0
- package/dist/cjs/create-payload/index.js +2 -2
- package/dist/cjs/vc/vc-observer/index.js +12 -12
- package/dist/cjs/vc/vc-observer/observers/index.js +10 -0
- package/dist/es2019/create-payload/index.js +2 -2
- package/dist/es2019/vc/vc-observer/index.js +12 -12
- package/dist/es2019/vc/vc-observer/observers/index.js +10 -0
- package/dist/esm/create-payload/index.js +2 -2
- package/dist/esm/vc/vc-observer/index.js +12 -12
- package/dist/esm/vc/vc-observer/observers/index.js +10 -0
- package/dist/types/common/vc/types.d.ts +2 -2
- package/dist/types/vc/vc-observer/index.d.ts +1 -1
- package/dist/types-ts4.5/common/vc/types.d.ts +2 -2
- package/dist/types-ts4.5/vc/vc-observer/index.d.ts +1 -1
- package/package.json +4 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @atlaskit/ufo-interaction-ignore
|
|
2
2
|
|
|
3
|
+
## 2.3.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#166517](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/166517)
|
|
8
|
+
[`c50bc0f9a3564`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/c50bc0f9a3564) -
|
|
9
|
+
Add VC calculations for without invisible elements
|
|
10
|
+
|
|
11
|
+
## 2.3.0
|
|
12
|
+
|
|
13
|
+
### Minor Changes
|
|
14
|
+
|
|
15
|
+
- [#164782](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/164782)
|
|
16
|
+
[`1be7ad59ff332`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/1be7ad59ff332) -
|
|
17
|
+
fixing ssr attribute in vc observer config
|
|
18
|
+
|
|
3
19
|
## 2.2.3
|
|
4
20
|
|
|
5
21
|
### Patch Changes
|
|
@@ -188,7 +188,7 @@ var getPaintMetrics = function getPaintMetrics(type) {
|
|
|
188
188
|
return metrics;
|
|
189
189
|
};
|
|
190
190
|
var getVCMetrics = function getVCMetrics(interaction) {
|
|
191
|
-
var _config$vc,
|
|
191
|
+
var _config$vc, _interaction$apdex;
|
|
192
192
|
var config = (0, _config.getConfig)();
|
|
193
193
|
if (!(config !== null && config !== void 0 && (_config$vc = config.vc) !== null && _config$vc !== void 0 && _config$vc.enabled)) {
|
|
194
194
|
return {};
|
|
@@ -196,7 +196,7 @@ var getVCMetrics = function getVCMetrics(interaction) {
|
|
|
196
196
|
if (interaction.type !== 'page_load' && interaction.type !== 'transition') {
|
|
197
197
|
return {};
|
|
198
198
|
}
|
|
199
|
-
var ssr = interaction.type === 'page_load' && config !== null && config !== void 0 &&
|
|
199
|
+
var ssr = interaction.type === 'page_load' && config !== null && config !== void 0 && config.ssr ? {
|
|
200
200
|
ssr: getSSRDoneTimeValue(config)
|
|
201
201
|
} : null;
|
|
202
202
|
_interactionMetrics.postInteractionLog.setVCObserverSSRConfig(ssr);
|
|
@@ -82,8 +82,8 @@ var VCObserver = exports.VCObserver = /*#__PURE__*/function () {
|
|
|
82
82
|
return {
|
|
83
83
|
abortReasonInfo: abortReasonInfo,
|
|
84
84
|
abortReason: _objectSpread({}, _this.abortReason),
|
|
85
|
-
heatmap: _this.
|
|
86
|
-
|
|
85
|
+
heatmap: _this.heatmap,
|
|
86
|
+
heatmapNext: _this.heatmapNext,
|
|
87
87
|
outOfBoundaryInfo: _this.outOfBoundaryInfo,
|
|
88
88
|
totalTime: Math.round(_this.totalTime + _this.observers.getTotalTime()),
|
|
89
89
|
componentsLog: _objectSpread({}, _this.componentsLog),
|
|
@@ -111,7 +111,7 @@ var VCObserver = exports.VCObserver = /*#__PURE__*/function () {
|
|
|
111
111
|
var abortReason = rawData.abortReason,
|
|
112
112
|
abortReasonInfo = rawData.abortReasonInfo,
|
|
113
113
|
heatmap = rawData.heatmap,
|
|
114
|
-
|
|
114
|
+
heatmapNext = rawData.heatmapNext,
|
|
115
115
|
outOfBoundaryInfo = rawData.outOfBoundaryInfo,
|
|
116
116
|
totalTime = rawData.totalTime,
|
|
117
117
|
componentsLog = rawData.componentsLog,
|
|
@@ -153,14 +153,14 @@ var VCObserver = exports.VCObserver = /*#__PURE__*/function () {
|
|
|
153
153
|
} catch (e) {
|
|
154
154
|
/* empty */
|
|
155
155
|
}
|
|
156
|
-
var
|
|
157
|
-
heatmap:
|
|
156
|
+
var vcNext = VCObserver.calculateVC({
|
|
157
|
+
heatmap: heatmapNext,
|
|
158
158
|
ssr: ssr,
|
|
159
159
|
componentsLog: _objectSpread({}, componentsLog),
|
|
160
160
|
viewport: viewport
|
|
161
161
|
});
|
|
162
162
|
var outOfBoundary = outOfBoundaryInfo ? (0, _defineProperty2.default)({}, "".concat(fullPrefix, "vc:oob"), outOfBoundaryInfo) : {};
|
|
163
|
-
//const oldDomUpdates = oldDomUpdatesEnabled ? { [`${fullPrefix}vc:old:dom`]:
|
|
163
|
+
//const oldDomUpdates = oldDomUpdatesEnabled ? { [`${fullPrefix}vc:old:dom`]: vcNext.VCBox } : {};
|
|
164
164
|
|
|
165
165
|
var stopTime = performance.now();
|
|
166
166
|
|
|
@@ -198,7 +198,7 @@ var VCObserver = exports.VCObserver = /*#__PURE__*/function () {
|
|
|
198
198
|
}
|
|
199
199
|
return _objectSpread(_objectSpread((_objectSpread2 = {
|
|
200
200
|
'metrics:vc': VC
|
|
201
|
-
}, (0, _defineProperty2.default)(_objectSpread2, "".concat(fullPrefix, "vc:state"), true), (0, _defineProperty2.default)(_objectSpread2, "".concat(fullPrefix, "vc:clean"), !abortReasonInfo), (0, _defineProperty2.default)(_objectSpread2, "".concat(fullPrefix, "vc:dom"), VCBox), (0, _defineProperty2.default)(_objectSpread2, "".concat(fullPrefix, "vc:updates"), VCEntries.rel.slice(0, 50)), (0, _defineProperty2.default)(_objectSpread2, "".concat(fullPrefix, "vc:size"), viewport), (0, _defineProperty2.default)(_objectSpread2, "".concat(fullPrefix, "vc:time"), Math.round(totalTime + (stopTime - startTime))), (0, _defineProperty2.default)(_objectSpread2, "".concat(fullPrefix, "vc:total"), totalPainted), (0, _defineProperty2.default)(_objectSpread2, "".concat(fullPrefix, "vc:ratios"), ratios), _objectSpread2), outOfBoundary), {}, (_objectSpread3 = {}, (0, _defineProperty2.default)(_objectSpread3, "".concat(fullPrefix, "vc:
|
|
201
|
+
}, (0, _defineProperty2.default)(_objectSpread2, "".concat(fullPrefix, "vc:state"), true), (0, _defineProperty2.default)(_objectSpread2, "".concat(fullPrefix, "vc:clean"), !abortReasonInfo), (0, _defineProperty2.default)(_objectSpread2, "".concat(fullPrefix, "vc:dom"), VCBox), (0, _defineProperty2.default)(_objectSpread2, "".concat(fullPrefix, "vc:updates"), VCEntries.rel.slice(0, 50)), (0, _defineProperty2.default)(_objectSpread2, "".concat(fullPrefix, "vc:size"), viewport), (0, _defineProperty2.default)(_objectSpread2, "".concat(fullPrefix, "vc:time"), Math.round(totalTime + (stopTime - startTime))), (0, _defineProperty2.default)(_objectSpread2, "".concat(fullPrefix, "vc:total"), totalPainted), (0, _defineProperty2.default)(_objectSpread2, "".concat(fullPrefix, "vc:ratios"), ratios), _objectSpread2), outOfBoundary), {}, (_objectSpread3 = {}, (0, _defineProperty2.default)(_objectSpread3, "".concat(fullPrefix, "vc:next"), vcNext.VC), (0, _defineProperty2.default)(_objectSpread3, "".concat(fullPrefix, "vc:ignored"), _this.getIgnoredElements(componentsLog)), _objectSpread3));
|
|
202
202
|
});
|
|
203
203
|
(0, _defineProperty2.default)(this, "handleUpdate", function (rawTime, intersectionRect, targetName, element, type, ignoreReason) {
|
|
204
204
|
_this.measureStart();
|
|
@@ -207,10 +207,10 @@ var VCObserver = exports.VCObserver = /*#__PURE__*/function () {
|
|
|
207
207
|
var mappedValues = _this.mapPixelsToHeatmap(intersectionRect.left, intersectionRect.top, intersectionRect.width, intersectionRect.height);
|
|
208
208
|
_this.vcRatios[targetName] = _this.getElementRatio(mappedValues);
|
|
209
209
|
if (!ignoreReason) {
|
|
210
|
-
_this.applyChangesToHeatMap(mappedValues, time, _this.
|
|
210
|
+
_this.applyChangesToHeatMap(mappedValues, time, _this.heatmapNext);
|
|
211
211
|
}
|
|
212
|
-
if (!ignoreReason && type !== 'attr') {
|
|
213
|
-
_this.applyChangesToHeatMap(mappedValues, time, _this.
|
|
212
|
+
if ((!ignoreReason || ignoreReason === 'not-visible') && type !== 'attr') {
|
|
213
|
+
_this.applyChangesToHeatMap(mappedValues, time, _this.heatmap);
|
|
214
214
|
}
|
|
215
215
|
if (!_this.componentsLog[time]) {
|
|
216
216
|
_this.componentsLog[time] = [];
|
|
@@ -307,7 +307,7 @@ var VCObserver = exports.VCObserver = /*#__PURE__*/function () {
|
|
|
307
307
|
}
|
|
308
308
|
});
|
|
309
309
|
this.heatmap = this.getCleanHeatmap();
|
|
310
|
-
this.
|
|
310
|
+
this.heatmapNext = this.getCleanHeatmap();
|
|
311
311
|
this.isPostInteraction = options.isPostInteraction || false;
|
|
312
312
|
}
|
|
313
313
|
(0, _createClass2.default)(VCObserver, [{
|
|
@@ -389,7 +389,7 @@ var VCObserver = exports.VCObserver = /*#__PURE__*/function () {
|
|
|
389
389
|
};
|
|
390
390
|
this.detachAbortListeners();
|
|
391
391
|
this.heatmap = this.getCleanHeatmap();
|
|
392
|
-
this.
|
|
392
|
+
this.heatmapNext = this.getCleanHeatmap();
|
|
393
393
|
this.totalTime = 0;
|
|
394
394
|
this.componentsLog = {};
|
|
395
395
|
this.vcRatios = {};
|
|
@@ -291,6 +291,16 @@ var Observers = exports.Observers = /*#__PURE__*/function () {
|
|
|
291
291
|
// ignore intersection report without recent mutation
|
|
292
292
|
return;
|
|
293
293
|
}
|
|
294
|
+
if ((0, _platformFeatureFlags.fg)('platform-ufo-invisible-element-vc-calculations')) {
|
|
295
|
+
var isVisible = target.checkVisibility({
|
|
296
|
+
contentVisibilityAuto: true,
|
|
297
|
+
opacityProperty: true,
|
|
298
|
+
visibilityProperty: true
|
|
299
|
+
});
|
|
300
|
+
if (!isVisible) {
|
|
301
|
+
data.ignoreReason = 'not-visible';
|
|
302
|
+
}
|
|
303
|
+
}
|
|
294
304
|
_this3.callbacks.forEach(function (callback) {
|
|
295
305
|
var elementName;
|
|
296
306
|
try {
|
|
@@ -165,7 +165,7 @@ const getPaintMetrics = type => {
|
|
|
165
165
|
return metrics;
|
|
166
166
|
};
|
|
167
167
|
const getVCMetrics = interaction => {
|
|
168
|
-
var _config$vc,
|
|
168
|
+
var _config$vc, _interaction$apdex, _interaction$apdex$;
|
|
169
169
|
const config = getConfig();
|
|
170
170
|
if (!(config !== null && config !== void 0 && (_config$vc = config.vc) !== null && _config$vc !== void 0 && _config$vc.enabled)) {
|
|
171
171
|
return {};
|
|
@@ -173,7 +173,7 @@ const getVCMetrics = interaction => {
|
|
|
173
173
|
if (interaction.type !== 'page_load' && interaction.type !== 'transition') {
|
|
174
174
|
return {};
|
|
175
175
|
}
|
|
176
|
-
const ssr = interaction.type === 'page_load' && config !== null && config !== void 0 &&
|
|
176
|
+
const ssr = interaction.type === 'page_load' && config !== null && config !== void 0 && config.ssr ? {
|
|
177
177
|
ssr: getSSRDoneTimeValue(config)
|
|
178
178
|
} : null;
|
|
179
179
|
postInteractionLog.setVCObserverSSRConfig(ssr);
|
|
@@ -65,8 +65,8 @@ export class VCObserver {
|
|
|
65
65
|
abortReason: {
|
|
66
66
|
...this.abortReason
|
|
67
67
|
},
|
|
68
|
-
heatmap: this.
|
|
69
|
-
|
|
68
|
+
heatmap: this.heatmap,
|
|
69
|
+
heatmapNext: this.heatmapNext,
|
|
70
70
|
outOfBoundaryInfo: this.outOfBoundaryInfo,
|
|
71
71
|
totalTime: Math.round(this.totalTime + this.observers.getTotalTime()),
|
|
72
72
|
componentsLog: {
|
|
@@ -99,7 +99,7 @@ export class VCObserver {
|
|
|
99
99
|
abortReason,
|
|
100
100
|
abortReasonInfo,
|
|
101
101
|
heatmap,
|
|
102
|
-
|
|
102
|
+
heatmapNext,
|
|
103
103
|
outOfBoundaryInfo,
|
|
104
104
|
totalTime,
|
|
105
105
|
componentsLog,
|
|
@@ -148,8 +148,8 @@ export class VCObserver {
|
|
|
148
148
|
} catch (e) {
|
|
149
149
|
/* empty */
|
|
150
150
|
}
|
|
151
|
-
const
|
|
152
|
-
heatmap:
|
|
151
|
+
const vcNext = VCObserver.calculateVC({
|
|
152
|
+
heatmap: heatmapNext,
|
|
153
153
|
ssr,
|
|
154
154
|
componentsLog: {
|
|
155
155
|
...componentsLog
|
|
@@ -159,7 +159,7 @@ export class VCObserver {
|
|
|
159
159
|
const outOfBoundary = outOfBoundaryInfo ? {
|
|
160
160
|
[`${fullPrefix}vc:oob`]: outOfBoundaryInfo
|
|
161
161
|
} : {};
|
|
162
|
-
//const oldDomUpdates = oldDomUpdatesEnabled ? { [`${fullPrefix}vc:old:dom`]:
|
|
162
|
+
//const oldDomUpdates = oldDomUpdatesEnabled ? { [`${fullPrefix}vc:old:dom`]: vcNext.VCBox } : {};
|
|
163
163
|
|
|
164
164
|
const stopTime = performance.now();
|
|
165
165
|
|
|
@@ -207,7 +207,7 @@ export class VCObserver {
|
|
|
207
207
|
[`${fullPrefix}vc:total`]: totalPainted,
|
|
208
208
|
[`${fullPrefix}vc:ratios`]: ratios,
|
|
209
209
|
...outOfBoundary,
|
|
210
|
-
[`${fullPrefix}vc:
|
|
210
|
+
[`${fullPrefix}vc:next`]: vcNext.VC,
|
|
211
211
|
//...oldDomUpdates,
|
|
212
212
|
[`${fullPrefix}vc:ignored`]: this.getIgnoredElements(componentsLog)
|
|
213
213
|
};
|
|
@@ -219,10 +219,10 @@ export class VCObserver {
|
|
|
219
219
|
const mappedValues = this.mapPixelsToHeatmap(intersectionRect.left, intersectionRect.top, intersectionRect.width, intersectionRect.height);
|
|
220
220
|
this.vcRatios[targetName] = this.getElementRatio(mappedValues);
|
|
221
221
|
if (!ignoreReason) {
|
|
222
|
-
this.applyChangesToHeatMap(mappedValues, time, this.
|
|
222
|
+
this.applyChangesToHeatMap(mappedValues, time, this.heatmapNext);
|
|
223
223
|
}
|
|
224
|
-
if (!ignoreReason && type !== 'attr') {
|
|
225
|
-
this.applyChangesToHeatMap(mappedValues, time, this.
|
|
224
|
+
if ((!ignoreReason || ignoreReason === 'not-visible') && type !== 'attr') {
|
|
225
|
+
this.applyChangesToHeatMap(mappedValues, time, this.heatmap);
|
|
226
226
|
}
|
|
227
227
|
if (!this.componentsLog[time]) {
|
|
228
228
|
this.componentsLog[time] = [];
|
|
@@ -319,7 +319,7 @@ export class VCObserver {
|
|
|
319
319
|
}
|
|
320
320
|
});
|
|
321
321
|
this.heatmap = this.getCleanHeatmap();
|
|
322
|
-
this.
|
|
322
|
+
this.heatmapNext = this.getCleanHeatmap();
|
|
323
323
|
this.isPostInteraction = options.isPostInteraction || false;
|
|
324
324
|
}
|
|
325
325
|
start({
|
|
@@ -461,7 +461,7 @@ export class VCObserver {
|
|
|
461
461
|
};
|
|
462
462
|
this.detachAbortListeners();
|
|
463
463
|
this.heatmap = this.getCleanHeatmap();
|
|
464
|
-
this.
|
|
464
|
+
this.heatmapNext = this.getCleanHeatmap();
|
|
465
465
|
this.totalTime = 0;
|
|
466
466
|
this.componentsLog = {};
|
|
467
467
|
this.vcRatios = {};
|
|
@@ -239,6 +239,16 @@ export class Observers {
|
|
|
239
239
|
// ignore intersection report without recent mutation
|
|
240
240
|
return;
|
|
241
241
|
}
|
|
242
|
+
if (fg('platform-ufo-invisible-element-vc-calculations')) {
|
|
243
|
+
const isVisible = target.checkVisibility({
|
|
244
|
+
contentVisibilityAuto: true,
|
|
245
|
+
opacityProperty: true,
|
|
246
|
+
visibilityProperty: true
|
|
247
|
+
});
|
|
248
|
+
if (!isVisible) {
|
|
249
|
+
data.ignoreReason = 'not-visible';
|
|
250
|
+
}
|
|
251
|
+
}
|
|
242
252
|
this.callbacks.forEach(callback => {
|
|
243
253
|
let elementName;
|
|
244
254
|
try {
|
|
@@ -178,7 +178,7 @@ var getPaintMetrics = function getPaintMetrics(type) {
|
|
|
178
178
|
return metrics;
|
|
179
179
|
};
|
|
180
180
|
var getVCMetrics = function getVCMetrics(interaction) {
|
|
181
|
-
var _config$vc,
|
|
181
|
+
var _config$vc, _interaction$apdex;
|
|
182
182
|
var config = getConfig();
|
|
183
183
|
if (!(config !== null && config !== void 0 && (_config$vc = config.vc) !== null && _config$vc !== void 0 && _config$vc.enabled)) {
|
|
184
184
|
return {};
|
|
@@ -186,7 +186,7 @@ var getVCMetrics = function getVCMetrics(interaction) {
|
|
|
186
186
|
if (interaction.type !== 'page_load' && interaction.type !== 'transition') {
|
|
187
187
|
return {};
|
|
188
188
|
}
|
|
189
|
-
var ssr = interaction.type === 'page_load' && config !== null && config !== void 0 &&
|
|
189
|
+
var ssr = interaction.type === 'page_load' && config !== null && config !== void 0 && config.ssr ? {
|
|
190
190
|
ssr: getSSRDoneTimeValue(config)
|
|
191
191
|
} : null;
|
|
192
192
|
postInteractionLog.setVCObserverSSRConfig(ssr);
|
|
@@ -75,8 +75,8 @@ export var VCObserver = /*#__PURE__*/function () {
|
|
|
75
75
|
return {
|
|
76
76
|
abortReasonInfo: abortReasonInfo,
|
|
77
77
|
abortReason: _objectSpread({}, _this.abortReason),
|
|
78
|
-
heatmap: _this.
|
|
79
|
-
|
|
78
|
+
heatmap: _this.heatmap,
|
|
79
|
+
heatmapNext: _this.heatmapNext,
|
|
80
80
|
outOfBoundaryInfo: _this.outOfBoundaryInfo,
|
|
81
81
|
totalTime: Math.round(_this.totalTime + _this.observers.getTotalTime()),
|
|
82
82
|
componentsLog: _objectSpread({}, _this.componentsLog),
|
|
@@ -104,7 +104,7 @@ export var VCObserver = /*#__PURE__*/function () {
|
|
|
104
104
|
var abortReason = rawData.abortReason,
|
|
105
105
|
abortReasonInfo = rawData.abortReasonInfo,
|
|
106
106
|
heatmap = rawData.heatmap,
|
|
107
|
-
|
|
107
|
+
heatmapNext = rawData.heatmapNext,
|
|
108
108
|
outOfBoundaryInfo = rawData.outOfBoundaryInfo,
|
|
109
109
|
totalTime = rawData.totalTime,
|
|
110
110
|
componentsLog = rawData.componentsLog,
|
|
@@ -146,14 +146,14 @@ export var VCObserver = /*#__PURE__*/function () {
|
|
|
146
146
|
} catch (e) {
|
|
147
147
|
/* empty */
|
|
148
148
|
}
|
|
149
|
-
var
|
|
150
|
-
heatmap:
|
|
149
|
+
var vcNext = VCObserver.calculateVC({
|
|
150
|
+
heatmap: heatmapNext,
|
|
151
151
|
ssr: ssr,
|
|
152
152
|
componentsLog: _objectSpread({}, componentsLog),
|
|
153
153
|
viewport: viewport
|
|
154
154
|
});
|
|
155
155
|
var outOfBoundary = outOfBoundaryInfo ? _defineProperty({}, "".concat(fullPrefix, "vc:oob"), outOfBoundaryInfo) : {};
|
|
156
|
-
//const oldDomUpdates = oldDomUpdatesEnabled ? { [`${fullPrefix}vc:old:dom`]:
|
|
156
|
+
//const oldDomUpdates = oldDomUpdatesEnabled ? { [`${fullPrefix}vc:old:dom`]: vcNext.VCBox } : {};
|
|
157
157
|
|
|
158
158
|
var stopTime = performance.now();
|
|
159
159
|
|
|
@@ -191,7 +191,7 @@ export var VCObserver = /*#__PURE__*/function () {
|
|
|
191
191
|
}
|
|
192
192
|
return _objectSpread(_objectSpread((_objectSpread2 = {
|
|
193
193
|
'metrics:vc': VC
|
|
194
|
-
}, _defineProperty(_objectSpread2, "".concat(fullPrefix, "vc:state"), true), _defineProperty(_objectSpread2, "".concat(fullPrefix, "vc:clean"), !abortReasonInfo), _defineProperty(_objectSpread2, "".concat(fullPrefix, "vc:dom"), VCBox), _defineProperty(_objectSpread2, "".concat(fullPrefix, "vc:updates"), VCEntries.rel.slice(0, 50)), _defineProperty(_objectSpread2, "".concat(fullPrefix, "vc:size"), viewport), _defineProperty(_objectSpread2, "".concat(fullPrefix, "vc:time"), Math.round(totalTime + (stopTime - startTime))), _defineProperty(_objectSpread2, "".concat(fullPrefix, "vc:total"), totalPainted), _defineProperty(_objectSpread2, "".concat(fullPrefix, "vc:ratios"), ratios), _objectSpread2), outOfBoundary), {}, (_objectSpread3 = {}, _defineProperty(_objectSpread3, "".concat(fullPrefix, "vc:
|
|
194
|
+
}, _defineProperty(_objectSpread2, "".concat(fullPrefix, "vc:state"), true), _defineProperty(_objectSpread2, "".concat(fullPrefix, "vc:clean"), !abortReasonInfo), _defineProperty(_objectSpread2, "".concat(fullPrefix, "vc:dom"), VCBox), _defineProperty(_objectSpread2, "".concat(fullPrefix, "vc:updates"), VCEntries.rel.slice(0, 50)), _defineProperty(_objectSpread2, "".concat(fullPrefix, "vc:size"), viewport), _defineProperty(_objectSpread2, "".concat(fullPrefix, "vc:time"), Math.round(totalTime + (stopTime - startTime))), _defineProperty(_objectSpread2, "".concat(fullPrefix, "vc:total"), totalPainted), _defineProperty(_objectSpread2, "".concat(fullPrefix, "vc:ratios"), ratios), _objectSpread2), outOfBoundary), {}, (_objectSpread3 = {}, _defineProperty(_objectSpread3, "".concat(fullPrefix, "vc:next"), vcNext.VC), _defineProperty(_objectSpread3, "".concat(fullPrefix, "vc:ignored"), _this.getIgnoredElements(componentsLog)), _objectSpread3));
|
|
195
195
|
});
|
|
196
196
|
_defineProperty(this, "handleUpdate", function (rawTime, intersectionRect, targetName, element, type, ignoreReason) {
|
|
197
197
|
_this.measureStart();
|
|
@@ -200,10 +200,10 @@ export var VCObserver = /*#__PURE__*/function () {
|
|
|
200
200
|
var mappedValues = _this.mapPixelsToHeatmap(intersectionRect.left, intersectionRect.top, intersectionRect.width, intersectionRect.height);
|
|
201
201
|
_this.vcRatios[targetName] = _this.getElementRatio(mappedValues);
|
|
202
202
|
if (!ignoreReason) {
|
|
203
|
-
_this.applyChangesToHeatMap(mappedValues, time, _this.
|
|
203
|
+
_this.applyChangesToHeatMap(mappedValues, time, _this.heatmapNext);
|
|
204
204
|
}
|
|
205
|
-
if (!ignoreReason && type !== 'attr') {
|
|
206
|
-
_this.applyChangesToHeatMap(mappedValues, time, _this.
|
|
205
|
+
if ((!ignoreReason || ignoreReason === 'not-visible') && type !== 'attr') {
|
|
206
|
+
_this.applyChangesToHeatMap(mappedValues, time, _this.heatmap);
|
|
207
207
|
}
|
|
208
208
|
if (!_this.componentsLog[time]) {
|
|
209
209
|
_this.componentsLog[time] = [];
|
|
@@ -300,7 +300,7 @@ export var VCObserver = /*#__PURE__*/function () {
|
|
|
300
300
|
}
|
|
301
301
|
});
|
|
302
302
|
this.heatmap = this.getCleanHeatmap();
|
|
303
|
-
this.
|
|
303
|
+
this.heatmapNext = this.getCleanHeatmap();
|
|
304
304
|
this.isPostInteraction = options.isPostInteraction || false;
|
|
305
305
|
}
|
|
306
306
|
_createClass(VCObserver, [{
|
|
@@ -382,7 +382,7 @@ export var VCObserver = /*#__PURE__*/function () {
|
|
|
382
382
|
};
|
|
383
383
|
this.detachAbortListeners();
|
|
384
384
|
this.heatmap = this.getCleanHeatmap();
|
|
385
|
-
this.
|
|
385
|
+
this.heatmapNext = this.getCleanHeatmap();
|
|
386
386
|
this.totalTime = 0;
|
|
387
387
|
this.componentsLog = {};
|
|
388
388
|
this.vcRatios = {};
|
|
@@ -284,6 +284,16 @@ export var Observers = /*#__PURE__*/function () {
|
|
|
284
284
|
// ignore intersection report without recent mutation
|
|
285
285
|
return;
|
|
286
286
|
}
|
|
287
|
+
if (fg('platform-ufo-invisible-element-vc-calculations')) {
|
|
288
|
+
var isVisible = target.checkVisibility({
|
|
289
|
+
contentVisibilityAuto: true,
|
|
290
|
+
opacityProperty: true,
|
|
291
|
+
visibilityProperty: true
|
|
292
|
+
});
|
|
293
|
+
if (!isVisible) {
|
|
294
|
+
data.ignoreReason = 'not-visible';
|
|
295
|
+
}
|
|
296
|
+
}
|
|
287
297
|
_this3.callbacks.forEach(function (callback) {
|
|
288
298
|
var elementName;
|
|
289
299
|
try {
|
|
@@ -18,7 +18,7 @@ export type VCRawDataType = {
|
|
|
18
18
|
abortReasonInfo: string | null;
|
|
19
19
|
abortReason: VCAbortReasonType;
|
|
20
20
|
heatmap: number[][];
|
|
21
|
-
|
|
21
|
+
heatmapNext: number[][];
|
|
22
22
|
outOfBoundaryInfo: string;
|
|
23
23
|
totalTime: number;
|
|
24
24
|
componentsLog: ComponentsLogType;
|
|
@@ -35,7 +35,7 @@ export type VCEntryType = {
|
|
|
35
35
|
vc: number;
|
|
36
36
|
elements: string[];
|
|
37
37
|
};
|
|
38
|
-
export type VCIgnoreReason = 'image' | 'ssr-hydration' | 'editor-lazy-node-view' | '';
|
|
38
|
+
export type VCIgnoreReason = 'image' | 'ssr-hydration' | 'editor-lazy-node-view' | 'not-visible' | '';
|
|
39
39
|
export type ComponentsLogEntry = {
|
|
40
40
|
targetName: string;
|
|
41
41
|
__debug__element: WeakRef<Element> | null;
|
|
@@ -18,7 +18,7 @@ export type VCRawDataType = {
|
|
|
18
18
|
abortReasonInfo: string | null;
|
|
19
19
|
abortReason: VCAbortReasonType;
|
|
20
20
|
heatmap: number[][];
|
|
21
|
-
|
|
21
|
+
heatmapNext: number[][];
|
|
22
22
|
outOfBoundaryInfo: string;
|
|
23
23
|
totalTime: number;
|
|
24
24
|
componentsLog: ComponentsLogType;
|
|
@@ -35,7 +35,7 @@ export type VCEntryType = {
|
|
|
35
35
|
vc: number;
|
|
36
36
|
elements: string[];
|
|
37
37
|
};
|
|
38
|
-
export type VCIgnoreReason = 'image' | 'ssr-hydration' | 'editor-lazy-node-view' | '';
|
|
38
|
+
export type VCIgnoreReason = 'image' | 'ssr-hydration' | 'editor-lazy-node-view' | 'not-visible' | '';
|
|
39
39
|
export type ComponentsLogEntry = {
|
|
40
40
|
targetName: string;
|
|
41
41
|
__debug__element: WeakRef<Element> | null;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/react-ufo",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.3.1",
|
|
4
4
|
"description": "Parts of React UFO that are publicly available",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -126,6 +126,9 @@
|
|
|
126
126
|
"platform-feature-flags": {
|
|
127
127
|
"platform_editor_ed-25557_lnv_add_ssr_placeholder": {
|
|
128
128
|
"type": "boolean"
|
|
129
|
+
},
|
|
130
|
+
"platform-ufo-invisible-element-vc-calculations": {
|
|
131
|
+
"type": "boolean"
|
|
129
132
|
}
|
|
130
133
|
}
|
|
131
134
|
}
|