Skip to content

Commit

Permalink
[private-classnames] Remove package and move everything to utils (mui…
Browse files Browse the repository at this point in the history
  • Loading branch information
mnajdova authored May 17, 2022
1 parent 6972036 commit 57c91aa
Show file tree
Hide file tree
Showing 40 changed files with 28 additions and 124 deletions.
1 change: 0 additions & 1 deletion .codesandbox/ci.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
"@mui/styled-engine-sc": "packages/mui-styled-engine-sc/build",
"@mui/system": "packages/mui-system/build",
"@mui/private-theming": "packages/mui-private-theming/build",
"@mui/private-classnames": "packages/mui-private-classnames/build",
"@mui/types": "packages/mui-types/build",
"@mui/utils": "packages/mui-utils/build",
"@mui/base": "packages/mui-base/build",
Expand Down
1 change: 0 additions & 1 deletion babel.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ const defaultAlias = {
'@mui/styles': resolveAliasPath('./packages/mui-styles/src'),
'@mui/system': resolveAliasPath('./packages/mui-system/src'),
'@mui/private-theming': resolveAliasPath('./packages/mui-private-theming/src'),
'@mui/private-classnames': resolveAliasPath('./packages/mui-private-classnames/src'),
'@mui/base': resolveAliasPath('./packages/mui-base/src'),
'@mui/utils': resolveAliasPath('./packages/mui-utils/src'),
'@mui/material-next': resolveAliasPath('./packages/mui-material-next/src'),
Expand Down
1 change: 0 additions & 1 deletion docs/babel.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ const alias = {
// '@mui/styled-engine': '../packages/mui-styled-engine-sc/src',
'@mui/system': '../packages/mui-system/src',
'@mui/private-theming': '../packages/mui-private-theming/src',
'@mui/private-classnames': '../packages/mui-private-classnames/src',
'@mui/utils': '../packages/mui-utils/src',
'@mui/base': '../packages/mui-base/src',
'@mui/material-next': '../packages/mui-material-next/src',
Expand Down
1 change: 0 additions & 1 deletion docs/next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,6 @@ module.exports = {
'@mui/styles': '../packages/mui-styles/src',
'@mui/system': '../packages/mui-system/src',
'@mui/private-theming': '../packages/mui-private-theming/src',
'@mui/private-classnames': '../packages/mui-private-classnames/src',
'@mui/utils': '../packages/mui-utils/src',
'@mui/base': '../packages/mui-base/src',
'@mui/material-next': '../packages/mui-material-next/src',
Expand Down
1 change: 0 additions & 1 deletion docs/src/modules/utils/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,6 @@ export function getDependencies(
'@mui/styles': getMuiPackageVersion('styles', muiCommitRef),
'@mui/system': getMuiPackageVersion('system', muiCommitRef),
'@mui/private-theming': getMuiPackageVersion('theming', muiCommitRef),
'@mui/private-classnames': getMuiPackageVersion('classnames', muiCommitRef),
'@mui/base': getMuiPackageVersion('base', muiCommitRef),
'@mui/utils': getMuiPackageVersion('utils', muiCommitRef),
'@mui/material-next': getMuiPackageVersion('material-next', muiCommitRef),
Expand Down
1 change: 0 additions & 1 deletion packages/mui-base/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@
"dependencies": {
"@babel/runtime": "^7.17.2",
"@emotion/is-prop-valid": "^1.1.2",
"@mui/private-classnames": "^5.7.0",
"@mui/types": "^7.1.3",
"@mui/utils": "^5.7.0",
"@popperjs/core": "^2.11.5",
Expand Down
2 changes: 1 addition & 1 deletion packages/mui-base/src/className/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
// eslint-disable-next-line import/prefer-default-export
export { unstable_ClassNameGenerator } from '@mui/private-classnames';
export { unstable_ClassNameGenerator } from '@mui/utils';
2 changes: 1 addition & 1 deletion packages/mui-base/src/composeClasses/index.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export { unstable_composeClasses as default } from '@mui/private-classnames';
export { unstable_composeClasses as default } from '@mui/utils';
4 changes: 2 additions & 2 deletions packages/mui-base/src/generateUtilityClass/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
export { generateUtilityClass as default } from '@mui/private-classnames';
export type { GlobalStateSlot } from '@mui/private-classnames';
export { unstable_generateUtilityClass as default } from '@mui/utils';
export type { GlobalStateSlot } from '@mui/utils';
2 changes: 1 addition & 1 deletion packages/mui-base/src/generateUtilityClasses/index.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export { generateUtilityClasses as default } from '@mui/private-classnames';
export { unstable_generateUtilityClasses as default } from '@mui/utils';
3 changes: 1 addition & 2 deletions packages/mui-base/tsconfig.build.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,5 @@
"rootDir": "./src"
},
"include": ["src/**/*.ts*"],
"exclude": ["src/**/*.spec.ts*", "src/**/*.test.ts*"],
"references": [{ "path": "../mui-private-classnames/tsconfig.build.json" }]
"exclude": ["src/**/*.spec.ts*", "src/**/*.test.ts*"]
}
1 change: 0 additions & 1 deletion packages/mui-material/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@
"dependencies": {
"@babel/runtime": "^7.17.2",
"@mui/base": "5.0.0-alpha.80",
"@mui/private-classnames": "^5.7.0",
"@mui/system": "^5.7.0",
"@mui/types": "^7.1.3",
"@mui/utils": "^5.7.0",
Expand Down
4 changes: 0 additions & 4 deletions packages/mui-material/scripts/rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,10 +102,6 @@ const nestedFolder = {
return resolveNestedImport('mui-private-theming', importee);
}

if (importee.indexOf('@mui/private-classnames/') === 0) {
return resolveNestedImport('mui-private-classnames', importee);
}

if (importee.indexOf('@mui/styled-engine/') === 0) {
return resolveNestedImport('mui-styled-engine', importee);
}
Expand Down
2 changes: 1 addition & 1 deletion packages/mui-material/src/className/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
// eslint-disable-next-line import/prefer-default-export
export { unstable_ClassNameGenerator } from '@mui/private-classnames';
export { unstable_ClassNameGenerator } from '@mui/utils';
3 changes: 0 additions & 3 deletions packages/mui-private-classnames/README.md

This file was deleted.

46 changes: 0 additions & 46 deletions packages/mui-private-classnames/package.json

This file was deleted.

11 changes: 0 additions & 11 deletions packages/mui-private-classnames/src/index.d.ts

This file was deleted.

4 changes: 0 additions & 4 deletions packages/mui-private-classnames/src/index.js

This file was deleted.

15 changes: 0 additions & 15 deletions packages/mui-private-classnames/tsconfig.build.json

This file was deleted.

4 changes: 0 additions & 4 deletions packages/mui-private-classnames/tsconfig.json

This file was deleted.

5 changes: 4 additions & 1 deletion packages/mui-system/src/Container/containerClasses.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
import { generateUtilityClass, generateUtilityClasses } from '@mui/private-classnames';
import {
unstable_generateUtilityClass as generateUtilityClass,
unstable_generateUtilityClasses as generateUtilityClasses,
} from '@mui/utils';

export interface ContainerClasses {
/** Styles applied to the root element. */
Expand Down
6 changes: 3 additions & 3 deletions packages/mui-system/src/Container/createContainer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ import * as React from 'react';
import PropTypes from 'prop-types';
import clsx from 'clsx';
import { Interpolation, StyledComponent } from '@mui/styled-engine';
import { unstable_capitalize as capitalize } from '@mui/utils';
import { OverridableComponent } from '@mui/types';
import {
unstable_capitalize as capitalize,
unstable_composeClasses as composeClasses,
generateUtilityClass,
} from '@mui/private-classnames';
unstable_generateUtilityClass as generateUtilityClass,
} from '@mui/utils';
import { ContainerProps, ContainerTypeMap } from './ContainerProps';
import useThemePropsSystem from '../useThemeProps';
import systemStyled from '../styled';
Expand Down
3 changes: 1 addition & 2 deletions packages/mui-system/tsconfig.build.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,5 @@
"rootDir": "./src"
},
"include": ["src/**/*.ts*"],
"exclude": ["src/**/*.spec.ts", "src/**/*.test.ts"],
"references": [{ "path": "../mui-private-classnames/tsconfig.build.json" }]
"exclude": ["src/**/*.spec.ts", "src/**/*.test.ts"]
}
4 changes: 2 additions & 2 deletions packages/mui-utils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,14 @@
"url": "https://opencollective.com/mui"
},
"scripts": {
"build": "yarn build:legacy && yarn build:modern && yarn build:node && yarn build:stable && yarn build:copy-files && yarn build:types",
"build": "yarn build:legacy && yarn build:modern && yarn build:node && yarn build:stable && yarn build:types && yarn build:copy-files",
"build:legacy": "node ../../scripts/build legacy",
"build:modern": "node ../../scripts/build modern",
"build:node": "node ../../scripts/build node",
"build:stable": "node ../../scripts/build stable",
"build:copy-files": "node ../../scripts/copy-files.js",
"build:types": "node ../../scripts/buildTypes",
"prebuild": "rimraf build",
"prebuild": "rimraf build tsconfig.build.tsbuildinfo",
"release": "yarn build && npm publish build",
"test": "cd ../../ && cross-env NODE_ENV=test mocha 'packages/mui-utils/**/*.test.{js,ts,tsx}'",
"typescript": "tslint -p tsconfig.json \"{src,test}/**/*.{spec,d}.{ts,tsx}\" && tsc -p tsconfig.json"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { expect } from 'chai';
import { unstable_composeClasses as composeClasses } from '@mui/private-classnames';
import { unstable_composeClasses as composeClasses } from '@mui/utils';

describe('composeClasses', () => {
it('should generate the classes based on the slots', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { expect } from 'chai';
import {
generateUtilityClass,
unstable_generateUtilityClass as generateUtilityClass,
unstable_ClassNameGenerator as ClassNameGenerator,
} from '@mui/private-classnames';
} from '@mui/utils';

describe('generateUtilityClass', () => {
it('should generate the class correctly', () => {
Expand All @@ -27,14 +27,14 @@ describe('generateUtilityClass', () => {
});

it('able to set custom generator', () => {
const generator = (name) => `foo-bar-${name}`;
const generator = (name: string) => `foo-bar-${name}`;
ClassNameGenerator.configure(generator);

expect(generateUtilityClass('MuiTest', 'slot')).to.equal('foo-bar-MuiTest-slot');
});

it('does not affect state class', () => {
const generator = (name) => `foo-bar-${name}`;
const generator = (name: string) => `foo-bar-${name}`;
ClassNameGenerator.configure(generator);

expect(generateUtilityClass('MuiTest', 'active')).to.equal('Mui-active');
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { expect } from 'chai';
import { generateUtilityClasses } from '@mui/private-classnames';
import { unstable_generateUtilityClasses as generateUtilityClasses } from '@mui/utils';

describe('generateUtilityClasses', () => {
it('should generate the classes correctly', () => {
Expand Down
5 changes: 5 additions & 0 deletions packages/mui-utils/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,8 @@ export { default as usePreviousProps } from './usePreviousProps';
export { default as visuallyHidden } from './visuallyHidden';
export { default as integerPropType } from './integerPropType';
export { default as internal_resolveProps } from './resolveProps';
export { default as unstable_composeClasses } from './composeClasses';
export { default as unstable_generateUtilityClass } from './generateUtilityClass';
export * from './generateUtilityClass';
export { default as unstable_generateUtilityClasses } from './generateUtilityClasses';
export { default as unstable_ClassNameGenerator } from './ClassNameGenerator';
4 changes: 0 additions & 4 deletions scripts/sizeSnapshot/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -216,10 +216,6 @@ function createWebpackConfig(entry, environment) {
'@mui/styles': path.join(workspaceRoot, 'packages/mui-styles/build'),
'@mui/system': path.join(workspaceRoot, 'packages/mui-system/build'),
'@mui/private-theming': path.join(workspaceRoot, 'packages/mui-private-theming/build'),
'@mui/private-classnames': path.join(
workspaceRoot,
'packages/mui-private-classnames/build',
),
'@mui/utils': path.join(workspaceRoot, 'packages/mui-utils/build'),
'@mui/base': path.join(workspaceRoot, 'packages/mui-base/build'),
'@mui/material-next': path.join(workspaceRoot, 'packages/mui-material-next/build'),
Expand Down
1 change: 0 additions & 1 deletion test/karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,6 @@ module.exports = function setKarmaConfig(config) {
'@mui/styles': './packages/mui-styles/src',
'@mui/system': './packages/mui-system/src',
'@mui/private-theming': './packages/mui-private-theming/src',
'@mui/private-classnames': './packages/mui-private-classnames/src',
'@mui/utils': './packages/mui-utils/src',
'@mui/base': './packages/mui-base/src',
'@mui/material-next': './packages/mui-material-next/src',
Expand Down
2 changes: 0 additions & 2 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@
"@mui/system": ["./packages/mui-system/src"],
"@mui/private-theming": ["./packages/mui-private-theming/src"],
"@mui/private-theming/*": ["./packages/mui-private-theming/src/*"],
"@mui/private-classnames": ["./packages/mui-private-classnames/src"],
"@mui/private-classnames/*": ["./packages/mui-private-classnames/src/*"],
"@mui/types": ["./packages/mui-types"],
"@mui/base": ["./packages/mui-base/src"],
"@mui/base/*": ["./packages/mui-base/src/*"],
Expand Down
1 change: 0 additions & 1 deletion webpackBaseConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ module.exports = {
'@mui/styles': path.resolve(__dirname, './packages/mui-styles/src'),
'@mui/system': path.resolve(__dirname, './packages/mui-system/src'),
'@mui/private-theming': path.resolve(__dirname, './packages/mui-private-theming/src'),
'@mui/private-classnames': path.resolve(__dirname, './packages/mui-private-classnames/src'),
'@mui/base': path.resolve(__dirname, './packages/mui-base/src'),
'@mui/utils': path.resolve(__dirname, './packages/mui-utils/src'),
'@mui/material-next': path.resolve(__dirname, './packages/mui-material-next/src'),
Expand Down

0 comments on commit 57c91aa

Please sign in to comment.