@patternfly/documentation-framework 2.0.0-alpha.4 → 2.0.0-alpha.40

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 (52) hide show
  1. package/CHANGELOG.md +339 -0
  2. package/app.js +12 -11
  3. package/components/autoLinkHeader/autoLinkHeader.css +2 -2
  4. package/components/cssVariables/cssSearch.js +3 -4
  5. package/components/cssVariables/cssVariables.css +4 -4
  6. package/components/cssVariables/cssVariables.js +72 -70
  7. package/components/example/example.css +29 -29
  8. package/components/example/example.js +4 -4
  9. package/components/footer/footer.css +15 -15
  10. package/components/footer/footer.js +13 -13
  11. package/components/functionsTable/functionsTable.js +57 -0
  12. package/components/gdprBanner/gdprBanner.css +2 -2
  13. package/components/gdprBanner/gdprBanner.js +3 -3
  14. package/components/inlineAlert/inlineAlert.js +1 -1
  15. package/components/propsTable/propsTable.js +85 -79
  16. package/components/sectionGallery/sectionDataListLayout.js +67 -0
  17. package/components/sectionGallery/sectionGallery.css +44 -0
  18. package/components/sectionGallery/sectionGallery.js +53 -0
  19. package/components/sectionGallery/sectionGalleryLayout.js +37 -0
  20. package/components/sectionGallery/sectionGalleryToolbar.js +30 -0
  21. package/components/sectionGallery/sectionGalleryWrapper.js +89 -0
  22. package/components/sideNav/sideNav.css +12 -12
  23. package/components/sideNav/sideNav.js +12 -5
  24. package/components/tableOfContents/tableOfContents.css +17 -17
  25. package/components/topNav/topNav.css +12 -12
  26. package/helpers/getTitle.js +2 -2
  27. package/layouts/sideNavLayout/sideNavLayout.css +7 -11
  28. package/layouts/sideNavLayout/sideNavLayout.js +57 -40
  29. package/package.json +28 -25
  30. package/pages/404/404.css +2 -2
  31. package/pages/404/index.js +4 -4
  32. package/pages/global-css-variables.md +16 -16
  33. package/pages/red-hat-font.md +1 -1
  34. package/routes.js +19 -5
  35. package/scripts/cli/build.js +6 -0
  36. package/scripts/cli/cli.js +2 -0
  37. package/scripts/cli/generate.js +2 -2
  38. package/scripts/cli/start.js +6 -8
  39. package/scripts/md/parseMD.js +40 -8
  40. package/scripts/md/styled-tags.js +2 -2
  41. package/scripts/tsDocgen.js +119 -91
  42. package/scripts/typeDocGen.js +209 -0
  43. package/scripts/webpack/webpack.base.config.js +34 -32
  44. package/scripts/webpack/webpack.client.config.js +11 -8
  45. package/scripts/webpack/webpack.server.config.js +8 -5
  46. package/scripts/writeScreenshots.js +3 -3
  47. package/templates/html.ejs +1 -3
  48. package/templates/mdx.css +155 -160
  49. package/templates/mdx.js +60 -43
  50. package/templates/patternfly-docs/content/extensions/extension/design-guidelines/design-guidelines.md +2 -0
  51. package/templates/patternfly-docs/content/extensions/extension/examples/basic.md +2 -0
  52. package/versions.json +29 -9
