@stylexjs/shared 0.5.1 → 0.6.1
Sign up to get free protection for your applications and to get access to all the features.
- package/lib/convert-to-className.d.ts +5 -1
- package/lib/convert-to-className.js +33 -1
- package/lib/convert-to-className.js.flow +5 -1
- package/lib/messages.d.ts +1 -0
- package/lib/messages.js +3 -2
- package/lib/messages.js.flow +1 -0
- package/lib/stylex-create-theme.js +30 -40
- package/lib/stylex-define-vars.d.ts +2 -6
- package/lib/stylex-define-vars.js +40 -21
- package/lib/stylex-define-vars.js.flow +1 -4
- package/lib/stylex-first-that-works.d.ts +1 -1
- package/lib/stylex-first-that-works.js.flow +1 -1
- package/lib/stylex-vars-utils.d.ts +27 -0
- package/lib/stylex-vars-utils.js +69 -0
- package/lib/stylex-vars-utils.js.flow +31 -0
- package/lib/types/index.d.ts +127 -92
- package/lib/types/index.js +28 -72
- package/lib/types/index.js.flow +138 -99
- package/lib/utils/normalize-value.js +1 -2
- package/lib/utils/normalizers/zero-dimensions.d.ts +2 -2
- package/lib/utils/normalizers/zero-dimensions.js +6 -0
- package/lib/utils/normalizers/zero-dimensions.js.flow +2 -2
- package/package.json +2 -2
package/lib/types/index.d.ts
CHANGED
@@ -7,9 +7,19 @@
|
|
7
7
|
*
|
8
8
|
*/
|
9
9
|
|
10
|
-
type
|
11
|
-
|
|
12
|
-
|
|
10
|
+
type NestedWithNumbers =
|
11
|
+
| number
|
12
|
+
| string
|
13
|
+
| Readonly<{
|
14
|
+
default: NestedWithNumbers;
|
15
|
+
[$$Key$$: string]: NestedWithNumbers;
|
16
|
+
}>;
|
17
|
+
type ValueWithDefault =
|
18
|
+
| string
|
19
|
+
| Readonly<{
|
20
|
+
default: ValueWithDefault;
|
21
|
+
[$$Key$$: string]: ValueWithDefault;
|
22
|
+
}>;
|
13
23
|
type CSSSyntax =
|
14
24
|
| '*'
|
15
25
|
| '<length>'
|
@@ -26,180 +36,205 @@ type CSSSyntax =
|
|
26
36
|
| '<transform-function>'
|
27
37
|
| '<custom-ident>'
|
28
38
|
| '<transform-list>';
|
29
|
-
type CSSSyntaxType = CSSSyntax
|
30
|
-
|
31
|
-
|
32
|
-
readonly value: ValueWithDefault<T>;
|
39
|
+
type CSSSyntaxType = CSSSyntax;
|
40
|
+
declare class BaseCSSType {
|
41
|
+
readonly value: ValueWithDefault;
|
33
42
|
readonly syntax: CSSSyntaxType;
|
43
|
+
constructor(value: ValueWithDefault);
|
34
44
|
}
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
45
|
+
export interface CSSType<_T extends string | number = string | number> {
|
46
|
+
readonly value: ValueWithDefault;
|
47
|
+
readonly syntax: CSSSyntaxType;
|
48
|
+
}
|
49
|
+
export declare const isCSSType: (
|
50
|
+
value: unknown,
|
51
|
+
) => value is CSSType<string | number>;
|
52
|
+
type AngleValue = string;
|
53
|
+
export declare class Angle<T extends AngleValue>
|
54
|
+
extends BaseCSSType
|
55
|
+
implements CSSType<T>
|
39
56
|
{
|
40
|
-
readonly value: ValueWithDefault
|
57
|
+
readonly value: ValueWithDefault;
|
41
58
|
readonly syntax: CSSSyntaxType;
|
42
59
|
static readonly syntax: CSSSyntaxType;
|
43
|
-
|
44
|
-
|
45
|
-
value: ValueWithDefault<T>,
|
60
|
+
static create<T extends AngleValue = AngleValue>(
|
61
|
+
value: ValueWithDefault,
|
46
62
|
): Angle<T>;
|
47
63
|
}
|
48
|
-
export declare const angle:
|
64
|
+
export declare const angle: <T extends AngleValue = AngleValue>(
|
65
|
+
value: ValueWithDefault,
|
66
|
+
) => Angle<T>;
|
49
67
|
type ColorValue = string;
|
50
68
|
export declare class Color<T extends ColorValue>
|
51
|
-
extends
|
52
|
-
implements
|
69
|
+
extends BaseCSSType
|
70
|
+
implements CSSType<T>
|
53
71
|
{
|
54
|
-
readonly value: ValueWithDefault
|
72
|
+
readonly value: ValueWithDefault;
|
55
73
|
readonly syntax: CSSSyntaxType;
|
56
|
-
constructor(value: ValueWithDefault<T>);
|
57
74
|
static create<T extends ColorValue = ColorValue>(
|
58
|
-
value: ValueWithDefault
|
75
|
+
value: ValueWithDefault,
|
59
76
|
): Color<T>;
|
60
77
|
}
|
61
|
-
export declare const color:
|
78
|
+
export declare const color: <T extends ColorValue = ColorValue>(
|
79
|
+
value: ValueWithDefault,
|
80
|
+
) => Color<T>;
|
62
81
|
type URLValue = string;
|
63
82
|
export declare class Url<T extends URLValue>
|
64
|
-
extends
|
65
|
-
implements
|
83
|
+
extends BaseCSSType
|
84
|
+
implements CSSType<T>
|
66
85
|
{
|
67
|
-
readonly value: ValueWithDefault
|
86
|
+
readonly value: ValueWithDefault;
|
68
87
|
readonly syntax: CSSSyntaxType;
|
69
|
-
|
70
|
-
static create<T extends URLValue = URLValue>(
|
71
|
-
value: ValueWithDefault<T>,
|
72
|
-
): Url<T>;
|
88
|
+
static create<T extends URLValue = URLValue>(value: ValueWithDefault): Url<T>;
|
73
89
|
}
|
74
|
-
export declare const url:
|
90
|
+
export declare const url: <T extends URLValue = URLValue>(
|
91
|
+
value: ValueWithDefault,
|
92
|
+
) => Url<T>;
|
75
93
|
type ImageValue = string;
|
76
94
|
export declare class Image<T extends ImageValue>
|
77
95
|
extends Url<T>
|
78
|
-
implements
|
96
|
+
implements CSSType<T>
|
79
97
|
{
|
80
|
-
readonly value: ValueWithDefault
|
98
|
+
readonly value: ValueWithDefault;
|
81
99
|
readonly syntax: CSSSyntaxType;
|
82
|
-
constructor(value: ValueWithDefault
|
100
|
+
constructor(value: ValueWithDefault);
|
83
101
|
static create<T extends ImageValue = ImageValue>(
|
84
|
-
value: ValueWithDefault
|
102
|
+
value: ValueWithDefault,
|
85
103
|
): Image<T>;
|
86
104
|
}
|
87
|
-
export declare const image:
|
105
|
+
export declare const image: <T extends ImageValue = ImageValue>(
|
106
|
+
value: ValueWithDefault,
|
107
|
+
) => Image<T>;
|
88
108
|
type IntegerValue = number;
|
89
109
|
export declare class Integer<T extends IntegerValue>
|
90
|
-
extends
|
91
|
-
implements
|
110
|
+
extends BaseCSSType
|
111
|
+
implements CSSType<T>
|
92
112
|
{
|
93
|
-
readonly value: ValueWithDefault
|
113
|
+
readonly value: ValueWithDefault;
|
94
114
|
readonly syntax: CSSSyntaxType;
|
95
|
-
constructor(value: ValueWithDefault<T>);
|
96
115
|
static create<T extends IntegerValue = IntegerValue>(value: T): Integer<T>;
|
97
116
|
}
|
98
|
-
export declare const integer:
|
117
|
+
export declare const integer: <T extends IntegerValue = IntegerValue>(
|
118
|
+
value: T,
|
119
|
+
) => Integer<T>;
|
99
120
|
type LengthPercentageValue = string;
|
100
|
-
export declare class LengthPercentage<
|
101
|
-
extends
|
102
|
-
implements
|
121
|
+
export declare class LengthPercentage<_T extends LengthPercentageValue>
|
122
|
+
extends BaseCSSType
|
123
|
+
implements CSSType<string>
|
103
124
|
{
|
104
|
-
readonly value: ValueWithDefault
|
125
|
+
readonly value: ValueWithDefault;
|
105
126
|
readonly syntax: CSSSyntaxType;
|
106
|
-
|
107
|
-
|
108
|
-
value: ValueWithDefault<T>,
|
127
|
+
static createLength<_T extends LengthPercentageValue | number>(
|
128
|
+
value: ValueWithDefault,
|
109
129
|
): LengthPercentage<string>;
|
110
|
-
static createPercentage<
|
111
|
-
value: ValueWithDefault
|
130
|
+
static createPercentage<_T extends LengthPercentageValue | number>(
|
131
|
+
value: ValueWithDefault,
|
112
132
|
): LengthPercentage<string>;
|
113
133
|
}
|
114
|
-
export declare const lengthPercentage:
|
134
|
+
export declare const lengthPercentage: <
|
135
|
+
_T extends LengthPercentageValue | number,
|
136
|
+
>(
|
137
|
+
value: ValueWithDefault,
|
138
|
+
) => LengthPercentage<string>;
|
115
139
|
type LengthValue = number | string;
|
116
|
-
export declare class Length<
|
140
|
+
export declare class Length<_T extends LengthValue>
|
117
141
|
extends LengthPercentage<string>
|
118
|
-
implements
|
142
|
+
implements CSSType<string>
|
119
143
|
{
|
120
|
-
readonly value: ValueWithDefault
|
144
|
+
readonly value: ValueWithDefault;
|
121
145
|
readonly syntax: CSSSyntaxType;
|
122
|
-
constructor(value: ValueWithDefault<T>);
|
123
146
|
static create<T extends LengthValue = LengthValue>(
|
124
|
-
value:
|
147
|
+
value: NestedWithNumbers,
|
125
148
|
): Length<T>;
|
126
149
|
}
|
127
|
-
export declare const length:
|
150
|
+
export declare const length: <T extends LengthValue = LengthValue>(
|
151
|
+
value: NestedWithNumbers,
|
152
|
+
) => Length<T>;
|
128
153
|
type PercentageValue = string | number;
|
129
|
-
export declare class Percentage<
|
154
|
+
export declare class Percentage<_T extends PercentageValue>
|
130
155
|
extends LengthPercentage<string>
|
131
|
-
implements
|
156
|
+
implements CSSType<string>
|
132
157
|
{
|
133
|
-
readonly value: ValueWithDefault
|
158
|
+
readonly value: ValueWithDefault;
|
134
159
|
readonly syntax: CSSSyntaxType;
|
135
|
-
constructor(value: ValueWithDefault<T>);
|
136
160
|
static create<T extends PercentageValue = PercentageValue>(
|
137
|
-
value:
|
161
|
+
value: NestedWithNumbers,
|
138
162
|
): Percentage<T>;
|
139
163
|
}
|
140
|
-
export declare const percentage:
|
164
|
+
export declare const percentage: <T extends PercentageValue = PercentageValue>(
|
165
|
+
value: NestedWithNumbers,
|
166
|
+
) => Percentage<T>;
|
141
167
|
type NumberValue = number;
|
142
168
|
export declare class Num<T extends NumberValue>
|
143
|
-
extends
|
144
|
-
implements
|
169
|
+
extends BaseCSSType
|
170
|
+
implements CSSType<T>
|
145
171
|
{
|
146
|
-
readonly value: ValueWithDefault
|
172
|
+
readonly value: ValueWithDefault;
|
147
173
|
readonly syntax: CSSSyntaxType;
|
148
|
-
constructor(value: ValueWithDefault<T>);
|
149
174
|
static create<T extends NumberValue = NumberValue>(
|
150
|
-
value:
|
175
|
+
value: NestedWithNumbers,
|
151
176
|
): Num<T>;
|
152
177
|
}
|
153
|
-
export declare const number:
|
178
|
+
export declare const number: <T extends NumberValue = NumberValue>(
|
179
|
+
value: NestedWithNumbers,
|
180
|
+
) => Num<T>;
|
154
181
|
type ResolutionValue = string | 0;
|
155
182
|
export declare class Resolution<T extends ResolutionValue>
|
156
|
-
extends
|
157
|
-
implements
|
183
|
+
extends BaseCSSType
|
184
|
+
implements CSSType<T>
|
158
185
|
{
|
159
|
-
readonly value: ValueWithDefault
|
186
|
+
readonly value: ValueWithDefault;
|
160
187
|
readonly syntax: CSSSyntaxType;
|
161
|
-
constructor(value: ValueWithDefault<T>);
|
162
188
|
static create<T extends ResolutionValue = ResolutionValue>(
|
163
|
-
value: ValueWithDefault
|
189
|
+
value: ValueWithDefault,
|
164
190
|
): Resolution<T>;
|
165
191
|
}
|
166
|
-
export declare const resolution:
|
192
|
+
export declare const resolution: <T extends ResolutionValue = ResolutionValue>(
|
193
|
+
value: ValueWithDefault,
|
194
|
+
) => Resolution<T>;
|
167
195
|
type TimeValue = string | 0;
|
168
196
|
export declare class Time<T extends TimeValue>
|
169
|
-
extends
|
170
|
-
implements
|
197
|
+
extends BaseCSSType
|
198
|
+
implements CSSType<T>
|
171
199
|
{
|
172
|
-
readonly value: ValueWithDefault
|
200
|
+
readonly value: ValueWithDefault;
|
173
201
|
readonly syntax: CSSSyntaxType;
|
174
|
-
constructor(value: ValueWithDefault<T>);
|
175
202
|
static create<T extends TimeValue = TimeValue>(
|
176
|
-
value: ValueWithDefault
|
203
|
+
value: ValueWithDefault,
|
177
204
|
): Time<T>;
|
178
205
|
}
|
179
|
-
export declare const time:
|
206
|
+
export declare const time: <T extends TimeValue = TimeValue>(
|
207
|
+
value: ValueWithDefault,
|
208
|
+
) => Time<T>;
|
180
209
|
type TransformFunctionValue = string;
|
181
210
|
export declare class TransformFunction<T extends TransformFunctionValue>
|
182
|
-
extends
|
183
|
-
implements
|
211
|
+
extends BaseCSSType
|
212
|
+
implements CSSType<T>
|
184
213
|
{
|
185
|
-
readonly value: ValueWithDefault
|
214
|
+
readonly value: ValueWithDefault;
|
186
215
|
readonly syntax: CSSSyntaxType;
|
187
|
-
constructor(value: ValueWithDefault<T>);
|
188
216
|
static create<T extends TransformFunctionValue = TransformFunctionValue>(
|
189
|
-
value: ValueWithDefault
|
217
|
+
value: ValueWithDefault,
|
190
218
|
): TransformFunction<T>;
|
191
219
|
}
|
192
|
-
export declare const transformFunction:
|
220
|
+
export declare const transformFunction: <
|
221
|
+
T extends TransformFunctionValue = TransformFunctionValue,
|
222
|
+
>(
|
223
|
+
value: ValueWithDefault,
|
224
|
+
) => TransformFunction<T>;
|
193
225
|
type TransformListValue = string;
|
194
226
|
export declare class TransformList<T extends TransformListValue>
|
195
|
-
extends
|
196
|
-
implements
|
227
|
+
extends BaseCSSType
|
228
|
+
implements CSSType<T>
|
197
229
|
{
|
198
|
-
readonly value: ValueWithDefault
|
230
|
+
readonly value: ValueWithDefault;
|
199
231
|
readonly syntax: CSSSyntaxType;
|
200
|
-
constructor(value: ValueWithDefault<T>);
|
201
232
|
static create<T extends TransformListValue = TransformListValue>(
|
202
|
-
value: ValueWithDefault
|
233
|
+
value: ValueWithDefault,
|
203
234
|
): TransformList<T>;
|
204
235
|
}
|
205
|
-
export declare const transformList:
|
236
|
+
export declare const transformList: <
|
237
|
+
T extends TransformListValue = TransformListValue,
|
238
|
+
>(
|
239
|
+
value: ValueWithDefault,
|
240
|
+
) => TransformList<T>;
|
package/lib/types/index.js
CHANGED
@@ -3,40 +3,35 @@
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
4
4
|
value: true
|
5
5
|
});
|
6
|
-
exports.url = exports.transformList = exports.transformFunction = exports.time = exports.resolution = exports.percentage = exports.number = exports.lengthPercentage = exports.length = exports.integer = exports.image = exports.color = exports.angle = exports.Url = exports.TransformList = exports.TransformFunction = exports.Time = exports.Resolution = exports.Percentage = exports.Num = exports.LengthPercentage = exports.Length = exports.Integer = exports.Image = exports.Color = exports.
|
7
|
-
class
|
8
|
-
exports.CSSType = CSSType;
|
9
|
-
class Angle extends CSSType {
|
10
|
-
syntax = '<angle>';
|
11
|
-
static syntax = '<angle>';
|
6
|
+
exports.url = exports.transformList = exports.transformFunction = exports.time = exports.resolution = exports.percentage = exports.number = exports.lengthPercentage = exports.length = exports.isCSSType = exports.integer = exports.image = exports.color = exports.angle = exports.Url = exports.TransformList = exports.TransformFunction = exports.Time = exports.Resolution = exports.Percentage = exports.Num = exports.LengthPercentage = exports.Length = exports.Integer = exports.Image = exports.Color = exports.Angle = void 0;
|
7
|
+
class BaseCSSType {
|
12
8
|
constructor(value) {
|
13
|
-
super();
|
14
9
|
this.value = value;
|
15
10
|
}
|
11
|
+
}
|
12
|
+
const isCSSType = value => {
|
13
|
+
return value instanceof BaseCSSType && value.value != null && typeof value.syntax === 'string';
|
14
|
+
};
|
15
|
+
exports.isCSSType = isCSSType;
|
16
|
+
class Angle extends BaseCSSType {
|
17
|
+
syntax = '<angle>';
|
18
|
+
static syntax = '<angle>';
|
16
19
|
static create(value) {
|
17
20
|
return new Angle(value);
|
18
21
|
}
|
19
22
|
}
|
20
23
|
exports.Angle = Angle;
|
21
24
|
const angle = exports.angle = Angle.create;
|
22
|
-
class Color extends
|
25
|
+
class Color extends BaseCSSType {
|
23
26
|
syntax = '<color>';
|
24
|
-
constructor(value) {
|
25
|
-
super();
|
26
|
-
this.value = value;
|
27
|
-
}
|
28
27
|
static create(value) {
|
29
28
|
return new Color(value);
|
30
29
|
}
|
31
30
|
}
|
32
31
|
exports.Color = Color;
|
33
32
|
const color = exports.color = Color.create;
|
34
|
-
class Url extends
|
33
|
+
class Url extends BaseCSSType {
|
35
34
|
syntax = '<url>';
|
36
|
-
constructor(value) {
|
37
|
-
super();
|
38
|
-
this.value = value;
|
39
|
-
}
|
40
35
|
static create(value) {
|
41
36
|
return new Url(value);
|
42
37
|
}
|
@@ -55,24 +50,16 @@ class Image extends Url {
|
|
55
50
|
}
|
56
51
|
exports.Image = Image;
|
57
52
|
const image = exports.image = Image.create;
|
58
|
-
class Integer extends
|
53
|
+
class Integer extends BaseCSSType {
|
59
54
|
syntax = '<integer>';
|
60
|
-
constructor(value) {
|
61
|
-
super();
|
62
|
-
this.value = value;
|
63
|
-
}
|
64
55
|
static create(value) {
|
65
|
-
return new Integer(value);
|
56
|
+
return new Integer(convertNumberToStringUsing(String, '0')(value));
|
66
57
|
}
|
67
58
|
}
|
68
59
|
exports.Integer = Integer;
|
69
60
|
const integer = exports.integer = Integer.create;
|
70
|
-
class LengthPercentage extends
|
61
|
+
class LengthPercentage extends BaseCSSType {
|
71
62
|
syntax = '<length-percentage>';
|
72
|
-
constructor(value) {
|
73
|
-
super();
|
74
|
-
this.value = value;
|
75
|
-
}
|
76
63
|
static createLength(value) {
|
77
64
|
return new LengthPercentage(convertNumberToLength(value));
|
78
65
|
}
|
@@ -84,80 +71,54 @@ exports.LengthPercentage = LengthPercentage;
|
|
84
71
|
const lengthPercentage = exports.lengthPercentage = LengthPercentage.createLength;
|
85
72
|
class Length extends LengthPercentage {
|
86
73
|
syntax = '<length>';
|
87
|
-
constructor(value) {
|
88
|
-
super(convertNumberToLength(value));
|
89
|
-
}
|
90
74
|
static create(value) {
|
91
|
-
return new Length(value);
|
75
|
+
return new Length(convertNumberToLength(value));
|
92
76
|
}
|
93
77
|
}
|
94
78
|
exports.Length = Length;
|
95
79
|
const length = exports.length = Length.create;
|
96
80
|
class Percentage extends LengthPercentage {
|
97
81
|
syntax = '<percentage>';
|
98
|
-
constructor(value) {
|
99
|
-
super(convertNumberToPercentage(value));
|
100
|
-
}
|
101
82
|
static create(value) {
|
102
|
-
return new Percentage(value);
|
83
|
+
return new Percentage(convertNumberToPercentage(value));
|
103
84
|
}
|
104
85
|
}
|
105
86
|
exports.Percentage = Percentage;
|
106
87
|
const percentage = exports.percentage = Percentage.create;
|
107
|
-
class Num extends
|
88
|
+
class Num extends BaseCSSType {
|
108
89
|
syntax = '<number>';
|
109
|
-
constructor(value) {
|
110
|
-
super();
|
111
|
-
this.value = value;
|
112
|
-
}
|
113
90
|
static create(value) {
|
114
|
-
return new Num(value);
|
91
|
+
return new Num(convertNumberToBareString(value));
|
115
92
|
}
|
116
93
|
}
|
117
94
|
exports.Num = Num;
|
118
95
|
const number = exports.number = Num.create;
|
119
|
-
class Resolution extends
|
96
|
+
class Resolution extends BaseCSSType {
|
120
97
|
syntax = '<resolution>';
|
121
|
-
constructor(value) {
|
122
|
-
super();
|
123
|
-
this.value = value;
|
124
|
-
}
|
125
98
|
static create(value) {
|
126
99
|
return new Resolution(value);
|
127
100
|
}
|
128
101
|
}
|
129
102
|
exports.Resolution = Resolution;
|
130
103
|
const resolution = exports.resolution = Resolution.create;
|
131
|
-
class Time extends
|
104
|
+
class Time extends BaseCSSType {
|
132
105
|
syntax = '<time>';
|
133
|
-
constructor(value) {
|
134
|
-
super();
|
135
|
-
this.value = value;
|
136
|
-
}
|
137
106
|
static create(value) {
|
138
107
|
return new Time(value);
|
139
108
|
}
|
140
109
|
}
|
141
110
|
exports.Time = Time;
|
142
111
|
const time = exports.time = Time.create;
|
143
|
-
class TransformFunction extends
|
112
|
+
class TransformFunction extends BaseCSSType {
|
144
113
|
syntax = '<transform-function>';
|
145
|
-
constructor(value) {
|
146
|
-
super();
|
147
|
-
this.value = value;
|
148
|
-
}
|
149
114
|
static create(value) {
|
150
115
|
return new TransformFunction(value);
|
151
116
|
}
|
152
117
|
}
|
153
118
|
exports.TransformFunction = TransformFunction;
|
154
119
|
const transformFunction = exports.transformFunction = TransformFunction.create;
|
155
|
-
class TransformList extends
|
120
|
+
class TransformList extends BaseCSSType {
|
156
121
|
syntax = '<transform-list>';
|
157
|
-
constructor(value) {
|
158
|
-
super();
|
159
|
-
this.value = value;
|
160
|
-
}
|
161
122
|
static create(value) {
|
162
123
|
return new TransformList(value);
|
163
124
|
}
|
@@ -172,20 +133,15 @@ const convertNumberToStringUsing = (transformNumber, defaultStr) => value => {
|
|
172
133
|
return value;
|
173
134
|
}
|
174
135
|
if (typeof value === 'object') {
|
175
|
-
const
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
const defaultResult = convertNumberToLength(defaultValue);
|
180
|
-
const result = {
|
181
|
-
default: typeof defaultResult === 'string' ? defaultResult : defaultStr
|
182
|
-
};
|
183
|
-
for (const [key, value] of Object.entries(rest)) {
|
184
|
-
result[key] = convertNumberToLength(value);
|
136
|
+
const val = value;
|
137
|
+
const result = {};
|
138
|
+
for (const key of Object.keys(val)) {
|
139
|
+
result[key] = convertNumberToStringUsing(transformNumber, defaultStr)(val[key]);
|
185
140
|
}
|
186
141
|
return result;
|
187
142
|
}
|
188
143
|
return value;
|
189
144
|
};
|
145
|
+
const convertNumberToBareString = convertNumberToStringUsing(value => String(value), '0');
|
190
146
|
const convertNumberToLength = convertNumberToStringUsing(value => value === 0 ? '0' : `${value}px`, '0px');
|
191
147
|
const convertNumberToPercentage = convertNumberToStringUsing(value => value === 0 ? '0' : `${value * 100}%`, '0');
|