@atlaskit/portal 4.9.3 → 4.10.0

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,21 @@
1
1
  # @atlaskit/portal
2
2
 
3
+ ## 4.10.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [`0e8e931171299`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/0e8e931171299) -
8
+ Testing behind a feature gate, adds a Suspense boundary to all created React 18 portals (also
9
+ behind a feature gate)
10
+
11
+ ## 4.9.4
12
+
13
+ ### Patch Changes
14
+
15
+ - [#165531](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/165531)
16
+ [`57f451bda8919`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/57f451bda8919) -
17
+ Adds side-effect config to support Compiled css extraction in third-party apps
18
+
3
19
  ## 4.9.3
4
20
 
5
21
  ### Patch Changes
@@ -1,15 +1,19 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ var _typeof = require("@babel/runtime/helpers/typeof");
4
5
  Object.defineProperty(exports, "__esModule", {
5
6
  value: true
6
7
  });
7
8
  exports.default = InternalPortalNew;
8
9
  var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
9
- var _react = require("react");
10
+ var _react = _interopRequireWildcard(require("react"));
10
11
  var _reactDom = require("react-dom");
12
+ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
11
13
  var _useIsomorphicLayoutEffect = require("../hooks/use-isomorphic-layout-effect");
12
14
  var _portalDomUtils = require("../utils/portal-dom-utils");
15
+ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
16
+ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
13
17
  function InternalPortalNew(props) {
14
18
  var zIndex = props.zIndex,
15
19
  children = props.children;
@@ -32,5 +36,15 @@ function InternalPortalNew(props) {
32
36
  setAtlaskitPortal(null);
33
37
  };
34
38
  }, [zIndex]);
35
- return atlaskitPortal ? /*#__PURE__*/(0, _reactDom.createPortal)(children, atlaskitPortal) : null;
39
+
40
+ /**
41
+ * Conditionally wrap ALL portal children with Suspense behind a feature gate for safe rollout.
42
+ *
43
+ * This is here because in React 18 concurrent, if you suspend from _within_ a portal to a
44
+ * suspense boundary _outside_ a portal, our portal gets in an infinite loop of re-rendering.
45
+ */
46
+ var conditionallySuspendedChildren = (0, _platformFeatureFlags.fg)('platform_design_system_suspend_portal_children') ? /*#__PURE__*/_react.default.createElement(_react.Suspense, {
47
+ fallback: null
48
+ }, children) : children;
49
+ return atlaskitPortal ? /*#__PURE__*/(0, _reactDom.createPortal)(conditionallySuspendedChildren, atlaskitPortal) : null;
36
50
  }
@@ -1,5 +1,6 @@
1
- import { useState } from 'react';
1
+ import React, { Suspense, useState } from 'react';
2
2
  import { createPortal } from 'react-dom';
3
+ import { fg } from '@atlaskit/platform-feature-flags';
3
4
  import { useIsomorphicLayoutEffect } from '../hooks/use-isomorphic-layout-effect';
4
5
  import { createAtlaskitPortal, createPortalParent } from '../utils/portal-dom-utils';
5
6
  export default function InternalPortalNew(props) {
@@ -23,5 +24,15 @@ export default function InternalPortalNew(props) {
23
24
  setAtlaskitPortal(null);
24
25
  };
25
26
  }, [zIndex]);
26
- return atlaskitPortal ? /*#__PURE__*/createPortal(children, atlaskitPortal) : null;
27
+
28
+ /**
29
+ * Conditionally wrap ALL portal children with Suspense behind a feature gate for safe rollout.
30
+ *
31
+ * This is here because in React 18 concurrent, if you suspend from _within_ a portal to a
32
+ * suspense boundary _outside_ a portal, our portal gets in an infinite loop of re-rendering.
33
+ */
34
+ const conditionallySuspendedChildren = fg('platform_design_system_suspend_portal_children') ? /*#__PURE__*/React.createElement(Suspense, {
35
+ fallback: null
36
+ }, children) : children;
37
+ return atlaskitPortal ? /*#__PURE__*/createPortal(conditionallySuspendedChildren, atlaskitPortal) : null;
27
38
  }
@@ -1,6 +1,7 @@
1
1
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
2
- import { useState } from 'react';
2
+ import React, { Suspense, useState } from 'react';
3
3
  import { createPortal } from 'react-dom';
4
+ import { fg } from '@atlaskit/platform-feature-flags';
4
5
  import { useIsomorphicLayoutEffect } from '../hooks/use-isomorphic-layout-effect';
5
6
  import { createAtlaskitPortal, createPortalParent } from '../utils/portal-dom-utils';
