mirror of
https://github.com/reduxjs/redux-devtools.git
synced 2025-07-26 07:59:48 +03:00
And that
This commit is contained in:
parent
aedde97d24
commit
46e804b5cf
|
@ -1,6 +1,8 @@
|
||||||
// Same as https://github.com/SimenB/react-vendor-prefixes/blob/master/src/index.js,
|
// Same as https://github.com/SimenB/react-vendor-prefixes/blob/master/src/index.js,
|
||||||
// but dumber
|
// but dumber
|
||||||
|
|
||||||
|
import { CSSProperties } from 'react';
|
||||||
|
|
||||||
const vendorSpecificProperties = [
|
const vendorSpecificProperties = [
|
||||||
'animation',
|
'animation',
|
||||||
'animationDelay',
|
'animationDelay',
|
||||||
|
@ -34,8 +36,8 @@ const vendorSpecificProperties = [
|
||||||
|
|
||||||
const prefixes = ['Moz', 'Webkit', 'ms', 'O'];
|
const prefixes = ['Moz', 'Webkit', 'ms', 'O'];
|
||||||
|
|
||||||
function prefixProp(key, value) {
|
function prefixProp<Value>(key: string, value: Value) {
|
||||||
return prefixes.reduce(
|
return prefixes.reduce<{ [key: string]: Value }>(
|
||||||
(obj, pre) => (
|
(obj, pre) => (
|
||||||
(obj[pre + key[0].toUpperCase() + key.substr(1)] = value), obj
|
(obj[pre + key[0].toUpperCase() + key.substr(1)] = value), obj
|
||||||
),
|
),
|
||||||
|
@ -43,13 +45,13 @@ function prefixProp(key, value) {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function autoprefix(style) {
|
export default function autoprefix(style: CSSProperties) {
|
||||||
return Object.keys(style).reduce(
|
return Object.keys(style).reduce(
|
||||||
(obj, key) =>
|
(obj, key) =>
|
||||||
vendorSpecificProperties.indexOf(key) !== -1
|
vendorSpecificProperties.indexOf(key) !== -1
|
||||||
? {
|
? {
|
||||||
...obj,
|
...obj,
|
||||||
...prefixProp(key, style[key]),
|
...prefixProp(key, style[key as keyof CSSProperties]),
|
||||||
}
|
}
|
||||||
: obj,
|
: obj,
|
||||||
style
|
style
|
||||||
|
|
Loading…
Reference in New Issue
Block a user