@mui/codemod 6.4.7 → 6.4.11
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/README.md +36 -62
- package/node/deprecations/all/deprecations-all.js +14 -1
- package/node/deprecations/dialog-classes/dialog-classes.js +69 -0
- package/node/deprecations/dialog-classes/index.js +13 -0
- package/node/deprecations/dialog-classes/postcss-plugin.js +33 -0
- package/node/deprecations/dialog-classes/postcss.config.js +8 -0
- package/node/deprecations/dialog-classes/test-cases/actual.js +7 -0
- package/node/deprecations/dialog-classes/test-cases/expected.js +7 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -11,8 +11,6 @@ Some of the codemods also run [postcss](https://github.com/postcss/postcss) plug
|
|
|
11
11
|
|
|
12
12
|
## Setup & run
|
|
13
13
|
|
|
14
|
-
<!-- #default-branch-switch -->
|
|
15
|
-
|
|
16
14
|
```bash
|
|
17
15
|
npx @mui/codemod@latest <codemod> <paths...>
|
|
18
16
|
|
|
@@ -1032,6 +1030,42 @@ npx @mui/codemod@latest deprecations/circular-progress-classes <path>
|
|
|
1032
1030
|
npx @mui/codemod@latest deprecations/divider-props <path>
|
|
1033
1031
|
```
|
|
1034
1032
|
|
|
1033
|
+
#### `dialog-classes`
|
|
1034
|
+
|
|
1035
|
+
JS transforms:
|
|
1036
|
+
|
|
1037
|
+
```diff
|
|
1038
|
+
import { dialogClasses } from '@mui/material/Dialog';
|
|
1039
|
+
|
|
1040
|
+
MuiDialog: {
|
|
1041
|
+
styleOverrides: {
|
|
1042
|
+
root: {
|
|
1043
|
+
- [`& .${dialogClasses.paperScrollBody}`]: {
|
|
1044
|
+
+ [`& .${dialogClasses.scrollBody} > .${dialogClasses.paper}`]: {
|
|
1045
|
+
color: 'red',
|
|
1046
|
+
},
|
|
1047
|
+
- [`& .${dialogClasses.paperScrollPaper}`]: {
|
|
1048
|
+
+ [`& .${dialogClasses.scrollPaper} > .${dialogClasses.paper}`]: {
|
|
1049
|
+
color: 'red',
|
|
1050
|
+
},
|
|
1051
|
+
},
|
|
1052
|
+
},
|
|
1053
|
+
},
|
|
1054
|
+
```
|
|
1055
|
+
|
|
1056
|
+
CSS transforms:
|
|
1057
|
+
|
|
1058
|
+
```diff
|
|
1059
|
+
-.MuiDialog-root .MuiDialog-paperScrollBody
|
|
1060
|
+
+.MuiDialog-root .MuiDialog-scrollBody > .MuiDialog-paper
|
|
1061
|
+
-.MuiDialog-root .MuiDialog-paperScrollPaper
|
|
1062
|
+
+.MuiDialog-root .MuiDialog-scrollPaper > .MuiDialog-paper
|
|
1063
|
+
```
|
|
1064
|
+
|
|
1065
|
+
```bash
|
|
1066
|
+
npx @mui/codemod@latest deprecations/dialog-classes <path>
|
|
1067
|
+
```
|
|
1068
|
+
|
|
1035
1069
|
#### `drawer-classes`
|
|
1036
1070
|
|
|
1037
1071
|
JS transforms:
|
|
@@ -2595,8 +2629,6 @@ Renames `Autocomplete`'s `closeIcon` prop to `clearIcon`.
|
|
|
2595
2629
|
+<Autocomplete clearIcon={defaultClearIcon} />
|
|
2596
2630
|
```
|
|
2597
2631
|
|
|
2598
|
-
<!-- #default-branch-switch -->
|
|
2599
|
-
|
|
2600
2632
|
```bash
|
|
2601
2633
|
npx @mui/codemod@latest v5.0.0/autocomplete-rename-closeicon <path>
|
|
2602
2634
|
```
|
|
@@ -2614,8 +2646,6 @@ Renames `Autocomplete`'s `getOptionSelected` to `isOptionEqualToValue`.
|
|
|
2614
2646
|
/>
|
|
2615
2647
|
```
|
|
2616
2648
|
|
|
2617
|
-
<!-- #default-branch-switch -->
|
|
2618
|
-
|
|
2619
2649
|
```bash
|
|
2620
2650
|
npx @mui/codemod@latest v5.0.0/autocomplete-rename-option <path>
|
|
2621
2651
|
```
|
|
@@ -2633,8 +2663,6 @@ Updates the `Avatar`'s `variant` value and `classes` key from 'circle' to 'circu
|
|
|
2633
2663
|
+<Avatar classes={{ circular: 'className' }} />
|
|
2634
2664
|
```
|
|
2635
2665
|
|
|
2636
|
-
<!-- #default-branch-switch -->
|
|
2637
|
-
|
|
2638
2666
|
```bash
|
|
2639
2667
|
npx @mui/codemod@latest v5.0.0/avatar-circle-circular <path>
|
|
2640
2668
|
```
|
|
@@ -2668,8 +2696,6 @@ Renames the badge's props.
|
|
|
2668
2696
|
}}>
|
|
2669
2697
|
```
|
|
2670
2698
|
|
|
2671
|
-
<!-- #default-branch-switch -->
|
|
2672
|
-
|
|
2673
2699
|
```bash
|
|
2674
2700
|
npx @mui/codemod@latest v5.0.0/badge-overlap-value <path>
|
|
2675
2701
|
```
|
|
@@ -2692,8 +2718,6 @@ This change only affects Base UI components.
|
|
|
2692
2718
|
/>;
|
|
2693
2719
|
```
|
|
2694
2720
|
|
|
2695
|
-
<!-- #default-branch-switch -->
|
|
2696
|
-
|
|
2697
2721
|
```bash
|
|
2698
2722
|
npx @mui/codemod@latest v5.0.0/base-rename-components-to-slots <path>
|
|
2699
2723
|
```
|
|
@@ -2711,8 +2735,6 @@ Updates the Box API from separate system props to `sx`.
|
|
|
2711
2735
|
+<Box borderRadius="16px">
|
|
2712
2736
|
```
|
|
2713
2737
|
|
|
2714
|
-
<!-- #default-branch-switch -->
|
|
2715
|
-
|
|
2716
2738
|
```bash
|
|
2717
2739
|
npx @mui/codemod@latest v5.0.0/box-borderradius-values <path>
|
|
2718
2740
|
```
|
|
@@ -2747,8 +2769,6 @@ Renames the Box `grid*Gap` props.
|
|
|
2747
2769
|
+<Box rowGap={4}>Item 5</Box>
|
|
2748
2770
|
```
|
|
2749
2771
|
|
|
2750
|
-
<!-- #default-branch-switch -->
|
|
2751
|
-
|
|
2752
2772
|
```bash
|
|
2753
2773
|
npx @mui/codemod@latest v5.0.0/box-rename-gap <path>
|
|
2754
2774
|
```
|
|
@@ -2764,8 +2784,6 @@ Removes the outdated `color` prop values.
|
|
|
2764
2784
|
+<Button>
|
|
2765
2785
|
```
|
|
2766
2786
|
|
|
2767
|
-
<!-- #default-branch-switch -->
|
|
2768
|
-
|
|
2769
2787
|
```bash
|
|
2770
2788
|
npx @mui/codemod@latest v5.0.0/button-color-prop <path>
|
|
2771
2789
|
```
|
|
@@ -2781,8 +2799,6 @@ Removes the Chip `variant` prop if the value is `"default"`.
|
|
|
2781
2799
|
+<Chip>
|
|
2782
2800
|
```
|
|
2783
2801
|
|
|
2784
|
-
<!-- #default-branch-switch -->
|
|
2785
|
-
|
|
2786
2802
|
```bash
|
|
2787
2803
|
npx @mui/codemod@latest v5.0.0/chip-variant-prop <path>
|
|
2788
2804
|
```
|
|
@@ -2798,8 +2814,6 @@ Renames the CircularProgress `static` variant to `determinate`.
|
|
|
2798
2814
|
+<CircularProgress variant="determinate" classes={{ determinate: 'className' }} />
|
|
2799
2815
|
```
|
|
2800
2816
|
|
|
2801
|
-
<!-- #default-branch-switch -->
|
|
2802
|
-
|
|
2803
2817
|
```bash
|
|
2804
2818
|
npx @mui/codemod@latest v5.0.0/circularprogress-variant <path>
|
|
2805
2819
|
```
|
|
@@ -2817,8 +2831,6 @@ Renames `Collapse`'s `collapsedHeight` prop to `collapsedSize`.
|
|
|
2817
2831
|
+<Collapse classes={{ root: 'collapse' }} />
|
|
2818
2832
|
```
|
|
2819
2833
|
|
|
2820
|
-
<!-- #default-branch-switch -->
|
|
2821
|
-
|
|
2822
2834
|
```bash
|
|
2823
2835
|
npx @mui/codemod@latest v5.0.0/collapse-rename-collapsedheight <path>
|
|
2824
2836
|
```
|
|
@@ -2836,8 +2848,6 @@ A generic codemod to rename any component prop.
|
|
|
2836
2848
|
+<Component newProp />
|
|
2837
2849
|
```
|
|
2838
2850
|
|
|
2839
|
-
<!-- #default-branch-switch -->
|
|
2840
|
-
|
|
2841
2851
|
```bash
|
|
2842
2852
|
npx @mui/codemod@latest v5.0.0/component-rename-prop <path> -- --component=Grid --from=prop --to=newProp
|
|
2843
2853
|
```
|
|
@@ -2948,8 +2958,6 @@ Renames the `fade` style utility import and calls to `alpha()`.
|
|
|
2948
2958
|
+const foo = alpha('#aaa');
|
|
2949
2959
|
```
|
|
2950
2960
|
|
|
2951
|
-
<!-- #default-branch-switch -->
|
|
2952
|
-
|
|
2953
2961
|
```bash
|
|
2954
2962
|
npx @mui/codemod@latest v5.0.0/fade-rename-alpha <path>
|
|
2955
2963
|
```
|
|
@@ -2965,8 +2973,6 @@ Renames `Grid`'s `justify` prop to `justifyContent`.
|
|
|
2965
2973
|
+<Grid item justifyContent="left">Item</Grid>
|
|
2966
2974
|
```
|
|
2967
2975
|
|
|
2968
|
-
<!-- #default-branch-switch -->
|
|
2969
|
-
|
|
2970
2976
|
```bash
|
|
2971
2977
|
npx @mui/codemod@latest v5.0.0/grid-justify-justifycontent <path>
|
|
2972
2978
|
```
|
|
@@ -3249,8 +3255,6 @@ or
|
|
|
3249
3255
|
+import { SpeedDial } from '@material-ui/core';
|
|
3250
3256
|
```
|
|
3251
3257
|
|
|
3252
|
-
<!-- #default-branch-switch -->
|
|
3253
|
-
|
|
3254
3258
|
```bash
|
|
3255
3259
|
npx @mui/codemod@latest v5.0.0/moved-lab-modules <path>
|
|
3256
3260
|
```
|
|
@@ -3293,8 +3297,6 @@ Fix private import paths.
|
|
|
3293
3297
|
+import { createTheme } from '@material-ui/core/styles';
|
|
3294
3298
|
```
|
|
3295
3299
|
|
|
3296
|
-
<!-- #default-branch-switch -->
|
|
3297
|
-
|
|
3298
3300
|
```bash
|
|
3299
3301
|
npx @mui/codemod@latest v5.0.0/optimal-imports <path>
|
|
3300
3302
|
```
|
|
@@ -3422,8 +3424,6 @@ Updates breakpoint values to match new logic. ⚠️ This mod is not idempotent,
|
|
|
3422
3424
|
+theme.breakpoints.between('sm', 'lg')
|
|
3423
3425
|
```
|
|
3424
3426
|
|
|
3425
|
-
<!-- #default-branch-switch -->
|
|
3426
|
-
|
|
3427
3427
|
```bash
|
|
3428
3428
|
npx @mui/codemod@latest v5.0.0/theme-breakpoints <path>
|
|
3429
3429
|
```
|
|
@@ -3496,8 +3496,6 @@ Removes the 'px' suffix from some template strings.
|
|
|
3496
3496
|
+`${theme.spacing(2)} ${theme.spacing(4)}`
|
|
3497
3497
|
```
|
|
3498
3498
|
|
|
3499
|
-
<!-- #default-branch-switch -->
|
|
3500
|
-
|
|
3501
3499
|
```bash
|
|
3502
3500
|
npx @mui/codemod@latest v5.0.0/theme-spacing <path>
|
|
3503
3501
|
```
|
|
@@ -3529,8 +3527,6 @@ Converts all `@mui/material` submodule imports to the root module:
|
|
|
3529
3527
|
+import { List, Grid } from '@mui/material';
|
|
3530
3528
|
```
|
|
3531
3529
|
|
|
3532
|
-
<!-- #default-branch-switch -->
|
|
3533
|
-
|
|
3534
3530
|
```bash
|
|
3535
3531
|
npx @mui/codemod@latest v5.0.0/top-level-imports <path>
|
|
3536
3532
|
```
|
|
@@ -3581,8 +3577,6 @@ Updates Dialog, Menu, Popover, and Snackbar to use the `TransitionProps` prop to
|
|
|
3581
3577
|
/>
|
|
3582
3578
|
```
|
|
3583
3579
|
|
|
3584
|
-
<!-- #default-branch-switch -->
|
|
3585
|
-
|
|
3586
3580
|
```bash
|
|
3587
3581
|
npx @mui/codemod@latest v5.0.0/use-transitionprops <path>
|
|
3588
3582
|
```
|
|
@@ -3611,8 +3605,6 @@ The diff should look like this:
|
|
|
3611
3605
|
+<FormControl value="Standard" variant="standard" />
|
|
3612
3606
|
```
|
|
3613
3607
|
|
|
3614
|
-
<!-- #default-branch-switch -->
|
|
3615
|
-
|
|
3616
3608
|
```bash
|
|
3617
3609
|
npx @mui/codemod@latest v5.0.0/variant-prop <path>
|
|
3618
3610
|
```
|
|
@@ -3722,8 +3714,6 @@ The diff should look like this:
|
|
|
3722
3714
|
+const spacing = theme.spacing(1);
|
|
3723
3715
|
```
|
|
3724
3716
|
|
|
3725
|
-
<!-- #default-branch-switch -->
|
|
3726
|
-
|
|
3727
3717
|
```bash
|
|
3728
3718
|
npx @mui/codemod@latest v4.0.0/theme-spacing-api <path>
|
|
3729
3719
|
```
|
|
@@ -3749,8 +3739,6 @@ Converts all `@material-ui/core` imports more than 1 level deep to the optimal f
|
|
|
3749
3739
|
+import { withStyles, createTheme } from '@material-ui/core/styles';
|
|
3750
3740
|
```
|
|
3751
3741
|
|
|
3752
|
-
<!-- #default-branch-switch -->
|
|
3753
|
-
|
|
3754
3742
|
```bash
|
|
3755
3743
|
npx @mui/codemod@latest v4.0.0/optimal-imports <path>
|
|
3756
3744
|
```
|
|
@@ -3767,8 +3755,6 @@ Converts all `@material-ui/core` submodule imports to the root module:
|
|
|
3767
3755
|
+import { List, withStyles } from '@material-ui/core';
|
|
3768
3756
|
```
|
|
3769
3757
|
|
|
3770
|
-
<!-- #default-branch-switch -->
|
|
3771
|
-
|
|
3772
3758
|
```bash
|
|
3773
3759
|
npx @mui/codemod@latest v4.0.0/top-level-imports <path>
|
|
3774
3760
|
```
|
|
@@ -3788,8 +3774,6 @@ The diff should look like this:
|
|
|
3788
3774
|
+import MenuItem from '@material-ui/core/MenuItem';
|
|
3789
3775
|
```
|
|
3790
3776
|
|
|
3791
|
-
<!-- #default-branch-switch -->
|
|
3792
|
-
|
|
3793
3777
|
```bash
|
|
3794
3778
|
npx @mui/codemod@latest v1.0.0/import-path <path>
|
|
3795
3779
|
```
|
|
@@ -3815,16 +3799,12 @@ The diff should look like this:
|
|
|
3815
3799
|
+const teal500 = teal['500'];
|
|
3816
3800
|
```
|
|
3817
3801
|
|
|
3818
|
-
<!-- #default-branch-switch -->
|
|
3819
|
-
|
|
3820
3802
|
```bash
|
|
3821
3803
|
npx @mui/codemod@latest v1.0.0/color-imports <path>
|
|
3822
3804
|
```
|
|
3823
3805
|
|
|
3824
3806
|
**additional options**
|
|
3825
3807
|
|
|
3826
|
-
<!-- #default-branch-switch -->
|
|
3827
|
-
|
|
3828
3808
|
```bash
|
|
3829
3809
|
npx @mui/codemod@latest v1.0.0/color-imports <path> -- --importPath='mui/styles/colors' --targetPath='mui/colors'
|
|
3830
3810
|
```
|
|
@@ -3841,8 +3821,6 @@ The diff should look like this:
|
|
|
3841
3821
|
+import ThreeDRotation from '@material-ui/icons/ThreeDRotation';
|
|
3842
3822
|
```
|
|
3843
3823
|
|
|
3844
|
-
<!-- #default-branch-switch -->
|
|
3845
|
-
|
|
3846
3824
|
```bash
|
|
3847
3825
|
npx @mui/codemod@latest v1.0.0/svg-icon-imports <path>
|
|
3848
3826
|
```
|
|
@@ -3859,8 +3837,6 @@ The diff should look like this:
|
|
|
3859
3837
|
+<MenuItem>{"Profile" + "!"}</MenuItem>
|
|
3860
3838
|
```
|
|
3861
3839
|
|
|
3862
|
-
<!-- #default-branch-switch -->
|
|
3863
|
-
|
|
3864
3840
|
```bash
|
|
3865
3841
|
npx @mui/codemod@latest v1.0.0/menu-item-primary-text <path>
|
|
3866
3842
|
```
|
|
@@ -3883,8 +3859,6 @@ The diff should look like this:
|
|
|
3883
3859
|
+import RaisedButton from 'material-ui/RaisedButton';
|
|
3884
3860
|
```
|
|
3885
3861
|
|
|
3886
|
-
<!-- #default-branch-switch -->
|
|
3887
|
-
|
|
3888
3862
|
```bash
|
|
3889
3863
|
npx @mui/codemod@latest v0.15.0/import-path <path>
|
|
3890
3864
|
```
|
|
@@ -8,6 +8,7 @@ exports.default = deprecationsAll;
|
|
|
8
8
|
var _accordionSummaryClasses = _interopRequireDefault(require("../accordion-summary-classes"));
|
|
9
9
|
var _accordionProps = _interopRequireDefault(require("../accordion-props"));
|
|
10
10
|
var _alertClasses = _interopRequireDefault(require("../alert-classes"));
|
|
11
|
+
var _alertProps = _interopRequireDefault(require("../alert-props"));
|
|
11
12
|
var _avatarGroupProps = _interopRequireDefault(require("../avatar-group-props"));
|
|
12
13
|
var _autocompleteProps = _interopRequireDefault(require("../autocomplete-props"));
|
|
13
14
|
var _avatarProps = _interopRequireDefault(require("../avatar-props"));
|
|
@@ -18,6 +19,7 @@ var _chipClasses = _interopRequireDefault(require("../chip-classes"));
|
|
|
18
19
|
var _circularProgressClasses = _interopRequireDefault(require("../circular-progress-classes"));
|
|
19
20
|
var _dividerProps = _interopRequireDefault(require("../divider-props"));
|
|
20
21
|
var _drawerClasses = _interopRequireDefault(require("../drawer-classes"));
|
|
22
|
+
var _dialogClasses = _interopRequireDefault(require("../dialog-classes"));
|
|
21
23
|
var _filledInputProps = _interopRequireDefault(require("../filled-input-props"));
|
|
22
24
|
var _formControlLabelProps = _interopRequireDefault(require("../form-control-label-props"));
|
|
23
25
|
var _imageListItemBarClasses = _interopRequireDefault(require("../image-list-item-bar-classes"));
|
|
@@ -28,7 +30,9 @@ var _listItemTextProps = _interopRequireDefault(require("../list-item-text-props
|
|
|
28
30
|
var _linearProgressClasses = _interopRequireDefault(require("../linear-progress-classes"));
|
|
29
31
|
var _modalProps = _interopRequireDefault(require("../modal-props"));
|
|
30
32
|
var _outlinedInputProps = _interopRequireDefault(require("../outlined-input-props"));
|
|
33
|
+
var _paginationItemProps = _interopRequireDefault(require("../pagination-item-props"));
|
|
31
34
|
var _paginationItemClasses = _interopRequireDefault(require("../pagination-item-classes"));
|
|
35
|
+
var _popperProps = _interopRequireDefault(require("../popper-props"));
|
|
32
36
|
var _speedDialProps = _interopRequireDefault(require("../speed-dial-props"));
|
|
33
37
|
var _tableSortLabelClasses = _interopRequireDefault(require("../table-sort-label-classes"));
|
|
34
38
|
var _selectClasses = _interopRequireDefault(require("../select-classes"));
|
|
@@ -42,14 +46,16 @@ var _tooltipProps = _interopRequireDefault(require("../tooltip-props"));
|
|
|
42
46
|
var _tablePaginationProps = _interopRequireDefault(require("../table-pagination-props"));
|
|
43
47
|
var _cardHeaderProps = _interopRequireDefault(require("../card-header-props"));
|
|
44
48
|
var _popoverProps = _interopRequireDefault(require("../popover-props"));
|
|
49
|
+
var _snackbarProps = _interopRequireDefault(require("../snackbar-props"));
|
|
50
|
+
var _sliderProps = _interopRequireDefault(require("../slider-props"));
|
|
45
51
|
var _sliderClasses = _interopRequireDefault(require("../slider-classes"));
|
|
46
52
|
var _mobileStepperProps = _interopRequireDefault(require("../mobile-stepper-props"));
|
|
47
|
-
var _snackbarProps = _interopRequireDefault(require("../snackbar-props"));
|
|
48
53
|
var _tabsProps = _interopRequireDefault(require("../tabs-props"));
|
|
49
54
|
var _tabsClasses = _interopRequireDefault(require("../tabs-classes"));
|
|
50
55
|
var _drawerProps = _interopRequireDefault(require("../drawer-props"));
|
|
51
56
|
var _menuProps = _interopRequireDefault(require("../menu-props"));
|
|
52
57
|
var _ratingProps = _interopRequireDefault(require("../rating-props"));
|
|
58
|
+
var _typographyProps = _interopRequireDefault(require("../typography-props"));
|
|
53
59
|
/**
|
|
54
60
|
* @param {import('jscodeshift').FileInfo} file
|
|
55
61
|
* @param {import('jscodeshift').API} api
|
|
@@ -58,6 +64,7 @@ function deprecationsAll(file, api, options) {
|
|
|
58
64
|
file.source = (0, _accordionSummaryClasses.default)(file, api, options);
|
|
59
65
|
file.source = (0, _accordionProps.default)(file, api, options);
|
|
60
66
|
file.source = (0, _alertClasses.default)(file, api, options);
|
|
67
|
+
file.source = (0, _alertProps.default)(file, api, options);
|
|
61
68
|
file.source = (0, _avatarGroupProps.default)(file, api, options);
|
|
62
69
|
file.source = (0, _autocompleteProps.default)(file, api, options);
|
|
63
70
|
file.source = (0, _avatarProps.default)(file, api, options);
|
|
@@ -68,6 +75,7 @@ function deprecationsAll(file, api, options) {
|
|
|
68
75
|
file.source = (0, _circularProgressClasses.default)(file, api, options);
|
|
69
76
|
file.source = (0, _dividerProps.default)(file, api, options);
|
|
70
77
|
file.source = (0, _drawerClasses.default)(file, api, options);
|
|
78
|
+
file.source = (0, _dialogClasses.default)(file, api, options);
|
|
71
79
|
file.source = (0, _filledInputProps.default)(file, api, options);
|
|
72
80
|
file.source = (0, _formControlLabelProps.default)(file, api, options);
|
|
73
81
|
file.source = (0, _imageListItemBarClasses.default)(file, api, options);
|
|
@@ -79,6 +87,8 @@ function deprecationsAll(file, api, options) {
|
|
|
79
87
|
file.source = (0, _modalProps.default)(file, api, options);
|
|
80
88
|
file.source = (0, _outlinedInputProps.default)(file, api, options);
|
|
81
89
|
file.source = (0, _paginationItemClasses.default)(file, api, options);
|
|
90
|
+
file.source = (0, _paginationItemProps.default)(file, api, options);
|
|
91
|
+
file.source = (0, _popperProps.default)(file, api, options);
|
|
82
92
|
file.source = (0, _speedDialProps.default)(file, api, options);
|
|
83
93
|
file.source = (0, _stepConnectorClasses.default)(file, api, options);
|
|
84
94
|
file.source = (0, _stepContentProps.default)(file, api, options);
|
|
@@ -92,6 +102,8 @@ function deprecationsAll(file, api, options) {
|
|
|
92
102
|
file.source = (0, _tablePaginationProps.default)(file, api, options);
|
|
93
103
|
file.source = (0, _cardHeaderProps.default)(file, api, options);
|
|
94
104
|
file.source = (0, _popoverProps.default)(file, api, options);
|
|
105
|
+
file.source = (0, _snackbarProps.default)(file, api, options);
|
|
106
|
+
file.source = (0, _sliderProps.default)(file, api, options);
|
|
95
107
|
file.source = (0, _sliderClasses.default)(file, api, options);
|
|
96
108
|
file.source = (0, _mobileStepperProps.default)(file, api, options);
|
|
97
109
|
file.source = (0, _snackbarProps.default)(file, api, options);
|
|
@@ -100,5 +112,6 @@ function deprecationsAll(file, api, options) {
|
|
|
100
112
|
file.source = (0, _drawerProps.default)(file, api, options);
|
|
101
113
|
file.source = (0, _menuProps.default)(file, api, options);
|
|
102
114
|
file.source = (0, _ratingProps.default)(file, api, options);
|
|
115
|
+
file.source = (0, _typographyProps.default)(file, api, options);
|
|
103
116
|
return file.source;
|
|
104
117
|
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = transformer;
|
|
7
|
+
var _postcssPlugin = require("./postcss-plugin");
|
|
8
|
+
/**
|
|
9
|
+
* @param {import('jscodeshift').FileInfo} file
|
|
10
|
+
* @param {import('jscodeshift').API} api
|
|
11
|
+
*/
|
|
12
|
+
function transformer(file, api, options) {
|
|
13
|
+
const j = api.jscodeshift;
|
|
14
|
+
const root = j(file.source);
|
|
15
|
+
const printOptions = options.printOptions;
|
|
16
|
+
_postcssPlugin.classes.forEach(({
|
|
17
|
+
deprecatedClass,
|
|
18
|
+
replacementSelector
|
|
19
|
+
}) => {
|
|
20
|
+
const replacementSelectorPrefix = '&';
|
|
21
|
+
root.find(j.ImportDeclaration).filter(path => path.node.source.value.match(/^@mui\/material\/Dialog$/)).forEach(path => {
|
|
22
|
+
path.node.specifiers.forEach(specifier => {
|
|
23
|
+
if (specifier.type === 'ImportSpecifier' && specifier.imported.name === 'dialogClasses') {
|
|
24
|
+
const deprecatedAtomicClass = deprecatedClass.replace(`${deprecatedClass.split('-')[0]}-`, '');
|
|
25
|
+
root.find(j.MemberExpression, {
|
|
26
|
+
object: {
|
|
27
|
+
name: specifier.local.name
|
|
28
|
+
},
|
|
29
|
+
property: {
|
|
30
|
+
name: deprecatedAtomicClass
|
|
31
|
+
}
|
|
32
|
+
}).forEach(memberExpression => {
|
|
33
|
+
const parent = memberExpression.parentPath.parentPath.value;
|
|
34
|
+
if (parent.type === j.TemplateLiteral.name) {
|
|
35
|
+
const memberExpressionIndex = parent.expressions.findIndex(expression => expression === memberExpression.value);
|
|
36
|
+
const precedingTemplateElement = parent.quasis[memberExpressionIndex];
|
|
37
|
+
const atomicClasses = replacementSelector.replaceAll('MuiDialog-', '').replaceAll(replacementSelectorPrefix, '').replaceAll(' > ', '').replaceAll(' ', '').split('.').filter(Boolean);
|
|
38
|
+
if (precedingTemplateElement.value.raw.endsWith(deprecatedClass.startsWith(' ') ? `${replacementSelectorPrefix} .` : `${replacementSelectorPrefix}.`)) {
|
|
39
|
+
parent.expressions.splice(memberExpressionIndex, 1, j.memberExpression(memberExpression.value.object, j.identifier(atomicClasses[0])), j.memberExpression(memberExpression.value.object, j.identifier(atomicClasses[1])));
|
|
40
|
+
if (replacementSelector.includes(' > ')) {
|
|
41
|
+
parent.quasis.splice(memberExpressionIndex, 1, j.templateElement({
|
|
42
|
+
raw: precedingTemplateElement.value.raw,
|
|
43
|
+
cooked: precedingTemplateElement.value.cooked
|
|
44
|
+
}, false), j.templateElement({
|
|
45
|
+
raw: ' > .',
|
|
46
|
+
cooked: ' > .'
|
|
47
|
+
}, false));
|
|
48
|
+
} else {
|
|
49
|
+
parent.quasis.splice(memberExpressionIndex, 1, j.templateElement({
|
|
50
|
+
raw: precedingTemplateElement.value.raw,
|
|
51
|
+
cooked: precedingTemplateElement.value.cooked
|
|
52
|
+
}, false), j.templateElement({
|
|
53
|
+
raw: '.',
|
|
54
|
+
cooked: '.'
|
|
55
|
+
}, false));
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
});
|
|
63
|
+
const selectorRegex = new RegExp(`^${replacementSelectorPrefix}${deprecatedClass}`);
|
|
64
|
+
root.find(j.Literal, literal => typeof literal.value === 'string' && literal.value.match(selectorRegex)).forEach(path => {
|
|
65
|
+
path.replace(j.literal(path.value.value.replace(selectorRegex, `${replacementSelectorPrefix}${deprecatedClass.startsWith(' ') ? ' ' : ''}${replacementSelector.trim()}`)));
|
|
66
|
+
});
|
|
67
|
+
});
|
|
68
|
+
return root.toSource(printOptions);
|
|
69
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
Object.defineProperty(exports, "default", {
|
|
8
|
+
enumerable: true,
|
|
9
|
+
get: function () {
|
|
10
|
+
return _dialogClasses.default;
|
|
11
|
+
}
|
|
12
|
+
});
|
|
13
|
+
var _dialogClasses = _interopRequireDefault(require("./dialog-classes"));
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
const classes = [{
|
|
4
|
+
deprecatedClass: ' .MuiDialog-paperScrollBody',
|
|
5
|
+
replacementSelector: ' .MuiDialog-scrollBody > .MuiDialog-paper'
|
|
6
|
+
}, {
|
|
7
|
+
deprecatedClass: ' .MuiDialog-paperScrollPaper',
|
|
8
|
+
replacementSelector: ' .MuiDialog-scrollPaper > .MuiDialog-paper'
|
|
9
|
+
}];
|
|
10
|
+
const plugin = () => {
|
|
11
|
+
return {
|
|
12
|
+
postcssPlugin: `Replace deprecated Dialog classes with new classes`,
|
|
13
|
+
Rule(rule) {
|
|
14
|
+
const {
|
|
15
|
+
selector
|
|
16
|
+
} = rule;
|
|
17
|
+
classes.forEach(({
|
|
18
|
+
deprecatedClass,
|
|
19
|
+
replacementSelector
|
|
20
|
+
}) => {
|
|
21
|
+
const selectorRegex = new RegExp(`${deprecatedClass}`);
|
|
22
|
+
if (selector.match(selectorRegex)) {
|
|
23
|
+
rule.selector = selector.replace(selectorRegex, replacementSelector);
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
plugin.postcss = true;
|
|
30
|
+
module.exports = {
|
|
31
|
+
plugin,
|
|
32
|
+
classes
|
|
33
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _Dialog = require("@mui/material/Dialog");
|
|
4
|
+
"& .MuiDialog-scrollBody > .MuiDialog-paper";
|
|
5
|
+
"& .MuiDialog-scrollPaper > .MuiDialog-paper";
|
|
6
|
+
`& .${_Dialog.dialogClasses.scrollBody} > .${_Dialog.dialogClasses.paper}`;
|
|
7
|
+
`& .${_Dialog.dialogClasses.scrollPaper} > .${_Dialog.dialogClasses.paper}`;
|