Skip to content

Commit 645198d

Browse files
committed
Drop IE support
1 parent 8d3453f commit 645198d

13 files changed

+36
-236
lines changed

Diff for: THEMING.md

-13
Original file line numberDiff line numberDiff line change
@@ -77,16 +77,3 @@ Here is a sample theme to change the UI from light to dark. We attach all of our
7777
You can inspect the editor and see a full listing of all variables that you can override:
7878

7979
![see-css-variables-inspector](https://user-images.githubusercontent.com/11803153/34531018-7e24bbba-f076-11e7-90cd-a35fe5eae84d.png)
80-
81-
## Caveats
82-
83-
CSS custom properties are not supported in IE11. However, you can use a [PostCSS](https://github.com/postcss/postcss) plugin to convert the css properties to their true value when they are used. We are using [PostCSS Custom Properties](https://github.com/postcss/postcss-custom-properties).
84-
85-
The PostCSS plugin we are using only applies to variables that are in the `:root{}` scope. If you'd like to both theme and use your styles to support IE11, you would need to import the unminified IE styles we ship with the editor:
86-
`import react-chart-editor/lib/react-chart-editor.ie.css` (this stylesheet has the variables attached to the `:root{}` scope).
87-
88-
Then, rather than applying your custom properties to `.theme--dark .plotly-editor--theme-provider`, you would apply your overrides to `:root{}`.
89-
90-
Finally, you would pipe in the PostCSS plugin(s) to your project and produce a css file with the properties applied as their true value. It's recommended to use the [PostCSS Remove Root](https://github.com/cbracco/postcss-remove-root) plugin after you have converted all of the properties.
91-
92-
You can see our PostCSS scripts [here](https://github.com/plotly/react-chart-editor/tree/master/scripts/postcss.js).

Diff for: package.json

+2-4
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"lint": "prettier --write \"src/**/*.js\"",
1111
"make:arrows": "node scripts/makeArrows.js",
1212
"make:combined-translation-keys": "npm run make:translation-keys && node scripts/combineTranslationKeys.js",
13-
"make:lib:css": "mkdirp lib && babel-node scripts/styles.js && SASS_ENV=ie babel-node scripts/styles.js && babel-node scripts/postcss.js && SASS_ENV=ie babel-node scripts/postcss.js",
13+
"make:lib:css": "mkdirp lib && babel-node scripts/styles.js && babel-node scripts/styles.js && babel-node scripts/postcss.js && babel-node scripts/postcss.js",
1414
"make:lib:js": "mkdirp lib && babel src --out-dir lib --ignore=__tests__/* --source-maps",
1515
"make:lib": "rimraf lib && mkdir lib && npm run make:lib:js && npm run make:lib:css && npm run make:combined-translation-keys",
1616
"make:translation-keys": "node scripts/findTranslationKeys.js",
@@ -84,8 +84,6 @@
8484
"node-sass": "4.14.1",
8585
"postcss": "8.2.13",
8686
"postcss-combine-duplicated-selectors": "10.0.2",
87-
"postcss-custom-properties": "8.0.11",
88-
"postcss-remove-root": "0.0.2",
8987
"prettier": "2.2.1",
9088
"react": "16.14.0",
9189
"react-ace": "7.0.5",
@@ -135,6 +133,6 @@
135133
"url": "https://github.com/plotly/react-chart-editor.git"
136134
},
137135
"browserslist": [
138-
"ie 11"
136+
"last 8 years and not dead"
139137
]
140138
}

Diff for: scripts/postcss.js

+21-72
Original file line numberDiff line numberDiff line change
@@ -1,85 +1,34 @@
11
const fs = require('fs');
22
const postcss = require('postcss');
3-
const customProperties = require('postcss-custom-properties');
43
const autoprefixer = require('autoprefixer');
54
const cssnano = require('cssnano');
65
const combineSelectors = require('postcss-combine-duplicated-selectors');
7-
const removeRoot = require('postcss-remove-root');
86

97
/* eslint-disable no-process-env */
10-
const SASS_ENV = process.env.SASS_ENV || 'default';
118
const BUILD_ENV = process.env.BUILD_ENV || 'lib';
129

1310
const fileName = `react-chart-editor`;
14-
const dist = `${BUILD_ENV}/${fileName}.css`;
15-
16-
const internetExplorerPostCSS = () => {
17-
/**
18-
* IE11 specific post-processing
19-
* This will:
20-
* - combine duplicate selectors into one,
21-
* - convert all css variables into their true value
22-
* - remove unneeded `:root{}` after converting vars into their value
23-
* - autoprefix for IE11
24-
* - minify the css with cssnano
25-
*/
26-
const ie11_plugins = [
27-
combineSelectors,
28-
customProperties({preserve: false}),
29-
removeRoot,
30-
autoprefixer({grid: true}),
31-
cssnano,
32-
];
33-
fs.readFile(`${BUILD_ENV}/${fileName}.ie.css`, (err, css) => {
34-
postcss([...ie11_plugins])
35-
.process(css, {
36-
from: dist,
37-
to: `${BUILD_ENV}/${fileName}.ie.min.css`,
38-
})
39-
.then(result => {
40-
fs.writeFile(`${BUILD_ENV}/${fileName}.ie.min.css`, result.css, error => {
41-
if (error) {
42-
/* eslint-disable no-console */
43-
console.log(error);
44-
}
45-
});
46-
});
47-
});
48-
};
49-
50-
const defaultPostCSS = () => {
51-
/**
52-
* Default post-processing
53-
* This will:
54-
* - combine duplicate selectors into one,
55-
* - convert all css variables into their true value
56-
* - remove unneeded `:root{}` after converting vars into their value
57-
* - autoprefix for IE11
58-
* - minify the css with cssnano
59-
*/
60-
const default_plugins = [combineSelectors, autoprefixer, cssnano];
61-
fs.readFile(`${BUILD_ENV}/${fileName}.css`, (err, css) => {
62-
postcss([...default_plugins])
63-
.process(css, {
64-
from: `${BUILD_ENV}/${fileName}.css`,
65-
to: `${BUILD_ENV}/${fileName}.min.css`,
66-
})
67-
.then(result => {
68-
fs.writeFile(`${BUILD_ENV}/${fileName}.min.css`, result.css, error => {
69-
if (error) {
70-
/* eslint-disable no-console */
71-
console.log(error);
72-
}
73-
});
74-
});
75-
});
76-
};
7711

7812
/**
79-
* Run our PostCSS scripts based off of SASS_ENV passed through
13+
* This will:
14+
* - combine duplicate selectors into one,
15+
* - convert all css variables into their true value
16+
* - remove unneeded `:root{}` after converting vars into their value
17+
* - autoprefix for IE11
18+
* - minify the css with cssnano
8019
*/
81-
if (SASS_ENV === 'ie') {
82-
internetExplorerPostCSS();
83-
} else {
84-
defaultPostCSS();
85-
}
20+
fs.readFile(`${BUILD_ENV}/${fileName}.css`, (err, css) => {
21+
postcss([combineSelectors, autoprefixer, cssnano])
22+
.process(css, {
23+
from: `${BUILD_ENV}/${fileName}.css`,
24+
to: `${BUILD_ENV}/${fileName}.min.css`,
25+
})
26+
.then((result) => {
27+
fs.writeFile(`${BUILD_ENV}/${fileName}.min.css`, result.css, (error) => {
28+
if (error) {
29+
/* eslint-disable no-console */
30+
console.log(error);
31+
}
32+
});
33+
});
34+
});

Diff for: scripts/styles.js

+4-11
Original file line numberDiff line numberDiff line change
@@ -3,26 +3,19 @@ const path = require('path');
33
const sass = require('node-sass');
44

55
/* eslint-disable no-process-env */
6-
const SASS_ENV = process.env.SASS_ENV || 'default';
76
const BUILD_ENV = process.env.BUILD_ENV || 'lib';
87

98
const src = 'src/styles/main.scss';
109
const fileName = `react-chart-editor`;
11-
const dist =
12-
SASS_ENV === 'ie'
13-
? `${BUILD_ENV}/${fileName}.ie.css`
14-
: `${BUILD_ENV}/${fileName}.css`;
10+
const dist = `${BUILD_ENV}/${fileName}.css`;
1511

1612
/**
1713
* Compile our scss to css!
18-
* --
19-
* the `data:...` line will inject our SASS_ENV value into our scss,
20-
* so we are able to do conditionals in scss for our env (default|ie)
2114
*/
22-
fs.readFile(src, function(err, data) {
15+
fs.readFile(src, function (err, data) {
2316
sass.render(
2417
{
25-
data: '$ENV: "' + SASS_ENV + '";\n' + data,
18+
data,
2619
includePaths: [path.dirname(src)],
2720
outFile: dist,
2821
},
@@ -34,7 +27,7 @@ fs.readFile(src, function(err, data) {
3427
console.log(error.message);
3528
console.log(error.line);
3629
} else {
37-
fs.writeFile(dist, result.css, error => {
30+
fs.writeFile(dist, result.css, (error) => {
3831
if (error) {
3932
/* eslint-disable no-console */
4033
console.log(error);

Diff for: src/styles/_mixins.scss

+6-5
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
@mixin vendor($property, $value) {
22
-webkit-#{$property}: $value;
33
-moz-#{$property}: $value;
4-
-ms-#{$property}: $value;
54
-o-#{$property}: $value;
65
#{$property}: $value;
76
}
@@ -34,7 +33,11 @@
3433
}
3534
}
3635

37-
@mixin scrollbar($width: 5px, $trackbg: var(--scrollbar-track-background), $thumb-color: var(--scrollbar-thumb-color)) {
36+
@mixin scrollbar(
37+
$width: 5px,
38+
$trackbg: var(--scrollbar-track-background),
39+
$thumb-color: var(--scrollbar-thumb-color)
40+
) {
3841
-webkit-overflow-scrolling: touch;
3942
&::-webkit-scrollbar {
4043
background: white;
@@ -163,9 +166,7 @@
163166
@each $var, $val in $sidebar {
164167
#{--sidebar}-#{$var}: $val;
165168
}
166-
--editor-width: calc(
167-
var(--sidebar-width) + var(--panel-width) + 1px
168-
); // +1px for border
169+
--editor-width: calc(var(--sidebar-width) + var(--panel-width) + 1px); // +1px for border
169170
}
170171

171172
@mixin heading($type: 'base') {

Diff for: src/styles/components/fields/_field.scss

-8
Original file line numberDiff line numberDiff line change
@@ -101,14 +101,6 @@
101101
}
102102
}
103103

104-
@media all and (-ms-high-contrast: none), (-ms-high-contrast: active) {
105-
.field {
106-
&__widget {
107-
flex-basis: auto;
108-
}
109-
}
110-
}
111-
112104
.field .field {
113105
border-top: none;
114106
.field__no-title {

Diff for: src/styles/components/sidebar/_main.scss

-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
border-right: var(--border-default);
1313
flex-grow: 1;
1414
@include scrollbar(0px);
15-
-ms-overflow-style: none;
1615

1716
&__group {
1817
background-color: var(--sidebar-group-background-base);

Diff for: src/styles/components/widgets/_colorscalepicker.scss

-5
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,6 @@ $text-padding: 5px;
2929
.colorscalePickerContainer input:focus {
3030
outline: none;
3131
}
32-
@media all and (-ms-high-contrast: none), (-ms-high-contrast: active) {
33-
.colorscalePickerContainer {
34-
display: inline;
35-
}
36-
}
3732
.colorscalePickerContainer::-webkit-scrollbar {
3833
width: 5px;
3934
}

Diff for: src/styles/components/widgets/_numeric-input.scss

-10
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,6 @@
66
/* Firefox 19+ */
77
color: var(--color-text-placeholder);
88
}
9-
:-ms-input-placeholder {
10-
/* IE 10+ */
11-
color: var(--color-text-placeholder);
12-
}
139
:-moz-placeholder {
1410
/* Firefox 18- */
1511
color: var(--color-text-placeholder);
@@ -24,12 +20,6 @@
2420
color: var(--color-text-base);
2521
}
2622

27-
@media all and (-ms-high-contrast: none), (-ms-high-contrast: active) {
28-
.numeric-input__wrapper {
29-
flex-basis: auto;
30-
}
31-
}
32-
3323
.numeric-input__number {
3424
display: inline-block;
3525
border: var(--border-default);

Diff for: src/styles/components/widgets/_rangeslider.scss

+1-3
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,10 @@
66
min-width: 60px;
77
position: relative;
88
background: var(--color-background-light);
9-
-ms-touch-action: none;
109
touch-action: none;
1110
border: 1px solid var(--color-border-default);
1211
flex-grow: 1;
1312

14-
1513
&,
1614
.rangeslider__fill {
1715
display: block;
@@ -74,7 +72,7 @@
7472
.rangeslider__handle {
7573
$size: 20px;
7674
width: $size/3;
77-
height: $size*1.5;
75+
height: $size * 1.5;
7876
border-radius: $size;
7977
top: 50%;
8078
transform: translate3d(-50%, -50%, 0);

Diff for: src/styles/components/widgets/_text-input.scss

-4
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,6 @@
66
/* Firefox 19+ */
77
color: var(--color-text-placeholder);
88
}
9-
:-ms-input-placeholder {
10-
/* IE 10+ */
11-
color: var(--color-text-placeholder);
12-
}
139
:-moz-placeholder {
1410
/* Firefox 18- */
1511
color: var(--color-text-placeholder);

0 commit comments

Comments
 (0)