@patternfly/documentation-framework 1.8.0 → 2.0.0-alpha.1
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 +2 -21
- package/components/sideNav/sideNav.js +3 -10
- package/package.json +12 -8
- package/routes.js +4 -19
- package/scripts/md/parseMD.js +1 -11
- package/templates/mdx.js +2 -10
- package/templates/patternfly-docs/content/extensions/extension/design-guidelines/design-guidelines.md +0 -2
- package/templates/patternfly-docs/content/extensions/extension/examples/basic.md +0 -2
- package/versions.json +20 -0
package/CHANGELOG.md
CHANGED
|
@@ -3,31 +3,12 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
-
#
|
|
6
|
+
# 2.0.0-alpha.1 (2023-02-13)
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
### Features
|
|
10
10
|
|
|
11
|
-
* **
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
# 1.7.0 (2023-02-09)
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
### Features
|
|
21
|
-
|
|
22
|
-
* **docs:** customize tabs with optional tabText frontmatter ([#3394](https://github.com/patternfly/patternfly-org/issues/3394)) ([093c6c7](https://github.com/patternfly/patternfly-org/commit/093c6c77053f544605d40f8918dc5621829ac7c3))
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
## 1.6.1 (2023-02-09)
|
|
29
|
-
|
|
30
|
-
**Note:** Version bump only for package @patternfly/documentation-framework
|
|
11
|
+
* **v5:** pull in alphas, set up doc-framework alpha ([#3401](https://github.com/patternfly/patternfly-org/issues/3401)) ([082d048](https://github.com/patternfly/patternfly-org/commit/082d048f33505fb1efc39a3c9928d1552c7f9cea))
|
|
31
12
|
|
|
32
13
|
|
|
33
14
|
|
|
@@ -12,8 +12,6 @@ const getIsActive = (location, section, subsection = null) => {
|
|
|
12
12
|
return location.pathname.startsWith(`${process.env.pathPrefix}${slug}`);
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
-
const defaultValue = 50;
|
|
16
|
-
|
|
17
15
|
const NavItem = ({ text, href }) => {
|
|
18
16
|
const isMobileView = window.innerWidth < Number.parseInt(globalBreakpointXl.value, 10);
|
|
19
17
|
return (
|
|
@@ -69,14 +67,9 @@ const ExpandableNav = ({groupedRoutes, location, section, subsection = null}) =>
|
|
|
69
67
|
}}
|
|
70
68
|
>
|
|
71
69
|
{Object.entries(routes || {})
|
|
72
|
-
.filter(([id,
|
|
73
|
-
.map(([id, { slug, isSubsection = false
|
|
74
|
-
.sort(({text: text1
|
|
75
|
-
if (sortValue1 === sortValue2) {
|
|
76
|
-
return text1.localeCompare(text2);
|
|
77
|
-
}
|
|
78
|
-
return sortValue1 > sortValue2 ? 1 : -1;
|
|
79
|
-
})
|
|
70
|
+
.filter(([id, { hideNavItem }]) => !Boolean(hideNavItem) && (id !== 'isSubsection'))
|
|
71
|
+
.map(([id, { slug, isSubsection = false }]) => ({ text: id, href: slug, isSubsection }))
|
|
72
|
+
.sort(({ text: text1 }, { text: text2 }) => text1.localeCompare(text2))
|
|
80
73
|
.map(navObj => navObj.isSubsection
|
|
81
74
|
? ExpandableNav({groupedRoutes, location, section, subsection: navObj.text})
|
|
82
75
|
: NavItem(navObj)
|
package/package.json
CHANGED
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@patternfly/documentation-framework",
|
|
3
3
|
"description": "A framework to build documentation for PatternFly.",
|
|
4
|
-
"version": "
|
|
4
|
+
"version": "2.0.0-alpha.1",
|
|
5
5
|
"author": "Red Hat",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"private": false,
|
|
8
|
+
"publishConfig": {
|
|
9
|
+
"access": "public",
|
|
10
|
+
"tag": "alpha"
|
|
11
|
+
},
|
|
8
12
|
"bin": {
|
|
9
13
|
"pf-docs-framework": "scripts/cli/cli.js"
|
|
10
14
|
},
|
|
@@ -77,12 +81,12 @@
|
|
|
77
81
|
"webpack-merge": "5.8.0"
|
|
78
82
|
},
|
|
79
83
|
"peerDependencies": {
|
|
80
|
-
"@patternfly/patternfly": "
|
|
81
|
-
"@patternfly/react-code-editor": "
|
|
82
|
-
"@patternfly/react-core": "
|
|
83
|
-
"@patternfly/react-table": "
|
|
84
|
-
"react": "^
|
|
85
|
-
"react-dom": "^
|
|
84
|
+
"@patternfly/patternfly": "^5.0.0-alpha.13",
|
|
85
|
+
"@patternfly/react-code-editor": "^5.0.0-alpha.7",
|
|
86
|
+
"@patternfly/react-core": "^5.0.0-alpha.7",
|
|
87
|
+
"@patternfly/react-table": "^5.0.0-alpha.7",
|
|
88
|
+
"react": "^17.0.0 || ^18.0.0",
|
|
89
|
+
"react-dom": "^17.0.0 || ^18.0.0"
|
|
86
90
|
},
|
|
87
|
-
"gitHead": "
|
|
91
|
+
"gitHead": "b9ec67db0e229b808ea53376209393c25b3e1869"
|
|
88
92
|
}
|
package/routes.js
CHANGED
|
@@ -9,8 +9,6 @@ const routes = {
|
|
|
9
9
|
...generatedRoutes
|
|
10
10
|
};
|
|
11
11
|
|
|
12
|
-
const defaultOrder = 50;
|
|
13
|
-
|
|
14
12
|
for (let route in routes) {
|
|
15
13
|
const pageData = routes[route];
|
|
16
14
|
if (pageData.SyncComponent) {
|
|
@@ -30,7 +28,7 @@ const isNull = o => o === null || o === undefined;
|
|
|
30
28
|
const groupedRoutes = Object.entries(routes)
|
|
31
29
|
.filter(([_slug, { id, section }]) => !isNull(id) && !isNull(section))
|
|
32
30
|
.reduce((accum, [slug, pageData]) => {
|
|
33
|
-
const { section, subsection = null, id, title, source, katacodaLayout, hideNavItem, relPath
|
|
31
|
+
const { section, subsection = null, id, title, source, katacodaLayout, hideNavItem, relPath } = pageData;
|
|
34
32
|
pageData.slug = slug;
|
|
35
33
|
// add section to groupedRoutes obj if not yet created
|
|
36
34
|
accum[section] = accum[section] || {};
|
|
@@ -44,9 +42,7 @@ const groupedRoutes = Object.entries(routes)
|
|
|
44
42
|
sources: [],
|
|
45
43
|
katacodaLayout,
|
|
46
44
|
hideNavItem,
|
|
47
|
-
relPath
|
|
48
|
-
...(sortValue && { sortValue }),
|
|
49
|
-
...(subsectionSortValue && { subsectionSortValue })
|
|
45
|
+
relPath
|
|
50
46
|
}
|
|
51
47
|
// add page to groupedRoutes obj section or subsection
|
|
52
48
|
if (subsection) {
|
|
@@ -56,21 +52,10 @@ const groupedRoutes = Object.entries(routes)
|
|
|
56
52
|
// add page to subsection
|
|
57
53
|
accum[section][subsection][id] = accum[section][subsection][id] || data;
|
|
58
54
|
accum[section][subsection][id].sources.push(pageData);
|
|
59
|
-
// nav item ordering
|
|
60
|
-
if (sortValue) {
|
|
61
|
-
accum[section][subsection].sortValue = sortValue;
|
|
62
|
-
}
|
|
63
|
-
if (subsectionSortValue) {
|
|
64
|
-
accum[section][subsection].subsectionSortValue = subsectionSortValue;
|
|
65
|
-
}
|
|
66
55
|
} else {
|
|
67
56
|
// add page to section
|
|
68
57
|
accum[section][id] = accum[section][id] || data;
|
|
69
58
|
accum[section][id].sources.push(pageData);
|
|
70
|
-
// nav item ordering
|
|
71
|
-
if (sortValue) {
|
|
72
|
-
accum[section][id].sortValue = sortValue;
|
|
73
|
-
}
|
|
74
59
|
}
|
|
75
60
|
|
|
76
61
|
return accum;
|
|
@@ -88,6 +73,7 @@ const sourceOrder = {
|
|
|
88
73
|
'design-guidelines': 99,
|
|
89
74
|
'accessibility': 100
|
|
90
75
|
};
|
|
76
|
+
const defaultOrder = 50;
|
|
91
77
|
|
|
92
78
|
const sortSources = ({ source: s1 }, { source: s2 }) => {
|
|
93
79
|
const s1Index = sourceOrder[s1] || defaultOrder;
|
|
@@ -122,8 +108,7 @@ Object.entries(groupedRoutes)
|
|
|
122
108
|
// Loop through each page in expandable subsection
|
|
123
109
|
if (pageData.isSubsection) {
|
|
124
110
|
Object.entries(pageData).map(([section, ids]) => {
|
|
125
|
-
|
|
126
|
-
if (ids && ids?.id) {
|
|
111
|
+
if (section !== 'isSubsection') {
|
|
127
112
|
pageDataArr.push(ids);
|
|
128
113
|
}
|
|
129
114
|
})
|
package/scripts/md/parseMD.js
CHANGED
|
@@ -85,7 +85,6 @@ function toReactComponent(mdFilePath, source, buildMode) {
|
|
|
85
85
|
section: frontmatter.section || '',
|
|
86
86
|
subsection: frontmatter.subsection || '',
|
|
87
87
|
source,
|
|
88
|
-
tabName: frontmatter.tabName || null,
|
|
89
88
|
slug,
|
|
90
89
|
sourceLink: frontmatter.sourceLink || `https://github.com/patternfly/${
|
|
91
90
|
sourceRepo}/blob/main/${
|
|
@@ -127,12 +126,6 @@ function toReactComponent(mdFilePath, source, buildMode) {
|
|
|
127
126
|
if (frontmatter.hideNavItem) {
|
|
128
127
|
pageData.hideNavItem = frontmatter.hideNavItem;
|
|
129
128
|
}
|
|
130
|
-
if (frontmatter.sortValue) {
|
|
131
|
-
pageData.sortValue = frontmatter.sortValue;
|
|
132
|
-
}
|
|
133
|
-
if (frontmatter.subsectionSortValue) {
|
|
134
|
-
pageData.subsectionSortValue = frontmatter.subsectionSortValue;
|
|
135
|
-
}
|
|
136
129
|
})
|
|
137
130
|
// Delete HTML comments
|
|
138
131
|
.use(require('./remove-comments'))
|
|
@@ -273,11 +266,8 @@ function sourceMDFile(file, source, buildMode) {
|
|
|
273
266
|
section: pageData.section,
|
|
274
267
|
subsection: pageData.subsection,
|
|
275
268
|
source: pageData.source,
|
|
276
|
-
tabName: pageData.tabName,
|
|
277
269
|
...(pageData.katacodaLayout && { katacodaLayout: pageData.katacodaLayout }),
|
|
278
|
-
...(pageData.hideNavItem && { hideNavItem: pageData.hideNavItem })
|
|
279
|
-
...(pageData.sortValue && { sortValue: pageData.sortValue }),
|
|
280
|
-
...(pageData.subsectionSortValue && { subsectionSortValue: pageData.subsectionSortValue })
|
|
270
|
+
...(pageData.hideNavItem && { hideNavItem: pageData.hideNavItem })
|
|
281
271
|
};
|
|
282
272
|
}
|
|
283
273
|
}
|
package/templates/mdx.js
CHANGED
|
@@ -121,15 +121,7 @@ export const MDXTemplate = ({
|
|
|
121
121
|
id,
|
|
122
122
|
componentsData
|
|
123
123
|
}) => {
|
|
124
|
-
|
|
125
|
-
const tabNames = sources.reduce((acc, curSrc) => {
|
|
126
|
-
const { source, tabName } = curSrc;
|
|
127
|
-
// use tabName for tab name if present, otherwise default to source
|
|
128
|
-
const tabLinkText = tabName || capitalize(source.replace('html', 'HTML').replace(/-/g, ' '));
|
|
129
|
-
acc[source] = tabLinkText;
|
|
130
|
-
return acc;
|
|
131
|
-
}, {});
|
|
132
|
-
const sourceKeys = Object.keys(tabNames);
|
|
124
|
+
const sourceKeys = sources.map(v => v.source);
|
|
133
125
|
const isSinglePage = sourceKeys.length === 1;
|
|
134
126
|
|
|
135
127
|
let isDevResources, isComponent, isExtension, isChart, isDemo, isLayout, isUtility;
|
|
@@ -231,7 +223,7 @@ export const MDXTemplate = ({
|
|
|
231
223
|
onClick={() => trackEvent('tab_click', 'click_event', source.toUpperCase())}
|
|
232
224
|
>
|
|
233
225
|
<Link className="pf-c-tabs__link" to={`${path}${index === 0 ? '' : '/' + source}`}>
|
|
234
|
-
{
|
|
226
|
+
{capitalize(source.replace('html', 'HTML').replace(/-/g, ' '))}
|
|
235
227
|
</Link>
|
|
236
228
|
</li>
|
|
237
229
|
))}
|
|
@@ -7,8 +7,6 @@ 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
|
|
12
10
|
---
|
|
13
11
|
|
|
14
12
|
Design guidelines intro
|
|
@@ -7,8 +7,6 @@ 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
|
|
12
10
|
# If you use typescript, the name of the interface to display props for
|
|
13
11
|
# These are found through the sourceProps function provdided in patternfly-docs.source.js
|
|
14
12
|
# Can also pass object { component: string, source: string } allowing to specify the source
|
package/versions.json
CHANGED
|
@@ -1,5 +1,25 @@
|
|
|
1
1
|
{
|
|
2
2
|
"Releases": [
|
|
3
|
+
{
|
|
4
|
+
"name": "alphas",
|
|
5
|
+
"date": "2022-02-08",
|
|
6
|
+
"latest": true,
|
|
7
|
+
"versions": {
|
|
8
|
+
"@patternfly/patternfly": "5.0.0-alpha.13",
|
|
9
|
+
"@patternfly/react-catalog-view-extension": "4.95.1",
|
|
10
|
+
"@patternfly/react-charts": "7.0.0-alpha.3",
|
|
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",
|
|
14
|
+
"@patternfly/react-inline-edit-extension": "4.86.118",
|
|
15
|
+
"@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
|
+
"@patternfly/react-topology": "4.91.27",
|
|
20
|
+
"@patternfly/react-virtualized-extension": "4.88.113"
|
|
21
|
+
}
|
|
22
|
+
},
|
|
3
23
|
{
|
|
4
24
|
"name": "2023.01",
|
|
5
25
|
"date": "2022-01-31",
|