@atlaskit/react-ufo 4.15.6 → 4.15.7

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,12 @@
1
1
  # @atlaskit/ufo-interaction-ignore
2
2
 
3
+ ## 4.15.7
4
+
5
+ ### Patch Changes
6
+
7
+ - [`eb8e5acf00c10`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/eb8e5acf00c10) -
8
+ fix placeholder matching for TTVC v4 display contents elements
9
+
3
10
  ## 4.15.6
4
11
 
5
12
  ### Patch Changes
@@ -197,6 +197,34 @@ var SSRPlaceholderHandlers = exports.SSRPlaceholderHandlers = /*#__PURE__*/funct
197
197
  // data-ssr-placeholder-ignored doesn't have a value.
198
198
  return 'ssrPlaceholderIgnored' in element.dataset;
199
199
  }
200
+ }, {
201
+ key: "isPlaceholderV4",
202
+ value: function isPlaceholderV4(element) {
203
+ var currentElement = element;
204
+ var i = 0;
205
+ while (currentElement && i < ANCESTOR_LOOKUP_LIMIT) {
206
+ if (Boolean(this.getPlaceholderId(currentElement))) {
207
+ return true;
208
+ }
209
+ currentElement = currentElement.parentElement;
210
+ i++;
211
+ }
212
+ return false;
213
+ }
214
+ }, {
215
+ key: "isPlaceholderReplacementV4",
216
+ value: function isPlaceholderReplacementV4(element) {
217
+ var currentElement = element;
218
+ var i = 0;
219
+ while (currentElement && i < ANCESTOR_LOOKUP_LIMIT) {
220
+ if (Boolean(this.getPlaceholderReplacementId(currentElement))) {
221
+ return true;
222
+ }
223
+ currentElement = currentElement.parentElement;
224
+ i++;
225
+ }
226
+ return false;
227
+ }
200
228
  }, {
201
229
  key: "findNearestPlaceholderContainerIfIgnored",
202
230
  value: function findNearestPlaceholderContainerIfIgnored(element) {
@@ -80,10 +80,10 @@ var createElementMutationsWatcherV4 = function createElementMutationsWatcherV4(r
80
80
  if (getSSRPlaceholderHandler) {
81
81
  var ssrPlaceholderHandler = getSSRPlaceholderHandler();
82
82
  if (ssrPlaceholderHandler) {
83
- if ((ssrPlaceholderHandler.isPlaceholder(target) || ssrPlaceholderHandler.isPlaceholderIgnored(target)) && ssrPlaceholderHandler.checkIfExistedAndSizeMatchingV3(target)) {
83
+ if ((ssrPlaceholderHandler.isPlaceholderV4(target) || ssrPlaceholderHandler.isPlaceholderIgnored(target)) && ssrPlaceholderHandler.checkIfExistedAndSizeMatchingV3(target)) {
84
84
  return 'mutation:ssr-placeholder';
85
85
  }
86
- if ((ssrPlaceholderHandler.isPlaceholderReplacement(target) || ssrPlaceholderHandler.isPlaceholderIgnored(target)) && ssrPlaceholderHandler.validateReactComponentMatchToPlaceholderV4(target)) {
86
+ if ((ssrPlaceholderHandler.isPlaceholderReplacementV4(target) || ssrPlaceholderHandler.isPlaceholderIgnored(target)) && ssrPlaceholderHandler.validateReactComponentMatchToPlaceholderV4(target)) {
87
87
  return 'mutation:ssr-placeholder';
88
88
  }
89
89
  }
@@ -170,6 +170,30 @@ export class SSRPlaceholderHandlers {
170
170
  // data-ssr-placeholder-ignored doesn't have a value.
171
171
  return 'ssrPlaceholderIgnored' in element.dataset;
172
172
  }
173
+ isPlaceholderV4(element) {
174
+ let currentElement = element;
175
+ let i = 0;
176
+ while (currentElement && i < ANCESTOR_LOOKUP_LIMIT) {
177
+ if (Boolean(this.getPlaceholderId(currentElement))) {
178
+ return true;
179
+ }
180
+ currentElement = currentElement.parentElement;
181
+ i++;
182
+ }
183
+ return false;
184
+ }
185
+ isPlaceholderReplacementV4(element) {
186
+ let currentElement = element;
187
+ let i = 0;
188
+ while (currentElement && i < ANCESTOR_LOOKUP_LIMIT) {
189
+ if (Boolean(this.getPlaceholderReplacementId(currentElement))) {
190
+ return true;
191
+ }
192
+ currentElement = currentElement.parentElement;
193
+ i++;
194
+ }
195
+ return false;
196
+ }
173
197
  findNearestPlaceholderContainerIfIgnored(element) {
174
198
  if (!this.isPlaceholderIgnored(element)) {
175
199
  return element;
@@ -61,10 +61,10 @@ const createElementMutationsWatcherV4 = (removedNodeRects, isWithinThirdPartySeg
61
61
  if (getSSRPlaceholderHandler) {
62
62
  const ssrPlaceholderHandler = getSSRPlaceholderHandler();
63
63
  if (ssrPlaceholderHandler) {
64
- if ((ssrPlaceholderHandler.isPlaceholder(target) || ssrPlaceholderHandler.isPlaceholderIgnored(target)) && ssrPlaceholderHandler.checkIfExistedAndSizeMatchingV3(target)) {
64
+ if ((ssrPlaceholderHandler.isPlaceholderV4(target) || ssrPlaceholderHandler.isPlaceholderIgnored(target)) && ssrPlaceholderHandler.checkIfExistedAndSizeMatchingV3(target)) {
65
65
  return 'mutation:ssr-placeholder';
66
66
  }
67
- if ((ssrPlaceholderHandler.isPlaceholderReplacement(target) || ssrPlaceholderHandler.isPlaceholderIgnored(target)) && ssrPlaceholderHandler.validateReactComponentMatchToPlaceholderV4(target)) {
67
+ if ((ssrPlaceholderHandler.isPlaceholderReplacementV4(target) || ssrPlaceholderHandler.isPlaceholderIgnored(target)) && ssrPlaceholderHandler.validateReactComponentMatchToPlaceholderV4(target)) {
68
68
  return 'mutation:ssr-placeholder';
69
69
  }
70
70
  }
@@ -190,6 +190,34 @@ export var SSRPlaceholderHandlers = /*#__PURE__*/function () {
190
190
  // data-ssr-placeholder-ignored doesn't have a value.
191
191
  return 'ssrPlaceholderIgnored' in element.dataset;
192
192
  }
193
+ }, {
194
+ key: "isPlaceholderV4",
195
+ value: function isPlaceholderV4(element) {
196
+ var currentElement = element;
197
+ var i = 0;
198
+ while (currentElement && i < ANCESTOR_LOOKUP_LIMIT) {
199
+ if (Boolean(this.getPlaceholderId(currentElement))) {
200
+ return true;
201
+ }
202
+ currentElement = currentElement.parentElement;
203
+ i++;
204
+ }
205
+ return false;
206
+ }
207
+ }, {
208
+ key: "isPlaceholderReplacementV4",
209
+ value: function isPlaceholderReplacementV4(element) {
210
+ var currentElement = element;
211
+ var i = 0;
212
+ while (currentElement && i < ANCESTOR_LOOKUP_LIMIT) {
213
+ if (Boolean(this.getPlaceholderReplacementId(currentElement))) {
214
+ return true;
215
+ }
216
+ currentElement = currentElement.parentElement;
217
+ i++;
218
+ }
219
+ return false;
220
+ }
193
221
  }, {
194
222
  key: "findNearestPlaceholderContainerIfIgnored",
195
223
  value: function findNearestPlaceholderContainerIfIgnored(element) {
@@ -71,10 +71,10 @@ var createElementMutationsWatcherV4 = function createElementMutationsWatcherV4(r
71
71
  if (getSSRPlaceholderHandler) {
72
72
  var ssrPlaceholderHandler = getSSRPlaceholderHandler();
73
73
  if (ssrPlaceholderHandler) {
74
- if ((ssrPlaceholderHandler.isPlaceholder(target) || ssrPlaceholderHandler.isPlaceholderIgnored(target)) && ssrPlaceholderHandler.checkIfExistedAndSizeMatchingV3(target)) {
74
+ if ((ssrPlaceholderHandler.isPlaceholderV4(target) || ssrPlaceholderHandler.isPlaceholderIgnored(target)) && ssrPlaceholderHandler.checkIfExistedAndSizeMatchingV3(target)) {
75
75
  return 'mutation:ssr-placeholder';
76
76
  }
77
- if ((ssrPlaceholderHandler.isPlaceholderReplacement(target) || ssrPlaceholderHandler.isPlaceholderIgnored(target)) && ssrPlaceholderHandler.validateReactComponentMatchToPlaceholderV4(target)) {
77
+ if ((ssrPlaceholderHandler.isPlaceholderReplacementV4(target) || ssrPlaceholderHandler.isPlaceholderIgnored(target)) && ssrPlaceholderHandler.validateReactComponentMatchToPlaceholderV4(target)) {
78
78
  return 'mutation:ssr-placeholder';
79
79
  }
80
80
  }
@@ -28,6 +28,8 @@ export declare class SSRPlaceholderHandlers {
28
28
  isPlaceholder(element: HTMLElement): boolean;
29
29
  isPlaceholderReplacement(element: HTMLElement): boolean;
30
30
  isPlaceholderIgnored(element: HTMLElement): boolean;
31
+ isPlaceholderV4(element: HTMLElement): boolean;
32
+ isPlaceholderReplacementV4(element: HTMLElement): boolean;
31
33
  findNearestPlaceholderContainerIfIgnored(element: HTMLElement): HTMLElement;
32
34
  checkIfExistedAndSizeMatching(el: HTMLElement): Promise<boolean>;
33
35
  checkIfExistedAndSizeMatchingV3(el: HTMLElement): boolean;
@@ -28,6 +28,8 @@ export declare class SSRPlaceholderHandlers {
28
28
  isPlaceholder(element: HTMLElement): boolean;
29
29
  isPlaceholderReplacement(element: HTMLElement): boolean;
30
30
  isPlaceholderIgnored(element: HTMLElement): boolean;
31
+ isPlaceholderV4(element: HTMLElement): boolean;
32
+ isPlaceholderReplacementV4(element: HTMLElement): boolean;
31
33
  findNearestPlaceholderContainerIfIgnored(element: HTMLElement): HTMLElement;
32
34
  checkIfExistedAndSizeMatching(el: HTMLElement): Promise<boolean>;
33
35
  checkIfExistedAndSizeMatchingV3(el: HTMLElement): boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/react-ufo",
3
- "version": "4.15.6",
3
+ "version": "4.15.7",
4
4
  "description": "Parts of React UFO that are publicly available",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",