@atlaskit/react-ufo 3.13.7 → 3.13.10

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.
@@ -0,0 +1,12 @@
1
+ ---
2
+ description:
3
+ globs:
4
+ alwaysApply: true
5
+ ---
6
+ # Feature Flagging
7
+ - Feature Gate is synonymous to feature flag
8
+ - To do fetaure gating first need to import `import { fg } from '@atlaskit/platform-feature-flags';`
9
+ - to evaluate fature gate: `fg('fg-name')` it returns boolean
10
+ - if fg is used in if, put the fg check as last condition of the if statement e.g. `if (a===b && fg('my_fg'))`
11
+ - feature gates need to be registered in [package.json](mdc:platform/packages/react-ufo/atlaskit/package.json)
12
+
@@ -0,0 +1,10 @@
1
+ ---
2
+ description:
3
+ globs:
4
+ alwaysApply: true
5
+ ---
6
+ ## Running Tests
7
+ - Unit tests: `cd platform && yarn test packages/react-ufo`
8
+ - Integration tests: Start dev server with `yarn start:rspack react-ufo`, then run `yarn test:integration packages/react-ufo/atlaskit/__tests__/ --retries 0 --reporter list --reuse-dev-server --project=desktop-chromium --max-failures=0`
9
+ - Specific test file: `yarn test <path-to-test-file>`
10
+ - Clear Jest cache if compilation issues: `yarn test <path> --clearCache`
@@ -0,0 +1,11 @@
1
+ ---
2
+ description:
3
+ globs:
4
+ alwaysApply: true
5
+ ---
6
+ # Integration test
7
+ - Integration tests: Start dev server with `yarn start:rspack react-ufo`, then run `yarn test:integration packages/react-ufo/atlaskit/__tests__/ --retries 0 --reporter list --reuse-dev-server --project=desktop-chromium --max-failures=0`
8
+ - integration test cases are located in `packages/react-ufo/atlaskit/__tests__`
9
+ - There are test helper in `packages/react-ufo/atlaskit/__tests__/fixtures.ts`
10
+ - Integration test run examples page in a browser using playwright then execute the test cases scenarios
11
+ - To determine which example page is run `test.use({ examplePage: 'exapmle-page-name' });`, which corresponds to file in `packages/react-ufo/atlaskit/examples`
package/CHANGELOG.md CHANGED
@@ -1,5 +1,32 @@
1
1
  # @atlaskit/ufo-interaction-ignore
2
2
 