@@ -8,6 +8,7 @@ module.exports = (_env, argv) => {
8
8
  const {
9
9
  pathPrefix = '',
10
10
  mode,
11
+ googleAnalyticsID = false,
11
12
  algolia = {},
12
13
  hasGdprBanner = false,
13
14
  hasFooter = false,
@@ -27,7 +28,8 @@ module.exports = (_env, argv) => {
27
28
  output: {
28
29
  publicPath: isProd ? `${pathPrefix}/` : '/',
29
30
  pathinfo: false, // https://webpack.js.org/guides/build-performance/#output-without-path-info,
30
- hashDigestLength: 8
31
+ hashDigestLength: 8,
32
+ clean: true, // Clean the output directory before emit.
31
33
  },
32
34
  amd: false, // We don't use any AMD modules, helps performance
33
35
  mode: isProd ? 'production' : 'development',
@@ -39,9 +41,12 @@ module.exports = (_env, argv) => {
39
41
  include: [
40
42
  path.resolve(process.cwd(), 'src'),
41
43
  path.resolve(process.cwd(), 'patternfly-docs'),
44
+ path.resolve(process.cwd(), 'examples'),
42
45
  path.resolve(__dirname, '../..'), // Temporarily compile theme using webpack for development
43
46
  /react-[\w-]+\/src\/.*\/examples/,
44
47
  /react-[\w-]+\\src\\.*\\examples/, // fix for Windows
48
+ /react-[\w-]+\/patternfly-docs\/.*\/examples/, //fixes for extensions
49
+ /react-[\w-]+\\patternfly-docs\\.*\\examples/,
45
50
  ].concat(includePaths.map(path => new RegExp(path))),
46
51
  exclude: [
47
52
  path.resolve(__dirname, '../../node_modules'), // Temporarily compile theme using webpack for development
@@ -82,35 +87,28 @@ module.exports = (_env, argv) => {
82
87
  },
83
88
  {
84
89
  test: /\.(gif|svg)$/,
85
- use: {
86
- loader: 'file-loader',
87
- options: {
88
- name: '[name].[contenthash].[ext]',
89
- outputPath: 'images/'
90
- },
90
+ type: 'asset/resource',
91
+ dependency: { not: ['url'] },
92
+ generator: {
93
+ filename: 'images/[hash][ext][query]'
91
94
  }
92
95
  },
93
96
  {
94
97
  test: /\.(pdf)$/,
95
- use: {
96
- loader: 'file-loader',
97
- options: {
98
- name: '[name].[contenthash].[ext]',
99
- }
98
+ type: 'asset/resource',
99
+ dependency: { not: ['url'] },
100
+ generator: {
101
+ filename: '[hash][ext][query]'
100
102
  }
101
103
  },
102
104
  {
103
105
  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
- }
106
+ type: 'asset/resource',
107
+ dependency: { not: ['url'] },
108
+ generator: {
109
+ filename: 'fonts/[name][ext][query]'
110
+ }
111
+ },
114
112
  ]
115
113
  },
116
114
  resolve: {
@@ -118,21 +116,29 @@ module.exports = (_env, argv) => {
118
116
  alias: {
119
117
  'client-styles': path.resolve(process.cwd(), 'patternfly-docs/patternfly-docs.css.js'),
120
118
  './routes-client': path.resolve(process.cwd(), 'patternfly-docs/patternfly-docs.routes.js'),
121
- './routes-generated': path.resolve(process.cwd(), 'patternfly-docs/generated/index.js')
119
+ './routes-generated': path.resolve(process.cwd(), 'patternfly-docs/generated/index.js'),
120
+ process: "process/browser"
122
121
  },
123
122
  modules: [
124
123
  'node_modules',
125
124
  ...module.paths,
126
- ]
125
+ ],
126
+ fallback: {
127
+ "path": require.resolve("path-browserify")
128
+ },
127
129
  },
128
130
  // Use this module's node_modules first (for use in Core/React workspaces)
129
131
  resolveLoader: {
130
132
  modules: module.paths,
131
133
  },
132
134
  plugins: [
135
+ new webpack.ProvidePlugin({
136
+ process: 'process/browser',
137
+ }),
133
138
  new webpack.DefinePlugin({
134
139
  'process.env.NODE_ENV': JSON.stringify(mode),
135
140
  'process.env.pathPrefix': JSON.stringify(isProd ? pathPrefix : ''),
141
+ 'process.env.googleAnalyticsID': JSON.stringify(isProd ? googleAnalyticsID : ''),
136
142
  'process.env.algolia': JSON.stringify(algolia),
137
143
  'process.env.hasGdprBanner': JSON.stringify(hasGdprBanner),
138
144
  'process.env.hasFooter': JSON.stringify(hasFooter),
@@ -143,20 +149,16 @@ module.exports = (_env, argv) => {
143
149
  'process.env.sideNavItems': JSON.stringify(sideNavItems),
144
150
  'process.env.topNavItems': JSON.stringify(topNavItems),
145
151
  '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 || ''),
152
+ 'process.env.prurl': JSON.stringify(process.env.CIRCLE_PULL_REQUEST || '')
147
153
  }),
148
154
  new CopyWebpackPlugin({
149
155
  patterns: [
150
156
  { from: path.join(__dirname, '../../assets'), to: 'assets' }
151
157
  ]
152
158
  }),
153
- new MonacoWebpackPlugin(),
154
- ...(isProd
155
- ? [
156
- new CleanWebpackPlugin()
157
- ]
158
- : []
159
- )
159
+ new MonacoWebpackPlugin({
160
+ globalAPI: true,
161
+ })
160
162
  ],
161
163
  stats: 'minimal'
162
164
  };
@@ -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
@@ -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