@atlaskit/react-ufo 4.5.1 → 4.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 CHANGED
@@ -1,5 +1,14 @@
1
1
  # @atlaskit/ufo-interaction-ignore
2
2
 
3
+ ## 4.5.2
4
+
5
+ ### Patch Changes
6
+
7
+ - [`4dc561b657a31`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/4dc561b657a31) -
8
+ FG cleanup - platform_ufo_report_non_htmlelement_selectors
9
+ - [`0251aa356dcf9`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/0251aa356dcf9) -
10
+ fix logic on checkIfExistedAndSizeMatchingV3 function
11
+
3
12
  ## 4.5.1
4
13
 
5
14
  ### Patch Changes
@@ -239,7 +239,11 @@ var SSRPlaceholderHandlers = exports.SSRPlaceholderHandlers = /*#__PURE__*/funct
239
239
  value: function checkIfExistedAndSizeMatchingV3(el) {
240
240
  el = this.findNearestPlaceholderContainerIfIgnored(el);
241
241
  var id = this.getPlaceholderId(el);
242
- return this.staticPlaceholders.has(id);
242
+ var placeholderRects = this.staticPlaceholders.get(id);
243
+ if (!placeholderRects) {
244
+ return false;
245
+ }
246
+ return this.hasSameSizePosition(placeholderRects, el.getBoundingClientRect());
243
247
  }
