@patternfly/react-styles 5.4.0-prerelease.5 → 5.4.0-prerelease.7
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
CHANGED
@@ -3,6 +3,14 @@
|
|
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
|
+
# [5.4.0-prerelease.7](https://github.com/patternfly/patternfly-react/compare/@patternfly/react-styles@5.4.0-prerelease.6...@patternfly/react-styles@5.4.0-prerelease.7) (2024-06-13)
|
7
|
+
|
8
|
+
**Note:** Version bump only for package @patternfly/react-styles
|
9
|
+
|
10
|
+
# [5.4.0-prerelease.6](https://github.com/patternfly/patternfly-react/compare/@patternfly/react-styles@5.4.0-prerelease.5...@patternfly/react-styles@5.4.0-prerelease.6) (2024-05-31)
|
11
|
+
|
12
|
+
**Note:** Version bump only for package @patternfly/react-styles
|
13
|
+
|
6
14
|
# [5.4.0-prerelease.5](https://github.com/patternfly/patternfly-react/compare/@patternfly/react-styles@5.4.0-prerelease.4...@patternfly/react-styles@5.4.0-prerelease.5) (2024-05-20)
|
7
15
|
|
8
16
|
**Note:** Version bump only for package @patternfly/react-styles
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@patternfly/react-styles",
|
3
|
-
"version": "5.4.0-prerelease.
|
3
|
+
"version": "5.4.0-prerelease.7",
|
4
4
|
"main": "dist/js/index.js",
|
5
5
|
"module": "dist/esm/index.js",
|
6
6
|
"types": "dist/esm/index.d.ts",
|
@@ -14,17 +14,14 @@
|
|
14
14
|
"access": "public"
|
15
15
|
},
|
16
16
|
"scripts": {
|
17
|
-
"generate": "rimraf css && node scripts/writeClassMaps.
|
17
|
+
"generate": "rimraf css && node scripts/writeClassMaps.mjs && node scripts/copyStyles.mjs",
|
18
18
|
"clean": "rimraf dist css"
|
19
19
|
},
|
20
20
|
"devDependencies": {
|
21
21
|
"@patternfly/patternfly": "5.4.0-prerelease.3",
|
22
|
-
"
|
23
|
-
"
|
24
|
-
"fs-extra": "^11.1.1",
|
25
|
-
"glob": "^7.1.2",
|
26
|
-
"jsdom": "^15.1.0"
|
22
|
+
"change-case": "^5.4.4",
|
23
|
+
"fs-extra": "^11.2.0"
|
27
24
|
},
|
28
25
|
"license": "MIT",
|
29
|
-
"gitHead": "
|
26
|
+
"gitHead": "b1dd98299ae56738c87630eb74c175ff92ad212c"
|
30
27
|
}
|
@@ -0,0 +1,8 @@
|
|
1
|
+
import { copySync } from 'fs-extra/esm';
|
2
|
+
import path from 'node:path';
|
3
|
+
import url from 'node:url';
|
4
|
+
|
5
|
+
const toDir = path.resolve(import.meta.dirname, '../css');
|
6
|
+
const fromDir = path.dirname(url.fileURLToPath(import.meta.resolve('@patternfly/patternfly/package.json')));
|
7
|
+
|
8
|
+
copySync(path.join(fromDir, 'assets/images'), path.join(toDir, 'assets/images'));
|
@@ -1,7 +1,8 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
1
|
+
import { camelCase } from 'change-case';
|
2
|
+
import { glob } from 'glob';
|
3
|
+
import fs from 'node:fs';
|
4
|
+
import path from 'node:path';
|
5
|
+
import url from 'node:url';
|
5
6
|
|
6
7
|
/**
|
7
8
|
* @param {string} cssString - CSS string
|
@@ -14,7 +15,7 @@ function getCSSClasses(cssString) {
|
|
14
15
|
* @param {string} className - Class name
|
15
16
|
*/
|
16
17
|
function formatClassName(className) {
|
17
|
-
return
|
18
|
+
return camelCase(className.replace(/pf-(v5-)?((c|l|m|u|is|has)-)?/g, ''));
|
18
19
|
}
|
19
20
|
|
20
21
|
/**
|
@@ -53,8 +54,8 @@ function getClassMaps(cssString) {
|
|
53
54
|
/**
|
54
55
|
* @returns {any} Map of file names to classMaps
|
55
56
|
*/
|
56
|
-
function generateClassMaps() {
|
57
|
-
const pfStylesDir = path.dirname(
|
57
|
+
export function generateClassMaps() {
|
58
|
+
const pfStylesDir = path.dirname(url.fileURLToPath(import.meta.resolve('@patternfly/patternfly/patternfly.css')));
|
58
59
|
|
59
60
|
const patternflyCSSFiles = glob.sync('**/*.css', {
|
60
61
|
cwd: pfStylesDir,
|
@@ -73,7 +74,3 @@ function generateClassMaps() {
|
|
73
74
|
|
74
75
|
return res;
|
75
76
|
}
|
76
|
-
|
77
|
-
module.exports = {
|
78
|
-
generateClassMaps
|
79
|
-
};
|
@@ -1,34 +1,36 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
1
|
+
import { outputFileSync } from 'fs-extra/esm';
|
2
|
+
import fs from 'node:fs';
|
3
|
+
import path from 'node:path';
|
4
|
+
import url from 'node:url';
|
5
|
+
import { generateClassMaps } from './generateClassMaps.mjs';
|
4
6
|
|
5
|
-
const outDir = resolve(
|
7
|
+
const outDir = path.resolve(import.meta.dirname, '../css');
|
6
8
|
|
7
9
|
const writeCJSExport = (file, classMap) =>
|
8
10
|
outputFileSync(
|
9
|
-
join(outDir, file.replace(/.css$/, '.js')),
|
11
|
+
path.join(outDir, file.replace(/.css$/, '.js')),
|
10
12
|
`
|
11
13
|
"use strict";
|
12
14
|
exports.__esModule = true;
|
13
|
-
require('./${basename(file, '.css.js')}');
|
15
|
+
require('./${path.basename(file, '.css.js')}');
|
14
16
|
exports.default = ${JSON.stringify(classMap, null, 2)};
|
15
17
|
`.trim()
|
16
18
|
);
|
17
19
|
|
18
20
|
const writeESMExport = (file, classMap) =>
|
19
21
|
outputFileSync(
|
20
|
-
join(outDir, file.replace(/.css$/, '.mjs')),
|
22
|
+
path.join(outDir, file.replace(/.css$/, '.mjs')),
|
21
23
|
`
|
22
|
-
import './${basename(file, '.css.js')}';
|
24
|
+
import './${path.basename(file, '.css.js')}';
|
23
25
|
export default ${JSON.stringify(classMap, null, 2)};
|
24
26
|
`.trim()
|
25
27
|
);
|
26
28
|
|
27
29
|
const writeDTSExport = (file, classMap) =>
|
28
30
|
outputFileSync(
|
29
|
-
join(outDir, file.replace(/.css$/, '.d.ts')),
|
31
|
+
path.join(outDir, file.replace(/.css$/, '.d.ts')),
|
30
32
|
`
|
31
|
-
import './${basename(file, '.css.js')}';
|
33
|
+
import './${path.basename(file, '.css.js')}';
|
32
34
|
declare const _default: ${JSON.stringify(classMap, null, 2)};
|
33
35
|
export default _default;
|
34
36
|
`.trim()
|
@@ -38,15 +40,15 @@ export default _default;
|
|
38
40
|
* @param {any} classMaps Map of file names to classMaps
|
39
41
|
*/
|
40
42
|
function writeClassMaps(classMaps) {
|
41
|
-
const pfStylesDir = dirname(
|
43
|
+
const pfStylesDir = path.dirname(url.fileURLToPath(import.meta.resolve('@patternfly/patternfly/patternfly.css')));
|
42
44
|
|
43
45
|
Object.entries(classMaps).forEach(([file, classMap]) => {
|
44
|
-
const outPath = file.includes(pfStylesDir) ? relative(pfStylesDir, file) : relative('src/css', file);
|
46
|
+
const outPath = file.includes(pfStylesDir) ? path.relative(pfStylesDir, file) : path.relative('src/css', file);
|
45
47
|
|
46
48
|
writeCJSExport(outPath, classMap);
|
47
49
|
writeDTSExport(outPath, classMap);
|
48
50
|
writeESMExport(outPath, classMap);
|
49
|
-
copyFileSync(file, join(outDir, outPath));
|
51
|
+
fs.copyFileSync(file, path.join(outDir, outPath));
|
50
52
|
});
|
51
53
|
|
52
54
|
// eslint-disable-next-line no-console
|
package/scripts/copyStyles.js
DELETED
@@ -1,7 +0,0 @@
|
|
1
|
-
const { copySync } = require('fs-extra');
|
2
|
-
const { resolve, dirname, join } = require('path');
|
3
|
-
|
4
|
-
const toDir = resolve(__dirname, '../css');
|
5
|
-
const fromDir = dirname(require.resolve('@patternfly/patternfly/package.json'));
|
6
|
-
|
7
|
-
copySync(join(fromDir, 'assets/images'), join(toDir, 'assets/images'));
|