Skip to content

Commit f9ab364

Browse files
committed
nit: reorganize applyAnimatedValues in react-spring/web
1 parent d6b61ef commit f9ab364

File tree

1 file changed

+54
-54
lines changed

1 file changed

+54
-54
lines changed

targets/web/src/applyAnimatedValues.ts

Lines changed: 54 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -1,59 +1,5 @@
11
import { Globals as G } from 'shared'
22

3-
let isUnitlessNumber: { [key: string]: true } = {
4-
animationIterationCount: true,
5-
borderImageOutset: true,
6-
borderImageSlice: true,
7-
borderImageWidth: true,
8-
boxFlex: true,
9-
boxFlexGroup: true,
10-
boxOrdinalGroup: true,
11-
columnCount: true,
12-
columns: true,
13-
flex: true,
14-
flexGrow: true,
15-
flexPositive: true,
16-
flexShrink: true,
17-
flexNegative: true,
18-
flexOrder: true,
19-
gridRow: true,
20-
gridRowEnd: true,
21-
gridRowSpan: true,
22-
gridRowStart: true,
23-
gridColumn: true,
24-
gridColumnEnd: true,
25-
gridColumnSpan: true,
26-
gridColumnStart: true,
27-
fontWeight: true,
28-
lineClamp: true,
29-
lineHeight: true,
30-
opacity: true,
31-
order: true,
32-
orphans: true,
33-
tabSize: true,
34-
widows: true,
35-
zIndex: true,
36-
zoom: true,
37-
// SVG-related properties
38-
fillOpacity: true,
39-
floodOpacity: true,
40-
stopOpacity: true,
41-
strokeDasharray: true,
42-
strokeDashoffset: true,
43-
strokeMiterlimit: true,
44-
strokeOpacity: true,
45-
strokeWidth: true,
46-
}
47-
48-
const prefixKey = (prefix: string, key: string) =>
49-
prefix + key.charAt(0).toUpperCase() + key.substring(1)
50-
const prefixes = ['Webkit', 'Ms', 'Moz', 'O']
51-
52-
isUnitlessNumber = Object.keys(isUnitlessNumber).reduce((acc, prop) => {
53-
prefixes.forEach(prefix => (acc[prefixKey(prefix, prop)] = acc[prop]))
54-
return acc
55-
}, isUnitlessNumber)
56-
573
const isCustomPropRE = /^--/
584

595
type Value = string | number | boolean | null
@@ -132,3 +78,57 @@ export function applyAnimatedValues(
13278
}
13379
})
13480
}
81+
82+
let isUnitlessNumber: { [key: string]: true } = {
83+
animationIterationCount: true,
84+
borderImageOutset: true,
85+
borderImageSlice: true,
86+
borderImageWidth: true,
87+
boxFlex: true,
88+
boxFlexGroup: true,
89+
boxOrdinalGroup: true,
90+
columnCount: true,
91+
columns: true,
92+
flex: true,
93+
flexGrow: true,
94+
flexPositive: true,
95+
flexShrink: true,
96+
flexNegative: true,
97+
flexOrder: true,
98+
gridRow: true,
99+
gridRowEnd: true,
100+
gridRowSpan: true,
101+
gridRowStart: true,
102+
gridColumn: true,
103+
gridColumnEnd: true,
104+
gridColumnSpan: true,
105+
gridColumnStart: true,
106+
fontWeight: true,
107+
lineClamp: true,
108+
lineHeight: true,
109+
opacity: true,
110+
order: true,
111+
orphans: true,
112+
tabSize: true,
113+
widows: true,
114+
zIndex: true,
115+
zoom: true,
116+
// SVG-related properties
117+
fillOpacity: true,
118+
floodOpacity: true,
119+
stopOpacity: true,
120+
strokeDasharray: true,
121+
strokeDashoffset: true,
122+
strokeMiterlimit: true,
123+
strokeOpacity: true,
124+
strokeWidth: true,
125+
}
126+
127+
const prefixKey = (prefix: string, key: string) =>
128+
prefix + key.charAt(0).toUpperCase() + key.substring(1)
129+
const prefixes = ['Webkit', 'Ms', 'Moz', 'O']
130+
131+
isUnitlessNumber = Object.keys(isUnitlessNumber).reduce((acc, prop) => {
132+
prefixes.forEach(prefix => (acc[prefixKey(prefix, prop)] = acc[prop]))
133+
return acc
134+
}, isUnitlessNumber)

0 commit comments

Comments
 (0)