244
248
  }, {
245
249
  key: "getSize",
@@ -4,37 +4,32 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
- var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
8
7
  var nameCache = new WeakMap();
9
8
  function getElementName(selectorConfig, element) {
10
9
  if (!(element instanceof HTMLElement)) {
11
- if ((0, _platformFeatureFlags.fg)('platform_ufo_report_non_htmlelement_selectors')) {
12
- var elementInstance = 'Unknown';
10
+ var elementInstance = 'Unknown';
13
11
 
14
- // Types of elements according to LLM
15
- if (element instanceof Document) {
16
- elementInstance = 'Document';
17
- } else if (element instanceof DocumentFragment) {
18
- elementInstance = 'DocumentFragment';
19
- } else if (element instanceof Text) {
20
- elementInstance = 'Text';
21
- } else if (element instanceof Comment) {
22
- elementInstance = 'Comment';
23
- } else if (element instanceof ProcessingInstruction) {
24
- elementInstance = 'ProcessingInstruction';
25
- } else if (element instanceof Attr) {
26
- elementInstance = 'Attr';
27
- } else if (element instanceof CDATASection) {
28
- elementInstance = 'CDATASection';
29
- }
30
- if (element.parentElement && element.parentElement instanceof HTMLElement) {
31
- var parentElementSelector = getElementName(selectorConfig, element.parentElement);
32
- return "".concat(parentElementSelector, " > ").concat(elementInstance);
33
- } else {
34
- return elementInstance;
35
- }
12
+ // Types of elements according to LLM
13
+ if (element instanceof Text) {
14
+ elementInstance = 'Text';
15
+ } else if (element instanceof DocumentFragment) {
16
+ elementInstance = 'DocumentFragment';
17
+ } else if (element instanceof Document) {
18
+ elementInstance = 'Document';
19
+ } else if (element instanceof Comment) {
20
+ elementInstance = 'Comment';
21
+ } else if (element instanceof ProcessingInstruction) {
22
+ elementInstance = 'ProcessingInstruction';
23
+ } else if (element instanceof Attr) {
24
+ elementInstance = 'Attr';
25
+ } else if (element instanceof CDATASection) {
26
+ elementInstance = 'CDATASection';
27
+ }
28
+ if (element.parentElement && element.parentElement instanceof HTMLElement) {
29
+ var parentElementSelector = getElementName(selectorConfig, element.parentElement);
30
+ return "".concat(parentElementSelector, " > ").concat(elementInstance);
36
31
  } else {
37
- return 'error';
32
+ return elementInstance;
38
33
  }
39
34
  }
40
35
  var cachedName = nameCache.get(element);
@@ -205,7 +205,11 @@ export class SSRPlaceholderHandlers {
205
205
  checkIfExistedAndSizeMatchingV3(el) {
206
206
  el = this.findNearestPlaceholderContainerIfIgnored(el);
207
207
  const id = this.getPlaceholderId(el);
208
- return this.staticPlaceholders.has(id);
208
+ const placeholderRects = this.staticPlaceholders.get(id);
209
+ if (!placeholderRects) {
210
+ return false;
211
+ }
212
+ return this.hasSameSizePosition(placeholderRects, el.getBoundingClientRect());
209
213
  }
210
214
  getSize(el) {
211
215
  return new Promise(resolve => {
@@ -1,34 +1,29 @@
1
- import { fg } from '@atlaskit/platform-feature-flags';
2
1
  const nameCache = new WeakMap();
3
2
  function getElementName(selectorConfig, element) {
4
3
  if (!(element instanceof HTMLElement)) {
5
- if (fg('platform_ufo_report_non_htmlelement_selectors')) {
6
- let elementInstance = 'Unknown';
4
+ let elementInstance = 'Unknown';
7
5
 
8
- // Types of elements according to LLM
9
- if (element instanceof Document) {
10
- elementInstance = 'Document';
11
- } else if (element instanceof DocumentFragment) {
12
- elementInstance = 'DocumentFragment';
13
- } else if (element instanceof Text) {
14
- elementInstance = 'Text';
15
- } else if (element instanceof Comment) {
16
- elementInstance = 'Comment';
17
- } else if (element instanceof ProcessingInstruction) {
18
- elementInstance = 'ProcessingInstruction';
19
- } else if (element instanceof Attr) {
20
- elementInstance = 'Attr';
21
- } else if (element instanceof CDATASection) {
22
- elementInstance = 'CDATASection';
23
- }
24
- if (element.parentElement && element.parentElement instanceof HTMLElement) {
25
- const parentElementSelector = getElementName(selectorConfig, element.parentElement);
26
- return `${parentElementSelector} > ${elementInstance}`;
27
- } else {
28
- return elementInstance;
29
- }
6
+ // Types of elements according to LLM
7
+ if (element instanceof Text) {
8
+ elementInstance = 'Text';
9
+ } else if (element instanceof DocumentFragment) {
10
+ elementInstance = 'DocumentFragment';
11
+ } else if (element instanceof Document) {
12
+ elementInstance = 'Document';
13
+ } else if (element instanceof Comment) {
14
+ elementInstance = 'Comment';
15
+ } else if (element instanceof ProcessingInstruction) {
16
+ elementInstance = 'ProcessingInstruction';
17
+ } else if (element instanceof Attr) {
18
+ elementInstance = 'Attr';
19
+ } else if (element instanceof CDATASection) {
20
+ elementInstance = 'CDATASection';
21
+ }
22
+ if (element.parentElement && element.parentElement instanceof HTMLElement) {
23
+ const parentElementSelector = getElementName(selectorConfig, element.parentElement);
24
+ return `${parentElementSelector} > ${elementInstance}`;
30
25
  } else {
31
- return 'error';
26
+ return elementInstance;
32
27
  }
33
28
  }
34
29
  const cachedName = nameCache.get(element);
@@ -232,7 +232,11 @@ export var SSRPlaceholderHandlers = /*#__PURE__*/function () {
232
232
  value: function checkIfExistedAndSizeMatchingV3(el) {
233
233
  el = this.findNearestPlaceholderContainerIfIgnored(el);
234
234
  var id = this.getPlaceholderId(el);
235
- return this.staticPlaceholders.has(id);
235
+ var placeholderRects = this.staticPlaceholders.get(id);
236
+ if (!placeholderRects) {
237
+ return false;
238
+ }
239
+ return this.hasSameSizePosition(placeholderRects, el.getBoundingClientRect());
236
240
  }
237
241
  }, {
238
242
  key: "getSize",
@@ -1,34 +1,29 @@
1
- import { fg } from '@atlaskit/platform-feature-flags';
2
1
  var nameCache = new WeakMap();
3
2
  function getElementName(selectorConfig, element) {
4
3
  if (!(element instanceof HTMLElement)) {
5
- if (fg('platform_ufo_report_non_htmlelement_selectors')) {
6
- var elementInstance = 'Unknown';
4
+ var elementInstance = 'Unknown';
7
5
 
8
- // Types of elements according to LLM
9
- if (element instanceof Document) {
10
- elementInstance = 'Document';
11
- } else if (element instanceof DocumentFragment) {
12
- elementInstance = 'DocumentFragment';
13
- } else if (element instanceof Text) {
14
- elementInstance = 'Text';
15
- } else if (element instanceof Comment) {
16
- elementInstance = 'Comment';
17
- } else if (element instanceof ProcessingInstruction) {
18
- elementInstance = 'ProcessingInstruction';
19
- } else if (element instanceof Attr) {
20
- elementInstance = 'Attr';
21
- } else if (element instanceof CDATASection) {
22
- elementInstance = 'CDATASection';
23
- }
24
- if (element.parentElement && element.parentElement instanceof HTMLElement) {
25
- var parentElementSelector = getElementName(selectorConfig, element.parentElement);
26
- return "".concat(parentElementSelector, " > ").concat(elementInstance);
27
- } else {
28
- return elementInstance;
29
- }
6
+ // Types of elements according to LLM
7
+ if (element instanceof Text) {
8
+ elementInstance = 'Text';
9
+ } else if (element instanceof DocumentFragment) {
10
+ elementInstance = 'DocumentFragment';
11
+ } else if (element instanceof Document) {
12
+ elementInstance = 'Document';
13
+ } else if (element instanceof Comment) {
14
+ elementInstance = 'Comment';
15
+ } else if (element instanceof ProcessingInstruction) {
16
+ elementInstance = 'ProcessingInstruction';
17
+ } else if (element instanceof Attr) {
18
+ elementInstance = 'Attr';
19
+ } else if (element instanceof CDATASection) {
20
+ elementInstance = 'CDATASection';
21
+ }
22
+ if (element.parentElement && element.parentElement instanceof HTMLElement) {
23
+ var parentElementSelector = getElementName(selectorConfig, element.parentElement);
24
+ return "".concat(parentElementSelector, " > ").concat(elementInstance);
30
25
  } else {
31
- return 'error';
26
+ return elementInstance;
32
27
  }
33
28
  }
34
29
  var cachedName = nameCache.get(element);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/react-ufo",
3
- "version": "4.5.1",
3
+ "version": "4.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",
@@ -181,9 +181,6 @@
181
181
  "platform_ufo_segment_critical_metrics": {
182
182
  "type": "boolean"
183
183
  },
184
- "platform_ufo_report_non_htmlelement_selectors": {
185
- "type": "boolean"
186
- },
187
184
  "platform_ufo_add_segments_count_threshold": {
188
185
  "type": "boolean"
189
186
  },