3
+ ## 3.13.10
4
+
5
+ ### Patch Changes
6
+
7
+ - [#160800](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/160800)
8
+ [`3763aa7aadc8c`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/3763aa7aadc8c) -
9
+ AFO-3913 fix transitio VC v3 not reaching 100 in VC Chart
10
+
11
+ ## 3.13.9
12
+
13
+ ### Patch Changes
14
+
15
+ - [#161064](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/161064)
16
+ [`26461e98f0825`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/26461e98f0825) -
17
+ Fix enabling marking page-layour as a SSR placeholder
18
+ - [#161052](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/161052)
19
+ [`a16bd256e0ae6`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/a16bd256e0ae6) -
20
+ Clean up fg platform_ufo_use_offscreen_canvas
21
+
22
+ ## 3.13.8
23
+
24
+ ### Patch Changes
25
+
26
+ - [#160478](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/160478)
27
+ [`e79a796bb3b5a`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/e79a796bb3b5a) -
28
+ Add id to ttvc v3 attribute ignore list
29
+
3
30
  ## 3.13.7
4
31
 
5
32
  ### Patch Changes
@@ -95,7 +95,8 @@ function init(analyticsWebClientAsync, config) {
95
95
  heatmapSize: config.vc.heatmapSize,
96
96
  oldDomUpdates: config.vc.oldDomUpdates,
97
97
  devToolsEnabled: config.vc.devToolsEnabled,
98
- selectorConfig: config.vc.selectorConfig
98
+ selectorConfig: config.vc.selectorConfig,
99
+ ssrEnablePageLayoutPlaceholder: config.vc.ssrEnablePageLayoutPlaceholder
99
100
  };
100
101
  (0, _vc.getVCObserver)(vcOptions).start({
101
102
  startTime: 0
@@ -128,12 +128,15 @@ var VCObserverNew = exports.default = /*#__PURE__*/function () {
128
128
  case 0:
129
129
  start = param.start, stop = param.stop, interactionId = param.interactionId;
130
130
  results = [];
131
+ if ((0, _platformFeatureFlags.fg)('platform_ufo_v3_add_start_entry')) {
132
+ this.addStartEntry(start);
133
+ }
131
134
  calculator_fy25_03 = new _fy25_.default();
132
135
  orderedEntries = this.entriesTimeline.getOrderedEntries({
133
136
  start: start,
134
137
  stop: stop
135
138
  });
136
- _context.next = 6;
139
+ _context.next = 7;
137
140
  return calculator_fy25_03.calculate({
138
141
  orderedEntries: orderedEntries,
139
142
  startTime: start,
@@ -141,13 +144,13 @@ var VCObserverNew = exports.default = /*#__PURE__*/function () {
141
144
  interactionId: interactionId,
142
145
  isPostInteraction: this.isPostInteraction
143
146
  });
144
- case 6:
147
+ case 7:
145
148
  fy25_03 = _context.sent;
146
149
  if (fy25_03) {
147
150
  results.push(fy25_03);
148
151
  }
149
152
  return _context.abrupt("return", results);
150
- case 9:
153
+ case 10:
151
154
  case "end":
152
155
  return _context.stop();
153
156
  }
@@ -158,6 +161,40 @@ var VCObserverNew = exports.default = /*#__PURE__*/function () {
158
161
  }
159
162
  return getVCResult;
160
163
  }()
164
+ }, {
165
+ key: "addStartEntry",
166
+ value: function addStartEntry(startTime) {
167
+ this.entriesTimeline.push({
168
+ time: startTime,
169
+ data: {
170
+ type: 'mutation:element',
171
+ elementName: 'START',
172
+ visible: true,
173
+ rect: {
174
+ x: 0,
175
+ y: 0,
176
+ width: window.innerWidth,
177
+ height: window.innerHeight,
178
+ top: 0,
179
+ left: 0,
180
+ bottom: window.innerHeight,
181
+ right: window.innerWidth,
182
+ toJSON: function toJSON() {
183
+ return {
184
+ x: this.x,
185
+ y: this.y,
186
+ width: this.width,
187
+ height: this.height,
188
+ top: this.top,
189
+ left: this.left,
190
+ bottom: this.bottom,
191
+ right: this.right
192
+ };
193
+ }
194
+ }
195
+ }
196
+ });
197
+ }
161
198
  }, {
162
199
  key: "getElementName",
163
200
  value: function getElementName(element) {
@@ -47,7 +47,7 @@ var VCCalculator_FY25_03 = exports.default = /*#__PURE__*/function (_AbstractVCC
47
47
  if (attributeName === 'data-aui-version' && (0, _platformFeatureFlags.fg)('platform_ufo_filter_out_aui_attribute_changes')) {
48
48
  return false;
49
49
  }
50
- if ((attributeName === 'data-testid' || attributeName === 'data-vc' || attributeName === 'data-ssr-placeholder' || attributeName === 'data-ssr-placeholder-replace' || attributeName === 'data-vc-nvs' || attributeName === 'data-media-vc-wrapper' || attributeName === 'data-auto-scrollable' || NON_VISUAL_ARIA_ATTRIBUTES.includes(attributeName)) && (0, _platformFeatureFlags.fg)('platform_ufo_ignore_non_vis_attributes')) {
50
+ if ((attributeName === 'data-testid' || attributeName === 'data-vc' || attributeName === 'data-ssr-placeholder' || attributeName === 'data-ssr-placeholder-replace' || attributeName === 'data-vc-nvs' || attributeName === 'data-media-vc-wrapper' || attributeName === 'data-auto-scrollable' || attributeName === 'id' || attributeName === 'tabindex' || NON_VISUAL_ARIA_ATTRIBUTES.includes(attributeName)) && (0, _platformFeatureFlags.fg)('platform_ufo_ignore_non_vis_attributes')) {
51
51
  return false;
52
52
  }
53
53
  return true;
@@ -11,7 +11,6 @@ var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"))
11
11
  var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
12
12
  var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
13
13
  var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
14
- var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
15
14
  var _taskYield = _interopRequireDefault(require("../../utils/task-yield"));
16
15
  // 24-bit color value
17
16
  /**
@@ -65,20 +64,18 @@ var ViewportCanvas = exports.ViewportCanvas = /*#__PURE__*/function () {
65
64
  }
66
65
  this.ctx = ctx;
67
66
  this.ctx.globalCompositeOperation = 'source-over';
68
- if ((0, _platformFeatureFlags.fg)('platform_ufo_use_offscreen_canvas')) {
69
- this.ctx.imageSmoothingEnabled = false; // Disable image smoothing for better performance
70
- }
67
+ this.ctx.imageSmoothingEnabled = false; // Disable image smoothing for better performance
68
+
71
69
  this.clear();
72
70
  }
73
71
 
74
72
  /**
75
73
  * Creates a canvas instance, falling back to HTMLCanvasElement if OffscreenCanvas is not available
76
- * or if the feature flag is disabled
77
74
  */
78
75
  return (0, _createClass2.default)(ViewportCanvas, [{
79
76
  key: "createCanvas",
80
77
  value: function createCanvas(width, height) {
81
- if (typeof OffscreenCanvas !== 'undefined' && (0, _platformFeatureFlags.fg)('platform_ufo_use_offscreen_canvas')) {
78
+ if (typeof OffscreenCanvas !== 'undefined') {
82
79
  return new OffscreenCanvas(width, height);
83
80
  }
84
81
  var canvas = document.createElement('canvas');
@@ -84,7 +84,8 @@ export function init(analyticsWebClientAsync, config) {
84
84
  heatmapSize: config.vc.heatmapSize,
85
85
  oldDomUpdates: config.vc.oldDomUpdates,
86
86
  devToolsEnabled: config.vc.devToolsEnabled,
87
- selectorConfig: config.vc.selectorConfig
87
+ selectorConfig: config.vc.selectorConfig,
88
+ ssrEnablePageLayoutPlaceholder: config.vc.ssrEnablePageLayoutPlaceholder
88
89
  };
89
90
  getVCObserver(vcOptions).start({
90
91
  startTime: 0
@@ -103,6 +103,9 @@ export default class VCObserverNew {
103
103
  interactionId
104
104
  } = param;
105
105
  const results = [];
106
+ if (fg('platform_ufo_v3_add_start_entry')) {
107
+ this.addStartEntry(start);
108
+ }
106
109
  const calculator_fy25_03 = new VCCalculator_FY25_03();
107
110
  const orderedEntries = this.entriesTimeline.getOrderedEntries({
108
111
  start,
@@ -120,6 +123,38 @@ export default class VCObserverNew {
120
123
  }
121
124
  return results;
122
125
  }
126
+ addStartEntry(startTime) {
127
+ this.entriesTimeline.push({
128
+ time: startTime,
129
+ data: {
130
+ type: 'mutation:element',
131
+ elementName: 'START',
132
+ visible: true,
133
+ rect: {
134
+ x: 0,
135
+ y: 0,
136
+ width: window.innerWidth,
137
+ height: window.innerHeight,
138
+ top: 0,
139
+ left: 0,
140
+ bottom: window.innerHeight,
141
+ right: window.innerWidth,
142
+ toJSON: function () {
143
+ return {
144
+ x: this.x,
145
+ y: this.y,
146
+ width: this.width,
147
+ height: this.height,
148
+ top: this.top,
149
+ left: this.left,
150
+ bottom: this.bottom,
151
+ right: this.right
152
+ };
153
+ }
154
+ }
155
+ }
156
+ });
157
+ }
123
158
  getElementName(element) {
124
159
  return getElementName(this.selectorConfig, element);
125
160
  }
@@ -29,7 +29,7 @@ export default class VCCalculator_FY25_03 extends AbstractVCCalculatorBase {
29
29
  if (attributeName === 'data-aui-version' && fg('platform_ufo_filter_out_aui_attribute_changes')) {
30
30
  return false;
31
31
  }
32
- if ((attributeName === 'data-testid' || attributeName === 'data-vc' || attributeName === 'data-ssr-placeholder' || attributeName === 'data-ssr-placeholder-replace' || attributeName === 'data-vc-nvs' || attributeName === 'data-media-vc-wrapper' || attributeName === 'data-auto-scrollable' || NON_VISUAL_ARIA_ATTRIBUTES.includes(attributeName)) && fg('platform_ufo_ignore_non_vis_attributes')) {
32
+ if ((attributeName === 'data-testid' || attributeName === 'data-vc' || attributeName === 'data-ssr-placeholder' || attributeName === 'data-ssr-placeholder-replace' || attributeName === 'data-vc-nvs' || attributeName === 'data-media-vc-wrapper' || attributeName === 'data-auto-scrollable' || attributeName === 'id' || attributeName === 'tabindex' || NON_VISUAL_ARIA_ATTRIBUTES.includes(attributeName)) && fg('platform_ufo_ignore_non_vis_attributes')) {
33
33
  return false;
34
34
  }
35
35
  return true;
@@ -1,4 +1,3 @@
1
- import { fg } from '@atlaskit/platform-feature-flags';
2
1
  import taskYield from '../../utils/task-yield';
3
2
 
4
3
  // 24-bit color value
@@ -52,18 +51,16 @@ export class ViewportCanvas {
52
51
  }
53
52
  this.ctx = ctx;
54
53
  this.ctx.globalCompositeOperation = 'source-over';
55
- if (fg('platform_ufo_use_offscreen_canvas')) {
56
- this.ctx.imageSmoothingEnabled = false; // Disable image smoothing for better performance
57
- }
54
+ this.ctx.imageSmoothingEnabled = false; // Disable image smoothing for better performance
55
+
58
56
  this.clear();
59
57
  }
60
58
 
61
59
  /**
62
60
  * Creates a canvas instance, falling back to HTMLCanvasElement if OffscreenCanvas is not available
63
- * or if the feature flag is disabled
64
61
  */
65
62
  createCanvas(width, height) {
66
- if (typeof OffscreenCanvas !== 'undefined' && fg('platform_ufo_use_offscreen_canvas')) {
63
+ if (typeof OffscreenCanvas !== 'undefined') {
67
64
  return new OffscreenCanvas(width, height);
68
65
  }
69
66
  const canvas = document.createElement('canvas');
@@ -85,7 +85,8 @@ export function init(analyticsWebClientAsync, config) {
85
85
  heatmapSize: config.vc.heatmapSize,
86
86
  oldDomUpdates: config.vc.oldDomUpdates,
87
87
  devToolsEnabled: config.vc.devToolsEnabled,
88
- selectorConfig: config.vc.selectorConfig
88
+ selectorConfig: config.vc.selectorConfig,
89
+ ssrEnablePageLayoutPlaceholder: config.vc.ssrEnablePageLayoutPlaceholder
89
90
  };
90
91
  getVCObserver(vcOptions).start({
91
92
  startTime: 0
@@ -121,12 +121,15 @@ var VCObserverNew = /*#__PURE__*/function () {
121
121
  case 0:
122
122
  start = param.start, stop = param.stop, interactionId = param.interactionId;
123
123
  results = [];
124
+ if (fg('platform_ufo_v3_add_start_entry')) {
125
+ this.addStartEntry(start);
126
+ }
124
127
  calculator_fy25_03 = new VCCalculator_FY25_03();
125
128
  orderedEntries = this.entriesTimeline.getOrderedEntries({
126
129
  start: start,
127
130
  stop: stop
128
131
  });
129
- _context.next = 6;
132
+ _context.next = 7;
130
133
  return calculator_fy25_03.calculate({
131
134
  orderedEntries: orderedEntries,
132
135
  startTime: start,
@@ -134,13 +137,13 @@ var VCObserverNew = /*#__PURE__*/function () {
134
137
  interactionId: interactionId,
135
138
  isPostInteraction: this.isPostInteraction
136
139
  });
137
- case 6:
140
+ case 7:
138
141
  fy25_03 = _context.sent;
139
142
  if (fy25_03) {
140
143
  results.push(fy25_03);
141
144
  }
142
145
  return _context.abrupt("return", results);
143
- case 9:
146
+ case 10:
144
147
  case "end":
145
148
  return _context.stop();
146
149
  }
@@ -151,6 +154,40 @@ var VCObserverNew = /*#__PURE__*/function () {
151
154
  }
152
155
  return getVCResult;
153
156
  }()
157
+ }, {
158
+ key: "addStartEntry",
159
+ value: function addStartEntry(startTime) {
160
+ this.entriesTimeline.push({
161
+ time: startTime,
162
+ data: {
163
+ type: 'mutation:element',
164
+ elementName: 'START',
165
+ visible: true,
166
+ rect: {
167
+ x: 0,
168
+ y: 0,
169
+ width: window.innerWidth,
170
+ height: window.innerHeight,
171
+ top: 0,
172
+ left: 0,
173
+ bottom: window.innerHeight,
174
+ right: window.innerWidth,
175
+ toJSON: function toJSON() {
176
+ return {
177
+ x: this.x,
178
+ y: this.y,
179
+ width: this.width,
180
+ height: this.height,
181
+ top: this.top,
182
+ left: this.left,
183
+ bottom: this.bottom,
184
+ right: this.right
185
+ };
186
+ }
187
+ }
188
+ }
189
+ });
190
+ }
154
191
  }, {
155
192
  key: "getElementName",
156
193
  value: function getElementName(element) {
@@ -40,7 +40,7 @@ var VCCalculator_FY25_03 = /*#__PURE__*/function (_AbstractVCCalculator) {
40
40
  if (attributeName === 'data-aui-version' && fg('platform_ufo_filter_out_aui_attribute_changes')) {
41
41
  return false;
42
42
  }
43
- if ((attributeName === 'data-testid' || attributeName === 'data-vc' || attributeName === 'data-ssr-placeholder' || attributeName === 'data-ssr-placeholder-replace' || attributeName === 'data-vc-nvs' || attributeName === 'data-media-vc-wrapper' || attributeName === 'data-auto-scrollable' || NON_VISUAL_ARIA_ATTRIBUTES.includes(attributeName)) && fg('platform_ufo_ignore_non_vis_attributes')) {
43
+ if ((attributeName === 'data-testid' || attributeName === 'data-vc' || attributeName === 'data-ssr-placeholder' || attributeName === 'data-ssr-placeholder-replace' || attributeName === 'data-vc-nvs' || attributeName === 'data-media-vc-wrapper' || attributeName === 'data-auto-scrollable' || attributeName === 'id' || attributeName === 'tabindex' || NON_VISUAL_ARIA_ATTRIBUTES.includes(attributeName)) && fg('platform_ufo_ignore_non_vis_attributes')) {
44
44
  return false;
45
45
  }
46
46
  return true;
@@ -2,7 +2,6 @@ import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
2
2
  import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
3
3
  import _createClass from "@babel/runtime/helpers/createClass";
4
4
  import _regeneratorRuntime from "@babel/runtime/regenerator";
5
- import { fg } from '@atlaskit/platform-feature-flags';
6
5
  import taskYield from '../../utils/task-yield';
7
6
 
8
7
  // 24-bit color value
@@ -58,20 +57,18 @@ export var ViewportCanvas = /*#__PURE__*/function () {
58
57
  }
59
58
  this.ctx = ctx;
60
59
  this.ctx.globalCompositeOperation = 'source-over';
61
- if (fg('platform_ufo_use_offscreen_canvas')) {
62
- this.ctx.imageSmoothingEnabled = false; // Disable image smoothing for better performance
63
- }
60
+ this.ctx.imageSmoothingEnabled = false; // Disable image smoothing for better performance
61
+
64
62
  this.clear();
65
63
  }
66
64
 
67
65
  /**
68
66
  * Creates a canvas instance, falling back to HTMLCanvasElement if OffscreenCanvas is not available
69
- * or if the feature flag is disabled
70
67
  */
71
68
  return _createClass(ViewportCanvas, [{
72
69
  key: "createCanvas",
73
70
  value: function createCanvas(width, height) {
74
- if (typeof OffscreenCanvas !== 'undefined' && fg('platform_ufo_use_offscreen_canvas')) {
71
+ if (typeof OffscreenCanvas !== 'undefined') {
75
72
  return new OffscreenCanvas(width, height);
76
73
  }
77
74
  var canvas = document.createElement('canvas');
@@ -17,5 +17,6 @@ export default class VCObserverNew {
17
17
  }): void;
18
18
  stop(): void;
19
19
  getVCResult(param: VCObserverGetVCResultParam): Promise<RevisionPayloadEntry[]>;
20
+ private addStartEntry;
20
21
  private getElementName;
21
22
  }
@@ -32,7 +32,6 @@ export declare class ViewportCanvas {
32
32
  constructor(viewport: Viewport, scaleFactor?: number);
33
33
  /**
34
34
  * Creates a canvas instance, falling back to HTMLCanvasElement if OffscreenCanvas is not available
35
- * or if the feature flag is disabled
36
35
  */
37
36
  private createCanvas;
38
37
  getScaledDimensions(): {
@@ -17,5 +17,6 @@ export default class VCObserverNew {
17
17
  }): void;
18
18
  stop(): void;
19
19
  getVCResult(param: VCObserverGetVCResultParam): Promise<RevisionPayloadEntry[]>;
20
+ private addStartEntry;
20
21
  private getElementName;
21
22
  }
@@ -32,7 +32,6 @@ export declare class ViewportCanvas {
32
32
  constructor(viewport: Viewport, scaleFactor?: number);
33
33
  /**
34
34
  * Creates a canvas instance, falling back to HTMLCanvasElement if OffscreenCanvas is not available
35
- * or if the feature flag is disabled
36
35
  */
37
36
  private createCanvas;
38
37
  getScaledDimensions(): {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/react-ufo",
3
- "version": "3.13.7",
3
+ "version": "3.13.10",
4
4
  "description": "Parts of React UFO that are publicly available",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -127,9 +127,6 @@
127
127
  }
128
128
  },
129
129
  "platform-feature-flags": {
130
- "platform_ufo_use_offscreen_canvas": {
131
- "type": "boolean"
132
- },
133
130
  "platform_ufo_canvas_heatmap_full_precision": {
134
131
  "type": "boolean"
135
132
  },
@@ -168,6 +165,9 @@
168
165
  },
169
166
  "platform_ufo_ignore_non_vis_attributes": {
170
167
  "type": "boolean"
168
+ },
169
+ "platform_ufo_v3_add_start_entry": {
170
+ "type": "boolean"
171
171
  }
172
172
  }
173
173
  }