@hero-design/snowflake-guard 1.4.10 → 1.4.12
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/package.json +2 -2
- package/lib/src/__tests__/parseMobileSource.spec.d.ts +0 -1
- package/lib/src/__tests__/parseMobileSource.spec.js +0 -417
- package/lib/src/__tests__/parseSource.spec.d.ts +0 -1
- package/lib/src/__tests__/parseSource.spec.js +0 -207
- package/lib/src/graphql/__tests__/fetchGrapql.spec.d.ts +0 -1
- package/lib/src/graphql/__tests__/fetchGrapql.spec.js +0 -33
- package/lib/src/graphql/__tests__/queryGenerators.spec.d.ts +0 -1
- package/lib/src/graphql/__tests__/queryGenerators.spec.js +0 -82
- package/lib/src/graphql/fetchGraphql.d.ts +0 -2
- package/lib/src/graphql/fetchGraphql.js +0 -23
- package/lib/src/graphql/queryGenerators.d.ts +0 -18
- package/lib/src/graphql/queryGenerators.js +0 -61
- package/lib/src/graphql/types.d.ts +0 -18
- package/lib/src/graphql/types.js +0 -2
- package/lib/src/index.d.ts +0 -3
- package/lib/src/index.js +0 -175
- package/lib/src/parseMobileSource.d.ts +0 -15
- package/lib/src/parseMobileSource.js +0 -135
- package/lib/src/parseSource.d.ts +0 -17
- package/lib/src/parseSource.js +0 -138
- package/lib/src/parsers/flow.d.ts +0 -3
- package/lib/src/parsers/flow.js +0 -47
- package/lib/src/parsers/typescript.d.ts +0 -3
- package/lib/src/parsers/typescript.js +0 -47
- package/lib/src/reports/__tests__/reportInlineStyle.spec.d.ts +0 -1
- package/lib/src/reports/__tests__/reportInlineStyle.spec.js +0 -143
- package/lib/src/reports/constants.d.ts +0 -233
- package/lib/src/reports/constants.js +0 -917
- package/lib/src/reports/mobile/__tests__/reportCustomStyleProperties.spec.d.ts +0 -1
- package/lib/src/reports/mobile/__tests__/reportCustomStyleProperties.spec.js +0 -144
- package/lib/src/reports/mobile/__tests__/reportInlineStyle.spec.d.ts +0 -1
- package/lib/src/reports/mobile/__tests__/reportInlineStyle.spec.js +0 -113
- package/lib/src/reports/mobile/__tests__/reportStyledComponents.spec.d.ts +0 -1
- package/lib/src/reports/mobile/__tests__/reportStyledComponents.spec.js +0 -54
- package/lib/src/reports/mobile/constants.d.ts +0 -106
- package/lib/src/reports/mobile/constants.js +0 -470
- package/lib/src/reports/mobile/reportCustomStyleProperties.d.ts +0 -24
- package/lib/src/reports/mobile/reportCustomStyleProperties.js +0 -193
- package/lib/src/reports/mobile/reportInlineStyle.d.ts +0 -20
- package/lib/src/reports/mobile/reportInlineStyle.js +0 -223
- package/lib/src/reports/mobile/reportStyledComponents.d.ts +0 -6
- package/lib/src/reports/mobile/reportStyledComponents.js +0 -105
- package/lib/src/reports/mobile/testUtils.d.ts +0 -1
- package/lib/src/reports/mobile/testUtils.js +0 -42
- package/lib/src/reports/mobile/types.d.ts +0 -3
- package/lib/src/reports/mobile/types.js +0 -2
- package/lib/src/reports/reportClassName.d.ts +0 -3
- package/lib/src/reports/reportClassName.js +0 -12
- package/lib/src/reports/reportCustomStyleProperties.d.ts +0 -25
- package/lib/src/reports/reportCustomStyleProperties.js +0 -185
- package/lib/src/reports/reportInlineStyle.d.ts +0 -23
- package/lib/src/reports/reportInlineStyle.js +0 -238
- package/lib/src/reports/reportStyledComponents.d.ts +0 -6
- package/lib/src/reports/reportStyledComponents.js +0 -105
- package/lib/src/reports/types.d.ts +0 -3
- package/lib/src/reports/types.js +0 -2
- package/lib/src/utils/__tests__/getDiffLocs.spec.d.ts +0 -1
- package/lib/src/utils/__tests__/getDiffLocs.spec.js +0 -43
- package/lib/src/utils/getDiffLocs.d.ts +0 -3
- package/lib/src/utils/getDiffLocs.js +0 -40
|
@@ -1,470 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.TEXT_STYLE_RULESET_MAP = exports.CONTAINER_STYLE_RULESET_MAP = exports.BAR_STYLE_RULESET_MAP = exports.MOBILE_RULESET_MAP = exports.HD_MOBILE_COMPONENTS = void 0;
|
|
4
|
-
const PADDING_ATTRS = [
|
|
5
|
-
'padding',
|
|
6
|
-
'paddingBottom',
|
|
7
|
-
'paddingEnd',
|
|
8
|
-
'paddingHorizontal',
|
|
9
|
-
'paddingLeft',
|
|
10
|
-
'paddingRight',
|
|
11
|
-
'paddingStart',
|
|
12
|
-
'paddingTop',
|
|
13
|
-
'paddingVertical',
|
|
14
|
-
];
|
|
15
|
-
const MARGIN_ATTRS = [
|
|
16
|
-
'margin',
|
|
17
|
-
'marginBottom',
|
|
18
|
-
'marginEnd',
|
|
19
|
-
'marginHorizontal',
|
|
20
|
-
'marginLeft',
|
|
21
|
-
'marginRight',
|
|
22
|
-
'marginStart',
|
|
23
|
-
'marginTop',
|
|
24
|
-
'marginVertical',
|
|
25
|
-
];
|
|
26
|
-
const COLOR_ATTRS = ['backgroundColor', 'borderColor'];
|
|
27
|
-
const BORDER_ATTRS = [
|
|
28
|
-
'borderBottomColor',
|
|
29
|
-
'borderBottomEndRadius',
|
|
30
|
-
'borderBottomLeftRadius',
|
|
31
|
-
'borderBottomRightRadius',
|
|
32
|
-
'borderBottomStartRadius',
|
|
33
|
-
'borderBottomWidth',
|
|
34
|
-
'borderEndColor',
|
|
35
|
-
'borderEndWidth',
|
|
36
|
-
'borderLeftColor',
|
|
37
|
-
'borderLeftWidth',
|
|
38
|
-
'borderRadius',
|
|
39
|
-
'borderRightColor',
|
|
40
|
-
'borderRightWidth',
|
|
41
|
-
'borderStartColor',
|
|
42
|
-
'borderStartWidth',
|
|
43
|
-
'borderStyle',
|
|
44
|
-
'borderTopColor',
|
|
45
|
-
'borderTopEndRadius',
|
|
46
|
-
'borderTopLeftRadius',
|
|
47
|
-
'borderTopRightRadius',
|
|
48
|
-
'borderTopStartRadius',
|
|
49
|
-
'borderTopWidth',
|
|
50
|
-
'borderWidth',
|
|
51
|
-
];
|
|
52
|
-
const SHADOW_ATTRS = [
|
|
53
|
-
'shadowColor',
|
|
54
|
-
'shadowOffset',
|
|
55
|
-
'shadowOpacity',
|
|
56
|
-
'shadowRadius',
|
|
57
|
-
'elevation',
|
|
58
|
-
];
|
|
59
|
-
const TEXT_ATTRS = [
|
|
60
|
-
'color',
|
|
61
|
-
'fontFamily',
|
|
62
|
-
'fontSize',
|
|
63
|
-
'fontStyle',
|
|
64
|
-
'fontWeight',
|
|
65
|
-
'fontVariant',
|
|
66
|
-
'letterSpacing',
|
|
67
|
-
'lineHeight',
|
|
68
|
-
];
|
|
69
|
-
const WIDTH_ATTRS = ['width', 'maxWidth', 'minWidth'];
|
|
70
|
-
const HEIGHT_ATTRS = ['height', 'maxHeight', 'minHeight'];
|
|
71
|
-
const HD_MOBILE_COMPONENTS = [
|
|
72
|
-
'Accordion',
|
|
73
|
-
'Alert',
|
|
74
|
-
'Attachment',
|
|
75
|
-
'Avatar',
|
|
76
|
-
'Badge',
|
|
77
|
-
'BottomNavigation',
|
|
78
|
-
'BottomSheet',
|
|
79
|
-
'Box',
|
|
80
|
-
'Button',
|
|
81
|
-
'Calendar',
|
|
82
|
-
'Carousel',
|
|
83
|
-
'Card',
|
|
84
|
-
'Chart',
|
|
85
|
-
'Chip',
|
|
86
|
-
'Collapse',
|
|
87
|
-
'Checkbox',
|
|
88
|
-
'ContentNavigator',
|
|
89
|
-
'DatePicker',
|
|
90
|
-
'Divider',
|
|
91
|
-
'Drawer',
|
|
92
|
-
'Empty',
|
|
93
|
-
'Error',
|
|
94
|
-
'FAB',
|
|
95
|
-
'FormGroup',
|
|
96
|
-
'HeroDesignProvider',
|
|
97
|
-
'MapPin',
|
|
98
|
-
'Icon',
|
|
99
|
-
'Image',
|
|
100
|
-
'List',
|
|
101
|
-
'PinInput',
|
|
102
|
-
'Progress',
|
|
103
|
-
'Slider',
|
|
104
|
-
'Spinner',
|
|
105
|
-
'Swipeable',
|
|
106
|
-
'Radio',
|
|
107
|
-
'SectionHeading',
|
|
108
|
-
'Select',
|
|
109
|
-
'Skeleton',
|
|
110
|
-
'Success',
|
|
111
|
-
'Switch',
|
|
112
|
-
'Tabs',
|
|
113
|
-
'Tag',
|
|
114
|
-
'TextInput',
|
|
115
|
-
'TimePicker',
|
|
116
|
-
'Toast',
|
|
117
|
-
'Toolbar',
|
|
118
|
-
'Typography',
|
|
119
|
-
'Rate',
|
|
120
|
-
'RefreshControl',
|
|
121
|
-
'RichTextEditor',
|
|
122
|
-
'PageControl',
|
|
123
|
-
'Portal',
|
|
124
|
-
'ScrollViewWithFAB',
|
|
125
|
-
'SectionListWithFAB',
|
|
126
|
-
'FlatListWithFAB',
|
|
127
|
-
'Search',
|
|
128
|
-
'FloatingIsland',
|
|
129
|
-
'FilterTrigger',
|
|
130
|
-
'SegmentedControl',
|
|
131
|
-
];
|
|
132
|
-
exports.HD_MOBILE_COMPONENTS = HD_MOBILE_COMPONENTS;
|
|
133
|
-
// Not common: MARGIN_ATTRS, WIDTH_ATTRS, HEIGHT_ATTRS
|
|
134
|
-
const COMMON_PROHIBITED_ATTRS = [
|
|
135
|
-
...PADDING_ATTRS,
|
|
136
|
-
...COLOR_ATTRS,
|
|
137
|
-
...BORDER_ATTRS,
|
|
138
|
-
...TEXT_ATTRS,
|
|
139
|
-
...SHADOW_ATTRS,
|
|
140
|
-
];
|
|
141
|
-
const MOBILE_RULESET_MAP = {
|
|
142
|
-
Accordion: [...COMMON_PROHIBITED_ATTRS, ...HEIGHT_ATTRS],
|
|
143
|
-
Alert: [...COMMON_PROHIBITED_ATTRS, ...WIDTH_ATTRS, HEIGHT_ATTRS],
|
|
144
|
-
Attachment: [...COMMON_PROHIBITED_ATTRS, ...HEIGHT_ATTRS],
|
|
145
|
-
Avatar: [
|
|
146
|
-
...PADDING_ATTRS,
|
|
147
|
-
...BORDER_ATTRS,
|
|
148
|
-
...TEXT_ATTRS,
|
|
149
|
-
...SHADOW_ATTRS,
|
|
150
|
-
...HEIGHT_ATTRS,
|
|
151
|
-
...WIDTH_ATTRS,
|
|
152
|
-
...HEIGHT_ATTRS,
|
|
153
|
-
...['borderColor'],
|
|
154
|
-
],
|
|
155
|
-
'Avatar.Stack': [...COMMON_PROHIBITED_ATTRS, ...WIDTH_ATTRS, ...HEIGHT_ATTRS],
|
|
156
|
-
Badge: [...COMMON_PROHIBITED_ATTRS, ...WIDTH_ATTRS, ...HEIGHT_ATTRS],
|
|
157
|
-
'Badge.Status': [
|
|
158
|
-
...COMMON_PROHIBITED_ATTRS,
|
|
159
|
-
...WIDTH_ATTRS,
|
|
160
|
-
...HEIGHT_ATTRS,
|
|
161
|
-
...MARGIN_ATTRS,
|
|
162
|
-
],
|
|
163
|
-
BottomNavigation: [
|
|
164
|
-
...COMMON_PROHIBITED_ATTRS,
|
|
165
|
-
...WIDTH_ATTRS,
|
|
166
|
-
...HEIGHT_ATTRS,
|
|
167
|
-
],
|
|
168
|
-
BottomSheet: [...COMMON_PROHIBITED_ATTRS, ...WIDTH_ATTRS, ...HEIGHT_ATTRS],
|
|
169
|
-
'BottomSheet.ScrollView': [
|
|
170
|
-
...COMMON_PROHIBITED_ATTRS,
|
|
171
|
-
...WIDTH_ATTRS,
|
|
172
|
-
...HEIGHT_ATTRS,
|
|
173
|
-
],
|
|
174
|
-
Box: [...TEXT_ATTRS],
|
|
175
|
-
Button: [...COMMON_PROHIBITED_ATTRS, ...HEIGHT_ATTRS],
|
|
176
|
-
'Button.Icon': [...COMMON_PROHIBITED_ATTRS, ...WIDTH_ATTRS, ...HEIGHT_ATTRS],
|
|
177
|
-
'Button.Utility': [
|
|
178
|
-
...COMMON_PROHIBITED_ATTRS,
|
|
179
|
-
...WIDTH_ATTRS,
|
|
180
|
-
...HEIGHT_ATTRS,
|
|
181
|
-
],
|
|
182
|
-
Calendar: [
|
|
183
|
-
...COMMON_PROHIBITED_ATTRS,
|
|
184
|
-
...WIDTH_ATTRS,
|
|
185
|
-
...HEIGHT_ATTRS,
|
|
186
|
-
...MARGIN_ATTRS,
|
|
187
|
-
],
|
|
188
|
-
Card: [...COMMON_PROHIBITED_ATTRS],
|
|
189
|
-
'Card.Data': [...COMMON_PROHIBITED_ATTRS],
|
|
190
|
-
Carousel: [...COMMON_PROHIBITED_ATTRS],
|
|
191
|
-
'Carousel.Card': [...COMMON_PROHIBITED_ATTRS],
|
|
192
|
-
Checkbox: [...COMMON_PROHIBITED_ATTRS, ...HEIGHT_ATTRS],
|
|
193
|
-
Chip: [...COMMON_PROHIBITED_ATTRS, ...HEIGHT_ATTRS],
|
|
194
|
-
'Chart.Column': [...COMMON_PROHIBITED_ATTRS],
|
|
195
|
-
'Chart.Line': [...COMMON_PROHIBITED_ATTRS],
|
|
196
|
-
'Chart.SelectAction': [
|
|
197
|
-
...COMMON_PROHIBITED_ATTRS,
|
|
198
|
-
...WIDTH_ATTRS,
|
|
199
|
-
...HEIGHT_ATTRS,
|
|
200
|
-
],
|
|
201
|
-
Collapse: [...TEXT_ATTRS],
|
|
202
|
-
ContentNavigator: [...COMMON_PROHIBITED_ATTRS, ...HEIGHT_ATTRS],
|
|
203
|
-
DatePicker: [
|
|
204
|
-
...PADDING_ATTRS,
|
|
205
|
-
...BORDER_ATTRS,
|
|
206
|
-
...SHADOW_ATTRS,
|
|
207
|
-
...TEXT_ATTRS,
|
|
208
|
-
...HEIGHT_ATTRS,
|
|
209
|
-
],
|
|
210
|
-
Divider: [...COMMON_PROHIBITED_ATTRS, ...HEIGHT_ATTRS],
|
|
211
|
-
Drawer: [
|
|
212
|
-
...COMMON_PROHIBITED_ATTRS,
|
|
213
|
-
...WIDTH_ATTRS,
|
|
214
|
-
...HEIGHT_ATTRS,
|
|
215
|
-
...MARGIN_ATTRS,
|
|
216
|
-
],
|
|
217
|
-
'Drawer.Dragable': [
|
|
218
|
-
...COMMON_PROHIBITED_ATTRS,
|
|
219
|
-
...WIDTH_ATTRS,
|
|
220
|
-
...HEIGHT_ATTRS,
|
|
221
|
-
...MARGIN_ATTRS,
|
|
222
|
-
],
|
|
223
|
-
Empty: [
|
|
224
|
-
...COMMON_PROHIBITED_ATTRS,
|
|
225
|
-
...WIDTH_ATTRS,
|
|
226
|
-
...HEIGHT_ATTRS,
|
|
227
|
-
...MARGIN_ATTRS,
|
|
228
|
-
],
|
|
229
|
-
Error: [
|
|
230
|
-
...COMMON_PROHIBITED_ATTRS,
|
|
231
|
-
...WIDTH_ATTRS,
|
|
232
|
-
...HEIGHT_ATTRS,
|
|
233
|
-
...MARGIN_ATTRS,
|
|
234
|
-
],
|
|
235
|
-
FAB: [...COMMON_PROHIBITED_ATTRS, ...WIDTH_ATTRS, ...HEIGHT_ATTRS],
|
|
236
|
-
'FAB.ActionGroup': [
|
|
237
|
-
...COMMON_PROHIBITED_ATTRS,
|
|
238
|
-
...WIDTH_ATTRS,
|
|
239
|
-
...HEIGHT_ATTRS,
|
|
240
|
-
],
|
|
241
|
-
'FAB.Pair': [...COMMON_PROHIBITED_ATTRS, ...WIDTH_ATTRS, ...HEIGHT_ATTRS],
|
|
242
|
-
FloatingIsland: [...COMMON_PROHIBITED_ATTRS, ...WIDTH_ATTRS, ...HEIGHT_ATTRS],
|
|
243
|
-
FilterTrigger: [...COMMON_PROHIBITED_ATTRS, ...HEIGHT_ATTRS],
|
|
244
|
-
Icon: [...COMMON_PROHIBITED_ATTRS, ...WIDTH_ATTRS, ...HEIGHT_ATTRS],
|
|
245
|
-
Illustration: [...COMMON_PROHIBITED_ATTRS, ...WIDTH_ATTRS, ...HEIGHT_ATTRS],
|
|
246
|
-
Image: [...COMMON_PROHIBITED_ATTRS],
|
|
247
|
-
'List.BasicItem': [...COMMON_PROHIBITED_ATTRS],
|
|
248
|
-
'List.Item': [...COMMON_PROHIBITED_ATTRS],
|
|
249
|
-
MapPin: [...COMMON_PROHIBITED_ATTRS, ...WIDTH_ATTRS, ...HEIGHT_ATTRS],
|
|
250
|
-
PageControl: [...COMMON_PROHIBITED_ATTRS, ...WIDTH_ATTRS, ...HEIGHT_ATTRS],
|
|
251
|
-
PinInput: [...COMMON_PROHIBITED_ATTRS, ...WIDTH_ATTRS, ...HEIGHT_ATTRS],
|
|
252
|
-
Portal: [
|
|
253
|
-
...COMMON_PROHIBITED_ATTRS,
|
|
254
|
-
...WIDTH_ATTRS,
|
|
255
|
-
...HEIGHT_ATTRS,
|
|
256
|
-
...MARGIN_ATTRS,
|
|
257
|
-
],
|
|
258
|
-
'Progress.Bar': [...COMMON_PROHIBITED_ATTRS, ...HEIGHT_ATTRS],
|
|
259
|
-
'Progress.Circle': [
|
|
260
|
-
...COMMON_PROHIBITED_ATTRS,
|
|
261
|
-
...WIDTH_ATTRS,
|
|
262
|
-
...HEIGHT_ATTRS,
|
|
263
|
-
],
|
|
264
|
-
'Progress.Step': [...COMMON_PROHIBITED_ATTRS, ...HEIGHT_ATTRS],
|
|
265
|
-
'Radio.Group': [...COMMON_PROHIBITED_ATTRS, ...HEIGHT_ATTRS],
|
|
266
|
-
Rate: [...COMMON_PROHIBITED_ATTRS, ...WIDTH_ATTRS, ...HEIGHT_ATTRS],
|
|
267
|
-
RefreshControl: [...COMMON_PROHIBITED_ATTRS, ...WIDTH_ATTRS, ...HEIGHT_ATTRS],
|
|
268
|
-
RichTextEditor: [
|
|
269
|
-
...COMMON_PROHIBITED_ATTRS,
|
|
270
|
-
...WIDTH_ATTRS,
|
|
271
|
-
...HEIGHT_ATTRS,
|
|
272
|
-
...MARGIN_ATTRS,
|
|
273
|
-
],
|
|
274
|
-
'RichTextEditor.MentionList': [
|
|
275
|
-
...COMMON_PROHIBITED_ATTRS,
|
|
276
|
-
...WIDTH_ATTRS,
|
|
277
|
-
...HEIGHT_ATTRS,
|
|
278
|
-
...MARGIN_ATTRS,
|
|
279
|
-
],
|
|
280
|
-
'RichTextEditor.Toolbar': [
|
|
281
|
-
...COMMON_PROHIBITED_ATTRS,
|
|
282
|
-
...WIDTH_ATTRS,
|
|
283
|
-
...HEIGHT_ATTRS,
|
|
284
|
-
...MARGIN_ATTRS,
|
|
285
|
-
],
|
|
286
|
-
ScrollViewWithFAB: [...TEXT_ATTRS],
|
|
287
|
-
FlatListWithFAB: [...TEXT_ATTRS],
|
|
288
|
-
SectionListWithFAB: [...TEXT_ATTRS],
|
|
289
|
-
'Search.OneLine': [...COMMON_PROHIBITED_ATTRS, ...HEIGHT_ATTRS],
|
|
290
|
-
'Search.TwoLine': [...COMMON_PROHIBITED_ATTRS, ...HEIGHT_ATTRS],
|
|
291
|
-
'Search.SuffixIcon': [
|
|
292
|
-
...COMMON_PROHIBITED_ATTRS,
|
|
293
|
-
...WIDTH_ATTRS,
|
|
294
|
-
...HEIGHT_ATTRS,
|
|
295
|
-
...MARGIN_ATTRS,
|
|
296
|
-
],
|
|
297
|
-
SectionHeading: [...COMMON_PROHIBITED_ATTRS, ...HEIGHT_ATTRS],
|
|
298
|
-
Select: [
|
|
299
|
-
...PADDING_ATTRS,
|
|
300
|
-
...BORDER_ATTRS,
|
|
301
|
-
...SHADOW_ATTRS,
|
|
302
|
-
...TEXT_ATTRS,
|
|
303
|
-
...HEIGHT_ATTRS,
|
|
304
|
-
],
|
|
305
|
-
'Select.Multi': [
|
|
306
|
-
...PADDING_ATTRS,
|
|
307
|
-
...BORDER_ATTRS,
|
|
308
|
-
...SHADOW_ATTRS,
|
|
309
|
-
...TEXT_ATTRS,
|
|
310
|
-
...HEIGHT_ATTRS,
|
|
311
|
-
],
|
|
312
|
-
Skeleton: [...COMMON_PROHIBITED_ATTRS],
|
|
313
|
-
Slider: [...COMMON_PROHIBITED_ATTRS, ...HEIGHT_ATTRS],
|
|
314
|
-
Spinner: [...COMMON_PROHIBITED_ATTRS, ...WIDTH_ATTRS, ...HEIGHT_ATTRS],
|
|
315
|
-
Success: [
|
|
316
|
-
...COMMON_PROHIBITED_ATTRS,
|
|
317
|
-
...WIDTH_ATTRS,
|
|
318
|
-
...HEIGHT_ATTRS,
|
|
319
|
-
...MARGIN_ATTRS,
|
|
320
|
-
],
|
|
321
|
-
Swipeable: [
|
|
322
|
-
...COMMON_PROHIBITED_ATTRS,
|
|
323
|
-
...WIDTH_ATTRS,
|
|
324
|
-
...HEIGHT_ATTRS,
|
|
325
|
-
...MARGIN_ATTRS,
|
|
326
|
-
],
|
|
327
|
-
'Swipeable.Action': [
|
|
328
|
-
...COMMON_PROHIBITED_ATTRS,
|
|
329
|
-
...WIDTH_ATTRS,
|
|
330
|
-
...HEIGHT_ATTRS,
|
|
331
|
-
...MARGIN_ATTRS,
|
|
332
|
-
],
|
|
333
|
-
'Swipeable.Content': [
|
|
334
|
-
...COLOR_ATTRS,
|
|
335
|
-
...BORDER_ATTRS,
|
|
336
|
-
...TEXT_ATTRS,
|
|
337
|
-
...SHADOW_ATTRS,
|
|
338
|
-
...WIDTH_ATTRS,
|
|
339
|
-
...HEIGHT_ATTRS,
|
|
340
|
-
...MARGIN_ATTRS,
|
|
341
|
-
],
|
|
342
|
-
Switch: [...COMMON_PROHIBITED_ATTRS, ...HEIGHT_ATTRS],
|
|
343
|
-
'Switch.Selector': [...COMMON_PROHIBITED_ATTRS, ...HEIGHT_ATTRS],
|
|
344
|
-
Tabs: [
|
|
345
|
-
...COMMON_PROHIBITED_ATTRS,
|
|
346
|
-
...WIDTH_ATTRS,
|
|
347
|
-
...HEIGHT_ATTRS,
|
|
348
|
-
...MARGIN_ATTRS,
|
|
349
|
-
],
|
|
350
|
-
'Tabs.Scroll': [
|
|
351
|
-
...COMMON_PROHIBITED_ATTRS,
|
|
352
|
-
...WIDTH_ATTRS,
|
|
353
|
-
...HEIGHT_ATTRS,
|
|
354
|
-
...MARGIN_ATTRS,
|
|
355
|
-
],
|
|
356
|
-
Tag: [...COMMON_PROHIBITED_ATTRS, ...WIDTH_ATTRS, ...HEIGHT_ATTRS],
|
|
357
|
-
TextInput: [
|
|
358
|
-
...PADDING_ATTRS,
|
|
359
|
-
...BORDER_ATTRS,
|
|
360
|
-
...SHADOW_ATTRS,
|
|
361
|
-
...TEXT_ATTRS,
|
|
362
|
-
...HEIGHT_ATTRS,
|
|
363
|
-
],
|
|
364
|
-
FormGroup: [...COMMON_PROHIBITED_ATTRS, ...HEIGHT_ATTRS],
|
|
365
|
-
SegmentedControl: [...COMMON_PROHIBITED_ATTRS, ...HEIGHT_ATTRS],
|
|
366
|
-
TimePicker: [
|
|
367
|
-
...PADDING_ATTRS,
|
|
368
|
-
...BORDER_ATTRS,
|
|
369
|
-
...SHADOW_ATTRS,
|
|
370
|
-
...TEXT_ATTRS,
|
|
371
|
-
...HEIGHT_ATTRS,
|
|
372
|
-
],
|
|
373
|
-
'Toast.Container': [
|
|
374
|
-
...COMMON_PROHIBITED_ATTRS,
|
|
375
|
-
...WIDTH_ATTRS,
|
|
376
|
-
...HEIGHT_ATTRS,
|
|
377
|
-
...MARGIN_ATTRS,
|
|
378
|
-
],
|
|
379
|
-
'Toast.Provider': [
|
|
380
|
-
...COMMON_PROHIBITED_ATTRS,
|
|
381
|
-
...WIDTH_ATTRS,
|
|
382
|
-
...HEIGHT_ATTRS,
|
|
383
|
-
...MARGIN_ATTRS,
|
|
384
|
-
],
|
|
385
|
-
'Toolbar.Group': [
|
|
386
|
-
...COMMON_PROHIBITED_ATTRS,
|
|
387
|
-
...WIDTH_ATTRS,
|
|
388
|
-
...HEIGHT_ATTRS,
|
|
389
|
-
...MARGIN_ATTRS,
|
|
390
|
-
],
|
|
391
|
-
'Toolbar.Item': [
|
|
392
|
-
...COMMON_PROHIBITED_ATTRS,
|
|
393
|
-
...WIDTH_ATTRS,
|
|
394
|
-
...HEIGHT_ATTRS,
|
|
395
|
-
...MARGIN_ATTRS,
|
|
396
|
-
],
|
|
397
|
-
'Toolbar.Message': [
|
|
398
|
-
...COMMON_PROHIBITED_ATTRS,
|
|
399
|
-
...WIDTH_ATTRS,
|
|
400
|
-
...HEIGHT_ATTRS,
|
|
401
|
-
...MARGIN_ATTRS,
|
|
402
|
-
],
|
|
403
|
-
'Typography.Title': [...COMMON_PROHIBITED_ATTRS, ...HEIGHT_ATTRS],
|
|
404
|
-
'Typography.Body': [...COMMON_PROHIBITED_ATTRS, ...HEIGHT_ATTRS],
|
|
405
|
-
'Typography.Caption': [...COMMON_PROHIBITED_ATTRS, ...HEIGHT_ATTRS],
|
|
406
|
-
'Typography.Label': [...COMMON_PROHIBITED_ATTRS, ...HEIGHT_ATTRS],
|
|
407
|
-
};
|
|
408
|
-
exports.MOBILE_RULESET_MAP = MOBILE_RULESET_MAP;
|
|
409
|
-
const BAR_STYLE_RULESET_MAP = {
|
|
410
|
-
Tabs: [
|
|
411
|
-
...PADDING_ATTRS,
|
|
412
|
-
...BORDER_ATTRS,
|
|
413
|
-
...TEXT_ATTRS,
|
|
414
|
-
...SHADOW_ATTRS,
|
|
415
|
-
...WIDTH_ATTRS,
|
|
416
|
-
...HEIGHT_ATTRS,
|
|
417
|
-
...MARGIN_ATTRS,
|
|
418
|
-
],
|
|
419
|
-
'Tabs.Scroll': [
|
|
420
|
-
...PADDING_ATTRS,
|
|
421
|
-
...BORDER_ATTRS,
|
|
422
|
-
...TEXT_ATTRS,
|
|
423
|
-
...SHADOW_ATTRS,
|
|
424
|
-
...WIDTH_ATTRS,
|
|
425
|
-
...HEIGHT_ATTRS,
|
|
426
|
-
...MARGIN_ATTRS,
|
|
427
|
-
],
|
|
428
|
-
};
|
|
429
|
-
exports.BAR_STYLE_RULESET_MAP = BAR_STYLE_RULESET_MAP;
|
|
430
|
-
const CONTAINER_STYLE_RULESET_MAP = {
|
|
431
|
-
Tabs: [
|
|
432
|
-
...BORDER_ATTRS,
|
|
433
|
-
...TEXT_ATTRS,
|
|
434
|
-
...SHADOW_ATTRS,
|
|
435
|
-
...WIDTH_ATTRS,
|
|
436
|
-
...HEIGHT_ATTRS,
|
|
437
|
-
...MARGIN_ATTRS,
|
|
438
|
-
],
|
|
439
|
-
'Tabs.Scroll': [
|
|
440
|
-
...BORDER_ATTRS,
|
|
441
|
-
...TEXT_ATTRS,
|
|
442
|
-
...SHADOW_ATTRS,
|
|
443
|
-
...WIDTH_ATTRS,
|
|
444
|
-
...HEIGHT_ATTRS,
|
|
445
|
-
...MARGIN_ATTRS,
|
|
446
|
-
],
|
|
447
|
-
};
|
|
448
|
-
exports.CONTAINER_STYLE_RULESET_MAP = CONTAINER_STYLE_RULESET_MAP;
|
|
449
|
-
const TEXT_STYLE_RULESET_MAP = {
|
|
450
|
-
'Toolbar.Message': [
|
|
451
|
-
...COMMON_PROHIBITED_ATTRS,
|
|
452
|
-
...WIDTH_ATTRS,
|
|
453
|
-
...HEIGHT_ATTRS,
|
|
454
|
-
...MARGIN_ATTRS,
|
|
455
|
-
],
|
|
456
|
-
TextInput: [
|
|
457
|
-
...PADDING_ATTRS,
|
|
458
|
-
...BORDER_ATTRS,
|
|
459
|
-
...SHADOW_ATTRS,
|
|
460
|
-
...TEXT_ATTRS,
|
|
461
|
-
...HEIGHT_ATTRS,
|
|
462
|
-
],
|
|
463
|
-
'Search.OneLine': [
|
|
464
|
-
...COMMON_PROHIBITED_ATTRS,
|
|
465
|
-
...WIDTH_ATTRS,
|
|
466
|
-
...HEIGHT_ATTRS,
|
|
467
|
-
...MARGIN_ATTRS,
|
|
468
|
-
],
|
|
469
|
-
};
|
|
470
|
-
exports.TEXT_STYLE_RULESET_MAP = TEXT_STYLE_RULESET_MAP;
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import * as recast from 'recast';
|
|
2
|
-
import type { InlineStyleProps } from './reportInlineStyle';
|
|
3
|
-
import type { CompoundMobileComponentName, MobileComponentName } from './types';
|
|
4
|
-
declare const reportCustomProperties: (ast: recast.types.ASTNode, componentList: {
|
|
5
|
-
[k: string]: MobileComponentName;
|
|
6
|
-
}, commentList: {
|
|
7
|
-
styleCmts: {
|
|
8
|
-
loc: number;
|
|
9
|
-
comment: string;
|
|
10
|
-
}[];
|
|
11
|
-
}) => {
|
|
12
|
-
style: number[];
|
|
13
|
-
barStyle: number[];
|
|
14
|
-
containerStyle: number[];
|
|
15
|
-
textStyle: number[];
|
|
16
|
-
violatingAttributes: {
|
|
17
|
-
attributeName: string;
|
|
18
|
-
attributeValue: string | null;
|
|
19
|
-
inlineStyleProps: InlineStyleProps;
|
|
20
|
-
componentName: CompoundMobileComponentName;
|
|
21
|
-
loc: number | undefined;
|
|
22
|
-
}[];
|
|
23
|
-
};
|
|
24
|
-
export default reportCustomProperties;
|
|
@@ -1,193 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
-
var ownKeys = function(o) {
|
|
20
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
-
var ar = [];
|
|
22
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
-
return ar;
|
|
24
|
-
};
|
|
25
|
-
return ownKeys(o);
|
|
26
|
-
};
|
|
27
|
-
return function (mod) {
|
|
28
|
-
if (mod && mod.__esModule) return mod;
|
|
29
|
-
var result = {};
|
|
30
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
-
__setModuleDefault(result, mod);
|
|
32
|
-
return result;
|
|
33
|
-
};
|
|
34
|
-
})();
|
|
35
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
36
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
|
-
};
|
|
38
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
const recast = __importStar(require("recast"));
|
|
40
|
-
const reportInlineStyle_1 = __importDefault(require("./reportInlineStyle"));
|
|
41
|
-
const mapViolatingAttributesAndAdditionalProps = (violatingAttributes) => {
|
|
42
|
-
return violatingAttributes.map((violatingAttribute) => (Object.assign({}, violatingAttribute)));
|
|
43
|
-
};
|
|
44
|
-
const getNonApprovedInlineLocs = (reportedLocs, violatingAttributes, approvedCmts, elementLoc) => {
|
|
45
|
-
var _a, _b;
|
|
46
|
-
const approvedCmt = approvedCmts.find((cmt) => cmt.loc === elementLoc - 1);
|
|
47
|
-
if (approvedCmt) {
|
|
48
|
-
const approvedCmtAttrNames = (_b = (_a = approvedCmt.comment
|
|
49
|
-
.toLowerCase()
|
|
50
|
-
.replace(/\s+/g, '')
|
|
51
|
-
.split('attributes:')[1]) === null || _a === void 0 ? void 0 : _a.split(',')) !== null && _b !== void 0 ? _b : [];
|
|
52
|
-
const noneApprovedStyleAttributes = violatingAttributes.filter((attr) => attr.loc === reportedLocs.style &&
|
|
53
|
-
!approvedCmtAttrNames.includes(attr.attributeName.toLowerCase()));
|
|
54
|
-
const nonApprovedBarStyleAttributes = violatingAttributes.filter((attr) => attr.loc === reportedLocs.barStyle &&
|
|
55
|
-
!approvedCmtAttrNames.includes(attr.attributeName.toLowerCase()));
|
|
56
|
-
const nonApprovedContainerStyleAttributes = violatingAttributes.filter((attr) => attr.loc === reportedLocs.containerStyle &&
|
|
57
|
-
!approvedCmtAttrNames.includes(attr.attributeName.toLowerCase()));
|
|
58
|
-
const nonApprovedTextStyleAttributes = violatingAttributes.filter((attr) => attr.loc === reportedLocs.textStyle &&
|
|
59
|
-
!approvedCmtAttrNames.includes(attr.attributeName.toLowerCase()));
|
|
60
|
-
if (noneApprovedStyleAttributes.length > 0) {
|
|
61
|
-
return {
|
|
62
|
-
reportedLocs,
|
|
63
|
-
noneApprovedAttributes: [
|
|
64
|
-
...noneApprovedStyleAttributes,
|
|
65
|
-
...nonApprovedBarStyleAttributes,
|
|
66
|
-
...nonApprovedContainerStyleAttributes,
|
|
67
|
-
...nonApprovedTextStyleAttributes,
|
|
68
|
-
],
|
|
69
|
-
};
|
|
70
|
-
}
|
|
71
|
-
return { reportedLocs: {}, noneApprovedAttributes: [] };
|
|
72
|
-
}
|
|
73
|
-
return { reportedLocs, noneApprovedAttributes: violatingAttributes };
|
|
74
|
-
};
|
|
75
|
-
const reportCustomProperties = (ast, componentList, commentList) => {
|
|
76
|
-
const report = {
|
|
77
|
-
style: [],
|
|
78
|
-
barStyle: [],
|
|
79
|
-
containerStyle: [],
|
|
80
|
-
textStyle: [],
|
|
81
|
-
violatingAttributes: [],
|
|
82
|
-
};
|
|
83
|
-
const localComponentList = Object.keys(componentList);
|
|
84
|
-
recast.visit(ast, {
|
|
85
|
-
visitJSXOpeningElement(path) {
|
|
86
|
-
this.traverse(path);
|
|
87
|
-
// Case 1: Custom default component, e.g. <Button />
|
|
88
|
-
if (path.value.name.type === 'JSXIdentifier' &&
|
|
89
|
-
localComponentList.includes(path.value.name.name)) {
|
|
90
|
-
const attributes = path.value
|
|
91
|
-
.attributes;
|
|
92
|
-
const { locs: styleObjectLocs, violatingAttributes } = (0, reportInlineStyle_1.default)(ast, attributes, componentList[path.value.name.name]);
|
|
93
|
-
const { reportedLocs, noneApprovedAttributes } = getNonApprovedInlineLocs(styleObjectLocs, violatingAttributes, commentList.styleCmts, path.value.loc.start.line);
|
|
94
|
-
if (reportedLocs.style) {
|
|
95
|
-
report.style.push(reportedLocs.style);
|
|
96
|
-
}
|
|
97
|
-
if (reportedLocs.barStyle) {
|
|
98
|
-
report.style.push(reportedLocs.barStyle);
|
|
99
|
-
}
|
|
100
|
-
if (reportedLocs.containerStyle) {
|
|
101
|
-
report.style.push(reportedLocs.containerStyle);
|
|
102
|
-
}
|
|
103
|
-
if (reportedLocs.textStyle) {
|
|
104
|
-
report.style.push(reportedLocs.textStyle);
|
|
105
|
-
}
|
|
106
|
-
report.violatingAttributes = [
|
|
107
|
-
...report.violatingAttributes,
|
|
108
|
-
...mapViolatingAttributesAndAdditionalProps(noneApprovedAttributes),
|
|
109
|
-
];
|
|
110
|
-
}
|
|
111
|
-
// Case 2: Custom compound component, e.g. <Button.Icon />
|
|
112
|
-
if (path.value.name.type === 'JSXMemberExpression' &&
|
|
113
|
-
localComponentList.includes(path.value.name.object.name)) {
|
|
114
|
-
const compoundComponentName = [
|
|
115
|
-
componentList[path.value.name.object.name],
|
|
116
|
-
path.value.name.property.name,
|
|
117
|
-
].join('.');
|
|
118
|
-
const attributes = path.value
|
|
119
|
-
.attributes;
|
|
120
|
-
const { locs: styleObjectLocs, violatingAttributes } = (0, reportInlineStyle_1.default)(ast, attributes, compoundComponentName);
|
|
121
|
-
const { reportedLocs, noneApprovedAttributes } = getNonApprovedInlineLocs(styleObjectLocs, violatingAttributes, commentList.styleCmts, path.value.loc.start.line);
|
|
122
|
-
if (reportedLocs.style) {
|
|
123
|
-
report.style.push(reportedLocs.style);
|
|
124
|
-
}
|
|
125
|
-
if (reportedLocs.barStyle) {
|
|
126
|
-
report.style.push(reportedLocs.barStyle);
|
|
127
|
-
}
|
|
128
|
-
if (reportedLocs.containerStyle) {
|
|
129
|
-
report.style.push(reportedLocs.containerStyle);
|
|
130
|
-
}
|
|
131
|
-
if (reportedLocs.textStyle) {
|
|
132
|
-
report.style.push(reportedLocs.textStyle);
|
|
133
|
-
}
|
|
134
|
-
report.violatingAttributes = [
|
|
135
|
-
...report.violatingAttributes,
|
|
136
|
-
...mapViolatingAttributesAndAdditionalProps(noneApprovedAttributes),
|
|
137
|
-
];
|
|
138
|
-
}
|
|
139
|
-
},
|
|
140
|
-
// Case 3: Custom compound component with spead operator. e.g. const { Icon } = Button, then <Button />
|
|
141
|
-
visitVariableDeclaration(path) {
|
|
142
|
-
this.traverse(path);
|
|
143
|
-
const declaration = path.value
|
|
144
|
-
.declarations[0];
|
|
145
|
-
if (declaration.init &&
|
|
146
|
-
declaration.init.type === 'Identifier' &&
|
|
147
|
-
localComponentList.includes(declaration.init.name)) {
|
|
148
|
-
const componentName = declaration.init.name;
|
|
149
|
-
const { id } = declaration;
|
|
150
|
-
if (id.type === 'ObjectPattern') {
|
|
151
|
-
const compoundComponentNames = id.properties
|
|
152
|
-
.map((prop) => prop.type === 'ObjectProperty' && prop.key.type === 'Identifier'
|
|
153
|
-
? prop.key.name
|
|
154
|
-
: null)
|
|
155
|
-
.filter((name) => name !== null);
|
|
156
|
-
recast.visit(ast, {
|
|
157
|
-
visitJSXOpeningElement(openPath) {
|
|
158
|
-
this.traverse(openPath);
|
|
159
|
-
if (openPath.value.name.type === 'JSXIdentifier' &&
|
|
160
|
-
compoundComponentNames.includes(openPath.value.name.name)) {
|
|
161
|
-
const compoundComponentName = [
|
|
162
|
-
componentList[componentName],
|
|
163
|
-
openPath.value.name.name,
|
|
164
|
-
].join('.');
|
|
165
|
-
const { attributes } = openPath.value;
|
|
166
|
-
const { locs: styleObjectLocs, violatingAttributes } = (0, reportInlineStyle_1.default)(ast, attributes, compoundComponentName);
|
|
167
|
-
const { reportedLocs, noneApprovedAttributes } = getNonApprovedInlineLocs(styleObjectLocs, violatingAttributes, commentList.styleCmts, openPath.value.loc.start.line);
|
|
168
|
-
if (reportedLocs.style) {
|
|
169
|
-
report.style.push(reportedLocs.style);
|
|
170
|
-
}
|
|
171
|
-
if (reportedLocs.barStyle) {
|
|
172
|
-
report.style.push(reportedLocs.barStyle);
|
|
173
|
-
}
|
|
174
|
-
if (reportedLocs.containerStyle) {
|
|
175
|
-
report.style.push(reportedLocs.containerStyle);
|
|
176
|
-
}
|
|
177
|
-
if (reportedLocs.textStyle) {
|
|
178
|
-
report.style.push(reportedLocs.textStyle);
|
|
179
|
-
}
|
|
180
|
-
report.violatingAttributes = [
|
|
181
|
-
...report.violatingAttributes,
|
|
182
|
-
...mapViolatingAttributesAndAdditionalProps(noneApprovedAttributes),
|
|
183
|
-
];
|
|
184
|
-
}
|
|
185
|
-
},
|
|
186
|
-
});
|
|
187
|
-
}
|
|
188
|
-
}
|
|
189
|
-
},
|
|
190
|
-
});
|
|
191
|
-
return report;
|
|
192
|
-
};
|
|
193
|
-
exports.default = reportCustomProperties;
|