6
7
  export default function InternalPortalNew(props) {
@@ -25,5 +26,15 @@ export default function InternalPortalNew(props) {
25
26
  setAtlaskitPortal(null);
26
27
  };
27
28
  }, [zIndex]);
28
- return atlaskitPortal ? /*#__PURE__*/createPortal(children, atlaskitPortal) : null;
29
+
30
+ /**
31
+ * Conditionally wrap ALL portal children with Suspense behind a feature gate for safe rollout.
32
+ *
33
+ * This is here because in React 18 concurrent, if you suspend from _within_ a portal to a
34
+ * suspense boundary _outside_ a portal, our portal gets in an infinite loop of re-rendering.
35
+ */
36
+ var conditionallySuspendedChildren = fg('platform_design_system_suspend_portal_children') ? /*#__PURE__*/React.createElement(Suspense, {
37
+ fallback: null
38
+ }, children) : children;
39
+ return atlaskitPortal ? /*#__PURE__*/createPortal(conditionallySuspendedChildren, atlaskitPortal) : null;
29
40
  }
@@ -1,7 +1,7 @@
1
- /// <reference types="react" />
1
+ import React from 'react';
2
2
  interface InternalPortalProps {
3
3
  children: React.ReactNode;
4
4
  zIndex: number | string;
5
5
  }
6
- export default function InternalPortalNew(props: InternalPortalProps): import("react").ReactPortal | null;
6
+ export default function InternalPortalNew(props: InternalPortalProps): React.ReactPortal | null;
7
7
  export {};
@@ -1,7 +1,7 @@
1
- /// <reference types="react" />
1
+ import React from 'react';
2
2
  interface InternalPortalProps {
3
3
  children: React.ReactNode;
4
4
  zIndex: number | string;
5
5
  }
6
- export default function InternalPortalNew(props: InternalPortalProps): import("react").ReactPortal | null;
6
+ export default function InternalPortalNew(props: InternalPortalProps): React.ReactPortal | null;
7
7
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/portal",
3
- "version": "4.9.3",
3
+ "version": "4.10.0",
4
4
  "description": "A wrapper for rendering components in React portals.",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -20,7 +20,9 @@
20
20
  ]
21
21
  }
22
22
  },
23
- "sideEffects": false,
23
+ "sideEffects": [
24
+ "**/*.compiled.css"
25
+ ],
24
26
  "atlaskit:src": "src/index.tsx",
25
27
  "atlassian": {
26
28
  "team": "Design System Team",
@@ -46,11 +48,11 @@
46
48
  "devDependencies": {
47
49
  "@af/accessibility-testing": "*",
48
50
  "@af/integration-testing": "*",
49
- "@atlaskit/ds-lib": "^3.1.0",
50
- "@atlaskit/modal-dialog": "^12.17.0",
51
+ "@atlaskit/ds-lib": "^3.3.0",
52
+ "@atlaskit/modal-dialog": "^12.18.0",
51
53
  "@atlaskit/ssr": "*",
52
- "@atlaskit/tokens": "^2.0.0",
53
- "@atlaskit/tooltip": "^18.8.0",
54
+ "@atlaskit/tokens": "^2.4.0",
55
+ "@atlaskit/tooltip": "^19.0.0",
54
56
  "@atlaskit/visual-regression": "*",
55
57
  "@atlassian/feature-flags-test-utils": "^0.2.0",
56
58
  "@emotion/react": "^11.7.1",
@@ -58,7 +60,7 @@
58
60
  "@testing-library/react-hooks": "^8.0.1",
59
61
  "bind-event-listener": "^3.0.0",
60
62
  "raf-stub": "^2.0.1",
61
- "storybook-addon-performance": "^0.16.0",
63
+ "storybook-addon-performance": "^0.17.3",
62
64
  "typescript": "~5.4.2"
63
65
  },
64
66
  "keywords": [
@@ -90,6 +92,9 @@
90
92
  "platform-feature-flags": {
91
93
  "platform_design_system_team_portal_logic_r18_fix": {
92
94
  "type": "boolean"
95
+ },
96
+ "platform_design_system_suspend_portal_children": {
97
+ "type": "boolean"
93
98
  }
94
99
  }
95
100
  }
@@ -3,7 +3,9 @@
3
3
  "main": "../dist/cjs/entry-points/types.js",
4
4
  "module": "../dist/esm/entry-points/types.js",
5
5
  "module:es2019": "../dist/es2019/entry-points/types.js",
6
- "sideEffects": false,
6
+ "sideEffects": [
7
+ "**/*.compiled.css"
8
+ ],
7
9
  "types": "../dist/types/entry-points/types.d.ts",
8
10
  "typesVersions": {
9
11
  ">=4.5 <5.4": {