@patternfly/documentation-framework 2.0.0-alpha.9 → 5.0.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.
Files changed (71) hide show
  1. package/CHANGELOG.md +606 -0
  2. package/README.md +1 -1
  3. package/app.js +20 -14
  4. package/assets/Favicon-Light-16x16.png +0 -0
  5. package/assets/Favicon-Light-32x32.png +0 -0
  6. package/assets/Favicon-Light-48x48.png +0 -0
  7. package/assets/Favicon-Light.png +0 -0
  8. package/assets/android-chrome-36x36.png +0 -0
  9. package/assets/android-chrome-48x48.png +0 -0
  10. package/assets/android-chrome-96x96.png +0 -0
  11. package/components/autoLinkHeader/autoLinkHeader.css +2 -2
  12. package/components/autoLinkHeader/autoLinkHeader.js +18 -13
  13. package/components/cssVariables/cssSearch.js +3 -4
  14. package/components/cssVariables/cssVariables.css +4 -4
  15. package/components/cssVariables/cssVariables.js +83 -84
  16. package/components/example/example.css +29 -29
  17. package/components/example/example.js +34 -6
  18. package/components/footer/footer.css +16 -16
  19. package/components/footer/footer.js +16 -16
  20. package/components/functionsTable/functionsTable.js +57 -0
  21. package/components/gdprBanner/gdprBanner.css +2 -2
  22. package/components/gdprBanner/gdprBanner.js +3 -3
  23. package/components/inlineAlert/inlineAlert.js +1 -1
  24. package/components/link/link.js +1 -2
  25. package/components/propsTable/propsTable.js +85 -79
  26. package/components/sectionGallery/TextSummary.js +31 -0
  27. package/components/sectionGallery/sectionDataListLayout.js +51 -0
  28. package/components/sectionGallery/sectionGallery.css +53 -0
  29. package/components/sectionGallery/sectionGallery.js +76 -0
  30. package/components/sectionGallery/sectionGalleryLayout.js +41 -0
  31. package/components/sectionGallery/sectionGalleryToolbar.js +38 -0
  32. package/components/sectionGallery/sectionGalleryWrapper.js +110 -0
  33. package/components/sideNav/sideNav.css +12 -12
  34. package/components/sideNav/sideNav.js +44 -16
  35. package/components/tableOfContents/tableOfContents.css +17 -17
  36. package/helpers/codesandbox.js +3 -5
  37. package/helpers/getTitle.js +2 -2
  38. package/layouts/sideNavLayout/sideNavLayout.css +7 -11
  39. package/layouts/sideNavLayout/sideNavLayout.js +59 -45
  40. package/package.json +28 -29
  41. package/pages/404/404.css +2 -2
  42. package/pages/404/index.js +1 -1
  43. package/pages/global-css-variables.md +16 -16
  44. package/routes.js +20 -10
  45. package/scripts/cli/build.js +0 -1
  46. package/scripts/cli/cli.js +2 -1
  47. package/scripts/cli/generate.js +2 -2
  48. package/scripts/cli/start.js +6 -8
  49. package/scripts/md/parseMD.js +46 -11
  50. package/scripts/md/styled-tags.js +8 -4
  51. package/scripts/tsDocgen.js +119 -91
  52. package/scripts/typeDocGen.js +209 -0
  53. package/scripts/webpack/getHtmlWebpackPlugins.js +1 -2
  54. package/scripts/webpack/prerender.js +1 -2
  55. package/scripts/webpack/webpack.base.config.js +35 -35
  56. package/scripts/webpack/webpack.client.config.js +11 -8
  57. package/scripts/webpack/webpack.server.config.js +8 -5
  58. package/scripts/writeScreenshots.js +3 -3
  59. package/templates/html.ejs +6 -8
  60. package/templates/mdx.css +156 -161
  61. package/templates/mdx.js +122 -51
  62. package/templates/patternfly-docs/content/extensions/extension/design-guidelines/design-guidelines.md +2 -0
  63. package/templates/patternfly-docs/content/extensions/extension/examples/basic.md +2 -0
  64. package/templates/sitemap.ejs +1 -1
  65. package/versions.json +32 -14
  66. package/assets/favicon-16x16.png +0 -0
  67. package/assets/favicon-32x32.png +0 -0
  68. package/assets/favicon-48x48.png +0 -0
  69. package/assets/favicon.ico +0 -0
  70. package/components/topNav/topNav.css +0 -30
  71. package/pages/red-hat-font.md +0 -40
