@atlaskit/portal 4.2.4 → 4.2.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,24 @@
1
1
  # @atlaskit/portal
2
2
 
3
+ ## 4.2.7
4
+
5
+ ### Patch Changes
6
+
7
+ - [`cb2392f6d33`](https://bitbucket.org/atlassian/atlassian-frontend/commits/cb2392f6d33) - Upgrade to TypeScript 4.2.4
8
+
9
+ ## 4.2.6
10
+
11
+ ### Patch Changes
12
+
13
+ - [`b3e5a62a9e3`](https://bitbucket.org/atlassian/atlassian-frontend/commits/b3e5a62a9e3) - Adds `static` techstack to package, enforcing stricter style linting. In this case the package already satisfied this requirement so there have been no changes to styles.
14
+
15
+ ## 4.2.5
16
+
17
+ ### Patch Changes
18
+
19
+ - [`cf853e39278`](https://bitbucket.org/atlassian/atlassian-frontend/commits/cf853e39278) - Retains the portal wrapper in the DOM after the last portal is unmounted. This drastically reduces the style recalculations and improves performance for portalled elements.
20
+ - Updated dependencies
21
+
3
22
  ## 4.2.4
4
23
 
5
24
  ### Patch Changes
@@ -1,4 +1,3 @@
1
- /* eslint-disable @atlaskit/design-system/ensure-design-token-usage */
2
1
  import React from 'react';
3
2
 
4
3
  import Portal from '../src';
@@ -11,6 +10,7 @@ const PortalPerformance = () => {
11
10
  position: 'absolute',
12
11
  top: 24,
13
12
  left: 24,
13
+ // eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage
14
14
  background: 'lightpink',
15
15
  padding: '24px',
16
16
  borderRadius: '3px',
package/dist/cjs/index.js CHANGED
@@ -5,12 +5,6 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
5
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: true
7
7
  });
8
- Object.defineProperty(exports, "default", {
9
- enumerable: true,
10
- get: function get() {
11
- return _portal.default;
12
- }
13
- });
14
8
  Object.defineProperty(exports, "PORTAL_MOUNT_EVENT", {
15
9
  enumerable: true,
16
10
  get: function get() {
@@ -23,6 +17,12 @@ Object.defineProperty(exports, "PORTAL_UNMOUNT_EVENT", {
23
17
  return _constants.PORTAL_UNMOUNT_EVENT;
24
18
  }
25
19
  });
20
+ Object.defineProperty(exports, "default", {
21
+ enumerable: true,
22
+ get: function get() {
23
+ return _portal.default;
24
+ }
25
+ });
26
26
 
27
27
  var _portal = _interopRequireDefault(require("./portal"));
28
28
 
@@ -25,7 +25,6 @@ function InternalPortal(props) {
25
25
  (0, _react.useEffect)(function () {
26
26
  return function () {
27
27
  (0, _portalDomUtils.removePortalContainer)(container);
28
- (0, _portalDomUtils.removePortalParentContainerIfNoMorePortals)();
29
28
  };
30
29
  }, [container]);
31
30
  return /*#__PURE__*/(0, _reactDom.createPortal)(children, container);
@@ -3,9 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.portalClassName = exports.portalParentSelector = exports.portalParentClassName = exports.portalSelector = void 0;
7
- var portalSelector = 'body > .atlaskit-portal-container > .atlaskit-portal';
8
- exports.portalSelector = portalSelector;
6
+ exports.portalParentSelector = exports.portalParentClassName = exports.portalClassName = void 0;
9
7
  var portalParentClassName = 'atlaskit-portal-container';
10
8
  exports.portalParentClassName = portalParentClassName;
11
9
  var portalParentSelector = 'body > .atlaskit-portal-container';
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.removePortalParentContainerIfNoMorePortals = exports.appendPortalContainerIfNotAppended = exports.removePortalContainer = exports.createContainer = void 0;
6
+ exports.removePortalContainer = exports.createContainer = exports.appendPortalContainerIfNotAppended = void 0;
7
7
 
8
8
  var _constants = require("../constants");
9
9
 
@@ -51,14 +51,6 @@ var getPortalParent = function getPortalParent() {
51
51
 
52
52
  return parentElement;
53
53
  };
54
- /**
55
- * Removes portal parent container from document body
56
- */
57
-
58
-
59
- var removePortalParent = function removePortalParent() {
60
- getBody().removeChild(getPortalParent());
61
- };
62
54
  /**
63
55
  * Removes portal container from portal parent container
64
56
  * @param {HTMLDivElement | undefined} container - portal container to be removed from portal parent container
@@ -81,17 +73,5 @@ var appendPortalContainerIfNotAppended = function appendPortalContainerIfNotAppe
81
73
  getPortalParent().appendChild(container);
82
74
  }
83
75
  };
84
- /**
85
- * Removes portal parent container from document body if there are no more portals inside it
86
- */
87
-
88
-
89
- exports.appendPortalContainerIfNotAppended = appendPortalContainerIfNotAppended;
90
-
91
- var removePortalParentContainerIfNoMorePortals = function removePortalParentContainerIfNoMorePortals() {
92
- if (!document.querySelector(_constants.portalSelector)) {
93
- removePortalParent();
94
- }
95
- };
96
76
 
97
- exports.removePortalParentContainerIfNoMorePortals = removePortalParentContainerIfNoMorePortals;
77
+ exports.appendPortalContainerIfNotAppended = appendPortalContainerIfNotAppended;
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/portal",
3
- "version": "4.2.4",
3
+ "version": "4.2.7",
4
4
  "sideEffects": false
5
5
  }
@@ -1,6 +1,6 @@
1
1
  import { useEffect, useMemo } from 'react';
2
2
  import { createPortal } from 'react-dom';
3
- import { appendPortalContainerIfNotAppended, createContainer, removePortalContainer, removePortalParentContainerIfNoMorePortals } from '../utils/portal-dom-utils';
3
+ import { appendPortalContainerIfNotAppended, createContainer, removePortalContainer } from '../utils/portal-dom-utils';
4
4
  export default function InternalPortal(props) {
5
5
  const {
6
6
  zIndex,
@@ -15,7 +15,6 @@ export default function InternalPortal(props) {
15
15
  useEffect(() => {
16
16
  return () => {
17
17
  removePortalContainer(container);
18
- removePortalParentContainerIfNoMorePortals();
19
18
  };
20
19
  }, [container]);
21
20
  return /*#__PURE__*/createPortal(children, container);
@@ -1,4 +1,3 @@
1
- export const portalSelector = 'body > .atlaskit-portal-container > .atlaskit-portal';
2
1
  export const portalParentClassName = 'atlaskit-portal-container';
3
2
  export const portalParentSelector = 'body > .atlaskit-portal-container';
4
3
  export const portalClassName = 'atlaskit-portal';
@@ -1,4 +1,4 @@
1
- import { portalClassName, portalParentClassName, portalParentSelector, portalSelector } from '../constants';
1
+ import { portalClassName, portalParentClassName, portalParentSelector } from '../constants';
2
2
  /**
3
3
  * Creates a new portal container element with provided z-index and class name 'atlaskit-portal',
4
4
  * it is not be attached to any DOM node at this stage.
@@ -41,14 +41,6 @@ const getPortalParent = () => {
41
41
 
42
42
  return parentElement;
43
43
  };
44
- /**
45
- * Removes portal parent container from document body
46
- */
47
-
48
-
49
- const removePortalParent = () => {
50
- getBody().removeChild(getPortalParent());
51
- };
52
44
  /**
53
45
  * Removes portal container from portal parent container
54
46
  * @param {HTMLDivElement | undefined} container - portal container to be removed from portal parent container
@@ -67,13 +59,4 @@ export const appendPortalContainerIfNotAppended = container => {
67
59
  if (!container.parentElement) {
68
60
  getPortalParent().appendChild(container);
69
61
  }
70
- };
71
- /**
72
- * Removes portal parent container from document body if there are no more portals inside it
73
- */
74
-
75
- export const removePortalParentContainerIfNoMorePortals = () => {
76
- if (!document.querySelector(portalSelector)) {
77
- removePortalParent();
78
- }
79
62
  };
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/portal",
3
- "version": "4.2.4",
3
+ "version": "4.2.7",
4
4
  "sideEffects": false
5
5
  }
@@ -1,6 +1,6 @@
1
1
  import { useEffect, useMemo } from 'react';
2
2
  import { createPortal } from 'react-dom';
3
- import { appendPortalContainerIfNotAppended, createContainer, removePortalContainer, removePortalParentContainerIfNoMorePortals } from '../utils/portal-dom-utils';
3
+ import { appendPortalContainerIfNotAppended, createContainer, removePortalContainer } from '../utils/portal-dom-utils';
4
4
  export default function InternalPortal(props) {
5
5
  var zIndex = props.zIndex,
6
6
  children = props.children;
@@ -15,7 +15,6 @@ export default function InternalPortal(props) {
15
15
  useEffect(function () {
16
16
  return function () {
17
17
  removePortalContainer(container);
18
- removePortalParentContainerIfNoMorePortals();
19
18
  };
20
19
  }, [container]);
21
20
  return /*#__PURE__*/createPortal(children, container);
@@ -1,4 +1,3 @@
1
- export var portalSelector = 'body > .atlaskit-portal-container > .atlaskit-portal';
2
1
  export var portalParentClassName = 'atlaskit-portal-container';
3
2
  export var portalParentSelector = 'body > .atlaskit-portal-container';
4
3
  export var portalClassName = 'atlaskit-portal';
@@ -1,4 +1,4 @@
1
- import { portalClassName, portalParentClassName, portalParentSelector, portalSelector } from '../constants';
1
+ import { portalClassName, portalParentClassName, portalParentSelector } from '../constants';
2
2
  /**
3
3
  * Creates a new portal container element with provided z-index and class name 'atlaskit-portal',
4
4
  * it is not be attached to any DOM node at this stage.
@@ -41,14 +41,6 @@ var getPortalParent = function getPortalParent() {
41
41
 
42
42
  return parentElement;
43
43
  };
44
- /**
45
- * Removes portal parent container from document body
46
- */
47
-
48
-
49
- var removePortalParent = function removePortalParent() {
50
- getBody().removeChild(getPortalParent());
51
- };
52
44
  /**
53
45
  * Removes portal container from portal parent container
54
46
  * @param {HTMLDivElement | undefined} container - portal container to be removed from portal parent container
@@ -67,13 +59,4 @@ export var appendPortalContainerIfNotAppended = function appendPortalContainerIf
67
59
  if (!container.parentElement) {
68
60
  getPortalParent().appendChild(container);
69
61
  }
70
- };
71
- /**
72
- * Removes portal parent container from document body if there are no more portals inside it
73
- */
74
-
75
- export var removePortalParentContainerIfNoMorePortals = function removePortalParentContainerIfNoMorePortals() {
76
- if (!document.querySelector(portalSelector)) {
77
- removePortalParent();
78
- }
79
62
  };
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/portal",
3
- "version": "4.2.4",
3
+ "version": "4.2.7",
4
4
  "sideEffects": false
5
5
  }
@@ -1,4 +1,3 @@
1
- export declare const portalSelector = "body > .atlaskit-portal-container > .atlaskit-portal";
2
1
  export declare const portalParentClassName = "atlaskit-portal-container";
3
2
  export declare const portalParentSelector = "body > .atlaskit-portal-container";
4
3
  export declare const portalClassName = "atlaskit-portal";
@@ -15,7 +15,3 @@ export declare const removePortalContainer: (container: HTMLDivElement) => void;
15
15
  * @param {HTMLDivElement | undefined} container - portal container to be added to portal parent container
16
16
  */
17
17
  export declare const appendPortalContainerIfNotAppended: (container: HTMLDivElement) => void;
18
- /**
19
- * Removes portal parent container from document body if there are no more portals inside it
20
- */
21
- export declare const removePortalParentContainerIfNoMorePortals: () => void;
@@ -1,2 +1,3 @@
1
+ /// <reference types="react" />
1
2
  import type { PortalProps } from './types';
2
3
  export default function Portal(props: PortalProps): JSX.Element | null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/portal",
3
- "version": "4.2.4",
3
+ "version": "4.2.7",
4
4
  "description": "Atlaskit wrapper for rendering components in React portals",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -16,7 +16,6 @@
16
16
  "atlaskit:src": "src/index.ts",
17
17
  "atlassian": {
18
18
  "team": "Design System Team",
19
- "inPublicMirror": true,
20
19
  "releaseModel": "scheduled",
21
20
  "website": {
22
21
  "name": "Portal"
@@ -27,7 +26,7 @@
27
26
  ".": "./src/index.ts"
28
27
  },
29
28
  "dependencies": {
30
- "@atlaskit/theme": "^11.4.0",
29
+ "@atlaskit/theme": "^12.1.0",
31
30
  "@babel/runtime": "^7.0.0"
32
31
  },
33
32
  "peerDependencies": {
@@ -35,16 +34,15 @@
35
34
  "react-dom": "^16.8.0"
36
35
  },
37
36
  "devDependencies": {
38
- "@atlaskit/build-utils": "*",
39
- "@atlaskit/button": "^16.1.0",
37
+ "@atlaskit/button": "^16.3.0",
40
38
  "@atlaskit/docs": "*",
41
- "@atlaskit/flag": "^14.4.0",
42
- "@atlaskit/icon": "^21.5.0",
43
- "@atlaskit/inline-dialog": "^13.1.0",
44
- "@atlaskit/modal-dialog": "^11.5.0",
45
- "@atlaskit/onboarding": "^10.1.0",
39
+ "@atlaskit/flag": "^14.5.0",
40
+ "@atlaskit/icon": "^21.10.0",
41
+ "@atlaskit/inline-dialog": "^13.3.0",
42
+ "@atlaskit/modal-dialog": "^12.2.0",
43
+ "@atlaskit/onboarding": "^10.3.0",
46
44
  "@atlaskit/ssr": "*",
47
- "@atlaskit/tooltip": "^17.4.0",
45
+ "@atlaskit/tooltip": "^17.5.0",
48
46
  "@atlaskit/visual-regression": "*",
49
47
  "@atlaskit/webdriver-runner": "*",
50
48
  "@atlassian/atlassian-frontend-prettier-config-1.0.1": "npm:@atlassian/atlassian-frontend-prettier-config@1.0.1",
@@ -52,7 +50,7 @@
52
50
  "enzyme": "^3.10.0",
53
51
  "raf-stub": "^2.0.1",
54
52
  "storybook-addon-performance": "^0.16.0",
55
- "typescript": "3.9.6"
53
+ "typescript": "4.2.4"
56
54
  },
57
55
  "keywords": [
58
56
  "atlaskit",
@@ -67,7 +65,11 @@
67
65
  "ui-components": "lite-mode",
68
66
  "analytics": "analytics-next",
69
67
  "theming": "tokens",
70
- "deprecation": "no-deprecated-imports"
68
+ "deprecation": "no-deprecated-imports",
69
+ "styling": [
70
+ "static",
71
+ "emotion"
72
+ ]
71
73
  }
72
74
  },
73
75
  "prettier": "@atlassian/atlassian-frontend-prettier-config-1.0.1"