@atlaskit/portal 4.2.3 → 4.2.6
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 +19 -0
- package/__perf__/examples.tsx +1 -0
- package/dist/cjs/index.js +6 -6
- package/dist/cjs/internal/components/internal-portal.js +0 -1
- package/dist/cjs/internal/constants.js +1 -3
- package/dist/cjs/internal/utils/portal-dom-utils.js +2 -22
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/internal/components/internal-portal.js +1 -2
- package/dist/es2019/internal/constants.js +0 -1
- package/dist/es2019/internal/utils/portal-dom-utils.js +1 -18
- package/dist/es2019/version.json +1 -1
- package/dist/esm/internal/components/internal-portal.js +1 -2
- package/dist/esm/internal/constants.js +0 -1
- package/dist/esm/internal/utils/portal-dom-utils.js +1 -18
- package/dist/esm/version.json +1 -1
- package/dist/types/internal/constants.d.ts +0 -1
- package/dist/types/internal/utils/portal-dom-utils.d.ts +0 -4
- package/dist/types/portal.d.ts +1 -0
- package/package.json +17 -23
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,24 @@
|
|
|
1
1
|
# @atlaskit/portal
|
|
2
2
|
|
|
3
|
+
## 4.2.6
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`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.
|
|
8
|
+
|
|
9
|
+
## 4.2.5
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [`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.
|
|
14
|
+
- Updated dependencies
|
|
15
|
+
|
|
16
|
+
## 4.2.4
|
|
17
|
+
|
|
18
|
+
### Patch Changes
|
|
19
|
+
|
|
20
|
+
- [`cd34d8ca8ea`](https://bitbucket.org/atlassian/atlassian-frontend/commits/cd34d8ca8ea) - Internal wiring up to the tokens techstack, no code changes.
|
|
21
|
+
|
|
3
22
|
## 4.2.3
|
|
4
23
|
|
|
5
24
|
### Patch Changes
|
package/__perf__/examples.tsx
CHANGED
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.
|
|
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.
|
|
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.
|
|
77
|
+
exports.appendPortalContainerIfNotAppended = appendPortalContainerIfNotAppended;
|
package/dist/cjs/version.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useEffect, useMemo } from 'react';
|
|
2
2
|
import { createPortal } from 'react-dom';
|
|
3
|
-
import { appendPortalContainerIfNotAppended, createContainer, removePortalContainer
|
|
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
|
|
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
|
};
|
package/dist/es2019/version.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useEffect, useMemo } from 'react';
|
|
2
2
|
import { createPortal } from 'react-dom';
|
|
3
|
-
import { appendPortalContainerIfNotAppended, createContainer, removePortalContainer
|
|
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,4 @@
|
|
|
1
|
-
import { portalClassName, portalParentClassName, portalParentSelector
|
|
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
|
};
|
package/dist/esm/version.json
CHANGED
|
@@ -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;
|
package/dist/types/portal.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/portal",
|
|
3
|
-
"version": "4.2.
|
|
3
|
+
"version": "4.2.6",
|
|
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": "^
|
|
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/
|
|
39
|
-
"@atlaskit/button": "^16.0.0",
|
|
37
|
+
"@atlaskit/button": "^16.2.0",
|
|
40
38
|
"@atlaskit/docs": "*",
|
|
41
|
-
"@atlaskit/flag": "^14.
|
|
42
|
-
"@atlaskit/icon": "^21.
|
|
43
|
-
"@atlaskit/inline-dialog": "^13.
|
|
44
|
-
"@atlaskit/modal-dialog": "^
|
|
45
|
-
"@atlaskit/onboarding": "^10.
|
|
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.
|
|
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.
|
|
53
|
+
"typescript": "3.9.10"
|
|
56
54
|
},
|
|
57
55
|
"keywords": [
|
|
58
56
|
"atlaskit",
|
|
@@ -64,17 +62,13 @@
|
|
|
64
62
|
"import-structure": "atlassian-conventions"
|
|
65
63
|
},
|
|
66
64
|
"@repo/internal": {
|
|
67
|
-
"ui-components":
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
"
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
"new-theming-api"
|
|
75
|
-
],
|
|
76
|
-
"deprecation": [
|
|
77
|
-
"no-deprecated-imports"
|
|
65
|
+
"ui-components": "lite-mode",
|
|
66
|
+
"analytics": "analytics-next",
|
|
67
|
+
"theming": "tokens",
|
|
68
|
+
"deprecation": "no-deprecated-imports",
|
|
69
|
+
"styling": [
|
|
70
|
+
"static",
|
|
71
|
+
"emotion"
|
|
78
72
|
]
|
|
79
73
|
}
|
|
80
74
|
},
|