@atlaskit/emoji 71.15.8 → 71.15.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,20 @@
1
1
  # @atlaskit/emoji
2
2
 
3
+ ## 71.15.10
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies
8
+
9
+ ## 71.15.9
10
+
11
+ ### Patch Changes
12
+
13
+ - [`8442d3ac8c58b`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/8442d3ac8c58b) -
14
+ Migrate ReactDOM.render/unmountComponentAtNode in Popup to createRoot/root.unmount() behind the
15
+ nike_r19_render_unmount feature gate, as part of the React 19 migration
16
+ - Updated dependencies
17
+
3
18
  ## 71.15.8
4
19
 
5
20
  ### Patch Changes
@@ -9,7 +9,37 @@ exports.default = void 0;
9
9
  var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
10
10
  var _react = _interopRequireWildcard(require("react"));
11
11
  var _reactDom = _interopRequireDefault(require("react-dom"));
12
+ var _client = require("react-dom/client");
13
+ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
12
14
  function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
15
+ var reactRoots = new WeakMap();
16
+
17
+ /** Mounts `element` into `mountPoint`: uses the React 18/19 `createRoot` API when `nike_r19_render_unmount` is on, else the legacy render path. */
18
+ var renderToMountPoint = function renderToMountPoint(element, mountPoint) {
19
+ if ((0, _platformFeatureFlags.fg)('nike_r19_render_unmount')) {
20
+ var root = reactRoots.get(mountPoint);
21
+ if (!root) {
22
+ root = (0, _client.createRoot)(mountPoint);
23
+ reactRoots.set(mountPoint, root);
24
+ }
25
+ root.render(element);
26
+ } else {
27
+ _reactDom.default.render(element, mountPoint);
28
+ }
29
+ };
30
+
31
+ /** Unmounts the tree at `mountPoint`: uses `root.unmount()` when `nike_r19_render_unmount` is on, else the legacy unmount path. */
32
+ var unmountFromMountPoint = function unmountFromMountPoint(mountPoint) {
33
+ if ((0, _platformFeatureFlags.fg)('nike_r19_render_unmount')) {
34
+ var root = reactRoots.get(mountPoint);
35
+ if (root) {
36
+ root.unmount();
37
+ reactRoots.delete(mountPoint);
38
+ }
39
+ } else {
40
+ _reactDom.default.unmountComponentAtNode(mountPoint);
41
+ }
42
+ };
13
43
  var getTargetNode = function getTargetNode(target) {
14
44
  if (typeof target === 'string') {
15
45
  return document.querySelector(target);
@@ -121,7 +151,7 @@ var Popup = function Popup(props) {
121
151
  if (!popup.current) {
122
152
  return;
123
153
  }
124
- _reactDom.default.render(children, popup.current);
154
+ renderToMountPoint(children, popup.current);
125
155
  }, [children]);
126
156
  (0, _react.useEffect)(function () {
127
157
  popup.current = document.createElement('div');
@@ -141,7 +171,7 @@ var Popup = function Popup(props) {
141
171
  }
142
172
  window.removeEventListener('resize', handleResize);
143
173
  if (popup.current) {
144
- _reactDom.default.unmountComponentAtNode(popup.current);
174
+ unmountFromMountPoint(popup.current);
145
175
  document.body.removeChild(popup.current);
146
176
  }
147
177
  };
@@ -20,7 +20,7 @@ var createEvent = function createEvent(eventType, action, actionSubject, actionS
20
20
  actionSubjectId: actionSubjectId,
21
21
  attributes: _objectSpread({
22
22
  packageName: "@atlaskit/emoji",
23
- packageVersion: "71.15.7"
23
+ packageVersion: "71.15.9"
24
24
  }, attributes)
25
25
  };
26
26
  };
@@ -1,5 +1,35 @@
1
1
  import React, { useCallback, useEffect, useRef, useState } from 'react';
2
2
  import ReactDOM from 'react-dom';
3
+ import { createRoot } from 'react-dom/client';
4
+ import { fg } from '@atlaskit/platform-feature-flags';
5
+ let reactRoots = new WeakMap();
6
+
7
+ /** Mounts `element` into `mountPoint`: uses the React 18/19 `createRoot` API when `nike_r19_render_unmount` is on, else the legacy render path. */
8
+ const renderToMountPoint = (element, mountPoint) => {
9
+ if (fg('nike_r19_render_unmount')) {
10
+ let root = reactRoots.get(mountPoint);
11
+ if (!root) {
12
+ root = createRoot(mountPoint);
13
+ reactRoots.set(mountPoint, root);
14
+ }
15
+ root.render(element);
16
+ } else {
17
+ ReactDOM.render(element, mountPoint);
18
+ }
19
+ };
20
+
21
+ /** Unmounts the tree at `mountPoint`: uses `root.unmount()` when `nike_r19_render_unmount` is on, else the legacy unmount path. */
22
+ const unmountFromMountPoint = mountPoint => {
23
+ if (fg('nike_r19_render_unmount')) {
24
+ const root = reactRoots.get(mountPoint);
25
+ if (root) {
26
+ root.unmount();
27
+ reactRoots.delete(mountPoint);
28
+ }
29
+ } else {
30
+ ReactDOM.unmountComponentAtNode(mountPoint);
31
+ }
32
+ };
3
33
  const getTargetNode = target => {
4
34
  if (typeof target === 'string') {
5
35
  return document.querySelector(target);
@@ -103,7 +133,7 @@ const Popup = props => {
103
133
  if (!popup.current) {
104
134
  return;
105
135
  }
106
- ReactDOM.render(children, popup.current);
136
+ renderToMountPoint(children, popup.current);
107
137
  }, [children]);
108
138
  useEffect(() => {
109
139
  popup.current = document.createElement('div');
@@ -123,7 +153,7 @@ const Popup = props => {
123
153
  }
124
154
  window.removeEventListener('resize', handleResize);
125
155
  if (popup.current) {
126
- ReactDOM.unmountComponentAtNode(popup.current);
156
+ unmountFromMountPoint(popup.current);
127
157
  document.body.removeChild(popup.current);
128
158
  }
129
159
  };
@@ -9,7 +9,7 @@ const createEvent = (eventType, action, actionSubject, actionSubjectId, attribut
9
9
  actionSubjectId,
10
10
  attributes: {
11
11
  packageName: "@atlaskit/emoji",
12
- packageVersion: "71.15.7",
12
+ packageVersion: "71.15.9",
13
13
  ...attributes
14
14
  }
15
15
  });
@@ -1,6 +1,36 @@
1
1
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
2
2
  import React, { useCallback, useEffect, useRef, useState } from 'react';
3
3
  import ReactDOM from 'react-dom';
4
+ import { createRoot } from 'react-dom/client';
5
+ import { fg } from '@atlaskit/platform-feature-flags';
6
+ var reactRoots = new WeakMap();
7
+
8
+ /** Mounts `element` into `mountPoint`: uses the React 18/19 `createRoot` API when `nike_r19_render_unmount` is on, else the legacy render path. */
9
+ var renderToMountPoint = function renderToMountPoint(element, mountPoint) {
10
+ if (fg('nike_r19_render_unmount')) {
11
+ var root = reactRoots.get(mountPoint);
12
+ if (!root) {
13
+ root = createRoot(mountPoint);
14
+ reactRoots.set(mountPoint, root);
15
+ }
16
+ root.render(element);
17
+ } else {
18
+ ReactDOM.render(element, mountPoint);
19
+ }
20
+ };
21
+
22
+ /** Unmounts the tree at `mountPoint`: uses `root.unmount()` when `nike_r19_render_unmount` is on, else the legacy unmount path. */
23
+ var unmountFromMountPoint = function unmountFromMountPoint(mountPoint) {
24
+ if (fg('nike_r19_render_unmount')) {
25
+ var root = reactRoots.get(mountPoint);
26
+ if (root) {
27
+ root.unmount();
28
+ reactRoots.delete(mountPoint);
29
+ }
30
+ } else {
31
+ ReactDOM.unmountComponentAtNode(mountPoint);
32
+ }
33
+ };
4
34
  var getTargetNode = function getTargetNode(target) {
5
35
  if (typeof target === 'string') {
6
36
  return document.querySelector(target);
@@ -112,7 +142,7 @@ var Popup = function Popup(props) {
112
142
  if (!popup.current) {
113
143
  return;
114
144
  }
115
- ReactDOM.render(children, popup.current);
145
+ renderToMountPoint(children, popup.current);
116
146
  }, [children]);
117
147
  useEffect(function () {
118
148
  popup.current = document.createElement('div');
@@ -132,7 +162,7 @@ var Popup = function Popup(props) {
132
162
  }
133
163
  window.removeEventListener('resize', handleResize);
134
164
  if (popup.current) {
135
- ReactDOM.unmountComponentAtNode(popup.current);
165
+ unmountFromMountPoint(popup.current);
136
166
  document.body.removeChild(popup.current);
137
167
  }
138
168
  };
@@ -14,7 +14,7 @@ var createEvent = function createEvent(eventType, action, actionSubject, actionS
14
14
  actionSubjectId: actionSubjectId,
15
15
  attributes: _objectSpread({
16
16
  packageName: "@atlaskit/emoji",
17
- packageVersion: "71.15.7"
17
+ packageVersion: "71.15.9"
18
18
  }, attributes)
19
19
  };
20
20
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/emoji",
3
- "version": "71.15.8",
3
+ "version": "71.15.10",
4
4
  "description": "Fabric emoji React components",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -37,8 +37,8 @@
37
37
  "@atlaskit/feature-gate-js-client": "^6.0.0",
38
38
  "@atlaskit/form": "^16.1.0",
39
39
  "@atlaskit/heading": "^7.0.0",
40
- "@atlaskit/icon": "^37.2.0",
41
- "@atlaskit/icon-lab": "^7.4.0",
40
+ "@atlaskit/icon": "^37.3.0",
41
+ "@atlaskit/icon-lab": "^7.5.0",
42
42
  "@atlaskit/image": "^5.0.0",
43
43
  "@atlaskit/logo": "^21.4.0",
44
44
  "@atlaskit/media-client": "^37.2.0",
@@ -50,7 +50,7 @@
50
50
  "@atlaskit/spinner": "^20.1.0",
51
51
  "@atlaskit/textfield": "^10.0.0",
52
52
  "@atlaskit/theme": "^26.1.0",
53
- "@atlaskit/tmp-editor-statsig": "^139.0.0",
53
+ "@atlaskit/tmp-editor-statsig": "^140.0.0",
54
54
  "@atlaskit/tokens": "^16.3.0",
55
55
  "@atlaskit/tooltip": "^24.0.0",
56
56
  "@atlaskit/ufo": "^1.0.0",
@@ -116,6 +116,9 @@
116
116
  }
117
117
  },
118
118
  "platform-feature-flags": {
119
+ "nike_r19_render_unmount": {
120
+ "type": "boolean"
121
+ },
119
122
  "platform_index_emoji_just_in_time": {
120
123
  "type": "boolean"
121
124
  },