@patternfly/documentation-framework 2.0.0-alpha.3 → 2.0.0-alpha.31
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 +266 -0
- package/app.js +12 -11
- package/components/cssVariables/cssSearch.js +3 -4
- package/components/cssVariables/cssVariables.js +69 -67
- package/components/functionsTable/functionsTable.js +57 -0
- package/components/propsTable/propsTable.js +85 -79
- package/components/sectionGallery/sectionDataListLayout.js +67 -0
- package/components/sectionGallery/sectionGallery.css +44 -0
- package/components/sectionGallery/sectionGallery.js +53 -0
- package/components/sectionGallery/sectionGalleryLayout.js +37 -0
- package/components/sectionGallery/sectionGalleryToolbar.js +30 -0
- package/components/sectionGallery/sectionGalleryWrapper.js +89 -0
- package/components/sideNav/sideNav.js +10 -3
- package/helpers/getTitle.js +2 -2
- package/layouts/sideNavLayout/sideNavLayout.css +0 -4
- package/layouts/sideNavLayout/sideNavLayout.js +54 -37
- package/package.json +28 -25
- package/pages/404/index.js +3 -3
- package/routes.js +19 -5
- package/scripts/cli/build.js +6 -0
- package/scripts/cli/cli.js +2 -0
- package/scripts/cli/generate.js +2 -2
- package/scripts/cli/start.js +6 -8
- package/scripts/md/parseMD.js +40 -8
- package/scripts/tsDocgen.js +119 -91
- package/scripts/typeDocGen.js +209 -0
- package/scripts/webpack/webpack.base.config.js +34 -32
- package/scripts/webpack/webpack.client.config.js +11 -8
- package/scripts/webpack/webpack.server.config.js +8 -5
- package/scripts/writeScreenshots.js +2 -2
- package/templates/html.ejs +1 -3
- package/templates/mdx.css +0 -5
- package/templates/mdx.js +58 -41
- package/templates/patternfly-docs/content/extensions/extension/design-guidelines/design-guidelines.md +2 -0
- package/templates/patternfly-docs/content/extensions/extension/examples/basic.md +2 -0
- package/versions.json +29 -9
|
@@ -2,8 +2,11 @@ const path = require('path');
|
|
|
2
2
|
const webpack = require('webpack');
|
|
3
3
|
const { merge } = require('webpack-merge');
|
|
4
4
|
const baseConfig = require('./webpack.base.config');
|
|
5
|
+
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
|
|
6
|
+
const reactCSSRegex = /(react-[\w-]+\/dist|react-styles\/css)\/.*\.css$/;
|
|
5
7
|
|
|
6
|
-
const serverConfig = () => {
|
|
8
|
+
const serverConfig = async (env, argv) => {
|
|
9
|
+
const isProd = argv.mode === 'production';
|
|
7
10
|
return {
|
|
8
11
|
output: {
|
|
9
12
|
path: path.resolve('.cache/ssr-build'), // Don't bloat `public` dir
|
|
@@ -31,7 +34,7 @@ const serverConfig = () => {
|
|
|
31
34
|
{
|
|
32
35
|
test: /(novnc-core|@novnc\/novnc)\/.*\.js/,
|
|
33
36
|
use: 'null-loader'
|
|
34
|
-
}
|
|
37
|
+
},
|
|
35
38
|
]
|
|
36
39
|
},
|
|
37
40
|
resolve: {
|
|
@@ -41,7 +44,7 @@ const serverConfig = () => {
|
|
|
41
44
|
// The maintainer will not allow his bundle to be required from a node context
|
|
42
45
|
// https://github.com/xtermjs/xterm.js/pull/3134
|
|
43
46
|
'xterm': '@patternfly/documentation-framework/helpers/xterm',
|
|
44
|
-
'xterm-addon-fit': '@patternfly/documentation-framework/helpers/xterm-addon-fit'
|
|
47
|
+
'xterm-addon-fit': '@patternfly/documentation-framework/helpers/xterm-addon-fit',
|
|
45
48
|
},
|
|
46
49
|
},
|
|
47
50
|
// Load in prerender.js instead
|
|
@@ -49,7 +52,7 @@ const serverConfig = () => {
|
|
|
49
52
|
};
|
|
50
53
|
}
|
|
51
54
|
|
|
52
|
-
module.exports = (env = {}, argv) => merge(
|
|
55
|
+
module.exports = async (env = {}, argv) => merge(
|
|
53
56
|
baseConfig(env, argv),
|
|
54
|
-
serverConfig(env, argv)
|
|
57
|
+
await serverConfig(env, argv)
|
|
55
58
|
);
|
|
@@ -27,7 +27,7 @@ async function writeScreenshot({ page, data: { url, urlPrefix } }) {
|
|
|
27
27
|
await sharp(buffer).toFile(outfile);
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
-
async function writeScreenshots({ urlPrefix }) {
|
|
30
|
+
async function writeScreenshots({ urlPrefix, allRoutes }) {
|
|
31
31
|
const cluster = await Cluster.launch({
|
|
32
32
|
concurrency: Cluster.CONCURRENCY_CONTEXT,
|
|
33
33
|
maxConcurrency: os.cpus().length,
|
|
@@ -43,7 +43,7 @@ async function writeScreenshots({ urlPrefix }) {
|
|
|
43
43
|
|
|
44
44
|
// Add some pages to queue
|
|
45
45
|
Object.entries(fullscreenRoutes)
|
|
46
|
-
.filter(([, { isFullscreenOnly }]) => isFullscreenOnly)
|
|
46
|
+
.filter(([, { isFullscreenOnly }]) => allRoutes || isFullscreenOnly)
|
|
47
47
|
.forEach(([url,]) => cluster.queue({
|
|
48
48
|
url: `${urlPrefix}${url}`,
|
|
49
49
|
urlPrefix
|
package/templates/html.ejs
CHANGED
|
@@ -16,9 +16,7 @@
|
|
|
16
16
|
<%= htmlWebpackPlugin.tags.headTags %>
|
|
17
17
|
</head>
|
|
18
18
|
<body class="pf-m-redhat-updated-font pf-m-redhatmono-font">
|
|
19
|
-
<div id="root">
|
|
20
|
-
<%= prerendering %>
|
|
21
|
-
</div>
|
|
19
|
+
<div id="root"><%= prerendering %></div>
|
|
22
20
|
<%= htmlWebpackPlugin.tags.bodyTags %>
|
|
23
21
|
<% if (algolia) { %>
|
|
24
22
|
<script
|
package/templates/mdx.css
CHANGED
package/templates/mdx.js
CHANGED
|
@@ -7,12 +7,14 @@ import { CSSVariables, PropsTable, TableOfContents, Link, AutoLinkHeader, Inline
|
|
|
7
7
|
import { capitalize, getTitle, slugger, trackEvent } from '../helpers';
|
|
8
8
|
import './mdx.css';
|
|
9
9
|
import { convertToReactComponent } from '@patternfly/ast-helpers';
|
|
10
|
+
import { FunctionsTable } from '../components/functionsTable/functionsTable';
|
|
10
11
|
|
|
11
12
|
const MDXChildTemplate = ({
|
|
12
13
|
Component,
|
|
13
14
|
source,
|
|
14
15
|
toc = [],
|
|
15
|
-
index = 0
|
|
16
|
+
index = 0,
|
|
17
|
+
id
|
|
16
18
|
}) => {
|
|
17
19
|
const {
|
|
18
20
|
propComponents = [],
|
|
@@ -20,8 +22,7 @@ const MDXChildTemplate = ({
|
|
|
20
22
|
cssPrefix = [],
|
|
21
23
|
optIn,
|
|
22
24
|
beta,
|
|
23
|
-
|
|
24
|
-
katacodaLayout
|
|
25
|
+
functionDocumentation = []
|
|
25
26
|
} = Component.getPageData();
|
|
26
27
|
const cssVarsTitle = cssPrefix.length > 0 && 'CSS variables';
|
|
27
28
|
const propsTitle = propComponents.length > 0 && 'Props';
|
|
@@ -59,23 +60,27 @@ const MDXChildTemplate = ({
|
|
|
59
60
|
To learn more about the process, visit our <Link to="/get-started/about#beta-components">about page</Link> or our <a href="https://github.com/patternfly/patternfly-org/tree/main/beta-component-promotion">Beta components</a> page on GitHub.
|
|
60
61
|
</InlineAlert>
|
|
61
62
|
)}
|
|
62
|
-
{katacodaBroken && (
|
|
63
|
-
<InlineAlert variant="warning" title="Down for maintenance">
|
|
64
|
-
The embedded version of our tutorials are broken, but you can still access our tutorials on <a href="https://www.katacoda.com/patternfly">Katacoda.com <ExternalLinkAltIcon /></a>.
|
|
65
|
-
</InlineAlert>
|
|
66
|
-
)}
|
|
67
63
|
</React.Fragment>
|
|
68
64
|
);
|
|
65
|
+
console.log(id);
|
|
69
66
|
// Create dynamic component for @reach/router
|
|
70
67
|
const ChildComponent = () => (
|
|
71
68
|
<div className="pf-u-display-flex ws-mdx-child-template">
|
|
72
69
|
{toc.length > 1 && (
|
|
73
70
|
<TableOfContents items={toc} />
|
|
74
71
|
)}
|
|
75
|
-
<div className=
|
|
76
|
-
<div className={
|
|
72
|
+
<div className="ws-mdx-content">
|
|
73
|
+
<div className={id === 'All components' ? "" : "ws-mdx-content-content"}>
|
|
77
74
|
{InlineAlerts}
|
|
78
75
|
<Component />
|
|
76
|
+
{functionDocumentation.length > 0 && (
|
|
77
|
+
<React.Fragment>
|
|
78
|
+
<AutoLinkHeader size="h2" className="ws-h2" id="functions">
|
|
79
|
+
Functions
|
|
80
|
+
</AutoLinkHeader>
|
|
81
|
+
<FunctionsTable functionDescriptions={functionDocumentation}/>
|
|
82
|
+
</React.Fragment>
|
|
83
|
+
)}
|
|
79
84
|
{propsTitle && (
|
|
80
85
|
<React.Fragment>
|
|
81
86
|
<AutoLinkHeader size="h2" className="ws-h2" id="props">
|
|
@@ -100,7 +105,7 @@ const MDXChildTemplate = ({
|
|
|
100
105
|
<CSSVariables prefix={cssPrefix} />
|
|
101
106
|
</React.Fragment>
|
|
102
107
|
)}
|
|
103
|
-
{
|
|
108
|
+
{sourceLink && (
|
|
104
109
|
<React.Fragment>
|
|
105
110
|
<br />
|
|
106
111
|
<a href={sourceLink} target="_blank" onClick={() => trackEvent('view_source_click', 'click_event', source.toUpperCase())}>View source on GitHub</a>
|
|
@@ -121,7 +126,15 @@ export const MDXTemplate = ({
|
|
|
121
126
|
id,
|
|
122
127
|
componentsData
|
|
123
128
|
}) => {
|
|
124
|
-
|
|
129
|
+
// Build obj mapping source names to text displayed on tabs
|
|
130
|
+
const tabNames = sources.reduce((acc, curSrc) => {
|
|
131
|
+
const { source, tabName } = curSrc;
|
|
132
|
+
// use tabName for tab name if present, otherwise default to source
|
|
133
|
+
const tabLinkText = tabName || capitalize(source.replace('html', 'HTML').replace(/-/g, ' '));
|
|
134
|
+
acc[source] = tabLinkText;
|
|
135
|
+
return acc;
|
|
136
|
+
}, {});
|
|
137
|
+
const sourceKeys = Object.keys(tabNames);
|
|
125
138
|
const isSinglePage = sourceKeys.length === 1;
|
|
126
139
|
|
|
127
140
|
let isDevResources, isComponent, isExtension, isChart, isDemo, isLayout, isUtility;
|
|
@@ -159,7 +172,6 @@ export const MDXTemplate = ({
|
|
|
159
172
|
(e) => e.includes("pages") || e.includes("training")
|
|
160
173
|
);
|
|
161
174
|
const { pathname } = useLocation();
|
|
162
|
-
const { katacodaLayout } = sources[0].Component.getPageData();
|
|
163
175
|
let activeSource = pathname.replace(/\/$/, '').split('/').pop();
|
|
164
176
|
// get summary text, convert to JSX to display above tabs on component pages
|
|
165
177
|
const componentDasherized = id.split(' ').join('-').toLowerCase();
|
|
@@ -192,6 +204,14 @@ export const MDXTemplate = ({
|
|
|
192
204
|
return "pf-m-light-100";
|
|
193
205
|
};
|
|
194
206
|
|
|
207
|
+
const showTabs = (
|
|
208
|
+
(!isSinglePage && !hideTabName) ||
|
|
209
|
+
isComponent ||
|
|
210
|
+
isUtility ||
|
|
211
|
+
isDemo
|
|
212
|
+
);
|
|
213
|
+
|
|
214
|
+
console.log(id);
|
|
195
215
|
return (
|
|
196
216
|
<React.Fragment>
|
|
197
217
|
<PageGroup>
|
|
@@ -201,38 +221,35 @@ export const MDXTemplate = ({
|
|
|
201
221
|
isWidthLimited
|
|
202
222
|
>
|
|
203
223
|
<TextContent>
|
|
204
|
-
|
|
205
|
-
|
|
224
|
+
<Title headingLevel='h1' size='4xl' id="ws-page-title">{title}</Title>
|
|
225
|
+
{isComponent && summary && (<SummaryComponent />)}
|
|
206
226
|
</TextContent>
|
|
207
227
|
</PageSection>
|
|
208
|
-
{
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
>
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
</ul>
|
|
231
|
-
</div>
|
|
232
|
-
</PageSection>
|
|
228
|
+
{ showTabs && (
|
|
229
|
+
<PageSection id="ws-sticky-nav-tabs" stickyOnBreakpoint={{'default':'top'}} type="tabs">
|
|
230
|
+
<div className="pf-c-tabs pf-m-page-insets pf-m-no-border-bottom">
|
|
231
|
+
<ul className="pf-c-tabs__list">
|
|
232
|
+
{sourceKeys.map((source, index) => (
|
|
233
|
+
<li
|
|
234
|
+
key={source}
|
|
235
|
+
className={css(
|
|
236
|
+
'pf-c-tabs__item',
|
|
237
|
+
activeSource === source && 'pf-m-current'
|
|
238
|
+
)}
|
|
239
|
+
// Send clicked tab name for analytics
|
|
240
|
+
onClick={() => trackEvent('tab_click', 'click_event', source.toUpperCase())}
|
|
241
|
+
>
|
|
242
|
+
<Link className="pf-c-tabs__link" to={`${path}${index === 0 ? '' : '/' + source}`}>
|
|
243
|
+
{tabNames[source]}
|
|
244
|
+
</Link>
|
|
245
|
+
</li>
|
|
246
|
+
))}
|
|
247
|
+
</ul>
|
|
248
|
+
</div>
|
|
249
|
+
</PageSection>
|
|
233
250
|
)}
|
|
234
251
|
<PageSection id="main-content" isFilled className="pf-m-light-100">
|
|
235
|
-
{isSinglePage && <MDXChildTemplate {...sources[0]} />}
|
|
252
|
+
{isSinglePage && <MDXChildTemplate {...sources[0]} id={id}/>}
|
|
236
253
|
{!isSinglePage && (
|
|
237
254
|
<Router className="pf-u-h-100" primary={false}>
|
|
238
255
|
{sources
|
|
@@ -7,6 +7,8 @@ section: extensions
|
|
|
7
7
|
id: My extension
|
|
8
8
|
# Tab (react | react-demos | html | html-demos | design-guidelines | accessibility)
|
|
9
9
|
source: design-guidelines
|
|
10
|
+
# Optional custom text to display in tab in place of source
|
|
11
|
+
tabName: My custom tab-name
|
|
10
12
|
---
|
|
11
13
|
|
|
12
14
|
Design guidelines intro
|
|
@@ -7,6 +7,8 @@ section: extensions
|
|
|
7
7
|
id: My extension
|
|
8
8
|
# Tab (react | react-demos | html | html-demos | design-guidelines | accessibility)
|
|
9
9
|
source: react
|
|
10
|
+
# Optional custom text to display in tab in place of source
|
|
11
|
+
tabName: My custom tab-name
|
|
10
12
|
# If you use typescript, the name of the interface to display props for
|
|
11
13
|
# These are found through the sourceProps function provdided in patternfly-docs.source.js
|
|
12
14
|
# Can also pass object { component: string, source: string } allowing to specify the source
|
package/versions.json
CHANGED
|
@@ -5,25 +5,45 @@
|
|
|
5
5
|
"date": "2022-02-08",
|
|
6
6
|
"latest": true,
|
|
7
7
|
"versions": {
|
|
8
|
-
"@patternfly/patternfly": "5.0.0-alpha.
|
|
8
|
+
"@patternfly/patternfly": "5.0.0-alpha.37",
|
|
9
|
+
"@patternfly/react-charts": "^7.0.0-alpha.14",
|
|
10
|
+
"@patternfly/react-code-editor": "^5.0.0-alpha.54",
|
|
11
|
+
"@patternfly/react-core": "^5.0.0-alpha.53",
|
|
12
|
+
"@patternfly/react-icons": "^5.0.0-alpha.8",
|
|
13
|
+
"@patternfly/react-styles": "^5.0.0-alpha.6",
|
|
14
|
+
"@patternfly/react-table": "^5.0.0-alpha.54",
|
|
15
|
+
"@patternfly/react-tokens": "^5.0.0-alpha.6",
|
|
9
16
|
"@patternfly/react-catalog-view-extension": "4.95.1",
|
|
10
|
-
"@patternfly/react-
|
|
11
|
-
"@patternfly/react-code-editor": "5.0.0-alpha.7",
|
|
12
|
-
"@patternfly/react-core": "5.0.0-alpha.7",
|
|
13
|
-
"@patternfly/react-icons": "5.0.0-alpha.2",
|
|
17
|
+
"@patternfly/react-drag-drop": "5.0.0-alpha.0",
|
|
14
18
|
"@patternfly/react-inline-edit-extension": "4.86.118",
|
|
15
19
|
"@patternfly/react-log-viewer": "4.87.100",
|
|
16
|
-
"@patternfly/react-styles": "5.0.0-alpha.2",
|
|
17
|
-
"@patternfly/react-table": "5.0.0-alpha.7",
|
|
18
|
-
"@patternfly/react-tokens": "5.0.0-alpha.2",
|
|
19
20
|
"@patternfly/react-topology": "4.91.27",
|
|
20
21
|
"@patternfly/react-virtualized-extension": "4.88.113"
|
|
21
22
|
}
|
|
22
23
|
},
|
|
24
|
+
{
|
|
25
|
+
"name": "2023.02",
|
|
26
|
+
"date": "2022-03-27",
|
|
27
|
+
"versions": {
|
|
28
|
+
"@patternfly/patternfly": "4.224.4",
|
|
29
|
+
"@patternfly/react-catalog-view-extension": "4.96.0",
|
|
30
|
+
"@patternfly/react-charts": "6.94.19",
|
|
31
|
+
"@patternfly/react-code-editor": "4.82.115",
|
|
32
|
+
"@patternfly/react-console": "4.95.5",
|
|
33
|
+
"@patternfly/react-core": "4.276.8",
|
|
34
|
+
"@patternfly/react-icons": "4.93.6",
|
|
35
|
+
"@patternfly/react-inline-edit-extension": "4.86.122",
|
|
36
|
+
"@patternfly/react-log-viewer": "4.87.100",
|
|
37
|
+
"@patternfly/react-styles": "4.92.6",
|
|
38
|
+
"@patternfly/react-table": "4.113.0",
|
|
39
|
+
"@patternfly/react-tokens": "4.94.6",
|
|
40
|
+
"@patternfly/react-topology": "4.91.40",
|
|
41
|
+
"@patternfly/react-virtualized-extension": "4.88.115"
|
|
42
|
+
}
|
|
43
|
+
},
|
|
23
44
|
{
|
|
24
45
|
"name": "2023.01",
|
|
25
46
|
"date": "2022-01-31",
|
|
26
|
-
"latest": true,
|
|
27
47
|
"versions": {
|
|
28
48
|
"@patternfly/patternfly": "4.224.2",
|
|
29
49
|
"@patternfly/react-catalog-view-extension": "4.95.1",
|