@atlaskit/react-ufo 2.5.0 → 2.5.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 +16 -0
- package/dist/cjs/additional-payload/utils/lighthouse-metrics/utils/buffer/index.js +2 -4
- package/dist/cjs/common/constants.js +1 -0
- package/dist/cjs/interaction-metrics/index.js +1 -1
- package/dist/cjs/interaction-metrics/post-interaction-log.js +1 -2
- package/dist/cjs/vc/vc-observer/index.js +29 -32
- package/dist/cjs/vc/vc-observer/observers/editor-lnv/index.js +1 -2
- package/dist/cjs/vc/vc-observer/observers/editor-lnv/test-utils.js +1 -2
- package/dist/cjs/vc/vc-observer/observers/index.js +1 -2
- package/dist/cjs/vc/vc-observer/observers/ssr-placeholders/index.js +1 -2
- package/dist/es2019/common/constants.js +2 -0
- package/dist/es2019/interaction-metrics/index.js +1 -1
- package/dist/es2019/vc/vc-observer/index.js +19 -19
- package/dist/esm/additional-payload/utils/lighthouse-metrics/utils/buffer/index.js +2 -4
- package/dist/esm/common/constants.js +2 -0
- package/dist/esm/interaction-metrics/index.js +1 -1
- package/dist/esm/interaction-metrics/post-interaction-log.js +1 -2
- package/dist/esm/vc/vc-observer/index.js +29 -32
- package/dist/esm/vc/vc-observer/observers/editor-lnv/index.js +1 -2
- package/dist/esm/vc/vc-observer/observers/editor-lnv/test-utils.js +1 -2
- package/dist/esm/vc/vc-observer/observers/index.js +1 -2
- package/dist/esm/vc/vc-observer/observers/ssr-placeholders/index.js +1 -2
- package/dist/types/vc/vc-observer/index.d.ts +1 -1
- package/dist/types-ts4.5/vc/vc-observer/index.d.ts +1 -1
- package/package.json +1 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @atlaskit/ufo-interaction-ignore
|
|
2
2
|
|
|
3
|
+
## 2.5.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#179378](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/179378)
|
|
8
|
+
[`0c54148687bda`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/0c54148687bda) -
|
|
9
|
+
move filtering of components log to allow for ufo:vc:next observation
|
|
10
|
+
|
|
11
|
+
## 2.5.1
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- [#172505](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/172505)
|
|
16
|
+
[`e43cba2a879aa`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/e43cba2a879aa) -
|
|
17
|
+
Remove explicit jest extension with .toBeAccessible matcher
|
|
18
|
+
|
|
3
19
|
## 2.5.0
|
|
4
20
|
|
|
5
21
|
### Minor Changes
|
|
@@ -9,7 +9,6 @@ var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/cl
|
|
|
9
9
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
10
10
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
11
11
|
var _const = require("../../const");
|
|
12
|
-
var _EntriesBuffer;
|
|
13
12
|
var BufferWithMaxLength = exports.BufferWithMaxLength = /*#__PURE__*/function () {
|
|
14
13
|
function BufferWithMaxLength() {
|
|
15
14
|
var maxLength = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 1000;
|
|
@@ -18,7 +17,7 @@ var BufferWithMaxLength = exports.BufferWithMaxLength = /*#__PURE__*/function ()
|
|
|
18
17
|
(0, _defineProperty2.default)(this, "full", false);
|
|
19
18
|
this.maxLength = maxLength;
|
|
20
19
|
}
|
|
21
|
-
(0, _createClass2.default)(BufferWithMaxLength, [{
|
|
20
|
+
return (0, _createClass2.default)(BufferWithMaxLength, [{
|
|
22
21
|
key: "push",
|
|
23
22
|
value: function push(item) {
|
|
24
23
|
if (this.full || this.maxLength === this.buffer.length) {
|
|
@@ -33,6 +32,5 @@ var BufferWithMaxLength = exports.BufferWithMaxLength = /*#__PURE__*/function ()
|
|
|
33
32
|
return this.buffer;
|
|
34
33
|
}
|
|
35
34
|
}]);
|
|
36
|
-
return BufferWithMaxLength;
|
|
37
35
|
}();
|
|
38
|
-
var EntriesBuffer = exports.EntriesBuffer = (
|
|
36
|
+
var EntriesBuffer = exports.EntriesBuffer = (0, _defineProperty2.default)((0, _defineProperty2.default)({}, _const.PerformanceObserverEntryTypes.LongTask, new BufferWithMaxLength()), _const.PerformanceObserverEntryTypes.LayoutShift, new BufferWithMaxLength());
|
|
@@ -5,4 +5,5 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.REACT_UFO_VERSION = void 0;
|
|
7
7
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
8
|
+
// eslint-disable-next-line @atlaskit/platform/no-module-level-eval
|
|
8
9
|
var REACT_UFO_VERSION = exports.REACT_UFO_VERSION = (0, _platformFeatureFlags.fg)('enable-react-ufo-payload-segment-compressed') ? '2.0.0' : '1.0.1';
|
|
@@ -482,7 +482,7 @@ var finishInteraction = function finishInteraction(id, data) {
|
|
|
482
482
|
(0, _experienceTraceIdContext.clearActiveTrace)();
|
|
483
483
|
callCleanUpCallbacks(data);
|
|
484
484
|
if ((_getConfig3 = (0, _config.getConfig)()) !== null && _getConfig3 !== void 0 && (_getConfig3 = _getConfig3.vc) !== null && _getConfig3 !== void 0 && _getConfig3.stopVCAtInteractionFinish) {
|
|
485
|
-
data.vc = (0, _vc.getVCObserver)().getVCRawData(
|
|
485
|
+
data.vc = (0, _vc.getVCObserver)().getVCRawData();
|
|
486
486
|
}
|
|
487
487
|
remove(id);
|
|
488
488
|
PreviousInteractionLog.name = data.ufoName || 'unknown';
|
|
@@ -38,7 +38,7 @@ var PostInteractionLog = exports.default = /*#__PURE__*/function () {
|
|
|
38
38
|
*/
|
|
39
39
|
(0, _defineProperty2.default)(this, "sinkHandlerFn", function () {});
|
|
40
40
|
}
|
|
41
|
-
(0, _createClass2.default)(PostInteractionLog, [{
|
|
41
|
+
return (0, _createClass2.default)(PostInteractionLog, [{
|
|
42
42
|
key: "initializeVCObserver",
|
|
43
43
|
value: function initializeVCObserver(options) {
|
|
44
44
|
if (this.vcObserver === null) {
|
|
@@ -190,5 +190,4 @@ var PostInteractionLog = exports.default = /*#__PURE__*/function () {
|
|
|
190
190
|
}
|
|
191
191
|
}
|
|
192
192
|
}]);
|
|
193
|
-
return PostInteractionLog;
|
|
194
193
|
}();
|
|
@@ -71,7 +71,7 @@ var VCObserver = exports.VCObserver = /*#__PURE__*/function () {
|
|
|
71
71
|
var info = _this.abortReason.info !== '' ? " ".concat(_this.abortReason.info) : '';
|
|
72
72
|
return "".concat(_this.abortReason.reason).concat(info);
|
|
73
73
|
});
|
|
74
|
-
(0, _defineProperty2.default)(this, "getVCRawData", function (
|
|
74
|
+
(0, _defineProperty2.default)(this, "getVCRawData", function () {
|
|
75
75
|
_this.measureStart();
|
|
76
76
|
if (!_this.active) {
|
|
77
77
|
_this.measureStop();
|
|
@@ -80,20 +80,6 @@ var VCObserver = exports.VCObserver = /*#__PURE__*/function () {
|
|
|
80
80
|
_this.stop();
|
|
81
81
|
var abortReasonInfo = _this.getAbortReasonInfo();
|
|
82
82
|
_this.measureStop();
|
|
83
|
-
var componentsLog = {};
|
|
84
|
-
if (stopTime && (0, _platformFeatureFlags.fg)('ufo-remove-vc-component-observations-after-ttai')) {
|
|
85
|
-
Object.entries(_this.componentsLog).forEach(function (_ref3) {
|
|
86
|
-
var _ref4 = (0, _slicedToArray2.default)(_ref3, 2),
|
|
87
|
-
_timestamp = _ref4[0],
|
|
88
|
-
value = _ref4[1];
|
|
89
|
-
var timestamp = Number(_timestamp);
|
|
90
|
-
if (stopTime > timestamp) {
|
|
91
|
-
componentsLog[timestamp] = value;
|
|
92
|
-
}
|
|
93
|
-
});
|
|
94
|
-
} else {
|
|
95
|
-
componentsLog = _objectSpread({}, _this.componentsLog);
|
|
96
|
-
}
|
|
97
83
|
return {
|
|
98
84
|
abortReasonInfo: abortReasonInfo,
|
|
99
85
|
abortReason: _objectSpread({}, _this.abortReason),
|
|
@@ -101,25 +87,24 @@ var VCObserver = exports.VCObserver = /*#__PURE__*/function () {
|
|
|
101
87
|
heatmapNext: _this.heatmapNext,
|
|
102
88
|
outOfBoundaryInfo: _this.outOfBoundaryInfo,
|
|
103
89
|
totalTime: Math.round(_this.totalTime + _this.observers.getTotalTime()),
|
|
104
|
-
componentsLog: componentsLog,
|
|
90
|
+
componentsLog: _objectSpread({}, _this.componentsLog),
|
|
105
91
|
viewport: _objectSpread({}, _this.viewport),
|
|
106
92
|
oldDomUpdatesEnabled: _this.oldDomUpdatesEnabled,
|
|
107
93
|
devToolsEnabled: _this.devToolsEnabled,
|
|
108
94
|
ratios: _this.vcRatios
|
|
109
95
|
};
|
|
110
96
|
});
|
|
111
|
-
(0, _defineProperty2.default)(this, "getVCResult", function (
|
|
112
|
-
var
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
vc = _ref5.vc;
|
|
97
|
+
(0, _defineProperty2.default)(this, "getVCResult", function (_ref3) {
|
|
98
|
+
var start = _ref3.start,
|
|
99
|
+
stop = _ref3.stop,
|
|
100
|
+
tti = _ref3.tti,
|
|
101
|
+
prefix = _ref3.prefix,
|
|
102
|
+
ssr = _ref3.ssr,
|
|
103
|
+
vc = _ref3.vc;
|
|
119
104
|
var startTime = performance.now();
|
|
120
105
|
// add local measurement
|
|
121
106
|
var fullPrefix = prefix !== undefined && prefix !== '' ? "".concat(prefix, ":") : '';
|
|
122
|
-
var rawData = vc !== undefined ? vc : _this.getVCRawData(
|
|
107
|
+
var rawData = vc !== undefined ? vc : _this.getVCRawData();
|
|
123
108
|
if (rawData === null) {
|
|
124
109
|
return {};
|
|
125
110
|
}
|
|
@@ -134,14 +119,13 @@ var VCObserver = exports.VCObserver = /*#__PURE__*/function () {
|
|
|
134
119
|
devToolsEnabled = rawData.devToolsEnabled,
|
|
135
120
|
ratios = rawData.ratios;
|
|
136
121
|
if (abortReasonInfo !== null && abortReason.blocking) {
|
|
137
|
-
var _ref6;
|
|
138
122
|
// exposing data to devtools
|
|
139
123
|
try {
|
|
140
124
|
if (devToolsEnabled && !_this.isPostInteraction) {
|
|
141
125
|
window.__vcNotAvailableReason = abortReasonInfo;
|
|
142
126
|
}
|
|
143
127
|
} catch (e) {}
|
|
144
|
-
return
|
|
128
|
+
return (0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)({}, "".concat(fullPrefix, "vc:state"), false), "".concat(fullPrefix, "vc:abort:reason"), abortReasonInfo), "".concat(fullPrefix, "vc:abort:timestamp"), abortReason.timestamp);
|
|
145
129
|
}
|
|
146
130
|
var _VCObserver$calculate = VCObserver.calculateVC({
|
|
147
131
|
heatmap: heatmap,
|
|
@@ -168,10 +152,24 @@ var VCObserver = exports.VCObserver = /*#__PURE__*/function () {
|
|
|
168
152
|
} catch (e) {
|
|
169
153
|
/* empty */
|
|
170
154
|
}
|
|
155
|
+
var _componentsLog = {};
|
|
156
|
+
if ((0, _platformFeatureFlags.fg)('ufo-remove-vc-component-observations-after-ttai')) {
|
|
157
|
+
Object.entries(_this.componentsLog).forEach(function (_ref5) {
|
|
158
|
+
var _ref6 = (0, _slicedToArray2.default)(_ref5, 2),
|
|
159
|
+
_timestamp = _ref6[0],
|
|
160
|
+
value = _ref6[1];
|
|
161
|
+
var timestamp = Number(_timestamp);
|
|
162
|
+
if (stop > timestamp) {
|
|
163
|
+
_componentsLog[timestamp] = value;
|
|
164
|
+
}
|
|
165
|
+
});
|
|
166
|
+
} else {
|
|
167
|
+
_componentsLog = _objectSpread({}, componentsLog);
|
|
168
|
+
}
|
|
171
169
|
var vcNext = VCObserver.calculateVC({
|
|
172
170
|
heatmap: heatmapNext,
|
|
173
171
|
ssr: ssr,
|
|
174
|
-
componentsLog:
|
|
172
|
+
componentsLog: _componentsLog,
|
|
175
173
|
viewport: viewport
|
|
176
174
|
});
|
|
177
175
|
var outOfBoundary = outOfBoundaryInfo ? (0, _defineProperty2.default)({}, "".concat(fullPrefix, "vc:oob"), outOfBoundaryInfo) : {};
|
|
@@ -211,9 +209,9 @@ var VCObserver = exports.VCObserver = /*#__PURE__*/function () {
|
|
|
211
209
|
} catch (e) {
|
|
212
210
|
/* do nothing */
|
|
213
211
|
}
|
|
214
|
-
return _objectSpread(_objectSpread((
|
|
212
|
+
return _objectSpread(_objectSpread((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)({
|
|
215
213
|
'metrics:vc': VC
|
|
216
|
-
},
|
|
214
|
+
}, "".concat(fullPrefix, "vc:state"), true), "".concat(fullPrefix, "vc:clean"), !abortReasonInfo), "".concat(fullPrefix, "vc:dom"), VCBox), "".concat(fullPrefix, "vc:updates"), VCEntries.rel.slice(0, 50)), "".concat(fullPrefix, "vc:size"), viewport), "".concat(fullPrefix, "vc:time"), Math.round(totalTime + (stopTime - startTime))), "".concat(fullPrefix, "vc:total"), totalPainted), "".concat(fullPrefix, "vc:ratios"), ratios), outOfBoundary), {}, (0, _defineProperty2.default)((0, _defineProperty2.default)({}, "".concat(fullPrefix, "vc:next"), vcNext.VC), "".concat(fullPrefix, "vc:ignored"), _this.getIgnoredElements(componentsLog)));
|
|
217
215
|
});
|
|
218
216
|
(0, _defineProperty2.default)(this, "handleUpdate", function (rawTime, intersectionRect, targetName, element, type, ignoreReason) {
|
|
219
217
|
_this.measureStart();
|
|
@@ -325,7 +323,7 @@ var VCObserver = exports.VCObserver = /*#__PURE__*/function () {
|
|
|
325
323
|
this.heatmapNext = this.getCleanHeatmap();
|
|
326
324
|
this.isPostInteraction = options.isPostInteraction || false;
|
|
327
325
|
}
|
|
328
|
-
(0, _createClass2.default)(VCObserver, [{
|
|
326
|
+
return (0, _createClass2.default)(VCObserver, [{
|
|
329
327
|
key: "start",
|
|
330
328
|
value: function start(_ref10) {
|
|
331
329
|
var startTime = _ref10.startTime;
|
|
@@ -579,7 +577,6 @@ var VCObserver = exports.VCObserver = /*#__PURE__*/function () {
|
|
|
579
577
|
return vc;
|
|
580
578
|
}
|
|
581
579
|
}]);
|
|
582
|
-
return VCObserver;
|
|
583
580
|
}();
|
|
584
581
|
/** config * */
|
|
585
582
|
(0, _defineProperty2.default)(VCObserver, "VCParts", ['25', '50', '75', '80', '85', '90', '95', '98', '99']);
|
|
@@ -78,7 +78,7 @@ var EditorLnvHandler = exports.EditorLnvHandler = /*#__PURE__*/function () {
|
|
|
78
78
|
}).forEach(_this.intersectionObserverCallback);
|
|
79
79
|
});
|
|
80
80
|
}
|
|
81
|
-
(0, _createClass2.default)(EditorLnvHandler, [{
|
|
81
|
+
return (0, _createClass2.default)(EditorLnvHandler, [{
|
|
82
82
|
key: "shouldHandleAddedNode",
|
|
83
83
|
value: function shouldHandleAddedNode(el) {
|
|
84
84
|
var _el$dataset, _el$dataset2;
|
|
@@ -183,5 +183,4 @@ var EditorLnvHandler = exports.EditorLnvHandler = /*#__PURE__*/function () {
|
|
|
183
183
|
return Math.abs(a.width - b.width) < 1 && Math.abs(a.height - b.height) < 1;
|
|
184
184
|
}
|
|
185
185
|
}]);
|
|
186
|
-
return EditorLnvHandler;
|
|
187
186
|
}();
|
|
@@ -54,7 +54,7 @@ function createMockIntersectionObserver(cbRef) {
|
|
|
54
54
|
}));
|
|
55
55
|
};
|
|
56
56
|
}
|
|
57
|
-
(0, _createClass2.default)(_class, [{
|
|
57
|
+
return (0, _createClass2.default)(_class, [{
|
|
58
58
|
key: "observe",
|
|
59
59
|
value: function observe() {}
|
|
60
60
|
}, {
|
|
@@ -64,6 +64,5 @@ function createMockIntersectionObserver(cbRef) {
|
|
|
64
64
|
key: "disconnect",
|
|
65
65
|
value: function disconnect() {}
|
|
66
66
|
}]);
|
|
67
|
-
return _class;
|
|
68
67
|
}();
|
|
69
68
|
}
|
|
@@ -65,7 +65,7 @@ var Observers = exports.Observers = /*#__PURE__*/function () {
|
|
|
65
65
|
this.ssrPlaceholderHandler = new _ssrPlaceholders.SSRPlaceholderHandlers();
|
|
66
66
|
this.editorLnvHandler = new _editorLnv.EditorLnvHandler();
|
|
67
67
|
}
|
|
68
|
-
(0, _createClass2.default)(Observers, [{
|
|
68
|
+
return (0, _createClass2.default)(Observers, [{
|
|
69
69
|
key: "isBrowserSupported",
|
|
70
70
|
value: function isBrowserSupported() {
|
|
71
71
|
return typeof window.IntersectionObserver === 'function' && typeof window.MutationObserver === 'function';
|
|
@@ -301,5 +301,4 @@ var Observers = exports.Observers = /*#__PURE__*/function () {
|
|
|
301
301
|
this._startMeasureTimestamp = -1;
|
|
302
302
|
}
|
|
303
303
|
}]);
|
|
304
|
-
return Observers;
|
|
305
304
|
}();
|
|
@@ -89,7 +89,7 @@ var SSRPlaceholderHandlers = exports.SSRPlaceholderHandlers = /*#__PURE__*/funct
|
|
|
89
89
|
}
|
|
90
90
|
}
|
|
91
91
|
}
|
|
92
|
-
(0, _createClass2.default)(SSRPlaceholderHandlers, [{
|
|
92
|
+
return (0, _createClass2.default)(SSRPlaceholderHandlers, [{
|
|
93
93
|
key: "clear",
|
|
94
94
|
value: function clear() {
|
|
95
95
|
this.staticPlaceholders = new Map();
|
|
@@ -177,5 +177,4 @@ var SSRPlaceholderHandlers = exports.SSRPlaceholderHandlers = /*#__PURE__*/funct
|
|
|
177
177
|
return rect && Math.abs(rect.x - boundingClientRect.x) < EQUALITY_THRESHOLD && Math.abs(rect.y - boundingClientRect.y) < EQUALITY_THRESHOLD && Math.abs(rect.width - boundingClientRect.width) < EQUALITY_THRESHOLD && Math.abs(rect.height - boundingClientRect.height) < EQUALITY_THRESHOLD || false;
|
|
178
178
|
}
|
|
179
179
|
}]);
|
|
180
|
-
return SSRPlaceholderHandlers;
|
|
181
180
|
}();
|
|
@@ -411,7 +411,7 @@ const finishInteraction = (id, data, endTime = performance.now()) => {
|
|
|
411
411
|
clearActiveTrace();
|
|
412
412
|
callCleanUpCallbacks(data);
|
|
413
413
|
if ((_getConfig3 = getConfig()) !== null && _getConfig3 !== void 0 && (_getConfig3$vc = _getConfig3.vc) !== null && _getConfig3$vc !== void 0 && _getConfig3$vc.stopVCAtInteractionFinish) {
|
|
414
|
-
data.vc = getVCObserver().getVCRawData(
|
|
414
|
+
data.vc = getVCObserver().getVCRawData();
|
|
415
415
|
}
|
|
416
416
|
remove(id);
|
|
417
417
|
PreviousInteractionLog.name = data.ufoName || 'unknown';
|
|
@@ -52,7 +52,7 @@ export class VCObserver {
|
|
|
52
52
|
const info = this.abortReason.info !== '' ? ` ${this.abortReason.info}` : '';
|
|
53
53
|
return `${this.abortReason.reason}${info}`;
|
|
54
54
|
});
|
|
55
|
-
_defineProperty(this, "getVCRawData",
|
|
55
|
+
_defineProperty(this, "getVCRawData", () => {
|
|
56
56
|
this.measureStart();
|
|
57
57
|
if (!this.active) {
|
|
58
58
|
this.measureStop();
|
|
@@ -61,19 +61,6 @@ export class VCObserver {
|
|
|
61
61
|
this.stop();
|
|
62
62
|
const abortReasonInfo = this.getAbortReasonInfo();
|
|
63
63
|
this.measureStop();
|
|
64
|
-
let componentsLog = {};
|
|
65
|
-
if (stopTime && fg('ufo-remove-vc-component-observations-after-ttai')) {
|
|
66
|
-
Object.entries(this.componentsLog).forEach(([_timestamp, value]) => {
|
|
67
|
-
const timestamp = Number(_timestamp);
|
|
68
|
-
if (stopTime > timestamp) {
|
|
69
|
-
componentsLog[timestamp] = value;
|
|
70
|
-
}
|
|
71
|
-
});
|
|
72
|
-
} else {
|
|
73
|
-
componentsLog = {
|
|
74
|
-
...this.componentsLog
|
|
75
|
-
};
|
|
76
|
-
}
|
|
77
64
|
return {
|
|
78
65
|
abortReasonInfo,
|
|
79
66
|
abortReason: {
|
|
@@ -83,7 +70,9 @@ export class VCObserver {
|
|
|
83
70
|
heatmapNext: this.heatmapNext,
|
|
84
71
|
outOfBoundaryInfo: this.outOfBoundaryInfo,
|
|
85
72
|
totalTime: Math.round(this.totalTime + this.observers.getTotalTime()),
|
|
86
|
-
componentsLog
|
|
73
|
+
componentsLog: {
|
|
74
|
+
...this.componentsLog
|
|
75
|
+
},
|
|
87
76
|
viewport: {
|
|
88
77
|
...this.viewport
|
|
89
78
|
},
|
|
@@ -103,7 +92,7 @@ export class VCObserver {
|
|
|
103
92
|
const startTime = performance.now();
|
|
104
93
|
// add local measurement
|
|
105
94
|
const fullPrefix = prefix !== undefined && prefix !== '' ? `${prefix}:` : '';
|
|
106
|
-
const rawData = vc !== undefined ? vc : this.getVCRawData(
|
|
95
|
+
const rawData = vc !== undefined ? vc : this.getVCRawData();
|
|
107
96
|
if (rawData === null) {
|
|
108
97
|
return {};
|
|
109
98
|
}
|
|
@@ -160,12 +149,23 @@ export class VCObserver {
|
|
|
160
149
|
} catch (e) {
|
|
161
150
|
/* empty */
|
|
162
151
|
}
|
|
152
|
+
let _componentsLog = {};
|
|
153
|
+
if (fg('ufo-remove-vc-component-observations-after-ttai')) {
|
|
154
|
+
Object.entries(this.componentsLog).forEach(([_timestamp, value]) => {
|
|
155
|
+
const timestamp = Number(_timestamp);
|
|
156
|
+
if (stop > timestamp) {
|
|
157
|
+
_componentsLog[timestamp] = value;
|
|
158
|
+
}
|
|
159
|
+
});
|
|
160
|
+
} else {
|
|
161
|
+
_componentsLog = {
|
|
162
|
+
...componentsLog
|
|
163
|
+
};
|
|
164
|
+
}
|
|
163
165
|
const vcNext = VCObserver.calculateVC({
|
|
164
166
|
heatmap: heatmapNext,
|
|
165
167
|
ssr,
|
|
166
|
-
componentsLog:
|
|
167
|
-
...componentsLog
|
|
168
|
-
},
|
|
168
|
+
componentsLog: _componentsLog,
|
|
169
169
|
viewport
|
|
170
170
|
});
|
|
171
171
|
const outOfBoundary = outOfBoundaryInfo ? {
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
2
2
|
import _createClass from "@babel/runtime/helpers/createClass";
|
|
3
3
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
4
|
-
var _EntriesBuffer;
|
|
5
4
|
import { PerformanceObserverEntryTypes } from '../../const';
|
|
6
5
|
export var BufferWithMaxLength = /*#__PURE__*/function () {
|
|
7
6
|
function BufferWithMaxLength() {
|
|
@@ -11,7 +10,7 @@ export var BufferWithMaxLength = /*#__PURE__*/function () {
|
|
|
11
10
|
_defineProperty(this, "full", false);
|
|
12
11
|
this.maxLength = maxLength;
|
|
13
12
|
}
|
|
14
|
-
_createClass(BufferWithMaxLength, [{
|
|
13
|
+
return _createClass(BufferWithMaxLength, [{
|
|
15
14
|
key: "push",
|
|
16
15
|
value: function push(item) {
|
|
17
16
|
if (this.full || this.maxLength === this.buffer.length) {
|
|
@@ -26,6 +25,5 @@ export var BufferWithMaxLength = /*#__PURE__*/function () {
|
|
|
26
25
|
return this.buffer;
|
|
27
26
|
}
|
|
28
27
|
}]);
|
|
29
|
-
return BufferWithMaxLength;
|
|
30
28
|
}();
|
|
31
|
-
export var EntriesBuffer = (
|
|
29
|
+
export var EntriesBuffer = _defineProperty(_defineProperty({}, PerformanceObserverEntryTypes.LongTask, new BufferWithMaxLength()), PerformanceObserverEntryTypes.LayoutShift, new BufferWithMaxLength());
|
|
@@ -439,7 +439,7 @@ var finishInteraction = function finishInteraction(id, data) {
|
|
|
439
439
|
clearActiveTrace();
|
|
440
440
|
callCleanUpCallbacks(data);
|
|
441
441
|
if ((_getConfig3 = getConfig()) !== null && _getConfig3 !== void 0 && (_getConfig3 = _getConfig3.vc) !== null && _getConfig3 !== void 0 && _getConfig3.stopVCAtInteractionFinish) {
|
|
442
|
-
data.vc = getVCObserver().getVCRawData(
|
|
442
|
+
data.vc = getVCObserver().getVCRawData();
|
|
443
443
|
}
|
|
444
444
|
remove(id);
|
|
445
445
|
PreviousInteractionLog.name = data.ufoName || 'unknown';
|
|
@@ -31,7 +31,7 @@ var PostInteractionLog = /*#__PURE__*/function () {
|
|
|
31
31
|
*/
|
|
32
32
|
_defineProperty(this, "sinkHandlerFn", function () {});
|
|
33
33
|
}
|
|
34
|
-
_createClass(PostInteractionLog, [{
|
|
34
|
+
return _createClass(PostInteractionLog, [{
|
|
35
35
|
key: "initializeVCObserver",
|
|
36
36
|
value: function initializeVCObserver(options) {
|
|
37
37
|
if (this.vcObserver === null) {
|
|
@@ -183,6 +183,5 @@ var PostInteractionLog = /*#__PURE__*/function () {
|
|
|
183
183
|
}
|
|
184
184
|
}
|
|
185
185
|
}]);
|
|
186
|
-
return PostInteractionLog;
|
|
187
186
|
}();
|
|
188
187
|
export { PostInteractionLog as default };
|
|
@@ -64,7 +64,7 @@ export var VCObserver = /*#__PURE__*/function () {
|
|
|
64
64
|
var info = _this.abortReason.info !== '' ? " ".concat(_this.abortReason.info) : '';
|
|
65
65
|
return "".concat(_this.abortReason.reason).concat(info);
|
|
66
66
|
});
|
|
67
|
-
_defineProperty(this, "getVCRawData", function (
|
|
67
|
+
_defineProperty(this, "getVCRawData", function () {
|
|
68
68
|
_this.measureStart();
|
|
69
69
|
if (!_this.active) {
|
|
70
70
|
_this.measureStop();
|
|
@@ -73,20 +73,6 @@ export var VCObserver = /*#__PURE__*/function () {
|
|
|
73
73
|
_this.stop();
|
|
74
74
|
var abortReasonInfo = _this.getAbortReasonInfo();
|
|
75
75
|
_this.measureStop();
|
|
76
|
-
var componentsLog = {};
|
|
77
|
-
if (stopTime && fg('ufo-remove-vc-component-observations-after-ttai')) {
|
|
78
|
-
Object.entries(_this.componentsLog).forEach(function (_ref3) {
|
|
79
|
-
var _ref4 = _slicedToArray(_ref3, 2),
|
|
80
|
-
_timestamp = _ref4[0],
|
|
81
|
-
value = _ref4[1];
|
|
82
|
-
var timestamp = Number(_timestamp);
|
|
83
|
-
if (stopTime > timestamp) {
|
|
84
|
-
componentsLog[timestamp] = value;
|
|
85
|
-
}
|
|
86
|
-
});
|
|
87
|
-
} else {
|
|
88
|
-
componentsLog = _objectSpread({}, _this.componentsLog);
|
|
89
|
-
}
|
|
90
76
|
return {
|
|
91
77
|
abortReasonInfo: abortReasonInfo,
|
|
92
78
|
abortReason: _objectSpread({}, _this.abortReason),
|
|
@@ -94,25 +80,24 @@ export var VCObserver = /*#__PURE__*/function () {
|
|
|
94
80
|
heatmapNext: _this.heatmapNext,
|
|
95
81
|
outOfBoundaryInfo: _this.outOfBoundaryInfo,
|
|
96
82
|
totalTime: Math.round(_this.totalTime + _this.observers.getTotalTime()),
|
|
97
|
-
componentsLog: componentsLog,
|
|
83
|
+
componentsLog: _objectSpread({}, _this.componentsLog),
|
|
98
84
|
viewport: _objectSpread({}, _this.viewport),
|
|
99
85
|
oldDomUpdatesEnabled: _this.oldDomUpdatesEnabled,
|
|
100
86
|
devToolsEnabled: _this.devToolsEnabled,
|
|
101
87
|
ratios: _this.vcRatios
|
|
102
88
|
};
|
|
103
89
|
});
|
|
104
|
-
_defineProperty(this, "getVCResult", function (
|
|
105
|
-
var
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
vc = _ref5.vc;
|
|
90
|
+
_defineProperty(this, "getVCResult", function (_ref3) {
|
|
91
|
+
var start = _ref3.start,
|
|
92
|
+
stop = _ref3.stop,
|
|
93
|
+
tti = _ref3.tti,
|
|
94
|
+
prefix = _ref3.prefix,
|
|
95
|
+
ssr = _ref3.ssr,
|
|
96
|
+
vc = _ref3.vc;
|
|
112
97
|
var startTime = performance.now();
|
|
113
98
|
// add local measurement
|
|
114
99
|
var fullPrefix = prefix !== undefined && prefix !== '' ? "".concat(prefix, ":") : '';
|
|
115
|
-
var rawData = vc !== undefined ? vc : _this.getVCRawData(
|
|
100
|
+
var rawData = vc !== undefined ? vc : _this.getVCRawData();
|
|
116
101
|
if (rawData === null) {
|
|
117
102
|
return {};
|
|
118
103
|
}
|
|
@@ -127,14 +112,13 @@ export var VCObserver = /*#__PURE__*/function () {
|
|
|
127
112
|
devToolsEnabled = rawData.devToolsEnabled,
|
|
128
113
|
ratios = rawData.ratios;
|
|
129
114
|
if (abortReasonInfo !== null && abortReason.blocking) {
|
|
130
|
-
var _ref6;
|
|
131
115
|
// exposing data to devtools
|
|
132
116
|
try {
|
|
133
117
|
if (devToolsEnabled && !_this.isPostInteraction) {
|
|
134
118
|
window.__vcNotAvailableReason = abortReasonInfo;
|
|
135
119
|
}
|
|
136
120
|
} catch (e) {}
|
|
137
|
-
return
|
|
121
|
+
return _defineProperty(_defineProperty(_defineProperty({}, "".concat(fullPrefix, "vc:state"), false), "".concat(fullPrefix, "vc:abort:reason"), abortReasonInfo), "".concat(fullPrefix, "vc:abort:timestamp"), abortReason.timestamp);
|
|
138
122
|
}
|
|
139
123
|
var _VCObserver$calculate = VCObserver.calculateVC({
|
|
140
124
|
heatmap: heatmap,
|
|
@@ -161,10 +145,24 @@ export var VCObserver = /*#__PURE__*/function () {
|
|
|
161
145
|
} catch (e) {
|
|
162
146
|
/* empty */
|
|
163
147
|
}
|
|
148
|
+
var _componentsLog = {};
|
|
149
|
+
if (fg('ufo-remove-vc-component-observations-after-ttai')) {
|
|
150
|
+
Object.entries(_this.componentsLog).forEach(function (_ref5) {
|
|
151
|
+
var _ref6 = _slicedToArray(_ref5, 2),
|
|
152
|
+
_timestamp = _ref6[0],
|
|
153
|
+
value = _ref6[1];
|
|
154
|
+
var timestamp = Number(_timestamp);
|
|
155
|
+
if (stop > timestamp) {
|
|
156
|
+
_componentsLog[timestamp] = value;
|
|
157
|
+
}
|
|
158
|
+
});
|
|
159
|
+
} else {
|
|
160
|
+
_componentsLog = _objectSpread({}, componentsLog);
|
|
161
|
+
}
|
|
164
162
|
var vcNext = VCObserver.calculateVC({
|
|
165
163
|
heatmap: heatmapNext,
|
|
166
164
|
ssr: ssr,
|
|
167
|
-
componentsLog:
|
|
165
|
+
componentsLog: _componentsLog,
|
|
168
166
|
viewport: viewport
|
|
169
167
|
});
|
|
170
168
|
var outOfBoundary = outOfBoundaryInfo ? _defineProperty({}, "".concat(fullPrefix, "vc:oob"), outOfBoundaryInfo) : {};
|
|
@@ -204,9 +202,9 @@ export var VCObserver = /*#__PURE__*/function () {
|
|
|
204
202
|
} catch (e) {
|
|
205
203
|
/* do nothing */
|
|
206
204
|
}
|
|
207
|
-
return _objectSpread(_objectSpread((
|
|
205
|
+
return _objectSpread(_objectSpread(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({
|
|
208
206
|
'metrics:vc': VC
|
|
209
|
-
},
|
|
207
|
+
}, "".concat(fullPrefix, "vc:state"), true), "".concat(fullPrefix, "vc:clean"), !abortReasonInfo), "".concat(fullPrefix, "vc:dom"), VCBox), "".concat(fullPrefix, "vc:updates"), VCEntries.rel.slice(0, 50)), "".concat(fullPrefix, "vc:size"), viewport), "".concat(fullPrefix, "vc:time"), Math.round(totalTime + (stopTime - startTime))), "".concat(fullPrefix, "vc:total"), totalPainted), "".concat(fullPrefix, "vc:ratios"), ratios), outOfBoundary), {}, _defineProperty(_defineProperty({}, "".concat(fullPrefix, "vc:next"), vcNext.VC), "".concat(fullPrefix, "vc:ignored"), _this.getIgnoredElements(componentsLog)));
|
|
210
208
|
});
|
|
211
209
|
_defineProperty(this, "handleUpdate", function (rawTime, intersectionRect, targetName, element, type, ignoreReason) {
|
|
212
210
|
_this.measureStart();
|
|
@@ -318,7 +316,7 @@ export var VCObserver = /*#__PURE__*/function () {
|
|
|
318
316
|
this.heatmapNext = this.getCleanHeatmap();
|
|
319
317
|
this.isPostInteraction = options.isPostInteraction || false;
|
|
320
318
|
}
|
|
321
|
-
_createClass(VCObserver, [{
|
|
319
|
+
return _createClass(VCObserver, [{
|
|
322
320
|
key: "start",
|
|
323
321
|
value: function start(_ref10) {
|
|
324
322
|
var startTime = _ref10.startTime;
|
|
@@ -572,7 +570,6 @@ export var VCObserver = /*#__PURE__*/function () {
|
|
|
572
570
|
return vc;
|
|
573
571
|
}
|
|
574
572
|
}]);
|
|
575
|
-
return VCObserver;
|
|
576
573
|
}();
|
|
577
574
|
/** config * */
|
|
578
575
|
_defineProperty(VCObserver, "VCParts", ['25', '50', '75', '80', '85', '90', '95', '98', '99']);
|
|
@@ -72,7 +72,7 @@ export var EditorLnvHandler = /*#__PURE__*/function () {
|
|
|
72
72
|
}).forEach(_this.intersectionObserverCallback);
|
|
73
73
|
});
|
|
74
74
|
}
|
|
75
|
-
_createClass(EditorLnvHandler, [{
|
|
75
|
+
return _createClass(EditorLnvHandler, [{
|
|
76
76
|
key: "shouldHandleAddedNode",
|
|
77
77
|
value: function shouldHandleAddedNode(el) {
|
|
78
78
|
var _el$dataset, _el$dataset2;
|
|
@@ -177,5 +177,4 @@ export var EditorLnvHandler = /*#__PURE__*/function () {
|
|
|
177
177
|
return Math.abs(a.width - b.width) < 1 && Math.abs(a.height - b.height) < 1;
|
|
178
178
|
}
|
|
179
179
|
}]);
|
|
180
|
-
return EditorLnvHandler;
|
|
181
180
|
}();
|
|
@@ -44,7 +44,7 @@ export function createMockIntersectionObserver(cbRef) {
|
|
|
44
44
|
}));
|
|
45
45
|
};
|
|
46
46
|
}
|
|
47
|
-
_createClass(_class, [{
|
|
47
|
+
return _createClass(_class, [{
|
|
48
48
|
key: "observe",
|
|
49
49
|
value: function observe() {}
|
|
50
50
|
}, {
|
|
@@ -54,6 +54,5 @@ export function createMockIntersectionObserver(cbRef) {
|
|
|
54
54
|
key: "disconnect",
|
|
55
55
|
value: function disconnect() {}
|
|
56
56
|
}]);
|
|
57
|
-
return _class;
|
|
58
57
|
}();
|
|
59
58
|
}
|
|
@@ -58,7 +58,7 @@ export var Observers = /*#__PURE__*/function () {
|
|
|
58
58
|
this.ssrPlaceholderHandler = new SSRPlaceholderHandlers();
|
|
59
59
|
this.editorLnvHandler = new EditorLnvHandler();
|
|
60
60
|
}
|
|
61
|
-
_createClass(Observers, [{
|
|
61
|
+
return _createClass(Observers, [{
|
|
62
62
|
key: "isBrowserSupported",
|
|
63
63
|
value: function isBrowserSupported() {
|
|
64
64
|
return typeof window.IntersectionObserver === 'function' && typeof window.MutationObserver === 'function';
|
|
@@ -294,5 +294,4 @@ export var Observers = /*#__PURE__*/function () {
|
|
|
294
294
|
this._startMeasureTimestamp = -1;
|
|
295
295
|
}
|
|
296
296
|
}]);
|
|
297
|
-
return Observers;
|
|
298
297
|
}();
|
|
@@ -82,7 +82,7 @@ export var SSRPlaceholderHandlers = /*#__PURE__*/function () {
|
|
|
82
82
|
}
|
|
83
83
|
}
|
|
84
84
|
}
|
|
85
|
-
_createClass(SSRPlaceholderHandlers, [{
|
|
85
|
+
return _createClass(SSRPlaceholderHandlers, [{
|
|
86
86
|
key: "clear",
|
|
87
87
|
value: function clear() {
|
|
88
88
|
this.staticPlaceholders = new Map();
|
|
@@ -170,5 +170,4 @@ export var SSRPlaceholderHandlers = /*#__PURE__*/function () {
|
|
|
170
170
|
return rect && Math.abs(rect.x - boundingClientRect.x) < EQUALITY_THRESHOLD && Math.abs(rect.y - boundingClientRect.y) < EQUALITY_THRESHOLD && Math.abs(rect.width - boundingClientRect.width) < EQUALITY_THRESHOLD && Math.abs(rect.height - boundingClientRect.height) < EQUALITY_THRESHOLD || false;
|
|
171
171
|
}
|
|
172
172
|
}]);
|
|
173
|
-
return SSRPlaceholderHandlers;
|
|
174
173
|
}();
|
|
@@ -48,7 +48,7 @@ export declare class VCObserver {
|
|
|
48
48
|
}): void;
|
|
49
49
|
stop(): void;
|
|
50
50
|
getAbortReasonInfo: () => string | null;
|
|
51
|
-
getVCRawData: (
|
|
51
|
+
getVCRawData: () => VCRawDataType | null;
|
|
52
52
|
getIgnoredElements(componentsLog: ComponentsLogType): {
|
|
53
53
|
targetName: string;
|
|
54
54
|
ignoreReason: VCIgnoreReason | undefined;
|
|
@@ -48,7 +48,7 @@ export declare class VCObserver {
|
|
|
48
48
|
}): void;
|
|
49
49
|
stop(): void;
|
|
50
50
|
getAbortReasonInfo: () => string | null;
|
|
51
|
-
getVCRawData: (
|
|
51
|
+
getVCRawData: () => VCRawDataType | null;
|
|
52
52
|
getIgnoredElements(componentsLog: ComponentsLogType): {
|
|
53
53
|
targetName: string;
|
|
54
54
|
ignoreReason: VCIgnoreReason | undefined;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/react-ufo",
|
|
3
|
-
"version": "2.5.
|
|
3
|
+
"version": "2.5.2",
|
|
4
4
|
"description": "Parts of React UFO that are publicly available",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -85,7 +85,6 @@
|
|
|
85
85
|
"react": "^16.8.0 || ^17.0.0 || ^18.0.0"
|
|
86
86
|
},
|
|
87
87
|
"devDependencies": {
|
|
88
|
-
"@atlassian/a11y-jest-testing": "*",
|
|
89
88
|
"@testing-library/react": "^12.1.5"
|
|
90
89
|
},
|
|
91
90
|
"techstack": {
|