@@ -6,8 +6,8 @@ const MonacoWebpackPlugin = require('monaco-editor-webpack-plugin');
6
6
 
7
7
  module.exports = (_env, argv) => {
8
8
  const {
9
- pathPrefix = '',
10
9
  mode,
10
+ googleAnalyticsID = false,
11
11
  algolia = {},
12
12
  hasGdprBanner = false,
13
13
  hasFooter = false,
@@ -25,9 +25,10 @@ module.exports = (_env, argv) => {
25
25
  return {
26
26
  entry: path.resolve(__dirname, '../../app.js'),
27
27
  output: {
28
- publicPath: isProd ? `${pathPrefix}/` : '/',
28
+ publicPath: '/',
29
29
  pathinfo: false, // https://webpack.js.org/guides/build-performance/#output-without-path-info,
30
- hashDigestLength: 8
30
+ hashDigestLength: 8,
31
+ clean: true, // Clean the output directory before emit.
31
32
  },
32
33
  amd: false, // We don't use any AMD modules, helps performance
33
34
  mode: isProd ? 'production' : 'development',
@@ -39,9 +40,12 @@ module.exports = (_env, argv) => {
39
40
  include: [
40
41
  path.resolve(process.cwd(), 'src'),
41
42
  path.resolve(process.cwd(), 'patternfly-docs'),
43
+ path.resolve(process.cwd(), 'examples'),
42
44
  path.resolve(__dirname, '../..'), // Temporarily compile theme using webpack for development
43
45
  /react-[\w-]+\/src\/.*\/examples/,
44
46
  /react-[\w-]+\\src\\.*\\examples/, // fix for Windows
47
+ /react-[\w-]+\/patternfly-docs\/.*\/examples/, //fixes for extensions
48
+ /react-[\w-]+\\patternfly-docs\\.*\\examples/,
45
49
  ].concat(includePaths.map(path => new RegExp(path))),
46
50
  exclude: [
47
51
  path.resolve(__dirname, '../../node_modules'), // Temporarily compile theme using webpack for development
@@ -82,35 +86,28 @@ module.exports = (_env, argv) => {
82
86
  },
83
87
  {
84
88
  test: /\.(gif|svg)$/,
85
- use: {
86
- loader: 'file-loader',
87
- options: {
88
- name: '[name].[contenthash].[ext]',
89
- outputPath: 'images/'
90
- },
89
+ type: 'asset/resource',
90
+ dependency: { not: ['url'] },
91
+ generator: {
92
+ filename: 'images/[hash][ext][query]'
91
93
  }
92
94
  },
93
95
  {
94
96
  test: /\.(pdf)$/,
95
- use: {
96
- loader: 'file-loader',
97
- options: {
98
- name: '[name].[contenthash].[ext]',
99
- }
97
+ type: 'asset/resource',
98
+ dependency: { not: ['url'] },
99
+ generator: {
100
+ filename: '[hash][ext][query]'
100
101
  }
101
102
  },
102
103
  {
103
104
  test: /.(woff(2)?|ttf|eot)(\?v=\d+\.\d+\.\d+)?$/,
104
- use: [
105
- {
106
- loader: 'file-loader',
107
- options: {
108
- name: '[name].[ext]',
109
- outputPath: 'fonts/'
110
- }
111
- }
112
- ]
113
- }
105
+ type: 'asset/resource',
106
+ dependency: { not: ['url'] },
107
+ generator: {
108
+ filename: 'fonts/[name][ext][query]'
109
+ }
110
+ },
114
111
  ]
115
112
  },
116
113
  resolve: {
@@ -118,21 +115,28 @@ module.exports = (_env, argv) => {
118
115
  alias: {
119
116
  'client-styles': path.resolve(process.cwd(), 'patternfly-docs/patternfly-docs.css.js'),
120
117
  './routes-client': path.resolve(process.cwd(), 'patternfly-docs/patternfly-docs.routes.js'),
121
- './routes-generated': path.resolve(process.cwd(), 'patternfly-docs/generated/index.js')
118
+ './routes-generated': path.resolve(process.cwd(), 'patternfly-docs/generated/index.js'),
119
+ process: "process/browser"
122
120
  },
123
121
  modules: [
124
122
  'node_modules',
125
123
  ...module.paths,
126
- ]
124
+ ],
125
+ fallback: {
126
+ "path": require.resolve("path-browserify")
127
+ },
127
128
  },
128
129
  // Use this module's node_modules first (for use in Core/React workspaces)
129
130
  resolveLoader: {
130
131
  modules: module.paths,
131
132
  },
132
133
  plugins: [
134
+ new webpack.ProvidePlugin({
135
+ process: 'process/browser',
136
+ }),
133
137
  new webpack.DefinePlugin({
134
138
  'process.env.NODE_ENV': JSON.stringify(mode),
135
- 'process.env.pathPrefix': JSON.stringify(isProd ? pathPrefix : ''),
139
+ 'process.env.googleAnalyticsID': JSON.stringify(isProd ? googleAnalyticsID : ''),
136
140
  'process.env.algolia': JSON.stringify(algolia),
137
141
  'process.env.hasGdprBanner': JSON.stringify(hasGdprBanner),
138
142
  'process.env.hasFooter': JSON.stringify(hasFooter),
@@ -143,20 +147,16 @@ module.exports = (_env, argv) => {
143
147
  'process.env.sideNavItems': JSON.stringify(sideNavItems),
144
148
  'process.env.topNavItems': JSON.stringify(topNavItems),
145
149
  'process.env.prnum': JSON.stringify(process.env.CIRCLE_PR_NUMBER || process.env.PR_NUMBER || ''),
146
- 'process.env.prurl': JSON.stringify(process.env.CIRCLE_PULL_REQUEST || ''),
150
+ 'process.env.prurl': JSON.stringify(process.env.CIRCLE_PULL_REQUEST || '')
147
151
  }),
148
152
  new CopyWebpackPlugin({
149
153
  patterns: [
150
154
  { from: path.join(__dirname, '../../assets'), to: 'assets' }
151
155
  ]
152
156
  }),
153
- new MonacoWebpackPlugin(),
154
- ...(isProd
155
- ? [
156
- new CleanWebpackPlugin()
157
- ]
158
- : []
159
- )
157
+ new MonacoWebpackPlugin({
158
+ globalAPI: true,
159
+ })
160
160
  ],
161
161
  stats: 'minimal'
162
162
  };
@@ -5,6 +5,7 @@ const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPl
5
5
  const MiniCssExtractPlugin = require('mini-css-extract-plugin');
6
6
  const TerserPlugin = require('terser-webpack-plugin');
7
7
  const CopyPlugin = require('copy-webpack-plugin');
8
+ const webpack = require('webpack');
8
9
  const baseConfig = require('./webpack.base.config');
9
10
  const { getHtmlWebpackPlugins } = require('./getHtmlWebpackPlugins');
10
11
 
@@ -23,18 +24,20 @@ const reactJSRegex = /react-([^\\/]*)[\\/]dist[\\/].*\.js$/
23
24
 
24
25
  const clientConfig = async (env, argv) => {
25
26
  const isProd = argv.mode === 'production';
26
-
27
27
  return {
28
28
  output: {
29
29
  path: argv.output ? path.resolve(argv.output) : path.resolve('public'),
30
- filename: '[name].[hash].bundle.js'
30
+ filename: '[name].[contenthash].bundle.js'
31
31
  },
32
32
  devServer: {
33
33
  hot: true,
34
34
  historyApiFallback: true,
35
+ compress: true,
35
36
  port: argv.port,
36
- clientLogLevel: 'info',
37
- stats: 'minimal'
37
+ client: {
38
+ logging: 'info',
39
+ },
40
+ static: {}
38
41
  },
39
42
  optimization: {
40
43
  splitChunks: {
@@ -71,10 +74,7 @@ const clientConfig = async (env, argv) => {
71
74
  },
72
75
  minimize: isProd ? true : false,
73
76
  minimizer: [
74
- new TerserPlugin({
75
- cache: path.join(process.cwd(), '.cache/terser'),
76
- ...(process.env.CI ? { parallel: 2 } : {})
77
- }),
77
+ new TerserPlugin(),
78
78
  ],
79
79
  runtimeChunk: 'single',
80
80
  },
@@ -113,6 +113,9 @@ const clientConfig = async (env, argv) => {
113
113
  ]
114
114
  },
115
115
  plugins: [
116
+ new webpack.DefinePlugin({
117
+ 'process.env.PRERENDER': false,
118
+ }),
116
119
  new MiniCssExtractPlugin(!isProd ? {} : {
117
120
  filename: '[name].[contenthash].css',
118
121
  chunkFilename: '[name].[contenthash].css',
@@ -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
  );
@@ -11,7 +11,7 @@ sharp.cache(false);
11
11
  async function writeScreenshot({ page, data: { url, urlPrefix } }) {
12
12
  await page.goto(url);
13
13
  await page.addStyleTag({content: '*,*::before,*::after{animation-delay:-1ms !important;animation-duration:1ms !important;animation-iteration-count:1 !important;transition-duration:0s !important;transition-delay:0s !important;}'}); // disable animations/transitions so they don't interfere with screenshot tool
14
- await page.waitForSelector('.pf-u-h-100');
14
+ await page.waitForSelector('.pf-v5-u-h-100');
15
15
  const outfile = path.join(
16
16
  screenshotBase,
17
17
  url.replace(`${urlPrefix}/`, '') + '.png'
@@ -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
@@ -5,20 +5,18 @@
5
5
  <meta name="viewport" content="width=device-width,initial-scale=1,shrink-to-fit=no">
6
6
  <meta name="description" content="PatternFly is Red Hat's open source design system. It consists of components, documentation, and code for building enterprise applications at scale.">
7
7
  <title><%= title %></title>
8
- <link rel="shortcut icon" href="/assets/favicon.ico">
9
- <link rel="icon" type="image/png" sizes="16x16" href="/assets/favicon-16x16.png">
10
- <link rel="icon" type="image/png" sizes="32x32" href="/assets/favicon-32x32.png">
11
- <link rel="icon" type="image/png" sizes="48x48" href="/assets/favicon-48x48.png">
8
+ <link rel="shortcut icon" href="/assets/Favicon-Light.png">
9
+ <link rel="icon" type="image/png" sizes="16x16" href="/assets/Favicon-Light-16x16.png">
10
+ <link rel="icon" type="image/png" sizes="32x32" href="/assets/Favicon-Light-32x32.png">
11
+ <link rel="icon" type="image/png" sizes="48x48" href="/assets/Favicon-Light-48x48.png">
12
12
  <link rel="manifest" href="/assets/manifest.json">
13
13
  <meta name="mobile-web-app-capable" content="yes">
14
14
  <meta name="theme-color" content="#151515">
15
15
  <meta name="application-name" content="PatternFly docs">
16
16
  <%= htmlWebpackPlugin.tags.headTags %>
17
17
  </head>
18
- <body class="pf-m-redhat-updated-font pf-m-redhatmono-font">
19
- <div id="root">
20
- <%= prerendering %>
21
- </div>
18
+ <body>
19
+ <div id="root"><%= prerendering %></div>
22
20
  <%= htmlWebpackPlugin.tags.bodyTags %>
23
21
  <% if (algolia) { %>
24
22
  <script