@atlassian/clientside-extensions-components 4.0.2 → 5.1.0-5a180d69-mdyn784a
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/dist/cjs/ExtensionPoint.js +1 -1
- package/dist/cjs/ExtensionPoint.js.map +1 -1
- package/dist/cjs/ExtensionPointInfo.js +27 -20
- package/dist/cjs/ExtensionPointInfo.js.map +1 -1
- package/dist/cjs/ExtensionsObservable.js +1 -1
- package/dist/cjs/ExtensionsObservable.js.map +1 -1
- package/dist/cjs/handlers/AsyncPanelHandler.js +1 -1
- package/dist/cjs/handlers/AsyncPanelHandler.js.map +1 -1
- package/dist/cjs/handlers/ButtonHandler.js +2 -2
- package/dist/cjs/handlers/ButtonHandler.js.map +1 -1
- package/dist/cjs/handlers/LinkHandler.js +2 -2
- package/dist/cjs/handlers/LinkHandler.js.map +1 -1
- package/dist/cjs/handlers/ModalHandler.js +5 -5
- package/dist/cjs/handlers/ModalHandler.js.map +1 -1
- package/dist/cjs/handlers/PanelHandler.js +1 -1
- package/dist/cjs/handlers/PanelHandler.js.map +1 -1
- package/dist/cjs/handlers/SectionHandler.js +1 -2
- package/dist/cjs/handlers/SectionHandler.js.map +1 -1
- package/dist/cjs/index.js +10 -10
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/renderElementAsReact.js +4 -3
- package/dist/cjs/renderElementAsReact.js.map +1 -1
- package/dist/cjs/styled.js +17 -47
- package/dist/cjs/styled.js.map +1 -1
- package/dist/cjs/types.js +1 -2
- package/dist/cjs/types.js.map +1 -1
- package/dist/cjs/useExtensions.js +1 -1
- package/dist/cjs/useExtensions.js.map +1 -1
- package/dist/cjs/useWebPanelRenderer.js.map +1 -1
- package/dist/esm/ExtensionPoint.js.map +1 -1
- package/dist/esm/ExtensionPointInfo.js +26 -19
- package/dist/esm/ExtensionPointInfo.js.map +1 -1
- package/dist/esm/ExtensionsObservable.js.map +1 -1
- package/dist/esm/handlers/AsyncPanelHandler.js.map +1 -1
- package/dist/esm/handlers/ButtonHandler.js.map +1 -1
- package/dist/esm/handlers/LinkHandler.js.map +1 -1
- package/dist/esm/handlers/ModalHandler.js +5 -5
- package/dist/esm/handlers/ModalHandler.js.map +1 -1
- package/dist/esm/handlers/PanelHandler.js.map +1 -1
- package/dist/esm/handlers/SectionHandler.js +0 -1
- package/dist/esm/handlers/SectionHandler.js.map +1 -1
- package/dist/esm/renderElementAsReact.js +3 -2
- package/dist/esm/renderElementAsReact.js.map +1 -1
- package/dist/esm/styled.js +14 -44
- package/dist/esm/styled.js.map +1 -1
- package/dist/esm/useExtensions.js.map +1 -1
- package/dist/esm/useWebPanelRenderer.js.map +1 -1
- package/dist/types/ExtensionPointInfo.d.ts +1 -1
- package/dist/types/ExtensionPointInfo.d.ts.map +1 -1
- package/dist/types/ExtensionsObservable.d.ts.map +1 -1
- package/dist/types/debug/types.d.ts +1 -1
- package/dist/types/debug/types.d.ts.map +1 -1
- package/dist/types/debug/useDebug.d.ts.map +1 -1
- package/dist/types/debug/useDiscovery.d.ts.map +1 -1
- package/dist/types/debug/useLogging.d.ts.map +1 -1
- package/dist/types/debug/useValidation.d.ts.map +1 -1
- package/dist/types/handlers/AsyncPanelHandler.d.ts +1 -1
- package/dist/types/handlers/AsyncPanelHandler.d.ts.map +1 -1
- package/dist/types/handlers/ButtonHandler.d.ts +2 -0
- package/dist/types/handlers/ButtonHandler.d.ts.map +1 -1
- package/dist/types/handlers/LinkHandler.d.ts +2 -0
- package/dist/types/handlers/LinkHandler.d.ts.map +1 -1
- package/dist/types/handlers/ModalHandler.d.ts +2 -1
- package/dist/types/handlers/ModalHandler.d.ts.map +1 -1
- package/dist/types/handlers/SectionHandler.d.ts +6 -1
- package/dist/types/handlers/SectionHandler.d.ts.map +1 -1
- package/dist/types/renderElementAsReact.d.ts +2 -1
- package/dist/types/renderElementAsReact.d.ts.map +1 -1
- package/dist/types/styled.d.ts +33 -14
- package/dist/types/styled.d.ts.map +1 -1
- package/dist/types/types.d.ts +4 -4
- package/dist/types/types.d.ts.map +1 -1
- package/dist/types/useExtensions.d.ts.map +1 -1
- package/lib/ExtensionPoint.test.tsx +1 -1
- package/lib/ExtensionPointInfo.test.tsx +1 -1
- package/lib/ExtensionPointInfo.tsx +51 -24
- package/lib/ExtensionsObservable.test.ts +1 -1
- package/lib/__snapshots__/ExtensionPointInfo.test.tsx.snap +203 -124
- package/lib/debug/useDebug.test.ts +2 -2
- package/lib/debug/useDiscovery.test.ts +2 -2
- package/lib/debug/useLogging.test.ts +2 -2
- package/lib/debug/useValidation.test.ts +2 -2
- package/lib/handlers/ButtonHandler.test.tsx +5 -1
- package/lib/handlers/ButtonHandler.tsx +3 -1
- package/lib/handlers/LinkHandler.test.tsx +5 -1
- package/lib/handlers/LinkHandler.tsx +1 -0
- package/lib/handlers/ModalHandler.test.tsx +9 -7
- package/lib/handlers/ModalHandler.tsx +11 -9
- package/lib/handlers/SectionHandler.test.tsx +1 -1
- package/lib/handlers/SectionHandler.tsx +5 -1
- package/lib/renderElementAsReact.test.tsx +7 -6
- package/lib/renderElementAsReact.tsx +12 -3
- package/lib/styled.ts +15 -46
- package/lib/useExtensions.test.ts +49 -43
- package/package.json +25 -24
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SectionHandler.js","sourceRoot":"","sources":["../../../lib/handlers/SectionHandler.tsx"],"names":[],"mappings":";;;;AAAA
|
|
1
|
+
{"version":3,"file":"SectionHandler.js","sourceRoot":"","sources":["../../../lib/handlers/SectionHandler.tsx"],"names":[],"mappings":";;;;AAAA,0DAA0B;AAQnB,MAAM,cAAc,GAA2C,CAAC,EAAE,QAAQ,EAAE,EAAE,EAAE;IACnF,OAAO,8DAAG,QAAQ,CAAI,CAAC;AAC3B,CAAC,CAAC;AAFW,QAAA,cAAc,kBAEzB","sourcesContent":["import React from 'react';\nimport type { FunctionComponent } from 'react';\n\n// eslint-disable-next-line import/prefer-default-export\ninterface SectionHandlerProps {\n children: React.ReactNode;\n}\n\nexport const SectionHandler: FunctionComponent<SectionHandlerProps> = ({ children }) => {\n return <>{children}</>;\n};\n"]}
|
package/dist/cjs/index.js
CHANGED
|
@@ -3,23 +3,23 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.useDiscovery = exports.useValidation = exports.useLogging = exports.useDebug = exports.useWebPanelRenderer = exports.getValidatedExtensions = exports.renderElementAsReact = exports.ExtensionPointInfo = exports.ExtensionPoint = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
var ExtensionPoint_1 = require("./ExtensionPoint");
|
|
6
|
-
Object.defineProperty(exports, "ExtensionPoint", { enumerable: true, get: function () { return
|
|
6
|
+
Object.defineProperty(exports, "ExtensionPoint", { enumerable: true, get: function () { return tslib_1.__importDefault(ExtensionPoint_1).default; } });
|
|
7
7
|
var ExtensionPointInfo_1 = require("./ExtensionPointInfo");
|
|
8
|
-
Object.defineProperty(exports, "ExtensionPointInfo", { enumerable: true, get: function () { return
|
|
8
|
+
Object.defineProperty(exports, "ExtensionPointInfo", { enumerable: true, get: function () { return tslib_1.__importDefault(ExtensionPointInfo_1).default; } });
|
|
9
9
|
var renderElementAsReact_1 = require("./renderElementAsReact");
|
|
10
|
-
Object.defineProperty(exports, "renderElementAsReact", { enumerable: true, get: function () { return
|
|
10
|
+
Object.defineProperty(exports, "renderElementAsReact", { enumerable: true, get: function () { return tslib_1.__importDefault(renderElementAsReact_1).default; } });
|
|
11
11
|
var ExtensionsObservable_1 = require("./ExtensionsObservable");
|
|
12
12
|
Object.defineProperty(exports, "getValidatedExtensions", { enumerable: true, get: function () { return ExtensionsObservable_1.getValidatedExtensions; } });
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
tslib_1.__exportStar(require("./useExtensions"), exports);
|
|
14
|
+
tslib_1.__exportStar(require("./handlers"), exports);
|
|
15
15
|
var useWebPanelRenderer_1 = require("./useWebPanelRenderer");
|
|
16
|
-
Object.defineProperty(exports, "useWebPanelRenderer", { enumerable: true, get: function () { return
|
|
16
|
+
Object.defineProperty(exports, "useWebPanelRenderer", { enumerable: true, get: function () { return tslib_1.__importDefault(useWebPanelRenderer_1).default; } });
|
|
17
17
|
var useDebug_1 = require("./debug/useDebug");
|
|
18
|
-
Object.defineProperty(exports, "useDebug", { enumerable: true, get: function () { return
|
|
18
|
+
Object.defineProperty(exports, "useDebug", { enumerable: true, get: function () { return tslib_1.__importDefault(useDebug_1).default; } });
|
|
19
19
|
var useLogging_1 = require("./debug/useLogging");
|
|
20
|
-
Object.defineProperty(exports, "useLogging", { enumerable: true, get: function () { return
|
|
20
|
+
Object.defineProperty(exports, "useLogging", { enumerable: true, get: function () { return tslib_1.__importDefault(useLogging_1).default; } });
|
|
21
21
|
var useValidation_1 = require("./debug/useValidation");
|
|
22
|
-
Object.defineProperty(exports, "useValidation", { enumerable: true, get: function () { return
|
|
22
|
+
Object.defineProperty(exports, "useValidation", { enumerable: true, get: function () { return tslib_1.__importDefault(useValidation_1).default; } });
|
|
23
23
|
var useDiscovery_1 = require("./debug/useDiscovery");
|
|
24
|
-
Object.defineProperty(exports, "useDiscovery", { enumerable: true, get: function () { return
|
|
24
|
+
Object.defineProperty(exports, "useDiscovery", { enumerable: true, get: function () { return tslib_1.__importDefault(useDiscovery_1).default; } });
|
|
25
25
|
//# sourceMappingURL=index.js.map
|
package/dist/cjs/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../lib/index.ts"],"names":[],"mappings":";;;;AAAA,mDAAkF;AAAzE,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../lib/index.ts"],"names":[],"mappings":";;;;AAAA,mDAAkF;AAAzE,yIAAA,OAAO,OAAkB;AAClC,2DAAqE;AAA5D,iJAAA,OAAO,OAAsB;AACtC,+DAAyE;AAAhE,qJAAA,OAAO,OAAwB;AACxC,+DAAgE;AAAvD,8HAAA,sBAAsB,OAAA;AAE/B,0DAAgC;AAChC,qDAA2B;AAE3B,6DAAuE;AAA9D,mJAAA,OAAO,OAAuB;AAIvC,6CAAuD;AAA9C,6HAAA,OAAO,OAAY;AAC5B,iDAA2D;AAAlD,iIAAA,OAAO,OAAc;AAC9B,uDAAiE;AAAxD,uIAAA,OAAO,OAAiB;AACjC,qDAA+D;AAAtD,qIAAA,OAAO,OAAgB","sourcesContent":["export { default as ExtensionPoint, ExtensionPointProps } from './ExtensionPoint';\nexport { default as ExtensionPointInfo } from './ExtensionPointInfo';\nexport { default as renderElementAsReact } from './renderElementAsReact';\nexport { getValidatedExtensions } from './ExtensionsObservable';\n\nexport * from './useExtensions';\nexport * from './handlers';\n\nexport { default as useWebPanelRenderer } from './useWebPanelRenderer';\n\nexport type { Options, ExtensionState } from './types';\n\nexport { default as useDebug } from './debug/useDebug';\nexport { default as useLogging } from './debug/useLogging';\nexport { default as useValidation } from './debug/useValidation';\nexport { default as useDiscovery } from './debug/useDiscovery';\n"]}
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const tslib_1 = require("tslib");
|
|
4
|
-
const react_dom_1 =
|
|
5
|
-
const react_1 =
|
|
4
|
+
const react_dom_1 = tslib_1.__importDefault(require("react-dom"));
|
|
5
|
+
const react_1 = tslib_1.__importStar(require("react"));
|
|
6
6
|
function renderElementAsReact(renderApi, RenderElement, additionalProps) {
|
|
7
7
|
renderApi
|
|
8
8
|
.onMount((element) => {
|
|
9
9
|
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
10
|
-
react_dom_1.default.render(react_1.default.createElement(
|
|
10
|
+
react_dom_1.default.render(react_1.default.createElement(react_1.StrictMode, null,
|
|
11
|
+
react_1.default.createElement(RenderElement, { ...additionalProps })), element);
|
|
11
12
|
})
|
|
12
13
|
.onUnmount((element) => {
|
|
13
14
|
react_dom_1.default.unmountComponentAtNode(element);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"renderElementAsReact.js","sourceRoot":"","sources":["../../lib/renderElementAsReact.tsx"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"renderElementAsReact.js","sourceRoot":"","sources":["../../lib/renderElementAsReact.tsx"],"names":[],"mappings":";;;AAAA,kEAAiC;AAEjC,uDAA0C;AAG1C,SAAS,oBAAoB,CACzB,SAA6B,EAC7B,aAAoC,EACpC,eAAyB;IAEzB,SAAS;SACJ,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;QACjB,wDAAwD;QACxD,mBAAQ,CAAC,MAAM,CACX,8BAAC,kBAAU;YACP,8BAAC,aAAa,OAAM,eAA0B,GAAI,CACzC,EACb,OAAO,CACV,CAAC;IACN,CAAC,CAAC;SACD,SAAS,CAAC,CAAC,OAAO,EAAE,EAAE;QACnB,mBAAQ,CAAC,sBAAsB,CAAC,OAAO,CAAC,CAAC;IAC7C,CAAC,CAAC,CAAC;AACX,CAAC;AAED,kBAAe,oBAAoB,CAAC","sourcesContent":["import ReactDOM from 'react-dom';\nimport type { ComponentType } from 'react';\nimport React, { StrictMode } from 'react';\nimport type { MountableExtension } from '@atlassian/clientside-extensions';\n\nfunction renderElementAsReact<PropsT extends React.JSX.IntrinsicAttributes>(\n renderApi: MountableExtension,\n RenderElement: ComponentType<PropsT>,\n additionalProps?: unknown,\n) {\n renderApi\n .onMount((element) => {\n // eslint-disable-next-line react/jsx-props-no-spreading\n ReactDOM.render(\n <StrictMode>\n <RenderElement {...(additionalProps as PropsT)} />\n </StrictMode>,\n element,\n );\n })\n .onUnmount((element) => {\n ReactDOM.unmountComponentAtNode(element);\n });\n}\n\nexport default renderElementAsReact;\n"]}
|
package/dist/cjs/styled.js
CHANGED
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.TableCell = exports.TableRow = exports.HeadCell = exports.HeadRow = exports.Table = exports.Blinker = exports.BlinkerContainer = void 0;
|
|
3
|
+
exports.HeadingWrapper = exports.TableCell = exports.TableRow = exports.HeadCell = exports.HeadRow = exports.Table = exports.Blinker = exports.BlinkerContainer = exports.GRID_SIZE = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
const constants_1 = require("@atlaskit/theme/constants");
|
|
5
|
+
const tokens_1 = require("@atlaskit/tokens");
|
|
6
|
+
const styled_1 = tslib_1.__importDefault(require("@emotion/styled"));
|
|
7
|
+
const react_1 = require("@emotion/react");
|
|
8
|
+
exports.GRID_SIZE = 8;
|
|
10
9
|
exports.BlinkerContainer = styled_1.default.span `
|
|
11
10
|
position: relative;
|
|
12
11
|
`;
|
|
13
|
-
const blinkAnimation = (0,
|
|
12
|
+
const blinkAnimation = (0, react_1.keyframes) `
|
|
14
13
|
from {
|
|
15
14
|
transform: scale(1);
|
|
16
15
|
}
|
|
@@ -19,10 +18,11 @@ const blinkAnimation = (0, core_1.keyframes) `
|
|
|
19
18
|
transform: scale(1.3);
|
|
20
19
|
}
|
|
21
20
|
`;
|
|
21
|
+
/* eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage */
|
|
22
22
|
exports.Blinker = styled_1.default.button `
|
|
23
23
|
height: 22px;
|
|
24
24
|
width: 22px;
|
|
25
|
-
background:
|
|
25
|
+
background: ${(0, tokens_1.token)('color.background.input')};
|
|
26
26
|
border-radius: 50%;
|
|
27
27
|
animation: ${blinkAnimation} 1s ease-in-out infinite;
|
|
28
28
|
animation-direction: alternate;
|
|
@@ -45,66 +45,36 @@ exports.Blinker = styled_1.default.button `
|
|
|
45
45
|
// AK doesn't provide a plain Table styled component.
|
|
46
46
|
// Using AK theme to be compatible with their dark mode.
|
|
47
47
|
// Styles copied from: https://bitbucket.org/atlassian/atlassian-frontend/src/master/packages/design-system/dynamic-table/src/styled/
|
|
48
|
-
const rowTheme = {
|
|
49
|
-
focusOutline: (0, components_1.themed)({ light: colors.B100, dark: colors.B100 }),
|
|
50
|
-
borderColor: (0, components_1.themed)({ light: colors.N40, dark: colors.DN50 }),
|
|
51
|
-
highlightedBackground: (0, components_1.themed)({ light: colors.N20, dark: colors.DN50 }),
|
|
52
|
-
hoverBackground: (0, components_1.themed)({ light: colors.N10, dark: colors.DN40 }),
|
|
53
|
-
hoverHighlightedBackground: (0, components_1.themed)({ light: colors.N30, dark: colors.DN60 }),
|
|
54
|
-
};
|
|
55
|
-
const headTheme = {
|
|
56
|
-
focusOutline: (0, components_1.themed)({ light: colors.B100, dark: colors.B100 }),
|
|
57
|
-
borderColor: (0, components_1.themed)({ light: colors.N40, dark: colors.DN50 }),
|
|
58
|
-
textColor: (0, components_1.themed)({ light: colors.N300, dark: colors.DN300 }),
|
|
59
|
-
};
|
|
60
48
|
exports.Table = styled_1.default.table `
|
|
61
49
|
border-collapse: collapse;
|
|
62
50
|
width: 100%;
|
|
63
51
|
`;
|
|
64
52
|
exports.HeadRow = styled_1.default.tr `
|
|
65
|
-
border-bottom:
|
|
53
|
+
border-bottom: 1px solid ${(0, tokens_1.token)('color.border')};
|
|
66
54
|
`;
|
|
67
55
|
exports.HeadCell = styled_1.default.th `
|
|
68
|
-
padding: ${
|
|
69
|
-
&:first-of-type {
|
|
70
|
-
padding-left: 0;
|
|
71
|
-
}
|
|
72
|
-
&:last-of-type {
|
|
73
|
-
padding-right: 0;
|
|
74
|
-
}
|
|
56
|
+
padding: ${exports.GRID_SIZE / 2}px ${exports.GRID_SIZE}px;
|
|
75
57
|
border: none;
|
|
76
|
-
color: ${
|
|
58
|
+
color: ${(0, tokens_1.token)('color.text')};
|
|
77
59
|
box-sizing: border-box;
|
|
78
60
|
font-size: 12px;
|
|
79
61
|
font-weight: bold;
|
|
80
62
|
position: relative;
|
|
81
63
|
text-align: left;
|
|
82
64
|
vertical-align: top;
|
|
83
|
-
&:focus {
|
|
84
|
-
outline: solid 2px ${headTheme.focusOutline};
|
|
85
|
-
}
|
|
86
65
|
`;
|
|
87
|
-
const outlineWidth = '2px';
|
|
88
66
|
exports.TableRow = styled_1.default.tr `
|
|
89
|
-
border-bottom:
|
|
67
|
+
border-bottom: 1px solid ${(0, tokens_1.token)('color.border')};
|
|
90
68
|
&:hover {
|
|
91
|
-
background-color: ${
|
|
92
|
-
}
|
|
93
|
-
&:focus {
|
|
94
|
-
outline: ${outlineWidth} solid ${rowTheme.focusOutline};
|
|
95
|
-
outline-offset: -${outlineWidth};
|
|
69
|
+
background-color: ${(0, tokens_1.token)('color.background.neutral.subtle.hovered')};
|
|
96
70
|
}
|
|
97
71
|
`;
|
|
98
72
|
exports.TableCell = styled_1.default.td `
|
|
99
73
|
border: none;
|
|
100
|
-
padding: ${
|
|
74
|
+
padding: ${exports.GRID_SIZE / 1.2}px ${exports.GRID_SIZE}px;
|
|
101
75
|
text-align: left;
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
}
|
|
106
|
-
&:last-of-type {
|
|
107
|
-
padding-right: 0;
|
|
108
|
-
}
|
|
76
|
+
`;
|
|
77
|
+
exports.HeadingWrapper = styled_1.default.div `
|
|
78
|
+
margin-top: 30px;
|
|
109
79
|
`;
|
|
110
80
|
//# sourceMappingURL=styled.js.map
|
package/dist/cjs/styled.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"styled.js","sourceRoot":"","sources":["../../lib/styled.ts"],"names":[],"mappings":";;;;AAAA,
|
|
1
|
+
{"version":3,"file":"styled.js","sourceRoot":"","sources":["../../lib/styled.ts"],"names":[],"mappings":";;;;AAAA,6CAAyC;AACzC,qEAAqC;AACrC,0CAA2C;AAE9B,QAAA,SAAS,GAAG,CAAC,CAAC;AAEd,QAAA,gBAAgB,GAAG,gBAAM,CAAC,IAAI,CAAA;;CAE1C,CAAC;AAEF,MAAM,cAAc,GAAG,IAAA,iBAAS,EAAA;;;;;;;;CAQ/B,CAAC;AAEF,gFAAgF;AACnE,QAAA,OAAO,GAAG,gBAAM,CAAC,MAAM,CAAA;;;kBAGlB,IAAA,cAAK,EAAC,wBAAwB,CAAC;;iBAEhC,cAAc;;;;;;;;;;;;;;;;;CAiB9B,CAAC;AAEF,qDAAqD;AACrD,wDAAwD;AACxD,qIAAqI;AACxH,QAAA,KAAK,GAAG,gBAAM,CAAC,KAAK,CAAA;;;CAGhC,CAAC;AAEW,QAAA,OAAO,GAAG,gBAAM,CAAC,EAAE,CAAA;+BACD,IAAA,cAAK,EAAC,cAAc,CAAC;CACnD,CAAC;AAEW,QAAA,QAAQ,GAAG,gBAAM,CAAC,EAAE,CAAA;eAClB,iBAAS,GAAG,CAAC,MAAM,iBAAS;;aAE9B,IAAA,cAAK,EAAC,YAAY,CAAC;;;;;;;CAO/B,CAAC;AAEW,QAAA,QAAQ,GAAG,gBAAM,CAAC,EAAE,CAAA;+BACF,IAAA,cAAK,EAAC,cAAc,CAAC;;4BAExB,IAAA,cAAK,EAAC,yCAAyC,CAAC;;CAE3E,CAAC;AAEW,QAAA,SAAS,GAAG,gBAAM,CAAC,EAAE,CAAA;;eAEnB,iBAAS,GAAG,GAAG,MAAM,iBAAS;;CAE5C,CAAC;AAEW,QAAA,cAAc,GAAG,gBAAM,CAAC,GAAG,CAAA;;CAEvC,CAAC","sourcesContent":["import { token } from '@atlaskit/tokens';\nimport styled from '@emotion/styled';\nimport { keyframes } from '@emotion/react';\n\nexport const GRID_SIZE = 8;\n\nexport const BlinkerContainer = styled.span`\n position: relative;\n`;\n\nconst blinkAnimation = keyframes`\n from {\n transform: scale(1);\n }\n\n to {\n transform: scale(1.3);\n }\n`;\n\n/* eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage */\nexport const Blinker = styled.button`\n height: 22px;\n width: 22px;\n background: ${token('color.background.input')};\n border-radius: 50%;\n animation: ${blinkAnimation} 1s ease-in-out infinite;\n animation-direction: alternate;\n cursor: pointer;\n border: none;\n\n &:after {\n display: block;\n background: rgb(7, 71, 166, 0.8);\n position: absolute;\n height: 12px;\n width: 12px;\n content: '';\n left: 50%;\n top: 50%;\n margin: -6px 0 0 -6px;\n border-radius: 50%;\n }\n`;\n\n// AK doesn't provide a plain Table styled component.\n// Using AK theme to be compatible with their dark mode.\n// Styles copied from: https://bitbucket.org/atlassian/atlassian-frontend/src/master/packages/design-system/dynamic-table/src/styled/\nexport const Table = styled.table`\n border-collapse: collapse;\n width: 100%;\n`;\n\nexport const HeadRow = styled.tr`\n border-bottom: 1px solid ${token('color.border')};\n`;\n\nexport const HeadCell = styled.th`\n padding: ${GRID_SIZE / 2}px ${GRID_SIZE}px;\n border: none;\n color: ${token('color.text')};\n box-sizing: border-box;\n font-size: 12px;\n font-weight: bold;\n position: relative;\n text-align: left;\n vertical-align: top;\n`;\n\nexport const TableRow = styled.tr`\n border-bottom: 1px solid ${token('color.border')};\n &:hover {\n background-color: ${token('color.background.neutral.subtle.hovered')};\n }\n`;\n\nexport const TableCell = styled.td`\n border: none;\n padding: ${GRID_SIZE / 1.2}px ${GRID_SIZE}px;\n text-align: left;\n`;\n\nexport const HeadingWrapper = styled.div`\n margin-top: 30px;\n`;\n"]}
|
package/dist/cjs/types.js
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isNotNullOrUndefined =
|
|
3
|
+
exports.isNotNullOrUndefined = isNotNullOrUndefined;
|
|
4
4
|
function isNotNullOrUndefined(input) {
|
|
5
5
|
return input !== undefined && input != null;
|
|
6
6
|
}
|
|
7
|
-
exports.isNotNullOrUndefined = isNotNullOrUndefined;
|
|
8
7
|
//# sourceMappingURL=types.js.map
|
package/dist/cjs/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../lib/types.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../lib/types.ts"],"names":[],"mappings":";;AAsBA,oDAEC;AAFD,SAAgB,oBAAoB,CAAI,KAA2B;IAC/D,OAAO,KAAK,KAAK,SAAS,IAAI,KAAK,IAAI,IAAI,CAAC;AAChD,CAAC","sourcesContent":["import type { ReactNode } from 'react';\nimport type { ExtensionAttributes, ExtensionDescriptor } from '@atlassian/clientside-extensions-registry';\n// We only import types here\n// eslint-disable-next-line node/no-unpublished-import\nimport type { Validator } from '@atlassian/clientside-extensions-schema';\n\nexport type ExtensionState<T extends ExtensionAttributes> = [ExtensionDescriptor<T>[], ExtensionDescriptor<T>[], boolean];\nexport type ExtensionPointCallback<T> = (supportedDescriptors: T[], unsupportedDescriptors: T[], loading: boolean) => ReactNode;\nexport type ExtensionPointState<T extends ExtensionAttributes = ExtensionAttributes> = {\n descriptors: ExtensionDescriptor<T>[];\n loadingState: boolean;\n};\nexport type ExtensionPointUpdate<T extends ExtensionAttributes = ExtensionAttributes> = {\n state: ExtensionPointState<T>;\n update: ExtensionDescriptor<T>[];\n};\n\nexport interface Options {\n attributeValidator: Validator;\n contextValidator?: Validator;\n}\n\nexport function isNotNullOrUndefined<T>(input: null | undefined | T): input is T {\n return input !== undefined && input != null;\n}\n"]}
|
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.useExtensionsLoadingState = exports.useExtensionsUnsupported = exports.useExtensions = exports.useExtensionsAll = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const react_1 = require("react");
|
|
6
|
-
const lodash_isequal_1 =
|
|
6
|
+
const lodash_isequal_1 = tslib_1.__importDefault(require("lodash.isequal"));
|
|
7
7
|
const clientside_extensions_debug_1 = require("@atlassian/clientside-extensions-debug");
|
|
8
8
|
const ExtensionsObservable_1 = require("./ExtensionsObservable");
|
|
9
9
|
const useDeepCompareMemoize = (value) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useExtensions.js","sourceRoot":"","sources":["../../lib/useExtensions.ts"],"names":[],"mappings":";;;;AAA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CAAC,CAAC;QAChC,CAAC,CACJ,CAAC;QAEF,OAAO,GAAG,EAAE,CAAC,YAAY,CAAC,WAAW,EAAE,CAAC;IAC5C,CAAC,EAAE,CAAC,cAAc,EAAE,aAAa,EAAE,aAAa,CAAC,CAAC,CAAC;IAEnD,OAAO,gBAAgB,CAAC;AAC5B,CAAC,CAAC;AA/BW,QAAA,gBAAgB,oBA+B3B;AAEK,MAAM,aAAa,GAAG,CACzB,cAAsB,EACtB,OAAiB,EACjB,OAAgB,EAClB,EAAE;IACA,MAAM,iBAAiB,GAAG,IAAA,wBAAgB,EAAwB,cAAc,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;IACpG,OAAO,iBAAiB,CAAC,CAAC,CAAC,CAAC;AAChC,CAAC,CAAC;AAPW,QAAA,aAAa,iBAOxB;AAEK,MAAM,wBAAwB,GAAG,CAIpC,IAAY,EACZ,OAAiB,EACjB,OAAgB,EAClB,EAAE;IACA,MAAM,iBAAiB,GAAG,IAAA,wBAAgB,EAAwB,IAAI,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;IAC1F,OAAO,iBAAiB,CAAC,CAAC,CAAC,CAAC;AAChC,CAAC,CAAC;AAVW,QAAA,wBAAwB,4BAUnC;AAEK,MAAM,yBAAyB,GAAG,CAIrC,IAAY,EACZ,OAAiB,EACjB,OAAgB,EAClB,EAAE;IACA,MAAM,iBAAiB,GAAG,IAAA,wBAAgB,EAAwB,IAAI,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;IAC1F,OAAO,iBAAiB,CAAC,CAAC,CAAC,CAAC;AAChC,CAAC,CAAC;AAVW,QAAA,yBAAyB,6BAUpC","sourcesContent":["import { useEffect, useRef, useState } from 'react';\nimport isEqual from 'lodash.isequal';\nimport type { ExtensionAttributes, Context } from '@atlassian/clientside-extensions-registry';\nimport { onDebug } from '@atlassian/clientside-extensions-debug';\nimport { getValidatedExtensions } from './ExtensionsObservable';\nimport type { ExtensionState, Options } from './types';\n\nconst useDeepCompareMemoize = <T>(value: T): T => {\n const ref = useRef<T>({} as T);\n\n if (!isEqual(value, ref.current)) {\n ref.current = value;\n }\n\n return ref.current;\n};\n\nexport const useExtensionsAll = <ContextT extends Context<{}> | null = null, AttributesT extends ExtensionAttributes = ExtensionAttributes>(\n extensionPoint: string,\n context: ContextT,\n options: Options,\n): ExtensionState<AttributesT> => {\n const [descriptorsState, setDescriptorsState] = useState<ExtensionState<AttributesT>>([[], [], true]);\n const cachedContext = useDeepCompareMemoize(context);\n const cachedOptions = useDeepCompareMemoize(options);\n\n useEffect(() => {\n const subscription = getValidatedExtensions<ContextT, AttributesT>(extensionPoint, cachedContext, cachedOptions).subscribe(\n (update) => {\n onDebug(({ debug }) => ({\n level: debug,\n message: `useExtensionsAll React hook received a new state`,\n components: 'useExtensionsAll',\n meta: {\n extensionPoint,\n context: cachedContext,\n update,\n },\n }));\n\n setDescriptorsState(update);\n },\n );\n\n return () => subscription.unsubscribe();\n }, [extensionPoint, cachedContext, cachedOptions]);\n\n return descriptorsState;\n};\n\nexport const useExtensions = <ContextT extends Context<{}> | null = null, AttributesT extends ExtensionAttributes = ExtensionAttributes>(\n extensionPoint: string,\n context: ContextT,\n options: Options,\n) => {\n const extensionsPayload = useExtensionsAll<ContextT, AttributesT>(extensionPoint, context, options);\n return extensionsPayload[0];\n};\n\nexport const useExtensionsUnsupported = <\n ContextT extends Context<{}> | null = null,\n AttributesU extends ExtensionAttributes = ExtensionAttributes,\n>(\n name: string,\n context: ContextT,\n options: Options,\n) => {\n const extensionsPayload = useExtensionsAll<ContextT, AttributesU>(name, context, options);\n return extensionsPayload[1];\n};\n\nexport const useExtensionsLoadingState = <\n ContextT extends Context<{}> | null = null,\n AttributesU extends ExtensionAttributes = ExtensionAttributes,\n>(\n name: string,\n context: ContextT,\n options: Options,\n) => {\n const extensionsPayload = useExtensionsAll<ContextT, AttributesU>(name, context, options);\n return extensionsPayload[2];\n};\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useWebPanelRenderer.js","sourceRoot":"","sources":["../../lib/useWebPanelRenderer.tsx"],"names":[],"mappings":";;AAAA,wFAAiE;AACjE,iCAA4C;AAE5C,MAAM,cAAc,GAAG,CAAC,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,UAAU,CAAU,CAAC;AAErE,MAAM,eAAe,GAAG,CAAC,cAAiC,EAAE,EAAE;IAC1D,MAAM,MAAM,GAAG,QAAQ,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC;IAChD,MAAM,CAAC,IAAI,GAAG,cAAc,CAAC,IAAI,CAAC;IAClC,cAAc,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE;QAC5B,6FAA6F;QAC7F,iFAAiF;QACjF,IAAI,cAAc,CAAC,IAAI,CAAC,EAAE;
|
|
1
|
+
{"version":3,"file":"useWebPanelRenderer.js","sourceRoot":"","sources":["../../lib/useWebPanelRenderer.tsx"],"names":[],"mappings":";;AAAA,wFAAiE;AACjE,iCAA4C;AAE5C,MAAM,cAAc,GAAG,CAAC,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,UAAU,CAAU,CAAC;AAErE,MAAM,eAAe,GAAG,CAAC,cAAiC,EAAE,EAAE;IAC1D,MAAM,MAAM,GAAG,QAAQ,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC;IAChD,MAAM,CAAC,IAAI,GAAG,cAAc,CAAC,IAAI,CAAC;IAClC,cAAc,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE;QAC5B,6FAA6F;QAC7F,iFAAiF;QACjF,IAAI,cAAc,CAAC,IAAI,CAAC,EAAE,CAAC;YACvB,yEAAyE;YACzE,MAAM,CAAC,IAAI,CAAC,GAAG,cAAc,CAAC,IAAI,CAAE,CAAC;QACzC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,IAAI,CAAC;QACD,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;IACtC,CAAC;IAAC,OAAO,CAAC,EA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I,EAAE,EAAE;;QACL,gDAAgD;QAChD,IAAI,MAAA,GAAG,aAAH,GAAG,uBAAH,GAAG,CAAE,OAAO,0CAAE,0BAA0B,EAAE,CAAC;YAC3C,OAAO;QACX,CAAC;QAED,iCAAiC;QACjC,IAAI,IAAI,EAAE,CAAC;YACP,8BAA8B,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;YAC3C,gDAAgD;YAC/C,IAAyB,CAAC,0BAA0B,GAAG,IAAI,CAAC;QACjE,CAAC;QAED,uFAAuF;QACvF,GAAG,CAAC,OAAO,GAAG,IAAI,CAAC;IACvB,CAAC,EACD,CAAC,IAAI,CAAC,CACT,CAAC;IAEF,OAAO,MAAM,CAAC;AAClB,CAAC,CAAC;AAEF,kBAAe,mBAAmB,CAAC","sourcesContent":["import { onDebug } from '@atlassian/clientside-extensions-debug';\nimport { useCallback, useRef } from 'react';\n\nconst copyAttributes = ['type', 'src', 'nonce', 'noModule'] as const;\n\nconst evaluateScripts = (originalScript: HTMLScriptElement) => {\n const script = document.createElement('script');\n script.text = originalScript.text;\n copyAttributes.forEach((attr) => {\n // we cant just check if an attribute exists, as some of them are enforced to be \"properties\"\n // see: https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/nonce\n if (originalScript[attr]) {\n // @ts-expect-error We want to assign whatever here, typescript be quiet!\n script[attr] = originalScript[attr]!;\n }\n });\n\n try {\n document.head.appendChild(script);\n } catch (e) {\n onDebug(({ error }) => ({\n level: error,\n message: `An inline script in a WebPanel failed to execute.`,\n meta: {\n error: e,\n },\n }));\n }\n\n try {\n script.remove();\n } catch (e) {\n onDebug(({ error }) => ({\n level: error,\n message: `Failed to remove inline script associated with WebPanel.`,\n meta: {\n error: e,\n },\n }));\n }\n};\n\nconst injectAndEvaluateInlineScripts = (node: HTMLElement, html: string) => {\n const template = document.createElement('template');\n template.innerHTML = html;\n const scripts = template.content.querySelectorAll('script');\n scripts.forEach((script) => script.remove());\n\n node.appendChild(template.content);\n\n scripts.forEach((script) => evaluateScripts(script));\n};\n\ntype WebpanelRootNode = { __cse_webpanel_initialized: boolean } & HTMLElement;\n\nconst useWebPanelRenderer = (html: string) => {\n const ref = useRef<WebpanelRootNode>(null);\n const setRef = useCallback<(node: HTMLElement | null) => void>(\n (node) => {\n // eslint-disable-next-line no-underscore-dangle\n if (ref?.current?.__cse_webpanel_initialized) {\n return;\n }\n\n // where the actual work happens.\n if (node) {\n injectAndEvaluateInlineScripts(node, html);\n // eslint-disable-next-line no-underscore-dangle\n (node as WebpanelRootNode).__cse_webpanel_initialized = true;\n }\n\n // @ts-expect-error This is typed as a \"read-only\" property, but in fact it can be set.\n ref.current = node;\n },\n [html],\n );\n\n return setRef;\n};\n\nexport default useWebPanelRenderer;\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExtensionPoint.js","sourceRoot":"","sources":["../../lib/ExtensionPoint.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,wCAAwC,CAAC;AACjE,OAAO,KAAK,EAAE,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC;AACpC,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAUnD,MAAM,cAAc,GAAkC,CAAC,EAAE,IAAI,EAAE,OAAO,GAAG,IAAI,EAAE,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE;IAClG,MAAM,CAAC,oBAAoB,EAAE,sBAAsB,EAAE,SAAS,CAAC,GAAG,gBAAgB,CAAC,IAAI,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;IAE3G,IAAI,OAAO,QAAQ,KAAK,UAAU,EAAE;
|
|
1
|
+
{"version":3,"file":"ExtensionPoint.js","sourceRoot":"","sources":["../../lib/ExtensionPoint.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,wCAAwC,CAAC;AACjE,OAAO,KAAK,EAAE,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC;AACpC,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAUnD,MAAM,cAAc,GAAkC,CAAC,EAAE,IAAI,EAAE,OAAO,GAAG,IAAI,EAAE,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE;IAClG,MAAM,CAAC,oBAAoB,EAAE,sBAAsB,EAAE,SAAS,CAAC,GAAG,gBAAgB,CAAC,IAAI,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;IAE3G,IAAI,OAAO,QAAQ,KAAK,UAAU,EAAE,CAAC;QACjC,OAAO,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE;YAClB,OAAO;gBACH,KAAK,EAAE,KAAK;gBAEZ,OAAO,EAAE,+FAA+F,IAAI,sBAAsB;gBAClI,UAAU,EAAE,gBAAgB;gBAC5B,IAAI,EAAE;oBACF,IAAI;oBACJ,OAAO;oBACP,OAAO;iBACV;aACJ,CAAC;QACN,CAAC,CAAC,CAAC;QACH,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,OAAO,0CAAG,QAAQ,CAAC,oBAAoB,EAAE,sBAAsB,EAAE,SAAS,CAAC,CAAI,CAAC;AACpF,CAAC,CAAC;AAEF,eAAe,IAAI,CAAC,cAAc,CAAC,CAAC","sourcesContent":["import type { Context, ExtensionDescriptor } from '@atlassian/clientside-extensions-registry';\nimport { onDebug } from '@atlassian/clientside-extensions-debug';\nimport React, { memo } from 'react';\nimport { useExtensionsAll } from './useExtensions';\nimport type { ExtensionPointCallback, Options } from './types';\n\nexport interface ExtensionPointProps {\n name: string;\n context?: Context<{}> | null;\n options: Options;\n children: ExtensionPointCallback<ExtensionDescriptor>;\n}\n\nconst ExtensionPoint: React.FC<ExtensionPointProps> = ({ name, context = null, options, children }) => {\n const [supportedDescriptors, unsupportedDescriptors, isLoading] = useExtensionsAll(name, context, options);\n\n if (typeof children !== 'function') {\n onDebug(({ error }) => {\n return {\n level: error,\n\n message: `ExtensionPoint expects a render-child.\\nThe \"children\"-property passed for extension point \"${name}\" is not a function.`,\n components: 'ExtensionPoint',\n meta: {\n name,\n context,\n options,\n },\n };\n });\n return null;\n }\n\n return <>{children(supportedDescriptors, unsupportedDescriptors, isLoading)}</>;\n};\n\nexport default memo(ExtensionPoint);\n"]}
|
|
@@ -1,16 +1,17 @@
|
|
|
1
|
+
import Button from '@atlaskit/button/new';
|
|
2
|
+
import Heading from '@atlaskit/heading';
|
|
3
|
+
import Modal, { ModalFooter, ModalHeader, ModalTitle, ModalTransition } from '@atlaskit/modal-dialog';
|
|
1
4
|
import React, { memo, useState } from 'react';
|
|
2
|
-
import
|
|
3
|
-
import Modal, { ModalTransition, ModalTitle, ModalHeader, ModalFooter } from '@atlaskit/modal-dialog';
|
|
4
|
-
import { Link, Element } from 'react-scroll';
|
|
5
|
-
import { gridSize } from '@atlaskit/theme/constants';
|
|
5
|
+
import { Element, Link } from 'react-scroll';
|
|
6
6
|
import useDiscovery from './debug/useDiscovery';
|
|
7
|
-
import {
|
|
7
|
+
import { Blinker, BlinkerContainer, GRID_SIZE, HeadCell, HeadingWrapper, HeadRow, Table, TableCell, TableRow } from './styled';
|
|
8
8
|
const LinkToElement = ({ to }) => {
|
|
9
9
|
// TODO: is there a way to get the clean type from the schema?
|
|
10
10
|
// We are removing the e.g. "!" required syntax that is a suffix of the schema type
|
|
11
11
|
const cleanTo = to.replace(/[^a-zA-Z0-9]/g, '');
|
|
12
12
|
return (
|
|
13
|
-
// eslint-disable-next-line jsx-a11y/anchor-is-valid
|
|
13
|
+
// eslint-disable-next-line jsx-a11y/anchor-is-valid, @typescript-eslint/ban-ts-comment
|
|
14
|
+
// @ts-ignore: react-scroll types are not up to date with the latest react version
|
|
14
15
|
React.createElement(Link, { to: cleanTo, href: "", containerId: "___cse_info_container", offset: -20, smooth: true }, to));
|
|
15
16
|
};
|
|
16
17
|
const TypeRenderer = ({ objectType }) => (React.createElement(React.Fragment, null,
|
|
@@ -31,14 +32,16 @@ const TypeRenderer = ({ objectType }) => (React.createElement(React.Fragment, nu
|
|
|
31
32
|
React.createElement(TableCell, { width: "10%" }, descriptor.required ? 'true' : 'false'),
|
|
32
33
|
React.createElement(TableCell, null, descriptor.description))))))));
|
|
33
34
|
const EnumTypeRenderer = ({ enumType }) => (React.createElement(React.Fragment, null,
|
|
34
|
-
React.createElement(
|
|
35
|
-
React.createElement(
|
|
35
|
+
React.createElement(HeadingWrapper, null,
|
|
36
|
+
React.createElement(Heading, { size: "small", as: "h3" },
|
|
37
|
+
React.createElement(Element, { id: enumType.name }, enumType.name))),
|
|
36
38
|
enumType.description ? (React.createElement("p", null, enumType.description)) : (React.createElement("p", null,
|
|
37
39
|
"Enum type with the following values: ",
|
|
38
40
|
React.createElement("b", null, enumType.values.join(', '))))));
|
|
39
41
|
const UnionTypeRenderer = ({ unionType }) => (React.createElement(React.Fragment, null,
|
|
40
|
-
React.createElement(
|
|
41
|
-
React.createElement(
|
|
42
|
+
React.createElement(HeadingWrapper, null,
|
|
43
|
+
React.createElement(Heading, { size: "small", as: "h3" },
|
|
44
|
+
React.createElement(Element, { id: unionType.name }, unionType.name))),
|
|
42
45
|
unionType.description ? (React.createElement("p", null, unionType.description)) : (React.createElement("p", null,
|
|
43
46
|
"Union of the following types:",
|
|
44
47
|
' ',
|
|
@@ -46,8 +49,9 @@ const UnionTypeRenderer = ({ unionType }) => (React.createElement(React.Fragment
|
|
|
46
49
|
i === 0 ? '' : ', ',
|
|
47
50
|
React.createElement(LinkToElement, { to: _type }))))))));
|
|
48
51
|
const ScalarRenderer = ({ scalar }) => (React.createElement(React.Fragment, null,
|
|
49
|
-
React.createElement(
|
|
50
|
-
React.createElement(
|
|
52
|
+
React.createElement(HeadingWrapper, null,
|
|
53
|
+
React.createElement(Heading, { size: "small", as: "h3" },
|
|
54
|
+
React.createElement(Element, { id: scalar.name }, scalar.name))),
|
|
51
55
|
React.createElement("p", null, scalar.description)));
|
|
52
56
|
const SchemasRenderer = ({ schemaDocuments: { schema, contextSchema } }) => {
|
|
53
57
|
const { objectTypes: { Schema: attributesDocument, ...attributeObjectTypes } = { Schema: null }, scalars: attributeScalars, enumTypes: attributesEnumTypes, unionTypes: attributesUnionTypes, } = schema || {};
|
|
@@ -57,19 +61,22 @@ const SchemasRenderer = ({ schemaDocuments: { schema, contextSchema } }) => {
|
|
|
57
61
|
const enumTypes = Object.values({ ...attributesEnumTypes, ...contextEnumTypes });
|
|
58
62
|
const unionTypes = Object.values({ ...attributesUnionTypes, ...contextUnionTypes });
|
|
59
63
|
return (React.createElement(React.Fragment, null,
|
|
60
|
-
React.createElement("
|
|
64
|
+
React.createElement(Heading, { size: "medium", as: "h2" }, "Attributes"),
|
|
61
65
|
attributesDocument ? (React.createElement(React.Fragment, null,
|
|
62
66
|
React.createElement("p", null, "List of attributes supported by this extension point."),
|
|
63
67
|
React.createElement(TypeRenderer, { objectType: attributesDocument }))) : (React.createElement("p", null, "No attributes information provided for this extension point.")),
|
|
64
|
-
React.createElement(
|
|
68
|
+
React.createElement(HeadingWrapper, null,
|
|
69
|
+
React.createElement(Heading, { size: "medium", as: "h2" }, "Context")),
|
|
65
70
|
contextDocument ? (React.createElement(React.Fragment, null,
|
|
66
71
|
React.createElement("p", null, "List of values provided by this extension point as context."),
|
|
67
72
|
React.createElement(TypeRenderer, { objectType: contextDocument }))) : (React.createElement("p", null, "No context information provided for this extension point.")),
|
|
68
|
-
React.createElement(
|
|
73
|
+
React.createElement(HeadingWrapper, null,
|
|
74
|
+
React.createElement(Heading, { size: "medium", as: "h2" }, "Types reference")),
|
|
69
75
|
objectTypeEntries &&
|
|
70
76
|
objectTypeEntries.map((objectType) => (React.createElement(React.Fragment, { key: objectType.name },
|
|
71
|
-
React.createElement(
|
|
72
|
-
React.createElement(
|
|
77
|
+
React.createElement(HeadingWrapper, null,
|
|
78
|
+
React.createElement(Heading, { size: "small", as: "h3" },
|
|
79
|
+
React.createElement(Element, { id: objectType.name }, objectType.name))),
|
|
73
80
|
React.createElement(TypeRenderer, { objectType: objectType })))),
|
|
74
81
|
enumTypes && enumTypes.map((enumType) => React.createElement(EnumTypeRenderer, { key: enumType.name, enumType: enumType })),
|
|
75
82
|
unionTypes && unionTypes.map((unionType) => React.createElement(UnionTypeRenderer, { key: unionType.name, unionType: unionType })),
|
|
@@ -80,7 +87,7 @@ const bodyStyles = {
|
|
|
80
87
|
overflowY: 'auto',
|
|
81
88
|
overflowX: 'hidden',
|
|
82
89
|
// The rest of the styles are copied from the @atlaskit/modal-dialog/dist/esm/modal-body.js
|
|
83
|
-
padding:
|
|
90
|
+
padding: GRID_SIZE * 3,
|
|
84
91
|
flex: '1 1 auto',
|
|
85
92
|
};
|
|
86
93
|
const CustomModalBody = ({ children }) => {
|
|
@@ -93,7 +100,7 @@ const ExtensionPointInfo = ({ name, schemaDocuments }) => {
|
|
|
93
100
|
return !showExtensionPointInfo ? null : (React.createElement(BlinkerContainer, null,
|
|
94
101
|
React.createElement(Blinker, { type: "button", onClick: () => setDialogState(true) }),
|
|
95
102
|
React.createElement(ModalTransition, null, dialogOpen && (React.createElement(Modal, { onClose: closeDialog, width: "x-large" },
|
|
96
|
-
React.createElement(ModalHeader,
|
|
103
|
+
React.createElement(ModalHeader, { hasCloseButton: true },
|
|
97
104
|
React.createElement(ModalTitle, null, `Extension point: ${name}`)),
|
|
98
105
|
React.createElement(CustomModalBody, null,
|
|
99
106
|
React.createElement(SchemasRenderer, { schemaDocuments: schemaDocuments })),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExtensionPointInfo.js","sourceRoot":"","sources":["../../lib/ExtensionPointInfo.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC9C,OAAO,MAAM,MAAM,kCAAkC,CAAC;AACtD,OAAO,KAAK,EAAE,EAAE,eAAe,EAAE,UAAU,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACtG,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;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';\nimport React, { memo, useState } from 'react';\nimport Button from '@atlaskit/button/standard-button';\nimport Modal, { ModalTransition, ModalTitle, ModalHeader, ModalFooter } from '@atlaskit/modal-dialog';\nimport { Link, Element } from 'react-scroll';\n\nimport type {\n SerializedDocument,\n SerializedEnumType,\n SerializedObjectType,\n SerializedScalar,\n SerializedUnionType,\n // We only import types here\n // eslint-disable-next-line node/no-unpublished-import\n} from '@atlassian/clientside-extensions-schema';\nimport { gridSize } from '@atlaskit/theme/constants';\nimport useDiscovery from './debug/useDiscovery';\nimport { Table, TableCell, TableRow, HeadRow, HeadCell, Blinker, BlinkerContainer } from './styled';\n\nexport type ExtensionPointInfoProps = {\n name: string;\n schemaDocuments: { schema: SerializedDocument; contextSchema: SerializedDocument };\n};\n\nconst LinkToElement = ({ to }: { to: string }) => {\n // TODO: is there a way to get the clean type from the schema?\n // We are removing the e.g. \"!\" required syntax that is a suffix of the schema type\n const cleanTo = to.replace(/[^a-zA-Z0-9]/g, '');\n\n return (\n // eslint-disable-next-line jsx-a11y/anchor-is-valid\n <Link to={cleanTo} href=\"\" containerId=\"___cse_info_container\" offset={-20} smooth>\n {to}\n </Link>\n );\n};\n\nconst TypeRenderer: FunctionComponent<{ objectType: SerializedObjectType }> = ({ objectType }) => (\n <>\n <p>{objectType.description}</p>\n <Table>\n <thead>\n <HeadRow>\n <HeadCell>Name</HeadCell>\n <HeadCell>Type</HeadCell>\n <HeadCell>Required</HeadCell>\n <HeadCell>Description</HeadCell>\n </HeadRow>\n </thead>\n <tbody>\n {objectType.descriptors.map((descriptor) => (\n <TableRow key={descriptor.name}>\n <TableCell width=\"15%\"> {descriptor.name}</TableCell>\n <TableCell width=\"15%\">\n <LinkToElement to={descriptor.type} />\n </TableCell>\n <TableCell width=\"10%\">{descriptor.required ? 'true' : 'false'}</TableCell>\n <TableCell>{descriptor.description}</TableCell>\n </TableRow>\n ))}\n </tbody>\n </Table>\n </>\n);\n\nconst EnumTypeRenderer = ({ enumType }: { enumType: SerializedEnumType }) => (\n <>\n <h3>\n <Element name={enumType.name}>{enumType.name}</Element>\n </h3>\n {enumType.description ? (\n <p>{enumType.description}</p>\n ) : (\n <p>\n Enum type with the following values: <b>{enumType.values.join(', ')}</b>\n </p>\n )}\n </>\n);\n\nconst UnionTypeRenderer = ({ unionType }: { unionType: SerializedUnionType }) => (\n <>\n <h3>\n <Element name={unionType.name}>{unionType.name}</Element>\n </h3>\n {unionType.description ? (\n <p>{unionType.description}</p>\n ) : (\n <p>\n Union of the following types:{' '}\n {unionType.types.map((_type, i) => (\n <React.Fragment key={`${_type}-link`}>\n {i === 0 ? '' : ', '}\n <LinkToElement to={_type} />\n </React.Fragment>\n ))}\n </p>\n )}\n </>\n);\n\nconst ScalarRenderer = ({ scalar }: { scalar: SerializedScalar }) => (\n <>\n <h3>\n <Element name={scalar.name}>{scalar.name}</Element>\n </h3>\n <p>{scalar.description}</p>\n </>\n);\n\nconst SchemasRenderer = ({ schemaDocuments: { schema, contextSchema } }: Omit<ExtensionPointInfoProps, 'name'>) => {\n const {\n objectTypes: { Schema: attributesDocument, ...attributeObjectTypes } = { Schema: null },\n scalars: attributeScalars,\n enumTypes: attributesEnumTypes,\n unionTypes: attributesUnionTypes,\n } = schema || {};\n\n const {\n objectTypes: { ContextSchema: contextDocument, ...contextObjectTypes } = { ContextSchema: null },\n scalars: contextScalars,\n enumTypes: contextEnumTypes,\n unionTypes: contextUnionTypes,\n } = contextSchema || {};\n\n const objectTypeEntries: SerializedObjectType[] = Object.values({ ...attributeObjectTypes, ...contextObjectTypes });\n const scalars: SerializedScalar[] = Object.values({ ...attributeScalars, ...contextScalars });\n const enumTypes: SerializedEnumType[] = Object.values({ ...attributesEnumTypes, ...contextEnumTypes });\n const unionTypes: SerializedUnionType[] = Object.values({ ...attributesUnionTypes, ...contextUnionTypes });\n\n return (\n <>\n <h2>Attributes</h2>\n {attributesDocument ? (\n <>\n <p>List of attributes supported by this extension point.</p>\n <TypeRenderer objectType={attributesDocument} />\n </>\n ) : (\n <p>No attributes information provided for this extension point.</p>\n )}\n\n <h2>Context</h2>\n {contextDocument ? (\n <>\n <p>List of values provided by this extension point as context.</p>\n <TypeRenderer objectType={contextDocument} />\n </>\n ) : (\n <p>No context information provided for this extension point.</p>\n )}\n\n <h2>Types reference</h2>\n {objectTypeEntries &&\n objectTypeEntries.map((objectType) => (\n <React.Fragment key={objectType.name}>\n <h3>\n <Element name={objectType.name}>{objectType.name}</Element>\n </h3>\n <TypeRenderer objectType={objectType} />\n </React.Fragment>\n ))}\n\n {enumTypes && enumTypes.map((enumType) => <EnumTypeRenderer key={enumType.name} enumType={enumType} />)}\n\n {unionTypes && unionTypes.map((unionType) => <UnionTypeRenderer key={unionType.name} unionType={unionType} />)}\n\n {scalars && scalars.map((scalar) => <ScalarRenderer key={scalar.name} scalar={scalar} />)}\n </>\n );\n};\n\nconst bodyStyles: React.CSSProperties = {\n // Styles required for the react-scroll to work when scrolling is animated\n overflowY: 'auto',\n overflowX: 'hidden',\n // The rest of the styles are copied from the @atlaskit/modal-dialog/dist/esm/modal-body.js\n padding: gridSize() * 3,\n flex: '1 1 auto',\n};\n\nconst CustomModalBody: React.FC = ({ children }) => {\n return (\n <div id=\"___cse_info_container\" style={bodyStyles}>\n {children}\n </div>\n );\n};\n\nconst ExtensionPointInfo: React.FC<ExtensionPointInfoProps> = ({ name, schemaDocuments }) => {\n const [showExtensionPointInfo] = useDiscovery();\n const [dialogOpen, setDialogState] = useState(false);\n\n const closeDialog = () => setDialogState(false);\n return !showExtensionPointInfo ? null : (\n <BlinkerContainer>\n <Blinker type=\"button\" onClick={() => setDialogState(true)} />\n <ModalTransition>\n {dialogOpen && (\n <Modal onClose={closeDialog} width=\"x-large\">\n <ModalHeader>\n <ModalTitle>{`Extension point: ${name}`}</ModalTitle>\n </ModalHeader>\n\n <CustomModalBody>\n <SchemasRenderer schemaDocuments={schemaDocuments} />\n </CustomModalBody>\n\n <ModalFooter>\n {/* eslint-disable-next-line jsx-a11y/no-autofocus */}\n <Button appearance=\"primary\" autoFocus onClick={closeDialog}>\n Close\n </Button>\n </ModalFooter>\n </Modal>\n )}\n </ModalTransition>\n </BlinkerContainer>\n );\n};\n\nexport default memo(ExtensionPointInfo);\n"]}
|
|
1
|
+
{"version":3,"file":"ExtensionPointInfo.js","sourceRoot":"","sources":["../../lib/ExtensionPointInfo.tsx"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,sBAAsB,CAAC;AAC1C,OAAO,OAAO,MAAM,mBAAmB,CAAC;AACxC,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,WAAW,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAEtG,OAAO,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC9C,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAW7C,OAAO,YAAY,MAAM,sBAAsB,CAAC;AAChD,OAAO,EAAE,OAAO,EAAE,gBAAgB,EAAE,SAAS,EAAE,QAAQ,EAAE,cAAc,EAAE,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAO/H,MAAM,aAAa,GAAG,CAAC,EAAE,EAAE,EAAkB,EAAE,EAAE;IAC7C,8DAA8D;IAC9D,mFAAmF;IACnF,MAAM,OAAO,GAAG,EAAE,CAAC,OAAO,CAAC,eAAe,EAAE,EAAE,CAAC,CAAC;IAEhD,OAAO;IACH,uFAAuF;IACvF,kFAAkF;IAClF,oBAAC,IAAI,IAAC,EAAE,EAAE,OAAO,EAAE,IAAI,EAAC,EAAE,EAAC,WAAW,EAAC,uBAAuB,EAAC,MAAM,EAAE,CAAC,EAAE,EAAE,MAAM,UAC7E,EAAE,CACA,CACV,CAAC;AACN,CAAC,CAAC;AAEF,MAAM,YAAY,GAA4D,CAAC,EAAE,UAAU,EAAE,EAAE,EAAE,CAAC,CAC9F;IACI,+BAAI,UAAU,CAAC,WAAW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Q,EAAE,EAAE,EAAE;IAC9E,OAAO,CACH,6BAAK,EAAE,EAAC,uBAAuB,EAAC,KAAK,EAAE,UAAU,IAC5C,QAAQ,CACP,CACT,CAAC;AACN,CAAC,CAAC;AAEF,MAAM,kBAAkB,GAAsC,CAAC,EAAE,IAAI,EAAE,eAAe,EAAE,EAAE,EAAE;IACxF,MAAM,CAAC,sBAAsB,CAAC,GAAG,YAAY,EAAE,CAAC;IAChD,MAAM,CAAC,UAAU,EAAE,cAAc,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IAErD,MAAM,WAAW,GAAG,GAAG,EAAE,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC;IAChD,OAAO,CAAC,sBAAsB,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CACpC,oBAAC,gBAAgB;QACb,oBAAC,OAAO,IAAC,IAAI,EAAC,QAAQ,EAAC,OAAO,EAAE,GAAG,EAAE,CAAC,cAAc,CAAC,IAAI,CAAC,GAAI;QAC9D,oBAAC,eAAe,QACX,UAAU,IAAI,CACX,oBAAC,KAAK,IAAC,OAAO,EAAE,WAAW,EAAE,KAAK,EAAC,SAAS;YACxC,oBAAC,WAAW,IAAC,cAAc;gBACvB,oBAAC,UAAU,QAAE,oBAAoB,IAAI,EAAE,CAAc,CAC3C;YAEd,oBAAC,eAAe;gBACZ,oBAAC,eAAe,IAAC,eAAe,EAAE,eAAe,GAAI,CACvC;YAElB,oBAAC,WAAW;gBAER,oBAAC,MAAM,IAAC,UAAU,EAAC,SAAS,EAAC,SAAS,QAAC,OAAO,EAAE,WAAW,YAElD,CACC,CACV,CACX,CACa,CACH,CACtB,CAAC;AACN,CAAC,CAAC;AAEF,eAAe,IAAI,CAAC,kBAAkB,CAAC,CAAC","sourcesContent":["import Button from '@atlaskit/button/new';\nimport Heading from '@atlaskit/heading';\nimport Modal, { ModalFooter, ModalHeader, ModalTitle, ModalTransition } from '@atlaskit/modal-dialog';\nimport type { FunctionComponent } from 'react';\nimport React, { memo, useState } from 'react';\nimport { Element, Link } from 'react-scroll';\n\nimport type {\n SerializedDocument,\n SerializedEnumType,\n SerializedObjectType,\n SerializedScalar,\n SerializedUnionType,\n // We only import types here\n // eslint-disable-next-line node/no-unpublished-import\n} from '@atlassian/clientside-extensions-schema';\nimport useDiscovery from './debug/useDiscovery';\nimport { Blinker, BlinkerContainer, GRID_SIZE, HeadCell, HeadingWrapper, HeadRow, Table, TableCell, TableRow } from './styled';\n\nexport type ExtensionPointInfoProps = {\n name: string;\n schemaDocuments: { schema: SerializedDocument; contextSchema: SerializedDocument };\n};\n\nconst LinkToElement = ({ to }: { to: string }) => {\n // TODO: is there a way to get the clean type from the schema?\n // We are removing the e.g. \"!\" required syntax that is a suffix of the schema type\n const cleanTo = to.replace(/[^a-zA-Z0-9]/g, '');\n\n return (\n // eslint-disable-next-line jsx-a11y/anchor-is-valid, @typescript-eslint/ban-ts-comment\n // @ts-ignore: react-scroll types are not up to date with the latest react version\n <Link to={cleanTo} href=\"\" containerId=\"___cse_info_container\" offset={-20} smooth>\n {to}\n </Link>\n );\n};\n\nconst TypeRenderer: FunctionComponent<{ objectType: SerializedObjectType }> = ({ objectType }) => (\n <>\n <p>{objectType.description}</p>\n <Table>\n <thead>\n <HeadRow>\n <HeadCell>Name</HeadCell>\n <HeadCell>Type</HeadCell>\n <HeadCell>Required</HeadCell>\n <HeadCell>Description</HeadCell>\n </HeadRow>\n </thead>\n <tbody>\n {objectType.descriptors.map((descriptor) => (\n <TableRow key={descriptor.name}>\n <TableCell width=\"15%\"> {descriptor.name}</TableCell>\n <TableCell width=\"15%\">\n <LinkToElement to={descriptor.type} />\n </TableCell>\n <TableCell width=\"10%\">{descriptor.required ? 'true' : 'false'}</TableCell>\n <TableCell>{descriptor.description}</TableCell>\n </TableRow>\n ))}\n </tbody>\n </Table>\n </>\n);\n\nconst EnumTypeRenderer = ({ enumType }: { enumType: SerializedEnumType }) => (\n <>\n <HeadingWrapper>\n <Heading size=\"small\" as=\"h3\">\n {/* eslint-disable-next-line @typescript-eslint/ban-ts-comment */}\n {/* @ts-ignore: react-scroll types are not up to date with the latest react version*/}\n <Element id={enumType.name}>{enumType.name}</Element>\n </Heading>\n </HeadingWrapper>\n {enumType.description ? (\n <p>{enumType.description}</p>\n ) : (\n <p>\n Enum type with the following values: <b>{enumType.values.join(', ')}</b>\n </p>\n )}\n </>\n);\n\nconst UnionTypeRenderer = ({ unionType }: { unionType: SerializedUnionType }) => (\n <>\n <HeadingWrapper>\n <Heading size=\"small\" as=\"h3\">\n {/* eslint-disable-next-line @typescript-eslint/ban-ts-comment */}\n {/* @ts-ignore: react-scroll types are not up to date with the latest react version*/}\n <Element id={unionType.name}>{unionType.name}</Element>\n </Heading>\n </HeadingWrapper>\n {unionType.description ? (\n <p>{unionType.description}</p>\n ) : (\n <p>\n Union of the following types:{' '}\n {unionType.types.map((_type, i) => (\n <React.Fragment key={`${_type}-link`}>\n {i === 0 ? '' : ', '}\n <LinkToElement to={_type} />\n </React.Fragment>\n ))}\n </p>\n )}\n </>\n);\n\nconst ScalarRenderer = ({ scalar }: { scalar: SerializedScalar }) => (\n <>\n <HeadingWrapper>\n <Heading size=\"small\" as=\"h3\">\n {/* eslint-disable-next-line @typescript-eslint/ban-ts-comment */}\n {/* @ts-ignore: react-scroll types are not up to date with the latest react version*/}\n <Element id={scalar.name}>{scalar.name}</Element>\n </Heading>\n </HeadingWrapper>\n <p>{scalar.description}</p>\n </>\n);\n\nconst SchemasRenderer = ({ schemaDocuments: { schema, contextSchema } }: Omit<ExtensionPointInfoProps, 'name'>) => {\n const {\n objectTypes: { Schema: attributesDocument, ...attributeObjectTypes } = { Schema: null },\n scalars: attributeScalars,\n enumTypes: attributesEnumTypes,\n unionTypes: attributesUnionTypes,\n } = schema || {};\n\n const {\n objectTypes: { ContextSchema: contextDocument, ...contextObjectTypes } = { ContextSchema: null },\n scalars: contextScalars,\n enumTypes: contextEnumTypes,\n unionTypes: contextUnionTypes,\n } = contextSchema || {};\n\n const objectTypeEntries: SerializedObjectType[] = Object.values({ ...attributeObjectTypes, ...contextObjectTypes });\n const scalars: SerializedScalar[] = Object.values({ ...attributeScalars, ...contextScalars });\n const enumTypes: SerializedEnumType[] = Object.values({ ...attributesEnumTypes, ...contextEnumTypes });\n const unionTypes: SerializedUnionType[] = Object.values({ ...attributesUnionTypes, ...contextUnionTypes });\n\n return (\n <>\n <Heading size=\"medium\" as=\"h2\">\n Attributes\n </Heading>\n {attributesDocument ? (\n <>\n <p>List of attributes supported by this extension point.</p>\n <TypeRenderer objectType={attributesDocument} />\n </>\n ) : (\n <p>No attributes information provided for this extension point.</p>\n )}\n\n <HeadingWrapper>\n <Heading size=\"medium\" as=\"h2\">\n Context\n </Heading>\n </HeadingWrapper>\n {contextDocument ? (\n <>\n <p>List of values provided by this extension point as context.</p>\n <TypeRenderer objectType={contextDocument} />\n </>\n ) : (\n <p>No context information provided for this extension point.</p>\n )}\n\n <HeadingWrapper>\n <Heading size=\"medium\" as=\"h2\">\n Types reference\n </Heading>\n </HeadingWrapper>\n {objectTypeEntries &&\n objectTypeEntries.map((objectType) => (\n <React.Fragment key={objectType.name}>\n <HeadingWrapper>\n <Heading size=\"small\" as=\"h3\">\n {/* eslint-disable-next-line @typescript-eslint/ban-ts-comment */}\n {/* @ts-ignore: react-scroll types are not up to date with the latest react version*/}\n <Element id={objectType.name}>{objectType.name}</Element>\n </Heading>\n </HeadingWrapper>\n <TypeRenderer objectType={objectType} />\n </React.Fragment>\n ))}\n\n {enumTypes && enumTypes.map((enumType) => <EnumTypeRenderer key={enumType.name} enumType={enumType} />)}\n\n {unionTypes && unionTypes.map((unionType) => <UnionTypeRenderer key={unionType.name} unionType={unionType} />)}\n\n {scalars && scalars.map((scalar) => <ScalarRenderer key={scalar.name} scalar={scalar} />)}\n </>\n );\n};\n\nconst bodyStyles: React.CSSProperties = {\n // Styles required for the react-scroll to work when scrolling is animated\n overflowY: 'auto',\n overflowX: 'hidden',\n // The rest of the styles are copied from the @atlaskit/modal-dialog/dist/esm/modal-body.js\n padding: GRID_SIZE * 3,\n flex: '1 1 auto',\n};\n\nconst CustomModalBody: React.FC<{ children: React.ReactNode }> = ({ children }) => {\n return (\n <div id=\"___cse_info_container\" style={bodyStyles}>\n {children}\n </div>\n );\n};\n\nconst ExtensionPointInfo: React.FC<ExtensionPointInfoProps> = ({ name, schemaDocuments }) => {\n const [showExtensionPointInfo] = useDiscovery();\n const [dialogOpen, setDialogState] = useState(false);\n\n const closeDialog = () => setDialogState(false);\n return !showExtensionPointInfo ? null : (\n <BlinkerContainer>\n <Blinker type=\"button\" onClick={() => setDialogState(true)} />\n <ModalTransition>\n {dialogOpen && (\n <Modal onClose={closeDialog} width=\"x-large\">\n <ModalHeader hasCloseButton>\n <ModalTitle>{`Extension point: ${name}`}</ModalTitle>\n </ModalHeader>\n\n <CustomModalBody>\n <SchemasRenderer schemaDocuments={schemaDocuments} />\n </CustomModalBody>\n\n <ModalFooter>\n {/* eslint-disable-next-line jsx-a11y/no-autofocus */}\n <Button appearance=\"primary\" autoFocus onClick={closeDialog}>\n Close\n </Button>\n </ModalFooter>\n </Modal>\n )}\n </ModalTransition>\n </BlinkerContainer>\n );\n};\n\nexport default memo(ExtensionPointInfo);\n"]}
|