@atlaskit/react-ufo 4.1.9 → 4.1.11

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.
@@ -155,10 +155,23 @@ export function addCustomTiming(interactionId, labelStack, data) {
155
155
  } = timingData;
156
156
  try {
157
157
  // for Firefox 102 and older
158
- performance.measure(`🛸 ${labelStackToString(labelStack, key)} [custom_timing]`, {
159
- start: startTime,
160
- end: endTime
161
- });
158
+ if (fg('ufo_chrome_devtools_uplift')) {
159
+ performance.measure(`🛸 ${labelStackToString(labelStack, key)} [custom_timing]`, {
160
+ start: startTime,
161
+ end: endTime,
162
+ detail: {
163
+ devtools: {
164
+ track: '🛸 reactUFO detailed timings',
165
+ color: 'tertiary-light'
166
+ }
167
+ }
168
+ });
169
+ } else {
170
+ performance.measure(`🛸 ${labelStackToString(labelStack, key)} [custom_timing]`, {
171
+ start: startTime,
172
+ end: endTime
173
+ });
174
+ }
162
175
  } catch (e) {
163
176
  // do nothing
164
177
  }
@@ -211,10 +224,23 @@ export function addSpan(interactionId, type, name, labelStack, start, end = perf
211
224
  if (isPerformanceTracingEnabled()) {
212
225
  try {
213
226
  // for Firefox 102 and older
214
- performance.measure(`🛸 ${labelStackToString(labelStack, name)} [${type}]`, {
215
- start,
216
- end
217
- });
227
+ if (fg('ufo_chrome_devtools_uplift')) {
228
+ performance.measure(`🛸 ${labelStackToString(labelStack, name)} [${type}]`, {
229
+ start,
230
+ end,
231
+ detail: {
232
+ devtools: {
233
+ track: '🛸 reactUFO detailed timings',
234
+ color: 'secondary'
235
+ }
236
+ }
237
+ });
238
+ } else {
239
+ performance.measure(`🛸 ${labelStackToString(labelStack, name)} [${type}]`, {
240
+ start,
241
+ end
242
+ });
243
+ }
218
244
  } catch (e) {
219
245
  // do nothing
220
246
  }
@@ -235,10 +261,23 @@ export function addSpanToAll(type, name, labelStack, start, end = performance.no
235
261
  if (isPerformanceTracingEnabled()) {
236
262
  try {
237
263
  // for Firefox 102 and older
238
- performance.measure(`🛸 ${labelStackToString(labelStack, name)} [${type}]`, {
239
- start,
240
- end
241
- });
264
+ if (fg('ufo_chrome_devtools_uplift')) {
265
+ performance.measure(`🛸 ${labelStackToString(labelStack, name)} [${type}]`, {
266
+ start,
267
+ end,
268
+ detail: {
269
+ devtools: {
270
+ track: '🛸 reactUFO detailed timings',
271
+ color: 'secondary'
272
+ }
273
+ }
274
+ });
275
+ } else {
276
+ performance.measure(`🛸 ${labelStackToString(labelStack, name)} [${type}]`, {
277
+ start,
278
+ end
279
+ });
280
+ }
242
281
  } catch (e) {
243
282
  // do nothing
244
283
  }
@@ -301,10 +340,23 @@ export function addHold(interactionId, labelStack, name, experimental) {
301
340
  if (isPerformanceTracingEnabled()) {
302
341
  try {
303
342
  // for Firefox 102 and older
304
- performance.measure(`🛸 ${labelStackToString(labelStack, name)} [hold]`, {
305
- start,
306
- end
307
- });
343
+ if (fg('ufo_chrome_devtools_uplift')) {
344
+ performance.measure(`🛸 ${labelStackToString(labelStack, name)} [hold]`, {
345
+ start,
346
+ end,
347
+ detail: {
348
+ devtools: {
349
+ track: '🛸 reactUFO detailed timings',
350
+ color: 'secondary-light'
351
+ }
352
+ }
353
+ });
354
+ } else {
355
+ performance.measure(`🛸 ${labelStackToString(labelStack, name)} [hold]`, {
356
+ start,
357
+ end
358
+ });
359
+ }
308
360
  } catch (e) {
309
361
  // do nothing
310
362
  }
@@ -434,10 +486,23 @@ export function addProfilerTimings(interactionId, labelStack, type, actualDurati
434
486
  if (isPerformanceTracingEnabled()) {
435
487
  try {
436
488
  // for Firefox 102 and older
437
- performance.measure(`🛸 ${labelStackToString(labelStack)} [react-profiler] ${type}`, {
438
- start: startTime,
439
- duration: actualDuration
440
- });
489
+ if (fg('ufo_chrome_devtools_uplift')) {
490
+ performance.measure(`🛸 ${labelStackToString(labelStack)} [react-profiler] ${type}`, {
491
+ start: startTime,
492
+ duration: actualDuration,
493
+ detail: {
494
+ devtools: {
495
+ track: '🛸 reactUFO detailed timings',
496
+ color: 'secondary-dark'
497
+ }
498
+ }
499
+ });
500
+ } else {
501
+ performance.measure(`🛸 ${labelStackToString(labelStack)} [react-profiler] ${type}`, {
502
+ start: startTime,
503
+ duration: actualDuration
504
+ });
505
+ }
441
506
  } catch (e) {
442
507
  // do nothing
443
508
  }
@@ -473,10 +538,24 @@ function finishInteraction(id, data, endTime = performance.now()) {
473
538
  data.end = endTime;
474
539
  try {
475
540
  // for Firefox 102 and older
476
- performance.measure(`🛸 [${data.type}] ${data.ufoName} [ttai]`, {
477
- start: data.start,
478
- end: data.end
479
- });
541
+ if (fg('ufo_chrome_devtools_uplift')) {
542
+ performance.measure(`🛸 [${data.type}] ${data.ufoName} [ttai]`, {
543
+ start: data.start,
544
+ end: data.end,
545
+ detail: {
546
+ devtools: {
547
+ track: 'main metrics',
548
+ trackGroup: '🛸 reactUFO metrics',
549
+ color: 'tertiary'
550
+ }
551
+ }
552
+ });
553
+ } else {
554
+ performance.measure(`🛸 [${data.type}] ${data.ufoName} [ttai]`, {
555
+ start: data.start,
556
+ end: data.end
557
+ });
558
+ }
480
559
  } catch (e) {
481
560
  // do nothing
482
561
  }
@@ -521,10 +600,23 @@ function finishInteraction(id, data, endTime = performance.now()) {
521
600
  start,
522
601
  end
523
602
  }] of profilerTimingMap.entries()) {
524
- performance.measure(`🛸 ${labelStackToString(labelStack)} [segment_ttai]`, {
525
- start,
526
- end
527
- });
603
+ if (fg('ufo_chrome_devtools_uplift')) {
604
+ performance.measure(`🛸 ${labelStackToString(labelStack)} [segment_ttai]`, {
605
+ start,
606
+ end,
607
+ detail: {
608
+ devtools: {
609
+ track: '🛸 reactUFO detailed timings',
610
+ color: 'secondary-dark'
611
+ }
612
+ }
613
+ });
614
+ } else {
615
+ performance.measure(`🛸 ${labelStackToString(labelStack)} [segment_ttai]`, {
616
+ start,
617
+ end
618
+ });
619
+ }
528
620
  }
529
621
  } catch (e) {
530
622
  // do nothing
@@ -815,12 +907,27 @@ export function addApdexToAll(apdex) {
815
907
  interactions.forEach((interaction, key) => {
816
908
  interaction.apdex.push(apdex);
817
909
  try {
818
- var _apdex$startTime;
819
910
  // for Firefox 102 and older
820
- performance.measure(`🛸 ${apdex.key} [bm3_tti]`, {
821
- start: (_apdex$startTime = apdex.startTime) !== null && _apdex$startTime !== void 0 ? _apdex$startTime : interaction.start,
822
- end: apdex.stopTime
823
- });
911
+ if (fg('ufo_chrome_devtools_uplift')) {
912
+ var _apdex$startTime;
913
+ performance.measure(`🛸 ${apdex.key} [bm3_tti]`, {
914
+ start: (_apdex$startTime = apdex.startTime) !== null && _apdex$startTime !== void 0 ? _apdex$startTime : interaction.start,
915
+ end: apdex.stopTime,
916
+ detail: {
917
+ devtools: {
918
+ track: 'main metrics',
919
+ trackGroup: '🛸 reactUFO metrics',
920
+ color: 'primary-dark'
921
+ }
922
+ }
923
+ });
924
+ } else {
925
+ var _apdex$startTime2;
926
+ performance.measure(`🛸 ${apdex.key} [bm3_tti]`, {
927
+ start: (_apdex$startTime2 = apdex.startTime) !== null && _apdex$startTime2 !== void 0 ? _apdex$startTime2 : interaction.start,
928
+ end: apdex.stopTime
929
+ });
930
+ }
824
931
  } catch (e) {
825
932
  // do nothing
826
933
  }
@@ -834,12 +941,27 @@ export function addApdex(interactionId, apdexInfo) {
834
941
  if (interaction != null) {
835
942
  interaction.apdex.push(apdexInfo);
836
943
  try {
837
- var _apdexInfo$startTime;
838
944
  // for Firefox 102 and older
839
- performance.measure(`🛸 ${apdexInfo.key} [bm3_tti]`, {
840
- start: (_apdexInfo$startTime = apdexInfo.startTime) !== null && _apdexInfo$startTime !== void 0 ? _apdexInfo$startTime : interaction.start,
841
- end: apdexInfo.stopTime
842
- });
945
+ if (fg('ufo_chrome_devtools_uplift')) {
946
+ var _apdexInfo$startTime;
947
+ performance.measure(`🛸 ${apdexInfo.key} [bm3_tti]`, {
948
+ start: (_apdexInfo$startTime = apdexInfo.startTime) !== null && _apdexInfo$startTime !== void 0 ? _apdexInfo$startTime : interaction.start,
949
+ end: apdexInfo.stopTime,
950
+ detail: {
951
+ devtools: {
952
+ track: 'main metrics',
953
+ trackGroup: '🛸 reactUFO metrics',
954
+ color: 'primary-dark'
955
+ }
956
+ }
957
+ });
958
+ } else {
959
+ var _apdexInfo$startTime2;
960
+ performance.measure(`🛸 ${apdexInfo.key} [bm3_tti]`, {
961
+ start: (_apdexInfo$startTime2 = apdexInfo.startTime) !== null && _apdexInfo$startTime2 !== void 0 ? _apdexInfo$startTime2 : interaction.start,
962
+ end: apdexInfo.stopTime
963
+ });
964
+ }
843
965
  } catch (e) {
844
966
  // do nothing
845
967
  }
@@ -903,12 +1025,26 @@ export function addRedirect(interactionId, fromUfoName, nextUfoName, nextRouteNa
903
1025
  if (isPerformanceTracingEnabled()) {
904
1026
  const prevRedirect = interaction.redirects.at(-2);
905
1027
  try {
906
- var _prevRedirect$time;
907
1028
  // for Firefox 102 and older
908
- performance.measure(`🛸 ${nextUfoName} [redirect]`, {
909
- start: (_prevRedirect$time = prevRedirect === null || prevRedirect === void 0 ? void 0 : prevRedirect.time) !== null && _prevRedirect$time !== void 0 ? _prevRedirect$time : interaction.start,
910
- end: time
911
- });
1029
+ if (fg('ufo_chrome_devtools_uplift')) {
1030
+ var _prevRedirect$time;
1031
+ performance.measure(`🛸 ${nextUfoName} [redirect]`, {
1032
+ start: (_prevRedirect$time = prevRedirect === null || prevRedirect === void 0 ? void 0 : prevRedirect.time) !== null && _prevRedirect$time !== void 0 ? _prevRedirect$time : interaction.start,
1033
+ end: time,
1034
+ detail: {
1035
+ devtools: {
1036
+ track: '🛸 reactUFO detailed timings',
1037
+ color: 'tertiary'
1038
+ }
1039
+ }
1040
+ });
1041
+ } else {
1042
+ var _prevRedirect$time2;
1043
+ performance.measure(`🛸 ${nextUfoName} [redirect]`, {
1044
+ start: (_prevRedirect$time2 = prevRedirect === null || prevRedirect === void 0 ? void 0 : prevRedirect.time) !== null && _prevRedirect$time2 !== void 0 ? _prevRedirect$time2 : interaction.start,
1045
+ end: time
1046
+ });
1047
+ }
912
1048
  } catch (e) {
913
1049
  // do nothing
914
1050
  }
@@ -1,4 +1,5 @@
1
1
  var _process, _process$env;
2
+ import { fg } from '@atlaskit/platform-feature-flags';
2
3
  import { isVCRevisionEnabled } from '../config';
3
4
  import { VCObserverNOOP } from './no-op-vc-observer';
4
5
  import { VCObserver } from './vc-observer';
@@ -111,6 +112,7 @@ export class VCObserverWrapper {
111
112
  interactionId: param.interactionId,
112
113
  ssr: param.includeSSRInV3 ? param.ssr : undefined
113
114
  })) : [];
115
+ fg('ufo_chrome_devtools_uplift') && this.addPerformanceMeasures(param.start, [...((v1v2Result === null || v1v2Result === void 0 ? void 0 : v1v2Result['ufo:vc:rev']) || []), ...(v3Result !== null && v3Result !== void 0 ? v3Result : [])]);
114
116
  if (!v3Result) {
115
117
  return v1v2Result !== null && v1v2Result !== void 0 ? v1v2Result : {};
116
118
  }
@@ -137,6 +139,46 @@ export class VCObserverWrapper {
137
139
  collectSSRPlaceholders() {
138
140
  this.ssrPlaceholderHandler.collectExistingPlaceholders();
139
141
  }
142
+ addPerformanceMeasures(start, measures) {
143
+ try {
144
+ measures.forEach(entry => {
145
+ var _entry$vcDetails, _entry$vcDetails$;
146
+ if (!entry || !entry.vcDetails) {
147
+ return;
148
+ }
149
+ const VCParts = Object.keys(entry.vcDetails);
150
+ performance.measure(`VC90 (${entry.revision})`, {
151
+ start,
152
+ duration: (_entry$vcDetails = entry.vcDetails) === null || _entry$vcDetails === void 0 ? void 0 : (_entry$vcDetails$ = _entry$vcDetails['90']) === null || _entry$vcDetails$ === void 0 ? void 0 : _entry$vcDetails$.t,
153
+ detail: {
154
+ devtools: {
155
+ track: `main metrics`,
156
+ trackGroup: '🛸 reactUFO metrics',
157
+ color: 'tertiary'
158
+ }
159
+ }
160
+ });
161
+ VCParts.forEach(key => {
162
+ var _entry$vcDetails2;
163
+ const duration = (_entry$vcDetails2 = entry.vcDetails) === null || _entry$vcDetails2 === void 0 ? void 0 : _entry$vcDetails2[key].t;
164
+ if (typeof duration !== 'number') {
165
+ return;
166
+ }
167
+ performance.measure(`VC${key}`, {
168
+ start,
169
+ duration,
170
+ detail: {
171
+ devtools: {
172
+ track: `VC ${entry.revision}`,
173
+ trackGroup: '🛸 reactUFO metrics',
174
+ color: key === '90' ? 'tertiary' : 'primary-light'
175
+ }
176
+ }
177
+ });
178
+ });
179
+ });
180
+ } catch (error) {}
181
+ }
140
182
  }
141
183
 
142
184
  // Some products set this variable to indicate it is running in SSR
@@ -1,4 +1,5 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
+ import { fg } from '@atlaskit/platform-feature-flags';
2
3
  import { isVCRevisionEnabled } from '../../config';
3
4
  import { getActiveInteraction } from '../../interaction-metrics';
4
5
  import { attachAbortListeners } from './attachAbortListeners';
@@ -188,29 +189,35 @@ export class VCObserver {
188
189
  if (isTTVCv1Disabled) {
189
190
  const duration = vcNext.VC[key];
190
191
  if (duration !== null && duration !== undefined) {
191
- performance.measure(`VC${key}`, {
192
- start,
193
- duration
194
- });
195
- performance.measure(`VC_Next${key}`, {
196
- start,
197
- duration
198
- });
192
+ if (!fg('ufo_chrome_devtools_uplift')) {
193
+ performance.measure(`VC${key}`, {
194
+ start,
195
+ duration
196
+ });
197
+ performance.measure(`VC_Next${key}`, {
198
+ start,
199
+ duration
200
+ });
201
+ }
199
202
  }
200
203
  } else {
201
204
  const ttvcV1duration = VC[key];
202
205
  if (ttvcV1duration !== null && ttvcV1duration !== undefined) {
203
- performance.measure(`VC${key}`, {
204
- start,
205
- duration: ttvcV1duration
206
- });
206
+ if (!fg('ufo_chrome_devtools_uplift')) {
207
+ performance.measure(`VC${key}`, {
208
+ start,
209
+ duration: ttvcV1duration
210
+ });
211
+ }
207
212
  }
208
213
  const ttvcV2duration = vcNext.VC[key];
209
214
  if (ttvcV2duration !== null && ttvcV2duration !== undefined) {
210
- performance.measure(`VC_Next${key}`, {
211
- start,
212
- duration: ttvcV2duration
213
- });
215
+ if (!fg('ufo_chrome_devtools_uplift')) {
216
+ performance.measure(`VC_Next${key}`, {
217
+ start,
218
+ duration: ttvcV2duration
219
+ });
220
+ }
214
221
  }
215
222
  }
216
223
  });
@@ -1,5 +1,4 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
- import { fg } from '@atlaskit/platform-feature-flags';
3
2
  import { isContainedWithinMediaWrapper } from '../../vc-observer/media-wrapper/vc-utils';
4
3
  import isNonVisualStyleMutation from '../../vc-observer/observers/non-visual-styles/is-non-visual-style-mutation';
5
4
  import { RLLPlaceholderHandlers } from '../../vc-observer/observers/rll-placeholders';
@@ -41,19 +40,16 @@ const createElementMutationsWatcher = removedNodeRects => ({
41
40
  target,
42
41
  rect
43
42
  }) => {
44
- const isNoLsMarkerEnabled = fg('platform_vc_ignore_no_ls_mutation_marker');
45
43
  const isInIgnoreLsMarker = isInVCIgnoreIfNoLayoutShiftMarker(target);
46
- if (!isInIgnoreLsMarker && isNoLsMarkerEnabled) {
44
+ if (!isInIgnoreLsMarker) {
47
45
  return 'mutation:element';
48
46
  }
49
47
  const isRLLPlaceholder = RLLPlaceholderHandlers.getInstance().isRLLPlaceholderHydration(rect);
50
- if (isRLLPlaceholder && (!isNoLsMarkerEnabled || isInIgnoreLsMarker)) {
48
+ if (isRLLPlaceholder && isInIgnoreLsMarker) {
51
49
  return 'mutation:rll-placeholder';
52
50
  }
53
51
  const wasDeleted = removedNodeRects.some(nr => sameRectDimensions(nr, rect));
54
- // When fg('platform_vc_ignore_no_ls_mutation_marker') is not enabled,
55
- // no layout shift mutation is excluded as per existing fy25.03 logic
56
- if (wasDeleted && (!isNoLsMarkerEnabled || isInIgnoreLsMarker)) {
52
+ if (wasDeleted && isInIgnoreLsMarker) {
57
53
  return 'mutation:element-replacement';
58
54
  }
59
55
  return 'mutation:element';
@@ -111,7 +107,7 @@ export default class ViewportObserver {
111
107
  }
112
108
 
113
109
  // SSR hydration logic
114
- if (this.getSSRState && fg('platform_ufo_vc_v3_ssr_placeholder')) {
110
+ if (this.getSSRState) {
115
111
  const ssrState = this.getSSRState();
116
112
  const SSRStateEnum = {
117
113
  normal: 1,
@@ -140,7 +136,7 @@ export default class ViewportObserver {
140
136
  }
141
137
 
142
138
  // SSR placeholder logic - check and handle with await
143
- if (this.getSSRPlaceholderHandler && fg('platform_ufo_vc_v3_ssr_placeholder')) {
139
+ if (this.getSSRPlaceholderHandler) {
144
140
  const ssrPlaceholderHandler = this.getSSRPlaceholderHandler();
145
141
  if (ssrPlaceholderHandler) {
146
142
  if (ssrPlaceholderHandler.isPlaceholder(addedNode) || ssrPlaceholderHandler.isPlaceholderIgnored(addedNode)) {
@@ -171,11 +167,7 @@ export default class ViewportObserver {
171
167
  return n.isEqualNode(addedNode);
172
168
  });
173
169
  const isInIgnoreLsMarker = isInVCIgnoreIfNoLayoutShiftMarker(addedNode);
174
- const isNoLsMarkerEnabled = fg('platform_vc_ignore_no_ls_mutation_marker');
175
-
176
- // When fg('platform_vc_ignore_no_ls_mutation_marker') is not enabled,
177
- // no layout shift mutation is excluded as per existing fy25.03 logic
178
- if (sameDeletedNode && (!isNoLsMarkerEnabled || isInIgnoreLsMarker)) {
170
+ if (sameDeletedNode && isInIgnoreLsMarker) {
179
171
  var _this$intersectionObs5;
180
172
  (_this$intersectionObs5 = this.intersectionObserver) === null || _this$intersectionObs5 === void 0 ? void 0 : _this$intersectionObs5.watchAndTag(addedNode, 'mutation:remount');
181
173
  continue;